mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-22 10:21:30 +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
636 lines
18 KiB
Plaintext
Executable File
636 lines
18 KiB
Plaintext
Executable File
/* $Id: lispemul.h,v 1.3 1999/01/03 02:06:08 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* (C) Copyright 1989-1995 Venue. All Rights Reserved. */
|
|
/* Manufactured in the United States of America. */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef BYTESWAP
|
|
/*** Normal byte-order type decls */
|
|
typedef struct {unsigned char code;} BYTECODE;
|
|
typedef char ByteCode;
|
|
typedef unsigned short DLword;
|
|
typedef char DLbyte;
|
|
typedef unsigned int LispPTR;
|
|
/* 32 bit Cell Chang. 14 Jan 87 take */
|
|
typedef DLword mds_page; /* Top word of the MDS */
|
|
typedef (*CFuncPTR)();
|
|
|
|
#ifdef BIGVM
|
|
typedef struct consstr
|
|
{
|
|
unsigned cdr_code : 4;
|
|
unsigned car_field : 28;
|
|
} ConsCell;
|
|
|
|
typedef struct ufn_entry
|
|
{
|
|
DLword atom_name; /* UFN's atomindex */
|
|
unsigned byte_num : 8; /* num of byte code */
|
|
unsigned arg_num : 8; /* num of argments */
|
|
} UFN;
|
|
|
|
typedef struct closure_type
|
|
{
|
|
unsigned nil1 : 4;
|
|
unsigned def_ptr : 28; /* LispPTR to definition cell */
|
|
unsigned nil2 : 4;
|
|
unsigned env_ptr : 28; /* LispPTR to environment */
|
|
} Closure;
|
|
|
|
#else /* not BIGVM */
|
|
typedef struct consstr
|
|
{
|
|
unsigned cdr_code : 8;
|
|
unsigned car_field : 24;
|
|
} ConsCell;
|
|
|
|
typedef struct ufn_entry
|
|
{
|
|
DLword atom_name; /* UFN's atomindex */
|
|
unsigned byte_num : 8; /* num of byte code */
|
|
unsigned arg_num : 8; /* num of argments */
|
|
} UFN;
|
|
|
|
typedef struct closure_type
|
|
{
|
|
unsigned nil1 : 8;
|
|
unsigned def_ptr : 24; /* LispPTR to definition cell */
|
|
unsigned nil2 : 8;
|
|
unsigned env_ptr : 24; /* LispPTR to environment */
|
|
} Closure;
|
|
#endif /* BIGVM */
|
|
|
|
typedef struct interrupt_state
|
|
{ /* Interrupt-request mask to communicate with INTERRUPTED */
|
|
unsigned LogFileIO :1; /* console msg arrived to print */
|
|
unsigned ETHERInterrupt :1; /* 10MB activity happened */
|
|
unsigned IOInterrupt :1; /* I/O happened (not used yet) */
|
|
unsigned gcdisabled :1;
|
|
unsigned vmemfull :1;
|
|
unsigned stackoverflow :1;
|
|
unsigned storagefull :1;
|
|
unsigned waitinginterrupt :1;
|
|
unsigned nil :8; /* mask of ints being processes */
|
|
DLword intcharcode;
|
|
} INTSTAT;
|
|
|
|
typedef struct interrupt_state_2
|
|
{ /* alternate view of the interrupt state */
|
|
unsigned pendingmask :8;
|
|
unsigned handledmask :8;
|
|
DLword nil;
|
|
} INTSTAT2;
|
|
|
|
struct state
|
|
{
|
|
DLword *ivar; /* + 0 */
|
|
DLword *pvar; /* + 4 */
|
|
DLword *csp; /* + 8 */
|
|
LispPTR tosvalue; /* + 12 */
|
|
ByteCode *currentpc; /* + 16 */
|
|
struct fnhead *currentfunc; /* + 20*/
|
|
DLword *endofstack; /* + 24*/
|
|
UNSIGNED irqcheck; /* + 28 */
|
|
UNSIGNED irqend; /* + 32 */
|
|
LispPTR scratch_cstk; /* + 34 */
|
|
int errorexit; /* + 38 */
|
|
};
|
|
|
|
/***** Get_DLword(ptr) ptr is char* ***/
|
|
#ifndef UNALIGNED_FETCH_OK
|
|
#define Get_DLword(ptr) ((Get_BYTE(ptr) <<8) | Get_BYTE(ptr+1))
|
|
#else
|
|
#define Get_DLword(ptr) *(((DLword *)WORDPTR(ptr)))
|
|
#endif
|
|
|
|
#ifdef BIGVM
|
|
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 24) | \
|
|
(Get_BYTE(ptr+1) << 16) | \
|
|
(Get_BYTE(ptr+2) << 8) | Get_BYTE(ptr+3))
|
|
#else
|
|
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 16) | \
|
|
(Get_BYTE(ptr+1) << 8) | \
|
|
Get_BYTE(ptr+2))
|
|
#endif /* BIGVM */
|
|
|
|
#define Get_code_BYTE Get_BYTE
|
|
#define Get_code_DLword Get_DLword
|
|
#define Get_code_AtomNo Get_AtomNo
|
|
#define Get_code_Pointer Get_Pointer
|
|
|
|
#ifdef BIGATOMS
|
|
#define Get_AtomNo(ptr) Get_Pointer(ptr)
|
|
#else
|
|
#define Get_AtomNo(ptr) Get_DLword(ptr)
|
|
#endif /* BIGATOMS */
|
|
|
|
|
|
/* For bit test */
|
|
typedef struct wbits
|
|
{
|
|
unsigned xMSB :1;
|
|
unsigned B1 :1;
|
|
unsigned B2 :1;
|
|
unsigned B3 :1;
|
|
unsigned B4 :1;
|
|
unsigned B5 :1;
|
|
unsigned B6 :1;
|
|
unsigned B7 :1;
|
|
unsigned B8 :1;
|
|
unsigned B9 :1;
|
|
unsigned B10 :1;
|
|
unsigned B11 :1;
|
|
unsigned B12 :1;
|
|
unsigned B13 :1;
|
|
unsigned B14 :1;
|
|
unsigned LSB :1;
|
|
}WBITS;
|
|
|
|
typedef struct lbits
|
|
{
|
|
unsigned xMSB :1;
|
|
unsigned MIDDLE :30;
|
|
unsigned LSB :1;
|
|
}LBITS;
|
|
|
|
#define PUTBASEBIT68K(base68k, offset, bitvalue ) { \
|
|
if( bitvalue) \
|
|
*((DLword*)(base68k) + (((u_short)(offset))>>4 )) \
|
|
|= 1 << (15 - ((u_short)(offset))%BITSPER_DLWORD); \
|
|
else \
|
|
*((DLword*)(base68k) + (((u_short)(offset))>>4 )) \
|
|
&= ~( 1 << (15 - ((u_short)(offset)) %BITSPER_DLWORD)); \
|
|
}
|
|
|
|
#else
|
|
/*** Byte-swapped structure declarations, for 80386 ***/
|
|
typedef struct {unsigned char code;} BYTECODE;
|
|
typedef char ByteCode;
|
|
typedef unsigned short DLword;
|
|
typedef char DLbyte;
|
|
typedef unsigned int LispPTR;
|
|
/* 32 bit Cell Chang. 14 Jan 87 take */
|
|
typedef DLword mds_page; /* Top word of the MDS */
|
|
typedef (*CFuncPTR)();
|
|
|
|
#ifdef BIGVM
|
|
typedef struct consstr
|
|
{
|
|
unsigned car_field : 28;
|
|
unsigned cdr_code : 4;
|
|
} ConsCell;
|
|
|
|
typedef struct ufn_entry
|
|
{
|
|
unsigned arg_num : 8; /* num of argments */
|
|
unsigned byte_num : 8; /* num of byte code */
|
|
DLword atom_name; /* UFN's atomindex */
|
|
} UFN;
|
|
|
|
typedef struct closure_type
|
|
{
|
|
unsigned def_ptr : 28; /* LispPTR to definition cell */
|
|
unsigned nil1 : 4;
|
|
unsigned env_ptr : 28; /* LispPTR to environment */
|
|
unsigned nil2 : 4;
|
|
} Closure;
|
|
#else /* BIGVM */
|
|
typedef struct consstr
|
|
{
|
|
unsigned car_field : 24;
|
|
unsigned cdr_code : 8;
|
|
} ConsCell;
|
|
|
|
typedef struct ufn_entry
|
|
{
|
|
unsigned arg_num : 8; /* num of argments */
|
|
unsigned byte_num : 8; /* num of byte code */
|
|
DLword atom_name; /* UFN's atomindex */
|
|
} UFN;
|
|
|
|
typedef struct closure_type
|
|
{
|
|
unsigned def_ptr : 24; /* LispPTR to definition cell */
|
|
unsigned nil1 : 8;
|
|
unsigned env_ptr : 24; /* LispPTR to environment */
|
|
unsigned nil2 : 8;
|
|
} Closure;
|
|
#endif /* BIGVM */
|
|
|
|
typedef struct interrupt_state
|
|
{ /* Interrupt-request mask to communicate with INTERRUPTED */
|
|
DLword intcharcode;
|
|
unsigned nil :8;
|
|
unsigned waitinginterrupt :1;
|
|
unsigned storagefull :1;
|
|
unsigned stackoverflow :1;
|
|
unsigned vmemfull :1;
|
|
unsigned gcdisabled :1;
|
|
unsigned IOInterrupt :1; /* I/O happened (not used yet) */
|
|
unsigned ETHERInterrupt :1; /* 10MB activity happened */
|
|
unsigned LogFileIO :1; /* console msg arrived to print */
|
|
} INTSTAT;
|
|
|
|
typedef struct interrupt_state_2
|
|
{ /* alternate view of the interrupt state */
|
|
DLword nil;
|
|
unsigned handledmask :8;
|
|
unsigned pendingmask :8;
|
|
} INTSTAT2;
|
|
|
|
|
|
struct state
|
|
{
|
|
DLword *ivar; /* + 0 */
|
|
DLword *pvar; /* + 4 */
|
|
DLword *csp; /* + 8 */
|
|
LispPTR tosvalue; /* + 12 */
|
|
ByteCode *currentpc; /* + 16 */
|
|
struct fnhead *currentfunc; /* + 20*/
|
|
DLword *endofstack; /* + 24*/
|
|
UNSIGNED irqcheck; /* + 28 */
|
|
UNSIGNED irqend; /* + 32 */
|
|
LispPTR scratch_cstk; /* + 34 */
|
|
int errorexit; /* + 38 */
|
|
};
|
|
|
|
/* Fetching 2 bytes to make a word -- always do it the hard way */
|
|
/* if we're byte-swapped: You can't rely on byte ordering!! */
|
|
#define Get_DLword(ptr) ((Get_BYTE(ptr) <<8) | Get_BYTE(ptr+1))
|
|
|
|
#ifdef BIGVM
|
|
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 24) | \
|
|
(Get_BYTE(ptr+1) << 16) | \
|
|
(Get_BYTE(ptr+2) << 8) | Get_BYTE(ptr+3))
|
|
#else
|
|
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 16) | \
|
|
(Get_BYTE(ptr+1) << 8) | \
|
|
Get_BYTE(ptr+2))
|
|
#endif /* BIGVM */
|
|
|
|
#ifndef RESWAPPEDCODESTREAM
|
|
#define Get_code_BYTE(ptr) Get_BYTE(ptr)
|
|
#define Get_code_AtomNo Get_AtomNo
|
|
#define Get_code_DLword Get_DLword
|
|
#else
|
|
#define Get_code_BYTE(ptr) (((BYTECODE *)(ptr))->code)
|
|
|
|
#define Get_code_Pointer(ptr) ((Get_code_BYTE(ptr) << 16) | \
|
|
(Get_code_BYTE(ptr+1) << 8) | \
|
|
Get_code_BYTE(ptr+2))
|
|
#define Get_code_DLword(ptr) ((Get_code_BYTE(ptr) << 8) | Get_code_BYTE(ptr+1))
|
|
#define Get_code_AtomNo Get_code_Pointer
|
|
#endif /* RESWAPPEDCODESTREAM */
|
|
|
|
|
|
#ifdef BIGATOMS
|
|
#define Get_AtomNo(ptr) Get_Pointer(ptr)
|
|
#else
|
|
#define Get_AtomNo(ptr) Get_DLword(ptr)
|
|
#endif /* BIGATOMS */
|
|
|
|
|
|
/* For bit test */
|
|
typedef struct wbits
|
|
{
|
|
USHORT LSB :1;
|
|
USHORT B14 :1;
|
|
USHORT B13 :1;
|
|
USHORT B12 :1;
|
|
USHORT B11 :1;
|
|
USHORT B10 :1;
|
|
USHORT B9 :1;
|
|
USHORT B8 :1;
|
|
USHORT B7 :1;
|
|
USHORT B6 :1;
|
|
USHORT B5 :1;
|
|
USHORT B4 :1;
|
|
USHORT B3 :1;
|
|
USHORT B2 :1;
|
|
USHORT B1 :1;
|
|
USHORT xMSB :1;
|
|
} WBITS;
|
|
|
|
typedef struct lbits
|
|
{
|
|
unsigned LSB :1;
|
|
unsigned MIDDLE :30;
|
|
unsigned xMSB :1; /* xMSB b/c HPUX defined MSB in a header */
|
|
} LBITS;
|
|
|
|
#define PUTBASEBIT68K(base68k, offset, bitvalue ) { \
|
|
UNSIGNED real68kbase; \
|
|
real68kbase = 2 ^ ((UNSIGNED)(base68k)); \
|
|
if( bitvalue) \
|
|
(* (DLword *) (2^(UNSIGNED)((DLword*)(real68kbase) + (((u_short)(offset))>>4 )))) \
|
|
|= 1 << (15 - ((u_short)(offset))%BITSPER_DLWORD); \
|
|
else \
|
|
(* (DLword *) (2^(UNSIGNED)((DLword*)(real68kbase) + (((u_short)(offset))>>4 )))) \
|
|
&= ~( 1 << (15 - ((u_short)(offset)) %BITSPER_DLWORD)); \
|
|
}
|
|
|
|
#endif /* BYTESWAP */
|
|
|
|
|
|
|
|
/* Because a WBITS is only 1 word long, need byte-swapped */
|
|
/* access to it. Use WBITSPTR(x) instead of ((WBITS *) x) */
|
|
|
|
#define WBITSPTR(ptr) ((WBITS *) WORDPTR(ptr))
|
|
|
|
|
|
extern struct state MachineState;
|
|
|
|
#define MState (&MachineState)
|
|
#define CURRENTFX ((struct frameex1 *)(((DLword *) PVar) - FRAMESIZE))
|
|
#define IVar (MState->ivar)
|
|
#define PVar (MState->pvar)
|
|
#define CurrentStackPTR (MState->csp)
|
|
#define TopOfStack (MState->tosvalue)
|
|
#define PC (MState->currentpc)
|
|
#define FuncObj (MState->currentfunc)
|
|
#define EndSTKP (MState->endofstack)
|
|
#define Irq_Stk_Check (MState->irqcheck)
|
|
#define Irq_Stk_End (MState->irqend)
|
|
#define Scratch_CSTK (MState->scratch_cstk)
|
|
#define Error_Exit (MState->errorexit)
|
|
|
|
/* Typedef for IFPAGE */
|
|
#include "ifpage.h"
|
|
|
|
/* Typedef for IOPAGE */
|
|
#include "iopage.h"
|
|
|
|
|
|
/* Typedef for MISCSTAT */
|
|
#include "miscstat.h"
|
|
|
|
/****************************************************
|
|
MakeAddr:
|
|
base: DLword*
|
|
offset: word offset from base
|
|
return: DLword*
|
|
****************************************************/
|
|
#define MakeAddr(base, offset) ((DLword *)(base + (int)offset))
|
|
|
|
|
|
/****************************************************
|
|
GetHiWord:
|
|
*****************************************************/
|
|
#define GetHiWord(x) ((DLword)((x)>>16))
|
|
|
|
/****************************************************
|
|
GetLoWord:
|
|
*****************************************************/
|
|
#define GetLoWord(x) ((DLword)(x))
|
|
|
|
/****************************************************
|
|
GetLongWord:
|
|
address: DLword*
|
|
retrun: int
|
|
*****************************************************/
|
|
#define GetLongWord(address) (*((LispPTR *) (address)))
|
|
|
|
|
|
/****************************************************
|
|
PopCStack:
|
|
#define PopCStack {TopOfStack = *((LispPTR *)(--CurrentStackPTR)); --CurrentStackPTR;}
|
|
*****************************************************/
|
|
#define PopCStack {TopOfStack = *((LispPTR *)(CurrentStackPTR)); CurrentStackPTR -= 2;}
|
|
|
|
/****************************************************
|
|
PopStackTo: CSTK -> Place
|
|
#define PopStackTo(Place) {Place= *((LispPTR *)(--CurrentStackPTR)); CurrentStackPTR--; }
|
|
*****************************************************/
|
|
#define PopStackTo(Place) {Place= *((LispPTR *)(CurrentStackPTR)); CurrentStackPTR -= 2; }
|
|
|
|
/****************************************************
|
|
PushCStack:
|
|
#define PushCStack {*((int *)(++CurrentStackPTR)) = TopOfStack; ++CurrentStackPTR;}
|
|
*****************************************************/
|
|
#define PushCStack {CurrentStackPTR += 2;*((LispPTR *)(CurrentStackPTR)) = TopOfStack; }
|
|
|
|
/****************************************************
|
|
PushStack:
|
|
#define PushStack(x) {*((LispPTR *)(++CurrentStackPTR))=x;CurrentStackPTR++;}
|
|
*****************************************************/
|
|
#define PushStack(x) {CurrentStackPTR += 2;*((LispPTR *)(CurrentStackPTR))=x;}
|
|
|
|
/****************************************************
|
|
SmashStack:
|
|
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR-1))=x)
|
|
*****************************************************/
|
|
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR))=x)
|
|
|
|
/*********************************************************
|
|
Get_BYTE(byteptr) byteptr: pointer to 8 bit data
|
|
**********************************************************/
|
|
/***** OLD definition ************* 13 Nov 1987 takeshi ***
|
|
#define Get_BYTE(byteptr) (((unsigned)(*(byteptr))) & 0xff)
|
|
**********************************************/
|
|
#define Get_BYTE(byteptr) (((BYTECODE *)BYTEPTR(byteptr))->code)
|
|
|
|
/**********************************************************
|
|
DOSTACKOVERFLOW(argnum,bytenum) if it needs hardreturn-cleanup
|
|
then upnt to contextsw and immediately return
|
|
**********************************************************/
|
|
#define DOSTACKOVERFLOW(argnum,bytenum) { \
|
|
if(do_stackoverflow(T)) \
|
|
{ PushStack(S_POSITIVE | argnum); \
|
|
contextsw(SubovFXP,bytenum,1); \
|
|
return;\
|
|
} \
|
|
}
|
|
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* E X T E R N A L F U N C T I O N S */
|
|
/* */
|
|
/* Declare all functions that will default incorrectly under */
|
|
/* normal C inference rules. These functions are the ones */
|
|
/* that return pointers, because on DEC Alpha, a pointer is 8 */
|
|
/* bytes--but the default fn decl is int, a 4-byte return. */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
extern DLword *createcell68k();
|
|
extern LispPTR *alloc_mdspage();
|
|
extern UNSIGNED N_OP_unwind();
|
|
extern char *getenv();
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* E R R O R & T I M E R P U N T C A S E S */
|
|
/* */
|
|
/* Set up the top-of-stack so we can continue gracefully after */
|
|
/* handling the timer interrupt (e.g., FMEMB, which walks down */
|
|
/* the list being searched, pushes its current state on TOS */
|
|
/* so that it picks up where it left off after the interrupt. */
|
|
/* */
|
|
/* Call Interface where neg number indicates an error return */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
#define ERROR_EXIT(tos) {TopOfStack=tos; Error_Exit = 1; return(-1);}
|
|
#ifdef ISC
|
|
#define INLINE_ERROR_EXIT(tos,retlbl) {TopOfStack=tos; Error_Exit=1 asm("movl $-1,%0\n" retlbl ":" : "=g" (result) : "0" (result)); return(result); }
|
|
#endif
|
|
|
|
#define TIMER_EXIT(tos) {TopOfStack=tos; Error_Exit = 1; return(-2);}
|
|
|
|
|
|
#define WARN(message,operation) {warn(message);operation;return;}
|
|
#define NO_WOP {}
|
|
|
|
#define NIL 0 /* added 29-jan */
|
|
#define T 1
|
|
#define ATOM_T 0114 /* T's AtomIndex Number 114Q */
|
|
|
|
#define NIL_PTR 0 /* from cell.h 24-mar-87 take */
|
|
#define NOBIND_PTR 1
|
|
|
|
#define STKLIM 0x1FFFF
|
|
#define FRAMESIZE 10 /* size of frameex1: 10 words */
|
|
#define FNHEADSIZE 8 /* size of fnhead: 8 words */
|
|
#define BFSIZE 2 /* size of basci frame pointer: 2 words */
|
|
|
|
#define BITSPER_DLWORD 16
|
|
#define BITSPER_CELL 32
|
|
#define BYTESPER_DLWORD 2
|
|
#define BYTESPER_CELL 4
|
|
#define BYTESPER_QUAD 8
|
|
#define BYTESPER_PAGE 512
|
|
#define CELLSPER_QUAD 2
|
|
#define CELLSPER_PAGE 128
|
|
#define CELLSPER_SEGMENT 32768
|
|
#define DLWORDSPER_CELL 2
|
|
#define DLWORDSPER_QUAD 4
|
|
#define DLWORDSPER_PAGE 256
|
|
#define DLWORDSPER_SEGMENT 65536
|
|
#define PAGESPER_SEGMENT 256
|
|
#define PAGESPER_MDSUNIT 2
|
|
#define MDSINCREMENT 512
|
|
|
|
#define GUARDSTORAGEFULL 128
|
|
#define GUARD1STORAGEFULL 64
|
|
|
|
#define SFS_NOTSWITCHABLE 1
|
|
#define SFS_SWITCHABLE 2
|
|
#define SFS_ARRAYSWITCHED 3
|
|
#define SFS_FULLYSWITCHED 4
|
|
|
|
|
|
#define AtomHTSIZE 256 * DLWORDSPER_PAGE
|
|
|
|
#define MAXPNCHARS 255 /* Maximam length of PnChars */
|
|
|
|
#define GET_NATIVE_ADDR(fnobject) \
|
|
*((int *) ((UNSIGNED)fnobject + fnobject->startpc - 4))
|
|
|
|
|
|
#define FALSE 0
|
|
#define TRUE !FALSE
|
|
|
|
typedef unsigned int boolean;
|
|
|
|
|
|
/************************************************************************/
|
|
/* Define sizes of FN and FNX opcodes; depends on atom size */
|
|
/************************************************************************/
|
|
|
|
#ifdef BIGVM
|
|
#define FN_OPCODE_SIZE 5
|
|
#define FNX_OPCODE_SIZE 6
|
|
#elif defined(BIGATOMS)
|
|
#define FN_OPCODE_SIZE 4
|
|
#define FNX_OPCODE_SIZE 5
|
|
#else
|
|
#define FN_OPCODE_SIZE 3
|
|
#define FNX_OPCODE_SIZE 4
|
|
#endif /* BIGATOMS */
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* Definitions for "NEW" Symbols */
|
|
/* */
|
|
/* Offsets within the "New symbols that go with 3-byte atoms. */
|
|
/* */
|
|
/************************************************************************/
|
|
#ifdef BIGATOMS
|
|
|
|
typedef struct newatom
|
|
{
|
|
LispPTR na_pname; /* Pointer to the print name */
|
|
LispPTR na_value; /* The value cell */
|
|
LispPTR na_defn; /* The definition cell */
|
|
LispPTR na_plist; /* The property list */
|
|
LispPTR na_flags; /* flags from other cells, to make BIGVM work ok */
|
|
} NEWATOM;
|
|
|
|
/* Offsets, in WORDS, from the start of the NEWATOM structure */
|
|
#define NEWATOM_PNAME_OFFSET 0
|
|
#define NEWATOM_VALUE_OFFSET 2
|
|
#define NEWATOM_DEFN_OFFSET 4
|
|
#define NEWATOM_PLIST_OFFSET 6
|
|
|
|
|
|
/* Offsets, in cells from start of the NEWATOM structure */
|
|
#define NEWATOM_PNAME_PTROFF 0
|
|
#define NEWATOM_VALUE_PTROFF 1
|
|
#define NEWATOM_DEFN_PTROFF 2
|
|
#define NEWATOM_PLIST_PTROFF 3
|
|
#endif
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* Mask to mask off relevant bits in a pointer. */
|
|
/* */
|
|
/************************************************************************/
|
|
#ifdef BIGVM
|
|
#define POINTERMASK 0xfffffff
|
|
#define SEGMASK 0xfff0000
|
|
#define PAGEMASK 0xfffff00
|
|
#else
|
|
#define POINTERMASK 0xffffff
|
|
#define SEGMASK 0xff0000
|
|
#define PAGEMASK 0xffff00
|
|
#endif /* BIGVM */
|
|
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* F P t o V P M a n i p u l a t i o n */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
|
|
#ifdef BIGVM
|
|
#define GETFPTOVP(b,o) b[o]
|
|
#define GETPAGEOK(b,o) (b[o]>>16)
|
|
#else
|
|
#define GETFPTOVP GETWORDBASEWORD
|
|
#define GETPAGEOK GETWORDBASEWORD
|
|
#endif
|