mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-06 20:30:48 -08:00
Remove the need to use ecl.def and ecl-threads.def
This commit is contained in:
parent
89ffee8fd3
commit
b4e058bb0d
18 changed files with 1233 additions and 4127 deletions
|
|
@ -36,6 +36,10 @@
|
|||
`(progn ,@body))
|
||||
)
|
||||
|
||||
(ffi:clines "
|
||||
extern ECL_API size_t GC_get_total_bytes();
|
||||
")
|
||||
|
||||
(defconstant +wrap+ (ffi:c-inline () () :object "ecl_make_unsigned_integer(~((size_t)0))"
|
||||
:one-liner t))
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ THREADS_FLAGS=
|
|||
#
|
||||
TRUE_CC = cl
|
||||
CC = cl
|
||||
CFLAGS = -c $(ECL_CFLAGS) -I./ -I../ -I$(srcdir) -I$(top_srcdir)/gc/include -I$(top_srcdir)/gc/include/private
|
||||
CFLAGS = -c $(ECL_CFLAGS) -DECL_API="__declspec(dllexport)" -I./ -I../ -I$(srcdir) -I$(top_srcdir)/gc/include -I$(top_srcdir)/gc/include/private
|
||||
DEFS = $(THREADS_FLAGS)
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
|
@ -58,7 +58,7 @@ OBJS = main.obj symbol.obj package.obj list.obj\
|
|||
structure.obj load.obj unixfsys.obj unixsys.obj \
|
||||
ffi.obj alloc_2.obj tcp.obj $(THREADS_OBJ) ffi_x86.obj
|
||||
|
||||
all: $(DPP) ecl\external.h ..\eclmin.lib ..\cinit.obj
|
||||
all: $(DPP) ..\eclmin.lib ..\cinit.obj
|
||||
|
||||
.SUFFIXES: .obj .c .d
|
||||
|
||||
|
|
@ -75,15 +75,6 @@ all: $(DPP) ecl\external.h ..\eclmin.lib ..\cinit.obj
|
|||
|
||||
.PHONY: all
|
||||
|
||||
#
|
||||
# When compiling the library itself, we have to remove the dllimport
|
||||
# declarations, because the variables that they mark are in the
|
||||
# in the library and can be referenced without indirection.
|
||||
#
|
||||
ecl\external.h: $(top_srcdir)/h/external.h Makefile
|
||||
if not exist ecl mkdir ecl
|
||||
cut.exe removedecl < $(top_srcdir)/h/external.h > $@
|
||||
|
||||
cut.exe: $(top_srcdir)/util/cut.c
|
||||
$(CC) $(LDFLAGS) /Fecut.exe $(top_srcdir)/util/cut.c
|
||||
|
||||
|
|
@ -95,14 +86,14 @@ clean:
|
|||
-for %f in ($(OBJS:.obj=.c) all_symbols.c) do $(RM) %f
|
||||
-for %f in ($(OBJS) all_symbols.obj all_symbols2.obj) do $(RM) %f
|
||||
-$(RM) *.pdb
|
||||
-for %f in (..\ecl\config.h dpp dpp.obj $(DPP) ecl\external.h \
|
||||
-for %f in (..\ecl\config.h dpp dpp.obj $(DPP)
|
||||
..\eclmin.lib ..\cinit.obj cinit.c symbols_list2.h) \
|
||||
do $(RM) %f
|
||||
-for %f in (..\ecl\*.h) do $(RM) %f
|
||||
|
||||
# Build rules
|
||||
|
||||
$(DPP): $(srcdir)/dpp.c $(srcdir)/symbols_list2.h ../ecl/config.h ecl\external.h
|
||||
$(DPP): $(srcdir)/dpp.c $(srcdir)/symbols_list2.h ../ecl/config.h
|
||||
$(TRUE_CC) -I.. -I./ $(DEFS) $(srcdir)/dpp.c -o $@
|
||||
../ecl/config.h: ../ecl/config.h.msvc6 Makefile
|
||||
for %i in ($(HFILES)) do $(CP) %i ..\ecl
|
||||
|
|
|
|||
1463
msvc/ecl-threads.def
1463
msvc/ecl-threads.def
File diff suppressed because it is too large
Load diff
1438
msvc/ecl.def
1438
msvc/ecl.def
File diff suppressed because it is too large
Load diff
|
|
@ -84,6 +84,10 @@ ECL 0.9k:
|
|||
- The compiler now inlines and optimizes (FUNCALL (X ..) ... ) where X is a
|
||||
macro that returns a lambda form.
|
||||
|
||||
- ECL no longer needs library definition files ecl.def and ecl-threads.def
|
||||
thanks to a more clever use of declarations __declspec(dllexport) and
|
||||
__declspec(dllimport).
|
||||
|
||||
* System design:
|
||||
|
||||
- We introduce a new kind of lisp objects, the stack frames. These are objects
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ VPATH = @srcdir@
|
|||
#
|
||||
TRUE_CC = @CC@
|
||||
CC = @CC@
|
||||
CFLAGS = -c -I. -I@true_builddir@ -I$(srcdir) -I../ecl/gc @CPPFLAGS@ @CFLAGS@ @ECL_CFLAGS@ \
|
||||
CFLAGS = -c DECL_API -I. -I@true_builddir@ -I$(srcdir) -I../ecl/gc @CPPFLAGS@ @CFLAGS@ @ECL_CFLAGS@ \
|
||||
# -Wall -W -Wfloat-equal -Wundef -Wendif-labels -Wpointer-arith -Wcast-align \
|
||||
# -Wwrite-strings -Wconversion -Wsign-compare -Wmissing-prototypes -Wredundant-decls \
|
||||
# -Wunreachable-code -Winline
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ ecl_dynamic_callback_execute(cl_object cbk_info, char *arg_buffer)
|
|||
union ecl_ffi_values output;
|
||||
enum ecl_ffi_tag tag;
|
||||
|
||||
ECL_BUILD_STACK_FRAME(frame);
|
||||
ECL_BUILD_STACK_FRAME(frame, aux);
|
||||
|
||||
fun = CAR(cbk_info);
|
||||
rtype = CADR(cbk_info);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ ecl_dynamic_callback_execute(long i1, long i2, long i3, long i4, long i5, long i
|
|||
long i_reg[MAX_INT_REGISTERS];
|
||||
double f_reg[MAX_FP_REGISTERS];
|
||||
|
||||
ECL_BUILD_STACK_FRAME(frame);
|
||||
ECL_BUILD_STACK_FRAME(frame, aux);
|
||||
|
||||
fun = CAR(cbk_info);
|
||||
rtype = CADR(cbk_info);
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ _ecl_standard_dispatch(cl_object frame, cl_object gf)
|
|||
}
|
||||
}
|
||||
{
|
||||
ECL_BUILD_STACK_FRAME(frame1);
|
||||
ECL_BUILD_STACK_FRAME(frame1, aux);
|
||||
ecl_stack_frame_push(frame1, frame);
|
||||
ecl_stack_frame_push(frame1, Cnil);
|
||||
func = ecl_apply_from_stack_frame(frame1, func);
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ prepare_map(cl_va_list lists, cl_object cdrs_frame, cl_object cars_frame)
|
|||
cl_object res, *val = &res;
|
||||
cl_index i;
|
||||
@ {
|
||||
ECL_BUILD_STACK_FRAME(cars_frame);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame);
|
||||
ECL_BUILD_STACK_FRAME(cars_frame,frame1);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame,frame2);
|
||||
prepare_map(lists, cdrs_frame, cars_frame);
|
||||
res = Cnil;
|
||||
while (TRUE) {
|
||||
|
|
@ -60,8 +60,8 @@ prepare_map(cl_va_list lists, cl_object cdrs_frame, cl_object cars_frame)
|
|||
@(defun maplist (fun &rest lists)
|
||||
cl_object res, *val = &res;
|
||||
@ {
|
||||
ECL_BUILD_STACK_FRAME(cars_frame);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame);
|
||||
ECL_BUILD_STACK_FRAME(cars_frame,frame1);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame,frame2);
|
||||
prepare_map(lists, cdrs_frame, cars_frame);
|
||||
res = Cnil;
|
||||
while (TRUE) {
|
||||
|
|
@ -84,8 +84,8 @@ prepare_map(cl_va_list lists, cl_object cdrs_frame, cl_object cars_frame)
|
|||
@(defun mapc (fun &rest lists)
|
||||
cl_object onelist;
|
||||
@ {
|
||||
ECL_BUILD_STACK_FRAME(cars_frame);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame);
|
||||
ECL_BUILD_STACK_FRAME(cars_frame,frame1);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame,frame2);
|
||||
prepare_map(lists, cdrs_frame, cars_frame);
|
||||
onelist = ecl_stack_frame_elt(cdrs_frame, 0);
|
||||
while (TRUE) {
|
||||
|
|
@ -107,8 +107,8 @@ prepare_map(cl_va_list lists, cl_object cdrs_frame, cl_object cars_frame)
|
|||
@(defun mapl (fun &rest lists)
|
||||
cl_object onelist;
|
||||
@ {
|
||||
ECL_BUILD_STACK_FRAME(cars_frame);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame);
|
||||
ECL_BUILD_STACK_FRAME(cars_frame,frame1);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame,frame2);
|
||||
prepare_map(lists, cdrs_frame, cars_frame);
|
||||
onelist = ecl_stack_frame_elt(cdrs_frame, 0);
|
||||
while (TRUE) {
|
||||
|
|
@ -130,8 +130,8 @@ prepare_map(cl_va_list lists, cl_object cdrs_frame, cl_object cars_frame)
|
|||
@(defun mapcan (fun &rest lists)
|
||||
cl_object res, *val = &res;
|
||||
@ {
|
||||
ECL_BUILD_STACK_FRAME(cars_frame);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame);
|
||||
ECL_BUILD_STACK_FRAME(cars_frame,frame1);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame,frame2);
|
||||
prepare_map(lists, cdrs_frame, cars_frame);
|
||||
res = Cnil;
|
||||
while (TRUE) {
|
||||
|
|
@ -155,8 +155,8 @@ prepare_map(cl_va_list lists, cl_object cdrs_frame, cl_object cars_frame)
|
|||
@(defun mapcon (fun &rest lists)
|
||||
cl_object res, *val = &res;
|
||||
@ {
|
||||
ECL_BUILD_STACK_FRAME(cars_frame);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame);
|
||||
ECL_BUILD_STACK_FRAME(cars_frame,frame1);
|
||||
ECL_BUILD_STACK_FRAME(cdrs_frame,frame2);
|
||||
prepare_map(lists, cdrs_frame, cars_frame);
|
||||
res = Cnil;
|
||||
while (TRUE) {
|
||||
|
|
|
|||
|
|
@ -524,7 +524,7 @@
|
|||
(wt-comment "... shares definition with " (fun-name (fun-shares-with fun)))
|
||||
(return-from t3local-fun))
|
||||
(cond ((fun-exported fun)
|
||||
(wt-nl-h #+(and msvc (not ecl-min)) "__declspec(dllexport) " "cl_object " cfun "(")
|
||||
(wt-nl-h #+msvc "__declspec(dllexport) " "cl_object " cfun "(")
|
||||
(wt-nl1 "cl_object " cfun "("))
|
||||
(t
|
||||
(wt-nl-h "static cl_object " cfun "(")
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
;;;
|
||||
(setq si::*keep-documentation* nil)
|
||||
(proclaim '(optimize (safety 2) (space 3)))
|
||||
(let* ((c::*cc-flags* (concatenate 'string "-I\"@true_builddir@/c\" " c::*cc-flags*))
|
||||
(let* ((c::*cc-flags* (concatenate 'string "-DECL_API -I\"@true_builddir@/c\" " c::*cc-flags*))
|
||||
(lsp-objects (compile-if-old "build:lsp;" +lisp-module-files+
|
||||
:system-p t :c-file t :data-file t :h-file t
|
||||
;;:shared-data-file "build:ecl.sdat"
|
||||
|
|
@ -103,8 +103,8 @@
|
|||
;;; We do not need the -rpath flag for the library, nor -lecl.
|
||||
;;;
|
||||
(let ((c::*ld-shared-flags* #-msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @CORE_LIBS@ @LIBS@ @FASL_LIBS@"
|
||||
#+msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@ /DEF:@DEF@")
|
||||
(c::*cc-flags* (concatenate 'string "-I@true_builddir@/c " c::*cc-flags*)))
|
||||
#+msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@")
|
||||
(c::*cc-flags* (concatenate 'string "-DECL_API -I@true_builddir@/c " c::*cc-flags*)))
|
||||
(c::shared-cc (compile-file-pathname "ecl" :type :dll)
|
||||
"c/main.@OBJEXT@"
|
||||
"c/all_symbols2.@OBJEXT@"
|
||||
|
|
|
|||
22
src/h/ecl.h
22
src/h/ecl.h
|
|
@ -57,6 +57,28 @@ typedef unsigned short uint16_t;
|
|||
# define end_critical_section()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If ECL_API has been predefined, that means we are building the core
|
||||
* library and, under windows, we must tell the compiler to export
|
||||
* extern functions from the shared library.
|
||||
* If ECL_API is not defined, we are simply building an application that
|
||||
* uses ECL and, under windows, we must tell the compiler that certain
|
||||
* will be imported from a DLL.
|
||||
*/
|
||||
#if defined(mingw32) || defined(_MSC_VER) || defined(cygwin)
|
||||
# ifdef ECL_API
|
||||
# undef ECL_API
|
||||
# define ECL_API __declspec(dllexport)
|
||||
# else
|
||||
# define ECL_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# ifdef ECL_API
|
||||
# undef ECL_API
|
||||
# endif
|
||||
# define ECL_API
|
||||
#endif
|
||||
|
||||
#include <ecl/object.h>
|
||||
#include <ecl/stacks.h>
|
||||
#include <ecl/external.h>
|
||||
|
|
|
|||
2313
src/h/external.h
2313
src/h/external.h
File diff suppressed because it is too large
Load diff
|
|
@ -68,9 +68,9 @@ struct cl_compiler_env {
|
|||
#define cl_stack_ref(n) cl_env.stack[n]
|
||||
#define cl_stack_index() (cl_env.stack_top-cl_env.stack)
|
||||
|
||||
#define ECL_BUILD_STACK_FRAME(name) \
|
||||
struct ecl_stack_frame name##_aux;\
|
||||
cl_object name=(name##_aux.t=t_frame,name##_aux.narg=name##_aux.sp=0,(cl_object)&(name##_aux));
|
||||
#define ECL_BUILD_STACK_FRAME(name,frame) \
|
||||
struct ecl_stack_frame frame;\
|
||||
cl_object name=(frame.t=t_frame,frame.narg=frame.sp=0,(cl_object)(&frame))
|
||||
|
||||
/* ffi.d */
|
||||
|
||||
|
|
@ -128,20 +128,20 @@ struct ecl_fficall {
|
|||
cl_object cstring;
|
||||
};
|
||||
|
||||
enum ecl_ffi_tag ecl_foreign_type_code(cl_object type);
|
||||
enum ecl_ffi_calling_convention ecl_foreign_cc_code(cl_object cc_type);
|
||||
void ecl_fficall_prepare(cl_object return_type, cl_object arg_types, cl_object cc_type);
|
||||
void ecl_fficall_push_bytes(void *data, size_t bytes);
|
||||
void ecl_fficall_push_int(int word);
|
||||
void ecl_fficall_align(int data);
|
||||
cl_object ecl_foreign_data_ref_elt(void *p, enum ecl_ffi_tag type);
|
||||
void ecl_foreign_data_set_elt(void *p, enum ecl_ffi_tag type, cl_object value);
|
||||
extern enum ecl_ffi_tag ecl_foreign_type_code(cl_object type);
|
||||
extern enum ecl_ffi_calling_convention ecl_foreign_cc_code(cl_object cc_type);
|
||||
extern void ecl_fficall_prepare(cl_object return_type, cl_object arg_types, cl_object cc_type);
|
||||
extern void ecl_fficall_push_bytes(void *data, size_t bytes);
|
||||
extern void ecl_fficall_push_int(int word);
|
||||
extern void ecl_fficall_align(int data);
|
||||
extern cl_object ecl_foreign_data_ref_elt(void *p, enum ecl_ffi_tag type);
|
||||
extern void ecl_foreign_data_set_elt(void *p, enum ecl_ffi_tag type, cl_object value);
|
||||
|
||||
struct ecl_fficall_reg *ecl_fficall_prepare_extra(struct ecl_fficall_reg *registers);
|
||||
void ecl_fficall_push_arg(union ecl_ffi_values *data, enum ecl_ffi_tag type);
|
||||
void ecl_fficall_execute(void *f_ptr, struct ecl_fficall *fficall, enum ecl_ffi_tag return_type);
|
||||
void ecl_dynamic_callback_call(cl_object callback_info, char* buffer);
|
||||
void* ecl_dynamic_callback_make(cl_object data, enum ecl_ffi_calling_convention cc_type);
|
||||
extern struct ecl_fficall_reg *ecl_fficall_prepare_extra(struct ecl_fficall_reg *registers);
|
||||
extern void ecl_fficall_push_arg(union ecl_ffi_values *data, enum ecl_ffi_tag type);
|
||||
extern void ecl_fficall_execute(void *f_ptr, struct ecl_fficall *fficall, enum ecl_ffi_tag return_type);
|
||||
extern void ecl_dynamic_callback_call(cl_object callback_info, char* buffer);
|
||||
extern void* ecl_dynamic_callback_make(cl_object data, enum ecl_ffi_calling_convention cc_type);
|
||||
|
||||
/* file.d */
|
||||
|
||||
|
|
@ -257,12 +257,6 @@ typedef int fenv_t;
|
|||
# define fesetenv(bits) _controlfp(*(bits), MCW_EM)
|
||||
#endif
|
||||
|
||||
/* unixfsys.d */
|
||||
|
||||
#if defined(_MSC_VER) || defined(mingw32)
|
||||
extern cl_object si_get_library_pathname(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Fake several ISO C99 mathematical functions
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -32,17 +32,17 @@ typedef struct bds_bd {
|
|||
bds_overflow()
|
||||
|
||||
#ifdef ECL_THREADS
|
||||
extern void bds_bind(cl_object symbol, cl_object value);
|
||||
extern void bds_push(cl_object symbol);
|
||||
extern void bds_unwind1();
|
||||
extern void bds_unwind_n(int n);
|
||||
extern cl_object *ecl_symbol_slot(cl_object s);
|
||||
extern ECL_API void bds_bind(cl_object symbol, cl_object value);
|
||||
extern ECL_API void bds_push(cl_object symbol);
|
||||
extern ECL_API void bds_unwind1();
|
||||
extern ECL_API void bds_unwind_n(int n);
|
||||
extern ECL_API cl_object *ecl_symbol_slot(cl_object s);
|
||||
#define SYM_VAL(s) (*ecl_symbol_slot(s))
|
||||
#if 0
|
||||
#define ECL_SET(s,v) ((s)->symbol.value=(v))
|
||||
#define ECL_SETQ(s,v) (*ecl_symbol_slot(s)=(v))
|
||||
#else
|
||||
extern cl_object ecl_set_symbol(cl_object s, cl_object v);
|
||||
extern ECL_API cl_object ecl_set_symbol(cl_object s, cl_object v);
|
||||
#define ECL_SET(s,v) (ecl_set_symbol(s,v))
|
||||
#define ECL_SETQ(s,v) (ecl_set_symbol(s,v))
|
||||
#endif
|
||||
|
|
@ -88,7 +88,7 @@ typedef struct ihs_frame {
|
|||
cl_env.ihs_top = cl_env.ihs_top->next; \
|
||||
} while(0)
|
||||
|
||||
extern cl_object ihs_top_function_name(void);
|
||||
extern ECL_API cl_object ihs_top_function_name(void);
|
||||
|
||||
/***************
|
||||
* FRAME STACK
|
||||
|
|
@ -122,7 +122,7 @@ typedef struct ecl_frame {
|
|||
cl_index frs_sp;
|
||||
} *ecl_frame_ptr;
|
||||
|
||||
extern ecl_frame_ptr _frs_push(register cl_object val);
|
||||
extern ECL_API ecl_frame_ptr _frs_push(register cl_object val);
|
||||
#define frs_push(val) ecl_setjmp(_frs_push(val)->frs_jmpbuf)
|
||||
#define frs_pop() (cl_env.frs_top--)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Returns, as a string, the location of the machine on which ECL runs."
|
|||
(defun lisp-implementation-version ()
|
||||
"Args:()
|
||||
Returns the version of your ECL as a string."
|
||||
"@PACKAGE_VERSION@ (CVS 2008-02-16 11:33)")
|
||||
"@PACKAGE_VERSION@ (CVS 2008-03-16 12:11)")
|
||||
|
||||
(defun machine-type ()
|
||||
"Args: ()
|
||||
|
|
|
|||
|
|
@ -51,9 +51,6 @@ main(int narg, char **argv) {
|
|||
if (strstr(buffer, "-CUT-")) {
|
||||
exit(0);
|
||||
}
|
||||
} else if (strstr(buffer, "declspec(dllimport)")) {
|
||||
/* This is used to removed the declspec(dllimport) from external.h */
|
||||
continue;
|
||||
}
|
||||
puts(buffer);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue