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