5 static char *
rcsid=
"@(#)$Id$";
16 #define nextbuddy(p) ((bpointer)((eusinteger_t)p+(buddysize[p->h.bix]*sizeof(pointer)))) 29 nu.
ival = p & 0xfffffffc;
41 nu.
ival= p & 0xfffffffc;
63 {
if (issymbol(s)) s=s->c.sym.pname;
69 {
if (isstring(s))
return(s->c.str.chars);
70 if (issymbol(s))
return(s->c.sym.pname->c.str.chars);
77 #define allocobj(class,builtin,cid) \ 79 alloc(vecsize(speval(class)->c.cls.vars), ELM_FIXED, \ 80 intval(speval(class)->c.cls.cix), \ 82 vecsize(speval(class)->c.cls.vars)) : \ 83 alloc(wordsizeof(struct builtin), ELM_FIXED, cid, \ 84 wordsizeof(struct builtin))) 92 wordsizeof(
struct cons));
114 c=
alloc(vecsize(speval(
QCONS)->c.cls.vars), ELM_FIXED,
116 wordsizeof(
struct cons));
125 while (n-->0) r=
rawcons(ctx,*--fsp,r);
133 while (n-->0) r=
cons(ctx,*--fsp,r);
153 p->
c.
ivec.
iv[l/
sizeof(long)]=0;
154 memcpy((
void *)p->
c.
str.
chars, (
void *)s, l);
185 while (pkgs && islist(pkgs)) {
186 pkg=ccar(pkgs); pkgs=ccdr(pkgs);
188 while (islist(names))
189 if (strlength(ccar(names))==leng &&
190 !memcmp((
char *)ccar(names)->c.str.chars, (
char *)token, leng))
return(pkg);
191 else names=ccdr(names);}
196 {
register pointer pkg,pkgs,names;
197 if (ispackage(pkgname))
return(pkgname);
199 return(
searchpkg(pkgname->c.str.chars,strlength(pkgname)));}
203 register
pointer namestr,nicks,uses;
204 {
register pointer pkg,symvec,pkgs,names,p;
209 vpush(namestr); vpush(nicks); vpush(uses);
211 while (islist(nicks)) {
217 while (islist(uses)) {
218 if ((p=
findpkg(ccar(uses)))) { vpush(p); i++; uses=ccdr(uses);}
231 for (i=0; i<SYMBOLHASH; i++) symvec->
c.
vec.
v[i]=
makeint(0);
234 for (i=0; i<SYMBOLHASH; i++) symvec->
c.
vec.
v[i]=
makeint(0);
259 vpush(
string); vpush(fname);
274 vpush(in); vpush(out);
314 {
register struct chunk *cp;
317 #if defined(BIX_DEBUG) || defined(DEBUG_COUNT) 318 static int count = 0;
330 printf(
"recixobj:%d:p=0x%lx, bix = %d\n",
331 count, p, p->
h.
bix );
346 register int i,newcix,temp,supercix;
349 super= (classobj->c.cls.super);
350 if (isclass(super)) {
353 for (i=
nextcix-1; i>=newcix; i--) {
367 classobj->c.cls.cix=
makeint(newcix);
377 pointer name,superobj,vars,types,metaclass,forwards;
383 vpush(vars); vpush(types);
384 if (metaclass && isclass(metaclass))
class=
makeobject(metaclass);
390 class->c.cls.name=name;
399 class->c.vcls.size=
makeint(-1);}
411 size=vecsize(class->c.cls.vars);
412 obj=
alloc(size, ELM_FIXED,
intval(class->c.cls.cix), size);
414 while (size>0) v[--size]=
NIL;
421 register int n,etype;
423 etype=
intval(vclass->c.vcls.elmtype);
425 case ELM_BIT: n=(size+WORD_SIZE-1)/WORD_SIZE; init=0;
break;
428 case ELM_FLOAT: n=size; init=(
pointer)0;
break;
429 case ELM_INT: n=size; init=0;
break;
430 case ELM_FOREIGN: n=1; init=0;
break;
431 default: n=size; init=
NIL;}
432 v=
alloc(n+1,etype,
intval(vclass->c.vcls.cix),n+1);
435 while (--n>=0) vv[
n]=
init;
451 {
pointer classsym,
class,varvector,typevector,forwardvector;
461 vpush(forwardvector);
463 class=
makeclass(ctx,classsym,super,varvector,typevector,forwardvector,elm,0);
482 for (i=2; i<ARRAYRANKLIMIT; i++) m->
c.
ary.
dim[i]=
NIL;
491 elmtypeof(cvec)=ELM_BYTE;
525 {
pointer rdtable,rdsyntax,rdmacro,rddispatch;
542 wordsizeof(
struct labref));
612 {
register pointer sym,pkg,pdoc;
613 #if defined(DEFUN_DEBUG) || defined(DEBUG_COUNT) 619 printf(
"defun:%d:%s:", count, name );
623 sym=
intern(ctx,name,strlen(name),pkg);
629 compfun(ctx, sym, mod, f, pdoc);
630 if (doc !=
NULL) vpop();
642 sym=
intern(ctx,name,strlen(name),pkg);
653 sym=
intern(ctx,name,strlen(name),pkg);
657 #if Solaris2 || PTHREAD 689 sym=
intern(ctx,name,strlen(name),pkg);
699 sym=
intern(ctx,name,strlen(name),pkg);
711 sym=
intern(ctx,name,strlen(name),pkg);
723 sym=
intern(ctx,name,strlen(name),pkg);
729 pointer_update(ctx->specials->c.vec.v[x],vpop());
750 { pointer_update(sym->c.sym.spefunc,
makecode(mod,entry,SUBR_FUNCTION));
751 if (doc!=
NIL)
putprop(ctx,sym,doc,K_FUNCTION_DOCUMENTATION);
758 { pointer_update(sym->c.sym.spefunc,
makecode(mod,entry,SUBR_MACRO));
759 if (doc!=
NIL)
putprop(ctx,sym, doc, K_FUNCTION_DOCUMENTATION);
789 for (i=0; i<
sizeof(
struct fletframe)/sizeof(pointer); i++)
811 cfp->
jbp=(jmp_buf *)jbuf;
814 ctx->vsp += (
sizeof(
struct catchframe)/sizeof(pointer));
826 if (ctx->stack) cfree(ctx->stack);
829 i=(int)malloc((n+1)*
sizeof(
pointer));
834 ctx->stacklimit= &ctx->stack[n-100];
836 printf(
"allocate_stack: 0x%lx -- 0x%lx\n", ctx->stack, ctx->stacklimit );
847 if (bs_size<4096) bs_size=4096;
853 printf(
"makelispcontext: stack: 0x%lx -- 0x%lx\n", cntx->
stack, cntx->
stacklimit );
874 #ifdef __GC_ALLOC_DRIVEN 880 #ifdef __RETURN_BARRIER 889 for (i=0; i<MAX_SPECIALS; i++)
896 for (i=0; i<MAXMETHCACHE; i++) {
900 malloc(
sizeof(
struct buddyfree) * (MAXTHRBUDDY+1));
901 for (i=0; i<MAXTHRBUDDY; i++) {
950 ctx->threadobj=thrport;
951 ctx->lastalloc=thrport;
context * euscontexts[MAXTHREAD]
pointer makematrix(context *ctx, int row, int column)
pointer intern(context *, char *, int, pointer)
struct fletframe * dynlink
pointer mkstream(context *ctx, pointer dir, pointer string)
struct protectframe * protfp
struct fletframe * fletfp
struct fletframe * makeflet(context *ctx, pointer nm, pointer def, struct fletframe *scp, struct fletframe *link)
pointer makebig2(long hi, long lo)
struct filestream fstream
pointer mkiostream(context *ctx, pointer in, pointer out)
void recixobj(int newcix)
int sema_init(sema_t *, unsigned int, int, void *)
pointer stacknlist(context *ctx, int n)
context * makelispcontext(int bs_size)
struct specialbindframe * sbindfp
pointer makeclosure(pointer code, pointer quote, pointer(*f)(), pointer e0, pointer *e1, pointer *e2)
pointer defunpkg(context *ctx, char *name, pointer mod, pointer(*f)(), pointer pkg)
struct blockframe * blkfp
struct fletframe * newfletfp
eusinteger_t hide_ptr(pointer p)
pointer make_foreign_string(eusinteger_t addr, int size)
struct blockframe * lexklink
pointer stackrawlist(context *ctx, int n)
pointer findpkg(pointer pkgname)
struct blockframe * makeblock(context *ctx, pointer kind, pointer name, jmp_buf *jbuf, struct blockframe *link)
struct blockframe * dynklink
pointer defkeyword(context *ctx, char *name)
pointer compmacro(context *ctx, pointer sym, pointer mod, pointer(*entry)(), pointer doc)
pointer makevector(pointer vclass, int size)
pointer defconst(context *ctx, char *name, pointer val, pointer pkg)
pointer deflocal(context *ctx, char *name, pointer val, pointer pkg)
pointer makereadtable(context *ctx)
void rgc_add_to_classtable(pointer newclass)
struct numunion::@11 sval
pointer quote(context *, pointer)
byte * get_string(pointer s)
pointer makeobject(pointer class)
pointer makebuffer(int size)
pointer cons(context *ctx, pointer a, pointer d)
pointer alloc(int, int, int, int)
struct callframe * callfp
long buddysize[MAXBUDDY+1]
pointer makefvector(int s)
pointer makepkg(context *ctx, pointer namestr, pointer nicks, pointer uses)
pointer makelabref(pointer n, pointer v, pointer nxt)
pointer K_FUNCTION_DOCUMENTATION
struct methdef * methcache
pointer defvector(context *ctx, char *name, pointer super, int elm, int size)
pointer makecode(pointer mod, pointer(*f)(), pointer ftype)
struct fletframe * lexlink
pointer searchpkg(byte *token, int leng)
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
void mkcatchframe(context *ctx, pointer lab, jmp_buf *jbuf)
struct catchframe * nextcatch
pointer makeratio(int num, int denom)
void deletecontext(int id, context *ctx)
pointer defun(context *ctx, char *name, pointer mod, pointer(*f)(), char *doc)
struct catchframe * catchfp
pointer compfun(context *ctx, pointer sym, pointer mod, pointer(*entry)(), pointer doc)
void allocate_stack(context *ctx, int n)
pointer defmacro(context *ctx, char *name, pointer mod, pointer(*f)())
void bumpcix(int m, int n)
pointer makethreadport(context *ctx)
struct buddyfree * thr_buddy
pointer makesymbol(context *ctx, char *str, int leng, pointer home)
pointer mkfilestream(context *ctx, pointer dir, pointer string, int fno, pointer fname)
pointer makeclass(context *ctx, pointer name, pointer superobj, pointer vars, pointer types, pointer forwards, int tag, pointer metaclass)
pointer makeflt(double d)
pointer Getstring(pointer s)
pointer rawcons(context *ctx, pointer a, pointer d)
struct class_desc classtab[MAXCLASS]
struct bindframe * bindfp
pointer defvar(context *ctx, char *name, pointer val, pointer pkg)
pointer defspecial(context *ctx, char *name, pointer mod, pointer(*f)())
pointer makemodule(context *ctx, int size)
pointer makestring(char *s, int l)
struct built_in_cid builtinclass[64]
void resetcix(pointer class, cixpair *p)
void enterclass(pointer classobj)