diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..1fcee28e --- /dev/null +++ b/COPYING @@ -0,0 +1,24 @@ +Copyright (c) 2009 Alex Shinn +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README b/README index 4b723595..d1476de2 100644 --- a/README +++ b/README @@ -15,6 +15,9 @@ macros based on syntactic-closures, string ports and exceptions. Chibi-Scheme is written in highly portable C and supports multiple simultaneous VM instances to run. +------------------------------------------------------------------------ +INSTALLING + To build, just run "make". This will provide a shared library "libchibi-scheme", as well as a sample "chibi-scheme" command-line repl. The "chibi-scheme-static" make target builds an equivalent @@ -24,7 +27,7 @@ You can edit the file config.h for a number of settings, mostly disabling features to make the executable smaller. You can specify standard options directly as arguments to make, for example - make CFLAGS=-Os + make CFLAGS=-Os CPPFLAGS=-DSEXP_USE_NO_FEATURES=1 to optimize for size, or @@ -36,46 +39,25 @@ By default Chibi uses a custom, precise, non-moving GC. You can link against the Boehm conservative GC by editing the config file, or directly from make with: - make USE_BOEHM=1 + make SEXP_USE_BOEHM=1 -See the file main.c for an example of using chibi-scheme as a library. -The essential functions to remember are: +------------------------------------------------------------------------ +CHIBI-SCHEME LANGUAGE - #include +The default language is mostly compatible with the R5RS, with all +differences made by design, not through difficulty of implementation. +The following procedures are omitted: - sexp_make_eval_context(NULL, NULL, NULL) - returns a new context with a fresh stack and primitive environment + transcript-on and transcript-off (because they're silly) + rationalize (pending the addition of rational numbers) - sexp_load_standard_env(context, env, version) - loads the init.scm file in primitive environment env - (version should be SEXP_FIVE) +Apart from this, chibi-scheme is case-sensitive, unlike the R5RS. +The default configuration includes fixnums, flonums and bignums +but no exact rationals or complex numbers. - sexp_destroy_context(context) - free a context and all associated memory - - sexp_eval(context, expr, env) - evaluates an s-expression in an environment - env can be NULL to use the context's default env - - sexp_eval_string(context, str) - reads an s-expression from str and evaluates it - - sexp_load(context, file, env) - read and eval all top-level forms from file - - sexp_context_env(context) - a macro returning the environment associated with a context - - sexp_env_define(context, env, symbol, value) - define a variable in an environment - -A minimal module system is provided by default. Currently you can -load the following SRFIs with (import (srfi N)): - - 0, 1, 2, 6, 8, 9, 11, 16, 22, 23, 26, 27, 33, 46, 62, 69, 98 - -although 0, 22, 23, 46 and 62 are built into the default environment -so there's no need to import them. +Full continuations are supported, but currently continuations don't +take C code into account. The only higher-order C functions in the +standard environment are LOAD and EVAL. LOAD is extended to accept an optional environment argument, like EVAL. You can also LOAD shared libraries in addition to Scheme source @@ -84,23 +66,23 @@ called with the following signature: sexp_init_library(sexp context, sexp environment) -To define new primitive functions from C, use sexp_define_foreign, -which takes a Scheme environment, a name, a number of arguments the C -function takes (not counting the context argument), and a C function. +SYNTAX-RULES macros are provided by default, with the extensions from +SRFI-46. In addition, low-level hygienic macros are provided with +a syntactic-closures interface, including SC-MACRO-TRANSFORMER, +RSC-MACRO-TRANSFORMER, and ER-MACRO-TRANSFORMER. A good introduction +to syntactic-closures can be found at: - /* sexp_define_foreign(context, env, name, num_args, f) */ + http://community.schemewiki.org/?syntactic-closures - sexp add (sexp context, sexp x, sexp y) { - return sexp_fx_add(x, y); - } +IDENTIFIER?, IDENTIFIER->SYMBOL, IDENTIFIER=?, and +MAKE-SYNTACTIC-CLOSURE and STRIP-SYNTACTIC-CLOSURES are provided. - sexp_define_foreign(context, env, "add", 2, add); +SRFI-0's COND-EXPAND is provided, with the feature `chibi'. -You can also define functions with a single optional argument: +STRING-CONCATENATE concatenates a list of strings. - sexp_define_foreign_opt(context, env, "add", 2, add, sexp_make_fixnum(1)); - -See the SRFI-69 implementation for more detailed examples of this. +------------------------------------------------------------------------ +TYPES You can define new data types with SRFI-9. This is just syntactic sugar for the following more primitive type constructors: @@ -120,3 +102,305 @@ sugar for the following more primitive type constructors: (make-setter ) => ; takes 2 args, sets the field located at the index +------------------------------------------------------------------------ +MODULE SYSTEM + +A configurable module system, in the style of the Scheme48 module +system, is provided by default. + +Modules names are hierarchical lists of symbols or numbers. The +definition of the module (foo bar baz) is searched for in the file +foo/bar/baz.module. This file should contain an expression of the +form: + + (define-module (foo bar baz) + ...) + +where can be any of + + (export ...) - specify an export list + (import ...) - specify one or more imports + (import-immutable ...) - specify an immutable import + (body ...) - inline Scheme code + (include ...) - load one or more files + (include-shared ...) - dynamic load a library + + can either be a module name or any of + + (only ...) + (except ...) + (rename ( ) ...) + (prefix ) + +The can be composed and perform basic selection and renaming of +individual identifiers from the given module. + +Files are loaded relative to the .module file, and are written with +their extension (so you can use whatever suffix you prefer - .scm, +.ss, .sls, etc.). + +Shared modules, on the other hand, should be specified _without_ the +extension - the correct suffix will be added portably (e.g. .so for +Unix and .dylib for OS X). + +You may also use COND-EXPAND and arbitrary macro expansions in a +module definition to generate . + +------------------------------------------------------------------------ +MODULES + +The default environment is (scheme) - you almost always want to import +this. + +Currently you can load the following SRFIs with (import (srfi N)): + + 0, 1, 2, 6, 8, 9, 11, 16, 22, 23, 26, 27, 33, 39, 46, 62, 69, 95, 98 + +although 0, 22, 23, 46 and 62 are built into the default environment +so there's no need to import them. + +Included non-standard modules are put in the (chibi) module namespace. +The following additional modules are available: + + (chibi net) - networking interface + (chibi filesystem) - local filesystem and file descriptor interface + (chibi process) - processes and signals + (chibi system) - host system and user information + (chibi time) - time and date library + (chibi match) - pattern-matching library + (chibi loop) - extensible loop syntax + (chibi pathname) - pathname manipulation utilities + (chibi uri) - URI parsing and construction utilities + (chibi macroexpand) - macro expansion utility + (chibi ast) - interface to the internal Abstract Syntax Tree + (chibi disasm) - disassembly utility for the chibi VM + (chibi heap-stats) - debugging tool to analyze or dump the heap + +------------------------------------------------------------------------ +C INTERFACE + +See the file main.c for an example of using chibi-scheme as a library. + +The basic usage involves creating a context for evaluation and loading +or evaluating Scheme source with it. Begin by including the eval.h +header file: + + #include + +then call + + sexp_scheme_init(); + +with no parameters to initialize any globals (this actually does +nothing in the standard configuration but is a good idea to call +anyway). + +Then you can use the following to create and manipulate contexts: + + sexp_make_eval_context(context, stack, environment, heap_size) + Creates a new context with the given stack and environment. + If context is non-NULL, this will be the "parent" context and + the two contexts will share a heap. Otherwise, a new heap + will be allocated with heap_size, or a default size if heap_size + is zero. stack and environment may both also be NULL (and _must_ + be NULL if context is NULL) and will be given standard defaults. + + Thus the to create your first context you generally call: + + sexp_make_eval_context(NULL, NULL, NULL, 0) + + You can create as many contexts as you want, and other than those + sharing a heap they are all independent and thread-safe. + + sexp_load_standard_env(context, env, version) + Loads the init.scm file in the environment env. Version refers + to the RnRS version number and should always be SEXP_FIVE. The + environment created with sexp_make_eval_context only contains + core syntactic forms and C primitives (thus for example it has + CAR but not CADR or LIST), so to get a full featured + environment, plus a module system with which to load additional + modules, you want to use this. + + sexp_destroy_context(context) + Signals that you no longer need context, or any other context + sharing the heap. It will thus free() the context and heap and + all associated memory. Does nothing if using the Boehm GC. + +Environments can be handled with the following: + + sexp_context_env(context) + A macro returning the default environment associated with context. + + sexp_env_define(context, env, symbol, value) + Define a variable in an environment. + + sexp_env_ref(env, symbol, dflt) + Fetch the binding for symbol from the environment env, + returning the default dflt if the symbol is unbound. + +You can evaluate code with the following utility: + + sexp_eval(context, expr, env) + Evaluates an s-expression in an environment. + env can be NULL to use the context's default env. + + sexp_eval_string(context, str, env) + Reads an s-expression from str and evaluates it in env. + + sexp_load(context, file, env) + Read and eval all top-level forms from file in environment env. + As described in LOAD above, file may be a shared library. + +To define new primitive functions from C, use sexp_define_foreign, +which takes a Scheme environment, a name, a number of arguments the C +function takes (not counting the context argument), and a C function. + + /* sexp_define_foreign(context, env, name, num_args, f) */ + + sexp add (sexp context, sexp x, sexp y) { + return sexp_fx_add(x, y); + } + + sexp_define_foreign(context, env, "add", 2, add); + +You can also define functions with a single optional argument: + + sexp_define_foreign_opt(context, env, "add", 2, add, sexp_make_fixnum(1)); + +See the SRFI-69 implementation for more detailed examples of this. + +------------------------------------------------------------------------ +FFI + +Simple C FFI. "genstubs.scm file.stub" will read in the C function +FFI definitions from file.stub and output the appropriate C +wrappers into file.c. You can then compile that file with: + + cc -fPIC -shared file.c -lchibi-scheme + +(or using whatever flags are appropriate to generate shared libs on +your platform) and then the generated .so file can be loaded +directly with LOAD, or portably using (include-shared "file") in a +module definition (note that include-shared uses no suffix). + +The goal of this interface is to make access to C types and +functions easy, without requiring the user to write any C code. +That means the stubber needs to be intelligent about various C +calling conventions and idioms, such as return values passed in +actual parameters. Writing C by hand is still possible, and +several of the core modules provide C interfaces directly without +using the stubber. + +================================ + +Struct Interface + +(define-c-struct struct-name + [predicate: predicate-name] + [constructor: constructor-name] + [finalizer: c_finalizer_name] + (type c_field_name getter-name setter-name) ...) + + +================================ + + +Function Interface + +(define-c return-type name-spec (arg-type ...)) + +where name-space is either a symbol name, or a list of +(scheme-name c_name). If just a symbol, the C name is taken +to be the same with -'s replaced by _'s. + +arg-type is a type suitable for input validation and conversion. + +================================ + + +Types + +Types + +Basic Types + void + boolean + char + sexp (no conversions) + +Integer Types: + signed-char short int long + unsigned-char unsigned-short unsigned-int unsigned-long size_t pid_t + time_t (in seconds, but using the chibi epoch of 2010/01/01) + errno (as a return type returns #f on error) + +Float Types: + float double long-double + +String Types: + string - a null-terminated char* + env-string - a VAR=VALUE string represented as a (VAR . VALUE) pair inScheme + in addition you can use (array char) as a string + +Port Types: + input-port output-port + +Struct Types: + +Struct types are by default just referred to by the bare +struct-name from define-c-struct, and it is assumed you want a +pointer to that type. To refer to the full struct, use the struct +modifier, as in (struct struct-name). + +Type modifiers + +Any type may also be written as a list of modifiers followed by the +type itself. The supported modifiers are: + +const: prepends the "const" C type modifier + * as a return or result parameter, makes non-immediates immutable + +free: it's Scheme's responsibility to "free" this resource + * as a return or result parameter, registers the freep flag + this causes the type finalizer to be run when GCed + +maybe-null: this pointer type may be NULL + * as a result parameter, NULL is translated to #f + normally this would just return a wrapped NULL pointer + * as an input parameter, #f is translated to NULL + normally this would be a type error + +pointer: create a pointer to this type + * as a return parameter, wraps the result in a vanilla cpointer + * as a result parameter, boxes then unboxes the value + +struct: treat this struct type as a struct, not a pointer + * as an input parameter, dereferences the pointer + * as a type field, indicates a nested struct + +link: add a gc link + * as a field getter, link to the parent object, so the + parent won't be GCed so long as we have a reference + to the child. this behavior is automatic for nested + structs. + +result: return a result in this parameter + * if there are multiple results (including the return type), + they are all returned in a list + * if there are any result parameters, a return type + of errno returns #f on failure, and as eliminated + from the list of results otherwise + +(value ): specify a fixed value + * as an input parameter, this parameter is not provided + in the Scheme API but always passed as + +(default ): specify a default value + * as the final input parameter, makes the Scheme parameter + optional, defaulting to + +(array []) an array type + * length must be specified for return and result parameters + * if specified, length can be any of + ** an integer, for a fixed size + ** the symbol null, indicating a NULL-terminated array diff --git a/VERSION b/VERSION index 3b04cfb6..be586341 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2 +0.3 diff --git a/lib/chibi/ast.c b/lib/chibi/ast.c index dd85692c..19721c10 100644 --- a/lib/chibi/ast.c +++ b/lib/chibi/ast.c @@ -1,3 +1,6 @@ +/* ast.c -- interface to the Abstract Syntax Tree */ +/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ #include diff --git a/lib/chibi/disasm.c b/lib/chibi/disasm.c index f2a50b7d..2aac1943 100644 --- a/lib/chibi/disasm.c +++ b/lib/chibi/disasm.c @@ -1,4 +1,4 @@ -/* debug.c -- optional debugging utilities */ +/* disasm.c -- optional debugging utilities */ /* Copyright (c) 2009 Alex Shinn. All rights reserved. */ /* BSD-style license: http://synthcode.com/license.txt */ diff --git a/lib/chibi/filesystem.scm b/lib/chibi/filesystem.scm index 27af77e0..aa3fc69f 100644 --- a/lib/chibi/filesystem.scm +++ b/lib/chibi/filesystem.scm @@ -1,3 +1,6 @@ +;; filesystem.scm -- additional filesystem utilities +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (directory-fold dir kons knil) (let ((dir (opendir dir))) diff --git a/lib/chibi/heap-stats.c b/lib/chibi/heap-stats.c index 583277a7..34e415c1 100644 --- a/lib/chibi/heap-stats.c +++ b/lib/chibi/heap-stats.c @@ -1,3 +1,6 @@ +/* heap-stats.c -- count or dump heap objects */ +/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ #include diff --git a/lib/chibi/macroexpand.scm b/lib/chibi/macroexpand.scm index f1322c06..a040855a 100644 --- a/lib/chibi/macroexpand.scm +++ b/lib/chibi/macroexpand.scm @@ -1,3 +1,9 @@ +;; macroexpand.scm -- macro expansion utility +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt + +;; This actually analyzes the expression then reverse-engineers an +;; sexp from the result, generating a minimal amount of renames. (define (macroexpand x) (ast->sexp (analyze x))) diff --git a/lib/chibi/net.scm b/lib/chibi/net.scm index 0ac1adca..85ed756a 100644 --- a/lib/chibi/net.scm +++ b/lib/chibi/net.scm @@ -1,3 +1,6 @@ +;; net.scm -- the high-level network interface +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (with-net-io host service proc) (let lp ((addr (get-address-info host service #f))) diff --git a/lib/chibi/pathname.scm b/lib/chibi/pathname.scm index b8b28b4b..de27ad61 100644 --- a/lib/chibi/pathname.scm +++ b/lib/chibi/pathname.scm @@ -1,3 +1,6 @@ +;; pathname.scm -- a general, non-host-specific path lib +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (string-scan c str . o) (let ((limit (string-length str))) diff --git a/lib/chibi/signal.c b/lib/chibi/signal.c index 930ef468..463e481d 100644 --- a/lib/chibi/signal.c +++ b/lib/chibi/signal.c @@ -1,3 +1,6 @@ +/* signal.c -- process signals interface */ +/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ #define SEXP_MAX_SIGNUM 32 diff --git a/lib/chibi/uri.scm b/lib/chibi/uri.scm index 4386837a..41507961 100644 --- a/lib/chibi/uri.scm +++ b/lib/chibi/uri.scm @@ -1,3 +1,6 @@ +;; uri.scm -- URI parsing library +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; URI representation diff --git a/lib/config.scm b/lib/config.scm index 0993a3e3..1254360d 100644 --- a/lib/config.scm +++ b/lib/config.scm @@ -1,3 +1,6 @@ +;; config.scm -- configuration module +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; modules diff --git a/lib/init.scm b/lib/init.scm index 88fb43b4..cd50ad37 100644 --- a/lib/init.scm +++ b/lib/init.scm @@ -1,3 +1,6 @@ +;; init.scm -- R5RS library procedures +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt ;; provide c[ad]{2,4}r diff --git a/lib/srfi/1/alists.scm b/lib/srfi/1/alists.scm index b5032796..a35db42c 100644 --- a/lib/srfi/1/alists.scm +++ b/lib/srfi/1/alists.scm @@ -1,3 +1,6 @@ +;; alist.scm -- association list utilities +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (alist-cons key value ls) (cons (cons key value) ls)) diff --git a/lib/srfi/1/constructors.scm b/lib/srfi/1/constructors.scm index 836f48b5..e205cee0 100644 --- a/lib/srfi/1/constructors.scm +++ b/lib/srfi/1/constructors.scm @@ -1,3 +1,6 @@ +;; constructors.scm -- list construction utilities +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (xcons a b) (cons b a)) diff --git a/lib/srfi/1/deletion.scm b/lib/srfi/1/deletion.scm index 721ae8c3..70ee5cc5 100644 --- a/lib/srfi/1/deletion.scm +++ b/lib/srfi/1/deletion.scm @@ -1,3 +1,6 @@ +;; deletion.scm -- list deletion utilities +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (delete x ls . o) (let ((eq (if (pair? o) (car o) equal?))) diff --git a/lib/srfi/1/fold.scm b/lib/srfi/1/fold.scm index 5253dec6..892b075c 100644 --- a/lib/srfi/1/fold.scm +++ b/lib/srfi/1/fold.scm @@ -1,3 +1,6 @@ +;; fold.scm -- list fold/reduce utilities +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (fold kons knil ls . lists) (if (null? lists) diff --git a/lib/srfi/1/lset.scm b/lib/srfi/1/lset.scm index dd1a0964..f2ffc4ae 100644 --- a/lib/srfi/1/lset.scm +++ b/lib/srfi/1/lset.scm @@ -1,3 +1,6 @@ +;; lset.scm -- list set library +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (lset<= eq . sets) (if (null? sets) diff --git a/lib/srfi/1/misc.scm b/lib/srfi/1/misc.scm index c40afa1d..1e7568df 100644 --- a/lib/srfi/1/misc.scm +++ b/lib/srfi/1/misc.scm @@ -1,3 +1,6 @@ +;; misc.scm -- miscellaneous list utilities +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (map-onto proc ls init) (let lp ((ls ls) (res init)) diff --git a/lib/srfi/1/predicates.scm b/lib/srfi/1/predicates.scm index 70144660..be84e085 100644 --- a/lib/srfi/1/predicates.scm +++ b/lib/srfi/1/predicates.scm @@ -1,3 +1,6 @@ +;; predicates.scm -- list prediates +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (proper-list? x) (cond ((null? x) #t) diff --git a/lib/srfi/1/search.scm b/lib/srfi/1/search.scm index 4ab9eb7d..ea31d931 100644 --- a/lib/srfi/1/search.scm +++ b/lib/srfi/1/search.scm @@ -1,3 +1,6 @@ +;; search.scm -- list searching and splitting +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (find pred ls) (cond ((find-tail pred ls) => car) (else #f))) diff --git a/lib/srfi/1/selectors.scm b/lib/srfi/1/selectors.scm index c6608d50..74ef7119 100644 --- a/lib/srfi/1/selectors.scm +++ b/lib/srfi/1/selectors.scm @@ -1,3 +1,6 @@ +;; selectors.scm -- extended list selectors +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define first car) (define second cadr) diff --git a/lib/srfi/27/constructors.scm b/lib/srfi/27/constructors.scm index 473ad2a2..dbd0a8c6 100644 --- a/lib/srfi/27/constructors.scm +++ b/lib/srfi/27/constructors.scm @@ -1,3 +1,6 @@ +;; constructors.scm -- random function constructors +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (random-source-make-integers rs) (lambda (n) (%random-integer rs n))) diff --git a/lib/srfi/27/rand.c b/lib/srfi/27/rand.c index bff675c1..d5d3d984 100644 --- a/lib/srfi/27/rand.c +++ b/lib/srfi/27/rand.c @@ -1,3 +1,6 @@ +/* rand.c -- rand_r/random_r interface */ +/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ #include #include diff --git a/lib/srfi/33/bit.c b/lib/srfi/33/bit.c index cbfc940e..38aa4652 100644 --- a/lib/srfi/33/bit.c +++ b/lib/srfi/33/bit.c @@ -1,3 +1,6 @@ +/* bit.c -- bitwise operators */ +/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ #include #include diff --git a/lib/srfi/33/bitwise.scm b/lib/srfi/33/bitwise.scm index 7beaf316..d0ac59f1 100644 --- a/lib/srfi/33/bitwise.scm +++ b/lib/srfi/33/bitwise.scm @@ -1,3 +1,6 @@ +;; bitwise.scm -- high-level bitwise functions +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (bitwise-not i) (- (+ i 1))) diff --git a/lib/srfi/69/hash.c b/lib/srfi/69/hash.c index 51da2b62..e38c23c0 100644 --- a/lib/srfi/69/hash.c +++ b/lib/srfi/69/hash.c @@ -1,3 +1,6 @@ +/* hash.c -- type-general hashing */ +/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ #include diff --git a/lib/srfi/69/interface.scm b/lib/srfi/69/interface.scm index 548d1eae..edd752f1 100644 --- a/lib/srfi/69/interface.scm +++ b/lib/srfi/69/interface.scm @@ -1,3 +1,8 @@ +;; interface.scm -- hash-table interface +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt + +;; the non-exported hash-table-cell is the heart of the implemenation (define (make-hash-table . o) (let ((eq-fn (if (pair? o) (car o) equal?)) diff --git a/lib/srfi/69/type.scm b/lib/srfi/69/type.scm index 849d6a14..1fca9953 100644 --- a/lib/srfi/69/type.scm +++ b/lib/srfi/69/type.scm @@ -1,3 +1,6 @@ +;; types.scm -- the hash-table record type +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define-record-type hash-table (%make-hash-table buckets size hash-fn eq-fn) diff --git a/lib/srfi/95/qsort.c b/lib/srfi/95/qsort.c index ca2bb017..6b304e54 100644 --- a/lib/srfi/95/qsort.c +++ b/lib/srfi/95/qsort.c @@ -1,3 +1,6 @@ +/* qsort.c -- quicksort implementation */ +/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ #include "chibi/eval.h" diff --git a/lib/srfi/95/sort.scm b/lib/srfi/95/sort.scm index 0659c3c9..38273199 100644 --- a/lib/srfi/95/sort.scm +++ b/lib/srfi/95/sort.scm @@ -1,3 +1,6 @@ +;; sort.scm -- SRFI-95 sorting utilities +;; Copyright (c) 2009 Alex Shinn. All rights reserved. +;; BSD-style license: http://synthcode.com/license.txt (define (copy seq) (if (vector? seq) diff --git a/lib/srfi/98/env.c b/lib/srfi/98/env.c index 4a180421..38f8b883 100644 --- a/lib/srfi/98/env.c +++ b/lib/srfi/98/env.c @@ -1,3 +1,6 @@ +/* env.c -- SRFI-98 environment interface */ +/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ #ifdef __APPLE__ #include diff --git a/opt/simplify.c b/opt/simplify.c index d70de633..d4ac576d 100644 --- a/opt/simplify.c +++ b/opt/simplify.c @@ -1,3 +1,6 @@ +/* simplify.c -- basic simplification pass */ +/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ #define simplify_it(it) ((it) = simplify(ctx, it, substs, lambda))