內容列表(Table of Contents)


7. 選用的區塊詞集(The optional Block word set)

參閱(See): A.7 選用的區塊詞集(The optional Block word set)

7.1 簡介(Introduction)


7.2 附加的專有名詞(Additional terms)

區塊(block):
在大量儲存裝置的 1024 位元組, 以一個區塊號碼來指派.

1024 characters of data on mass storage, designated by a block number.
區塊緩衝區(block buffer):
一個區塊用來暫時提供使用的一個區塊大小的資料空間區域. 目前的區塊緩衝區是最近由 BLOCK, BUFFER, LOAD, LIST, 或 THRU 存取的區塊緩衝區.

A block-sized region of data space where a block is made temporarily available for use. The current block buffer is the block buffer most recently accessed by BLOCK, BUFFER, LOAD, LIST, or THRU.

參閱(See): A.7.2 附加的專有名詞(Additional terms)


7.3 附加的使用需求(Additional usage requirements)


7.3.1 環境的詢問(Environmental queries)

將表格 7.1 加進表格 3.5.

Append table 7.1 to table 3.5.

參閱(See): 3.2.6 環境的詢問(Environmental queries)

表格 7.1 - 環境詢問字串

字串            值    資料型別   常數?           意義   
------          ---------------  ---------       -------
BLOCK           flag             no              區塊詞集存在           
BLOCK-EXT       flag             no              區塊延伸詞集存在

Table 7.1 - Environmental Query Strings

String          Value data type  Constant?       Meaning
------          ---------------  ---------       -------
BLOCK           flag             no              block word set present
BLOCK-EXT       flag             no              block extensions word set present


7.3.2 資料空間(Data space)

一個程式可以存取在正確的區塊緩衝區中的記憶體.

A program may access memory within a valid block buffer.

參閱(See): 3.3.3 資料空間(Data Space)


7.3.3 區塊緩衝區區域(Block buffer regions)

BLOCKBUFFER 傳回的區塊緩衝區位址是暫時的. 呼叫 BLOCK 或 BUFFER 可以讓先前獲得的區塊緩衝區位址變成不正確的, 就像可以呼叫下列任何詞達到的作用(譯註: 抱歉! 我不確定這一段的意思是否正確地譯出了.):

The address of a block buffer returned by BLOCK or BUFFER is transient. A call to BLOCK or BUFFER may render a previously-obtained block-buffer address invalid, as may a call to any word that:

如果這個輸入來源是一個區塊, 這些限制也適用於 SOURCE 回傳的位址.

If the input source is a block, these restrictions also apply to the address returned by SOURCE .

區塊緩衝區被唯一地指定給區塊.

Block buffers are uniquely assigned to blocks.


7.3.4 分析(Parsing)

區塊詞集為文字解譯器實作了一個替代的輸入來源. 當輸入來源是一個區塊時, BLK 必須包含這個非零的區塊號碼, 而且輸入緩衝區是包含這個區塊的 1024 字元長的緩衝區.

The Block word set implements an alternative input source for the text interpreter. When the input source is a block, BLK shall contain the non-zero block number and the input buffer is the 1024-character buffer containing that block.

一個區塊傳統地顯示為 16 行的 64 字元.

A block is conventionally displayed as 16 lines of 64 characters.

一個程式可以用 LOADTHRU 來切換輸入來源到一個區塊. 輸入來源可以用任意順序來用 LOAD 和 EVALUATE 來巢狀化.

A program may switch the input source to a block by using LOAD or THRU. Input sources may be nested using LOAD and EVALUATE in any order.

一個程式可以用操作 >IN 的方式來改變一個區塊中的分析區的位置 更大規模的改變位置可以用 SAVE-INPUTRESTORE-INPUT 來實行.

A program may reposition the parse area within a block by manipulating >IN. More extensive repositioning can be accomplished using SAVE-INPUT and RESTORE-INPUT.

參閱(See): 3.4.1 分析(Parsing)


7.3.5 在一個模稜兩可的情況時可能的動作(Possible action on an ambiguous condition)

參閱(See): 3.4.4 在一個模稜兩可的情況時可能的動作( Possible action on an ambiguous condition)


7.4 附加的文件需求(Additional documentation requirements)


7.4.1 系統文件(System documentation)


7.4.1.1 實作自訂選項(Implementation-defined options)


7.4.1.2 模稜兩可的情況(Ambiguous conditions)


7.4.1.3 其他的系統文件(Other system documentation)


7.4.2 程式文件(Program documentation)


7.5 遵守標準和命名(Compliance and labeling)


7.5.1 ANS Forth 系統(ANS Forth systems)

措辭 提供區塊詞集 必須被加到任何提供區塊詞集的標準系統的描述之中.

The phrase Providing the Block word set shall be appended to the label of any Standard System that provides all of the Block word set.

措辭 從區塊延伸詞集提供 name(s) 必須被加到任何提供部分區塊延伸詞集的標準系統的描述之中.

The phrase Providing name(s) from the Block Extensions word set shall be appended to the label of any Standard System that provides portions of the Block Extensions word set.

措辭 提供區塊延伸詞集 必須被加到任何提供所有區塊和區塊延伸詞集的標準系統的描述之中.

The phrase Providing the Block Extensions word set shall be appended to the label of any Standard System that provides all of the Block and Block Extensions word sets.


7.5.2 ANS Forth 程式(ANS Forth programs)

措辭 需要區塊詞集 必須被加到任何需要系統提供區塊詞集的標準程式的描述之中.

The phrase Requiring the Block word set shall be appended to the label of Standard Programs that require the system to provide the Block word set.

措辭 需要區塊延伸詞集中的 name(s) 必須被加到任何需要系統提供部分區塊延伸詞集的標準程式的描述之中.

The phrase Requiring name(s) from the Block Extensions word set shall be appended to the label of Standard Programs that require the system to provide portions of the Block Extensions word set.

措辭 需要區塊延伸詞集 必須被加到任何需要系統提供所有區塊和區塊延伸詞集的標準程式的描述之中.

The phrase Requiring the Block Extensions word set shall be appended to the label of Standard Programs that require the system to provide all of the Block and Block Extensions word sets.


7.6 詞彙表(Glossary)


7.6.1 區塊詞(Block words)


7.6.1.0790 BLK
b-l-k BLOCK
	( -- a-addr )

a-addr 是一個單元的位址, 它包含零或是被解譯的大量儲存媒體區塊的號碼. 如果 BLK 包含零, 輸入的來源不是一個區塊, 並且如果系統提供 SOURCE-ID, 就可用 SOURCE-ID 來識別. 如果程式直接替換 BLK 的內容, 將會發生模稜兩可的情況.

參閱: 7.3.3 區塊緩衝區區域


7.6.1.0790 BLK
b-l-k BLOCK
	( -- a-addr )

a-addr is the address of a cell containing zero or the number of the mass-storage block being interpreted. If BLK contains zero, the input source is not a block and can be identified by SOURCE-ID, if SOURCE-ID is available. An ambiguous condition exists if a program directly alters the contents of BLK.

See: 7.3.3 Block buffer regions


7.6.1.0800 BLOCK
BLOCK
	( u -- a-addr )

a-addr 是指定給大量儲存區塊 u 的區塊緩衝區的第一個字元的位址. 如果 u 不是一個可用的區塊號碼, 將會發生模稜兩可的情況.

如果區塊 u 已經在一個區塊緩衝區中, a-addr 是那個區塊緩衝區的位址.

如果區塊 u 並非在記憶體中, 並且有一個未分配的區塊緩衝區, 從大量儲存媒體傳送區塊 u 到一個未分配的區塊緩衝區. a-addr 是那個區塊緩衝區的位址.

如果區塊 u 並非在記憶體中, 並且沒有一個未分配的區塊緩衝區, 釋放一個區塊緩衝區. 如果在那個緩衝區中的區塊已經被 UPDATE 過, 傳送這個區塊到大量儲存媒體, 並且從大量儲存媒體傳送區塊 u 到那個緩衝區. a-addr 是那個區塊緩衝區的位址.

這項操作的總結是, 由 a-addr 指向的區塊緩衝區是目前的區塊緩衝區, 並且分配給 u.


7.6.1.0800 BLOCK
BLOCK
	( u -- a-addr )

a-addr is the address of the first character of the block buffer assigned to mass-storage block u. An ambiguous condition exists if u is not an available block number.

If block u is already in a block buffer, a-addr is the address of that block buffer.

If block u is not already in memory and there is an unassigned block buffer, transfer block u from mass storage to an unassigned block buffer. a-addr is the address of that block buffer.

If block u is not already in memory and there are no unassigned block buffers, unassign a block buffer. If the block in that buffer has been UPDATEd, transfer the block to mass storage and transfer block u from mass storage into that buffer. a-addr is the address of that block buffer.

At the conclusion of the operation, the block buffer pointed to by a-addr is the current block buffer and is assigned to u.


7.6.1.0820 BUFFER
BLOCK
	( u -- a-addr )

a-addr 是指定給區塊 u 的區塊緩衝區的第一個字元的位址. 這個區塊的內容是未指定的. 如果 u 不是一個可用的區塊號碼, 將會發生模稜兩可的情況.

如果區塊 u 已經在一個區塊緩衝區中, a-addr 是那個區塊緩衝區的位址.

如果區塊 u 並非在記憶體中, 並且有一個未分配的區塊緩衝區, a-addr 是那個區塊緩衝區的位址.

如果區塊 u 並非在記憶體中, 並且沒有一個未分配的區塊緩衝區, 釋放一個區塊緩衝區. 如果在那個緩衝區中的區塊已經被 UPDATE 過, 傳送這個區塊到大量儲存媒體, a-addr 是那個區塊緩衝區的位址.

這項操作的總結是, 由 a-addr 指向的區塊緩衝區是目前的區塊緩衝區, 並且分配給 u.

參閱: 7.6.1.0800 BLOCK


7.6.1.0820 BUFFER
BLOCK
	( u -- a-addr )

a-addr is the address of the first character of the block buffer assigned to block u. The contents of the block are unspecified. An ambiguous condition exists if u is not an available block number.

If block u is already in a block buffer, a-addr is the address of that block buffer.

If block u is not already in memory and there is an unassigned buffer, a-addr is the address of that block buffer.

If block u is not already in memory and there are no unassigned block buffers, unassign a block buffer. If the block in that buffer has been UPDATEd, transfer the block to mass storage. a-addr is the address of that block buffer.

At the conclusion of the operation, the block buffer pointed to by a-addr is the current block buffer and is assigned to u.

See: 7.6.1.0800 BLOCK


7.6.1.1360E EVALUATE
BLOCK

延伸 6.1.1360 EVALUATE 的語義成包含:

在 BLK 中存入零.


7.6.1.1360E EVALUATE
BLOCK

Extend the semantics of 6.1.1360 EVALUATE to include:

Store zero in BLK.


7.6.1.1559 FLUSH
BLOCK
	( -- )

進行 SAVE-BUFFERS 的功能, 然後清除所有的區塊緩衝區.


7.6.1.1559 FLUSH
BLOCK
	( -- )

Perform the function of SAVE-BUFFERS, then unassign all block buffers.


7.6.1.1790 LOAD
BLOCK
	( i*x u -- j*x )

儲存目前的輸入來源規格. 將 u 存進 BLK (這讓 區塊 u 變成輸入來源, 並且設定輸入緩衝區包含它的內容), 設定 >IN 成零, 並且解譯. 當分析區用盡時, 回存之前的輸入來源規格. 其他的堆疊影響是依據其他載入的詞而訂.

如果 u 是零或不是一個正確的區塊號碼時, 模稜兩可的情況存在.

參閱: 3.4 Forth 文字解譯器


7.6.1.1790 LOAD
BLOCK
	( i*x u -- j*x )

Save the current input-source specification. Store u in BLK (thus making block u the input source and setting the input buffer to encompass its contents), set >IN to zero, and interpret. When the parse area is exhausted, restore the prior input source specification. Other stack effects are due to the words LOADed.

An ambiguous condition exists if u is zero or is not a valid block number.

See: 3.4 The Forth text interpreter


7.6.1.2180 SAVE-BUFFERS
BLOCK
	( -- )

傳送每一個 UPDATE 過的區塊緩衝區的內容到大量儲存媒體. 將所有的緩衝區標示為未修改過的.


7.6.1.2180 SAVE-BUFFERS
BLOCK
	( -- )

Transfer the contents of each UPDATEd block buffer to mass storage. Mark all buffers as unmodified.


7.6.1.2400 UPDATE
BLOCK
	( -- )

將目前的區塊緩衝區標示為修改過的. 如果沒有目前的區塊緩衝區, 將會發生模稜兩可的情況.

UPDATE 不會立即導致 I/O.

參閱: 7.6.1.0800 BLOCK , 7.6.1.0820 BUFFER , 7.6.1.1559 FLUSH , 7.6.1.2180 SAVE-BUFFERS


7.6.1.2400 UPDATE
BLOCK
	( -- )

Mark the current block buffer as modified. An ambiguous condition exists if there is no current block buffer.

UPDATE does not immediately cause I/O.

See: 7.6.1.0800 BLOCK , 7.6.1.0820 BUFFER , 7.6.1.1559 FLUSH , 7.6.1.2180 SAVE-BUFFERS


7.6.2 區塊延伸詞(Block extension words)


7.6.2.1330 EMPTY-BUFFERS
BLOCK EXT
	( -- )

釋放所有的區塊緩衝區. 不要傳送任何 UPDATE 過的區塊緩衝區的內容到大量儲存媒體.

參閱: 7.6.1.0800 BLOCK


7.6.2.1330 EMPTY-BUFFERS
BLOCK EXT
	( -- )

Unassign all block buffers. Do not transfer the contents of any UPDATEd block buffer to mass storage.

See: 7.6.1.0800 BLOCK


7.6.2.1770 LIST
BLOCK EXT
	( u -- )

以實作自訂的格式顯示區塊 u. 將 u 存進 SCR.

參閱: 7.6.1.0800 BLOCK


7.6.2.1770 LIST
BLOCK EXT
	( u -- )

Display block u in an implementation-defined format. Store u in SCR.

See: 7.6.1.0800 BLOCK


7.6.2.2125 REFILL
BLOCK EXT
	( -- flag )

延伸 6.2.2125 REFILL 的執行語義加上:

當輸入的來源是一個區塊時, 讓下一個區塊成為輸入來源, 而目前的輸入緩衝區是 BLK 之值加一, 並且設定 >IN 為零. 如果新的 BLK 之值是一個正確的區塊號碼傳回真, 其他狀況傳回假.

參閱: 11.6.2.2125 REFILL


7.6.2.2125 REFILL
BLOCK EXT
	( -- flag )

Extend the execution semantics of 6.2.2125 REFILL with the following:

When the input source is a block, make the next block the input source and current input buffer by adding one to the value of BLK and setting >IN to zero. Return true if the new value of BLK is a valid block number, otherwise false.

See: 11.6.2.2125 REFILL


7.6.2.2190 SCR
s-c-r BLOCK EXT
	( -- a-addr )

a-addr 是一個包含最近由 LIST 使用過的區塊號碼的一個單元的位址.

參閱: A.7.6.2.2190 SCR


7.6.2.2190 SCR
s-c-r BLOCK EXT
	( -- a-addr )

a-addr is the address of a cell containing the block number of the block most recently LISTed.

See: A.7.6.2.2190 SCR


7.6.2.2280 THRU
BLOCK EXT
	( i*x u1 u2 -- j*x )

依序 LOAD 從區塊號碼 u1 到 u2 的大量儲存區塊. 其他的堆疊影響是依照載入的詞而定.


7.6.2.2280 THRU
BLOCK EXT
	( i*x u1 u2 -- j*x )

LOAD the mass storage blocks numbered u1 through u2 in sequence. Other stack effects are due to the words LOADed.


7.6.2.2535 \
反斜線 BLOCK EXT

延伸 6.2.2535 \ 的執行語義成:

        編譯: 進行下列給予的執行語義. 

        執行: ( ccc<eol>-- )

如果 BLK 包含零, 分析並丟棄其餘的分析區; 否則分析並丟棄分析區中對應到目前行的部分. \ 是一個立即詞.


7.6.2.2535 \
backslash BLOCK EXT

Extend the semantics of 6.2.2535 \ to be:

        Compilation: Perform the execution semantics given below.

        Execution: ( ccc<eol>-- )

If BLK contains zero, parse and discard the remainder of the parse area; otherwise parse and discard the portion of the parse area corresponding to the remainder of the current line. \ is an immediate word.


內容列表(Table of Contents)
下一章(Next Section)