diff --git a/src/bare.lsp.in b/src/bare.lsp.in index 0ceb51e5d..788078393 100644 --- a/src/bare.lsp.in +++ b/src/bare.lsp.in @@ -21,15 +21,18 @@ ;;; ;;; * Load Common-Lisp base library ;;; -(if (member "ECL-MIN" *features* :test #'string-equal) +(if (or (member "ECL-MIN" *features* :test #'string-equal) + (member "CROSS" *features* :test #'string-equal)) (load "lsp/load.lsp" :verbose nil)) + (defun si::process-command-args () ) ;;; ;;; * Load PCL-based Common-Lisp Object System ;;; (setf sys::*gc-verbose* nil) -#+(and wants-clos ecl-min) +(print *features*) +#+(or (and wants-clos ecl-min) cross) (load "clos/load.lsp") ;;; diff --git a/src/c/Makefile.in b/src/c/Makefile.in index 5c43a2f2e..9c3e6781f 100644 --- a/src/c/Makefile.in +++ b/src/c/Makefile.in @@ -8,7 +8,7 @@ VPATH = @srcdir@ # Programs used by "make": # TRUE_CC = @CC@ -CC = @ECL_CC@ +CC = @CC@ CFLAGS = -c -I$(srcdir) -I$(HDIR) -I../h @BOEHM_HEADERS@ @CFLAGS@ @ECL_CFLAGS@ \ # -Wall -W -Wfloat-equal -Wundef -Wendif-labels -Wpointer-arith -Wcast-align \ # -Wwrite-strings -Wconversion -Wsign-compare -Wmissing-prototypes -Wredundant-decls \ diff --git a/src/c/cinit.d b/src/c/cinit.d index 45e6520ec..17cca40db 100644 --- a/src/c/cinit.d +++ b/src/c/cinit.d @@ -69,9 +69,9 @@ main(int argc, char **args) } #ifdef __cplusplus -extern "C" void init_LSP(void); -extern "C" void init_CLOS(void); +extern "C" void init_LSP(cl_object); +extern "C" void init_CLOS(cl_object); #endif -void init_LSP(void) {} -void init_CLOS(void) {} +void init_LSP(cl_object o) {} +void init_CLOS(cl_object o) {} diff --git a/src/c/load.d b/src/c/load.d index 052df1b84..a52fd983b 100644 --- a/src/c/load.d +++ b/src/c/load.d @@ -155,7 +155,7 @@ si_load_binary(cl_object filename, cl_object verbose, cl_object print) /* Finally, perform initialization */ GO_ON: - read_VV(block, block->cblock.entry); + read_VV(block, (void (*)(cl_object))(block->cblock.entry)); output = Cnil; OUTPUT: #ifdef ECL_THREADS diff --git a/src/c/read.d b/src/c/read.d index 6ad2c1343..1f1fe35a9 100644 --- a/src/c/read.d +++ b/src/c/read.d @@ -1789,14 +1789,12 @@ init_read(void) *---------------------------------------------------------------------- */ cl_object -read_VV(cl_object block, void *entry) +read_VV(cl_object block, void (*entry_point)(cl_object)) { volatile cl_object old_eptbc = cl_core.packages_to_be_created; - typedef void (*entry_point_ptr)(cl_object); volatile cl_object x; cl_index i, len; cl_object in; - entry_point_ptr entry_point = (entry_point_ptr)entry; cl_object *VV; if (block == NULL) diff --git a/src/clos/load.lsp.in b/src/clos/load.lsp.in index 0168fbf9f..9fb088f93 100644 --- a/src/clos/load.lsp.in +++ b/src/clos/load.lsp.in @@ -18,4 +18,5 @@ "src:clos;inspect.lsp" "src:clos;conditions.lsp")) +#-cross (mapc #'(lambda (x) (load x :verbose nil)) +clos-module-files+) diff --git a/src/clos/method.lsp b/src/clos/method.lsp index 663b41a38..1a0b278c9 100644 --- a/src/clos/method.lsp +++ b/src/clos/method.lsp @@ -51,8 +51,7 @@ (LOAD) (SI:RECORD-SOURCE-PATHNAME ',name '(DEFMETHOD ',qualifiers ',specializers))) - (EVAL-WHEN (COMPILE LOAD EVAL) - (INSTALL-METHOD + (INSTALL-METHOD ',name ',qualifiers ',specializers @@ -60,7 +59,7 @@ ',doc ',plist ,fn-form) - )))))) + ))))) ;;; ---------------------------------------------------------------------- diff --git a/src/clos/walk.lsp b/src/clos/walk.lsp index 218a9e7f1..589f67f17 100644 --- a/src/clos/walk.lsp +++ b/src/clos/walk.lsp @@ -229,7 +229,7 @@ (if wfop walk-form (second lock)) (if decp declarations (third lock)) (if lexp lexical-variables (fourth lock))))))) - + (defun env-walk-function (env) (declare (si::c-local)) (first (env-lock env))) @@ -353,7 +353,7 @@ ;;; walker. ;;; -(eval-when (compile load eval) +(eval-when (#-cross compile load eval) (defmacro get-walker-template-internal (x) ;Has to be inside eval-when because `(get-sysprop ,x 'WALKER-TEMPLATE)) ;Golden Common Lisp doesn't hack diff --git a/src/cmp/cmpcall.lsp b/src/cmp/cmpcall.lsp index fca85336f..0e9ec1d80 100644 --- a/src/cmp/cmpcall.lsp +++ b/src/cmp/cmpcall.lsp @@ -220,7 +220,11 @@ ;; We only write declarations for functions which are not ;; in lisp_external.h (when (and (not found) (not (si::mangle-name fname t))) + (wt-h "#ifdef __cplusplus") + (wt-h "extern cl_object " fd "(...);") + (wt-h "#else") (wt-h "extern cl_object " fd "();") + (wt-h "#endif") (setf (gethash fd *compiler-declared-globals*) 1))) (unwind-exit (if (minusp maxarg) diff --git a/src/cmp/cmpmain.lsp b/src/cmp/cmpmain.lsp index 7ab82d4dc..5e50aa911 100644 --- a/src/cmp/cmpmain.lsp +++ b/src/cmp/cmpmain.lsp @@ -111,7 +111,7 @@ coprocessor).") #define ECL_CPP_TAG #endif -~{ extern ECL_CPP_TAG void init_~A();~%~} +~{ extern ECL_CPP_TAG void init_~A(cl_object);~%~} ") @@ -119,7 +119,7 @@ coprocessor).") #ifdef __cplusplus extern \"C\" #endif -int init_~A(cl_object cblock) +void init_~A(cl_object cblock) { static cl_object Cblock; cl_object subblock; @@ -137,7 +137,7 @@ int init_~A(cl_object cblock) VV = Cblock->cblock.data; #endif ~A -~:[~{ subblock = read_VV(OBJNULL,init_~A); subblock->cblock.next = Cblock;~%~} +~:[~{ subblock = read_VV(OBJNULL, init_~A); subblock->cblock.next = Cblock;~%~} ~;~{ init_~A(Cblock);~%~}~] ~A diff --git a/src/compile.lsp.in b/src/compile.lsp.in index 88ed0ad26..87ee1c541 100644 --- a/src/compile.lsp.in +++ b/src/compile.lsp.in @@ -8,6 +8,8 @@ ;;; - On a second stage, using the final ECL executable, to test it. ;;; +(setq *package* (find-package "SYSTEM")) + ;;; ;;; * Ensure that we have the whole of Common-Lisp to compile ;;; @@ -95,7 +97,7 @@ cd ..; rm -rf tmp/*'"))) (si::pathname-translations "SYS" '(("**;*.*.*" "@ecldir@/**/*.*"))) -#+(or (not stage1) WANTS-CMP) +#+(and (not cross) (or (not stage1) WANTS-CMP)) (let ((objects (compile-if-old "build:cmp;" +cmp-module-files+ :system-p t :c-file t :data-file t :h-file t))) (c::build-static-library "cmp" :lisp-files objects) diff --git a/src/configure b/src/configure index 34095e034..0315e22ac 100755 --- a/src/configure +++ b/src/configure @@ -861,7 +861,6 @@ Optional Features: --enable-local-gmp Use already installed GMP library. --enable-threads Include the multiple thread facility. --disable-shared Disable building dynamically loadable extensions. ---enable-cxx Build ECL using C++ compiler. --enable-opcode8 Interpreter uses 8-bit codes (only Intel!). Optional Packages: @@ -874,6 +873,7 @@ Optional Packages: --with-cmuformat Use the FORMAT routine from CMUCL. --with-clos-streams Allow user defined stream objects. --with-ffi Run-time foreign data manipulation. +--with-cxx Build ECL using C++ compiler. --with-x use the X Window System Some influential environment variables: @@ -1475,10 +1475,11 @@ if test "${with_ffi+set}" = set; then withval="$with_ffi" ffi="yes" fi; -# Check whether --enable-cxx or --disable-cxx was given. -if test "${enable_cxx+set}" = set; then - enableval="$enable_cxx" - usecxx=${enableval} + +# Check whether --with-cxx or --without-cxx was given. +if test "${with_cxx+set}" = set; then + withval="$with_cxx" + usecxx="${withval}" else usecxx="no" fi; diff --git a/src/configure.in b/src/configure.in index feb6b3aae..5afc81dc3 100644 --- a/src/configure.in +++ b/src/configure.in @@ -96,9 +96,9 @@ AC_ARG_WITH(clos-streams, AC_ARG_WITH(ffi, [--with-ffi Run-time foreign data manipulation.], ffi="yes") -AC_ARG_ENABLE(cxx, - [--enable-cxx Build ECL using C++ compiler.], - usecxx=${enableval},usecxx="no") +AC_ARG_WITH(cxx, + [--with-cxx Build ECL using C++ compiler.], + usecxx="${withval}",usecxx="no") AC_ARG_ENABLE(opcode8, [--enable-opcode8 Interpreter uses 8-bit codes (only Intel!).], opcode8=${enableval},opcode8="no") diff --git a/src/h/external.h b/src/h/external.h index c5d35a568..337745c41 100644 --- a/src/h/external.h +++ b/src/h/external.h @@ -1126,7 +1126,7 @@ extern cl_object ecl_current_readtable(void); extern int ecl_current_read_base(void); extern char ecl_current_read_default_float_format(void); extern cl_object c_string_to_object(const char *s); -extern cl_object read_VV(cl_object block, void *entry); +extern cl_object read_VV(cl_object block, void (*entry)(cl_object)); /* reference.c */ @@ -1416,7 +1416,7 @@ extern cl_object si_chdir _ARGS((cl_narg narg, cl_object directory, ...)); extern cl_object si_mkdir(cl_object directory, cl_object mode); extern cl_object cl_directory _ARGS((cl_narg narg, cl_object directory, ...)); extern cl_object cl_user_homedir_pathname _ARGS((cl_narg narg, ...)); -extern cl_object si_mkstemp(cl_object template); +extern cl_object si_mkstemp(cl_object templ); extern const char *expand_pathname(const char *name); extern cl_object ecl_string_to_pathname(char *s); diff --git a/src/h/internal.h b/src/h/internal.h index b8aa47a97..3f8c29dd8 100644 --- a/src/h/internal.h +++ b/src/h/internal.h @@ -41,8 +41,8 @@ extern void init_stacks(int *); extern void init_unixint(void); extern void init_unixtime(void); extern void ecl_init_env(struct cl_env_struct *); -extern void init_LSP(void); -extern void init_CLOS(void); +extern void init_LSP(cl_object); +extern void init_CLOS(cl_object); /* all_functions.d */ diff --git a/src/h/object.h b/src/h/object.h index 000a90b9a..73adf49d0 100644 --- a/src/h/object.h +++ b/src/h/object.h @@ -535,7 +535,15 @@ typedef enum { /* Type_of. */ -#define type_of(obje) ((cl_type)(IMMEDIATE(obje) ? IMMEDIATE(obje) : (((cl_object)(obje)) ->d.t))) +#if defined(__cplusplus) || defined(__GNUC__) +static inline cl_type type_of(cl_object o) { + int i = IMMEDIATE(o); + return (i? (cl_type)i : (cl_type)(o->d.t)); +} +#else +#define type_of(o) \ + ((cl_type)(IMMEDIATE(o) ? IMMEDIATE(o) : ((o)->d.t))) +#endif /* This is used to retrieve optional arguments diff --git a/src/lsp/load.lsp.in b/src/lsp/load.lsp.in index 6f8e3c81a..a2cff64f9 100644 --- a/src/lsp/load.lsp.in +++ b/src/lsp/load.lsp.in @@ -1,9 +1,11 @@ -(load "src:lsp;export.lsp" :verbose nil) -(load "src:lsp;defmacro.lsp" :verbose nil) -(load "src:lsp;helpfile.lsp" :verbose nil) -(load "src:lsp;evalmacros.lsp" :verbose nil) +(if (not (member "CROSS" *features* :test #'string-equal)) + (progn + (load "src:lsp;export.lsp" :verbose nil) + (load "src:lsp;defmacro.lsp" :verbose nil) + (load "src:lsp;helpfile.lsp" :verbose nil) + (load "src:lsp;evalmacros.lsp" :verbose nil))) -(defconstant +lisp-module-files+ +(sys:*make-constant '+lisp-module-files+ '("src:lsp;export.lsp" "src:lsp;defmacro.lsp" "src:lsp;helpfile.lsp" @@ -43,5 +45,5 @@ "src:lsp;mp.lsp" )) -(mapc #'(lambda (x) (load x :verbose nil)) (cddddr +lisp-module-files+)) - +#-cross +(mapc #'(lambda (x) (load x :verbose nil)) (cddddr +lisp-module-files+)) \ No newline at end of file