Diff for /gforth/glocals.fs between versions 1.15 and 1.21

version 1.15, 1995/11/07 18:06:43 version 1.21, 1996/05/09 18:12:59
Line 19 Line 19
 \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   
   
   \ More documentation can be found in the manual and in
   \ http://www.complang.tuwien.ac.at/papers/ertl94l.ps.gz
   
 \ Local variables are quite important for writing readable programs, but  \ Local variables are quite important for writing readable programs, but
 \ IMO (anton) they are the worst part of the standard. There they are very  \ IMO (anton) they are the worst part of the standard. There they are very
 \ restricted and have an ugly interface.  \ restricted and have an ugly interface.
Line 485  forth definitions Line 488  forth definitions
     \ this gives a unique identifier for the way the xt was defined      \ this gives a unique identifier for the way the xt was defined
     \ words defined with different does>-codes have different definers      \ words defined with different does>-codes have different definers
     \ the definer can be used for comparison and in definer!      \ the definer can be used for comparison and in definer!
     dup >code-address [ ' bits >code-address ] Literal =      dup >code-address [ ' spaces >code-address ] Literal =
     \ !! this definition will not work on some implementations for `bits'      \ !! this definition will not work on some implementations for `bits'
     if  \ if >code-address delivers the same value for all does>-def'd words      if  \ if >code-address delivers the same value for all does>-def'd words
         >does-code 1 or \ bit 0 marks special treatment for does codes          >does-code 1 or \ bit 0 marks special treatment for does codes
Line 501  forth definitions Line 504  forth definitions
         code-address!          code-address!
     then ;      then ;
   
 \ !! untested  
 : TO ( c|w|d|r "name" -- ) \ core-ext,local  : TO ( c|w|d|r "name" -- ) \ core-ext,local
 \ !! state smart      0 0 0. 0.0e0 { c: clocal w: wlocal d: dlocal f: flocal }
  0 0 0. 0.0e0 { c: clocal w: wlocal d: dlocal f: flocal }      ' dup >definer
  ' dup >definer      case
  state @           [ ' locals-wordlist >definer ] literal \ value
  if          OF >body POSTPONE Aliteral POSTPONE ! ENDOF
    case          [ ' clocal >definer ] literal
      [ ' locals-wordlist >definer ] literal \ value          OF POSTPONE laddr# >body @ lp-offset, POSTPONE c! ENDOF
      OF >body POSTPONE Aliteral POSTPONE ! ENDOF          [ ' wlocal >definer ] literal
      [ ' clocal >definer ] literal          OF POSTPONE laddr# >body @ lp-offset, POSTPONE ! ENDOF
      OF POSTPONE laddr# >body @ lp-offset, POSTPONE c! ENDOF          [ ' dlocal >definer ] literal
      [ ' wlocal >definer ] literal          OF POSTPONE laddr# >body @ lp-offset, POSTPONE 2! ENDOF
      OF POSTPONE laddr# >body @ lp-offset, POSTPONE ! ENDOF          [ ' flocal >definer ] literal
      [ ' dlocal >definer ] literal          OF POSTPONE laddr# >body @ lp-offset, POSTPONE f! ENDOF
      OF POSTPONE laddr# >body @ lp-offset, POSTPONE d! ENDOF          -&32 throw
      [ ' flocal >definer ] literal      endcase ; immediate
      OF POSTPONE laddr# >body @ lp-offset, POSTPONE f! ENDOF  interpretation:
      -&32 throw      ' dup >definer [ ' locals-wordlist >definer ] literal =
    endcase      if
  else          >body !
    [ ' locals-wordlist >definer ] literal =      else
    if          -&32 throw
      >body !      endif ;
    else  
      -&32 throw  
    endif  
  endif ; immediate  
   
 : locals|  : locals|
     \ don't use 'locals|'! use '{'! A portable and free '{'      \ don't use 'locals|'! use '{'! A portable and free '{'
     \ implementation is anslocals.fs      \ implementation is compat/anslocals.fs
     BEGIN      BEGIN
         name 2dup s" |" compare 0<>          name 2dup s" |" compare 0<>
     WHILE      WHILE

Removed from v.1.15  
changed lines
  Added in v.1.21


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>