[gforth] / gforth / kernel / input.fs  

gforth: gforth/kernel/input.fs

Diff for /gforth/kernel/input.fs between version 1.14 and 1.15

version 1.14, Sat Feb 4 19:26:38 2006 UTC version 1.15, Sun Feb 5 17:54:40 2006 UTC
Line 57 
Line 57 
     \G @code{input-var} variable -- @i{a-addr} is the address of a      \G @code{input-var} variable -- @i{a-addr} is the address of a
     \G cell containing the char offset from the start of the input      \G cell containing the char offset from the start of the input
     \G buffer to the start of the parse area.      \G buffer to the start of the parse area.
   cell input-var input-start-parse ( -- addr ) \ gforth
       \G @code{input-var} variable -- @i{a-addr} is the address of a
       \G cell containing a pointer to the start of the last parsed
       \G string (but after skipped characters, if any); this is set
       \G automatically by @code{parse}, @code{parse-name} and
       \G @code{word}, but not if you set @code{>in} yourself.
 cell input-var #tib ( -- addr ) \ core-ext number-t-i-b  cell input-var #tib ( -- addr ) \ core-ext number-t-i-b
     \G @code{input-var} variable -- @i{a-addr} is the address of a      \G @code{input-var} variable -- @i{a-addr} is the address of a
     \G cell containing the number of characters in the terminal input      \G cell containing the number of characters in the terminal input
Line 89 
Line 95 
   
 Constant tib+  Constant tib+
   
   \ helper words
   
   : input-start-line ( -- )
       >in off  input-start-parse off ;
   
   : start-lexeme ( c-addr -- )
       \ record that the current lexeme starts at c-addr
       source drop - input-start-parse ! ;
   
 \ terminal input implementation  \ terminal input implementation
   
 :noname ( in 1 -- ) 1 <> -12 and throw >in ! ;  :noname ( in 1 -- ) 1 <> -12 and throw >in ! ;
Line 98 
Line 113 
 :noname ( -- flag ) [ has? file [IF] ]  :noname ( -- flag ) [ has? file [IF] ]
     stdin file-eof?  IF  false  EXIT  THEN [ [THEN] ]      stdin file-eof?  IF  false  EXIT  THEN [ [THEN] ]
     tib max#tib @ accept #tib !      tib max#tib @ accept #tib !
     >in off true 1 loadline +! ;     \ refill      input-start-line true 1 loadline +! ;     \ refill
 :noname ( -- addr u ) tib #tib @ ;   \ source  :noname ( -- addr u ) tib #tib @ ;   \ source
   
 | Create terminal-input   A, A, A, A, A,  | Create terminal-input   A, A, A, A, A,
Line 125 
Line 140 
     4 ;                \ save-input      4 ;                \ save-input
 :noname  ( -- file ) loadfile @ ;  \ source-id  :noname  ( -- file ) loadfile @ ;  \ source-id
 :noname  ( -- flag )  :noname  ( -- flag )
     #tib off #fill-bytes off >in off      #tib off #fill-bytes off input-start-line
     BEGIN      BEGIN
         tib max#tib @ #tib @ /string          tib max#tib @ #tib @ /string
         loadfile @ (read-line) throw #fill-bytes +!          loadfile @ (read-line) throw #fill-bytes +!
Line 160 
Line 175 
 : pop-file ( throw-code -- throw-code ) \ gforth  : pop-file ( throw-code -- throw-code ) \ gforth
     \G pop and free the current top input buffer      \G pop and free the current top input buffer
     dup IF      dup IF
         source >in @ sourceline#          input-error-data >error
         [ has? file [IF] ] sourcefilename [ [THEN] ]  
         >error  
     THEN      THEN
     current-input @ old-input @ current-input ! free throw ;      current-input @ old-input @ current-input ! free throw ;
   


Generate output suitable for use with a patch program
Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help