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

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
1.17    ! crook      29: \G CONSTANT: @i{f} is a cell with all bits set.
1.10      crook      30: \ see starts looking for primitives after this word!
                     31: 
                     32:   0 Constant false ( -- f ) \ core-ext
1.17    ! crook      33: \G CONSTANT: @i{f} is a cell with all bits clear.
1.1       anton      34: 
1.16      jwilke     35: [IFUNDEF] cell 
1.1       anton      36: 1 cells Constant cell ( -- u ) \ gforth
1.17    ! crook      37: \G CONSTANT: the number of address units corresponding to 1 cell.
1.16      jwilke     38: [THEN]
1.17    ! crook      39: 
1.1       anton      40: 1 floats Constant float ( -- u ) \ gforth
1.17    ! crook      41: \G CONSTANT: the number of address units corresponding to a floating-point number.
1.1       anton      42: 
1.10      crook      43: 20 Constant bl ( -- c-char ) \ core
1.17    ! crook      44: \G @i{c-char} is the character value for a space.
1.10      crook      45: \ used by docon:, must be constant
1.1       anton      46: 
                     47: FF Constant /line
                     48: 
                     49: 40 Constant c/l
                     50: 10 Constant l/s
                     51: 400 Constant chars/block
                     52: 
1.2       anton      53: $20 8 2* cells + 2 + cell+ constant word-pno-size ( -- u )
1.11      anton      54: create holdbuf word-pno-size chars allot
                     55: holdbuf word-pno-size chars + aconstant holdbuf-end
                     56: avariable holdptr holdbuf-end holdptr a!
1.12      anton      57: avariable holdend holdbuf-end holdend a!
1.11      anton      58: 
1.2       anton      59: 84 constant pad-minsize ( -- u )
1.11      anton      60: 
1.2       anton      61: 
1.1       anton      62: \ that's enough so long
                     63: 
                     64: \ User variables                                       13feb93py
                     65: 
                     66: \ initialized by COLD
                     67: 
1.7       pazsan     68: Create main-task  has? OS [IF] 100 [ELSE] 40 [THEN] cells allot
1.3       jwilke     69: 
                     70: \ set user-pointer from cross-compiler right
                     71: main-task 
                     72: UNLOCK tup ! LOCK
1.1       anton      73: 
1.8       anton      74: Variable udp \ user area size? -anton
1.1       anton      75: 
                     76: AUser next-task        main-task next-task !
                     77: AUser prev-task        main-task prev-task !
                     78: AUser save-task        0 save-task !
1.10      crook      79: AUser sp0 ( -- a-addr ) \ gforth
                     80: \G USER VARIABLE: Initial value of the data stack pointer.
                     81: \ sp0 is used by douser:, must be user
                     82:     ' sp0 Alias s0 ( -- a-addr ) \ gforth
                     83: \G OBSOLETE alias of @code{sp0}
                     84: 
                     85: AUser rp0 ( -- a-addr ) \ gforth
                     86: \G USER VARIABLE: Initial value of the return stack pointer.
                     87:     ' rp0 Alias r0 ( -- a-addr ) \ gforth
                     88: \G OBSOLETE alias of @code{rp0}
                     89: 
                     90: AUser fp0 ( -- a-addr ) \ gforth
                     91: \G USER VARIABLE: Initial value of the floating-point stack pointer.
                     92: \ no f0, because this leads to unexpected results when using hex
                     93: 
                     94: AUser lp0 ( -- a-addr ) \ gforth
                     95: \G USER VARIABLE: Initial value of the locals stack pointer.
                     96:     ' lp0 Alias l0 ( -- a-addr ) \ gforth
                     97: \G OBSOLETE alias of @code{lp0}
                     98: 
1.3       jwilke     99: AUser handler  \ pointer to last throw frame
1.13      anton     100: User backtrace-empty \ true if the next THROW should store a backtrace
                    101: AUser backtrace-rp0 \ rp at last call of interpret
1.1       anton     102: \ AUser output
                    103: \ AUser input
                    104: 
                    105: AUser errorhandler
                    106: 
                    107: AUser "error            0 "error !
                    108: 
1.3       jwilke    109: [IFUNDEF] #tib         \ in ec-Version we may define this ourself
                    110:  User tibstack         \ saves >tib in execute
                    111:  User >tib             \ pointer to terminal input buffer
1.10      crook     112:  User #tib ( -- a-addr ) \ core-ext
1.17    ! crook     113:  \G USER VARIABLE: @i{a-addr} is the address of a cell containing
1.10      crook     114:  \G the number of characters in the terminal input buffer.
                    115:  \G OBSOLESCENT: @code{source} superceeds the function of this word.
                    116: 
                    117:  User >in ( -- a-addr ) \ core
1.17    ! crook     118:  \G USER VARIABLE: @i{a-addr} is the address of a cell containing the
        !           119:  \G char offset from the start of the input buffer to the start of the
        !           120:  \G parse area.
1.10      crook     121:                         0 >in ! \ char number currently processed in tib
1.3       jwilke    122: [THEN]
1.7       pazsan    123: has? file [IF]
1.10      crook     124:  User blk ( -- a-addr ) \ block
1.17    ! crook     125:  \G USER VARIABLE: @i{a-addr} is the address of a cell containing zero
1.10      crook     126:  \G (in which case the input source is not a block and can be identified
                    127:  \G by @code{source-id}) or the number of the block currently being
                    128:  \G interpreted. A Standard program should not alter @code{blk} directly.
                    129:                        0 blk !
                    130: 
1.1       anton     131:  User loadfile          0 loadfile !
                    132: 
                    133:  User loadfilename#    0 loadfilename# !
                    134: 
                    135:  User loadline          \ number of the currently interpreted
                    136:                         \ (in TIB) line if the interpretation
                    137:                         \ is in a textfile
                    138:                         \ the first line is 1
                    139: 
                    140: 2User linestart         \ starting file postition of
                    141:                         \ the current interpreted line (in TIB)
1.7       pazsan    142: [THEN]
1.1       anton     143: 
1.10      crook     144:  User base ( -- a-addr ) \ core
1.17    ! crook     145:  \G USER VARIABLE: @i{a-addr} is the address of a cell that stores the
1.10      crook     146:  \G number base used by default for number conversion during input and output.
                    147:                         A base !
1.17    ! crook     148:  User dpl ( -- a-addr ) \ gforth
        !           149:  \G USER VARIABLE: @i{a-addr} is the address of a cell that stores the                 
        !           150:  \G position of the decimal point in the most recent numeric conversion.
        !           151:  \G Initialised to -1. After the conversion of a number containing no
        !           152:  \G decimal point, @code{@ dpl} is -1. After the conversion of @code{2.} it holds
        !           153:  \G 0. After the conversion of 234123.9 it contains 1, and so forth.
        !           154:  -1 dpl !
1.1       anton     155: 
1.10      crook     156:  User state ( -- a-addr ) \ core,tools-ext
1.17    ! crook     157:  \G USER VARIABLE: @i{a-addr} is the address of a cell containing the
        !           158:  \G compilation state flag. 0 => interpreting, -1 => compiling.  A
        !           159:  \G program shall not directly alter the value of @code{state}. The
        !           160:  \G following Standard words alter the value in @code{state}: @code{:}
        !           161:  \G (colon) @code{;} (semicolon) @code{abort} @code{quit}
        !           162:  \G @code{:noname} @code{[} (left-bracket) @code{]} (right-bracket)
        !           163:  \G @code{;code}. Don't use @code{state}! @xref{Interpretation and
        !           164:  \G Compilation Semantics} for an alternative. 
        !           165:  \  Recommended reading: @cite{@code{State}-smartness--Why it is evil
        !           166:  \  and how to exorcise it},
        !           167:  \  @url{http://www.complang.tuwien.ac.at/papers/ertl98.ps.gz}; short
        !           168:  \  version: Don't use @code{state}! 
        !           169:  0 state !
1.10      crook     170: 
1.1       anton     171: AUser normal-dp                \ the usual dictionary pointer
                    172: AUser dpp              normal-dp dpp !
                    173:                        \ the pointer to the current dictionary pointer
                    174:                         \ ist reset to normal-dp on (doerror)
                    175:                         \  (i.e. any throw caught by quit)
                    176: AUser LastCFA
                    177: AUser Last
                    178: 
1.7       pazsan    179: has? glocals [IF]
1.1       anton     180: User locals-size \ this is the current size of the locals stack
                    181:                 \ frame of the current word
1.7       pazsan    182: [THEN]
1.1       anton     183: 

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