File:  [gforth] / gforth / environ.fs
Revision 1.19: download - view: text, annotated - select for diffs
Tue Mar 23 20:24:17 1999 UTC (24 years ago) by crook
Branches: MAIN
CVS tags: HEAD
Makefile.in

-- changes to make documentation build with moofglos.fs
   rather than with mini-oof.fs (since the former contains glossary
   entries and the latter does not)

assert.fs blocks.fs debug.fs environ.fs errors.fs extend.fs float.fs
glocals.fs moofglos.fs prim search.fs struct.fs stuff.fs vt100.fs
kernel/args.fs kernel/basics.fs kernel/comp.fs kernel/cond.fs
kernel/files.fs kernel/getdoers.fs kernel/int.fs kernel/io.fs
kernel/nio.fs kernel/paths.fs kernel/require.fs kernel/special.fs
kernel/tools.fs kernel/toolsext.fs kernel/vars.fs

-- many small changes to glossary entries.. I think most are done
   now, so I hope to change far fewer files next time!

doc/gforth.ds

-- many, many small changes and a few large ones. Moved some sections
   around, fixed typos and formatting errors, added new section on
   exception handling, rearranged 'files' section.

    1: \ environmental queries
    2: 
    3: \ Copyright (C) 1995,1996,1997,1998 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 ( -- wid ) \ gforth
   24:   \G wid identifies the word list that is searched by environmental
   25:   \G queries.
   26:   wordlist drop
   27: 
   28: : environment? ( c-addr u -- false / ... true ) \ core environment-query
   29:     \G c-addr, u specify the address and length of a string. If the string is
   30:     \G not recognised, return a @code{false} flag. Otherwise return a true
   31:     \G flag and some (string-specific) information about the queried string.
   32:     environment-wordlist search-wordlist if
   33: 	execute true
   34:     else
   35: 	false
   36:     endif ;
   37: 
   38: : e? name environment? 0= ABORT" environmental dependency not existing" ;
   39: 
   40: : has? name environment? 0= IF false THEN ;
   41: 
   42: : $has? environment? 0= IF false THEN ;
   43: 
   44: environment-wordlist set-current
   45: get-order environment-wordlist swap 1+ set-order
   46: 
   47: \ assumes that chars, cells and doubles use an integral number of aus
   48: 
   49: \ this should be computed in C as CHAR_BITS/sizeof(char),
   50: \ but I don't know any machine with gcc where an au does not have 8 bits.
   51: 8 constant ADDRESS-UNIT-BITS ( -- n ) \ environment
   52: \G Size of one address unit, in bits.
   53: 
   54: 1 ADDRESS-UNIT-BITS chars lshift 1- constant MAX-CHAR ( -- u ) \ environment
   55: \G Maximum value of any character in the character set
   56: 
   57: MAX-CHAR constant /COUNTED-STRING ( -- n ) \ environment
   58: \G Maximum size of a counted string, in characters.
   59: 
   60: ADDRESS-UNIT-BITS cells 2* 2 + constant /HOLD ( -- n ) \ environment
   61: \G Size of the pictured numeric string output buffer, in characters.
   62: 
   63: &84 constant /PAD ( -- n ) \ environment
   64: \G Size of the scratch area pointed to by @code{PAD}, in characters.
   65: 
   66: true constant CORE ( -- f ) \ environment
   67: \G True if the complete core word set is present. Always true for Gforth.
   68: 
   69: true constant CORE-EXT ( -- f ) \ environment
   70: \G True if the complete core extension word set is present. Always true for Gforth.
   71: 
   72: 1 -3 mod 0< constant FLOORED ( -- f ) \ environment
   73: \G True if division is floored by default.
   74: 
   75: 1 ADDRESS-UNIT-BITS cells 1- lshift 1- constant MAX-N ( -- n ) \ environment
   76: \G Largest usable signed integer.
   77: 
   78: -1 constant MAX-U ( -- u ) \ environment
   79: \G Largest usable unsigned integer.
   80: 
   81: -1 MAX-N 2constant MAX-D ( -- d ) \ environment
   82: \G Largest usable signed double.
   83: 
   84: -1. 2constant MAX-UD ( -- ud ) \ environment
   85: \G Largest usable unsigned double.
   86: 
   87: version-string 2constant gforth ( -- c-addr u ) \ gforth-environment
   88: \G Counted string representing a version string for this version of Gforth
   89: \G (for versions>0.3.0).
   90: \ the version strings of the various versions are guaranteed to be
   91: \ sorted lexicographically
   92: 
   93: : return-stack-cells ( -- n ) \ environment
   94:     \G Maximum size of the return stack, in cells.
   95:     [ forthstart 6 cells + ] literal @ cell / ;
   96: 
   97: : stack-cells ( -- n ) \ environment
   98:     \G Maximum size of the data stack, in cells.
   99:     [ forthstart 4 cells + ] literal @ cell / ;
  100: 
  101: : floating-stack ( -- n ) \ environment
  102:     \G @var{n} is non-zero, showing that Gforth maintains a separate
  103:     \G floating-point stack of depth @var{n}.
  104:     [ forthstart 5 cells + ] literal @
  105:     [IFDEF] float  float  [ELSE]  [ 1 floats ] Literal [THEN] / ;
  106: 
  107: \ !! max-float
  108: 15 constant #locals \ 1000 64 /
  109:     \ One local can take up to 64 bytes, the size of locals-buffer is 1000
  110: maxvp constant wordlists
  111: 
  112: forth definitions
  113: previous
  114: 

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