home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FFB.ZIP / FFUTILS.ARC / ZIMMER.ARC / INTERP.SEQ < prev    next >
Encoding:
Text File  |  1987-12-02  |  1.1 KB  |  35 lines

  1. \ INTERP.SEQ    Interpret a string                      by Martin Tracy
  2.  
  3. comment:
  4.  
  5.   Originally suggested to me by Martin Tracy, but all the names have
  6. been changed to protect the guilty !!!
  7.  
  8.   Allows the definition of macros that will be interpreted at the run
  9. time of the macro. The first character of the first word following
  10. the macro name being defined is the delimiter for the macro as follows:
  11.  
  12.                 macro test " .( this is a test)"
  13.  
  14.                 macro test / .( this is a test)/
  15.  
  16.                 macro test \ .( this is a test)\
  17.  
  18.   The delimiter must naturally not occur within the macro.
  19.  
  20. comment;
  21.  
  22. : "interpret    ( a1 n1 --- )
  23.                 'tib @ >r >in @ >r span @ >r
  24.                 0 >in ! dup span ! #tib ! 'tib !
  25.                 interpret
  26.                 r> dup span ! #tib ! r> >in ! r> 'tib ! ;
  27.  
  28. : macro         ( name --- )    \ start a macro definitions
  29.                 ['] noop is ]   [compile] :
  30.                 ['] (])  is ]    compile (")
  31.                 bl word 1+ c@ word c@ 1+ allot
  32.                 compile "interpret state on [compile] ; ;
  33.  
  34.  
  35.