outlining standard r7rs libs

This commit is contained in:
Alex Shinn 2011-10-03 08:36:37 +09:00
parent ea9255e934
commit 0856230839
19 changed files with 110 additions and 14 deletions

View file

@ -5,17 +5,17 @@
# install configuration
CC ?= cc
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
SOLIBDIR ?= $(PREFIX)/lib
INCDIR ?= $(PREFIX)/include/chibi
MODDIR ?= $(PREFIX)/share/chibi
LIBDIR ?= $(PREFIX)/lib/chibi
MANDIR ?= $(PREFIX)/share/man/man1
CC ?= cc
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
SOLIBDIR ?= $(PREFIX)/lib
INCDIR ?= $(PREFIX)/include/chibi
MODDIR ?= $(PREFIX)/share/chibi
BINMODDIR ?= $(PREFIX)/lib/chibi
MANDIR ?= $(PREFIX)/share/man/man1
DESTDIR ?=
DESTDIR ?=
GENSTUBS ?= ./tools/chibi-ffi
GENSTATIC ?= ./tools/chibi-genstatic
@ -136,7 +136,7 @@ INCLUDES = include/chibi/sexp.h include/chibi/features.h include/chibi/install.h
include/chibi/install.h: Makefile
echo '#define sexp_so_extension "'$(SO)'"' > $@
echo '#define sexp_default_module_dir "'$(MODDIR)'"' >> $@
echo '#define sexp_default_module_path "'$(MODDIR):$(BINMODDIR)'"' >> $@
echo '#define sexp_platform "'$(PLATFORM)'"' >> $@
echo '#define sexp_version "'`cat VERSION`'"' >> $@
echo '#define sexp_release_name "'`cat RELEASE`'"' >> $@
@ -261,7 +261,9 @@ install: all
cp chibi-scheme$(EXE) $(DESTDIR)$(BINDIR)/
cp tools/chibi-ffi $(DESTDIR)$(BINDIR)/
cp tools/chibi-doc $(DESTDIR)$(BINDIR)/
mkdir -p $(DESTDIR)$(MODDIR)
mkdir -p $(DESTDIR)$(MODDIR)/chibi
mkdir -p $(DESTDIR)$(MODDIR)/scheme
mkdir -p $(DESTDIR)$(MODDIR)/srfi
cp -r lib/* $(DESTDIR)$(MODDIR)/
mkdir -p $(DESTDIR)$(INCDIR)
cp $(INCLUDES) include/chibi/eval.h $(DESTDIR)$(INCDIR)/
@ -281,6 +283,7 @@ uninstall:
rm -f $(DESTDIR)$(LIBDIR)/libchibi-scheme$(SO).a
cd $(DESTDIR)$(INCDIR) && rm -f $(INCLUDES) include/chibi/eval.h
rm -rf $(DESTDIR)$(MODDIR)
rm -rf $(DESTDIR)$(BINMODDIR)
dist: dist-clean
rm -f chibi-scheme-`cat VERSION`.tgz

2
eval.c
View file

@ -404,7 +404,7 @@ void sexp_init_eval_context_globals (sexp ctx) {
sexp_init_eval_context_bytecodes(ctx);
#endif
sexp_global(ctx, SEXP_G_MODULE_PATH) = SEXP_NULL;
sexp_add_path(ctx, sexp_default_module_dir);
sexp_add_path(ctx, sexp_default_module_path);
sexp_add_path(ctx, getenv(SEXP_MODULE_PATH_VAR));
tmp = sexp_c_string(ctx, "./lib", 5);
sexp_push(ctx, sexp_global(ctx, SEXP_G_MODULE_PATH), tmp);

View file

@ -16,6 +16,7 @@ extern "C" {
#define sexp_init_file "init-"
#define sexp_init_file_suffix ".scm"
#define sexp_meta_file "meta.scm"
#define sexp_leap_seconds_file "leap.txt"
enum sexp_core_form_names {
SEXP_CORE_DEFINE = 1,

View file

@ -3,7 +3,7 @@
(import (except (scheme) equal?)
(rename (chibi equiv) (equiv? equal?))
(chibi io)
(srfi 9) (srfi 11) (srfi 38) (srfi 39))
(srfi 9) (srfi 11) (srfi 39))
(export
* + - ... / < <= = => > >= _ abs and append apply assoc assq assv begin
binary-port? boolean? bytevector-copy bytevector-copy!

View file

@ -0,0 +1,4 @@
(define-library (scheme case-lambda)
(import (srfi 16))
(export case-lambda))

10
lib/scheme/char.sld Normal file
View file

@ -0,0 +1,10 @@
(define-library (scheme char)
(import (scheme))
(export
char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>?
char-downcase char-foldcase char-lower-case? char-numeric?
char-upcase char-upper-case? char-whitespace? numeric-digit
string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>?
string-downcase string-foldcase string-upcase)
(include "char.scm"))

View file

@ -0,0 +1,9 @@
(define-library (scheme char normalization)
(import (rename (scheme)
(string=? string-ni=?)
(string<? string-ni<?)
(string>? string-ni>?)
(string<=? string-ni<=?)
(string>=? string-ni>=?)))
(export string-ni=? string-ni<? string-ni>? string-ni<=? string-ni>=?))

4
lib/scheme/complex.sld Normal file
View file

@ -0,0 +1,4 @@
(define-library (scheme complex)
(import (scheme))
(export angle imag-part magnitude make-polar make-rectangular real-part))

10
lib/scheme/division.sld Normal file
View file

@ -0,0 +1,10 @@
(define-library (scheme division)
(import (scheme))
(export ceiling-quotient ceiling-remainder ceiling/
centered-quotient centered-remainder centered/
euclidean-quotient euclidean-remainder euclidean/
floor-quotient floor-remainder floor/
round-quotient round-remainder round/
truncate-quotient truncate-remainder truncate/)
(include "division.scm"))

4
lib/scheme/eval.sld Normal file
View file

@ -0,0 +1,4 @@
(define-library (scheme eval)
(import (scheme))
(export eval environment null-environment scheme-report-environment))

9
lib/scheme/file.sld Normal file
View file

@ -0,0 +1,9 @@
(define-library (scheme file)
(import (scheme))
(export
call-with-input-file call-with-output-file
delete-file file-exists?
open-binary-input-file open-binary-output-file
open-input-file open-output-file
with-input-from-file with-output-to-file))

4
lib/scheme/inexact.sld Normal file
View file

@ -0,0 +1,4 @@
(define-library (scheme inexact)
(import (scheme))
(export acos asin atan cos exp finite? log nan? sin sqrt tan))

5
lib/scheme/lazy.sld Normal file
View file

@ -0,0 +1,5 @@
(define-library (scheme lazy)
(import (scheme))
(export delay force lazy eager)
(begin (define (eager x) (delay x))))

4
lib/scheme/load.sld Normal file
View file

@ -0,0 +1,4 @@
(define-library (scheme load)
(import (scheme))
(export load))

View file

@ -0,0 +1,5 @@
(define-library (scheme process-context)
(import (scheme) (srfi 98))
(export get-environment-variable get-environment-variables
command-line exit))

4
lib/scheme/read.sld Normal file
View file

@ -0,0 +1,4 @@
(define-library (scheme read)
(import (rename (srfi 38) (read/ss read)))
(export read))

4
lib/scheme/repl.sld Normal file
View file

@ -0,0 +1,4 @@
(define-library (scheme repl)
(import (scheme))
(export interaction-environment))

8
lib/scheme/time.sld Normal file
View file

@ -0,0 +1,8 @@
(define-library (scheme time)
(import (scheme))
(export current-second current-jiffy jiffies-per-second)
(include-shared "time.c")
(begin
(define current-jiffy current-second)
(define (jiffies-per-second) 1)))

8
lib/scheme/write.sld Normal file
View file

@ -0,0 +1,8 @@
(define-library (scheme write)
(import (rename (scheme) (write write-simple) (display display-simple))
(rename (srfi 38) (write/ss write)))
(export display write write-simple)
(begin
(define (display x . o)
(apply (if (or (string? x) (char? x)) display-simple write) x o))))