home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
tutor
/
l7p020
< prev
next >
Wrap
Text File
|
1990-07-15
|
3KB
|
79 lines
╔════════════════════════════════════════════════════╗
║ Lesson 7 Part 020 F-PC 3.5 Tutorial by Jack Brown ║
╚════════════════════════════════════════════════════╝
Lesson 6 Review ( continued )
┌─────────────────────────────────┐
│ Number Formatting Operators. │
└─────────────────────────────────┘
PAD ( -- addr ) Leave address of output buffer.
The variable HLD points to the current position in the output buffer.
HLD is initialized to PAD by <# below and is decremented by 1 just
before another ASCII digit is added to the output.
VARIABLE HLD Pointer to current output address in below PAD .
HOLD ( n -- ) Add ASCII character n to string being formed
and decrement HLD
<# ( -- ) Start numeric conversion, initialize HLD for
new output.
#> ( dn -- addr len ) Terminate numeric conversion.
SIGN ( n -- ) If n is negative insert a -ve sign in the output string.
# ( dn -- dn' ) Convert a single digit using the current number BASE.
#S ( dn -- dn') Convert all remaining digits.
┌────────────────────────┐
│ Compiler Extension │
└────────────────────────┘
IMMEDIATE is used right after the definition of a word to declare it
to be IMMEDIATE. An IMMEDIATE word will execute at compile
time instead of being compiled.
LITERAL compiles the stack number in to the dictionary.
LITERAL is an IMMEDIATE word itself.
' ( tick ) Get the cfa of the next word in the input stream.
' is not IMMEDIATE in F-PC ( it was in Fig Forth).
STATE a system variable that is true if the system is
in compile mode and false if the system is in
interpretive mode.
[COMPILE] force the compilation of an IMMEDIATE word when it
would other wise execute.
COMPILE When the word containing COMPILE <xxx> executes
the word <xxx> will be compile into the dictionary.
┌────────────────────────┐
│ The Case Statement │
└────────────────────────┘
CASE ... OF ... ENDOF ... ENDCASE
CASE causes an index value to be compared to a series of values.
OF is equivalent to OVER = IF DROP
ENDOF is equivalent to ELSE
Any number of OF .. ENDOF pairs may be used.
ENDCASE is equivalent of the appropriate number of THENs
┌────────────────────────────────────┐
│ Please Move to Lesson 7 Part 030 │
└────────────────────────────────────┘