1 |
|
#include <string.h> |
2 |
|
#include <stdlib.h> |
3 |
|
#include "../h/include.h" |
4 |
|
|
5 |
|
extern object user_init(); |
6 |
|
|
7 |
|
|
8 |
|
void gcl_init_or_load1 (void (*)(void),char *); |
9 |
|
#define init_or_load(fn,file) do {extern void fn(void); gcl_init_or_load1(fn,file);} \ |
10 |
|
while(0) |
11 |
|
|
12 |
|
#define mjoin(a,b) a ## b |
13 |
|
#define Mjoin(a,b) mjoin(a,b) |
14 |
|
|
15 |
|
#define ar_init(a) do {\ |
16 |
|
char b[200];\ |
17 |
|
\ |
18 |
|
if (snprintf(b,sizeof(b),"ar x %-*.*slibpre_gcl.a %s.o",\ |
19 |
|
sSAsystem_directoryA->s.s_dbind->st.st_fillp,\ |
20 |
|
sSAsystem_directoryA->s.s_dbind->st.st_fillp,\ |
21 |
|
sSAsystem_directoryA->s.s_dbind->st.st_self,#a)<=0)\ |
22 |
|
error("Cannot unpack module " #a "o\n");\ |
23 |
|
if (system(b)) \ |
24 |
|
error("Cannot run ar command to unpack module " #a ".o\n");\ |
25 |
|
init_or_load(Mjoin(init_,a),#a ".o");\ |
26 |
|
if (unlink(#a ".o"))\ |
27 |
|
error("Cannot unlink " #a ".o\n");\ |
28 |
|
} while(0) |
29 |
|
|
30 |
|
#define ar_check_init(a,b) do {\ |
31 |
|
object t;\ |
32 |
|
\ |
33 |
|
for (t=b->s.s_dbind;!endp(t) && type_of(t->c.c_car)==t_string && strcmp(#a,t->c.c_car->st.st_self);t=t->c.c_cdr);\ |
34 |
|
if (endp(t))\ |
35 |
|
ar_init(a);\ |
36 |
|
} while(0) |
37 |
|
|
38 |
|
|
39 |
|
static void |
40 |
|
load1(x) |
41 |
|
char *x; |
42 |
|
{printf("loading %s\n",x); |
43 |
|
fflush(stdout); |
44 |
|
load(x);} |
45 |
|
|
46 |
|
#define lsp_init(a) do {\ |
47 |
|
char b[200];\ |
48 |
|
\ |
49 |
|
if (snprintf(b,sizeof(b),"%-*.*s%s",\ |
50 |
|
sSAsystem_directoryA->s.s_dbind->st.st_fillp,\ |
51 |
|
sSAsystem_directoryA->s.s_dbind->st.st_fillp,\ |
52 |
|
sSAsystem_directoryA->s.s_dbind->st.st_self,a)<=0)\ |
53 |
|
error("Cannot append system directory\n");\ |
54 |
|
load1(b);\ |
55 |
|
} while(0) |
56 |
|
|
57 |
|
void |
58 |
|
gcl_init_init() |
59 |
|
{ |
60 |
|
|
61 |
|
build_symbol_table(); |
62 |
|
|
63 |
|
lsp_init("../lsp/gcl_export.lsp"); |
64 |
|
|
65 |
|
lsp_init("../lsp/gcl_defmacro.lsp"); |
66 |
|
lsp_init("../lsp/gcl_evalmacros.lsp"); |
67 |
|
lsp_init("../lsp/gcl_top.lsp"); |
68 |
|
lsp_init("../lsp/gcl_module.lsp"); |
69 |
|
|
70 |
|
lsp_init("../lsp/gcl_autoload.lsp"); |
71 |
|
|
72 |
|
} |
73 |
|
|
74 |
|
void |
75 |
|
gcl_init_system(object no_init) |
76 |
|
{ |
77 |
|
|
78 |
|
if (type_of(no_init)!=t_symbol) |
79 |
|
error("Supplied no_init is not of type symbol\n"); |
80 |
|
|
81 |
|
lsp_init("../lsp/gcl_predlib.lsp"); |
82 |
|
lsp_init("../lsp/gcl_setf.lsp"); |
83 |
|
lsp_init("../lsp/gcl_arraylib.lsp"); |
84 |
|
lsp_init("../lsp/gcl_assert.lsp"); |
85 |
|
lsp_init("../lsp/gcl_defstruct.lsp"); |
86 |
|
lsp_init("../lsp/gcl_describe.lsp"); |
87 |
|
#ifdef HAVE_JAPI_H |
88 |
|
lsp_init("../mod/gcl_japi.lsp"); |
89 |
|
#endif |
90 |
|
lsp_init("../lsp/gcl_iolib.lsp"); |
91 |
|
lsp_init("../lsp/gcl_listlib.lsp"); |
92 |
|
lsp_init("../lsp/gcl_mislib.lsp"); |
93 |
|
lsp_init("../lsp/gcl_numlib.lsp"); |
94 |
|
lsp_init("../lsp/gcl_packlib.lsp"); |
95 |
|
lsp_init("../lsp/gcl_seq.lsp"); |
96 |
|
lsp_init("../lsp/gcl_seqlib.lsp"); |
97 |
|
lsp_init("../lsp/gcl_trace.lsp"); |
98 |
|
lsp_init("../lsp/gcl_sloop.lsp"); |
99 |
|
lsp_init("../lsp/gcl_serror.lsp"); |
100 |
|
|
101 |
|
lsp_init("../mod/gcl_destructuring_bind.lsp"); |
102 |
|
lsp_init("../mod/gcl_loop.lsp"); |
103 |
|
lsp_init("../mod/gcl_defpackage.lsp"); |
104 |
|
lsp_init("../mod/gcl_make_defpackage.lsp"); |
105 |
|
|
106 |
|
lsp_init("../cmpnew/gcl_cmpinline.lsp"); |
107 |
|
lsp_init("../cmpnew/gcl_cmputil.lsp"); |
108 |
|
|
109 |
|
lsp_init("../lsp/gcl_debug.lsp"); |
110 |
|
lsp_init("../lsp/gcl_info.lsp"); |
111 |
|
|
112 |
|
lsp_init("../cmpnew/gcl_cmptype.lsp"); |
113 |
|
lsp_init("../cmpnew/gcl_cmpbind.lsp"); |
114 |
|
lsp_init("../cmpnew/gcl_cmpblock.lsp"); |
115 |
|
lsp_init("../cmpnew/gcl_cmpcall.lsp"); |
116 |
|
lsp_init("../cmpnew/gcl_cmpcatch.lsp"); |
117 |
|
lsp_init("../cmpnew/gcl_cmpenv.lsp"); |
118 |
|
lsp_init("../cmpnew/gcl_cmpeval.lsp"); |
119 |
|
lsp_init("../cmpnew/gcl_cmpflet.lsp"); |
120 |
|
lsp_init("../cmpnew/gcl_cmpfun.lsp"); |
121 |
|
lsp_init("../cmpnew/gcl_cmpif.lsp"); |
122 |
|
lsp_init("../cmpnew/gcl_cmplabel.lsp"); |
123 |
|
lsp_init("../cmpnew/gcl_cmplam.lsp"); |
124 |
|
lsp_init("../cmpnew/gcl_cmplet.lsp"); |
125 |
|
lsp_init("../cmpnew/gcl_cmploc.lsp"); |
126 |
|
lsp_init("../cmpnew/gcl_cmpmap.lsp"); |
127 |
|
lsp_init("../cmpnew/gcl_cmpmulti.lsp"); |
128 |
|
lsp_init("../cmpnew/gcl_cmpspecial.lsp"); |
129 |
|
lsp_init("../cmpnew/gcl_cmptag.lsp"); |
130 |
|
lsp_init("../cmpnew/gcl_cmptop.lsp"); |
131 |
|
lsp_init("../cmpnew/gcl_cmpvar.lsp"); |
132 |
|
lsp_init("../cmpnew/gcl_cmpvs.lsp"); |
133 |
|
lsp_init("../cmpnew/gcl_cmpwt.lsp"); |
134 |
|
|
135 |
|
|
136 |
|
} |
137 |
|
|
138 |
|
int |
139 |
|
gcl_init_cmp_anon(void) { |
140 |
|
|
141 |
|
return 1; |
142 |
|
|
143 |
|
} |