From cfb16c19208dae2fadce51a651b8ebf065510a27 Mon Sep 17 00:00:00 2001 From: jjgarcia Date: Wed, 20 Nov 2002 17:26:21 +0000 Subject: [PATCH] + The tests for the type and size of cl_fixnum have been grouped. FIXNUM_BITS and CHAR_BIT do not rely now on "char" being 8-bit large. + All configuration settings are now grouped in config.h. This file has two parts, and the second one, containing flags which are only needed during the build process, is deleted when installing ECL. + File critical.h merged into lwp.h. --- src/CHANGELOG | 24 +++++++- src/aclocal.m4 | 60 ++++++++++--------- src/c/Makefile.in | 4 +- src/c/array.d | 5 +- src/c/cmpaux.d | 5 +- src/c/file.d | 1 + src/c/load.d | 1 + src/c/main.d | 1 + src/c/read.d | 6 +- src/c/sequence.d | 5 +- src/c/unixfsys.d | 3 +- src/c/unixsys.d | 71 +---------------------- src/configure | 109 ++++++++++++++--------------------- src/configure.in | 8 ++- src/h/config.h.in | 143 +++++++++++++++++++++++++++++++++------------- src/h/critical.h | 43 -------------- src/h/ecl-cmp.h | 18 +++--- src/h/ecl.h | 9 +-- src/h/internal.h | 9 +++ src/h/lwp.h | 20 +++++++ src/h/machines.h | 2 + src/h/object.h | 23 +------- src/h/stacks.h | 2 +- 23 files changed, 264 insertions(+), 308 deletions(-) delete mode 100644 src/h/critical.h diff --git a/src/CHANGELOG b/src/CHANGELOG index e14edb7d7..211306ad7 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -1016,8 +1016,8 @@ ECL 0.7 RECURSIVE-P is NIL. Furthermore, EOF is detected when EOF-ERROR-P is true, regardless of the value of RECURSIVE-P. -ECL 0.7b -======== +ECL 0.8 +======= * Errors fixed: @@ -1112,6 +1112,19 @@ ECL 0.7b - cl_special_form_p() renamed to cl_special_operator_p(). + - If a wrong number of arguments is passed to a function, the name of + the function is mentioned in the error message, whenever possible. + + - The tests for the type and size of cl_fixnum have been + grouped. FIXNUM_BITS and CHAR_BIT do not rely now on "char" being + 8-bit large. + + - All configuration settings are now grouped in config.h. This file + has two parts, and the second one, containing flags which are only + needed during the build process, is deleted when installing ECL. + + - File critical.h merged into lwp.h. + * ANSI compatibility: - DEFINE-SYMBOL-MACRO finally implemented. @@ -1120,6 +1133,13 @@ ECL 0.7b - Added function ENSURE-DIRECTORIES-EXIST. + - CODE-CHAR would reject negative numbers. + + - Remove si::*inhibit-macro-special*. When a special operator is + redefined as a macro, preserve the special nature of the + operator. Complain when user tries to redefine a special operator + as a function. + TODO: ===== diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 1d8f9f727..2b40d3831 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -99,6 +99,9 @@ configure___LDFLAGS=LDFLAGS configure___SHARED_LDFLAGS=SHARED_LDFLAGS #endif +configure___ecl_setjmp=ecl_setjmp +configure___ecl_longjmp=ecl_longjmp + configure___architecture=ARCHITECTURE configure___software_type=SOFTWARE_TYPE configure___software_version=SOFTWARE_VERSION @@ -127,6 +130,10 @@ AC_MSG_CHECKING(for software type) AC_MSG_RESULT([${software_type}]) AC_MSG_CHECKING(for software version) AC_MSG_RESULT([${software_version}]) +AC_MSG_CHECKING(use setjmp or _setjmp) +AC_MSG_RESULT([${ecl_setjmp}]) +AC_MSG_CHECKING(use longjmp or _longjmp) +AC_MSG_RESULT([${ecl_longjmp}]) ]) dnl dnl -------------------------------------------------------------- @@ -196,46 +203,37 @@ dnl enough that convertion back and forth to pointer implies no dnl loss of information. AC_DEFUN(ECL_FIXNUM_TYPE,[ AC_MSG_CHECKING(appropiate type for fixnums) -dnl -dnl 1.- Guess the type of a fixnum -dnl AC_TRY_RUN([#include int main() { + const char *int_type; + int bits; FILE *f=fopen("conftestval", "w"); if (!f) exit(1); if (sizeof(int) >= sizeof(void*)) { - fprintf(f, "int\n"); + unsigned int t = 1, l; + int_type="int"; + for (bits=0; ((t << 1) >> 1) == t; bits++, t <<= 1); + l = (~0) << (bits - 2); + fprintf(f,"CL_FIXNUM_MIN='%d';",l); + fprintf(f,"CL_FIXNUM_MAX='%d';",-(l+1)); } else if (sizeof(long) >= sizeof(void*)) { - fprintf(f, "long\n"); + unsigned long int t = 1, l; + int_type="long int"; + for (bits=0; ((t << 1) >> 1) == t; bits++, t <<= 1); + l = (~0) << (bits - 2); + fprintf(f,"CL_FIXNUM_MIN='%ld';",l); + fprintf(f,"CL_FIXNUM_MAX='%ld';",-(l+1)); } else exit(1); + fprintf(f,"CL_FIXNUM_TYPE='%s';",int_type); + fprintf(f,"CL_FIXNUM_BITS='%d'",bits); exit(0); }], -cl_fixnum=`cat conftestval` -AC_MSG_RESULT([${cl_fixnum}]) -AC_DEFINE_UNQUOTED(CL_FIXNUM_TYPE,${cl_fixnum}), -AC_MSG_ERROR(There is no appropiate integer type for the cl_fixnum type)) -dnl -dnl 2.- Guess the size of a fixnum -dnl -AC_MSG_CHECKING(most positive fixnum) -AC_TRY_RUN([#include -int main() { - ${cl_fixnum} i=0,j,k; - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - do { - k = i * 2 + 1; - if (k == i) exit(1); - i = k; - j = (i << 2) >> 2; - fprintf(stderr,"%d\n",i); - } while (i == j); - fprintf(f, "0x%xL\n", (long)i >> 1); - exit(0); -}], -cl_fixnum_limit=`cat conftestval` -AC_MSG_RESULT([${cl_fixnum_limit}]) -AC_DEFINE_UNQUOTED(MOST_POSITIVE_FIXNUM, ${cl_fixnum_limit}), +eval "`cat conftestval`" +AC_MSG_RESULT([${CL_FIXNUM_TYPE}]) +AC_SUBST(CL_FIXNUM_TYPE) +AC_SUBST(CL_FIXNUM_BITS) +AC_SUBST(CL_FIXNUM_MAX) +AC_SUBST(CL_FIXNUM_MIN), AC_MSG_ERROR(There is no appropiate integer type for the cl_fixnum type)) ]) diff --git a/src/c/Makefile.in b/src/c/Makefile.in index 5591752cc..7313a5876 100644 --- a/src/c/Makefile.in +++ b/src/c/Makefile.in @@ -30,7 +30,7 @@ HFILES = ../h/config.h $(HDIR)/ecl.h $(HDIR)/ecl-cmp.h\ $(HDIR)/machines.h $(HDIR)/object.h $(HDIR)/cs.h $(HDIR)/stacks.h\ $(HDIR)/external.h $(HDIR)/eval.h\ $(HDIR)/number.h $(HDIR)/page.h $(HDIR)/unify.h\ - $(HDIR)/lwp.h $(HDIR)/critical.h + $(HDIR)/lwp.h OBJS = main.o symbol.o package.o list.o\ apply.o eval.o interpreter.o compiler.o disassembler.o \ clos.o instance.o gfun.o reference.o character.o\ @@ -57,6 +57,8 @@ all: $(DPP) ../libecl.a cinit.o install: $(HFILES) $(INSTALL_DATA) $(HFILES) $(PREFIX)$(libdir)/h/ + sed ',-CUT-,$$d' ../h/config.h > ../h/config-install.h + $(INSTALL_DATA) ../h/config-install.h $(PREFIX)$(libdir)/h/config.h ../libecl.a: $(OBJS) ar cr $@ $(OBJS) diff --git a/src/c/array.d b/src/c/array.d index be9350a38..1daa5c6bd 100644 --- a/src/c/array.d +++ b/src/c/array.d @@ -14,12 +14,9 @@ See file '../Copyright' for full details. */ +#include #include "ecl.h" -#ifndef CHAR_BIT -#define CHAR_BIT (sizeof(char)*8) -#endif - static void displace (cl_object from, cl_object to, cl_object offset); static void check_displaced (cl_object dlist, cl_object orig, cl_index newdim); extern cl_elttype get_elttype (cl_object x); diff --git a/src/c/cmpaux.d b/src/c/cmpaux.d index 7d47f1796..f67a41b8b 100644 --- a/src/c/cmpaux.d +++ b/src/c/cmpaux.d @@ -14,13 +14,10 @@ See file '../Copyright' for full details. */ +#include #include "ecl.h" #include "ecl-inl.h" -#ifndef CHAR_BIT -#define CHAR_BIT (sizeof(char)*8) -#endif - cl_object si_specialp(cl_object sym) { diff --git a/src/c/file.d b/src/c/file.d index 04663ed73..361622cfc 100644 --- a/src/c/file.d +++ b/src/c/file.d @@ -22,6 +22,7 @@ */ #include +#include "machines.h" #if defined(BSD) && !defined(MSDOS) #include diff --git a/src/c/load.d b/src/c/load.d index facb4dca4..80d740175 100644 --- a/src/c/load.d +++ b/src/c/load.d @@ -14,6 +14,7 @@ */ #include "ecl.h" +#include "machines.h" #include "ecl-inl.h" #ifdef __mips diff --git a/src/c/main.d b/src/c/main.d index 41e17ebbb..7a1889c61 100644 --- a/src/c/main.d +++ b/src/c/main.d @@ -35,6 +35,7 @@ int data_start = (int)&data_start; #include #include "ecl.h" +#include "machines.h" #ifdef TK # include "tk.h" #endif diff --git a/src/c/read.d b/src/c/read.d index 55b279d4f..176ca5926 100644 --- a/src/c/read.d +++ b/src/c/read.d @@ -14,15 +14,13 @@ See file '../Copyright' for full details. */ +#include #include #include #include "ecl.h" +#include "internal.h" #include "ecl-inl.h" -#ifndef CHAR_BIT -#define CHAR_BIT (sizeof(char)*8) -#endif - /******************************* EXPORTS ******************************/ cl_object standard_readtable; diff --git a/src/c/sequence.d b/src/c/sequence.d index 37cdf1aea..1b1267c63 100644 --- a/src/c/sequence.d +++ b/src/c/sequence.d @@ -14,13 +14,10 @@ See file '../Copyright' for full details. */ +#include #include "ecl.h" #include "ecl-inl.h" -#ifndef CHAR_BIT -#define CHAR_BIT (sizeof(char)*8) -#endif - #undef endp #define endp(obje) (endp_temp = (obje), CONSP(endp_temp) ? \ diff --git a/src/c/unixfsys.d b/src/c/unixfsys.d index a7eb5a790..221a556a7 100644 --- a/src/c/unixfsys.d +++ b/src/c/unixfsys.d @@ -20,8 +20,9 @@ #include #include #include -#include "ecl.h" #include +#include "ecl.h" +#include "machines.h" #ifdef BSD #include #else diff --git a/src/c/unixsys.d b/src/c/unixsys.d index 6ab04d8ca..e54e9a686 100644 --- a/src/c/unixsys.d +++ b/src/c/unixsys.d @@ -14,76 +14,9 @@ See file '../Copyright' for full details. */ +#include #include "ecl.h" -#include - -#if 0 -#if !defined(__stdlib_h) && !defined(_STDLIB_H_) && !defined(__STDLIB_H__) && !defined(_STDLIB_H) -#include -int -system(const char *command) -{ - char buf[4]; - extern sigint(); - - signal(SIGINT, SIG_IGN); - write(4, command, strlen(command)+1); - read(5, buf, 1); - signal(SIGINT, sigint); - return(buf[0]<<8); -} -#endif /* __STDLIB_H__ */ - -#if defined(__FreeBSD__) || defined(__NetBSD__) - -/* due to the calls to realloc in system.c/exec.c (memory which hasn't been -malloc'ed can't be realloced in ecl) we have to patch this a bit. -We use execv and supply the arg list, so execl doesn't have to realloc. CvdL */ - -#include -#include -#include -#include -#include -#include -#include -#include - -int -system(const char *command) -{ - union wait pstat; - pid_t pid; - int omask; - sig_t intsave, quitsave; - - if (!command) /* just checking... */ - return(1); - - omask = sigblock(sigmask(SIGCHLD)); - switch(pid = vfork()) { - case -1: /* error */ - (void)sigsetmask(omask); - pstat.w_status = 0; - pstat.w_retcode = 127; - return(pstat.w_status); - case 0: { /* child */ - char *args[] = { "sh", "-c", command, (char *)NULL }; - (void)sigsetmask(omask); - execv(_PATH_BSHELL, args); - _exit(127); - } - } - intsave = signal(SIGINT, SIG_IGN); - quitsave = signal(SIGQUIT, SIG_IGN); - pid = waitpid(pid, (int *)&pstat, 0); - (void)sigsetmask(omask); - (void)signal(SIGINT, intsave); - (void)signal(SIGQUIT, quitsave); - return(pid == -1 ? -1 : pstat.w_status); -} -#endif -#endif +#include "machines.h" cl_object si_system(cl_object cmd) diff --git a/src/configure b/src/configure index a9b4439af..cdead9a12 100755 --- a/src/configure +++ b/src/configure @@ -1312,8 +1312,6 @@ test -z "$host_alias" && host_alias=$ac_cv_host -ac_config_headers="$ac_config_headers h/config.h" - @@ -3796,6 +3794,9 @@ configure___LDFLAGS=LDFLAGS configure___SHARED_LDFLAGS=SHARED_LDFLAGS #endif +configure___ecl_setjmp=ecl_setjmp +configure___ecl_longjmp=ecl_longjmp + configure___architecture=ARCHITECTURE configure___software_type=SOFTWARE_TYPE configure___software_version=SOFTWARE_VERSION @@ -3835,6 +3836,14 @@ echo "$as_me:$LINENO: checking for software version" >&5 echo $ECHO_N "checking for software version... $ECHO_C" >&6 echo "$as_me:$LINENO: result: ${software_version}" >&5 echo "${ECHO_T}${software_version}" >&6 +echo "$as_me:$LINENO: checking use setjmp or _setjmp" >&5 +echo $ECHO_N "checking use setjmp or _setjmp... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: ${ecl_setjmp}" >&5 +echo "${ECHO_T}${ecl_setjmp}" >&6 +echo "$as_me:$LINENO: checking use longjmp or _longjmp" >&5 +echo $ECHO_N "checking use longjmp or _longjmp... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: ${ecl_longjmp}" >&5 +echo "${ECHO_T}${ecl_longjmp}" >&6 if test "x$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi @@ -4086,14 +4095,28 @@ else #include "confdefs.h" #include int main() { + const char *int_type; + int bits; FILE *f=fopen("conftestval", "w"); if (!f) exit(1); if (sizeof(int) >= sizeof(void*)) { - fprintf(f, "int\n"); + unsigned int t = 1, l; + int_type="int"; + for (bits=0; ((t << 1) >> 1) == t; bits++, t <<= 1); + l = (~0) << (bits - 2); + fprintf(f,"CL_FIXNUM_MIN='%d';",l); + fprintf(f,"CL_FIXNUM_MAX='%d';",-(l+1)); } else if (sizeof(long) >= sizeof(void*)) { - fprintf(f, "long\n"); + unsigned long int t = 1, l; + int_type="long int"; + for (bits=0; ((t << 1) >> 1) == t; bits++, t <<= 1); + l = (~0) << (bits - 2); + fprintf(f,"CL_FIXNUM_MIN='%ld';",l); + fprintf(f,"CL_FIXNUM_MAX='%ld';",-(l+1)); } else exit(1); + fprintf(f,"CL_FIXNUM_TYPE='%s';",int_type); + fprintf(f,"CL_FIXNUM_BITS='%d'",bits); exit(0); } _ACEOF @@ -4108,67 +4131,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cl_fixnum=`cat conftestval` -echo "$as_me:$LINENO: result: ${cl_fixnum}" >&5 -echo "${ECHO_T}${cl_fixnum}" >&6 -cat >>confdefs.h <<_ACEOF -#define CL_FIXNUM_TYPE ${cl_fixnum} -_ACEOF + eval "`cat conftestval`" +echo "$as_me:$LINENO: result: ${CL_FIXNUM_TYPE}" >&5 +echo "${ECHO_T}${CL_FIXNUM_TYPE}" >&6 + + -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: There is no appropiate integer type for the cl_fixnum type" >&5 -echo "$as_me: error: There is no appropiate integer type for the cl_fixnum type" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: checking most positive fixnum" >&5 -echo $ECHO_N "checking most positive fixnum... $ECHO_C" >&6 -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 -echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include -int main() { - ${cl_fixnum} i=0,j,k; - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - do { - k = i * 2 + 1; - if (k == i) exit(1); - i = k; - j = (i << 2) >> 2; - fprintf(stderr,"%d\n",i); - } while (i == j); - fprintf(f, "0x%xL\n", (long)i >> 1); - exit(0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cl_fixnum_limit=`cat conftestval` -echo "$as_me:$LINENO: result: ${cl_fixnum_limit}" >&5 -echo "${ECHO_T}${cl_fixnum_limit}" >&6 -cat >>confdefs.h <<_ACEOF -#define MOST_POSITIVE_FIXNUM ${cl_fixnum_limit} -_ACEOF else echo "$as_me: program exited with status $ac_status" >&5 @@ -5614,6 +5582,10 @@ ac_config_files="$ac_config_files compile.lsp compile_rest.lsp bare.lsp lsp/conf ac_config_files="$ac_config_files ecl-config:util/ecl-config" +ac_config_files="$ac_config_files h/configpre:h/config.h.in" + +ac_config_headers="$ac_config_headers h/config.h:h/configpre" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -6106,7 +6078,8 @@ do "cmp/defsys.lsp" ) CONFIG_FILES="$CONFIG_FILES cmp/defsys.lsp" ;; "clos/defsys.lsp" ) CONFIG_FILES="$CONFIG_FILES clos/defsys.lsp" ;; "ecl-config" ) CONFIG_FILES="$CONFIG_FILES ecl-config:util/ecl-config" ;; - "h/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS h/config.h" ;; + "h/configpre" ) CONFIG_FILES="$CONFIG_FILES h/configpre:h/config.h.in" ;; + "h/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS h/config.h:h/configpre" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; @@ -6223,6 +6196,8 @@ s,@SHARED_LDFLAGS@,$SHARED_LDFLAGS,;t t s,@architecture@,$architecture,;t t s,@software_type@,$software_type,;t t s,@software_version@,$software_version,;t t +s,@ecl_setjmp@,$ecl_setjmp,;t t +s,@ecl_longjmp@,$ecl_longjmp,;t t s,@SHORT_SITE_NAME@,$SHORT_SITE_NAME,;t t s,@LONG_SITE_NAME@,$LONG_SITE_NAME,;t t s,@EXTRA_OBJS@,$EXTRA_OBJS,;t t @@ -6241,6 +6216,10 @@ s,@MACHINE_VERSION@,$MACHINE_VERSION,;t t s,@OS_TYPE@,$OS_TYPE,;t t s,@OS_RELEASE@,$OS_RELEASE,;t t s,@DOWN_STACK@,$DOWN_STACK,;t t +s,@CL_FIXNUM_TYPE@,$CL_FIXNUM_TYPE,;t t +s,@CL_FIXNUM_BITS@,$CL_FIXNUM_BITS,;t t +s,@CL_FIXNUM_MAX@,$CL_FIXNUM_MAX,;t t +s,@CL_FIXNUM_MIN@,$CL_FIXNUM_MIN,;t t s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t s,@X_LIBS@,$X_LIBS,;t t diff --git a/src/configure.in b/src/configure.in index 4c65f2c3c..99abb6956 100644 --- a/src/configure.in +++ b/src/configure.in @@ -37,7 +37,6 @@ AC_SUBST(ECL_VERSION) dnl Guess operating system of host. We do not allow cross-compiling. AC_CANONICAL_HOST -AC_CONFIG_HEADER(h/config.h) AC_SUBST(host) AC_SUBST(bindir) AC_SUBST(mandir) @@ -109,6 +108,8 @@ AC_SUBST(SHARED_LDFLAGS)dnl Flags for shared libraries linker AC_SUBST(architecture)dnl Type of processor for which this is compiled AC_SUBST(software_type)dnl Type of operating system AC_SUBST(software_version)dnl Version number of operating system +AC_SUBST(ecl_setjmp)dnl Function to use for setjmp +AC_SUBST(ecl_longjmp)dnl Function to use for longjmp AC_SUBST(SHORT_SITE_NAME)dnl Short name for the machine we built this on AC_SUBST(LONG_SITE_NAME)dnl Long name for the machine we built this on AC_SUBST(EXTRA_OBJS)dnl Extra *.o files to be compiled into libecl.a @@ -321,10 +322,15 @@ fi dnl --------------------------------------------------------------------- dnl Final pass over configuration files dnl +dnl Notice that we build ${builddir}/h/configpre.h fron ${srcdir}/h/config.h.in, +dnl and then use all AC_DEF* to build h/config.h from h/configpre.h +dnl AC_CONFIG_FILES(compile.lsp compile_rest.lsp bare.lsp lsp/config.lsp cmp/cmpcfg.lsp lsp/load.lsp clos/load.lsp cmp/load.lsp ../Makefile Makefile c/Makefile doc/Makefile tk/Makefile clx/defsys.lsp tests/Makefile ansi-tests/Makefile gabriel/Makefile lsp/defsys.lsp cmp/defsys.lsp clos/defsys.lsp) AC_CONFIG_FILES([ecl-config:util/ecl-config],[chmod +x ecl-config]) +AC_CONFIG_FILES([h/configpre:h/config.h.in]) +AC_CONFIG_HEADER([h/config.h:h/configpre]) AC_OUTPUT diff --git a/src/h/config.h.in b/src/h/config.h.in index 7fbab369b..8d1f2a274 100644 --- a/src/h/config.h.in +++ b/src/h/config.h.in @@ -3,6 +3,7 @@ */ /* Copyright (c) 1990, Giuseppe Attardi. + Copyright (c) 2001, Juan Jose Garcia Ripoll. ECoLisp is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,17 +13,77 @@ See file '../Copyright' for full details. */ +/* + * FEATURES LINKED IN + */ +/* Always use CLOS */ +#define CLOS -/* -------------------------------------------------------------------- * - * OPTIONS * - * -------------------------------------------------------------------- */ +/* Use Boehm's garbage collector */ +#undef GBC_BOEHM -#define CLOS /* Always use CLOS */ +/* Userland threads? */ #undef THREADS -#undef TK /* Network streams */ #undef TCP + +/* + * C TYPES AND SYSTEM LIMITS + */ +/* + * The integer type + * + * cl_fixnum must be an integer type, large enough to hold a pointer. + * Ideally, according to the ISOC99 standard, we should use intptr_t, + * but the required headers are not present in all systems. Hence we + * use autoconf to guess the following values. + */ +#define FIXNUM_BITS @CL_FIXNUM_BITS@ +#define MOST_POSITIVE_FIXNUM ((cl_fixnum)@CL_FIXNUM_MAX@) +#define MOST_NEGATIVE_FIXNUM ((cl_fixnum)@CL_FIXNUM_MIN@) + +typedef @CL_FIXNUM_TYPE@ cl_fixnum; +typedef unsigned @CL_FIXNUM_TYPE@ cl_index; +typedef unsigned @CL_FIXNUM_TYPE@ cl_hashkey; + +/* + * The character type + */ +#define CHAR_CODE_LIMIT 256 + +/* + * Array limits + */ +#define ARANKLIM 64 /* array rank limit */ +#define ADIMLIM 16*1024*1024 /* array dimension limit */ +#define ATOTLIM 16*1024*1024 /* array total limit */ + +/* + * Function limits + */ +/* Maximum number of function arguments */ +#define CALL_ARGUMENTS_LIMIT @CL_FIXNUM_MAX@ + +/* Maximum number of required arguments */ +#define LAMBDA_PARAMETERS_LIMIT 64 + +/* Numb. of args. which can be passed using the C stack */ +#define C_ARGUMENTS_LIMIT 64 + +/* Which functions to use for setting jump points */ +#define ecl_setjmp @ecl_setjmp@ +#define ecl_longjmp @ecl_longjmp@ + + +/* -CUT-: Everything below this mark will not be installed */ +/* -------------------------------------------------------------------- * + * BUILD OPTIONS WHICH NEED NOT BE EXPORTED * + * -------------------------------------------------------------------- */ +/* + * FEATURES LINKED IN: + */ + /* CLX */ #undef CLX /* Locatives */ @@ -37,51 +98,21 @@ /* Program Development Environment */ #undef PDE -/* Use Boehm's garbage collector */ -#undef GBC_BOEHM +/* Tcl/Tk library */ +#undef TK /* Allow loading dynamically linked code */ #undef ENABLE_DLOPEN -/* Undefine this if you do not want ECL to check for circular lists */ +/* Undefine this if you do not want ECL to check for circular lists */ #define ECL_SAFE /* Allow STREAM operations to work on arbitrary objects */ #undef ECL_CLOS_STREAMS -/* -------------------------------------------------------------------- * - * PARAMETERS * - * -------------------------------------------------------------------- */ - -#define LISP_PAGESIZE 2048 /* Page size in bytes */ -#define MAXPAGE 16384 /* Maximum Memory Size */ -#define BDSSIZE 2048 /* Size of Binding Stack */ -#define BDSGETA 16 /* Safety zone of BDS */ -#define FRSSIZE 1024 /* Size of Frame Stack */ -#define FRSGETA 16 /* Safety zone of FRS */ -#ifdef THREADS -#define CSSIZE 7500 /* Size of C Stack of each thread */ -#define CSGETA 500 -#else -#define CSSIZE 20000 /* Size of C Stack */ -#define CSGETA 4000 -#endif -#define VSSIZE 128 /* Size of return values stack */ - /* Maximum number of function arguments */ -#define CALL_ARGUMENTS_LIMIT MOST_POSITIVE_FIXNUM - /* Maximum number of required arguments */ -#define LAMBDA_PARAMETERS_LIMIT 64 - /* Numb. of args. which can be passed using the C stack */ -#define C_ARGUMENTS_LIMIT 64 - -#define BIGNUM_REGISTER_SIZE 16 /* Size in words of each register */ - -/* -------------------------------------------------------------------- * - * SYSTEM FEATURES * - * -------------------------------------------------------------------- */ - -#define CL_FIXNUM_TYPE 1 /* Integer type for fixnums */ -#define MOST_POSITIVE_FIXNUM 1 /* Positive limit for fixnums */ +/* + * SYSTEM FEATURES: + */ /* Stack grows downwards */ #undef DOWN_STACK @@ -97,3 +128,33 @@ #undef HAVE_ISNANF /* float.h for epsilons, maximum real numbers, etc */ #undef HAVE_FLOAT_H + +/* + * PARAMETERS: + */ + +/* + * Memory limits for the old garbage collector. + */ +#define LISP_PAGESIZE 2048 /* Page size in bytes */ +#define MAXPAGE 16384 /* Maximum Memory Size */ + +/* + * The lisp environment has several stacks. These are their limits: + */ +#define BDSSIZE 2048 /* Size of Binding Stack */ +#define BDSGETA 16 /* Safety zone of BDS */ +#define FRSSIZE 1024 /* Size of Frame Stack */ +#define FRSGETA 16 /* Safety zone of FRS */ +#ifdef THREADS +#define CSSIZE 7500 /* Size of C Stack of each thread */ +#define CSGETA 500 +#else +#define CSSIZE 20000 /* Size of C Stack */ +#define CSGETA 4000 +#endif +#define VSSIZE 128 /* Size of return values stack */ + +/* We reserve these many bytes for computation with bignums registers */ +#define BIGNUM_REGISTER_SIZE 16 + diff --git a/src/h/critical.h b/src/h/critical.h deleted file mode 100644 index e07076c16..000000000 --- a/src/h/critical.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - critical.h -- Mutual exclusion. -*/ -/* - Copyright (c) 1990, Giuseppe Attardi. - - ECoLisp is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - See file '../Copyright' for full details. -*/ - -/* - * SCHEDULER STOPPING - */ -#ifdef THREADS -#define BUSY 1 -#define CRITICAL 5 -#define ACTIVE 1 -#define INACTIVE 0 -#define SCHEDULER_INT 1 -#define ERROR_INT 2 - -extern bool scheduler_interrupted; -extern int critical_level; - -#define start_critical_section() {critical_level++;} - -#define end_critical_section() { critical_level--; \ - if (scheduler_interrupted) \ - if (critical_level == 0) \ - interruption_handler(); } -#endif /* THREADS */ - -/* - * EMPTY MACROS FOR SINGLE-THREADED CODE - */ -#ifndef THREADS -#define start_critical_section() -#define end_critical_section() -#endif /* !THREADS */ diff --git a/src/h/ecl-cmp.h b/src/h/ecl-cmp.h index 9cb98b0f2..5128cf5d9 100644 --- a/src/h/ecl-cmp.h +++ b/src/h/ecl-cmp.h @@ -13,20 +13,22 @@ See file '../Copyright' for full details. */ -#include "config.h" -#include "machines.h" +#include +#include #include #include #include #include #include -#include +#include "config.h" #include "gmp.h" #include "object.h" #include "stacks.h" #ifdef THREADS -#include "lwp.h" -#include "critical.h" +# include "lwp.h" +#else +# define start_critical_section() +# define end_critical_section() #endif #include "external.h" #include "eval.h" @@ -40,12 +42,6 @@ if ((int *)(&narg) < cs_limit) \ cs_overflow() -#define LINK_ARGS &narg #define TRAMPOLINK(narg, vv, lk) \ cl_va_list args; cl_va_start(args, narg, narg, 0); \ return(link_call(vv, (cl_objectfn *)lk, narg, args)) - -#define cclosure_call funcall - -#define Creturn(v) return((VALUES(0)=(v),1)) -#define Cexit return(0) diff --git a/src/h/ecl.h b/src/h/ecl.h index 8bc39cb18..805dbfbcd 100644 --- a/src/h/ecl.h +++ b/src/h/ecl.h @@ -15,21 +15,22 @@ #include /* includes and */ #include /* for EMX */ -#include "config.h" -#include "machines.h" #include #include #include #include +#include "config.h" #include "gmp.h" #include "object.h" #include "stacks.h" -#include "critical.h" #ifdef THREADS # include "lwp.h" +#else +# define start_critical_section() +# define end_critical_section() #endif #ifndef _ARGS -#define _ARGS(x) x +# define _ARGS(x) x #endif #include "external.h" /*#include "ecl-inl.h"*/ diff --git a/src/h/internal.h b/src/h/internal.h index 23d56c0de..c0a97816a 100644 --- a/src/h/internal.h +++ b/src/h/internal.h @@ -16,6 +16,12 @@ extern "C" { #endif +/* -------------------------------------------------------------------- * + * FUNCTIONS, VARIABLES AND TYPES NOT FOR GENERAL USE * + * -------------------------------------------------------------------- */ + +#include "machines.h" + /* all_symbols.d */ extern cl_index cl_num_symbols_in_core; @@ -54,6 +60,9 @@ extern void edit_double(int n, double d, int *sp, char *s, int *ep); extern void cl_setup_printer(cl_object strm); extern void cl_write_object(cl_object x); + /* read.d */ +#define RTABSIZE CHAR_CODE_LIMIT /* read table size */ + #ifdef __cplusplus } #endif diff --git a/src/h/lwp.h b/src/h/lwp.h index 93596d2ab..7c007db82 100644 --- a/src/h/lwp.h +++ b/src/h/lwp.h @@ -225,3 +225,23 @@ typedef struct pd { #define REALQUANTUM 100000 /* "" */ #define STACK_SIZE (CSSIZE+CSGETA) /* Words */ + +/* + * SCHEDULER STOPPING + */ +#define BUSY 1 +#define CRITICAL 5 +#define ACTIVE 1 +#define INACTIVE 0 +#define SCHEDULER_INT 1 +#define ERROR_INT 2 + +extern bool scheduler_interrupted; +extern int critical_level; + +#define start_critical_section() {critical_level++;} + +#define end_critical_section() { critical_level--; \ + if (scheduler_interrupted) \ + if (critical_level == 0) \ + interruption_handler(); } diff --git a/src/h/machines.h b/src/h/machines.h index 6c5cb6751..dd7b440fc 100755 --- a/src/h/machines.h +++ b/src/h/machines.h @@ -19,6 +19,7 @@ # define stack_align(n) (((n) + 03) & ~03) #endif +#ifndef ecl_setjmp #if defined(linux) # define ecl_setjmp setjmp # define ecl_longjmp longjmp @@ -26,6 +27,7 @@ # define ecl_setjmp _setjmp # define ecl_longjmp _longjmp #endif +#endif #ifdef __linux__ # define FILE_CNT(fp) ((fp)->_IO_read_end - (fp)->_IO_read_ptr) diff --git a/src/h/object.h b/src/h/object.h index 32516addd..3543590f1 100644 --- a/src/h/object.h +++ b/src/h/object.h @@ -19,15 +19,7 @@ extern "C" { #endif /* - Some system constants. -*/ - -/* - INV: CHAR_CODE_LIMIT is a power of two and <= MOST_POSITIVE_FIXNUM/2 - INV: PHTABSIZE is a power of two - INV: ARANKLIM is of type "index" - INV: fixnum, cl_index are large enough to hold a pointer - INV: symbol and cons share cons.car = symbol.dbind, cons.cdr = symbol.sfun. + Integer and boolean types (see config.h) */ #define TRUE 1 /* boolean true value */ @@ -35,20 +27,9 @@ extern "C" { #define CHAR_CODE_LIMIT 256 /* ASCII character code limit */ -#define PHTABSIZE 512 /* number of entries in the package hash table */ - -#define ARANKLIM 64 /* array rank limit */ -#define ADIMLIM 16*1024*1024 /* array dimension limit */ -#define ATOTLIM 16*1024*1024 /* array total limit */ - -#define RTABSIZE CHAR_CODE_LIMIT /* read table size */ - #ifndef __cplusplus typedef int bool; #endif -typedef CL_FIXNUM_TYPE cl_fixnum; -typedef unsigned CL_FIXNUM_TYPE cl_index; -typedef unsigned CL_FIXNUM_TYPE cl_hashkey; typedef unsigned char byte; /* @@ -73,8 +54,6 @@ typedef cl_object (*cl_objectfn)(int narg, ...); /* Immediate fixnums: */ #define FIXNUM_TAG 1 -#define FIXNUM_BITS ((sizeof)(cl_fixnum)/sizeof(byte)*8 - 2) -#define MOST_NEGATIVE_FIXNUM (-MOST_POSITIVE_FIXNUM-1) #define MAKE_FIXNUM(n) ((cl_object)(((cl_fixnum)(n) << 2) | FIXNUM_TAG)) #define FIXNUM_MINUSP(n) ((cl_fixnum)(n) < 0) #define FIXNUM_PLUSP(n) ((cl_fixnum)(n) >= (cl_fixnum)MAKE_FIXNUM(0)) diff --git a/src/h/stacks.h b/src/h/stacks.h index b5a7988f6..ee086bc47 100644 --- a/src/h/stacks.h +++ b/src/h/stacks.h @@ -201,7 +201,7 @@ extern size_t cssize; extern cl_object *Values; #else extern int NValues; -extern cl_object Values[VSSIZE]; +extern cl_object Values[]; #endif /*****************************