mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-19 17:28:18 +00:00
The code is being re-licensed under the MIT license. modified: bin/fixid modified: bin/launch.asm modified: bin/makefile-hpux.hp9000-x modified: bin/makefile-init.sgi modified: bin/makefile-init.sparc modified: bin/makefile-init.sparc-multi modified: bin/makefile-irix.sgi-x modified: bin/makefile-sunos4.sparc modified: bin/makefile-sunos4.sparc% modified: bin/makefile-sunos4.sparc-multi modified: bin/makefile-sunos5.386-x modified: bin/makefile-sunos5.i386-x modified: bin/makefile-sunos5.sparc-x modified: bin/makefile-tail modified: bin/makeisc modified: bin/makeright modified: inc/Check.h modified: inc/MyWindow.h modified: inc/Stipple.h modified: inc/XCursors.h modified: inc/XKeymap.h modified: inc/XVersion.h modified: inc/Xdeflt.h modified: inc/Xicon.h modified: inc/address.h modified: inc/arith.h modified: inc/arith2.h modified: inc/array.h modified: inc/bb.h modified: inc/cell.h modified: inc/cell.h% modified: inc/copyright modified: inc/dbprint.h modified: inc/debug.h modified: inc/devif.h modified: inc/display.h modified: inc/dspdata.h modified: inc/ether.h modified: inc/fast_dsp.h modified: inc/fp.h modified: inc/gc.h modified: inc/gc.h.save modified: inc/gcscan.h modified: inc/hdw_conf.h modified: inc/ifpage.h modified: inc/inlineC.h modified: inc/inlnMIPS.h modified: inc/inlnPS2.h modified: inc/inlndos.h modified: inc/iopage.h modified: inc/kbdif.h modified: inc/keyboard.h modified: inc/keyboard.h% modified: inc/keysym.h modified: inc/ldeXdefs.h modified: inc/lispemul.h modified: inc/lispemul.h.save modified: inc/lispmap.h modified: inc/lldsp.h modified: inc/lnk-Xdeflt.h modified: inc/lnk-debug.h modified: inc/lnk-fast_dsp.h modified: inc/lnk-inlineC.h modified: inc/lnk-lispmap.h modified: inc/lnk-tosfns.h modified: inc/lnk-tosret.h modified: inc/locfile.h modified: inc/lpdefs.h modified: inc/lpglobl.h modified: inc/lspglob.h modified: inc/lsptypes.h modified: inc/medleyfp.h modified: inc/mnxdefs.h modified: inc/my.h modified: inc/native.h modified: inc/ocr.h modified: inc/osmsg.h modified: inc/picture.h modified: inc/pilotbbt.h modified: inc/print.h modified: inc/profile.h modified: inc/rawrs232c.h modified: inc/return.h modified: inc/rs232c.h modified: inc/stack.h modified: inc/stream.h modified: inc/stream.h% modified: inc/stream.h2 modified: inc/sysatms.h modified: inc/timeout.h modified: inc/tos1defs.h modified: inc/tosfns.h modified: inc/tosret.h modified: inc/tty.h modified: inc/version.h modified: inc/vmemsave.h modified: inc/xbitmaps.h modified: inc/xdefs.h modified: src/Cldeetr.c modified: src/allocmds.c modified: src/arith2.c modified: src/arith3.c modified: src/arith4.c modified: src/array.c modified: src/array2.c modified: src/array3.c modified: src/array4.c modified: src/array5.c modified: src/array6.c modified: src/asmbbt.c modified: src/asmbitblt.c modified: src/atom.c modified: src/bbtSPARC.s modified: src/bbtsub.c modified: src/bin.c modified: src/binds.c modified: src/bitblt.c modified: src/blt.c modified: src/byteswap.c modified: src/call-c.c modified: src/car-cdr.c modified: src/cdaudio.c modified: src/cdrom.c modified: src/chardev.c modified: src/chatter.c modified: src/codeconv.c modified: src/codetbl.c modified: src/colorbltfns.c modified: src/common.c modified: src/conspage.c modified: src/cr modified: src/dbgtool.c modified: src/dir.c modified: src/doscomm.c modified: src/doskbd.c modified: src/dosmouse.c modified: src/draw.c modified: src/dsk.c modified: src/dspif.c modified: src/dspsubrs.c modified: src/ejlisp.c modified: src/eqf.c modified: src/ether.c modified: src/findkey.c modified: src/foreign.c modified: src/fp.c modified: src/fvar.c modified: src/gc.c modified: src/gc2.c modified: src/gcarray.c modified: src/gccode.c modified: src/gcfinal.c modified: src/gchtfind.c modified: src/gcmain3.c modified: src/gcoflow.c modified: src/gcr.c modified: src/gcrcell.c modified: src/gcscan.c modified: src/gvar2.c modified: src/hacks.c modified: src/hardrtn.c modified: src/imagefile.c modified: src/imagefile2.c modified: src/inet.c modified: src/initdsp.c modified: src/initkbd.c modified: src/initsout.c modified: src/intcall.c modified: src/kbdif.c modified: src/kbdsubrs.c modified: src/keyevent.c modified: src/keylib.c modified: src/keymaker.c modified: src/keytst.c modified: src/keytstno.c modified: src/kprint.c modified: src/launch.asm modified: src/ldeboot.c modified: src/ldeether.c modified: src/ldsout.c modified: src/lineblt8.c modified: src/lisp2c.c modified: src/llcolor.c modified: src/llstk.c modified: src/loader.c modified: src/loopsops.c modified: src/lowlev1.c modified: src/lowlev2.c modified: src/lpdual.c modified: src/lpkit.c modified: src/lplexyy.c modified: src/lpmain.c modified: src/lpread.c modified: src/lpsolve.c modified: src/lptran.c modified: src/lpwrite.c modified: src/lpytab.c modified: src/lsthandl.c modified: src/main.c modified: src/misc7.c modified: src/miscn.c modified: src/mkatom.c modified: src/mkcell.c modified: src/mkkey.c modified: src/mkvdate.c modified: src/mnwevent.c modified: src/mnxmeth.c modified: src/mouseif.c modified: src/mvs.c modified: src/ocr.c modified: src/ocrproc.c modified: src/oether.c modified: src/oldeether.c modified: src/optck.c modified: src/osmsg.c modified: src/perrno.c modified: src/picture.c modified: src/rawcolor.c modified: src/rawrs232c.c modified: src/return.c modified: src/rpc.c modified: src/rplcons.c modified: src/rs232c.c modified: src/setsout.c modified: src/shift.c modified: src/socdvr.c modified: src/storage.c modified: src/subr.c modified: src/subr0374.c modified: src/sxhash.c modified: src/testdsp.c modified: src/testtool.c modified: src/timeoday.c modified: src/timeofday.c modified: src/timer.c modified: src/truecolor.c modified: src/tstsout.c modified: src/tty.c modified: src/typeof.c modified: src/ubf1.c modified: src/ubf2.c modified: src/ubf3.c modified: src/ufn.c modified: src/ufs.c modified: src/unixcomm.c modified: src/unixfork.c modified: src/unwind.c modified: src/uraid.c modified: src/usrsubr.c modified: src/uutils.c modified: src/vars3.c modified: src/vesafns.asm modified: src/vesainit.c modified: src/vgainit.c modified: src/vmemsave.c modified: src/xbbt.c modified: src/xc.c modified: src/xc.c.orig modified: src/xcursor.c modified: src/xinit.c modified: src/xlspwin.c modified: src/xmkicon.c modified: src/xrdopt.c modified: src/xscroll.c modified: src/xwinman.c modified: src/z2.c
430 lines
14 KiB
C
430 lines
14 KiB
C
/* $Id: loopsops.c,v 1.3 1999/05/31 23:35:37 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
|
|
*/
|
|
static char *id = "$Id: loopsops.c,v 1.3 1999/05/31 23:35:37 sybalsky Exp $ Copyright (C) Venue";
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
|
/* Manufactured in the United States of America. */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
#include "version.h"
|
|
|
|
/*
|
|
LOOPS opcodes:
|
|
|
|
FetchMethodOrHelp(object, selector) -> MethodFn
|
|
LookupIV(object, iv) -> Index into iDescrs
|
|
GetValue(object, iv)
|
|
PutValue(object, iv, val)
|
|
*/
|
|
|
|
#include "lispemul.h"
|
|
#include "lsptypes.h"
|
|
#include "cell.h"
|
|
#include "car-cdr.h"
|
|
#include "lispmap.h"
|
|
#include "lspglob.h"
|
|
#include "adr68k.h"
|
|
#include "stack.h"
|
|
#include "gc.h"
|
|
|
|
LispPTR lcfuncall(register unsigned int atom_index, register int argnum, register int bytenum);
|
|
LispPTR get_package_atom(char *char_base, DLword charlen, char *packname, DLword packlen,
|
|
int externalp);
|
|
static char il_string[] = "INTERLISP";
|
|
#define GET_IL_ATOM(string) get_package_atom((string), (sizeof(string) - 1), il_string, 9, NIL)
|
|
|
|
#define AtomValPtr(index) Addr68k_from_LADDR(*(GetVALCELL68k(index)))
|
|
|
|
#ifdef BIGVM
|
|
#define DTD_FROM_LADDR(x) (((struct dtd *)GetDTD(GetTypeNumber((x))))->dtd_name)
|
|
#else
|
|
#define DTD_FROM_LADDR(x) \
|
|
(((struct dtd *)GetDTD(GetTypeNumber((x))))->dtd_namelo + \
|
|
(((struct dtd *)GetDTD(GetTypeNumber((x))))->dtd_namehi << 16))
|
|
#endif /* BIGVM */
|
|
|
|
/* These assume 0 <= POSINT <= 65535 */
|
|
#define SMALLP_FROM_POSINT(x) ((x) | S_POSITIVE)
|
|
#define POSINT_FROM_SMALLP(x) ((x)&0xffff)
|
|
|
|
#define RETCALL(fn, argnum) return lcfuncall(fn, argnum, 3)
|
|
|
|
/* #define PUNT (-1)*/
|
|
|
|
#define METH_CACHE_INDEX(CLASS, SELECTOR) (1023 & ((CLASS) ^ (SELECTOR)))
|
|
#define IV_CACHE_INDEX(VARLIST, IV) (1023 & ((VARLIST) ^ (IV)))
|
|
|
|
#define LC_TYPEP(obj, typeATOM) (DTD_FROM_LADDR((obj)) == typeATOM)
|
|
|
|
#define INSTANCEP(obj) (LC_TYPEP((obj), atom_instance))
|
|
#define CLASSP(obj) (LC_TYPEP((obj), atom_class))
|
|
|
|
#define INSTANCE_OR_PUNT(obj, fn, argnum) \
|
|
{ \
|
|
if (!LC_TYPEP((obj), atom_instance)) RETCALL(fn, argnum); \
|
|
}
|
|
|
|
#define INSTANCE_CLASS_OR_PUNT(obj, fn, argnum) \
|
|
{ \
|
|
register LispPTR tmp = DTD_FROM_LADDR(obj); \
|
|
if (tmp != atom_instance && tmp != atom_class) RETCALL(fn, argnum); \
|
|
}
|
|
|
|
#define LC_INIT \
|
|
if (atom_instance == 0) LCinit()
|
|
|
|
#define GET_IV_INDEX(objptr, iv, dest, otherwise) \
|
|
{ \
|
|
register struct LCIVCacheEntry *ce; \
|
|
register LispPTR iNames = objptr->iNames; \
|
|
\
|
|
ce = &(LCIVCache[IV_CACHE_INDEX(iNames, iv)]); \
|
|
if (ce->iNames == iNames && ce->iv == iv) { \
|
|
(dest) = POSINT_FROM_SMALLP(ce->index); \
|
|
} else { \
|
|
if (!Listp(iNames)) { \
|
|
otherwise; \
|
|
} else { \
|
|
register int i = 0; \
|
|
while (1) { \
|
|
if (car(iNames) == iv) { \
|
|
ce->iNames = objptr->iNames; \
|
|
ce->iv = iv; \
|
|
ce->index = SMALLP_FROM_POSINT(i); \
|
|
(dest) = i; \
|
|
break; \
|
|
} else { \
|
|
i++; \
|
|
if ((iNames = cdr(iNames)) == NIL_PTR) { otherwise; } \
|
|
} \
|
|
} \
|
|
} \
|
|
} \
|
|
}
|
|
|
|
struct LCClass { /* class datatype */
|
|
LispPTR metaClass, ivNames, ivDescrs, classUnitRec, localIVs, cvNames, cvDescrs, className,
|
|
supers, subClasses, otherClassDescription, selectors, methods, localSupers;
|
|
};
|
|
|
|
struct LCInstance { /* instance datatype */
|
|
LispPTR class, iNames, iDescrs, instMiscField;
|
|
};
|
|
|
|
struct LCMethodCacheEntry {
|
|
LispPTR class, selector, method_fn, junk;
|
|
} * LCMethodCache;
|
|
|
|
struct LCIVCacheEntry {
|
|
LispPTR iNames, iv, index, junk;
|
|
} * LCIVCache;
|
|
|
|
LispPTR atom_instance = 0, /* various atom indices */
|
|
atom_class, atom_annotatedValue, atom_FetchMethodOrHelp_LCUFN, atom_FetchMethod_LCUFN,
|
|
atom_FindVarIndex_LCUFN, atom_GetIVValue_LCUFN, atom_PutIVValue_LCUFN;
|
|
|
|
/* Called once to initialize the "constants" above */
|
|
|
|
LispPTR LCinit(void) {
|
|
atom_instance = GET_IL_ATOM("instance");
|
|
atom_class = GET_IL_ATOM("class");
|
|
atom_annotatedValue = GET_IL_ATOM("annotatedValue");
|
|
atom_FetchMethodOrHelp_LCUFN = GET_IL_ATOM("\\FetchMethodOrHelp-LCUFN");
|
|
atom_FetchMethod_LCUFN = GET_IL_ATOM("\\FetchMethod-LCUFN");
|
|
atom_FindVarIndex_LCUFN = GET_IL_ATOM("\\FindVarIndex-LCUFN");
|
|
atom_GetIVValue_LCUFN = GET_IL_ATOM("\\GetIVValue-LCUFN");
|
|
atom_PutIVValue_LCUFN = GET_IL_ATOM("\\PutIVValue-LCUFN");
|
|
LCMethodCache = (struct LCMethodCacheEntry *)AtomValPtr(GET_IL_ATOM("*Global-Method-Cache*"));
|
|
LCIVCache = (struct LCIVCacheEntry *)AtomValPtr(GET_IL_ATOM("*Global-IV-Cache-Block*"));
|
|
return NIL_PTR; /* in case called from lisp */
|
|
}
|
|
|
|
/* Type check fn */
|
|
/* We only check for instance and class, neither of which has supertypes,
|
|
so the loop is unnecessary. */
|
|
/* * * NOT USED * * */
|
|
#ifdef NEVER
|
|
int LCTypeOf(LispPTR thing, LispPTR typename)
|
|
{
|
|
register struct dtd *dtd68k;
|
|
#ifdef BIGVM
|
|
for (dtd68k = (struct dtd *)GetDTD(GetTypeNumber(thing)); typename != (dtd68k->dtd_name);
|
|
dtd68k = (struct dtd *)GetDTD(dtd68k->dtd_supertype)) {
|
|
if (dtd68k->dtd_supertype == 0) return 0;
|
|
}
|
|
#else
|
|
for (dtd68k = (struct dtd *)GetDTD(GetTypeNumber(thing));
|
|
typename != dtd68k->dtd_namelo + (dtgd68k->dtd_namehi << 16);
|
|
dtd68k = (struct dtd *)GetDTD(dtd68k->dtd_supertype)) {
|
|
if (dtd68k->dtd_supertype == 0) return 0;
|
|
}
|
|
#endif /* BIGVM */
|
|
return 1;
|
|
}
|
|
#endif /* NEVER */
|
|
|
|
/* Method lookup using global cache */
|
|
|
|
LispPTR LCFetchMethodOrHelp(register LispPTR object, register LispPTR selector) {
|
|
register struct LCInstance *objptr;
|
|
register struct LCMethodCacheEntry *ce;
|
|
register LispPTR cur_class;
|
|
|
|
LC_INIT;
|
|
|
|
INSTANCE_CLASS_OR_PUNT(object, atom_FetchMethodOrHelp_LCUFN, 2);
|
|
|
|
objptr = (struct LCInstance *)Addr68k_from_LADDR(object);
|
|
ce = &(LCMethodCache[METH_CACHE_INDEX((cur_class = objptr->class), selector)]);
|
|
if (ce->class == cur_class && ce->selector == selector) return ce->method_fn;
|
|
|
|
/* not in cache, search class then supers */
|
|
{
|
|
LispPTR supers = ((struct LCClass *)Addr68k_from_LADDR(cur_class))->supers;
|
|
|
|
for (;;) {
|
|
register int i = 0;
|
|
register LispPTR val;
|
|
register LispPTR *selectorptr;
|
|
register struct LCClass *classptr;
|
|
|
|
classptr = (struct LCClass *)Addr68k_from_LADDR(cur_class);
|
|
if (classptr->selectors == NIL_PTR) {
|
|
goto next_class;
|
|
} else {
|
|
selectorptr = (LispPTR *)Addr68k_from_LADDR(classptr->selectors);
|
|
}
|
|
|
|
while ((val = selectorptr[i++]) != NIL_PTR) {
|
|
if (val == selector) {
|
|
ce->class = objptr->class;
|
|
ce->selector = selector;
|
|
return (ce->method_fn = ((LispPTR *)Addr68k_from_LADDR(classptr->methods))[i - 1]);
|
|
}
|
|
};
|
|
|
|
next_class:
|
|
if ((cur_class = car(supers)) == NIL_PTR) break;
|
|
supers = cdr(supers);
|
|
}
|
|
}
|
|
|
|
/* we didn't find it at all; punt */
|
|
RETCALL(atom_FetchMethodOrHelp_LCUFN, 2);
|
|
|
|
/* return lcfuncall(atom_FetchMethodOrHelp_LCUFN,2,3); */
|
|
/* return PUNT;*/
|
|
}
|
|
|
|
LispPTR LCFetchMethod(register LispPTR class, register LispPTR selector) {
|
|
register struct LCMethodCacheEntry *ce;
|
|
|
|
LC_INIT;
|
|
|
|
/* Check cache before doing type check */
|
|
ce = &(LCMethodCache[METH_CACHE_INDEX(class, selector)]);
|
|
if (ce->class == class && ce->selector == selector) return ce->method_fn;
|
|
|
|
/* it wasn't there, go search class then supers */
|
|
|
|
if (!LC_TYPEP(class, atom_class)) RETCALL(atom_FetchMethod_LCUFN, 2);
|
|
{
|
|
register LispPTR cur_class = class;
|
|
LispPTR supers = ((struct LCClass *)Addr68k_from_LADDR(cur_class))->supers;
|
|
|
|
for (;;) {
|
|
register int i = 0;
|
|
register LispPTR val;
|
|
register struct LCClass *classptr;
|
|
register LispPTR *selectorptr;
|
|
|
|
classptr = (struct LCClass *)Addr68k_from_LADDR(cur_class);
|
|
if (classptr->selectors == NIL_PTR)
|
|
goto next_class;
|
|
else
|
|
selectorptr = (LispPTR *)Addr68k_from_LADDR(classptr->selectors);
|
|
|
|
while ((val = selectorptr[i++]) != NIL_PTR) {
|
|
if (val == selector) {
|
|
ce->class = class;
|
|
ce->selector = selector;
|
|
return (ce->method_fn = ((LispPTR *)Addr68k_from_LADDR(classptr->methods))[i - 1]);
|
|
}
|
|
};
|
|
|
|
next_class:
|
|
if ((cur_class = car(supers)) == NIL_PTR) break;
|
|
supers = cdr(supers);
|
|
}
|
|
}
|
|
|
|
/* we didn't find it at all; return NIL */
|
|
return NIL_PTR;
|
|
}
|
|
|
|
LispPTR LCFindVarIndex(register LispPTR iv, register LispPTR object) {
|
|
register struct LCInstance *objptr;
|
|
register struct LCIVCacheEntry *ce;
|
|
register LispPTR iNames;
|
|
|
|
LC_INIT;
|
|
|
|
INSTANCE_CLASS_OR_PUNT(object, atom_FindVarIndex_LCUFN, 2);
|
|
|
|
objptr = (struct LCInstance *)Addr68k_from_LADDR(object);
|
|
ce = &(LCIVCache[IV_CACHE_INDEX((iNames = objptr->iNames), iv)]);
|
|
if (ce->iNames == iNames && ce->iv == iv) return ce->index;
|
|
|
|
if (!Listp(iNames)) return NIL_PTR; /* FastFindIndex lisp macro (& others?) */
|
|
/* needs this check too ! */
|
|
{
|
|
register int i;
|
|
|
|
for (i = 0; (iNames = cdr(iNames)) != NIL_PTR; i++) {
|
|
if (car(iNames) == iv) {
|
|
ce->iNames = objptr->iNames;
|
|
ce->iv = iv;
|
|
return (ce->index = SMALLP_FROM_POSINT(i));
|
|
}
|
|
}
|
|
return NIL_PTR;
|
|
}
|
|
}
|
|
|
|
#if 01
|
|
|
|
LispPTR LCGetIVValue(register LispPTR object, register LispPTR iv) {
|
|
register struct LCInstance *objptr;
|
|
register LispPTR val;
|
|
register int index;
|
|
|
|
LC_INIT;
|
|
INSTANCE_OR_PUNT(object, atom_GetIVValue_LCUFN, 2);
|
|
|
|
objptr = (struct LCInstance *)Addr68k_from_LADDR(object);
|
|
GET_IV_INDEX(objptr, iv, index, goto pnut);
|
|
val = ((LispPTR *)Addr68k_from_LADDR(objptr->iDescrs))[index];
|
|
if (!LC_TYPEP(val, atom_annotatedValue)) return val;
|
|
pnut:
|
|
RETCALL(atom_GetIVValue_LCUFN, 2);
|
|
/*
|
|
return LCGetActiveValue(object,val);
|
|
*/
|
|
}
|
|
|
|
LispPTR LCPutIVValue(register LispPTR object, register LispPTR iv, register LispPTR val) {
|
|
register struct LCInstance *objptr;
|
|
register LispPTR *valptr;
|
|
register int index;
|
|
|
|
LC_INIT;
|
|
INSTANCE_OR_PUNT(object, atom_PutIVValue_LCUFN, 3);
|
|
|
|
objptr = (struct LCInstance *)Addr68k_from_LADDR(object);
|
|
GET_IV_INDEX(objptr, iv, index, goto pnut);
|
|
valptr = &(((LispPTR *)Addr68k_from_LADDR(objptr->iDescrs))[index]);
|
|
if (!LC_TYPEP(*valptr, atom_annotatedValue)) {
|
|
FRPLPTR((*valptr), val);
|
|
return val;
|
|
}
|
|
pnut:
|
|
RETCALL(atom_PutIVValue_LCUFN, 3);
|
|
/*
|
|
return LCPutActiveValue(object,*valptr,val);
|
|
*/
|
|
}
|
|
|
|
#endif
|
|
|
|
LispPTR lcfuncall(register unsigned int atom_index, register int argnum, register int bytenum)
|
|
/* Atomindex for Function to invoke */
|
|
/* Number of ARGS on TOS and STK */
|
|
/* Number of bytes of Caller's
|
|
OPCODE(including multi-byte) */
|
|
{
|
|
register struct definition_cell *defcell68k; /* Definition Cell PTR */
|
|
register short pv_num; /* scratch for pv */
|
|
register struct fnhead *tmp_fn;
|
|
int rest; /* use for arignments */
|
|
register CClosure *closure68k;
|
|
|
|
if (atom_index == 0xffffffff) error("Loops punt to nonexistant fn");
|
|
|
|
/* Get Next Block offset from argnum */
|
|
CURRENTFX->nextblock = (LADDR_from_68k(CurrentStackPTR) & 0x0ffff) - (argnum << 1) + 4 /* +3 */;
|
|
|
|
/* Setup IVar */
|
|
IVar = Addr68k_from_LADDR((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET));
|
|
|
|
/* Set PC to the Next Instruction and save into FX */
|
|
CURRENTFX->pc = ((UNSIGNED)PC - (UNSIGNED)FuncObj) + bytenum;
|
|
|
|
PushCStack; /* save TOS */
|
|
|
|
/* Get DEFCELL 68k address */
|
|
defcell68k = (struct definition_cell *)GetDEFCELL68k(atom_index);
|
|
|
|
tmp_fn = (struct fnhead *)Addr68k_from_LADDR(defcell68k->defpointer);
|
|
|
|
if ((UNSIGNED)(CurrentStackPTR + tmp_fn->stkmin + STK_SAFE) >= (UNSIGNED)EndSTKP) {
|
|
LispPTR test;
|
|
test = *((LispPTR *)CurrentStackPTR);
|
|
/* DOSTACKOVERFLOW(argnum,bytenum-1); XXX until we figure out what should be happening */
|
|
S_CHECK(test == *((LispPTR *)CurrentStackPTR), "overflow in ccfuncall");
|
|
}
|
|
FuncObj = tmp_fn;
|
|
|
|
if (FuncObj->na >= 0) {
|
|
/* This Function is Spread Type */
|
|
/* Arguments on Stack Adjustment */
|
|
rest = argnum - FuncObj->na;
|
|
|
|
while (rest < 0) {
|
|
PushStack(NIL_PTR);
|
|
rest++;
|
|
}
|
|
CurrentStackPTR -= (rest << 1);
|
|
} /* if end */
|
|
|
|
/* Set up BF */
|
|
CurrentStackPTR += 2;
|
|
GETWORD(CurrentStackPTR) = BF_MARK;
|
|
GETWORD(CurrentStackPTR + 1) = CURRENTFX->nextblock;
|
|
CurrentStackPTR += 2;
|
|
|
|
/* Set up FX */
|
|
GETWORD(CurrentStackPTR) = FX_MARK;
|
|
|
|
/* Now SET new FX */
|
|
((struct frameex1 *)CurrentStackPTR)->alink = LADDR_from_68k(PVar);
|
|
PVar = (DLword *)CurrentStackPTR + FRAMESIZE;
|
|
#ifdef BIGVM
|
|
((struct frameex1 *)CurrentStackPTR)->fnheader = (defcell68k->defpointer);
|
|
#else
|
|
((struct frameex1 *)CurrentStackPTR)->lofnheader = (defcell68k->defpointer) & 0x0ffff;
|
|
((struct frameex1 *)CurrentStackPTR)->hi2fnheader = ((defcell68k->defpointer) & SEGMASK) >> 16;
|
|
((struct frameex1 *)CurrentStackPTR)->hi1fnheader = 0;
|
|
#endif /* BIGVM */
|
|
|
|
CurrentStackPTR = PVar;
|
|
|
|
/* Set up PVar area */
|
|
pv_num = FuncObj->pv + 1; /* Changed Apr.27 */
|
|
|
|
while (pv_num > 0) {
|
|
*((LispPTR *)CurrentStackPTR) = 0x0ffff0000;
|
|
CurrentStackPTR += DLWORDSPER_CELL;
|
|
*((LispPTR *)CurrentStackPTR) = 0x0ffff0000;
|
|
CurrentStackPTR += DLWORDSPER_CELL;
|
|
pv_num--;
|
|
}
|
|
|
|
/* Set PC points New Function's first OPCODE */
|
|
PC = (ByteCode *)FuncObj + FuncObj->startpc;
|
|
|
|
return -2; /* signal to OP_miscn to leave stack & pc alone */
|
|
} /* end lcfuncall */
|