updating docs for new release

This commit is contained in:
Alex Shinn 2011-11-24 10:49:55 +09:00
parent 4d23c1e7c5
commit 473d16e99b
7 changed files with 134 additions and 18 deletions

View file

@ -11,8 +11,9 @@ Thanks to the following people for patches and bug reports:
* Andreas Rottman * Andreas Rottman
* Bakul Shah * Bakul Shah
* Bruno Deferrari * Bruno Deferrari
* Doug Curie * Doug Currie
* Derrick Eddington * Derrick Eddington
* Dmitry Chestnykh
* Eduardo Cavazos * Eduardo Cavazos
* Felix Winkelmann * Felix Winkelmann
* Gregor Klinke * Gregor Klinke

11
README
View file

@ -11,11 +11,12 @@ and scripting language in C programs. In addition to support for
lightweight VM-based threads, each VM itself runs in an isolated heap lightweight VM-based threads, each VM itself runs in an isolated heap
allowing multiple VMs to run simultaneously in different OS threads. allowing multiple VMs to run simultaneously in different OS threads.
The default language is R7RS Scheme with support for additional The default language is an extended subset of the current draft R7RS
languages such as JavaScript to be provided in future releases. Scheme, with support for all libraries. Support for additional
Scheme is chosen as a substrate because its first class continuations languages such as JavaScript, Go, Lua and Bash are planned for future
and guaranteed tail-call optimization makes implementing other releases. Scheme is chosen as a substrate because its first class
languages easy. continuations and guaranteed tail-call optimization makes implementing
other languages easy.
To build on most platforms just run "make && make test". This will To build on most platforms just run "make && make test". This will
provide a shared library "libchibi-scheme", as well as a sample provide a shared library "libchibi-scheme", as well as a sample

View file

@ -56,7 +56,8 @@ is given, the script will be loaded with SRFI-22 semantics,
calling the procedure calling the procedure
.I main .I main
(if defined) with a single parameter as a list of the (if defined) with a single parameter as a list of the
command-line arguments beginning with the script name. command-line arguments beginning with the script name. This
works as expected with shell #! semantics.
Otherwise, if no script is given and no -e or -p options Otherwise, if no script is given and no -e or -p options
are given an interactive repl is entered, reading, evaluating, are given an interactive repl is entered, reading, evaluating,
@ -65,7 +66,15 @@ provided is very minimal - if you want readline
completion you may want to wrap it with the completion you may want to wrap it with the
.I rlwrap(1) .I rlwrap(1)
program. Signals aren't caught either - to enable handling keyboard program. Signals aren't caught either - to enable handling keyboard
interrupts you can use the (chibi process) module. interrupts you can use the (chibi process) module. For a more
sophisticated REPL with readline support, signal handling, module
management and smarter read/write you may want to use the (chibi repl)
module. For example,
.I chibi-scheme -mchibi.repl -e'(repl)'
The default language is an extended subset of the draft R7RS
(scheme base) module. To get exactly the base module, use
.I chibi-scheme -xscheme.base
.SH OPTIONS .SH OPTIONS
.TP 5 .TP 5

View file

@ -13,13 +13,12 @@ and scripting language in C programs. In addition to support for
lightweight VM-based threads, each VM itself runs in an isolated heap lightweight VM-based threads, each VM itself runs in an isolated heap
allowing multiple VMs to run simultaneously in different OS threads. allowing multiple VMs to run simultaneously in different OS threads.
@margin-note{Converging with the The default language is an extended subset of the current draft R7RS
R7RS Scheme small language standard when the standard is finalized.} Scheme, with support for all libraries. Support for additional
The default language is R5RS Scheme with support for additional languages such as JavaScript, Go, Lua and Bash are planned for future
languages such as JavaScript to be provided in future releases. releases. Scheme is chosen as a substrate because its first class
Scheme is chosen as a substrate because its first class continuations continuations and guaranteed tail-call optimization makes implementing
and guaranteed tail-call optimization makes implementing other other languages easy.
languages easy.
The system is designed in optional layers, beginning with a VM based The system is designed in optional layers, beginning with a VM based
on a small set of opcodes, a set of primitives implemented in C, a on a small set of opcodes, a set of primitives implemented in C, a
@ -28,8 +27,8 @@ standard modules. You can choose whichever layer suits your needs
best and customize the rest. Adding your own primitives or wrappers best and customize the rest. Adding your own primitives or wrappers
around existing C libraries is easy with the C FFI. around existing C libraries is easy with the C FFI.
Chibi is known to build and run on 32 and 64-bit Linux, OS X, Chibi is known to build and run on 32 and 64-bit Linux, FreeBSD, OS X,
iOS, Windows (under cygwin) and Plan9. iOS, Windows (under Cygwin) and Plan9.
@section{Installation} @section{Installation}
@ -43,7 +42,8 @@ test the build with "make test".
To install run "make install". If you want to try the executable out To install run "make install". If you want to try the executable out
without installing, you will probably need to set LD_LIBRARY_PATH, without installing, you will probably need to set LD_LIBRARY_PATH,
depending on your platform. depending on your platform. If you have an old version installed,
run "make uninstall" first, or manually delete the directory.
You can edit the file chibi/features.h for a number of settings, You can edit the file chibi/features.h for a number of settings,
mostly disabling features to make the executable smaller. You can mostly disabling features to make the executable smaller. You can
@ -106,6 +106,18 @@ are listed below.
@item{@ccode{SEXP_USE_NO_FEATURES} - disable almost all features} @item{@ccode{SEXP_USE_NO_FEATURES} - disable almost all features}
] ]
@subsection{Installed Programs}
The command-line programs @ccode{chibi-scheme}, @ccode{chibi-doc} and
@ccode{chibi-ffi} are installed by default, along with manpages.
@ccode{chibi-scheme} provides a REPL and way to run scripts. In the
interest of size it has no --help option - see the man page for usage.
@ccode{chibi-doc} is the command-line interface to the literate
documentation system described in
@hyperlink["lib/chibi/scribble.html"]{(chibi scribble)}, and used to
build this manual. @ccode{chibi-ffi} is a tool to build wrappers for
C libraries, described in the FFI section below.
@section{Default Language} @section{Default Language}
@subsection{Scheme Standard} @subsection{Scheme Standard}

38
examples/echo-server.scm Normal file
View file

@ -0,0 +1,38 @@
(import (srfi 18) (chibi net) (chibi io) (chibi filesystem))
;; Copy each input line to output.
(define (echo-handler in out)
(let ((line (read-line in)))
(cond
((not (eof-object? line))
(display line out)
(newline out)
(flush-output out)
(echo-handler in out)))))
;; Run a handler in a separate thread on the input and output ports,
;; then cleanup.
(define (run-io-handler sock handler)
(let ((in (open-input-file-descriptor sock))
(out (open-output-file-descriptor sock)))
(thread-start!
(make-thread
(lambda ()
(handler in out)
(close-input-port in)
(close-output-port out)
(close-file-descriptor sock))))))
;; Basic server loop - repeatedly call accept, and dispatch the new
;; socket to a handler.
(define (serve host port)
(let* ((addrinfo (get-address-info host port))
(sock (make-listener-socket addrinfo)))
(do () (#f)
(let ((fd (accept sock
(address-info-address addrinfo)
(address-info-address-length addrinfo))))
(run-io-handler fd echo-handler)))))
(serve "localhost" 5556)

28
tests/process-tests.scm Normal file
View file

@ -0,0 +1,28 @@
(cond-expand
(modules (import (chibi process) (only (chibi test) test-begin test test-end)))
(else #f))
(test-begin "processes")
(test #t (process-running? (current-process-id)))
(test #t (process-running? (parent-process-id)))
(test #f (signal-set-contains? (current-signal-mask) signal/alarm))
(test #t (signal-set? (make-signal-set)))
(test #t (signal-set? (current-signal-mask)))
(test #f (signal-set? #f))
(test #f (signal-set? '(#f)))
(test #f (signal-set-contains? (make-signal-set) signal/interrupt))
(test #t (let ((sset (make-signal-set)))
(signal-set-fill! sset)
(signal-set-contains? sset signal/interrupt)))
(test #t (let ((sset (make-signal-set)))
(signal-set-add! sset signal/interrupt)
(signal-set-contains? sset signal/interrupt)))
(test #f (let ((sset (make-signal-set)))
(signal-set-fill! sset)
(signal-set-delete! sset signal/interrupt)
(signal-set-contains? sset signal/interrupt)))
(test-end)

27
tests/system-tests.scm Normal file
View file

@ -0,0 +1,27 @@
(cond-expand
(modules (import (chibi system) (only (chibi test) test-begin test test-end)))
(else #f))
(test-begin "system")
(test #t (user? (user-information (current-user-id))))
(test #f (user? #f))
(test #f (user? (list #f)))
(test #t (string? (user-name (user-information (current-user-id)))))
(test #t (string? (user-password (user-information (current-user-id)))))
(test #t (integer? (user-id (user-information (current-user-id)))))
(test #t (integer? (user-group-id (user-information (current-user-id)))))
(test #t (string? (user-gecos (user-information (current-user-id)))))
(test #t (string? (user-home (user-information (current-user-id)))))
(test #t (string? (user-shell (user-information (current-user-id)))))
(test (current-user-id) (user-id (user-information (current-user-id))))
(test (current-group-id) (user-group-id (user-information (current-user-id))))
(test (user-id (user-information (current-user-id)))
(user-id (user-information (user-name (user-information (current-user-id))))))
(test #t (integer? (current-session-id)))
(test-end)