PFE - Portable Forth Environment - pfe Forth Wordsets

  PFE 0.33.71 Homepage SourceForge Download Documentation -Overview -The PFE Manual old manual / (book) -ChangeLog -Authors -License (LGPL) -Wordsets / (book) -Functions .. (book) -Dp of ANS Forth -The 4thTutor -Forthprimer.pdf - Old Wordsets - Old Words List Forth Links * Forth Repository * Taygeta Compilation * TinyBoot FirmWare * FiCL, Free Forth * Research Vienna * Research Bournemouth * zForth WebRing Other Links * Tektronix/MPT * Forth Org. (FIG) * Forth Inc. * MPE Ltd. Forths * SF Win32Forth * PD Win32Forth * Neil Bawd generated (C) Guido U. Draheim guidod@gmx.de | ## STRUCT - simple struct implementation `STRUCT``( "name" -- here zero-offset )``` => `"EXTENSIONS"` begin definition of a new structure (mpe.000)
        : STRUCT CREATE  !CSP
          HERE
          0 DUP ,
        DOES>
          @
        ;
  primitive code = [p4_struct] `END-STRUCT``( here some-offset -- )``` => `"EXTENSIONS"` terminate definition of a new structure (mpe.000)
        : END-STRUCT  SWAP !  ?CSP ;
  primitive code = [p4_end_struct] `SUBRECORD``( outer-offset "name" -- outer-offset here zero-offset )``` => `"EXTENSIONS"` begin definition of a subrecord (mpe.000)
        : STRUCT CREATE
          HERE
          0 DUP ,
        DOES>
          @
        ;
  primitive code = [p4_subrecord] `END-SUBRECORD``( outer-offset here some-offset -- outer-offset+some )``` => `"EXTENSIONS"` end definition of a subrecord (mpe.000)
        : END-SUBRECORD  TUCK SWAP !  + ;
  primitive code = [p4_end_subrecord] `ARRAY-OF``( some-offset n len "name" -- some-offset )``` => `"EXTENSIONS"` a `FIELD`-array
        : ARRAY-OF * FIELD ;
  primitive code = [p4_array_of] `VARIANT``( outer-offset "name" -- outer-offset here zero-offset )``` => `"EXTENSIONS"` Variant records describe an alternative view of the current record or subrecord from the start to the current point. The variant need not be of the same length, but the larger is taken
        : VARIANT SUBRECORD ;
  primitive code = [p4_variant] `END-VARIANT``( outer-offset here some-offset -- outer-offset )``` => `"EXTENSIONS"` terminate definition of a new variant (mpe.000)
        : END-STRUCT  TUCK SWAP !  2DUP < IF NIP ELSE DROP THEN ;
  primitive code = [p4_end_variant] `INSTANCE``( len "name" -- )``` => `"EXTENSIONS"` Create a named instance of a named structure.
        : INSTANCE  CREATE ALLOT ;
  primitive code = [p4_instance] `INSTANCE-ADDR``( len -- addr )``` => `"EXTENSIONS"` Create nameless instance of a structure and return base address.
        : INSTANCE-ADDR  HERE SWAP ALLOT ;
  primitive code = [p4_instance_addr] `ENDSTRUCTURE``( here some-offset -- )``` => `"EXTENSIONS"` finalize a previously started `STRUCTURE` definition
        : ENDSTRUCTURE  SWAP !  ?CSP ;
  primitive code = [p4_endstructure] `SIZEOF``( "name" -- size )``` => `"EXTENSIONS"` get the size-value from a previous structure definition
        : SIZEOF   ' >BODY @  STATE @ IF [COMPILE] LITERAL THEN ; IMMEDIATE
compiling word = [p4_sizeof] `CHAR%``` => `"EXTENSIONS"` (no description) primitive code = [p4_char_mod] `CELL%``` => `"EXTENSIONS"` (no description) primitive code = [p4_cell_mod] `WCHAR%``` => `"EXTENSIONS"` (no description) primitive code = [p4_wchar_mod] `DOUBLE%``` => `"EXTENSIONS"` (no description) primitive code = [p4_double_mod] `FLOAT%``` => `"EXTENSIONS"` (no description) primitive code = [p4_float_mod] `SFLOAT%``` => `"EXTENSIONS"` (no description) primitive code = [p4_sfloat_mod] `DFLOAT%``` => `"EXTENSIONS"` (no description) primitive code = [p4_dfloat_mod]