From 141bca276933edc997456e9cba6a046d57150d35 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 19 Aug 2003 19:25:03 +0000 Subject: [PATCH] elk (3.0-10) unstable; urgency=low * Updated debhelper build dependency to >>3.0.0. * Shared library handling: + Extended load.c:General_Load() to open shared libraries. + Makefiles now build shared libraries. + Stopped distributing .o files and replaced them with the .so shared libraries; built the Unix, X11, Xaw and Motif extensions. + The interpreter is no longer linked with -lgdbm, gdbm.so is instead. * Replaced standalone.o and module.o with their .a equivalents. * Made the 'debian/arch-config' sourcing errors non-fatal so that make distclean works in the src/ directory. * Changed SCM_DIR again, from /usr/share/elk/scm to /usr/share/elk, and ditto with OBJ_DIR, from /usr/lib/elk/obj to /usr/lib/elk. * Defaulted "garbage-collect-notify?" and "autoload-notify?" to #f. -- Samuel Hocevar Tue, 1 Apr 2003 23:34:26 +0200 git-svn-id: svn://svn.zoy.org/elk/trunk@4 55e467fa-43c5-0310-a8a2-de718669efc6 --- MACHINES | 2 +- config/system | 2 +- debian/README.Debian | 6 +- debian/changelog | 18 ++++++ debian/control | 7 ++- debian/elk.ini | 2 +- debian/rules | 3 +- debian/scheme-warning-elk | 2 +- include/Makefile | 2 +- include/build-config | 9 ++- include/object.h | 32 +++++----- lib/misc/Makefile | 2 +- lib/misc/bitstring.c | 1 + lib/misc/build | 62 +++++++++++++++---- lib/misc/elk-eval.c | 6 +- lib/misc/gdbm.c | 3 +- lib/misc/hack.c | 1 + lib/misc/record.c | 1 + lib/misc/regexp.c | 3 +- lib/misc/struct.c | 1 + lib/unix/Makefile | 2 +- lib/unix/build | 17 +++-- lib/unix/file.c | 2 +- lib/unix/passwd.c | 2 +- lib/unix/process.c | 2 +- lib/unix/unix.c | 1 + lib/xaw/Makefile | 2 +- lib/xaw/build | 118 ++++++++++++++++++++++++++++++----- lib/xlib/Makefile | 2 +- lib/xlib/build | 17 +++-- lib/xlib/client.c | 8 +-- lib/xlib/color.c | 2 +- lib/xlib/colormap.c | 2 +- lib/xlib/display.c | 4 +- lib/xlib/error.c | 4 +- lib/xlib/event.c | 2 +- lib/xlib/extension.c | 2 +- lib/xlib/font.c | 2 +- lib/xlib/gcontext.c | 2 +- lib/xlib/grab.c | 2 +- lib/xlib/graphics.c | 8 +-- lib/xlib/init.c | 1 + lib/xlib/key.c | 2 +- lib/xlib/pixel.c | 2 +- lib/xlib/property.c | 6 +- lib/xlib/type.c | 4 +- lib/xlib/window.c | 4 +- lib/xlib/wm.c | 2 +- lib/xm/Makefile | 2 +- lib/xm/build | 126 +++++++++++++++++++++++++++++++++----- lib/xm/xt/Makefile | 2 +- lib/xm/xt/build | 19 +++--- lib/xt/Makefile | 2 +- lib/xt/accelerator.c | 2 +- lib/xt/action.c | 2 +- lib/xt/build | 17 +++-- lib/xt/callback.c | 2 +- lib/xt/class.c | 2 +- lib/xt/context.c | 4 +- lib/xt/init.c | 1 + lib/xt/resource.c | 4 +- lib/xt/translation.c | 4 +- lib/xt/widget.c | 4 +- scm/Makefile | 2 +- scm/bitstring.scm | 2 +- scm/build | 8 +-- scm/gdbmtest.scm | 2 +- scm/oops.scm | 2 +- scm/record.scm | 2 +- scm/regexp.scm | 2 +- scm/struct.scm | 2 +- scm/unix.scm | 2 +- scm/xlib.scm | 2 +- scm/xt.scm | 4 +- scm/xwidgets.scm | 11 ++-- scripts/Makefile | 2 +- src/Makefile | 2 +- src/autoload.c | 2 +- src/build | 20 +++--- src/heap.c | 2 +- src/load-dl.c | 26 +++++++- src/load-ld.c | 6 +- src/load-rld.c | 2 +- src/load-shl.c | 2 +- src/load.c | 29 ++++++--- src/main.c | 2 +- 86 files changed, 509 insertions(+), 209 deletions(-) diff --git a/MACHINES b/MACHINES index e928df3..1653eae 100644 --- a/MACHINES +++ b/MACHINES @@ -59,7 +59,7 @@ Sun-4, SunOS 5.2 (Solaris 2.2) A bug in Solaris 2.1 causes dlopen() to fail if more than 8 shared objects are loaded (which in turn causes the "load" primitive of Elk to signal an error). This restriction doesn't - exit in newer versions of Solaris 2. + exist in newer versions of Solaris 2. You can use the -v option of Elk to see the actual linker options when an object file is loaded. diff --git a/config/system b/config/system index 21fa2c8..5917d71 100644 --- a/config/system +++ b/config/system @@ -318,7 +318,7 @@ obj_ldflags= # The linker flags used to link the interpreter. -ldflags='-rdynamic -lm -ldl -lelf -lgdbm' +ldflags='-rdynamic -lm -ldl -lelf' # The lint flags. diff --git a/debian/README.Debian b/debian/README.Debian index 00fcdee..e1341d7 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -18,11 +18,11 @@ $install_dir/bin/scheme /usr/bin/scheme $install_dir/include/ /usr/include/elk/ -$install_dir/runtime/scm/ /usr/share/elk/scm/ +$install_dir/runtime/scm/ /usr/share/elk/ -$install_dir/runtime/obj/ /usr/lib/elk/obj/ +$install_dir/runtime/obj/ /usr/lib/elk/ -$install_dir/lib/*.o /usr/lib/elk/*.o +$install_dir/lib/*.o /usr/lib/elk/*.{o,so} $install_dir/lib/{linkscheme,makedl} /usr/bin/{linkscheme,makedl} diff --git a/debian/changelog b/debian/changelog index 9e933db..90454e4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +elk (3.0-10) unstable; urgency=low + + * Updated debhelper build dependency to >>3.0.0. + * Shared library handling: + + Extended load.c:General_Load() to open shared libraries. + + Makefiles now build shared libraries. + + Stopped distributing .o files and replaced them with the .so shared + libraries; built the Unix, X11, Xaw and Motif extensions. + + The interpreter is no longer linked with -lgdbm, gdbm.so is instead. + * Replaced standalone.o and module.o with their .a equivalents. + * Made the 'debian/arch-config' sourcing errors non-fatal so that make + distclean works in the src/ directory. + * Changed SCM_DIR again, from /usr/share/elk/scm to /usr/share/elk, and + ditto with OBJ_DIR, from /usr/lib/elk/obj to /usr/lib/elk. + * Defaulted "garbage-collect-notify?" and "autoload-notify?" to #f. + + -- Samuel Hocevar Tue, 1 Apr 2003 23:34:26 +0200 + elk (3.0-9) unstable; urgency=low * New maintainer. diff --git a/debian/control b/debian/control index 0598b1c..9429d0f 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: elk Section: devel Priority: optional Maintainer: Samuel Hocevar -Build-Depends: debhelper (>> 2.0.0), libelfg0-dev, xlibs-dev, lesstif-dev, libgdbmg1-dev, libxaw7-dev +Build-Depends: debhelper (>> 3.0.0), libelfg0-dev, xlibs-dev, lesstif-dev, libgdbmg1-dev, libxaw7-dev Standards-Version: 3.5.9.0 Package: elk @@ -17,6 +17,11 @@ Description: the Extension Language Kit, a Scheme implementation language subsystem for applications written in C or C++. . Elk is also useful as a stand-alone Scheme implementation. + . + This package also contains several plugins shipped with Elk. They provide + hooks for Unix system calls, the X Window System, as well as the X Athena + Widgets and the Motif toolkits. Example scripts on how to use these plugins + are provided in the elkdoc package. Package: elkdoc Architecture: all diff --git a/debian/elk.ini b/debian/elk.ini index 82184e6..19a755a 100644 --- a/debian/elk.ini +++ b/debian/elk.ini @@ -47,7 +47,7 @@ ;;; the directory where any auxillary files to your Scheme ;;; implementation reside. -(define (implementation-vicinity) "/usr/share/elk/scm") +(define (implementation-vicinity) "/usr/share/elk") ;;; (library-vicinity) should be defined to be the pathname of the ;;; directory where files of Scheme library functions reside. diff --git a/debian/rules b/debian/rules index 502122a..4c68177 100644 --- a/debian/rules +++ b/debian/rules @@ -54,7 +54,8 @@ install: build mv $(CURDIR)/debian/elk/usr/bin/scheme \ $(CURDIR)/debian/elk/usr/bin/scheme-elk install -m 755 debian/scheme-warning-elk $(CURDIR)/debian/elk/usr/bin/ - install -m 644 debian/elk.ini $(CURDIR)/debian/elk/usr/share/elk/scm + install -m 644 debian/elk.ini $(CURDIR)/debian/elk/usr/share/elk + # dh_movefiles # Build architecture-independent files here. diff --git a/debian/scheme-warning-elk b/debian/scheme-warning-elk index 68a0a1d..507a030 100644 --- a/debian/scheme-warning-elk +++ b/debian/scheme-warning-elk @@ -8,6 +8,6 @@ To do so, run (as root) the following command: update-alternatives --install /usr/bin/scheme scheme /usr/bin/scheme-elk 20 \ --slave /usr/share/man/man1/scheme.1.gz scheme.1.gz /usr/share/man/man1/elk.1.gz -Press any key to continue." +Press ENTER to continue." read foo diff --git a/include/Makefile b/include/Makefile index e61d7f4..2a53bb2 100644 --- a/include/Makefile +++ b/include/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../config/system ../config/site +Makefile.local: build ../config/system ../config/site $(SHELL) ./build default: Makefile.local diff --git a/include/build-config b/include/build-config index dbc50ae..a578f27 100755 --- a/include/build-config +++ b/include/build-config @@ -55,6 +55,7 @@ def_cachectl_h=undef def_syms_begin_with=undef def_ansi_cpp=undef def_can_load_obj=undef +def_can_load_lib=undef def_sigsegv_siginfo=undef def_sigsegv_sigcontext=undef def_sigsegv_arg4=undef @@ -168,7 +169,8 @@ case _$load_obj in _ld) def_use_ld=define; def_can_load_obj=define;; _rld) def_use_rld=define; def_can_load_obj=define;; _shl) def_use_shl=define; def_can_load_obj=define;; -_dl) def_use_dlopen=define; def_can_load_obj=define;; +_dl) def_use_dlopen=define; def_can_load_obj=define + def_can_load_lib=define;; _) ;; *) echo Error in config file: echo Invalid value for symbol load_obj: $load_obj; exit 1;; @@ -283,6 +285,7 @@ cat <config.h #$def_hp_shared_libs HPSHLIB #$def_debug_dump DEBUG_DUMP #$def_can_load_obj CAN_LOAD_OBJ +#$def_can_load_lib CAN_LOAD_LIB #$def_use_ld USE_LD #$def_use_rld USE_RLD #$def_use_shl USE_SHL @@ -321,8 +324,8 @@ $def_bcopy $def_bzero $def_bcmp #define AOUT_H $aout_h -#define SCM_DIR "$final_dir/share/elk/scm" -#define OBJ_DIR "$final_dir/lib/elk/obj" +#define SCM_DIR "$final_dir/share/elk" +#define OBJ_DIR "$final_dir/lib/elk" #define HEAP_SIZE $default_heap_size #define FIND_AOUT defined(USE_LD) || defined(CAN_DUMP)\\ || defined(INIT_OBJECTS) diff --git a/include/object.h b/include/object.h index 02cc539..37b097c 100644 --- a/include/object.h +++ b/include/object.h @@ -3,7 +3,7 @@ */ typedef struct { - unsigned long data; + unsigned long int data; int tag; } Object; @@ -22,8 +22,8 @@ typedef struct { #define CHAR(x) ((int)(x).data) #define POINTER(x) ((x).data) -#define SETPOINTER(x,p) ((x).data = (unsigned long)(p)) -#define SET(x,t,p) ((x).tag = (int)t << 1, (x).data = (unsigned long)(p)) +#define SETPOINTER(x,p) ((x).data = (unsigned long int)(p)) +#define SET(x,t,p) ((x).tag = (int)t << 1, (x).data = (unsigned long int)(p)) #define ISCONST(x) ((x).tag & CONSTBIT) #define SETCONST(x) ((x).tag |= CONSTBIT) @@ -37,10 +37,10 @@ typedef struct { #ifdef GENERATIONAL_GC - typedef int gcspace_t; /* type used for space and type arrays */ - typedef unsigned long gcptr_t; /* type used for pointers */ - typedef unsigned long pageno_t; /* type used for page numbers */ - typedef unsigned long addrarith_t; /* type used for address arithmetic */ + typedef int gcspace_t; /* type for space and type arrays */ + typedef unsigned long int gcptr_t; /* type for pointers */ + typedef unsigned long int pageno_t; /* type for page numbers */ + typedef unsigned long int addrarith_t; /* type for address arithmetic */ extern gcspace_t *space; extern gcspace_t current_space; @@ -118,8 +118,8 @@ typedef unsigned short gran_t; /* Granularity of bignums */ struct S_Bignum { Object minusp; - unsigned size; /* Number of ushorts allocated */ - unsigned usize; /* Number of ushorts actually used */ + unsigned int size; /* Number of ushorts allocated */ + unsigned int usize; /* Number of ushorts actually used */ gran_t data[1]; /* Data, lsw first */ }; @@ -189,8 +189,8 @@ typedef struct gcnode { typedef struct mem_node { struct mem_node *next; - unsigned len; - unsigned long refcnt; + unsigned int len; + unsigned long int refcnt; } MEM_NODE; #if defined(vax) || defined(__vax__) @@ -207,13 +207,13 @@ struct S_Control { Object gcsave; /* vector */ WIND *firstwind, *lastwind; int tailcall; - unsigned delta; + unsigned int delta; #ifdef GENERATIONAL_GC int reloc; #endif jmp_buf j; int size; - unsigned long intrlevel; + unsigned long int intrlevel; char stack[1]; /* must be word aligned */ }; @@ -229,7 +229,7 @@ struct S_Port { char unread; int ptr; FILE *file; - unsigned lno; + unsigned int lno; int (*closefun) P_((FILE*)); }; #define P_OPEN 1 /* flags */ @@ -285,7 +285,7 @@ typedef struct { typedef struct sym { struct sym *next; char *name; - unsigned long value; + unsigned long int value; } SYM; typedef struct { @@ -322,7 +322,7 @@ typedef struct weak_node { typedef struct { char *name; - unsigned long val; + unsigned long int val; } SYMDESCR; diff --git a/lib/misc/Makefile b/lib/misc/Makefile index cd1a7d3..29e6f57 100644 --- a/lib/misc/Makefile +++ b/lib/misc/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../../config/system ../../config/site +Makefile.local: build ../../config/system ../../config/site $(SHELL) ./build default: Makefile.local diff --git a/lib/misc/bitstring.c b/lib/misc/bitstring.c index ef7c260..6855fa5 100644 --- a/lib/misc/bitstring.c +++ b/lib/misc/bitstring.c @@ -522,5 +522,6 @@ elk_init_lib_bitstring() { Def_Prim(P_Bitstring_Andnot, "bitstring-andnot!", 2, 2, EVAL); Def_Prim(P_Bitstring_Xor, "bitstring-xor!", 2, 2, EVAL); Def_Prim(P_Substring_Move, "bitstring-substring-move!", 5, 5, EVAL); + P_Provide (Intern ("bitstring.so")); P_Provide (Intern ("bitstring.o")); } diff --git a/lib/misc/build b/lib/misc/build index a4bdb2e..949df22 100755 --- a/lib/misc/build +++ b/lib/misc/build @@ -4,7 +4,7 @@ if [ _$gdbm = _yes ]; then gdbm_c="gdbm.c" gdbm_o="gdbm.o" - gdbm_rule="gdbm.o: \$(H) gdbm.c" + gdbm_so="gdbm.so" else gdbm_incl= fi @@ -54,11 +54,21 @@ O= bitstring.o\\ regexp.o\\ struct.o $gdbm_o +SO= bitstring.so\\ + debug.so\\ + elk-eval.so\\ + hack.so\\ + monitor.so\\ + newhandler.so\\ + record.so\\ + regexp.so\\ + struct.so $gdbm_so + .c.o: \$(CC) \$(CFLAGS) -I\$(INC) $gdbm_incl -c \$< ../../scripts/makedl \$@ \$@ -all: \$(O) +all: \$(SO) bitstring.o: \$(H) bitstring.c debug.o: \$(H) debug.c @@ -69,9 +79,39 @@ newhandler.o: \$(H) newhandler.c record.o: \$(H) record.c regexp.o: \$(H) regexp.c struct.o: \$(H) struct.c -$gdbm_rule +gdbm.o: \$(H) gdbm.c -install: \$(O) +bitstring.so: bitstring.o + ld -shared -o \$@ \$< -lc + +debug.so: debug.o + ld -shared -o \$@ \$< -lc + +elk-eval.so: elk-eval.o + ld -shared -o \$@ \$< -lc + +hack.so: hack.o + ld -shared -o \$@ \$< -lc + +monitor.so: monitor.o + ld -shared -o \$@ \$< -lc + +newhandler.so: newhandler.o + ld -shared -o \$@ \$< -lc + +record.so: record.o + ld -shared -o \$@ \$< -lc + +regexp.so: regexp.o + ld -shared -o \$@ \$< -lc + +struct.so: struct.o + ld -shared -o \$@ \$< -lc + +gdbm.so: gdbm.o + ld -shared -o \$@ \$< -lgdbm -lc + +install: \$(SO) -@if [ ! -d $install_dir/lib ]; then \\ echo mkdir $install_dir/lib; \\ mkdir $install_dir/lib; \\ @@ -80,22 +120,18 @@ install: \$(O) echo mkdir $install_dir/lib/elk; \\ mkdir $install_dir/lib/elk; \\ fi - -@if [ ! -d $install_dir/lib/elk/obj ]; then \\ - echo mkdir $install_dir/lib/elk/obj; \\ - mkdir $install_dir/lib/elk/obj; \\ - fi - @for i in \$(O) ;\\ + @for i in \$(SO) ;\\ do \\ - echo cp \$\$i $install_dir/lib/elk/obj; \\ - cp \$\$i $install_dir/lib/elk/obj; \\ + echo cp \$\$i $install_dir/lib/elk; \\ + cp \$\$i $install_dir/lib/elk; \\ done lint: lint \$(LINTFLAGS) -I\$(INC) $gdbm_incl \$(C) clean: - rm -f *.o core + rm -f *.so *.o core distclean: - rm -f *.o core lint.out Makefile.local + rm -f *.so *.o core lint.out Makefile.local EOT diff --git a/lib/misc/elk-eval.c b/lib/misc/elk-eval.c index 33772d2..3665803 100644 --- a/lib/misc/elk-eval.c +++ b/lib/misc/elk-eval.c @@ -1,12 +1,12 @@ /* The function - * + * * char *Elk_Eval(char *expr); - * + * * is similar to Tcl_Eval() in Tcl. It is called with a Scheme expression * encoded as a C string and returns the result of evaluating the expression * (as another C string), or a null pointer if an error has occured * during evaluation. - * + * * Elk_Eval() stores its result in a static buffer of fixed size; this * can be improved easily by passing a buffer and a length as additional * arguments. diff --git a/lib/misc/gdbm.c b/lib/misc/gdbm.c index 13c4b80..d8c125d 100644 --- a/lib/misc/gdbm.c +++ b/lib/misc/gdbm.c @@ -220,7 +220,7 @@ Object P_Gdbm_Firstkey (fh) Object fh; { Disable_Interrupts; k = gdbm_firstkey (GDBM_FH(fh)->fptr); Enable_Interrupts; - if (k.dptr == 0) + if (k.dptr == 0) return False; res = Make_String (k.dptr, k.dsize); free (k.dptr); @@ -258,5 +258,6 @@ elk_init_lib_gdbm () { T_Gdbm_fh = Define_Type (0, "gdbm-file", NOFUNC, sizeof (struct S_gdbm_fh), Gdbm_fh_Equal, Gdbm_fh_Equal, Gdbm_fh_Print, NOFUNC); + P_Provide (Intern ("gdbm.so")); P_Provide (Intern ("gdbm.o")); } diff --git a/lib/misc/hack.c b/lib/misc/hack.c index 4d761eb..1035ab9 100644 --- a/lib/misc/hack.c +++ b/lib/misc/hack.c @@ -10,5 +10,6 @@ static Object P_Hack_Procedure_Environment (p, e) Object p, e; { elk_init_lib_hack () { Define_Primitive (P_Hack_Procedure_Environment, "hack-procedure-environment!", 2, 2, EVAL); + P_Provide (Intern ("hack.so")); P_Provide (Intern ("hack.o")); } diff --git a/lib/misc/record.c b/lib/misc/record.c index 2990d8d..c5230a9 100644 --- a/lib/misc/record.c +++ b/lib/misc/record.c @@ -131,5 +131,6 @@ elk_init_lib_record () { Def_Prim (P_Record_Type, "record-type-descriptor", 1, 1, EVAL); Def_Prim (P_Record_Values, "record-values", 1, 1, EVAL); Def_Prim (P_Make_Record, "make-record", 2, 2, EVAL); + P_Provide (Intern ("record.so")); P_Provide (Intern ("record.o")); } diff --git a/lib/misc/regexp.c b/lib/misc/regexp.c index 384f05e..b89de4c 100644 --- a/lib/misc/regexp.c +++ b/lib/misc/regexp.c @@ -26,7 +26,7 @@ struct S_Match { size_t num; regmatch_t matches[1]; }; - + int T_Regexp, T_Match; static SYMDESCR Compile_Syms[] = { @@ -218,5 +218,6 @@ elk_init_lib_regexp() { Def_Prim(P_Match_End, "regexp-match-end", 2, 2, EVAL); P_Provide(Intern(":regular-expressions")); #endif + P_Provide(Intern ("regexp.so")); P_Provide(Intern ("regexp.o")); } diff --git a/lib/misc/struct.c b/lib/misc/struct.c index 22a6a87..7b52753 100644 --- a/lib/misc/struct.c +++ b/lib/misc/struct.c @@ -106,5 +106,6 @@ elk_init_lib_struct () { Define_Primitive (P_Structure_Ref, "structure-ref", 3, 3, EVAL); Define_Primitive (P_Structure_Set, "structure-set!", 4, 4, EVAL); Define_Primitive (P_Make_Structure, "make-structure", 2, 2, EVAL); + P_Provide (Intern ("struct.so")); P_Provide (Intern ("struct.o")); } diff --git a/lib/unix/Makefile b/lib/unix/Makefile index cd1a7d3..29e6f57 100644 --- a/lib/unix/Makefile +++ b/lib/unix/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../../config/system ../../config/site +Makefile.local: build ../../config/system ../../config/site $(SHELL) ./build default: Makefile.local diff --git a/lib/unix/build b/lib/unix/build index 637b2bd..e4af293 100755 --- a/lib/unix/build +++ b/lib/unix/build @@ -55,7 +55,7 @@ O= error.o\\ unix.o\\ wait.o -all: \$(O) unix.pre +all: \$(O) unix.so .c.o: \$(CC) \$(CFLAGS) -I\$(INC) -c \$< @@ -77,7 +77,10 @@ wait.o: \$(H) wait.c unix.pre: \$(O) ../../scripts/makedl \$@ \$(O) -install: unix.pre +unix.so: \$(O) + ld -shared -o \$@ \$(O) -lc + +install: unix.so -@if [ ! -d $install_dir/lib ]; then \\ echo mkdir $install_dir/lib; \\ mkdir $install_dir/lib; \\ @@ -86,11 +89,7 @@ install: unix.pre echo mkdir $install_dir/lib/elk; \\ mkdir $install_dir/lib/elk; \\ fi - -@if [ ! -d $install_dir/lib/elk/obj ]; then \\ - echo mkdir $install_dir/lib/elk/obj; \\ - mkdir $install_dir/lib/elk/obj; \\ - fi - cp unix.pre $install_dir/lib/elk/obj/unix.o + cp unix.so $install_dir/lib/elk -@if [ ! -d $install_dir/include ]; then \\ echo mkdir $install_dir/include; \\ mkdir $install_dir/include; \\ @@ -109,8 +108,8 @@ lint: lint \$(LINTFLAGS) -I\$(INC) \$(C) clean: - rm -f *.o unix.pre core + rm -f *.so *.o unix.pre core distclean: - rm -f *.o unix.pre core lint.out Makefile.local + rm -f *.so *.o unix.pre core lint.out Makefile.local EOT diff --git a/lib/unix/file.c b/lib/unix/file.c index ab811fb..b300b68 100644 --- a/lib/unix/file.c +++ b/lib/unix/file.c @@ -83,7 +83,7 @@ static Object P_Read_Directory(fn) Object fn; { } while ((dp = readdir(d)) != NULL) { Object x; - + x = Make_String(dp->d_name, strlen(dp->d_name)); ret = Cons(x, ret); } diff --git a/lib/unix/passwd.c b/lib/unix/passwd.c index 2e9374c..a490a5b 100644 --- a/lib/unix/passwd.c +++ b/lib/unix/passwd.c @@ -125,7 +125,7 @@ static Object P_End_Group() { Enable_Interrupts; return Void; } - + elk_init_unix_passwd() { Def_Prim(P_Get_Passwd, "unix-get-passwd-vector-fill!", 1, 2, VARARGS); Def_Prim(P_Rewind_Passwd, "unix-rewind-passwd", 0, 0, EVAL); diff --git a/lib/unix/process.c b/lib/unix/process.c index 31ab39f..9472439 100644 --- a/lib/unix/process.c +++ b/lib/unix/process.c @@ -118,7 +118,7 @@ static Object P_Getenv(e) Object e; { static Object P_Getlogin() { extern char *getlogin(); char *s; - + Disable_Interrupts; s = getlogin(); Enable_Interrupts; diff --git a/lib/unix/unix.c b/lib/unix/unix.c index 5e2a9f4..9d1cdd5 100644 --- a/lib/unix/unix.c +++ b/lib/unix/unix.c @@ -34,5 +34,6 @@ void Check_Result_Vector(x, len) Object x; { } elk_init_unix_unix() { + P_Provide(Intern("unix.so")); P_Provide(Intern("unix.o")); } diff --git a/lib/xaw/Makefile b/lib/xaw/Makefile index cd1a7d3..29e6f57 100644 --- a/lib/xaw/Makefile +++ b/lib/xaw/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../../config/system ../../config/site +Makefile.local: build ../../config/system ../../config/site $(SHELL) ./build default: Makefile.local diff --git a/lib/xaw/build b/lib/xaw/build index 6a7b49a..acd7f4a 100755 --- a/lib/xaw/build +++ b/lib/xaw/build @@ -53,6 +53,30 @@ O= ascii.o\\ tree.o\\ viewport.o +SO= ascii.so\\ + box.so\\ + command.so\\ + dialog.so\\ + form.so\\ + grip.so\\ + label.so\\ + list.so\\ + menubutton.so\\ + paned.so\\ + panner.so\\ + porthole.so\\ + repeater.so\\ + scrollbar.so\\ + shell.so\\ + simplemenu.so\\ + sme.so\\ + smebsb.so\\ + smeline.so\\ + stripchart.so\\ + toggle.so\\ + tree.so\\ + viewport.so + WIDGET_SET= xaw .SUFFIXES: .d .c .o @@ -69,7 +93,7 @@ WIDGET_SET= xaw \$(CC) \$(CFLAGS) -I\$(INC) -I../xlib $x11_incl -c \$*.c ../../scripts/makedl \$@ \$@ -all: \$(O) +all: \$(SO) ascii.o: \$(H) ascii.d box.o: \$(H) box.d @@ -95,7 +119,77 @@ toggle.o: \$(H) toggle.d tree.o: \$(H) tree.d viewport.o: \$(H) viewport.d -install: \$(O) +ascii.so: ascii.o + ld -shared -o \$@ \$< $libxaw -lc + +box.so: box.o + ld -shared -o \$@ \$< $libxaw -lc + +command.so: command.o + ld -shared -o \$@ \$< $libxaw -lc + +dialog.so: dialog.o + ld -shared -o \$@ \$< $libxaw -lc + +form.so: form.o + ld -shared -o \$@ \$< $libxaw -lc + +grip.so: grip.o + ld -shared -o \$@ \$< $libxaw -lc + +label.so: label.o + ld -shared -o \$@ \$< $libxaw -lc + +list.so: list.o + ld -shared -o \$@ \$< $libxaw -lc + +menubutton.so: menubutton.o + ld -shared -o \$@ \$< $libxaw -lc + +paned.so: paned.o + ld -shared -o \$@ \$< $libxaw -lc + +panner.so: panner.o + ld -shared -o \$@ \$< $libxaw -lc + +porthole.so: porthole.o + ld -shared -o \$@ \$< $libxaw -lc + +repeater.so: repeater.o + ld -shared -o \$@ \$< $libxaw -lc + +scrollbar.so: scrollbar.o + ld -shared -o \$@ \$< $libxaw -lc + +shell.so: shell.o + ld -shared -o \$@ \$< $libxaw -lc + +simplemenu.so: simplemenu.o + ld -shared -o \$@ \$< $libxaw -lc + +sme.so: sme.o + ld -shared -o \$@ \$< $libxaw -lc + +smebsb.so: smebsb.o + ld -shared -o \$@ \$< $libxaw -lc + +smeline.so: smeline.o + ld -shared -o \$@ \$< $libxaw -lc + +stripchart.so: stripchart.o + ld -shared -o \$@ \$< $libxaw -lc + +toggle.so: toggle.o + ld -shared -o \$@ \$< $libxaw -lc + +tree.so: tree.o + ld -shared -o \$@ \$< $libxaw -lc + +viewport.so: viewport.o + ld -shared -o \$@ \$< $libxaw -lc + + +install: \$(SO) -@if [ ! -d $install_dir/lib ]; then \\ echo mkdir $install_dir/lib; \\ mkdir $install_dir/lib; \\ @@ -104,26 +198,22 @@ install: \$(O) echo mkdir $install_dir/lib/elk; \\ mkdir $install_dir/lib/elk; \\ fi - -@if [ ! -d $install_dir/lib/elk/obj ]; then \\ - echo mkdir $install_dir/lib/elk/obj; \\ - mkdir $install_dir/lib/elk/obj; \\ + -@if [ ! -d $install_dir/lib/elk/xaw ]; then \\ + echo mkdir $install_dir/lib/elk/xaw; \\ + mkdir $install_dir/lib/elk/xaw; \\ fi - -@if [ ! -d $install_dir/lib/elk/obj/xaw ]; then \\ - echo mkdir $install_dir/lib/elk/obj/xaw; \\ - mkdir $install_dir/lib/elk/obj/xaw; \\ - fi - @for i in \$(O) ALIASES ;\\ + @for i in \$(SO) ALIASES ;\\ do \\ - echo cp \$\$i $install_dir/lib/elk/obj/xaw; \\ - cp \$\$i $install_dir/lib/elk/obj/xaw; \\ + echo cp \$\$i $install_dir/lib/elk/xaw; \\ + cp \$\$i $install_dir/lib/elk/xaw; \\ done lint: lint \$(LINTFLAGS) -I\$(INC) -I../xlib $x11_incl *.c clean: - rm -f *.o *.c core + rm -f *.so *.o *.c core distclean: - rm -f *.o *.c core lint.out Makefile.local + rm -f *.so *.o *.c core lint.out Makefile.local EOT diff --git a/lib/xlib/Makefile b/lib/xlib/Makefile index cd1a7d3..29e6f57 100644 --- a/lib/xlib/Makefile +++ b/lib/xlib/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../../config/system ../../config/site +Makefile.local: build ../../config/system ../../config/site $(SHELL) ./build default: Makefile.local diff --git a/lib/xlib/build b/lib/xlib/build index d850c20..00ea073 100755 --- a/lib/xlib/build +++ b/lib/xlib/build @@ -75,7 +75,7 @@ O= client.o\\ window.o\\ wm.o -all: \$(O) xlib.pre +all: \$(O) xlib.so .c.o: \$(CC) \$(CFLAGS) -I\$(INC) $x11_incl -c \$< @@ -107,7 +107,10 @@ wm.o: \$(H) wm.c xlib.pre: \$(O) ../../scripts/makedl \$@ \$(O) -install: xlib.pre +xlib.so: \$(O) + ld -shared -o \$@ \$(O) $libxlib -lc + +install: xlib.so -@if [ ! -d $install_dir/lib ]; then \\ echo mkdir $install_dir/lib; \\ mkdir $install_dir/lib; \\ @@ -116,11 +119,7 @@ install: xlib.pre echo mkdir $install_dir/lib/elk; \\ mkdir $install_dir/lib/elk; \\ fi - -@if [ ! -d $install_dir/lib/elk/obj ]; then \\ - echo mkdir $install_dir/lib/elk/obj; \\ - mkdir $install_dir/lib/elk/obj; \\ - fi - cp xlib.pre $install_dir/lib/elk/obj/xlib.o + cp xlib.so $install_dir/lib/elk -@if [ ! -d $install_dir/include ]; then \\ echo mkdir $install_dir/include; \\ mkdir $install_dir/include; \\ @@ -139,8 +138,8 @@ lint: lint \$(LINTFLAGS) -I\$(INC) $x11_incl \$(C) clean: - rm -f *.o xlib.pre core + rm -f *.so *.o xlib.pre core distclean: - rm -f *.o xlib.pre core lint.out Makefile.local + rm -f *.so *.o xlib.pre core lint.out Makefile.local EOT diff --git a/lib/xlib/client.c b/lib/xlib/client.c index e110b14..0d58c57 100644 --- a/lib/xlib/client.c +++ b/lib/xlib/client.c @@ -130,7 +130,7 @@ static Object P_Wm_Protocols (w) Object w; { GC_Link (ret); for (i = 0; i < n; i++) { Object a; - + a = Make_Atom (p[i]); VECTOR(ret)->data[i] = a; } @@ -291,7 +291,7 @@ static Object P_Icon_Sizes (w) Object w; { int i, n; Object v; GC_Node; - + Check_Type (w, T_Window); Disable_Interrupts; if (!XGetIconSizes (WINDOW(w)->dpy, WINDOW(w)->win, &p, &n)) @@ -368,7 +368,7 @@ elk_init_xlib_client () { Define_Symbol (&Sym_Size_Hints, "size-hints"); Define_Primitive (P_Iconify_Window, "iconify-window", 2, 2, EVAL); Define_Primitive (P_Withdraw_Window, "withdraw-window", 2, 2, EVAL); - Define_Primitive (P_Reconfigure_Wm_Window, + Define_Primitive (P_Reconfigure_Wm_Window, "xlib-reconfigure-wm-window", 3, 3, EVAL); Define_Primitive (P_Wm_Command, "wm-command", 1, 1, EVAL); Define_Primitive (P_Get_Text_Property,"get-text-property", 2, 2, EVAL); @@ -381,7 +381,7 @@ elk_init_xlib_client () { Define_Primitive (P_Wm_Hints, "xlib-wm-hints", 1, 1, EVAL); Define_Primitive (P_Set_Wm_Hints, "xlib-set-wm-hints!",2, 2, EVAL); Define_Primitive (P_Size_Hints, "xlib-wm-size-hints",2, 2, EVAL); - Define_Primitive (P_Set_Size_Hints, + Define_Primitive (P_Set_Size_Hints, "xlib-set-wm-size-hints!", 3, 3, EVAL); Define_Primitive (P_Icon_Sizes, "icon-sizes", 1, 1, EVAL); Define_Primitive (P_Set_Icon_Sizes, "set-icon-sizes!", 2, 2, EVAL); diff --git a/lib/xlib/color.c b/lib/xlib/color.c index 634aaa5..3a81003 100644 --- a/lib/xlib/color.c +++ b/lib/xlib/color.c @@ -91,7 +91,7 @@ static Object P_Query_Colors (cmap, v) Object cmap, v; { GC_Link (ret); for (i = 0; i < n; i++, p++) { Object x; - + x = Make_Color (p->red, p->green, p->blue); VECTOR(ret)->data[i] = x; } diff --git a/lib/xlib/colormap.c b/lib/xlib/colormap.c index c1b75da..d2bbd8d 100644 --- a/lib/xlib/colormap.c +++ b/lib/xlib/colormap.c @@ -44,7 +44,7 @@ static Object P_Alloc_Color (cmap, color) Object cmap, color; { XColor c; Colormap cm = Get_Colormap (cmap); int r; - + c = *Get_Color (color); Disable_Interrupts; r = XAllocColor (COLORMAP(cmap)->dpy, cm, &c); diff --git a/lib/xlib/display.c b/lib/xlib/display.c index 885a3a6..6eb3530 100644 --- a/lib/xlib/display.c +++ b/lib/xlib/display.c @@ -108,7 +108,7 @@ static Object P_Display_Cells (d, scr) Object d, scr; { static Object P_Display_Planes (d, scr) Object d, scr; { Check_Type (d, T_Display); - return Make_Integer (DisplayPlanes (DISPLAY(d)->dpy, + return Make_Integer (DisplayPlanes (DISPLAY(d)->dpy, Get_Screen_Number (DISPLAY(d)->dpy, scr))); } @@ -246,7 +246,7 @@ static Object P_List_Pixmap_Formats (d) Object d; { GC_Link (ret); for (i = 0; i < num; i++) { Object t; - + t = P_Make_List (Make_Integer (3), Null); VECTOR(ret)->data[i] = t; Car (t) = Make_Integer (p[i].depth); t = Cdr (t); diff --git a/lib/xlib/error.c b/lib/xlib/error.c index 4bc4084..c445a31 100644 --- a/lib/xlib/error.c +++ b/lib/xlib/error.c @@ -3,7 +3,7 @@ static Object V_X_Error_Handler, V_X_Fatal_Error_Handler; /* Default error handlers of the Xlib */ -extern int _XDefaultIOError(); +extern int _XDefaultIOError(); extern int _XDefaultError(); static X_Fatal_Error (d) Display *d; { @@ -81,7 +81,7 @@ static Object P_After_Function (d) Object d; { Check_Type (d, T_Display); return DISPLAY(d)->after; } - + elk_init_xlib_error () { Define_Variable (&V_X_Fatal_Error_Handler, "x-fatal-error-handler", Null); Define_Variable (&V_X_Error_Handler, "x-error-handler", Null); diff --git a/lib/xlib/event.c b/lib/xlib/event.c index 4aa721b..ddea621 100644 --- a/lib/xlib/event.c +++ b/lib/xlib/event.c @@ -8,7 +8,7 @@ static struct event_desc { char *name; int argc; } Event_Table[] = { - { "event-0", 1 }, + { "event-0", 1 }, { "event-1", 1 }, { "key-press", 12 }, { "key-release", 12 }, diff --git a/lib/xlib/extension.c b/lib/xlib/extension.c index 1013a44..da83bf1 100644 --- a/lib/xlib/extension.c +++ b/lib/xlib/extension.c @@ -15,7 +15,7 @@ static Object P_List_Extensions (d) Object d; { GC_Link (ret); for (i = 0; i < n; i++) { Object e; - + e = Make_String (p[i], strlen (p[i])); VECTOR(ret)->data[i] = e; } diff --git a/lib/xlib/font.c b/lib/xlib/font.c index f28d4f3..4eee077 100644 --- a/lib/xlib/font.c +++ b/lib/xlib/font.c @@ -248,7 +248,7 @@ static Object P_Font_Path (d) Object d; { GC_Link (v); for (i = 0; i < n; i++) { Object x; - + x = Make_String (ret[i], strlen (ret[i])); VECTOR(v)->data[i] = x; } diff --git a/lib/xlib/gcontext.c b/lib/xlib/gcontext.c index e1ffbc5..8642999 100644 --- a/lib/xlib/gcontext.c +++ b/lib/xlib/gcontext.c @@ -91,7 +91,7 @@ static Object P_Set_Gcontext_Clip_Rectangles (gc, x, y, v, ord) Alloca (p, XRectangle*, n * sizeof (XRectangle)); for (i = 0; i < n; i++) { Object rect; - + rect = VECTOR(v)->data[i]; Check_Type (rect, T_Pair); if (Fast_Length (rect) != 4) diff --git a/lib/xlib/grab.c b/lib/xlib/grab.c index 4d9c8cb..a46d9ea 100644 --- a/lib/xlib/grab.c +++ b/lib/xlib/grab.c @@ -103,7 +103,7 @@ static Object P_Ungrab_Key (win, key, mods) Object win, key, mods; { static Object P_Allow_Events (d, mode, time) Object d, mode, time; { Check_Type (d, T_Display); - XAllowEvents (DISPLAY(d)->dpy, Symbols_To_Bits (mode, 0, + XAllowEvents (DISPLAY(d)->dpy, Symbols_To_Bits (mode, 0, Allow_Events_Syms), Get_Time (time)); return Void; } diff --git a/lib/xlib/graphics.c b/lib/xlib/graphics.c index 648b0e0..f9aa3c6 100644 --- a/lib/xlib/graphics.c +++ b/lib/xlib/graphics.c @@ -67,7 +67,7 @@ static Object Internal_Draw_Points (d, gc, v, relative, func, shape) Alloca (p, XPoint*, n * sizeof (XPoint)); for (i = 0; i < n; i++) { Object point; - + point = VECTOR(v)->data[i]; Check_Type (point, T_Pair); p[i].x = Get_Integer (Car (point)); @@ -112,7 +112,7 @@ static Object P_Draw_Segments (d, gc, v) Object d, gc, v; { Alloca (p, XSegment*, n * sizeof (XSegment)); for (i = 0; i < n; i++) { Object seg; - + seg = VECTOR(v)->data[i]; Check_Type (seg, T_Pair); if (Fast_Length (seg) != 4) @@ -159,7 +159,7 @@ static Object Internal_Draw_Rectangles (d, gc, v, func) Alloca (p, XRectangle*, n * sizeof (XRectangle)); for (i = 0; i < n; i++) { Object rect; - + rect = VECTOR(v)->data[i]; Check_Type (rect, T_Pair); if (Fast_Length (rect) != 4) @@ -216,7 +216,7 @@ static Object Internal_Draw_Arcs (d, gc, v, func) Object d, gc, v; Alloca (p, XArc*, n * sizeof (XArc)); for (i = 0; i < n; i++) { Object arc; - + arc = VECTOR(v)->data[i]; Check_Type (arc, T_Pair); if (Fast_Length (arc) != 6) diff --git a/lib/xlib/init.c b/lib/xlib/init.c index a259842..bfe5896 100644 --- a/lib/xlib/init.c +++ b/lib/xlib/init.c @@ -27,6 +27,7 @@ elk_init_xlib_init () { "xlib-release-5-or-later?", 0, 0, EVAL); Define_Primitive (P_Xlib_Release_6_Or_Laterp, "xlib-release-6-or-later?", 0, 0, EVAL); + P_Provide (Intern ("xlib.so")); P_Provide (Intern ("xlib.o")); } diff --git a/lib/xlib/key.c b/lib/xlib/key.c index 9f269c2..cb6d45a 100644 --- a/lib/xlib/key.c +++ b/lib/xlib/key.c @@ -123,7 +123,7 @@ static Object P_Rebind_Keysym (d, k, mods, str) Object d, k, mods, str; { Alloca (p, KeySym*, n * sizeof (KeySym)); for (i = 0; i < n; i++) p[i] = (KeySym)Get_Long (VECTOR(mods)->data[i]); - XRebindKeysym (DISPLAY(d)->dpy, (KeySym)Get_Long (k), p, n, + XRebindKeysym (DISPLAY(d)->dpy, (KeySym)Get_Long (k), p, n, (unsigned char *)STRING(str)->data, STRING(str)->size); Alloca_End; return Void; diff --git a/lib/xlib/pixel.c b/lib/xlib/pixel.c index d004995..f51b04f 100644 --- a/lib/xlib/pixel.c +++ b/lib/xlib/pixel.c @@ -36,7 +36,7 @@ static Object P_Black_Pixel (d) Object d; { static Object P_White_Pixel (d) Object d; { Check_Type (d, T_Display); - return Make_Pixel (WhitePixel (DISPLAY(d)->dpy, + return Make_Pixel (WhitePixel (DISPLAY(d)->dpy, DefaultScreen (DISPLAY(d)->dpy))); } diff --git a/lib/xlib/property.c b/lib/xlib/property.c index 9bf5c47..a1292b0 100644 --- a/lib/xlib/property.c +++ b/lib/xlib/property.c @@ -64,7 +64,7 @@ static Object P_List_Properties (w) Object w; { GC_Link (v); for (i = 0; i < n; i++) { Object x; - + x = Make_Atom (ap[i]); VECTOR(v)->data[i] = x; } @@ -125,7 +125,7 @@ static Object P_Get_Property (w, prop, type, start, len, deletep) GC_Unlink; } } - t = Cdr (t); + t = Cdr (t); x = Make_Unsigned_Long (bytes_left); Car (t) = x; GC_Unlink; @@ -188,7 +188,7 @@ static Object P_Rotate_Properties (w, v, delta) Object w, v, delta; { Alloca (p, Atom*, n * sizeof (Atom)); for (i = 0; i < n; i++) { Object a; - + a = VECTOR(v)->data[i]; Check_Type (a, T_Atom); p[i] = ATOM(a)->atom; diff --git a/lib/xlib/type.c b/lib/xlib/type.c index 06d3832..9b915cf 100644 --- a/lib/xlib/type.c +++ b/lib/xlib/type.c @@ -1,6 +1,6 @@ #include "xlib.h" -static Object Set_Attr_Slots; +static Object Set_Attr_Slots; static Object Conf_Slots; static Object GC_Slots; static Object Geometry_Slots; @@ -263,7 +263,7 @@ RECORD Size_Hints_Rec[] = { { (char *)&SZH.max_aspect.y, "max-aspect-y", T_INT, 0, PAspect }, { (char *)&SZH.base_width, "base-width", T_INT, 0, PBaseSize }, { (char *)&SZH.base_height, "base-height", T_INT, 0, PBaseSize }, - { (char *)&SZH.win_gravity, "gravity", T_SYM, Grav_Syms, + { (char *)&SZH.win_gravity, "gravity", T_SYM, Grav_Syms, PWinGravity }, {0, 0, T_NONE, 0, 0 } }; diff --git a/lib/xlib/window.c b/lib/xlib/window.c index de02e8d..8c6d4be 100644 --- a/lib/xlib/window.c +++ b/lib/xlib/window.c @@ -55,7 +55,7 @@ static Object P_Create_Window (parent, x, y, width, height, border_width, attr) Object parent, x, y, width, height, border_width, attr; { unsigned long mask; Window win; - + Check_Type (parent, T_Window); mask = Vector_To_Record (attr, Set_Attr_Size, Sym_Set_Attr, Set_Attr_Rec); if ((win = XCreateWindow (WINDOW(parent)->dpy, WINDOW(parent)->win, @@ -171,7 +171,7 @@ static Object P_Query_Tree (w) Object w; { v = Make_Vector (n, Null); for (i = 0; i < n; i++) { Object x; - + x = Make_Window (0, dpy, children[i]); VECTOR(v)->data[i] = x; } diff --git a/lib/xlib/wm.c b/lib/xlib/wm.c index e26e963..26dff03 100644 --- a/lib/xlib/wm.c +++ b/lib/xlib/wm.c @@ -34,7 +34,7 @@ static Object P_List_Installed_Colormaps (w) Object w; { GC_Link (v); for (i = 0; i < n; i++) { Object c; - + c = Make_Colormap (0, WINDOW(w)->dpy, ret[i]); VECTOR(v)->data[i] = c; } diff --git a/lib/xm/Makefile b/lib/xm/Makefile index cd1a7d3..29e6f57 100644 --- a/lib/xm/Makefile +++ b/lib/xm/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../../config/system ../../config/site +Makefile.local: build ../../config/system ../../config/site $(SHELL) ./build default: Makefile.local diff --git a/lib/xm/build b/lib/xm/build index 0d21e19..2810431 100755 --- a/lib/xm/build +++ b/lib/xm/build @@ -57,6 +57,32 @@ O= arrow-button.o\\ text.o\\ toggle-btn.o +SO= arrow-button.so\\ + bulletin-brd.so\\ + cascade-btn.so\\ + command.so\\ + drawing-area.so\\ + drawn-button.so\\ + file-selectn.so\\ + form.so\\ + frame.so\\ + label.so\\ + list.so\\ + main-window.so\\ + message-box.so\\ + paned-window.so\\ + push-button.so\\ + row-column.so\\ + scale.so\\ + scroll-bar.so\\ + scrolled-win.so\\ + selectn-box.so\\ + separator.so\\ + shell.so\\ + support.so\\ + text.so\\ + toggle-btn.so + WIDGET_SET= xm .SUFFIXES: .d .c .o @@ -73,7 +99,7 @@ WIDGET_SET= xm \$(CC) \$(CFLAGS) -I\$(INC) -I../xlib $sys_incl -c \$*.c ../../scripts/makedl \$@ \$@ -all: \$(O) +all: \$(SO) arrow-button.o: \$(H) arrow-button.d bulletin-brd.o: \$(H) bulletin-brd.d @@ -101,7 +127,83 @@ support.o: \$(H) support.d text.o: \$(H) text.d toggle-btn.o: \$(H) toggle-btn.d -install: \$(O) +arrow-button.so: arrow-button.o + ld -shared -o \$@ \$< $libxmotif -lc + +bulletin-brd.so: bulletin-brd.o + ld -shared -o \$@ \$< $libxmotif -lc + +cascade-btn.so: cascade-btn.o + ld -shared -o \$@ \$< $libxmotif -lc + +command.so: command.o + ld -shared -o \$@ \$< $libxmotif -lc + +drawing-area.so: drawing-area.o + ld -shared -o \$@ \$< $libxmotif -lc + +drawn-button.so: drawn-button.o + ld -shared -o \$@ \$< $libxmotif -lc + +file-selectn.so: file-selectn.o + ld -shared -o \$@ \$< $libxmotif -lc + +form.so: form.o + ld -shared -o \$@ \$< $libxmotif -lc + +frame.so: frame.o + ld -shared -o \$@ \$< $libxmotif -lc + +label.so: label.o + ld -shared -o \$@ \$< $libxmotif -lc + +list.so: list.o + ld -shared -o \$@ \$< $libxmotif -lc + +main-window.so: main-window.o + ld -shared -o \$@ \$< $libxmotif -lc + +message-box.so: message-box.o + ld -shared -o \$@ \$< $libxmotif -lc + +paned-window.so: paned-window.o + ld -shared -o \$@ \$< $libxmotif -lc + +push-button.so: push-button.o + ld -shared -o \$@ \$< $libxmotif -lc + +row-column.so: row-column.o + ld -shared -o \$@ \$< $libxmotif -lc + +scale.so: scale.o + ld -shared -o \$@ \$< $libxmotif -lc + +scroll-bar.so: scroll-bar.o + ld -shared -o \$@ \$< $libxmotif -lc + +scrolled-win.so: scrolled-win.o + ld -shared -o \$@ \$< $libxmotif -lc + +selectn-box.so: selectn-box.o + ld -shared -o \$@ \$< $libxmotif -lc + +separator.so: separator.o + ld -shared -o \$@ \$< $libxmotif -lc + +shell.so: shell.o + ld -shared -o \$@ \$< $libxmotif -lc + +support.so: support.o + ld -shared -o \$@ \$< $libxmotif -lc + +text.so: text.o + ld -shared -o \$@ \$< $libxmotif -lc + +toggle-btn.so: toggle-btn.o + ld -shared -o \$@ \$< $libxmotif -lc + + +install: \$(SO) -@if [ ! -d $install_dir/lib ]; then \\ echo mkdir $install_dir/lib; \\ mkdir $install_dir/lib; \\ @@ -110,26 +212,22 @@ install: \$(O) echo mkdir $install_dir/lib/elk; \\ mkdir $install_dir/lib/elk; \\ fi - -@if [ ! -d $install_dir/lib/elk/obj ]; then \\ - echo mkdir $install_dir/lib/elk/obj; \\ - mkdir $install_dir/lib/elk/obj; \\ + -@if [ ! -d $install_dir/lib/elk/xm ]; then \\ + echo mkdir $install_dir/lib/elk/xm; \\ + mkdir $install_dir/lib/elk/xm; \\ fi - -@if [ ! -d $install_dir/lib/elk/obj/xm ]; then \\ - echo mkdir $install_dir/lib/elk/obj/xm; \\ - mkdir $install_dir/lib/elk/obj/xm; \\ - fi - @for i in \$(O) ALIASES ;\\ + @for i in \$(SO) ALIASES ;\\ do \\ - echo cp \$\$i $install_dir/lib/elk/obj/xm; \\ - cp \$\$i $install_dir/lib/elk/obj/xm; \\ + echo cp \$\$i $install_dir/lib/elk/xm; \\ + cp \$\$i $install_dir/lib/elk/xm; \\ done lint: lint \$(LINTFLAGS) -I\$(INC) -I../xlib $sys_incl *.c clean: - rm -f *.o *.c core + rm -f *.so *.o *.c core distclean: - rm -f *.o *.c core lint.out Makefile.local + rm -f *.so *.o *.c core lint.out Makefile.local EOT diff --git a/lib/xm/xt/Makefile b/lib/xm/xt/Makefile index b844913..efefd86 100644 --- a/lib/xm/xt/Makefile +++ b/lib/xm/xt/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../../../config/system ../../../config/site +Makefile.local: build ../../../config/system ../../../config/site $(SHELL) ./build default: Makefile.local diff --git a/lib/xm/xt/build b/lib/xm/xt/build index 4946bf0..21a4046 100755 --- a/lib/xm/xt/build +++ b/lib/xm/xt/build @@ -1,6 +1,10 @@ . ../../../config/system . ../../../config/site +if [ _$load_obj = _ld -o _$load_obj = _dl ]; then + force_load_xm="-u ${syms_begin_with}XmIsMotifWMRunning" +fi + # In HP-UX, the Motif libraries must be linked with xt-motif.o instead # of placing them into the load-libraries (I don't know why): @@ -45,10 +49,13 @@ O= \$(XTDIR)/accelerator.o\\ @echo === Must make files in \$(XTDIR) first\! === @echo "" +xt-motif.so: \$(O) ../../xlib/xlib.so + ld -shared -o \$@ \$(O) ../../xlib/*.o $force_load_xm $libxmotif -lc + xt-motif.pre: \$(O) ../../xlib/xlib.pre ../../../scripts/makedl \$@ \$(O) ../../xlib/*.o $motif_link_libs -install: xt-motif.pre +install: xt-motif.so -@if [ ! -d $install_dir/lib ]; then \\ echo mkdir $install_dir/lib; \\ mkdir $install_dir/lib; \\ @@ -57,17 +64,13 @@ install: xt-motif.pre echo mkdir $install_dir/lib/elk; \\ mkdir $install_dir/lib/elk; \\ fi - -@if [ ! -d $install_dir/lib/elk/obj ]; then \\ - echo mkdir $install_dir/lib/elk/obj; \\ - mkdir $install_dir/lib/elk/obj; \\ - fi - cp xt-motif.pre $install_dir/lib/elk/obj/xt-motif.o + cp xt-motif.so $install_dir/lib/elk lint: clean: - rm -f *.o xt-motif.pre core + rm -f *.so *.o xt-motif.pre core distclean: - rm -f *.o xt-motif.pre core Makefile.local + rm -f *.so *.o xt-motif.pre core Makefile.local EOT diff --git a/lib/xt/Makefile b/lib/xt/Makefile index cd1a7d3..29e6f57 100644 --- a/lib/xt/Makefile +++ b/lib/xt/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../../config/system ../../config/site +Makefile.local: build ../../config/system ../../config/site $(SHELL) ./build default: Makefile.local diff --git a/lib/xt/accelerator.c b/lib/xt/accelerator.c index 3af2294..750750c 100644 --- a/lib/xt/accelerator.c +++ b/lib/xt/accelerator.c @@ -18,7 +18,7 @@ static Object P_Install_Accelerators (dst, src) Object dst, src; { XtInstallAccelerators (WIDGET(dst)->widget, WIDGET(src)->widget); return Void; } - + static Object P_Install_All_Accelerators (dst, src) Object dst, src; { Check_Widget (dst); Check_Widget (src); diff --git a/lib/xt/action.c b/lib/xt/action.c index 2f363d5..fe059c7 100644 --- a/lib/xt/action.c +++ b/lib/xt/action.c @@ -30,7 +30,7 @@ void Action_Hook (w, client_data, name, ep, argv, argc) params = P_Make_List (Make_Integer (*argc), Null); for (i = 0, tail = params; i < *argc; tail = Cdr (tail), i++) { Object tmp; - + tmp = Make_String (argv[i], strlen (argv[i])); Car (tail) = tmp; } diff --git a/lib/xt/build b/lib/xt/build index 384b4f8..109a737 100755 --- a/lib/xt/build +++ b/lib/xt/build @@ -62,7 +62,7 @@ O= accelerator.o\\ translation.o\\ widget.o -all: \$(O) xt.pre +all: \$(O) xt.so .c.o: \$(CC) \$(CFLAGS) -I\$(INC) -I../xlib $x11_incl -c \$< @@ -87,7 +87,10 @@ widget.o: \$(H) widget.c xt.pre: \$(O) ../xlib/xlib.pre ../../scripts/makedl \$@ \$(O) ../xlib/*.o -install: xt.pre +xt.so: \$(O) ../xlib/xlib.so + ld -shared -o \$@ \$(O) ../xlib/*.o $libxt -lc + +install: xt.so -@if [ ! -d $install_dir/lib ]; then \\ echo mkdir $install_dir/lib; \\ mkdir $install_dir/lib; \\ @@ -96,11 +99,7 @@ install: xt.pre echo mkdir $install_dir/lib/elk; \\ mkdir $install_dir/lib/elk; \\ fi - -@if [ ! -d $install_dir/lib/elk/obj ]; then \\ - echo mkdir $install_dir/lib/elk/obj; \\ - mkdir $install_dir/lib/elk/obj; \\ - fi - cp xt.pre $install_dir/lib/elk/obj/xt.o + cp xt.so $install_dir/lib/elk -@if [ ! -d $install_dir/include ]; then \\ echo mkdir $install_dir/include; \\ mkdir $install_dir/include; \\ @@ -119,8 +118,8 @@ lint: lint \$(LINTFLAGS) -I\$(INC) -I../xlib $x11_incl \$(C) clean: - rm -f *.o xt.pre core + rm -f *.so *.o xt.pre core distclean: - rm -f *.o xt.pre core lint.out Makefile.local + rm -f *.so *.o xt.pre core lint.out Makefile.local EOT diff --git a/lib/xt/callback.c b/lib/xt/callback.c index 63ccdcf..23d247d 100644 --- a/lib/xt/callback.c +++ b/lib/xt/callback.c @@ -15,7 +15,7 @@ static void Callback_Proc (w, client_data, call_data) Widget w; register CLIENT_DATA *cd = (CLIENT_DATA *)client_data; Object args; GC_Node; - + args = Null; GC_Link (args); if (cd->converter) diff --git a/lib/xt/class.c b/lib/xt/class.c index c696087..a7dd4aa 100644 --- a/lib/xt/class.c +++ b/lib/xt/class.c @@ -195,7 +195,7 @@ elk_init_xt_class () { Generic_Define (Class, "class", "class?"); Define_Primitive (P_Find_Class, "find-class", 1, 1, EVAL); Define_Primitive (P_Class_Resources, "class-resources", 1, 1, EVAL); - Define_Primitive (P_Class_Constraint_Resources, + Define_Primitive (P_Class_Constraint_Resources, "class-constraint-resources", 1, 1, EVAL); Define_Primitive (P_Class_Sub_Resources, "class-sub-resources", 1, 1, EVAL); diff --git a/lib/xt/context.c b/lib/xt/context.c index 6990ff4..0d4c537 100644 --- a/lib/xt/context.c +++ b/lib/xt/context.c @@ -115,7 +115,7 @@ static Object P_Set_Context_Fallback_Resources (argc, argv) Object *argv; { register i; struct S_String *sp; Object con; - + con = argv[0]; Check_Context (con); if (argc > 1) { @@ -158,7 +158,7 @@ static Object P_Context_Process_Event (argc, argv) Object *argv; { static Boolean Work_Proc (client_data) XtPointer client_data; { Object ret; - + ret = Funcall (Get_Function ((int)client_data), Null, 0); if (Truep (ret)) Deregister_Function ((int)client_data); diff --git a/lib/xt/init.c b/lib/xt/init.c index 42e6ba7..7997294 100644 --- a/lib/xt/init.c +++ b/lib/xt/init.c @@ -43,5 +43,6 @@ elk_init_xt_init () { Define_Primitive (P_Xt_Release_6_Or_Laterp, "xt-release-6-or-later?", 0, 0, EVAL); XtToolkitInitialize (); + P_Provide (Intern ("xt.so")); P_Provide (Intern ("xt.o")); } diff --git a/lib/xt/resource.c b/lib/xt/resource.c index bbf0992..6e0e448 100644 --- a/lib/xt/resource.c +++ b/lib/xt/resource.c @@ -237,7 +237,7 @@ void Convert_Args (ac, av, to, widget, class) Object *av; ArgList to; } else if (dt == T_Window) { XtSetArg (to[i], res, WINDOW(val)->win); } else Panic ("bad conversion type"); - } + } done: ; } Alloca_End; @@ -413,7 +413,7 @@ Object Get_Resources (c, fun, freeit) WidgetClass c; void (*fun)(); { int nr; Object ret, tail, tail2, x; GC_Node3; - + fun (c, &r, &nr); /* Note: * `r' is not freed in case of error. diff --git a/lib/xt/translation.c b/lib/xt/translation.c index fb44d15..52bbd95 100644 --- a/lib/xt/translation.c +++ b/lib/xt/translation.c @@ -17,7 +17,7 @@ static Object P_Augment_Translations (w, t) Object w, t; { XtAugmentTranslations (WIDGET(w)->widget, Get_Translations (t)); return Void; } - + static Object P_Override_Translations (w, t) Object w, t; { Check_Widget (w); XtOverrideTranslations (WIDGET(w)->widget, Get_Translations (t)); @@ -47,7 +47,7 @@ static Object P_Set_Multi_Click_Time (d, t) Object d, t; { elk_init_xt_translation () { Define_Primitive (P_Augment_Translations, "augment-translations", 2, 2, EVAL); - Define_Primitive (P_Override_Translations, + Define_Primitive (P_Override_Translations, "override-translations", 2, 2, EVAL); Define_Primitive (P_Uninstall_Translations, "uninstall-translations", 1, 1, EVAL); diff --git a/lib/xt/widget.c b/lib/xt/widget.c index 26e68b8..7e1d561 100644 --- a/lib/xt/widget.c +++ b/lib/xt/widget.c @@ -81,7 +81,7 @@ static Object P_Create_Widget (argc, argv) Object *argv; { char *name = 0; Object x, class, parent, ret; Alloca_Begin; - + x = argv[0]; if (TYPE(x) != T_Class) { name = Get_Strsym (x); @@ -158,7 +158,7 @@ static Object Manage_Unmanage (children, f) Object children; void (*f)(); { Alloca (buf, Widget*, n * sizeof (Widget)); for (i = 0, tail = children; i < n; i++, tail = Cdr (tail)) { Object w; - + w = Car (tail); Check_Widget (w); buf[i] = WIDGET(w)->widget; diff --git a/scm/Makefile b/scm/Makefile index cdc57f0..06d3a14 100644 --- a/scm/Makefile +++ b/scm/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../config/system ../config/site +Makefile.local: build ../config/system ../config/site $(SHELL) ./build default: Makefile.local diff --git a/scm/bitstring.scm b/scm/bitstring.scm index 8d112fb..5dc8b39 100644 --- a/scm/bitstring.scm +++ b/scm/bitstring.scm @@ -2,7 +2,7 @@ ;;; ;;; The Scheme layer of the bitstring extension. -(require 'bitstring.o) +(require 'bitstring.so) (define (bitstring-copy b) (let ((new (make-bitstring (bitstring-length b) #f))) diff --git a/scm/build b/scm/build index 73ed248..e695a3b 100755 --- a/scm/build +++ b/scm/build @@ -51,14 +51,10 @@ install: \$(TARGETS) echo mkdir $install_dir/share/elk; \\ mkdir $install_dir/share/elk; \\ fi - -@if [ ! -d $install_dir/share/elk/scm ]; then \\ - echo mkdir $install_dir/share/elk/scm; \\ - mkdir $install_dir/share/elk/scm; \\ - fi @for i in \$(FILES) ;\\ do \\ - echo cp \$\$i $install_dir/share/elk/scm; \\ - cp \$\$i $install_dir/share/elk/scm; \\ + echo cp \$\$i $install_dir/share/elk; \\ + cp \$\$i $install_dir/share/elk; \\ done lint: diff --git a/scm/gdbmtest.scm b/scm/gdbmtest.scm index 128a4d6..cf696fb 100644 --- a/scm/gdbmtest.scm +++ b/scm/gdbmtest.scm @@ -4,7 +4,7 @@ ;;; Contributed by Martin Stut. -(require 'gdbm.o) +(require 'gdbm.so) (let ((gf (gdbm-open 'test.gdbm 1024 'create)) (last "nothing")) (if (not gf) diff --git a/scm/oops.scm b/scm/oops.scm index 47e6634..d362ab0 100644 --- a/scm/oops.scm +++ b/scm/oops.scm @@ -2,7 +2,7 @@ ;;; ;;; A simple `OOPS' package -(require 'hack.o) +(require 'hack.so) (provide 'oops) diff --git a/scm/record.scm b/scm/record.scm index a09f15a..5ce0208 100644 --- a/scm/record.scm +++ b/scm/record.scm @@ -2,7 +2,7 @@ ;;; ;;; The Scheme layer of the record extension. -(require 'record.o) +(require 'record.so) (define (record-field-index name fields) (let loop ((fields fields) (index 0)) diff --git a/scm/regexp.scm b/scm/regexp.scm index 042122d..a172158 100644 --- a/scm/regexp.scm +++ b/scm/regexp.scm @@ -3,7 +3,7 @@ ;;; The Scheme layer of the regexp extension is (almost) empty for now. ;;; It mainly exists to enable use of "(require 'regexp)". -(require 'regexp.o) +(require 'regexp.so) (define (describe-regexp r) (format #t "a regular expression.~%") diff --git a/scm/struct.scm b/scm/struct.scm index fe1a28d..66277c4 100644 --- a/scm/struct.scm +++ b/scm/struct.scm @@ -10,7 +10,7 @@ ;;; ;;; slot = slot-name or (slot-name initial-value) -(require 'struct.o) +(require 'struct.so) (define-macro (define-structure name . slot-descr) (internal-define-structure name slot-descr #t)) diff --git a/scm/unix.scm b/scm/unix.scm index ec16aa0..768b161 100644 --- a/scm/unix.scm +++ b/scm/unix.scm @@ -4,7 +4,7 @@ (require 'record) (require 'recordutil) -(require 'unix.o) +(require 'unix.so) (define-record-type stat (type mode ino dev nlink uid gid size atime mtime ctime)) diff --git a/scm/xlib.scm b/scm/xlib.scm index 18eff5b..fa5df3c 100644 --- a/scm/xlib.scm +++ b/scm/xlib.scm @@ -5,7 +5,7 @@ (require 'siteinfo) (fluid-let ((load-libraries (string-append site-lib-xlib " " load-libraries))) - (require 'xlib.o)) + (require 'xlib.so)) (define (create-window . args) (apply-with-keywords diff --git a/scm/xt.scm b/scm/xt.scm index 082407a..b3ad995 100644 --- a/scm/xt.scm +++ b/scm/xt.scm @@ -8,10 +8,10 @@ (fluid-let ((load-libraries (string-append site-force-load-xm " " site-lib-xmotif " " load-libraries))) - (require 'xt.o 'xt-motif.o)) + (require 'xt.so 'xt-motif.so)) (fluid-let ((load-libraries (string-append site-lib-xt " " load-libraries))) - (require 'xt.o))) + (require 'xt.so))) (load 'xlib.scm) diff --git a/scm/xwidgets.scm b/scm/xwidgets.scm index accf861..c9f0fa2 100644 --- a/scm/xwidgets.scm +++ b/scm/xwidgets.scm @@ -11,7 +11,7 @@ (define widget-aliases #f) (define (widget-loaded? w) - (feature? (string->symbol (format #f "~a:~a.o" widget-subdirectory w)))) + (feature? (string->symbol (format #f "~a:~a.so" widget-subdirectory w)))) (define-macro (load-widgets . w) (let ((wl '()) (l '())) @@ -33,15 +33,16 @@ (begin (if (not widget-aliases) (load (format #f "~a/ALIASES" widget-subdirectory))) - (format #t "[Loading ") + (if autoload-notify? (format #t "[Loading ")) (do ((f l (cdr f))) ((null? f)) (let* ((file (car f)) (alias (assq (car f) widget-aliases))) (if alias (set! file (cdr alias))) - (format #t "~a~a" file (if (null? (cdr f)) "" " ")) - (set! wl (cons (format #f "~a/~a.o" widget-subdirectory file) + (if autoload-notify? + (format #t "~a~a" file (if (null? (cdr f)) "" " "))) + (set! wl (cons (format #f "~a/~a.so" widget-subdirectory file) wl)))) - (format #t "]~%") + (if autoload-notify? (format #t "]~%")) `(fluid-let ((load-libraries (if (feature? 'motif) (string-append site-lib-xmotif " " load-libraries) diff --git a/scripts/Makefile b/scripts/Makefile index e61d7f4..2a53bb2 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../config/system ../config/site +Makefile.local: build ../config/system ../config/site $(SHELL) ./build default: Makefile.local diff --git a/src/Makefile b/src/Makefile index 591b04f..1019aaf 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,7 +3,7 @@ MAKE=make all: default -Makefile.local: ../config/system ../config/site +Makefile.local: build ../config/system ../config/site $(SHELL) ./build default: Makefile.local diff --git a/src/autoload.c b/src/autoload.c index 2322864..b92a75a 100644 --- a/src/autoload.c +++ b/src/autoload.c @@ -3,7 +3,7 @@ Object V_Autoload_Notifyp; void Init_Auto (void) { - Define_Variable (&V_Autoload_Notifyp, "autoload-notify?", True); + Define_Variable (&V_Autoload_Notifyp, "autoload-notify?", False); } Object P_Autoload (Object sym, Object files) { diff --git a/src/build b/src/build index fd0afd6..ecdbbd9 100755 --- a/src/build +++ b/src/build @@ -1,6 +1,6 @@ . ../config/system . ../config/site -. ../debian/arch-config +. ../debian/arch-config || true case _$aout_format in _coff) dump=dump-vanilla.c; stab=stab-coff.c;; @@ -116,15 +116,21 @@ O1= \$(OCOMMON) main.o stab.o O2= \$(OCOMMON) main2.o stab2.o O3= \$(OCOMMON) main3.o stab2.o -all: scheme standalone.o module.o +all: scheme standalone.a module.a scheme: \$(O1) \$(CC) -o \$@ \$(CFLAGS) \$(O1) \$(LDFLAGS) +standalone.a: \$(O2) + ar cru \$@ \$< + standalone.o: \$(O2) ld -r -o \$@ \$(O2) chmod 644 \$@ +module.a: \$(O3) + ar cru \$@ \$< + module.o: \$(O3) ld -r -o \$@ \$(O3) chmod 644 \$@ @@ -181,7 +187,7 @@ main3.o: \$(H) main.c \$(CC) -DINIT_OBJECTS -DNOMAIN \$(CFLAGS) -I\$(INC) -c main3.c rm main3.c -install: scheme standalone.o module.o +install: scheme standalone.a module.a -@if [ ! -d $install_dir/bin ]; then \\ echo mkdir $install_dir/bin; \\ mkdir $install_dir/bin; \\ @@ -195,15 +201,15 @@ install: scheme standalone.o module.o echo mkdir $install_dir/lib/elk; \\ mkdir $install_dir/lib/elk; \\ fi - cp standalone.o $install_dir/lib/elk - cp module.o $install_dir/lib/elk + cp standalone.a $install_dir/lib/elk + cp module.a $install_dir/lib/elk lint: lint \$(LINTFLAGS) -I\$(INC) \$(C) clean: - rm -f *.o core main2.c stab2.c main3.c + rm -f *.o *.a core main2.c stab2.c main3.c distclean: - rm -f *.o core main2.c stab2.c main3.c lint.out scheme Makefile.local + rm -f *.o *.a core main2.c stab2.c main3.c lint.out scheme Makefile.local EOT diff --git a/src/heap.c b/src/heap.c index d4112a9..73b1517 100644 --- a/src/heap.c +++ b/src/heap.c @@ -16,7 +16,7 @@ static Object Sym_Stop_And_Copy_GC, Sym_Generational_GC, Sym_Incremental_GC; void Init_Heap () { Define_Variable (&V_Garbage_Collect_Notifyp, "garbage-collect-notify?", - True); + False); Define_Symbol (&Sym_Stop_And_Copy_GC, "stop-and-copy"); Define_Symbol (&Sym_Generational_GC, "generational"); diff --git a/src/load-dl.c b/src/load-dl.c index 28edf19..a74ba6b 100644 --- a/src/load-dl.c +++ b/src/load-dl.c @@ -12,7 +12,7 @@ void Dlopen_File (char *fn) { if (Verb_Load) printf ("[dlopen %s]\n", fn); - if ((handle = dlopen (fn, RTLD_NOW)) == 0) { + if ((handle = dlopen (fn, RTLD_NOW|RTLD_GLOBAL)) == 0) { char *errstr = dlerror (); Primitive_Error ("dlopen failed:~%~s", Make_String (errstr, strlen (errstr))); @@ -126,6 +126,30 @@ void Load_Object (Object names) { Alloca_End; } +void Load_Lib (Object libs) { + Object port, name; + + if (Nullp (libs)) + return; + + Load_Lib (Cdr (libs)); + + GC_Node2; + port = name = Null; + GC_Link2 (port, name); + port = General_Open_File (Car (libs), P_INPUT, Var_Get (V_Load_Path)); + name = PORT(port)->name; + Dlopen_File (STRING(name)->data); + (void)P_Close_Input_Port (port); + GC_Unlink; +} + +void Load_Library (Object libs) { + Disable_Interrupts; + Load_Lib (libs); + Enable_Interrupts; +} + void Finit_Load () { int i; diff --git a/src/load-ld.c b/src/load-ld.c index 9bce158..b1c9439 100644 --- a/src/load-ld.c +++ b/src/load-ld.c @@ -28,7 +28,7 @@ extern char *getenv(); static char *Loader_Output; static char *tmpdir; -Load_Object (Object names) { +void Load_Object (Object names) { #ifdef ECOFF struct headers hdr; #else @@ -51,7 +51,7 @@ Load_Object (Object names) { Loader_Output = Safe_Malloc (strlen (tmpdir) + 20); } sprintf (Loader_Output, "%s/ldXXXXXX", tmpdir); - (void)mkstemp (Loader_Output); + (void)mktemp (Loader_Output); port = tail = fullnames = Null; GC_Link3 (port, tail, fullnames); @@ -162,7 +162,7 @@ void Fork_Load () { Disable_Interrupts; newlink = Safe_Malloc (strlen (tmpdir) + 20); sprintf (newlink, "%s/ldXXXXXX", tmpdir); - (void)mkstemp (newlink); + (void)mktemp (newlink); (void)link (Loader_Input, newlink); free (Loader_Input); Loader_Input = newlink; diff --git a/src/load-rld.c b/src/load-rld.c index ef988c5..7bacded 100644 --- a/src/load-rld.c +++ b/src/load-rld.c @@ -3,7 +3,7 @@ extern void Free_Symbols (SYMTAB *); extern void Call_Initializers (SYMTAB *, char *, int); -Load_Object (Object names) { +void Load_Object (Object names) { long retval; struct mach_header *hdr; char **filenames, *libs; diff --git a/src/load-shl.c b/src/load-shl.c index a7f1bc1..94333d9 100644 --- a/src/load-shl.c +++ b/src/load-shl.c @@ -50,7 +50,7 @@ static void Load_Them (Object names) { Alloca_End; } -Load_Object (Object names) { +void Load_Object (Object names) { Object port, tail, fullnames, str; char *p, *libs = ""; GC_Node3; diff --git a/src/load.c b/src/load.c index 4d945d0..862894f 100644 --- a/src/load.c +++ b/src/load.c @@ -64,15 +64,16 @@ void Init_Loadpath (char *s) { /* No GC possible here */ Var_Set (V_Load_Path, P_Reverse (path)); } -int Is_O_File (Object name) { +int Has_Suffix (Object name, char const *suffix) { register char *p; + register int len = strlen(suffix); register struct S_String *str; if (TYPE(name) == T_Symbol) name = SYMBOL(name)->name; str = STRING(name); - p = str->data + str->size; - return str->size >= 2 && *--p == 'o' && *--p == '.'; + p = str->data + str->size - len; + return len <= str->size && !strncasecmp(p, suffix, len); } void Check_Loadarg (Object x) { @@ -89,7 +90,7 @@ void Check_Loadarg (Object x) { f = Car (tail); if (TYPE(f) != T_Symbol && TYPE(f) != T_String) Wrong_Type_Combination (f, "string or symbol"); - if (!Is_O_File (f)) + if (!Has_Suffix (f, ".o") && !Has_Suffix (f, ".so")) Primitive_Error ("~s: not an object file", f); } } @@ -103,14 +104,26 @@ Object General_Load (Object what, Object env) { GC_Link (oldenv); Switch_Environment (env); Check_Loadarg (what); - if (TYPE(what) == T_Pair) + if (TYPE(what) == T_Pair) { + if (Has_Suffix (Car (what), ".o")) #ifdef CAN_LOAD_OBJ - Load_Object (what) + Load_Object (what) #endif - ; - else if (Is_O_File (what)) + ; + else if (Has_Suffix (Car (what), ".so")) +#ifdef CAN_LOAD_LIB + Load_Library (what) +#endif + ; + } + else if (Has_Suffix (what, ".o")) #ifdef CAN_LOAD_OBJ Load_Object (Cons (what, Null)) +#endif + ; + else if (Has_Suffix (what, ".so")) +#ifdef CAN_LOAD_LIB + Load_Library (Cons (what, Null)) #endif ; else diff --git a/src/main.c b/src/main.c index 9bb6bb0..10589c3 100644 --- a/src/main.c +++ b/src/main.c @@ -63,7 +63,7 @@ unsigned int Max_Stack; int Interpreter_Initialized; int GC_Debug = 0; int Case_Insensitive; -int Verb_Load, Verb_Init; +int Verb_Load = 0, Verb_Init = 0; char **Argv; int Argc, First_Arg;