Annotation of gforth/kernel/vars.fs, revision 1.11

1.1       anton       1: \ VARS.FS      Kernal variables
                      2: 
1.6       anton       3: \ Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
1.1       anton       4: 
                      5: \ This file is part of Gforth.
                      6: 
                      7: \ Gforth is free software; you can redistribute it and/or
                      8: \ modify it under the terms of the GNU General Public License
                      9: \ as published by the Free Software Foundation; either version 2
                     10: \ of the License, or (at your option) any later version.
                     11: 
                     12: \ This program is distributed in the hope that it will be useful,
                     13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15: \ GNU General Public License for more details.
                     16: 
                     17: \ You should have received a copy of the GNU General Public License
                     18: \ along with this program; if not, write to the Free Software
                     19: \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
                     20: 
                     21: hex \ everything now hex!                               11may93jaw
                     22: 
                     23: \ important constants                                  17dec92py
                     24: 
                     25: \ dpANS6 (sect 3.1.3.1) says 
                     26: \ "a true flag ... [is] a single-cell value with all bits set"
                     27: \ better definition: 0 0= constant true ( no dependence on 2's compl)
1.10      crook      28:  -1 Constant true ( -- f ) \ core-ext
                     29: \G CONSTANT: f is a cell with all bits set.
                     30: \ see starts looking for primitives after this word!
                     31: 
                     32:   0 Constant false ( -- f ) \ core-ext
                     33: \G CONSTANT: f is a cell with all bits clear.
1.1       anton      34: 
                     35: 1 cells Constant cell ( -- u ) \ gforth
                     36: 1 floats Constant float ( -- u ) \ gforth
                     37: 
1.10      crook      38: 20 Constant bl ( -- c-char ) \ core
                     39: \G c-char is the character value for a space.
                     40: \ used by docon:, must be constant
1.1       anton      41: 
                     42: FF Constant /line
                     43: 
                     44: 40 Constant c/l
                     45: 10 Constant l/s
                     46: 400 Constant chars/block
                     47: 
1.2       anton      48: $20 8 2* cells + 2 + cell+ constant word-pno-size ( -- u )
1.11    ! anton      49: create holdbuf word-pno-size chars allot
        !            50: holdbuf word-pno-size chars + aconstant holdbuf-end
        !            51: avariable holdptr holdbuf-end holdptr a!
        !            52: 
1.2       anton      53: 84 constant pad-minsize ( -- u )
1.11    ! anton      54: 
1.2       anton      55: 
1.1       anton      56: \ that's enough so long
                     57: 
                     58: \ User variables                                       13feb93py
                     59: 
                     60: \ initialized by COLD
                     61: 
1.7       pazsan     62: Create main-task  has? OS [IF] 100 [ELSE] 40 [THEN] cells allot
1.3       jwilke     63: 
                     64: \ set user-pointer from cross-compiler right
                     65: main-task 
                     66: UNLOCK tup ! LOCK
1.1       anton      67: 
1.8       anton      68: Variable udp \ user area size? -anton
1.1       anton      69: 
                     70: AUser next-task        main-task next-task !
                     71: AUser prev-task        main-task prev-task !
                     72: AUser save-task        0 save-task !
1.10      crook      73: AUser sp0 ( -- a-addr ) \ gforth
                     74: \G USER VARIABLE: Initial value of the data stack pointer.
                     75: \ sp0 is used by douser:, must be user
                     76:     ' sp0 Alias s0 ( -- a-addr ) \ gforth
                     77: \G OBSOLETE alias of @code{sp0}
                     78: 
                     79: AUser rp0 ( -- a-addr ) \ gforth
                     80: \G USER VARIABLE: Initial value of the return stack pointer.
                     81:     ' rp0 Alias r0 ( -- a-addr ) \ gforth
                     82: \G OBSOLETE alias of @code{rp0}
                     83: 
                     84: AUser fp0 ( -- a-addr ) \ gforth
                     85: \G USER VARIABLE: Initial value of the floating-point stack pointer.
                     86: \ no f0, because this leads to unexpected results when using hex
                     87: 
                     88: AUser lp0 ( -- a-addr ) \ gforth
                     89: \G USER VARIABLE: Initial value of the locals stack pointer.
                     90:     ' lp0 Alias l0 ( -- a-addr ) \ gforth
                     91: \G OBSOLETE alias of @code{lp0}
                     92: 
1.3       jwilke     93: AUser handler  \ pointer to last throw frame
1.9       anton      94: AUser backtrace-empty \ true if the next THROW should store a backtrace
1.1       anton      95: \ AUser output
                     96: \ AUser input
                     97: 
                     98: AUser errorhandler
                     99: 
                    100: AUser "error            0 "error !
                    101: 
1.3       jwilke    102: [IFUNDEF] #tib         \ in ec-Version we may define this ourself
                    103:  User tibstack         \ saves >tib in execute
                    104:  User >tib             \ pointer to terminal input buffer
1.10      crook     105:  User #tib ( -- a-addr ) \ core-ext
                    106:  \G USER VARIABLE: a-addr is the address of a cell containing
                    107:  \G the number of characters in the terminal input buffer.
                    108:  \G OBSOLESCENT: @code{source} superceeds the function of this word.
                    109: 
                    110:  User >in ( -- a-addr ) \ core
                    111:  \G USER VARIABLE: a-addr is the address of a cell containing the
                    112:  \G char offset from the start of the terminal input buffer to the
                    113:  \G start of the parse area
                    114:                         0 >in ! \ char number currently processed in tib
1.3       jwilke    115: [THEN]
1.7       pazsan    116: has? file [IF]
1.10      crook     117:  User blk ( -- a-addr ) \ block
                    118:  \G USER VARIABLE: a-addr is the address of a cell containing zero
                    119:  \G (in which case the input source is not a block and can be identified
                    120:  \G by @code{source-id}) or the number of the block currently being
                    121:  \G interpreted. A Standard program should not alter @code{blk} directly.
                    122:                        0 blk !
                    123: 
1.1       anton     124:  User loadfile          0 loadfile !
                    125: 
                    126:  User loadfilename#    0 loadfilename# !
                    127: 
                    128:  User loadline          \ number of the currently interpreted
                    129:                         \ (in TIB) line if the interpretation
                    130:                         \ is in a textfile
                    131:                         \ the first line is 1
                    132: 
                    133: 2User linestart         \ starting file postition of
                    134:                         \ the current interpreted line (in TIB)
1.7       pazsan    135: [THEN]
1.1       anton     136: 
1.10      crook     137:  User base ( -- a-addr ) \ core
                    138:  \G USER VARIABLE: a-addr is the address of a cell that stores the
                    139:  \G number base used by default for number conversion during input and output.
                    140:                         A base !
1.1       anton     141:  User dpl               -1 dpl !
                    142: 
1.10      crook     143:  User state ( -- a-addr ) \ core,tools-ext
                    144:  \G USER VARIABLE: a-addr is the address of a cell containing
                    145:  \G the compilation state flag. 0 => interpreting, -1 => compiling.
                    146:  \G A program shall not directly alter the value of @code{state}. The
                    147:  \G following Standard words alter the value in @code{state}:
                    148:  \G @code{:} (colon) @code{;} (semicolon) @code{abort} @code{quit}
                    149:  \G @code{:noname} @code{[} (left-bracket) @code{]} (right-bracket)
                    150:  \G @code{;code}
                    151:                        0 state !
                    152: 
1.1       anton     153: AUser normal-dp                \ the usual dictionary pointer
                    154: AUser dpp              normal-dp dpp !
                    155:                        \ the pointer to the current dictionary pointer
                    156:                         \ ist reset to normal-dp on (doerror)
                    157:                         \  (i.e. any throw caught by quit)
                    158: AUser LastCFA
                    159: AUser Last
                    160: 
1.7       pazsan    161: has? glocals [IF]
1.1       anton     162: User locals-size \ this is the current size of the locals stack
                    163:                 \ frame of the current word
1.7       pazsan    164: [THEN]
1.1       anton     165: 

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