Replies: 2 comments
-
I implemented the following set of words: : OS-API ( -- sd.os-api ) "posix" ;
: OS-BRANCH ( -- sd.os-family-root ) "nix" ;
: OS-FAMILY ( -- sd.os-family ) "linux" ;
: OS-VERSION ( -- sd.os-version ) 0 0 ; \ not implemented yet
: OS-VERSION-NUMBER ( -- u.minor u.major ) 0 2 ; \ not implemented yet
: OS-NAME ( -- sd.os-name )
"OSTYPE" ENVIRONMENT? IF EXIT THEN 0.
; See also the Factor's approach: Operating system detection. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Am Dienstag, 3. September 2024, 22:01:41 MESZ schrieb ruv:
I
[implemented](https://github.com/rufig/spf4-utf8/blob/master/devel/~pinka/s
pf/os-detection.f) the following set of words:
```forth
: OS-API ( -- sd.os-api ) "posix" ;
: OS-BRANCH ( -- sd.os-family-root ) "nix" ;
: OS-FAMILY ( -- sd.os-family ) "linux" ;
: OS-VERSION ( -- ud.os-version ) 0 0 ; \ not implemented yet
: OS-VERSION-NUMBER ( -- u.minor u.major ) 0 2 ; \ not implemented yet
: OS-NAME ( -- sd.os-name )
"OSTYPE" ENVIRONMENT? IF EXIT THEN 0.
Gforth has two environments: OS-CLASS (e.g. “unix”) and OS-TYPE (e.g. “linux-
gnu”). The convention for the Forth system itself is that its name is a word
that prints the greeting; this works for Gforth and SwiftForth (those are the
names devined therein); VFXForth also has that word (i.e. VFXForth) defined,
but it doesn't print the greeting.
…--
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o id: ***@***.***}1GWr!+0qqp_Cn176t4(dQ*
https://net2o.de/
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a naming conventional for constants describing the OS and implementation, similar to C predefines, eg.
__STDC__
,__NetBSD__
,__GNUC__
, etc. For example for Forth constants that can be tested with[DEFINED]
, eg.__GFORTH__
,__VFX__
,__SWIFT__
,__LINUX__
,__ROCKY__
,__FREEBSD__
, ...?Essentially predefined constants for the implementation that packages can test for?
Beta Was this translation helpful? Give feedback.
All reactions