9 static char *
rcsid=
"@(#)$Id$";
47 in=
openfile(ctx,(
char *)argv[0]->c.str.chars,O_RDONLY,0,256);
78 #define MAX_SYSTEM_MODULES 100 103 printf(
"executing init: %s at %p...",
119 (*initfunc)(ctx,1, &mod); }
136 addr= (int)initfunc; addr >>=2;
142 printf(
"collecting init: %s at %x module at %x\n",
146 p=
cons(ctx,vpop(), p);
163 dlhandle=dlopen(0,RTLD_LAZY|RTLD_GLOBAL);
164 if (dlhandle==
NULL) {
165 fprintf(stderr,
"cannot dlopen self\n"); exit(2);}
167 while (iscons(initnames)) {
169 initfunc= dlsym(dlhandle, (
char *)ccar(initnames)->c.str.chars);
170 if (initfunc==
NULL) {
171 sprintf(namebuf,
"___%s",ccar(initnames)->c.str.chars);
172 initfunc=dlsym(dlhandle, namebuf);}
176 modname=ccar(initnames);
187 p=
cons(ctx,vpop(), p);
192 initnames=ccdr(initnames); }
204 pointer mod, modname, initnames, p;
211 #if (WORD_SIZE == 64) 220 while (iscons(initnames)) {
221 initfunc= dlsym(dlhandle, (
char *)ccar(initnames)->c.str.chars);
222 if (initfunc==
NULL) {
223 sprintf(namebuf,
"___%s",ccar(initnames)->c.str.chars);
224 initfunc=dlsym(dlhandle, namebuf);}
227 modname=ccar(initnames);
238 p=
cons(ctx,vpop(), p);
241 printf(
"%s not loaded\n", ccar(initnames)->c.str.chars); }
242 initnames=ccdr(initnames); }
252 {
pointer qvec, p, qstring, qstream;
258 for (i=0; i<size; i++) {
259 k=strlen((
char *)strings[i]);
277 const char *strings[];
279 int i, k, total_length;
284 for (i=0; i<size; i++) { total_length += strlen(strings[i]); }
288 for (i=0; i<size; i++) {
289 s=(
char *)strings[i];
290 while (*s) *d++ = *s++;
312 if (
n==2) mod=argv[1];
316 #if (WORD_SIZE == 64) 333 if (
n==2) mod=argv[1];
337 #if (WORD_SIZE == 64) 357 {
register pointer mod=argv[0];
361 #if (WORD_SIZE == 64) 373 {
char *binfn, *quofn;
375 int binfd,size,newsize,stat,i=0,
l,
s;
389 dlhandle=(
eusinteger_t)dlopen(binfn, RTLD_LAZY|RTLD_GLOBAL);
391 fprintf(stderr,
"BINLOAD cannot dlopen: %s\n", dlerror());
415 (*initfunc)(ctx, 1, &mod); }
416 else if (debug) fprintf(stderr,
";; no initializer\n");
445 pointer_update(Spevalof(
PACKAGE),p);}
pointer prinx(context *, pointer, pointer)
struct @15 module_initializers[MAX_SYSTEM_MODULES]
void add_module_initializer(char *name, pointer(*entry)())
pointer FIND_ENTRY2(context *ctx, int n, argv)
pointer cons(context *, pointer, pointer)
pointer BINLOAD(context *ctx, int n, pointer *argv)
void exec_module_initializers(context *ctx)
pointer UNBINLOAD(context *ctx, int n, pointer *argv)
defun("ADR_TO_STRING", mod, ADR_TO_STRING)
pointer SAVE(context *ctx, int n, argv)
pointer makevector(pointer, int)
pointer mkstream(context *, pointer, pointer)
pointer FIND_ENTRY(context *ctx, int n, argv)
pointer makemodule(context *, int)
pointer list_module_initializers(context *ctx, pointer initnames)
pointer SRCLOAD(context *ctx, int n, argv)
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
pointer list_module_initializers2(context *ctx, int n, pointer *argv)
pointer stacknlist(context *, int)
pointer makestring(char *, int)
void loadsave(context *ctx, pointer mod)
pointer eval_c_strings(context *ctx, int size, strings)
pointer eval(context *, pointer)
pointer build_quote_vector(context *ctx, int size, strings)
pointer reader(context *, pointer, pointer)