home *** CD-ROM | disk | FTP | other *** search
-
- ╔══════════════════════════════════════════════════════╗
- ║ Lesson 7 Part 010 F-PC 3.5 Tutorial by Jack Brown ║
- ╚══════════════════════════════════════════════════════╝
-
- ┌───────────────────────────────────────────────────┐
- │ In Lesson 7 we will look at the following topics: │
- └───────────────────────────────────────────────────┘
-
- 0) Review of Lesson 6
- 1) Vocabularies.
- 2) Deferred Execution
- 3) Compiler Extension with CREATE ... DOES>
- 4) Recursion
-
- ┌──────────────────────┐
- │ String Operators │
- └──────────────────────┘
-
- ," {text}" ( -- ) Compile string into array, use after CREATE
- USE OUTSIDE DEFINITION ONLY!!!
-
- COUNT ( addr -- addr+1 n) n is byte or count stored at addr.
- TYPE ( addr n -- ) Type n characters of string at addr.
-
- " {text}" ( -- addr count ) Compile string into colon definition.
- ONLY USE WITHIN A COLON DEFINITION!
- ." {text}" ( -- ) Compile display string into : definition.
-
-
- FILL ( addr n c -- ) Fill string at addr with n copies of c .
- ERASE ( addr n -- ) Fill string at addr with n null's or 0's.
- EXPECT ( addr n -- ) Input up to n characters to buffer at addr
-
-
- CMOVE ( addr-from addr-to n -- )
- "c-move" Move n bytes from memory at addr-from to memory at addr-to.
- Left-most or low memory bytes are moved first. ( ie Move
- starts at beginning of string.)
-
- CMOVE> ( addr-from addr-to n -- )
- "c-move-up" Move n bytes from addr-from to addr-to. Right-most or high
- memory bytes are moved first. ( ie Move starts at end or
- top of string.)
-
- MOVE ( addr-from addr-to n -- )
- "move" Forth's smart MOVE which checks for the overlapping case
- and makes the correct application of CMOVE or CMOVE>
-
- CPACK ( addr-from addr-to n -- )
- "c-pack" Convert uncounted string at addr-from to packed string
- format and store at addr-to.
-
- : /STRING ( addr len n -- addr' len' )
- "slash-string" Slash n characters from the beginning of a string
- addr'= addr+n and len'= len-n
-
- -TRAILING ( addr count1 -- addr count2 )
- "dash-trailing" Remove trailing blanks from a string.
-
- SKIP ( addr len char -- addr' len' )
- Given the address and length of a string, and a character to look for,
- run through the string while we continue to find the character. Leave
- the address of the *mismatch* and the length of the remaining string.
-
- SCAN ( addr len char -- addr' len' )
- Given the address and length of a string, and a character to look for,
- run through the string until we find the character. Leave the address
- of the *match* and the length of the remaining string.
-
- CONVERT ( ud1 addr1 -- ud2 addr2 )
- Convert a counted string starting at addr1 or an uncounted string
- starting at addr1+1 accumulating number into ud1. Conversion stops at
- first non digit character whose location, addr2, is left on the stack.
- addr1 is usually the address of a counted or packed digit string. The
- first digit of the string to be converted will be at addr1+1 . ud2 is
- ud1 with the addition of the accumulated digits. The character count or
- digit that may be at addr1 is not used by CONVERT. Examples:
-
- NUMBER ( addr -- dn )
- Convert the packed string delimited by a blank at addr into a double
- number dn.
-
- ┌────────────────────────────────────┐
- │ Please Move to Lesson 7 Part 020 │
- └────────────────────────────────────┘
-