附錄E 體裁約定的摘要─────────────────────────────────────── 縮排及間隔的指引 空1格 --冒號與名字之間 空2格 --名字與註解之間も 空2格或換行 --註解之後及定義之前も 空3格 --名字與定義之間(若未使用註解時) 縮排3格 --用於各後續行(或以3的倍數用於巢狀縮排) 空1格 --用於片語內部的字(或數字)之間 空2或3格 --用於各個片語之間 空1格 --用於最後一個字與分號之間 空1格 --用於分號與『IMMEDIATE』(若用到它)之間 定義與定義之間不要留空行,除非是為了分隔兩群不同的定義時。 も常見的另一些約定要求在名字與註解之間空1格,註解與定義之間空3格。更為自 由的做法是在註解的前後都空出3格。不論閣下選用的是何種約定,務必保持一貫 的用法,不要變來變去。
n 帶符號的單長度數字 d 帶符號的雙長度數字 u 不帶符號的單長度數字 ud 不帶符號的雙長度數字 t 三倍長度的數字 q 四倍長度的數字 c 7位元的字元值(高位元無作用,或為零) b 8位元值(高位元無作用,或為零) ? 布氏旗標;或寫成 t= 真 f= 假 a or adr 地址 acf 執行區地址 apf 參數區地址 ' (做為字首時)某物的地址 s d (成對出現時)來源,目的地址 l hi 上限下限(含) # 計數值 o 偏移值 i 索引值 m 遮罩 x 可忽略--(用在資料結構的表示法中) 一個"偏移值"是以絕對單位(例如byte)表示的差量。 一個"索引值"是以邏輯單位(例如元素或欄位)表示的差量。
c 單個字元,以空格作為分隔 name 一串字元,以空格作為分隔 text 一串字元,以非空格符號作為分隔 將分隔符號跟在text之後,例如 text" 或 test) 範例 \ Formatter Data Structure
6 CONSTANT TMARGIN \ line# where body of text begins
55 CONSTANT BMARGIN \ line# where body of text ends
CREATE HEADER 82 ALLOT
\ { 1left-cnt | 1right-cnt | 80header }
CREATE FOOTER 82 ALLOT
\ { 1left-cnt | 1right-cnt | 80footer }
VARIABLE ACROSS \ formatter's current horizontal position
VARIABLE DOWNWARD \ formatter's current vertical position
VARIABLE LEFT \ current primary left margin
VARIABLE WALL \ current primary right margin
VARIABLE WALL-WAS \ WALL when current line started being formatted
\ Formatter positioning
: SKIP ( --n) ACROSS +! ;
: NEWLEFT \ reset left margin
LEFT @ PERMANENT @ + TEMPORARY @ + ACROSS ! ;
: \LINE \ begin new line
DOOR CR' 1 DOWNWARD +! NEWLEFT WALL @ WALL-WAS ! ;
: AT-TOP? ( -- t=at-top) TMARGIN DOWNWARD @ = ;
: >TMARGIN \ move from crease to TMARGIN
0 DOWNWARD ! BEGIN \LINE AT-TOP? UNTIL ;
命名的約定 Meaning Form Example
(Arithmetic)
integer 1 1name 1+
integer 2 2name 2*
takes relative input parameters +name +DRAW
takes scaled input parameters *name *DRAW
(Compilation)
start of "high-level" code name: CASE:
end of "high-level" code ;name ;CASE
put something into dictionary name, C,
execute at compile time [name] [COMPILE]
slightly different name'(prime) CR'
internal form or primitive (name) (TYPE)
or <name> <TYPE>
compiling word run-time part:
systems with no folding lower-case if
systems with folding (name) (IF)
defining word :name :COLOR
block-number where overlay begins nameING DISKING
(Data Structure)m
table or array names EMPLOYEES
total number of elements #name #EMPLOYEES
current item number (variable) name# EMPLOYEE#
sets current item ( n) name 13 EMPLOYEE
advance to next element +name +EMPLOYEE
size of offset to item from name+ DATE+
beginning of structures
size of (bytes per) /name /EMPLOYEE
index pointer >name >IN
convert address of structure to >name >BODY
address of item
file index (name) (PEOPLE)
file pointer -name -JOB
initialize structure 0name 0RECORD
(Direction, Conversion)
backwards name< SLIDE<
forwards name> SLIDE>
from <name <TAPE
to >name >TAPE
convert to name>name FEET>METERS
downward \name \LINE
upward /name /LINE
open {name {FILE
close }name }FILE
(Logic, Control)
return boolean value name? SHORT?
return reversed boolean -name? -SHORT?
address of boolean 'name? 'SHORT?
operates conditionally ?name ?DUP
enable +name +CLOCK
or, absence of symbol name BLINKING
disable -name -CLOCK
-BLINKING
(Memory)
save value of !name !CURSOR
restore value of @name @CURSOR
store into name! SECONDS!
fetch from name@ INDEX@
name of buffer |name |INSERT
address of name 'name 'S
address of pointer to name 'name 'TYPE
exchange, espicially bytes >name< >MOVE<
(Numeric Types)
byte length Cname C@
2 cell size, 2's complement Dname D+
integer encoding
mixed 16 and 32-bit operator Mname M*
3 cell size Tname T*
4 cell size Qname Q*
unsigned encoding Uname U.
(Output, Printing)
print item .name .S
print numeric (name denotes type) name. D. , U.
print right-justified name.R U.R
(Quantity)
"per" /name /SIDE
(Sequencing)
start <name <#
end name> #>
(Text)
string follows delimited by " name" ABORT" text"
text or string operator "name "COMPARE
(similar to $ prefix in BASIC)
superstring array "name" "COLORS"
符號的讀法
! store
@ fetch
# sharp ( or "number" as in #RECORDS)
$ dollar
% percent
^ caret
& ampersand
* star
( left paren; paren
) right paren; paren
- dash; not
+ plus
= equals
{ } faces (tra nditionally called "curly brackets")
[ ] square brackets
" quote
' as prefix; tick; as suffix; prime
| bar
\ backslash. (also "under", "down", and "skip")
/ slash. ( also "up")
< less-than (left dart)
> greater-than (right dart)
? question (some prefer "query")
, comma
. dot
|