Next: srfi env-inquiry copyright, Previous: srfi env-inquiry spec, Up: srfi env-inquiry [Index]
The implementation of this SRFI is inherently system–dependent. The version shown below is for an imaginary Scheme implementation, and is in R5RS style. Trivial wrappers will convert it to an R6RS or R7RS library.
Some of the information can be derived from the uname()
system
call, which is provided by the POSIX standard. (Some of the same
information is available on Win32 using GetSystemInfo()
and
GetComputerNameA()
.)
The exact Scheme interface to uname()
is highly system–dependent.
system-information
procedure returns a list of
five strings representing the five components of the POSIX
utsname
structure.
sys-uname
.
uname
, and returns a vector
rather than a list; Sizzle places it in the module (core posix)
.
posix
structure named os-name
, os-node-name
,
os-release-name
, os-version-name
, and machine-name
.
uname
procedure returns a record whose fields have
the same names as the Scheme48 procedures; their accessors are named
uname:os-name
, etc.
The version below uses the Guile convention.
(define (implementation-name) "Fantastic Scheme") (define (implementation-version) "1.0") (define (cpu-architecture) (vector-ref (uname) 4)) ; POSIX machine field (define (machine-name) (vector-ref (uname) 1)) ; POSIX nodename field (define (os-name) (vector-ref (uname) 0)) ; POSIX sysname field (define (os-version) (string-append (vector-ref (uname) 2) ; POSIX version field " " (vector-ref (uname) 3))) ; POSIX release field