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