Fixed generation of function prototypes, and other glitches so that the lisp code can be compiled with a C++ compiler. The core library is still compiled with a C compiler.

This commit is contained in:
jjgarcia 2004-03-03 09:18:20 +00:00
parent 21b0d02960
commit 72dc89f61b
17 changed files with 58 additions and 40 deletions

View file

@ -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")
;;;

View file

@ -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 \

View file

@ -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) {}

View file

@ -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

View file

@ -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)

View file

@ -18,4 +18,5 @@
"src:clos;inspect.lsp"
"src:clos;conditions.lsp"))
#-cross
(mapc #'(lambda (x) (load x :verbose nil)) +clos-module-files+)

View file

@ -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)
))))))
)))))
;;; ----------------------------------------------------------------------

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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)

11
src/configure vendored
View file

@ -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;

View file

@ -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")

View file

@ -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);

View file

@ -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 */

View file

@ -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

View file

@ -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+))