mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 22:59:16 +02:00
initial windows mingw support patch from felix winkelmann
This commit is contained in:
parent
e8985cd84c
commit
41f54a7f41
4 changed files with 84 additions and 65 deletions
39
Makefile
39
Makefile
|
@ -2,14 +2,13 @@
|
||||||
|
|
||||||
.PHONY: all doc dist clean cleaner test install uninstall
|
.PHONY: all doc dist clean cleaner test install uninstall
|
||||||
|
|
||||||
all: chibi-scheme
|
CC ?= cc
|
||||||
|
PREFIX ?= /usr/local
|
||||||
CC ?= cc
|
BINDIR ?= $(PREFIX)/bin
|
||||||
PREFIX ?= /usr/local
|
LIBDIR ?= $(PREFIX)/lib
|
||||||
BINDIR ?= $(PREFIX)/bin
|
SOLIBDIR ?= $(PREFIX)/lib
|
||||||
LIBDIR ?= $(PREFIX)/lib
|
INCDIR ?= $(PREFIX)/include/chibi
|
||||||
INCDIR ?= $(PREFIX)/include/chibi
|
MODDIR ?= $(PREFIX)/share/chibi
|
||||||
MODDIR ?= $(PREFIX)/share/chibi
|
|
||||||
|
|
||||||
DESTDIR ?=
|
DESTDIR ?=
|
||||||
|
|
||||||
|
@ -17,9 +16,14 @@ ifndef PLATFORM
|
||||||
ifeq ($(shell uname),Darwin)
|
ifeq ($(shell uname),Darwin)
|
||||||
PLATFORM=macosx
|
PLATFORM=macosx
|
||||||
else
|
else
|
||||||
|
ifeq ($(shell uname -o),Msys)
|
||||||
|
PLATFORM=mingw
|
||||||
|
SOLIBDIR = $(BINDIR)
|
||||||
|
else
|
||||||
PLATFORM=unix
|
PLATFORM=unix
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(PLATFORM),macosx)
|
ifeq ($(PLATFORM),macosx)
|
||||||
SO = .dylib
|
SO = .dylib
|
||||||
|
@ -30,7 +34,10 @@ else
|
||||||
ifeq ($(PLATFORM),mingw)
|
ifeq ($(PLATFORM),mingw)
|
||||||
SO = .dll
|
SO = .dll
|
||||||
EXE = .exe
|
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
|
else
|
||||||
SO = .so
|
SO = .so
|
||||||
EXE =
|
EXE =
|
||||||
|
@ -39,6 +46,8 @@ STATICFLAGS = -static
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
all: chibi-scheme$(EXE)
|
||||||
|
|
||||||
ifdef USE_BOEHM
|
ifdef USE_BOEHM
|
||||||
GCLDFLAGS := -lgc
|
GCLDFLAGS := -lgc
|
||||||
XCPPFLAGS := $(CPPFLAGS) -Iinclude -DUSE_BOEHM=1
|
XCPPFLAGS := $(CPPFLAGS) -Iinclude -DUSE_BOEHM=1
|
||||||
|
@ -77,12 +86,12 @@ clean:
|
||||||
rm -f *.o *.i *.s
|
rm -f *.o *.i *.s
|
||||||
|
|
||||||
cleaner: clean
|
cleaner: clean
|
||||||
rm -f chibi-scheme chibi-scheme-static *$(SO)
|
rm -f chibi-scheme$(EXE) chibi-scheme-static$(EXE) *$(SO) *.a
|
||||||
rm -rf *.dSYM
|
rm -rf *.dSYM
|
||||||
|
|
||||||
test-basic: chibi-scheme
|
test-basic: chibi-scheme$(EXE)
|
||||||
@for f in tests/basic/*.scm; do \
|
@for f in tests/basic/*.scm; do \
|
||||||
./chibi-scheme $$f >$${f%.scm}.out 2>$${f%.scm}.err; \
|
./chibi-scheme$(EXE) $$f >$${f%.scm}.out 2>$${f%.scm}.err; \
|
||||||
if diff -q $${f%.scm}.out $${f%.scm}.res; then \
|
if diff -q $${f%.scm}.out $${f%.scm}.res; then \
|
||||||
echo "[PASS] $${f%.scm}"; \
|
echo "[PASS] $${f%.scm}"; \
|
||||||
else \
|
else \
|
||||||
|
@ -90,10 +99,10 @@ test-basic: chibi-scheme
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
test: chibi-scheme
|
test: chibi-scheme$(EXE)
|
||||||
./chibi-scheme tests/r5rs-tests.scm
|
./chibi-scheme$(EXE) tests/r5rs-tests.scm
|
||||||
|
|
||||||
install: chibi-scheme
|
install: chibi-scheme$(EXE)
|
||||||
mkdir -p $(DESTDIR)$(BINDIR)
|
mkdir -p $(DESTDIR)$(BINDIR)
|
||||||
cp chibi-scheme $(DESTDIR)$(BINDIR)/
|
cp chibi-scheme $(DESTDIR)$(BINDIR)/
|
||||||
mkdir -p $(DESTDIR)$(MODDIR)
|
mkdir -p $(DESTDIR)$(MODDIR)
|
||||||
|
|
|
@ -125,3 +125,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#ifdef BUILDING_DLL
|
||||||
|
#define SEXP_API __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define SEXP_API __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define SEXP_API
|
||||||
|
#endif
|
||||||
|
|
|
@ -128,13 +128,13 @@ enum opcode_names {
|
||||||
|
|
||||||
/**************************** prototypes ******************************/
|
/**************************** prototypes ******************************/
|
||||||
|
|
||||||
void sexp_scheme_init();
|
SEXP_API void sexp_scheme_init();
|
||||||
sexp sexp_apply(sexp context, sexp proc, sexp args);
|
SEXP_API sexp sexp_apply(sexp context, sexp proc, sexp args);
|
||||||
sexp sexp_eval(sexp context, sexp obj);
|
SEXP_API sexp sexp_eval(sexp context, sexp obj);
|
||||||
sexp sexp_eval_string(sexp context, char *str);
|
SEXP_API sexp sexp_eval_string(sexp context, char *str);
|
||||||
sexp sexp_load(sexp context, sexp expr, sexp env);
|
SEXP_API sexp sexp_load(sexp context, sexp expr, sexp env);
|
||||||
sexp sexp_make_context(sexp context, sexp stack, sexp env);
|
SEXP_API sexp sexp_make_context(sexp context, sexp stack, sexp env);
|
||||||
void sexp_warn_undefs(sexp ctx, sexp from, sexp to, sexp out);
|
SEXP_API void sexp_warn_undefs(sexp ctx, sexp from, sexp to, sexp out);
|
||||||
|
|
||||||
#endif /* ! SEXP_EVAL_H */
|
#endif /* ! SEXP_EVAL_H */
|
||||||
|
|
||||||
|
|
|
@ -564,54 +564,54 @@ 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_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))
|
#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_API int sexp_buffered_read_char (sexp ctx, sexp p);
|
||||||
sexp sexp_buffered_write_char (sexp ctx, int c, sexp p);
|
SEXP_API 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_API 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_API sexp sexp_buffered_write_string (sexp ctx, char *str, sexp p);
|
||||||
sexp sexp_buffered_flush (sexp ctx, sexp p);
|
SEXP_API sexp sexp_buffered_flush (sexp ctx, sexp p);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define sexp_newline(ctx, p) sexp_write_char(ctx, '\n', (p))
|
#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_API sexp sexp_alloc_tagged(sexp ctx, size_t size, sexp_uint_t tag);
|
||||||
sexp sexp_cons(sexp ctx, sexp head, sexp tail);
|
SEXP_API sexp sexp_cons(sexp ctx, sexp head, sexp tail);
|
||||||
sexp sexp_list2(sexp ctx, sexp a, sexp b);
|
SEXP_API sexp sexp_list2(sexp ctx, sexp a, sexp b);
|
||||||
sexp sexp_equalp (sexp ctx, sexp a, sexp b);
|
SEXP_API sexp sexp_equalp (sexp ctx, sexp a, sexp b);
|
||||||
sexp sexp_listp(sexp ctx, sexp obj);
|
SEXP_API sexp sexp_listp(sexp ctx, sexp obj);
|
||||||
sexp sexp_reverse(sexp ctx, sexp ls);
|
SEXP_API sexp sexp_reverse(sexp ctx, sexp ls);
|
||||||
sexp sexp_nreverse(sexp ctx, sexp ls);
|
SEXP_API sexp sexp_nreverse(sexp ctx, sexp ls);
|
||||||
sexp sexp_append2(sexp ctx, sexp a, sexp b);
|
SEXP_API sexp sexp_append2(sexp ctx, sexp a, sexp b);
|
||||||
sexp sexp_memq(sexp ctx, sexp x, sexp ls);
|
SEXP_API sexp sexp_memq(sexp ctx, sexp x, sexp ls);
|
||||||
sexp sexp_assq(sexp ctx, sexp x, sexp ls);
|
SEXP_API sexp sexp_assq(sexp ctx, sexp x, sexp ls);
|
||||||
sexp sexp_length(sexp ctx, sexp ls);
|
SEXP_API sexp sexp_length(sexp ctx, sexp ls);
|
||||||
sexp sexp_c_string(sexp ctx, char *str, sexp_sint_t slen);
|
SEXP_API sexp sexp_c_string(sexp ctx, char *str, sexp_sint_t slen);
|
||||||
sexp sexp_make_string(sexp ctx, sexp len, sexp ch);
|
SEXP_API sexp sexp_make_string(sexp ctx, sexp len, sexp ch);
|
||||||
sexp sexp_substring (sexp ctx, sexp str, sexp start, sexp end);
|
SEXP_API sexp sexp_substring (sexp ctx, sexp str, sexp start, sexp end);
|
||||||
sexp sexp_string_concatenate (sexp ctx, sexp str_ls);
|
SEXP_API sexp sexp_string_concatenate (sexp ctx, sexp str_ls);
|
||||||
sexp sexp_intern(sexp ctx, char *str);
|
SEXP_API sexp sexp_intern(sexp ctx, char *str);
|
||||||
sexp sexp_string_to_symbol(sexp ctx, sexp str);
|
SEXP_API sexp sexp_string_to_symbol(sexp ctx, sexp str);
|
||||||
sexp sexp_make_vector(sexp ctx, sexp len, sexp dflt);
|
SEXP_API sexp sexp_make_vector(sexp ctx, sexp len, sexp dflt);
|
||||||
sexp sexp_list_to_vector(sexp ctx, sexp ls);
|
SEXP_API sexp sexp_list_to_vector(sexp ctx, sexp ls);
|
||||||
void sexp_write(sexp ctx, sexp obj, sexp out);
|
SEXP_API void sexp_write(sexp ctx, sexp obj, sexp out);
|
||||||
sexp sexp_read_string(sexp ctx, sexp in);
|
SEXP_API sexp sexp_read_string(sexp ctx, sexp in);
|
||||||
sexp sexp_read_symbol(sexp ctx, sexp in, int init, int internp);
|
SEXP_API sexp sexp_read_symbol(sexp ctx, sexp in, int init, int internp);
|
||||||
sexp sexp_read_number(sexp ctx, sexp in, int base);
|
SEXP_API sexp sexp_read_number(sexp ctx, sexp in, int base);
|
||||||
sexp sexp_read_raw(sexp ctx, sexp in);
|
SEXP_API sexp sexp_read_raw(sexp ctx, sexp in);
|
||||||
sexp sexp_read(sexp ctx, sexp in);
|
SEXP_API sexp sexp_read(sexp ctx, sexp in);
|
||||||
sexp sexp_read_from_string(sexp ctx, char *str);
|
SEXP_API sexp sexp_read_from_string(sexp ctx, char *str);
|
||||||
sexp sexp_write_to_string(sexp ctx, sexp obj);
|
SEXP_API sexp sexp_write_to_string(sexp ctx, sexp obj);
|
||||||
sexp sexp_make_input_port(sexp ctx, FILE* in, sexp name);
|
SEXP_API sexp sexp_make_input_port(sexp ctx, FILE* in, sexp name);
|
||||||
sexp sexp_make_output_port(sexp ctx, FILE* out, sexp name);
|
SEXP_API sexp sexp_make_output_port(sexp ctx, FILE* out, sexp name);
|
||||||
sexp sexp_make_input_string_port(sexp ctx, sexp str);
|
SEXP_API sexp sexp_make_input_string_port(sexp ctx, sexp str);
|
||||||
sexp sexp_make_output_string_port(sexp ctx);
|
SEXP_API sexp sexp_make_output_string_port(sexp ctx);
|
||||||
sexp sexp_get_output_string(sexp ctx, sexp port);
|
SEXP_API 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_API 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_API sexp sexp_user_exception (sexp ctx, sexp self, char *message, sexp obj);
|
||||||
sexp sexp_type_exception (sexp ctx, char *message, sexp obj);
|
SEXP_API sexp sexp_type_exception (sexp ctx, char *message, sexp obj);
|
||||||
sexp sexp_range_exception (sexp ctx, sexp obj, sexp start, sexp end);
|
SEXP_API sexp sexp_range_exception (sexp ctx, sexp obj, sexp start, sexp end);
|
||||||
sexp sexp_print_exception(sexp ctx, sexp exn, sexp out);
|
SEXP_API sexp sexp_print_exception(sexp ctx, sexp exn, sexp out);
|
||||||
void sexp_init();
|
SEXP_API void sexp_init();
|
||||||
|
|
||||||
#endif /* ! SEXP_H */
|
#endif /* ! SEXP_H */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue