incorporating cygwin patches from john cowan:

* makefile rules for cygwin
 * forcing function versions of tolower/isalpha/etc.
This commit is contained in:
Alex Shinn 2010-08-15 16:08:34 +09:00
parent 9f69f1b425
commit 9d4203f613
5 changed files with 23 additions and 4 deletions

View file

@ -36,10 +36,16 @@ PLATFORM=mingw
SOLIBDIR = $(BINDIR) SOLIBDIR = $(BINDIR)
DIFFOPTS = -b DIFFOPTS = -b
else else
ifeq ($(shell uname -o),Cygwin)
PLATFORM=cygwin
SOLIBDIR = $(BINDIR)
DIFFOPTS = -b
else
PLATFORM=unix PLATFORM=unix
endif endif
endif endif
endif endif
endif
ifeq ($(PLATFORM),macosx) ifeq ($(PLATFORM),macosx)
SO = .dylib SO = .dylib
@ -57,12 +63,20 @@ LDFLAGS += -Wl,--out-implib,libchibi-scheme$(SO).a
STATICFLAGS = -DSEXP_USE_DL=0 STATICFLAGS = -DSEXP_USE_DL=0
LIBDL = LIBDL =
else else
ifeq ($(PLATFORM),cygwin)
SO = .dll
EXE = .exe
CC = gcc
CLIBFLAGS = -shared
LDFLAGS += -Wl,--out-implib,libchibi-scheme$(SO).a
else
SO = .so SO = .so
EXE = EXE =
CLIBFLAGS = -fPIC -shared CLIBFLAGS = -fPIC -shared
STATICFLAGS = -static -DSEXP_USE_DL=0 STATICFLAGS = -static -DSEXP_USE_DL=0
endif endif
endif endif
endif
ifeq ($(USE_BOEHM),1) ifeq ($(USE_BOEHM),1)
SEXP_USE_BOEHM = 1 SEXP_USE_BOEHM = 1

View file

@ -129,6 +129,11 @@ typedef unsigned int sexp_tag_t;
typedef unsigned long sexp_uint_t; typedef unsigned long sexp_uint_t;
typedef long sexp_sint_t; typedef long sexp_sint_t;
#define sexp_heap_align(n) sexp_align(n, 5) #define sexp_heap_align(n) sexp_align(n, 5)
#elif __CYGWIN__
typedef unsigned short sexp_tag_t;
typedef unsigned int sexp_uint_t;
typedef int sexp_sint_t;
#define sexp_heap_align(n) sexp_align(n, 5)
#else #else
typedef unsigned short sexp_tag_t; typedef unsigned short sexp_tag_t;
typedef unsigned int sexp_uint_t; typedef unsigned int sexp_uint_t;

View file

@ -34,7 +34,7 @@ static sexp sexp_string_hash (sexp ctx sexp_api_params(self, n), sexp str, sexp
static sexp_uint_t string_ci_hash (char *str, sexp_uint_t bound) { static sexp_uint_t string_ci_hash (char *str, sexp_uint_t bound) {
sexp_uint_t acc = FNV_OFFSET_BASIS; sexp_uint_t acc = FNV_OFFSET_BASIS;
while (*str) {acc *= FNV_PRIME; acc ^= tolower(*str++);} while (*str) {acc *= FNV_PRIME; acc ^= (tolower)(*str++);}
return acc % bound; return acc % bound;
} }

4
main.c
View file

@ -163,8 +163,8 @@ void run_main (int argc, char **argv) {
check_nonull_arg('h', arg); check_nonull_arg('h', arg);
heap_size = atol(arg); heap_size = atol(arg);
len = strlen(arg); len = strlen(arg);
if (heap_size && isalpha(arg[len-1])) { if (heap_size && (isalpha)(arg[len-1])) {
switch (tolower(arg[len-1])) { switch ((tolower)(arg[len-1])) {
case 'k': heap_size *= 1024; break; case 'k': heap_size *= 1024; break;
case 'm': heap_size *= (1024*1024); break; case 'm': heap_size *= (1024*1024); break;
} }

2
sexp.c
View file

@ -1659,7 +1659,7 @@ sexp sexp_read_raw (sexp ctx, sexp in) {
if (sexp_string_length(res) == 1) { if (sexp_string_length(res) == 1) {
res = sexp_make_character(c1); res = sexp_make_character(c1);
} else if ((c1 == 'x' || c1 == 'X') && } else if ((c1 == 'x' || c1 == 'X') &&
isxdigit(str[1]) && isxdigit(str[2]) && str[3] == '\0') { (isxdigit)(str[1]) && (isxdigit)(str[2]) && str[3] == '\0') {
res = sexp_make_character(16 * digit_value(str[1]) res = sexp_make_character(16 * digit_value(str[1])
+ digit_value(str[2])); + digit_value(str[2]));
} else { } else {