|
|
|
參閱(See):
15. 選用的程式設計工具詞集(The optional Programming-Tools word set)
This optional word set contains words most often used during the development of applications.
Append table 15.1 to table 3.5.
參閱(See):
3.2.6 環境的詢問(Environmental queries)
表格 15.1 - 環境詢問字串
字串 值 資料型別 常數? 意義 ------ --------------- --------- ------- TOOLS flag no 程式設計工具詞集存在 TOOLS-EXT flag no 程式設計工具延伸詞集存在
Table 15.1 - Environmental query strings
String Value data type Constant? Meaning ------ --------------- --------- ------- TOOLS flag no programming-tools word set present TOOLS-EXT flag no programming-tools extensions word set present
A program using the words CODE or ;CODE associated with assembler code has an environmental dependency on that particular instruction set and assembler notation.
使用 EDITOR 或 ASSEMBLER 這些詞的程式需要 搜尋順序詞集 或一個等價的實作自訂性能.
Programs using the words EDITOR or ASSEMBLER require the Search Order word set or an equivalent implementation-defined capability.
參閱(See):
3.3 Forth 詞典(The Forth dictionary)
The phrase Providing the Programming-Tools word set shall be appended to the label of any Standard System that provides all of the Programming-Tools word set.
措辭 從程式設計工具延伸詞集提供 name(s) 必須被加到任何提供部分程式設計工具延伸詞集的標準系統的描述之中.
The phrase Providing name(s) from the Programming-Tools Extensions word set shall be appended to the label of any Standard System that provides portions of the Programming-Tools Extensions word set.
措辭 提供程式設計工具延伸詞集 必須被加到任何提供所有程式設計工具詞集和程式設計工具延伸詞集的標準系統的描述之中.
The phrase Providing the Programming-Tools Extensions word set shall be appended to the label of any Standard System that provides all of the Programming-Tools and Programming-Tools Extensions word sets.
The phrase Requiring the Programming-Tools word set shall be appended to the label of Standard Programs that require the system to provide the Programming-Tools word set.
措辭 需要程式設計工具延伸詞集中的 name(s) 必須被加到任何需要系統提供部分程式設計工具延伸詞集的標準程式的描述之中.
The phrase Requiring name(s) from the Programming-Tools Extensions word set shall be appended to the label of Standard Programs that require the system to provide portions of the Programming-Tools Extensions word set.
措辭 需要程式設計工具延伸詞集 必須被加到任何需要系統提供所有程式設計工具和程式設計工具延伸詞集的標準程式的描述之中.
The phrase Requiring the Programming-Tools Extensions word set shall be appended to the label of Standard Programs that require the system to provide all of the Programming-Tools and Programming-Tools Extensions word sets.
15.6.1.0220 .S
( -- )
複製並顯示目前在資料堆疊上的值. 這個顯示的格式是實作相依的.
.S 可以用書寫數字輸出詞來實作. 因此它的使用可能會破壞由 #> 識別的暫時的區域.
參閱:
A.15.6.1.0220 .S ,
3.3.3.6 其他暫時的區域.
15.6.1.0220 .S
( -- )
Copy and display the values currently on the data stack. The format of the display is implementation-dependent.
.S may be implemented using pictured numeric output words. Consequently, its use may corrupt the transient region identified by #>.
See:
A.15.6.1.0220 .S ,
3.3.3.6 Other transient regions.
15.6.1.0600 ?
( a-addr -- )
顯示存於 a-addr 之值.
? 可以使用書寫數字輸出詞來實作. 因此它的使用可能會破壞由 #> 識別的暫時的區域.
參閱:
3.3.3.6 其他暫時的區域
15.6.1.0600 ?
( a-addr -- )
Display the value stored at a-addr.
? may be implemented using pictured numeric output words. Consequently, its use may corrupt the transient region identified by #>.
See:
3.3.3.6 Other transient regions
15.6.1.1280 DUMP
( addr u -- )
顯示開始於 addr 位址的 u 個連續不斷的位址的內容. 這個顯示的格式是實作相依的.
DUMP 可以使用書寫數字輸出詞來實作. 因此它的使用可能會破壞由 #> 識別的暫時的區域.
參閱:
3.3.3.6 其他暫時的區域
15.6.1.1280 DUMP
( addr u -- )
Display the contents of u consecutive addresses starting at addr. The format of the display is implementation dependent.
DUMP may be implemented using pictured numeric output words. Consequently, its use may corrupt the transient region identified by #>.
See:
3.3.3.6 Other transient regions
15.6.1.2194 SEE
( "<spaces>name" -- )
顯示一個人類可讀的名稱詞定義的表示法. 這個表示法的原始碼 (目的碼反編譯, 原始區塊, 等等) 和顯示的特別格式是實作自訂的.
SEE 可以使用書寫數字輸出詞來實作. 因此它的使用可能會破壞由 #> 識別的暫時的區域.
參閱:
3.3.3.6 其他暫時的區域,
A.15.6.1.2194 SEE
15.6.1.2194 SEE
( "<spaces>name" -- )
Display a human-readable representation of the named word's definition. The source of the representation (object-code decompilation, source block, etc.) and the particular form of the display is implementation defined.
SEE may be implemented using pictured numeric output words. Consequently, its use may corrupt the transient region identified by #>.
See:
3.3.3.6 Other transient regions,
A.15.6.1.2194 SEE
15.6.1.2465 WORDS
( -- )
列出在第一個搜尋順序詞列表中的定義名稱. 這個顯示的格式是實作相依的.
WORDS 可以使用書寫數字輸出詞來實作. 因此它的使用可能會破壞由 #> 識別的暫時的區域.
參閱:
3.3.3.6 其他暫時的區域,
A.15.6.1.2465 WORDS
15.6.1.2465 WORDS
( -- )
List the definition names in the first word list of the search order. The format of the display is implementation-dependent.
WORDS may be implemented using pictured numeric output words. Consequently, its use may corrupt the transient region identified by #>.
See:
3.3.3.6 Other transient regions,
A.15.6.1.2465 WORDS
15.6.2.0470 ;CODE
解譯: 這個詞的解譯語義是未定義的.
編譯: ( C: colon-sys -- )
將下列的執行時期語義加入到目前的定義. 結束目前的定義, 允許它在詞典內被找到, 並且進入解譯模式, 用掉 colon-sys.
在分析區中伴隨發生的字元一般地代表在一個程式設計語言中的原始碼, 通常是組合語言的一些格式. 這些字元是以實作自訂方式來處理, 產生對應的機械碼. 這個程序繼續動作, 依需要填滿輸入緩衝區, 直到處理到實作自訂的結束序列.
執行時期: ( -- ) ( R: nest-sys -- )
用下列的 name 執行語義取代最接近的定義的執行語義. 將控制權傳回給由 nest-sys 指定的呼叫定義. 如果最接近的定義不是由 CREATE 或一個呼叫 CREATE 的使用者自訂詞定義時, 會有一個模稜兩可的情況存在.
name 執行: ( i*x -- j*x )
執行由接著 ;CODE 後產生的機器碼序列.
參閱:
A.15.6.2.0470 ;CODE ,
6.1.1250 DOES>
15.6.2.0470 ;CODE
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: colon-sys -- )
Append the run-time semantics below to the current definition. End the current definition, allow it to be found in the dictionary, and enter interpretation state, consuming colon-sys.
Subsequent characters in the parse area typically represent source code in a programming language, usually some form of assembly language. Those characters are processed in an implementation-defined manner, generating the corresponding machine code. The process continues, refilling the input buffer as needed, until an implementation-defined ending sequence is processed.
Run-time: ( -- ) ( R: nest-sys -- )
Replace the execution semantics of the most recent definition with the name execution semantics given below. Return control to the calling definition specified by nest-sys. An ambiguous condition exists if the most recent definition was not defined with CREATE or a user-defined word that calls CREATE.
name Execution: ( i*x -- j*x )
Perform the machine code sequence that was generated following ;CODE.
See:
A.15.6.2.0470 ;CODE ,
6.1.1250 DOES>
15.6.2.0702 AHEAD
解譯: 這個詞的解譯語義是未定義的.
編譯: ( C: -- orig )
將一個新的、未解析出的向前參考 orig 放進流程控制堆疊中.
將下列的執行時期語義加進目前的定義.
這個語義在 orig 被解析出之前都是未完全的 (例如, 由
THEN).
執行時期: ( -- )
繼續執行由 orig 決議指定的位置.
15.6.2.0702 AHEAD
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: -- orig )
Put the location of a new unresolved forward reference orig onto the
control flow stack. Append the run-time semantics given below to the
current definition. The semantics are incomplete until orig is resolved
(e.g., by
THEN).
Run-time: ( -- )
Continue execution at the location specified by the resolution of orig.
15.6.2.0740 ASSEMBLER
( -- )
將在搜尋順序中的第一個詞列表換成 ASSEMBLER 詞列表.
參閱:
16. 選用的搜尋順序詞集
15.6.2.0740 ASSEMBLER
( -- )
Replace the first word list in the search order with the ASSEMBLER word list.
See:
16. The optional Search-Order word set
15.6.2.0830 BYE
( -- )
如果有主作業系統時, 將控制權交回給它.
15.6.2.0830 BYE
( -- )
Return control to the host operating system, if any.
15.6.2.0930 CODE
( "<spaces>name" -- )
跳過開頭的空白分界符號. 分析由一個空白分析出的 name. 為 name 創造一個定義, 叫做一個 碼定義, 它有下列的執行語義.
在分析區中伴隨發生的字元一般地代表在一個程式設計語言中的原始碼, 通常是組合語言的一些格式. 這些字元是以實作自訂方式來處理, 產生對應的機械碼. 這個程序繼續動作, 依需要填滿輸入緩衝區, 直到處理到實作自訂的結束序列.
name 執行: ( i*x -- j*x )
執行由接著 CODE 後產生的機器碼序列.
參閱:
A.15.6.2.0930 CODE ,
3.4.1 分析.
15.6.2.0930 CODE
( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name, called a code definition, with the execution semantics defined below.
Subsequent characters in the parse area typically represent source code in a programming language, usually some form of assembly language. Those characters are processed in an implementation-defined manner, generating the corresponding machine code. The process continues, refilling the input buffer as needed, until an implementation-defined ending sequence is processed.
name Execution: ( i*x -- j*x )
Execute the machine code sequence that was generated following CODE.
See:
A.15.6.2.0930 CODE ,
3.4.1 Parsing.
15.6.2.1015 CS-PICK
解譯: 這個詞的解譯語義是未定義的.
執行: ( C: destu ... orig0|dest0 -- destu ... orig0|dest0 destu )( S: u -- )
移除 u. 複製 destu 到流程控制堆疊的最上方. 如果有小於 u+1 個元素存在, 將會有模稜兩可的情況存在, 每一個元素必須是 orig 或 dest, 在 CS-PICK 被執行前在流程控制堆疊上.
如果流程控制堆疊是用資料堆疊實作時, u 必須是在資料堆疊最上方的元素.
15.6.2.1015 CS-PICK
Interpretation: Interpretation semantics for this word are undefined.
Execution: ( C: destu ... orig0|dest0 -- destu ... orig0|dest0 destu )( S: u -- )
Remove u. Copy destu to the top of the control-flow stack. An ambiguous condition exists if there are less than u+1 items, each of which shall be an orig or dest, on the control-flow stack before CS-PICK is executed.
If the control-flow stack is implemented using the data stack, u shall be the topmost item on the data stack.
15.6.2.1020 CS-ROLL
解譯: 這個詞的解譯語義是未定義的.
執行: ( C: origu|destu origu-1|destu-1 ... orig0|dest0 --
origu-1|destu-1 ... orig0|dest0 origu|destu )( S: u -- )
移除 u. 旋轉 u+1 個元素使得 origu|destu 到流程控制堆疊的最上方. 如果有小於 u+1 個元素存在, 將會有模稜兩可的情況存在, 每一個元素必須是 orig 或 dest, 在 CS-ROLL 被執行前在流程控制堆疊上.
如果流程控制堆疊是用資料堆疊實作時, u 必須是在資料堆疊最上方的元素.
15.6.2.1020 CS-ROLL
Interpretation: Interpretation semantics for this word are undefined.
Execution: ( C: origu|destu origu-1|destu-1 ... orig0|dest0 --
origu-1|destu-1 ... orig0|dest0 origu|destu )( S: u -- )
Remove u. Rotate u+1 elements on top of the control-flow stack so that origu|destu is on top of the control-flow stack. An ambiguous condition exists if there are less than u+1 items, each of which shall be an orig or dest, on the control-flow stack before CS-ROLL is executed.
If the control-flow stack is implemented using the data stack, u shall be the topmost item on the data stack.
15.6.2.1300 EDITOR
( -- )
將在搜尋順序中的第一個詞列表換成 EDITOR 詞列表.
參閱:
16. 選用的搜尋順序詞集
15.6.2.1300 EDITOR
( -- )
Replace the first word list in the search order with the EDITOR word list.
See:
16. The Optional Search-Order Word Set
15.6.2.1580 FORGET
( "<spaces>name" -- )
跳過開頭的空白分界符號. 分析由一個空白分析出的 name. 找出 name, 然後從詞典中刪除 name 及所有在詞典中加入於 name 之後的所有詞. 如果 name 找不到時, 將會有模稜兩可的情況存在.
如果搜尋順序詞集存在, FORGET 搜尋編譯詞列表. 如果這個編譯詞列表被刪除時, 將會有模稜兩可的情況存在.
如果 FORGET 移除了一個在目前的執行需要的詞時, 將會有模稜兩可的情況存在.
注意: 這個詞是過時的, 並且是對於已存在的實作的妥協.
參閱:
A.15.6.2.1580 FORGET ,
3.4.1 分析,
6.2.1850 MARKER
15.6.2.1580 FORGET
( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Find name, then delete name from the dictionary along with all words added to the dictionary after name. An ambiguous condition exists if name cannot be found.
If the Search-Order word set is present, FORGET searches the compilation word list. An ambiguous condition exists if the compilation word list is deleted.
An ambiguous condition exists if FORGET removes a word required for correct execution.
Note: This word is obsolescent and is included as a concession to existing implementations.
See:
A.15.6.2.1580 FORGET ,
3.4.1 Parsing,
6.2.1850 MARKER
15.6.2.2250 STATE
( -- a-addr )
延伸 6.1.2250 STATE 的語義成為允許 ;CODE 來改變 STATE 之值. 一個程式必須不直接改變 STATE 的內容.
參閱:
3.4 Forth 文字解譯器,
6.1.0450 : ,
6.1.0460 ; ,
6.1.0670 ABORT ,
6.1.2050 QUIT ,
6.1.2500 [ ,
6.1.2540 ] ,
6.2.0455 :NONAME
15.6.2.2250 STATE
( -- a-addr )
Extend the semantics of 6.1.2250 STATE to allow ;CODE to change the value in STATE. A program shall not directly alter the contents of STATE.
See:
3.4 The Forth text interpreter,
6.1.0450 : ,
6.1.0460 ; ,
6.1.0670 ABORT ,
6.1.2050 QUIT ,
6.1.2500 [ ,
6.1.2540 ] ,
6.2.0455 :NONAME
15.6.2.2531 [ELSE]
編譯: 執行下列給予的執行語義.
執行: ( "<spaces>name" ... -- )
跳過開頭的空白, 分析並丟棄從分析區來的空白分界詞, 包括巢狀的 [IF] ... [THEN] 和 [IF] ... [ELSE] ... [THEN] 的出現, 直到詞 [THEN] 被分析和丟棄. 如果分析區被用盡了, 它將會被用 REFILL 來重新填滿. [ELSE] 是一個立即詞.
參閱:
3.4.1 分析,
A.15.6.2.2531 [ELSE]
15.6.2.2531 [ELSE]
Compilation: Perform the execution semantics given below.
Execution: ( "<spaces>name" ... -- )
Skipping leading spaces, parse and discard space-delimited words from the parse area, including nested occurrences of [IF] ... [THEN] and [IF] ... [ELSE] ... [THEN], until the word [THEN] has been parsed and discarded. If the parse area becomes exhausted, it is refilled as with REFILL. [ELSE] is an immediate word.
See:
3.4.1 Parsing,
A.15.6.2.2531 [ELSE]
15.6.2.2532 [IF]
編譯: 執行下列給予的執行語義.
執行: ( flag | flag "<spaces>name" ... -- )
如果 flag 為真, 不做任何事. 否則跳過開頭的空白, 分析並丟棄從分析區來的空白分界詞, 包括巢狀的 [IF] ... [THEN] 和 [IF] ... [ELSE] ... [THEN] 的出現, 直到詞 [ELSE] 或 [THEN] 被分析和丟棄. 如果分析區被用盡了, 它將會被用 REFILL 來重新填滿. [IF] 是一個立即詞.
如果 [IF] 被 POSTPONE , 或達到輸入緩衝區的結束, 並且不能在重新填滿結束前分析到 [ELSE] 或 [THEN], 將會有一個模稜兩可的情況存在.
參閱:
3.4.1 分析,
A.15.6.2.2532 [IF]
15.6.2.2532 [IF]
Compilation: Perform the execution semantics given below.
Execution: ( flag | flag "<spaces>name" ... -- )
If flag is true, do nothing. Otherwise, skipping leading spaces, parse and discard space-delimited words from the parse area, including nested occurrences of [IF] ... [THEN] and [IF] ... [ELSE] ... [THEN], until either the word [ELSE] or the word [THEN] has been parsed and discarded. If the parse area becomes exhausted, it is refilled as with REFILL. [IF] is an immediate word.
An ambiguous condition exists if [IF] is POSTPONEd, or if the end of the input buffer is reached and cannot be refilled before the terminating [ELSE] or [THEN] is parsed.
See:
3.4.1 Parsing,
A.15.6.2.2532 [IF]
15.6.2.2533 [THEN]
編譯: 執行下列給予的執行語義.
執行: ( -- )
不做任何事. [THEN] 是一個立即詞.
15.6.2.2533 [THEN]
Compilation: Perform the execution semantics given below.
Execution: ( -- )
Does nothing. [THEN] is an immediate word.
See:
A.15.6.2.2533 [THEN]
內容列表(Table of Contents)
下一章(Next Section)