home *** CD-ROM | disk | FTP | other *** search
- \ Extended Data Objects for Forth. GTH 07/28/87
-
- .comment:
- See file EDO.TXT for documentation, file EDODMO.Seq for
- a test/demonstration/examples of code.
- comment;
- 20 tillkey
-
- \ Machine characteristics & scalar definition GTH 07/28/87
-
- 1 CONSTANT 1BYTE : BYTE* ;
-
- \ Modify line below to number of bytes per machine word:
- 2 CONSTANT 1WORD ( -- n ) \ the machine word/cell size
-
- : WORD+ ( n -- n+WORD ) \ increments by word size
- 1WORD + ;
-
- : WORD* ( n -- n*WORD ) \ multiplies by word size
- 1WORD * ;
-
- : DEF ( size -- ) \ defines a Forth scalar
- CONSTANT ;
-
- \ The structure data object GTH 07/28/87
-
- \ Initiates a structure definition.
- : S{ ( -- 0 )
- 0 ;
-
- \ Defines a structure component.
- : :: ( offset object-definition -- offset )
- CREATE OVER , + DOES> @ + ;
-
- \ Ends a structure definition & defines a structure object.
- : }S ( size -- ) \ definition name follows in input stream
- CONSTANT ;
-
- \ The vector data object GTH 07/28/87
-
- \ Defines a vector and a vector operator.
- : [] ( object-definition #objects -- )
- \ Input stream must contain: definition name & operator name.
- \ Higher dimensionality objects are vectors of vectors!
- OVER * CONSTANT \ define the vector
- CREATE , \ define the vector operator
- DOES> @ * + ;
-