(psystem *)
provides system APIs such as libc
access.
This library requires (pffi)
.
For convenience, it's also a submodule located on deps/pffi
of this
repository.
This library provides the name of the OS.
*psystem:os-name*
: Symbol of the operating system's name. The name shall be the same per implementations if they are running on the same platform.
This library provides access to libc
so that users don't have to write
the following common code:
(define *psystem:libc*
(open-shared-object
(case *psystem:os-name*
((Linux) "libc.so.6")
((Darwin) "libc.dylib")
((Windows) "msvcrt.dll")
;; something else
(else "libc.so"))))
It also provides commonly used C function bindings.
*psystem:libc*
: A PFFI shared object of libc.(psystem:malloc size)
: A binding formalloc
. The returning value is a pointer.(psystem:free pointer)
: A binding forfree
. The given argument must be a pointer which is allocated by thepsystem:malloc
or othermalloc
on the same libc.
Currently the following implemnetations are supported.
- Sagittarius Scheme (0.9.4 or later)
- Chez Scheme (v9.5)
- Larceny (1.3)
If the implemnetation supports SRFI 112, then it would work without modification.
Currently, the only implementation dependent part is (psystem os)
library.
If your implementation doesn't support SRFI 112, then add a file under the
lib/psystem/
with name of os.${implementation}.sls
which is de-fact
standard to dispatch library of R6RS implementations, and impelemnt the
variable described above section.
For example, if you want to add SuperScheme
which can only be run on
Linux machine then the file would look like this:
The file name: os.superscheme.sls
The content:
(library (psystem os)
(export *psystem:os-name*)
(import (rnrs))
(define *psystem:os-name* 'Linux)
)