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), \ 81 wordsizeof(struct builtin)): \ 82 alloc(wordsizeof(struct builtin), ELM_FIXED, cid, \ 83 wordsizeof(struct builtin))) 91 wordsizeof(
struct cons));
113 c=
alloc(vecsize(speval(
QCONS)->c.cls.vars), ELM_FIXED,
115 wordsizeof(
struct cons));
124 while (n-->0) r=
rawcons(ctx,*--fsp,r);
132 while (n-->0) r=
cons(ctx,*--fsp,r);
149 p->
c.
ivec.
iv[l/
sizeof(long)]=0;
150 memcpy((
void *)p->
c.
str.
chars, (
void *)s, l);
181 while (pkgs && islist(pkgs)) {
182 pkg=ccar(pkgs); pkgs=ccdr(pkgs);
184 while (islist(names))
185 if (strlength(ccar(names))==leng &&
186 !memcmp((
char *)ccar(names)->c.str.chars, (
char *)token, leng))
return(pkg);
187 else names=ccdr(names);}
192 {
register pointer pkg,pkgs,names;
193 if (ispackage(pkgname))
return(pkgname);
195 return(
searchpkg(pkgname->c.str.chars,strlength(pkgname)));}
199 register
pointer namestr,nicks,uses;
200 {
register pointer pkg,symvec,pkgs,names,p;
205 vpush(namestr); vpush(nicks); vpush(uses);
207 while (islist(nicks)) {
213 while (islist(uses)) {
214 if (p=
findpkg(ccar(uses))) { vpush(p); i++; uses=ccdr(uses);}
227 for (i=0; i<SYMBOLHASH; i++) symvec->
c.
vec.
v[i]=
makeint(0);
230 for (i=0; i<SYMBOLHASH; i++) symvec->
c.
vec.
v[i]=
makeint(0);
255 vpush(
string); vpush(fname);
270 vpush(in); vpush(out);
307 {
register struct chunk *cp;
310 #if defined(BIX_DEBUG) || defined(DEBUG_COUNT) 311 static int count = 0;
323 printf(
"recixobj:%d:p=0x%lx, bix = %d\n",
324 count, p, p->
h.
bix );
339 register int i,newcix,temp,supercix;
342 super= (classobj->c.cls.super);
343 if (isclass(super)) {
346 for (i=
nextcix-1; i>=newcix; i--) {
360 classobj->c.cls.cix=
makeint(newcix);
367 pointer name,superobj,vars,types,metaclass,forwards;
373 vpush(vars); vpush(types);
374 if (metaclass && isclass(metaclass))
class=
makeobject(metaclass);
380 class->c.cls.name=name;
389 class->c.vcls.size=
makeint(-1);}
401 size=vecsize(class->c.cls.vars);
402 obj=
alloc(size, ELM_FIXED,
intval(class->c.cls.cix), size);
404 while (size>0) v[--size]=
NIL;
411 register int n,etype;
413 etype=
intval(vclass->c.vcls.elmtype);
415 case ELM_BIT: n=(size+WORD_SIZE-1)/WORD_SIZE; init=0;
break;
418 case ELM_FLOAT: n=size; init=(
pointer)0;
break;
419 case ELM_INT: n=size; init=0;
break;
420 case ELM_FOREIGN: n=1; init=0;
break;
421 default: n=size; init=
NIL;}
422 v=
alloc(n+1,etype,
intval(vclass->c.vcls.cix),n+1);
425 while (--n>=0) vv[
n]=
init;
441 {
pointer classsym,
class,varvector,typevector,forwardvector;
451 vpush(forwardvector);
453 class=
makeclass(ctx,classsym,super,varvector,typevector,forwardvector,elm,0);
472 for (i=2; i<ARRAYRANKLIMIT; i++) m->
c.
ary.
dim[i]=
NIL;
481 elmtypeof(cvec)=ELM_BYTE;
509 {
pointer rdtable,rdsyntax,rdmacro,rddispatch;
526 wordsizeof(
struct labref));
597 #if defined(DEFUN_DEBUG) || defined(DEBUG_COUNT) 603 printf(
"defun:%d:%s:", count, name );
607 sym=
intern(ctx,name,strlen(name),pkg);
620 sym=
intern(ctx,name,strlen(name),pkg);
631 sym=
intern(ctx,name,strlen(name),pkg);
667 sym=
intern(ctx,name,strlen(name),pkg);
677 sym=
intern(ctx,name,strlen(name),pkg);
689 sym=
intern(ctx,name,strlen(name),pkg);
701 sym=
intern(ctx,name,strlen(name),pkg);
707 ctx->specials->c.vec.v[x]=vpop();
729 if (doc!=
NIL)
putprop(ctx,sym,doc,K_FUNCTION_DOCUMENTATION);
737 if (doc!=
NIL)
putprop(ctx,sym, doc, K_FUNCTION_DOCUMENTATION);
767 for (i=0; i<
sizeof(
struct fletframe)/sizeof(pointer); i++)
789 cfp->
jbp=(jmp_buf *)jbuf;
792 ctx->vsp += (
sizeof(
struct catchframe)/sizeof(pointer));
804 if (ctx->stack) cfree(ctx->stack);
807 i=(int)malloc((n+1)*
sizeof(
pointer));
814 ctx->stacklimit= &ctx->stack[n-100];
816 printf(
"allocate_stack: 0x%lx -- 0x%lx\n", ctx->stack, ctx->stacklimit );
825 struct buddy_free *thrbuddy;
829 if (bs_size<4096) bs_size=4096;
836 printf(
"makelispcontext: stack: 0x%lx -- 0x%lx\n", cntx->
stack, cntx->
stacklimit );
858 for (i=0; i<MAX_SPECIALS; i++)
866 for (i=0; i<MAXMETHCACHE; i++) {
870 malloc(
sizeof(
struct buddyfree) * (MAXTHRBUDDY+1));
873 for (i=0; i<MAXTHRBUDDY; i++) {
920 ctx->threadobj=thrport;
921 ctx->lastalloc=thrport;
context * euscontexts[MAXTHREAD]
pointer makemodule(context *ctx, int size)
pointer makelabref(pointer n, pointer v, pointer nxt)
pointer intern(context *, char *, int, pointer)
allocate_stack(context *ctx, int n)
struct fletframe * dynlink
struct protectframe * protfp
pointer makeclosure(pointer code, pointer quote, pointer(*f)(), pointer e0, pointer *e1, pointer *e2)
struct fletframe * fletfp
struct filestream fstream
context * makelispcontext(int bs_size)
struct blockframe * makeblock(context *ctx, pointer kind, pointer name, jmp_buf *jbuf, struct blockframe *link)
int sema_init(sema_t *, unsigned int, int, void *)
pointer rawcons(context *ctx, pointer a, pointer d)
pointer mkstream(context *ctx, pointer dir, pointer string)
pointer stacknlist(context *ctx, int n)
pointer makeflt(double d)
pointer makethreadport(context *ctx)
pointer defkeyword(context *ctx, char *name)
pointer makereadtable(context *ctx)
pointer makeobject(pointer class)
struct specialbindframe * sbindfp
struct blockframe * blkfp
struct fletframe * newfletfp
struct blockframe * lexklink
pointer defvar(context *ctx, char *name, pointer val, pointer pkg)
pointer makevector(pointer vclass, int size)
pointer compmacro(context *ctx, pointer sym, pointer mod, pointer(*entry)(), pointer doc)
struct blockframe * dynklink
pointer mkfilestream(context *ctx, pointer dir, pointer string, int fno, pointer fname)
pointer makepkg(context *ctx, pointer namestr, pointer nicks, pointer uses)
pointer defunpkg(context *ctx, char *name, pointer mod, pointer(*f)(), pointer pkg)
pointer defconst(context *ctx, char *name, pointer val, pointer pkg)
pointer makeclass(context *ctx, pointer name, pointer superobj, pointer vars, pointer types, pointer forwards, int tag, pointer metaclass)
struct numunion::@11 sval
pointer quote(context *, pointer)
struct fletframe * makeflet(context *ctx, pointer nm, pointer def, struct fletframe *scp, struct fletframe *link)
pointer cons(context *ctx, pointer a, pointer d)
pointer compfun(context *ctx, pointer sym, pointer mod, pointer(*entry)(), pointer doc)
pointer alloc(int, int, int, int)
struct callframe * callfp
long buddysize[MAXBUDDY+1]
pointer defmacro(context *ctx, char *name, pointer mod, pointer(*f)())
pointer defun(context *ctx, char *name, pointer mod, pointer(*f)())
struct methdef * methcache
struct fletframe * lexlink
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
struct catchframe * nextcatch
pointer makefvector(int s)
void deletecontext(id, context *ctx)
pointer makeratio(int num, int denom)
pointer searchpkg(byte *token, int leng)
struct catchframe * catchfp
pointer K_FUNCTION_DOCUMENTATION
pointer makematrix(context *ctx, int row, int column)
pointer makecode(pointer mod, pointer(*f)(), pointer ftype)
pointer defvector(context *ctx, char *name, pointer super, int elm, int size)
pointer makebuffer(int size)
pointer mkiostream(context *ctx, pointer in, pointer out)
pointer makesymbol(context *ctx, char *str, int leng, pointer home)
struct buddyfree * thr_buddy
pointer makebig2(long hi, long lo)
byte * get_string(pointer s)
pointer defspecial(context *ctx, char *name, pointer mod, pointer(*f)())
enterclass(pointer classobj)
pointer deflocal(context *ctx, char *name, pointer val, pointer pkg)
pointer Getstring(pointer s)
pointer findpkg(pointer pkgname)
void mkcatchframe(context *ctx, pointer lab, jmp_buf jbuf)
pointer stackrawlist(context *ctx, int n)
struct class_desc classtab[MAXCLASS]
resetcix(pointer class, cixpair *p)
struct bindframe * bindfp
pointer make_foreign_string(eusinteger_t addr, int size)
pointer makestring(char *s, int l)
struct built_in_cid builtinclass[64]