| What is KSM-Scheme? |
int inum = 123;
int add(int a, int b) { return a+b; }
In order to manipulate these variable and function, compilation of
glue functions (written in C language) is not required. One can
do that completely within KSM-Scheme as follow,
(load-shared "libsome.so")
(define inum (clang:sym int inum))
(define add (clang:sym int (add int int)))
inum ==> 123
(set! inum 1000) ;; inum in libsome.so is modified
inum ==> 1000
(add inum 234) ==> 1234 ;; call of C function "add"
Besides easy interface to C language, KSM-Scheme has following
features.
| How to download KSM-Scheme |
| How to make KSM-Scheme |
$ tar -xzvf ksm-0.3.2.tar.gz
2. `cd' to `ksm-0.3.2'
$ cd ksm-0.3.2
3. Do configuration
$ ./configure
By default, necessary files are installed in /usr/local/ksm directory, executable `ksm' is installed in /usr/local/bin, man file in /usr/local/man, and info files are installed in /usr/local/info. If these defaults are not desirable (for example, all files are to be installed in the user's home directory), following options to ./configure can be used.
$ ./configure --prefix=/home/hangil
With this option (--prefix), necessary files are installed in /home/hangil/ksm, executable in /home/hangil/bin, and info files in /home/hangil/info
$ ./configure --prefix=/home/hangil --bindir=/usr/bin
With this option (--prefix and --bindir), necessary files are installed in /home/hangil/ksm, executable int /usr/bin, and info files in /home/hangil/info
$ ./configure --prefix=/home/hangil --bindir=/usr/bin --infodir=/usr/info
With this option (--prefix and --bindir), necessary files are installed in /home/hangil/ksm, executable int /usr/bin, and info files in /usr/info
$ ./configure --mandir=/usr/man
With this option (--mandir), man file is installed in /usr/man 4. Do make
$ make
5. Do install
$ install
Depending on the circumstances, PATH or INFOPATH environment variables may be adjusted. For example, if the directory under which executable `ksm' is installed is not included in PATH,
$ export PATH=/home/hangil/bin:$PATH
If the directory under which info files are installed cannot be accessed by `info' command,
$ export INFOPATH=/home/hangil/info:$INFOPATH
In the distribution, sample Scheme programs are included ("r5rs.scm" and "pi.scm") under the ksm-0.3.2 directory. "pi.scm" is from SCM Scheme ditribution. It uses bignum features of KSM-SCheme, which is available only under the system that has GMP library. If the system does not have GMP library, `(load "pi.scm")' will raise an error.
$ ksm
> (load "r5rs.scm")
...
> (load "pi.scm")
#
> (pi 1000)
3.
1415926535 ...
| How to invoke KSM-Scheme |
ksm [options] [FILE ARG ...]
Acceptable options are
-xl FILE load FILE before starting the interpreter
-xc ENCODING set the default encoding to ENCODING
-xh display the help information
If ENCODING is specified, input files (including standard input) are assumed to be encoding by ENCODING and they are automatically converted to UTF-8 encoding while reading the file. Output files (including standard output and standard error) are automatically converted to ENCODING from UTF-8 that is the internal encoding in KSM-Scheme.
For example, to use KSM-Scheme under the circumstances in which `kterm' with default encoding of EUC-JP is used, following invocation will provide the desirable interaction.
ksm -xc EUC-JP
If FILE is specified, it should be the name of a Scheme source file. The KSM-Scheme interpreter loads the file and then terminates. If FILEfile is omitted, KSM-Scheme enters an interactive mode and accepts Scheme source from standard input.
If ARGS are specified, it is passed the FILE program as command line arguments. They can be accessed by `cmdline-args' from the program.
$ cat src.scm
(display (cmdline-args))
(newline)
$ ksm src.scm a b c
(src.scm a b c)
| Documents |
| Other Scheme Implementations |
| Supported platforms |
| References |