forked from sayon/forthress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocumentation.frt
162 lines (127 loc) · 4.09 KB
/
documentation.frt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
' include g"
Include the file content in the content of current file.
" doc-word
' file-print g"
( fd str -- )
Print file.
" doc-word
' file-close g"
Close file.
" doc-word
' file-open-read g"
( str -- )
Open file with name str as read-only.
" doc-word
' file-open-append g"
( str -- )
Open file with name str for reading and writing. If file does not exist create it as a regular file.
" doc-word
' file-create g"
( str -- )
Create a regular file with name specified by the string on top of the stack and the following flags: O_RDWR, O_CREAT, O_TRUNC.
" doc-word
' sys-close g"
System call to close a file. The exit code is on the top of the stack.
" doc-word
' sys-close-no g"
Place the number of sys_close system call on the top of the stack.
" doc-word
' sys-open g"
System call to open a file. The exit code is on the top of the stack.
" doc-word
' sys-open-no g"
Place the number of sys_open system call on the top of the stack.
" doc-word
' O_RDONLY g"
File access mode flag for opening file as read-only.
" doc-word
' O_WRONLY g"
File access mode flag for opening file as write-only.
" doc-word
' O_RDWR g"
File access mode flag for opening file as read/write.
" doc-word
' O_TRUNC g"
File creation flag.
If the file already exists and is a regular file and the access mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be truncated to length 0.
" doc-word
' O_CREAT g"
File creation flag.
If file does not exist create it as a regular file.
" doc-word
' O_APPEND g"
File creation flag.
The file is opened in append mode. Before each write operation, the file offset is positioned at the end of the file.
" doc-word
' 0x g"
( -- hex )
Place a hexadecimal literal's decimal representation on top of the stack. If it is not a hexadecimal literal place 0.
" doc-word
' O8x g"
( -- oct )
Place an octal literal on top of the stack. If it is not an octal literal place 0.
" doc-word
' read-oct-digit g"
( -- oct )
Read an octal digit add place it on top of the stack; otherwise place -1.
" doc-word
' read-hex-digit g"
( -- hex )
Read a hexadecimal digit add place its decimal representation on top of the stack; otherwise place -1.
" doc-word
' read-digit g"
( -- dec )
Read a decimal digit and place it on top of the stack; otherwise place -1.
" doc-word
' ." g"
Print the words up to the delimiting double-quote.
" doc-word
' g" g"
Create a documentation of the dictionary word whose XT is on top of the stack.
Description of the word goes up to the delimiting double-quote followed by the word 'doc-word'.
" doc-word
' TAB g"
( -- char )
Place TAB ASCII code on top of the stack.
" doc-word
' QUOTE g"
( -- char )
Place double quotes ASCII code on top of the stack.
" doc-word
' cr g"
Start a new line.
" doc-word
' readce g"
( -- char )
Read character and place its ASCII code on top of the stack.
Place 0 for control characters except new line character \n.
" doc-word
' .' g"
( -- char )
Place character ASCII code on top of the stack.
" doc-word
' compnumber g"
Compute number in compilation mode.
" doc-word
' compiling g"
( -- state )
Place on top of the stack the current Forth state:
0 - interpretation mode
1 - compilation mode
" doc-word
' in-range g"
( num from to -- 1/0 )
Check if number is in given range. Place on top of the stack 1 if it is; otherwise place 0.
" doc-word
' case g"
Execute the block of code associated with the case clause. Case clause mathes the value of the topmost element of the stack.
" doc-word
' of g"
Match the beginning of the block of code for a case clause.
" doc-word
' endof g"
Match the end of the block of code for a case clause.
" doc-word
' endcase g"
Match the end of case statement.
" doc-word