merged with upstream commits

This commit is contained in:
felix 2009-07-01 18:30:13 +02:00
commit 7df9ff823a
4 changed files with 77 additions and 58 deletions

View file

@ -2,12 +2,11 @@
.PHONY: all doc dist clean cleaner test install uninstall
all: chibi-scheme
CC ?= cc
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
SOLIBDIR ?= $(PREFIX)/lib
INCDIR ?= $(PREFIX)/include/chibi
MODDIR ?= $(PREFIX)/share/chibi
@ -17,9 +16,14 @@ ifndef PLATFORM
ifeq ($(shell uname),Darwin)
PLATFORM=macosx
else
ifeq ($(shell uname -o),Msys)
PLATFORM=mingw
SOLIBDIR = $(BINDIR)
else
PLATFORM=unix
endif
endif
endif
ifeq ($(PLATFORM),macosx)
SO = .dylib
@ -30,7 +34,10 @@ else
ifeq ($(PLATFORM),mingw)
SO = .dll
EXE = .exe
CLIBFLAGS = -fPIC -shared
CC = gcc
CLIBFLAGS = -shared
CPPFLAGS += -DUSE_STRING_STREAMS=0 -DBUILDING_DLL -DUSE_DEBUG=0
LDFLAGS += -Wl,--out-implib,libchibi-scheme$(SO).a
else
SO = .so
EXE =
@ -39,6 +46,8 @@ STATICFLAGS = -static
endif
endif
all: chibi-scheme$(EXE)
ifdef USE_BOEHM
GCLDFLAGS := -lgc
XCPPFLAGS := $(CPPFLAGS) -Iinclude -DUSE_BOEHM=1
@ -77,10 +86,10 @@ clean:
rm -f *.o *.i *.s
cleaner: clean
rm -f chibi-scheme chibi-scheme-static *$(SO)
rm -f chibi-scheme$(EXE) chibi-scheme-static$(EXE) *$(SO) *.a
rm -rf *.dSYM
test-basic: chibi-scheme
test-basic: chibi-scheme$(EXE)
@for f in tests/basic/*.scm; do \
./chibi-scheme $$f >$${f%.scm}.out 2>$${f%.scm}.err; \
if diff -q $${f%.scm}.out $${f%.scm}.res; then \
@ -93,20 +102,22 @@ test-basic: chibi-scheme
test: chibi-scheme
./chibi-scheme tests/r5rs-tests.scm
install: chibi-scheme
install: chibi-scheme$(EXE)
mkdir -p $(DESTDIR)$(BINDIR)
cp chibi-scheme $(DESTDIR)$(BINDIR)/
cp chibi-scheme$(EXE) $(DESTDIR)$(BINDIR)/
mkdir -p $(DESTDIR)$(MODDIR)
cp init.scm $(DESTDIR)$(MODDIR)/
mkdir -p $(DESTDIR)$(INCDIR)
cp $(INCLUDES) include/chibi/eval.h $(DESTDIR)$(INCDIR)/
mkdir -p $(DESTDIR)$(LIBDIR)
cp libchibi-scheme$(SO) $(DESTDIR)$(LIBDIR)/
cp libchibi-scheme$(SO) $(DESTDIR)$(SOLIBDIR)/
-cp libchibi-scheme$(SO).a $(DESTDIR)$(LIBDIR)/
if type ldconfig >/dev/null 2>/dev/null; then ldconfig; fi
uninstall:
rm -f $(BINDIR)/chibi-scheme*
rm -f $(LIBDIR)/libchibi-scheme$(SO)
rm -f $(SOLIBDIR)/libchibi-scheme$(SO)
rm -f $(LIBDIR)/libchibi-scheme$(SO).a
cd $(INCDIR) && rm -f $(INCLUDES) include/chibi/eval.h
rm -f $(MODDIR)/*.scm

View file

@ -118,3 +118,11 @@
#endif
#endif
#ifdef __MINGW32__
#ifdef BUILDING_DLL
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#endif

View file

@ -128,13 +128,13 @@ enum opcode_names {
/**************************** prototypes ******************************/
void sexp_scheme_init();
sexp sexp_apply(sexp context, sexp proc, sexp args);
sexp sexp_eval(sexp context, sexp obj);
sexp sexp_eval_string(sexp context, char *str);
sexp sexp_load(sexp context, sexp expr, sexp env);
sexp sexp_make_context(sexp context, sexp stack, sexp env);
void sexp_warn_undefs(sexp ctx, sexp from, sexp to, sexp out);
DLLEXPORT void sexp_scheme_init();
DLLEXPORT sexp sexp_apply(sexp context, sexp proc, sexp args);
DLLEXPORT sexp sexp_eval(sexp context, sexp obj);
DLLEXPORT sexp sexp_eval_string(sexp context, char *str);
DLLEXPORT sexp sexp_load(sexp context, sexp expr, sexp env);
DLLEXPORT sexp sexp_make_context(sexp context, sexp stack, sexp env);
DLLEXPORT void sexp_warn_undefs(sexp ctx, sexp from, sexp to, sexp out);
#endif /* ! SEXP_EVAL_H */

View file

@ -543,53 +543,53 @@ sexp sexp_make_flonum(sexp ctx, double f);
#define sexp_write_string(x, s, p) (sexp_port_buf(p) ? sexp_buffered_write_string(x, s, p) : (fputs(s, sexp_port_stream(p)), SEXP_VOID))
#define sexp_flush(x, p) (sexp_port_buf(p) ? sexp_buffered_flush(x, p) : (fflush(sexp_port_stream(p)), SEXP_VOID))
int sexp_buffered_read_char (sexp ctx, sexp p);
sexp sexp_buffered_write_char (sexp ctx, int c, sexp p);
sexp sexp_buffered_write_string_n (sexp ctx, char *str, sexp_uint_t len, sexp p);
sexp sexp_buffered_write_string (sexp ctx, char *str, sexp p);
sexp sexp_buffered_flush (sexp ctx, sexp p);
DLLEXPORT int sexp_buffered_read_char (sexp ctx, sexp p);
DLLEXPORT sexp sexp_buffered_write_char (sexp ctx, int c, sexp p);
DLLEXPORT sexp sexp_buffered_write_string_n (sexp ctx, char *str, sexp_uint_t len, sexp p);
DLLEXPORT sexp sexp_buffered_write_string (sexp ctx, char *str, sexp p);
DLLEXPORT sexp sexp_buffered_flush (sexp ctx, sexp p);
#endif
#define sexp_newline(ctx, p) sexp_write_char(ctx, '\n', (p))
sexp sexp_alloc_tagged(sexp ctx, size_t size, sexp_uint_t tag);
sexp sexp_cons(sexp ctx, sexp head, sexp tail);
sexp sexp_list2(sexp ctx, sexp a, sexp b);
sexp sexp_equalp (sexp ctx, sexp a, sexp b);
sexp sexp_listp(sexp ctx, sexp obj);
sexp sexp_reverse(sexp ctx, sexp ls);
sexp sexp_nreverse(sexp ctx, sexp ls);
sexp sexp_append2(sexp ctx, sexp a, sexp b);
sexp sexp_memq(sexp ctx, sexp x, sexp ls);
sexp sexp_assq(sexp ctx, sexp x, sexp ls);
sexp sexp_length(sexp ctx, sexp ls);
sexp sexp_c_string(sexp ctx, char *str, sexp_sint_t slen);
sexp sexp_make_string(sexp ctx, sexp len, sexp ch);
sexp sexp_substring (sexp ctx, sexp str, sexp start, sexp end);
sexp sexp_string_concatenate (sexp ctx, sexp str_ls);
sexp sexp_intern(sexp ctx, char *str);
sexp sexp_string_to_symbol(sexp ctx, sexp str);
sexp sexp_make_vector(sexp ctx, sexp len, sexp dflt);
sexp sexp_list_to_vector(sexp ctx, sexp ls);
void sexp_write(sexp ctx, sexp obj, sexp out);
sexp sexp_read_string(sexp ctx, sexp in);
sexp sexp_read_symbol(sexp ctx, sexp in, int init, int internp);
sexp sexp_read_number(sexp ctx, sexp in, int base);
sexp sexp_read_raw(sexp ctx, sexp in);
sexp sexp_read(sexp ctx, sexp in);
sexp sexp_read_from_string(sexp ctx, char *str);
sexp sexp_make_input_port(sexp ctx, FILE* in, sexp name);
sexp sexp_make_output_port(sexp ctx, FILE* out, sexp name);
sexp sexp_make_input_string_port(sexp ctx, sexp str);
sexp sexp_make_output_string_port(sexp ctx);
sexp sexp_get_output_string(sexp ctx, sexp port);
sexp sexp_make_exception(sexp ctx, sexp kind, sexp message, sexp irritants, sexp procedure, sexp source);
sexp sexp_user_exception (sexp ctx, sexp self, char *message, sexp obj);
sexp sexp_type_exception (sexp ctx, char *message, sexp obj);
sexp sexp_range_exception (sexp ctx, sexp obj, sexp start, sexp end);
sexp sexp_print_exception(sexp ctx, sexp exn, sexp out);
void sexp_init();
DLLEXPORT sexp sexp_alloc_tagged(sexp ctx, size_t size, sexp_uint_t tag);
DLLEXPORT sexp sexp_cons(sexp ctx, sexp head, sexp tail);
DLLEXPORT sexp sexp_list2(sexp ctx, sexp a, sexp b);
DLLEXPORT sexp sexp_equalp (sexp ctx, sexp a, sexp b);
DLLEXPORT sexp sexp_listp(sexp ctx, sexp obj);
DLLEXPORT sexp sexp_reverse(sexp ctx, sexp ls);
DLLEXPORT sexp sexp_nreverse(sexp ctx, sexp ls);
DLLEXPORT sexp sexp_append2(sexp ctx, sexp a, sexp b);
DLLEXPORT sexp sexp_memq(sexp ctx, sexp x, sexp ls);
DLLEXPORT sexp sexp_assq(sexp ctx, sexp x, sexp ls);
DLLEXPORT sexp sexp_length(sexp ctx, sexp ls);
DLLEXPORT sexp sexp_c_string(sexp ctx, char *str, sexp_sint_t slen);
DLLEXPORT sexp sexp_make_string(sexp ctx, sexp len, sexp ch);
DLLEXPORT sexp sexp_substring (sexp ctx, sexp str, sexp start, sexp end);
DLLEXPORT sexp sexp_string_concatenate (sexp ctx, sexp str_ls);
DLLEXPORT sexp sexp_intern(sexp ctx, char *str);
DLLEXPORT sexp sexp_string_to_symbol(sexp ctx, sexp str);
DLLEXPORT sexp sexp_make_vector(sexp ctx, sexp len, sexp dflt);
DLLEXPORT sexp sexp_list_to_vector(sexp ctx, sexp ls);
DLLEXPORT void sexp_write(sexp ctx, sexp obj, sexp out);
DLLEXPORT sexp sexp_read_string(sexp ctx, sexp in);
DLLEXPORT sexp sexp_read_symbol(sexp ctx, sexp in, int init, int internp);
DLLEXPORT sexp sexp_read_number(sexp ctx, sexp in, int base);
DLLEXPORT sexp sexp_read_raw(sexp ctx, sexp in);
DLLEXPORT sexp sexp_read(sexp ctx, sexp in);
DLLEXPORT sexp sexp_read_from_string(sexp ctx, char *str);
DLLEXPORT sexp sexp_make_input_port(sexp ctx, FILE* in, sexp name);
DLLEXPORT sexp sexp_make_output_port(sexp ctx, FILE* out, sexp name);
DLLEXPORT sexp sexp_make_input_string_port(sexp ctx, sexp str);
DLLEXPORT sexp sexp_make_output_string_port(sexp ctx);
DLLEXPORT sexp sexp_get_output_string(sexp ctx, sexp port);
DLLEXPORT sexp sexp_make_exception(sexp ctx, sexp kind, sexp message, sexp irritants, sexp procedure, sexp source);
DLLEXPORT sexp sexp_user_exception (sexp ctx, sexp self, char *message, sexp obj);
DLLEXPORT sexp sexp_type_exception (sexp ctx, char *message, sexp obj);
DLLEXPORT sexp sexp_range_exception (sexp ctx, sexp obj, sexp start, sexp end);
DLLEXPORT sexp sexp_print_exception(sexp ctx, sexp exn, sexp out);
DLLEXPORT void sexp_init();
#endif /* ! SEXP_H */