File:  [gforth] / gforth / environ.fs
Revision 1.12: download - view: text, annotated - select for diffs
Fri Jun 6 17:27:54 1997 UTC (24 years, 4 months ago) by anton
Branches: MAIN
CVS tags: HEAD
Environmental query "gforth" now returns the version-string
dictionary-end and unused moved into the kernel/basics.fs
Minor gforth.el bug fixes
Major rewrite of objects.fs (not yet done)
fixed -trailing bug (with test in test/other.fs)
optimization of fields with offset 0 in struct.fs and compat/struct.fs
other changes in compat/struct.fs (not yet done)
added ansreports to compat/*.fs
documentation changes
allot now checks for dict overflow
named [IS] (compilation semantics of IS).
minor changes

    1: \ environmental queries
    2: 
    3: \ Copyright (C) 1995 Free Software Foundation, Inc.
    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: \ wordlist constant environment-wordlist
   22: 
   23: Create environment-wordlist  wordlist drop
   24: 
   25: : environment? ( c-addr u -- false / ... true ) \ core environment-query
   26:     environment-wordlist search-wordlist if
   27: 	execute true
   28:     else
   29: 	false
   30:     endif ;
   31: 
   32: environment-wordlist set-current
   33: get-order environment-wordlist swap 1+ set-order
   34: 
   35: \ assumes that chars, cells and doubles use an integral number of aus
   36: 
   37: \ this should be computed in C as CHAR_BITS/sizeof(char),
   38: \ but I don't know any machine with gcc where an au does not have 8 bits.
   39: 8 constant ADDRESS-UNIT-BITS ( -- n ) \ environment
   40: 1 ADDRESS-UNIT-BITS chars lshift 1- constant MAX-CHAR
   41: MAX-CHAR constant /COUNTED-STRING
   42: ADDRESS-UNIT-BITS cells 2* 2 + constant /HOLD
   43: &84 constant /PAD
   44: true constant CORE
   45: true constant CORE-EXT
   46: 1 -3 mod 0< constant FLOORED
   47: 
   48: 1 ADDRESS-UNIT-BITS cells 1- lshift 1- constant MAX-N
   49: -1 constant MAX-U
   50: 
   51: -1 MAX-N 2constant MAX-D
   52: -1. 2constant MAX-UD
   53: 
   54: version-string 2constant gforth \ version string (for versions>0.3.0)
   55: \ the version strings of the various versions are guaranteed to be
   56: \ sorted lexicographically
   57: 
   58: : return-stack-cells ( -- n )
   59:     [ forthstart 6 cells + ] literal @ cell / ;
   60: 
   61: : stack-cells ( -- n )
   62:     [ forthstart 4 cells + ] literal @ cell / ;
   63: 
   64: : floating-stack ( -- n )
   65:     [ forthstart 5 cells + ] literal @
   66:     [IFDEF] float  float  [ELSE]  [ 1 floats ] Literal [THEN] / ;
   67: 
   68: \ !! max-float
   69: 15 constant #locals \ 1000 64 /
   70:     \ One local can take up to 64 bytes, the size of locals-buffer is 1000
   71: maxvp constant wordlists
   72: 
   73: forth definitions
   74: previous
   75: 

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