4. 文件需求(Documentation requirements)
當一個系統或程式不可能或不能實行定義一個特別的表現時, 允許將這個表現
聲明為不可預期的並解釋為何會如此的情況及理由.
When it is impossible or infeasible for a system or program to define a
particular behavior itself, it is permissible to state that the behavior
is unspecifiable and to explain the circumstances and reasons why this is so.
4.1 系統文件(System documentation)
4.1.1 實作自訂選項(Implementation-defined options)
在下列列表的實作自訂選項元素敘述了特色和留給實作者判斷的自由來選擇,
提供符合標準的需求. 一個系統必須為每一個元素提供文件說明評價或是表現的方式.
The implementation-defined items in the following list represent
characteristics and choices left to the discretion of the implementor,
provided that the requirements of this Standard are met. A system shall
document the values for, or behaviors of, each item.
- 對齊的位址需求
(3.1.3.3 位址);
- 對於非書寫文字
6.1.1320 EMIT 的行為;
- 6.1.0695 ACCEPT 和
6.2.1390 EXPECT 的字元編輯;
- 字元集合
(3.1.2 字元型別,
6.1.1320 EMIT,
6.1.1750 KEY);
- 字元對齊的位址需求
(3.1.3.3 位址);
- 字元延伸集匹配特質
(3.4.2 找出定義名稱);
- 哪一個控制字元匹配一個空白分界字元
(3.4.1.1 分界字元);
- 流程控制堆疊的格式
(3.2.3.2 流程控制堆疊);
- 轉換大於三十五的數字
(3.2.1.2 數字轉換);
- 在 6.1.0695 ACCEPT 和
6.2.1390 EXPECT 輸入中止後顯示;
- 例外中止流程 (就是 6.1.0680 ABORT");
- 輸入行終結符號
(3.2.4.1 使用者輸入裝置);
- 一個計數字串的最大大小, 以字元為單位
(3.1.3.4 計數字串,
6.1.2450 WORD);
- 一個分析過的字串的最大大小
(3.4.1 分析);
- 一個定義名稱的最大大小, 以字元為單位
(3.3.1.2 定義名稱
);
-
6.1.1345 ENVIRONMENT? 的最大字串長度
, 以字元為單位;
- 選擇
3.2.4.1 使用者輸入裝置的方法;
- 選擇
3.2.4.2 使用者輸出裝置的方法;
- 詞典編譯的方法
(3.3 Forth 詞典);
- 一個位址單元有多少位元數目
(3.1.3.3 位址);
- 數字的展現及算術
(3.2.1.1 內部數字展現);
- n, +n, u, d, +d, 和 ud 的範圍
(3.1.3 單一單元型別,
3.1.4 雙單元型別);
- 唯讀資料空間區域
(3.3.3 資料空間);
-
6.1.2450 WORD 的緩衝區大小
(3.3.3.6 其他暫時的區域);
- 在位址單位中一個單元的大小
(3.1.3 單一單元型別);
- 在位址單位中一個字元的大小
(3.1.2 字元型別);
- 鍵盤輸入緩衝區的大小
(3.3.3.5 輸入緩衝區);
- 書寫數字輸出字串緩衝區的大小
(3.3.3.6 其他暫時的區域);
- 由 6.2.2000 PAD 傳回的隨機區的大小
(3.3.3.6 其他暫時的區域);
- 系統大小寫敏感性特質
(3.4.2 搜尋定義名稱);
- 系統提示符號
(3.4 Forth 文字解譯器,
6.1.2050 QUIT);
- 除法四捨五入
(3.2.2.1 整數除法,
6.1.0100 */,
6.1.0110 */MOD,
6.1.0230 /,
6.1.0240 /MOD,
6.1.1890 MOD);
- 為真時
6.1.2250 STATE 的數值;
- 算術溢位後傳回的數值
(3.2.2.2 其他整數操作);
- 是否目前的定義可以在
6.1.1250 DOES>
(6.1.0450 :) 之後被找到.
- aligned address requirements
(3.1.3.3 Addresses);
- behavior of
6.1.1320 EMIT for non-graphic characters;
- character editing of
6.1.0695 ACCEPT and
6.2.1390 EXPECT;
- character set
(3.1.2 Character types,
6.1.1320 EMIT,
6.1.1750 KEY);
- character-aligned address requirements
(3.1.3.3 Addresses);
- character-set-extensions matching characteristics
(3.4.2 Finding
definition names);
- conditions under which control characters match a space delimiter
(3.4.1.1 Delimiters);
- format of the control-flow stack
(3.2.3.2 Control-flow stack);
- conversion of digits larger than thirty-five
(3.2.1.2 Digit
conversion);
- display after input terminates in
6.1.0695 ACCEPT and
6.2.1390 EXPECT;
- exception abort sequence (as in
6.1.0680 ABORT");
- input line terminator
(3.2.4.1 User input device);
- maximum size of a counted string, in characters
(3.1.3.4 Counted
strings,
6.1.2450 WORD);
- maximum size of a parsed string
(3.4.1 Parsing);
- maximum size of a definition name, in characters
(3.3.1.2 Definition
names);
- maximum string length for
6.1.1345 ENVIRONMENT?, in characters;
- method of selecting
3.2.4.1 User input device;
- method of selecting
3.2.4.2 User output device;
- methods of dictionary compilation
(3.3 The Forth dictionary);
- number of bits in one address unit
(3.1.3.3 Addresses);
- number representation and arithmetic
(3.2.1.1 Internal number
representation);
- ranges for n, +n, u, d, +d, and ud
(3.1.3 Single-cell types,
3.1.4 Cell-pair types);
- read-only data-space regions
(3.3.3 Data space);
- size of buffer at
6.1.2450 WORD
(3.3.3.6 Other transient regions);
- size of one cell in address units
(3.1.3 Single-cell types);
- size of one character in address units
(3.1.2 Character types);
- size of the keyboard terminal input buffer
(3.3.3.5 Input buffers);
- size of the pictured numeric output string buffer
(3.3.3.6 Other
transient regions);
- size of the scratch area whose address is returned by
6.2.2000 PAD
(3.3.3.6 Other transient regions);
- system case-sensitivity characteristics
(3.4.2 Finding definition
names);
- system prompt
(3.4 The Forth text interpreter,
6.1.2050 QUIT);
- type of division rounding
(3.2.2.1 Integer division,
6.1.0100 */,
6.1.0110 */MOD,
6.1.0230 /,
6.1.0240 /MOD,
6.1.1890 MOD);
- values of
6.1.2250 STATE when true;
- values returned after arithmetic overflow
(3.2.2.2 Other integer
operations);
- whether the current definition can be found after
6.1.1250 DOES>
(6.1.0450 :).
4.1.2 模稜兩可的情況(Ambiguous conditions)
一個系統必須註釋每一個標準識別為一般或特別的模稜兩可的情況下的系統動作.
參閱 3.4.4 在一個模稜兩可的情況中的可能動作.
A system shall document the system action taken upon each of the general or
specific ambiguous conditions identified in this Standard. See
3.4.4 Possible
actions on an ambiguous condition.
下列的一般的模稜兩可的情況可以因為一些組合的因素而出現.
The following general ambiguous conditions could occur because of a
combination of factors:
- 在文字解譯時一個名字不是一個正確的定義名稱也不是一個正確的數字
(3.4 Forth 文字解譯器);
- 一個定義名稱超過了最大允許長度
(3.3.1.2
定義名稱);
- 定址一個未列於
3.3.3 資料空間 的區域;
- 參數型別不相容於特定的輸入參數, 例如傳一個旗標給一個期望收到 n 的詞
(3.1 資料型別);
- 嘗試去獲得一個有未定義的解譯語義的定義的執行記號
(例如, 使用
6.1.0070 ',
6.1.1550 FIND,
等等);
- 除以零
(6.1.0100 */,
6.1.0110 */MOD,
6.1.0230 /,
6.1.0240 /MOD,
6.1.1561 FM/MOD,
6.1.1890 MOD,
6.1.2214 SM/REM,
6.1.2370 UM/MOD,
8.6.1.1820 M*/);
- 無效的資料堆疊空間或返回堆疊空間 (堆疊溢位);
- 無效的迴圈控制空間;
- 詞典中無效的空間;
- 使用未定義的語義來解譯一個詞;
- 修改輸入緩衝區的內容或是一個文字字串
(3.3.3.4 文字區域,
3.3.3.5 輸入緩衝區);
- 一個書寫數字輸出字串溢位;
- 分析過的字串溢位;
- 產生一個超過範圍的結果, 例如, 乘法 (使用 *) 產生了一個
超過由一個單一單元整數表現的數值
(6.1.0090 *,
6.1.0100 */,
6.1.0110 */MOD,
6.1.0570 >NUMBER,
6.1.1561 FM/MOD,
6.1.2214 SM/REM,
6.1.2370 UM/MOD,
6.2.0970 CONVERT,
8.6.1.1820 M*/);
- 從一個空的資料或返回堆疊讀取(堆疊不足);
- 非預期的輸入緩衝區結束, 導致一個使用一個零長度字串作為一個名字的嘗試;
- a name is neither a valid definition name nor a valid number during
text interpretation
(3.4 The Forth text interpreter);
- a definition name exceeded the maximum length allowed
(3.3.1.2
Definition names);
- addressing a region not listed in
3.3.3 Data Space;
- argument type incompatible with specified input parameter, e.g.,
passing a flag to a word expecting an n
(3.1 Data types);
- attempting to obtain the execution token, (e.g., with
6.1.0070 ',
6.1.1550 FIND,
etc.) of a definition with undefined interpretation semantics;
- dividing by zero
(6.1.0100 */,
6.1.0110 */MOD,
6.1.0230 /,
6.1.0240 /MOD,
6.1.1561 FM/MOD,
6.1.1890 MOD,
6.1.2214 SM/REM,
6.1.2370 UM/MOD,
8.6.1.1820 M*/);
- insufficient data-stack space or return-stack space (stack overflow);
- insufficient space for loop-control parameters;
- insufficient space in the dictionary;
- interpretating a word with undefined interpretation semantics;
- modifying the contents of the input buffer or a string literal
(3.3.3.4 Text-literal regions,
3.3.3.5 Input buffers);
- overflow of a pictured numeric output string;
- parsed string overflow;
- producing a result out of range, e.g., multiplication (using *)
results in a value too big to be represented by a single-cell integer
(6.1.0090 *,
6.1.0100 */,
6.1.0110 */MOD,
6.1.0570 >NUMBER,
6.1.1561 FM/MOD,
6.1.2214 SM/REM,
6.1.2370 UM/MOD,
6.2.0970 CONVERT,
8.6.1.1820 M*/);
- reading from an empty data stack or return stack (stack underflow);
- unexpected end of input buffer, resulting in an attempt to use a
zero-length string as a name;
下列的特別的模稜兩可的情況是注明在詞彙表記錄的相關的詞中:
The following specific ambiguous conditions are noted in the glossary entries
of the relevant words:
-
>IN
大於輸入緩衝區的大小
(3.4.1 分析);
-
6.1.2120 RECURSE 在
6.1.1250 DOES> 後出現;
- 6.2.2148 RESTORE-INPUT
用的參數輸入來源不同於目前的輸入來源;
- 包含定義的資料空間被釋放
(3.3.3.2 連續的區域);
- 以不正確的對齊方式讀寫資料空間
(3.3.3.1 位址對齊);
- 資料空間指標沒有適當地對齊
(6.1.0150 ,,
6.1.0860 C,);
- 小於 u + 2 個堆疊元素
(6.2.2030 PICK,
6.2.2150 ROLL);
- 不提供迴圈控制參數 (
6.1.0140 +LOOP,
6.1.1680 I,
6.1.1730 J,
6.1.1760 LEAVE,
6.1.1800 LOOP,
6.1.2380 UNLOOP);
- 最近的定義沒有一個名稱
(6.1.1710 IMMEDIATE);
- 由
6.2.2295 TO 使用的名稱未由
6.2.2405 VALUE 定義;
- 找不到名稱
(6.1.0070 ',
6.1.2033 POSTPONE,
6.1.2510 ['],
6.2.2530 [COMPILE]);
- 參數不是相同的型別
(6.1.1240 DO,
6.2.0620 ?DO,
6.2.2440 WITHIN);
-
6.1.2033 POSTPONE 或
6.2.2530 [COMPILE] 使用於
6.2.2295 TO;
-
6.1.2450 WORD
傳回一個長於計數字串的字串
;
- u 大於或等於一個單元中的位元數目
(6.1.1805 LSHIFT,
6.1.2162 RSHIFT);
- 未透過
6.1.1000 CREATE
(6.1.0550 >BODY,
6.1.1250 DOES>) 定義的詞;
- 不適當地在
6.1.0490 <# 和
6.1.0040 #>
(6.1.0030 #,
6.1.0050 #S,
6.1.1670 HOLD,
6.1.2210 SIGN) 之外使用詞.
-
>IN
greater than size of input buffer
(3.4.1 Parsing);
-
6.1.2120 RECURSE appears after
6.1.1250 DOES>;
- argument input source different than current input source for
6.2.2148 RESTORE-INPUT;
- data space containing definitions is de-allocated
(3.3.3.2 Contiguous regions);
- data space read/write with incorrect alignment
(3.3.3.1 Address alignment);
- data-space pointer not properly aligned
(6.1.0150 ,,
6.1.0860 C,);
- less than u+2 stack items
(6.2.2030 PICK,
6.2.2150 ROLL);
- loop-control parameters not available (
6.1.0140 +LOOP,
6.1.1680 I,
6.1.1730 J,
6.1.1760 LEAVE,
6.1.1800 LOOP,
6.1.2380 UNLOOP);
- most recent definition does not have a name
(6.1.1710 IMMEDIATE);
- name not defined by
6.2.2405 VALUE used by
6.2.2295 TO;
- name not found
(6.1.0070 ',
6.1.2033 POSTPONE,
6.1.2510 ['],
6.2.2530 [COMPILE]);
- parameters are not of the same type
(6.1.1240 DO,
6.2.0620 ?DO,
6.2.2440 WITHIN);
-
6.1.2033 POSTPONE or
6.2.2530 [COMPILE] applied to
6.2.2295 TO;
- string longer than a counted string returned by
6.1.2450 WORD;
- u greater than or equal to the number of bits in a cell
(6.1.1805 LSHIFT,
6.1.2162 RSHIFT);
- word not defined via
6.1.1000 CREATE
(6.1.0550 >BODY,
6.1.1250 DOES>);
- words improperly used outside
6.1.0490 <# and
6.1.0040 #>
(6.1.0030 #,
6.1.0050 #S,
6.1.1670 HOLD,
6.1.2210 SIGN).
4.1.3 其他系統文件(Other system documentation)
一個系統必須提供下列資訊:
A system shall provide the following information:
- 使用
6.2.2000 PAD 的非標準詞的列表
(3.3.3.6 其他暫時的區域);
- 操作員的擁有的終端機機能;
- 以位址單元為單位, 提供的程式資料空間;
- 以單元為單位, 提供的返回堆疊空間;
- 以單元為單位, 提供的資料堆疊空間;
- 需要的系統詞典空間, 以位址單元為單位.
- list of non-standard words using
6.2.2000 PAD
(3.3.3.6 Other transient
regions);
- operator's terminal facilities available;
- program data space available, in address units;
- return stack space available, in cells;
- stack space available, in cells;
- system dictionary space required, in address units.
4.2 程式文件(Program documentation)
4.2.1 環境相依性(Environmental dependencies)
一個系統必須註譯當它們使用時下列的環境相依性, 並且必須註譯其他的環境相似性:
A program shall document the following environmental dependencies, where they
apply, and should document other known environmental dependencies:
- considering the pictured numeric output string buffer a fixed area
with unchanging access parameters
(3.3.3.6 Other transient regions);
- depending on the presence or absence of non-graphic characters in a
received string
(6.1.0695 ACCEPT,
6.2.1390 EXPECT);
- relying on a particular rounding direction
(3.2.2.1 Integer division);
- requiring a particular number representation and arithmetic
(3.2.1.1
Internal number representation);
- requiring non-standard words or techniques
(3. Usage requirements);
- requiring the ability to send or receive control characters
(3.1.2.2 Control characters,
6.1.1750 KEY);
- using control characters to perform specific functions
(6.1.1320 EMIT,
6.1.2310 TYPE);
- using flags as arithmetic operands
(3.1.3.1 Flags);
- using lower case for standard definition names or depending on the
case sensitivity of a system
(3.3.1.2 Definition names);
- using the graphic character with a value of hex 24
(3.1.2.1 Graphic
characters).
4.2.2 其他程式文件(Other program documentation)
一個程式也應該為下列方面提供文件:
A program shall also document:
- 最少的操作管理者終端機機能需求;
- 是否在這個程式載入後, 標準系統將會存在.
- minimum operator's terminal facilities required;
- whether a Standard System exists after the program is loaded.
內容列表(Table of Contents)
下一章(Next Section)