1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-17 16:44:00 +00:00

Reformat (with clang-format 10.0) some header files (#344)

...in preparation for editing macro definitions to wrap in do {} while (0)
or other adjustment to make them complete statements without unnecessary
semicolons.

This programmatic reformatting should not introduce any functional changes.
This commit is contained in:
Nick Briggs 2021-02-10 16:44:37 -08:00 committed by GitHub
parent c9a0d441c4
commit 7274e16b24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2341 additions and 2253 deletions

View File

@ -1,10 +1,6 @@
#ifndef ARITH_H
#define ARITH_H 1
/* $Id: arith.h,v 1.2 1999/01/03 02:05:52 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* $Id: arith.h,v 1.2 1999/01/03 02:05:52 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
@ -13,168 +9,151 @@
/* */
/************************************************************************/
#define MAX_SMALL 65535 /* == 0x0000FFFF */
#define MIN_SMALL -65536 /* == 0xFFFF0000 */
#define MAX_SMALL 65535 /* == 0x0000FFFF */
#define MIN_SMALL -65536 /* == 0xFFFF0000 */
#define MAX_FIXP 2147483647 /* == 0x7FFFFFFF */
#define MIN_FIXP -2147483648 /* == 0x80000000 */
#define MAX_FIXP 2147483647 /* == 0x7FFFFFFF */
#define MIN_FIXP -2147483648 /* == 0x80000000 */
#define GetSmalldata(x) (((SEGMASK & x)==S_POSITIVE) ? (0xFFFF & x) : (((SEGMASK & x)==S_NEGATIVE) ? (0xFFFF0000 | x) : error("Not smallp address")))
#define GetSmallp(x) ((0xFFFF0000 & x) ? (((0xFFFF0000 & x)==0xFFFF0000) ? (S_NEGATIVE | (0xFFFF & x)) : error("Not Smallp data") ) : (S_POSITIVE | (0xFFFF & x)))
#define GetSmalldata(x) \
(((SEGMASK & x) == S_POSITIVE) \
? (0xFFFF & x) \
: (((SEGMASK & x) == S_NEGATIVE) ? (0xFFFF0000 | x) : error("Not smallp address")))
#define GetSmallp(x) \
((0xFFFF0000 & x) ? (((0xFFFF0000 & x) == 0xFFFF0000) ? (S_NEGATIVE | (0xFFFF & x)) \
: error("Not Smallp data")) \
: (S_POSITIVE | (0xFFFF & x)))
#define FIXP_VALUE(dest) *((int *)Addr68k_from_LADDR(dest))
#define FLOATP_VALUE(dest) *((float *)Addr68k_from_LADDR(dest))
#define N_GETNUMBER(sour, dest, label) \
{ dest = sour; /* access memory once */ \
switch(SEGMASK & dest){ \
case S_POSITIVE: \
dest = 0xFFFF & (dest); \
break; \
case S_NEGATIVE: \
dest = 0xFFFF0000 | (dest); \
break; \
default: \
if (GetTypeNumber( dest ) != TYPE_FIXP) \
{ goto label; } \
dest = FIXP_VALUE(dest); \
} \
}
#define N_GETNUMBER(sour, dest, label) \
{ \
dest = sour; /* access memory once */ \
switch (SEGMASK & dest) { \
case S_POSITIVE: dest = 0xFFFF & (dest); break; \
case S_NEGATIVE: dest = 0xFFFF0000 | (dest); break; \
default: \
if (GetTypeNumber(dest) != TYPE_FIXP) { goto label; } \
dest = FIXP_VALUE(dest); \
} \
}
#define N_IGETNUMBER(sour, dest, label) \
{ dest = sour; /* access memory once */ \
switch(SEGMASK & dest){ \
case S_POSITIVE: \
dest = 0xFFFF & dest; \
break; \
case S_NEGATIVE: \
dest = 0xFFFF0000 | dest; \
break; \
default: \
switch (GetTypeNumber( dest )) { \
case TYPE_FIXP: \
dest = FIXP_VALUE(dest); \
break; \
case TYPE_FLOATP: \
{register float temp; \
temp = FLOATP_VALUE(dest) ; \
if ( (temp > ((float) 0x7fffffff)) || \
(temp < ((float) 0x80000000)) ) \
goto label; \
dest = (int) temp; \
} \
break; \
default: goto label; \
} \
break; \
} \
}
#define ARITH_SWITCH(arg, result) \
switch((int) arg & 0xFFFF0000){ \
case 0: \
result = (S_POSITIVE | (int) arg); \
break; \
case 0xFFFF0000: \
result = (S_NEGATIVE | (0xFFFF & (int) arg)); \
break; \
default:{register LispPTR *wordp; \
/* arg is FIXP, call createcell */ \
wordp = (LispPTR *) createcell68k(TYPE_FIXP); \
*((int *)wordp) = (int) arg; \
result = (LADDR_from_68k(wordp)); \
break; \
} \
}
#define N_IGETNUMBER(sour, dest, label) \
{ \
dest = sour; /* access memory once */ \
switch (SEGMASK & dest) { \
case S_POSITIVE: dest = 0xFFFF & dest; break; \
case S_NEGATIVE: dest = 0xFFFF0000 | dest; break; \
default: \
switch (GetTypeNumber(dest)) { \
case TYPE_FIXP: dest = FIXP_VALUE(dest); break; \
case TYPE_FLOATP: { \
register float temp; \
temp = FLOATP_VALUE(dest); \
if ((temp > ((float)0x7fffffff)) || (temp < ((float)0x80000000))) goto label; \
dest = (int)temp; \
} break; \
default: goto label; \
} \
break; \
} \
}
#define ARITH_SWITCH(arg, result) \
switch ((int)arg & 0xFFFF0000) { \
case 0: result = (S_POSITIVE | (int)arg); break; \
case 0xFFFF0000: result = (S_NEGATIVE | (0xFFFF & (int)arg)); break; \
default: { \
register LispPTR *wordp; \
/* arg is FIXP, call createcell */ \
wordp = (LispPTR *)createcell68k(TYPE_FIXP); \
*((int *)wordp) = (int)arg; \
result = (LADDR_from_68k(wordp)); \
break; \
} \
}
/* *******
NEED to See if this is faster than the N_ARITH_SWITCH macro
NEED to See if this is faster than the N_ARITH_SWITCH macro
if( (MIN_FIXP <= result) && (result <= MAX_FIXP) ){
if(0 <= result){
if(result <= MAX_SMALL)
return(S_POSITIVE | result);
else{
wordp = createcell68k(TYPE_FIXP);
*((unsigned int *)wordp) = result;
return(LADDR_from_68k(wordp));
}
}else{
if(MIN_SMALL <= result)
return(S_NEGATIVE | (0xFFFF & result));
else{
wordp = createcell68k(TYPE_FIXP);
*((unsigned int *)wordp) = result;
return(LADDR_from_68k(wordp));
}
}/
}
if( (MIN_FIXP <= result) && (result <= MAX_FIXP) ){
if(0 <= result){
if(result <= MAX_SMALL)
return(S_POSITIVE | result);
else{
wordp = createcell68k(TYPE_FIXP);
*((unsigned int *)wordp) = result;
return(LADDR_from_68k(wordp));
}
}else{
if(MIN_SMALL <= result)
return(S_NEGATIVE | (0xFFFF & result));
else{
wordp = createcell68k(TYPE_FIXP);
*((unsigned int *)wordp) = result;
return(LADDR_from_68k(wordp));
}
}/
}
****** */
#define N_ARITH_SWITCH(arg) \
switch (arg & 0xFFFF0000) { \
case 0: return (S_POSITIVE | arg); \
case 0xFFFF0000: return (S_NEGATIVE | (0xFFFF & arg)); \
default: { \
register LispPTR *fixpp; \
/* arg is FIXP, call createcell */ \
fixpp = (LispPTR *)createcell68k(TYPE_FIXP); \
*((int *)fixpp) = arg; \
return (LADDR_from_68k(fixpp)); \
} \
}
#define N_IARITH_BODY_2(a, tos, op) \
{ \
register int arg1, arg2; \
\
N_IGETNUMBER(a, arg1, do_ufn); \
N_IGETNUMBER(tos, arg2, do_ufn); \
\
arg1 = arg1 op arg2; \
\
N_ARITH_SWITCH(arg1); \
\
do_ufn: \
ERROR_EXIT(tos); \
}
#define N_ARITH_SWITCH(arg) \
switch(arg & 0xFFFF0000){ \
case 0: \
return(S_POSITIVE | arg); \
case 0xFFFF0000: \
return(S_NEGATIVE | (0xFFFF & arg)); \
default:{register LispPTR *fixpp; \
/* arg is FIXP, call createcell */ \
fixpp = (LispPTR *) createcell68k(TYPE_FIXP); \
*((int *)fixpp) = arg; \
return(LADDR_from_68k(fixpp)); \
} \
}
#define N_IARITH_BODY_2(a, tos, op) \
{ \
register int arg1,arg2; \
\
N_IGETNUMBER( a, arg1, do_ufn); \
N_IGETNUMBER( tos, arg2, do_ufn); \
\
arg1 = arg1 op arg2; \
\
N_ARITH_SWITCH(arg1); \
\
do_ufn: ERROR_EXIT(tos); \
}
#define N_ARITH_BODY_1(a, n, op) \
{ \
register int arg1; \
\
N_GETNUMBER( a, arg1, do_ufn); \
\
arg1 = arg1 op n; \
\
N_ARITH_SWITCH(arg1); \
\
do_ufn: ERROR_EXIT(a); \
}
#define N_ARITH_BODY_1_UNSIGNED(a, n, op) \
{ \
register unsigned int arg1; \
\
N_GETNUMBER( a, arg1, do_ufn); \
\
arg1 = arg1 op n; \
\
N_ARITH_SWITCH(arg1); \
\
do_ufn: ERROR_EXIT(a); \
}
#define N_ARITH_BODY_1(a, n, op) \
{ \
register int arg1; \
\
N_GETNUMBER(a, arg1, do_ufn); \
\
arg1 = arg1 op n; \
\
N_ARITH_SWITCH(arg1); \
\
do_ufn: \
ERROR_EXIT(a); \
}
#define N_ARITH_BODY_1_UNSIGNED(a, n, op) \
{ \
register unsigned int arg1; \
\
N_GETNUMBER(a, arg1, do_ufn); \
\
arg1 = arg1 op n; \
\
N_ARITH_SWITCH(arg1); \
\
do_ufn: \
ERROR_EXIT(a); \
}
#endif /* ARITH_H */

1923
inc/inlineC.h Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,7 @@
#ifndef LISPEMUL_H
#define LISPEMUL_H 1
/* $Id: lispemul.h,v 1.4 2001/12/24 01:08:57 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* $Id: lispemul.h,v 1.4 2001/12/24 01:08:57 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
/************************************************************************/
/* */
@ -11,115 +10,102 @@
/* */
/************************************************************************/
#ifndef BYTESWAP
/*** Normal byte-order type decls */
typedef struct {unsigned char code;} BYTECODE;
/*** 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;
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 DLword mds_page; /* Top word of the MDS */
#ifdef BIGVM
typedef struct consstr
{
unsigned cdr_code : 4;
unsigned car_field : 28;
} ConsCell;
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 arguments */
} UFN;
typedef struct ufn_entry {
DLword atom_name; /* UFN's atomindex */
unsigned byte_num : 8; /* num of byte code */
unsigned arg_num : 8; /* num of arguments */
} 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;
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 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 arguments */
} UFN;
typedef struct ufn_entry {
DLword atom_name; /* UFN's atomindex */
unsigned byte_num : 8; /* num of byte code */
unsigned arg_num : 8; /* num of arguments */
} 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;
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 processed */
DLword intcharcode;
} INTSTAT;
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 processed */
DLword intcharcode;
} INTSTAT;
typedef struct interrupt_state_2
{ /* alternate view of the interrupt state */
unsigned pendingmask :8;
unsigned handledmask :8;
DLword nil;
} INTSTAT2;
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 */
};
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))
#define Get_DLword(ptr) ((Get_BYTE(ptr) << 8) | Get_BYTE(ptr + 1))
#else
#define Get_DLword(ptr) *(((DLword *)WORDPTR(ptr)))
#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))
#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))
#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
@ -128,152 +114,139 @@ struct state
#define Get_code_Pointer Get_Pointer
#ifdef BIGATOMS
#define Get_AtomNo(ptr) Get_Pointer(ptr)
#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 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;
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)); \
}
#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;
/*** 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;
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 DLword mds_page; /* Top word of the MDS */
#ifdef BIGVM
typedef struct consstr
{
unsigned car_field : 28;
unsigned cdr_code : 4;
} ConsCell;
typedef struct consstr {
unsigned car_field : 28;
unsigned cdr_code : 4;
} ConsCell;
typedef struct ufn_entry
{
unsigned arg_num : 8; /* num of arguments */
unsigned byte_num : 8; /* num of byte code */
DLword atom_name; /* UFN's atomindex */
} UFN;
typedef struct ufn_entry {
unsigned arg_num : 8; /* num of arguments */
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;
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 consstr {
unsigned car_field : 24;
unsigned cdr_code : 8;
} ConsCell;
typedef struct ufn_entry
{
unsigned arg_num : 8; /* num of arguments */
unsigned byte_num : 8; /* num of byte code */
DLword atom_name; /* UFN's atomindex */
} UFN;
typedef struct ufn_entry {
unsigned arg_num : 8; /* num of arguments */
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;
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 { /* 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;
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 */
};
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))
#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))
#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))
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 16) | (Get_BYTE(ptr + 1) << 8) | Get_BYTE(ptr + 2))
#endif /* BIGVM */
#ifndef RESWAPPEDCODESTREAM
@ -283,85 +256,78 @@ struct state
#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_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)
#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 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;
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)); \
}
#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) */
/* 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))
#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 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)
#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"
@ -369,66 +335,79 @@ extern struct state MachineState;
/* Typedef for IOPAGE */
#include "iopage.h"
/* Typedef for MISCSTAT */
#include "miscstat.h"
/****************************************************
MakeAddr:
base: DLword*
offset: word offset from base
return: DLword*
base: DLword*
offset: word offset from base
return: DLword*
****************************************************/
#define MakeAddr(base, offset) ((DLword *)(base + (int)offset))
#define MakeAddr(base, offset) ((DLword *)(base + (int)offset))
/****************************************************
GetHiWord:
*****************************************************/
#define GetHiWord(x) ((DLword)((x)>>16))
#define GetHiWord(x) ((DLword)((x) >> 16))
/****************************************************
GetLoWord:
*****************************************************/
#define GetLoWord(x) ((DLword)(x))
#define GetLoWord(x) ((DLword)(x))
/****************************************************
GetLongWord:
address: DLword*
return: int
address: DLword*
return: int
*****************************************************/
#define GetLongWord(address) (*((LispPTR *) (address)))
#define GetLongWord(address) (*((LispPTR *)(address)))
/****************************************************
PopCStack:
#define PopCStack {TopOfStack = *((LispPTR *)(--CurrentStackPTR)); --CurrentStackPTR;}
*****************************************************/
#define PopCStack {TopOfStack = *((LispPTR *)(CurrentStackPTR)); CurrentStackPTR -= 2;}
#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; }
#define PopStackTo(Place) \
{ \
Place = *((LispPTR *)(CurrentStackPTR)); \
CurrentStackPTR -= 2; \
}
/****************************************************
PushCStack:
#define PushCStack {*((int *)(++CurrentStackPTR)) = TopOfStack; ++CurrentStackPTR;}
*****************************************************/
#define PushCStack {CurrentStackPTR += 2;*((LispPTR *)(CurrentStackPTR)) = TopOfStack; }
#define PushCStack \
{ \
CurrentStackPTR += 2; \
*((LispPTR *)(CurrentStackPTR)) = TopOfStack; \
}
/****************************************************
PushStack:
#define PushStack(x) {*((LispPTR *)(++CurrentStackPTR))=x;CurrentStackPTR++;}
*****************************************************/
#define PushStack(x) {CurrentStackPTR += 2;*((LispPTR *)(CurrentStackPTR))=x;}
#define PushStack(x) \
{ \
CurrentStackPTR += 2; \
*((LispPTR *)(CurrentStackPTR)) = x; \
}
/****************************************************
SmashStack:
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR-1))=x)
*****************************************************/
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR))=x)
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR)) = x)
/*********************************************************
Get_BYTE(byteptr) byteptr: pointer to 8 bit data
@ -436,22 +415,20 @@ 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)
#define Get_BYTE(byteptr) (((BYTECODE *)BYTEPTR(byteptr))->code)
/**********************************************************
DOSTACKOVERFLOW(argnum,bytenum) if it needs hardreturn-cleanup
then upnt to contextsw and immediately return
then upnt to contextsw and immediately return
**********************************************************/
#define DOSTACKOVERFLOW(argnum,bytenum) { \
if(do_stackoverflow(T)) \
{ PushStack(S_POSITIVE | argnum); \
contextsw(SubovFXP,bytenum,1); \
return;\
} \
}
#define DOSTACKOVERFLOW(argnum, bytenum) \
{ \
if (do_stackoverflow(T)) { \
PushStack(S_POSITIVE | argnum); \
contextsw(SubovFXP, bytenum, 1); \
return; \
} \
}
/************************************************************************/
/* */
@ -480,61 +457,73 @@ DOSTACKOVERFLOW(argnum,bytenum) if it needs hardreturn-cleanup
/* */
/************************************************************************/
#define ERROR_EXIT(tos) do {TopOfStack=tos; Error_Exit = 1; return(-1);} while (0)
#define TIMER_EXIT(tos) do {TopOfStack=tos; Error_Exit = 1; return(-2);} while (0)
#define ERROR_EXIT(tos) \
do { \
TopOfStack = tos; \
Error_Exit = 1; \
return (-1); \
} while (0)
#define TIMER_EXIT(tos) \
do { \
TopOfStack = tos; \
Error_Exit = 1; \
return (-2); \
} while (0)
#define WARN(message, operation) \
do { \
warn(message); \
operation; \
} while (0)
#define NO_WOP \
{}
#define WARN(message,operation) do {warn(message);operation;} while (0)
#define NO_WOP {}
#define NIL 0 /* added 29-jan */
#define T 1
#define ATOM_T 0114 /* T's AtomIndex Number 114Q */
#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 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 basic frame pointer: 2 words */
#define STKLIM 0x1FFFF
#define FRAMESIZE 10 /* size of frameex1: 10 words */
#define FNHEADSIZE 8 /* size of fnhead: 8 words */
#define BFSIZE 2 /* size of basic 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 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 GUARDSTORAGEFULL 128
#define GUARD1STORAGEFULL 64
#define SFS_NOTSWITCHABLE 1
#define SFS_SWITCHABLE 2
#define SFS_ARRAYSWITCHED 3
#define SFS_FULLYSWITCHED 4
#define SFS_NOTSWITCHABLE 1
#define SFS_SWITCHABLE 2
#define SFS_ARRAYSWITCHED 3
#define SFS_FULLYSWITCHED 4
#define AtomHTSIZE 256 * DLWORDSPER_PAGE
#define AtomHTSIZE 256 * DLWORDSPER_PAGE
#define MAXPNCHARS 255 /* Maximum length of PnChars */
#define MAXPNCHARS 255 /* Maximum length of PnChars */
#define FALSE 0
#define TRUE !FALSE
#define TRUE !FALSE
typedef unsigned int boolean;
/************************************************************************/
/* Define sizes of FN and FNX opcodes; depends on atom size */
/************************************************************************/
@ -550,8 +539,6 @@ typedef unsigned int boolean;
#define FNX_OPCODE_SIZE 4
#endif /* BIGATOMS */
/************************************************************************/
/* */
/* Definitions for "NEW" Symbols */
@ -561,31 +548,27 @@ typedef unsigned int boolean;
/************************************************************************/
#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;
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 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
/* 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. */
@ -593,17 +576,14 @@ typedef struct newatom
/************************************************************************/
#ifdef BIGVM
#define POINTERMASK 0xfffffff
#define SEGMASK 0xfff0000
#define mPAGEMASK 0xfffff00
#define SEGMASK 0xfff0000
#define mPAGEMASK 0xfffff00
#else
#define POINTERMASK 0xffffff
#define SEGMASK 0xff0000
#define mPAGEMASK 0xffff00
#define SEGMASK 0xff0000
#define mPAGEMASK 0xffff00
#endif /* BIGVM */
/************************************************************************/
/* */
/* F P t o V P M a n i p u l a t i o n */
@ -612,10 +592,9 @@ typedef struct newatom
/* */
/************************************************************************/
#ifdef BIGVM
#define GETFPTOVP(b,o) b[o]
#define GETPAGEOK(b,o) (b[o]>>16)
#define GETFPTOVP(b, o) b[o]
#define GETPAGEOK(b, o) (b[o] >> 16)
#else
#define GETFPTOVP GETWORDBASEWORD
#define GETPAGEOK GETWORDBASEWORD

View File

@ -1,8 +1,6 @@
#ifndef STACK_H
#define STACK_H 1
/* $Id: stack.h,v 1.2 1999/01/03 02:06:23 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* $Id: stack.h,v 1.2 1999/01/03 02:06:23 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
@ -11,342 +9,342 @@
/* */
/************************************************************************/
/* ContextSW frame number */
#define CurrentFXP 0
#define ResetFXP 1
#define SubovFXP 2
#define KbdFXP 3
#define HardReturnFXP 4
#define GCFXP 5
#define FAULTFXP 6
#define CurrentFXP 0
#define ResetFXP 1
#define SubovFXP 2
#define KbdFXP 3
#define HardReturnFXP 4
#define GCFXP 5
#define FAULTFXP 6
#define STK_FSB_WORD 0xA000u
#define STK_GUARD_WORD 0xE000u
#define BF_MARK 0x8000u
#define BF_MARK32 0x80000000
#define FX_MARK 0xc000u
#define STK_FSB_WORD 0xA000u
#define STK_GUARD_WORD 0xE000u
#define BF_MARK 0x8000u
#define BF_MARK32 0x80000000
#define FX_MARK 0xc000u
#define STK_GUARD 7
#define STK_FX 6
#define STK_FSB 5
#define STK_BF 4
#define STK_NOTFLG 0
#define STK_GUARD 7
#define STK_FX 6
#define STK_FSB 5
#define STK_BF 4
#define STK_NOTFLG 0
#define STK_SAFE 32 /* added with stkmin */
#define MINEXTRASTACKWORDS 32
#define STACKAREA_SIZE 768
#define STK_SAFE 32 /* added with stkmin */
#define MINEXTRASTACKWORDS 32
#define STACKAREA_SIZE 768
/* For Fvar operations */
#define FVSTACK 2
#define FVGLOBAL 6
#define FVUBNBOUND 3
#define FVIVAR 0x0
#define FVPVAR 0x80
#define FVFVAR 0xC0
#define ENDSTACKMARK 0xb
#define FVSTACK 2
#define FVGLOBAL 6
#define FVUBNBOUND 3
#define FVIVAR 0x0
#define FVPVAR 0x80
#define FVFVAR 0xC0
#define ENDSTACKMARK 0xb
#define FXPTR(base) ((struct frameex1 *) WORDPTR(base))
#define FXPTR(base) ((struct frameex1 *)WORDPTR(base))
#ifndef BYTESWAP
/*******************************************************/
/* Normal definitions for structures on stack */
/*******************************************************/
typedef struct fnhead{
DLword stkmin; /* ?? */
short na; /* Numbers of arguments */
short pv; /* ?? */
DLword startpc;
/* head of ByteCodes, DLword offset from stkmin */
unsigned nil4 : 1; /* not used, prev: native translated? */
unsigned byteswapped : 1; /* code was reswapped. */
unsigned argtype : 2; /* ?? */
/*******************************************************/
/* Normal definitions for structures on stack */
/*******************************************************/
typedef struct fnhead {
DLword stkmin; /* ?? */
short na; /* Numbers of arguments */
short pv; /* ?? */
DLword startpc;
/* head of ByteCodes, DLword offset from stkmin */
unsigned nil4 : 1; /* not used, prev: native translated? */
unsigned byteswapped : 1; /* code was reswapped. */
unsigned argtype : 2; /* ?? */
#ifdef BIGVM
unsigned framename :28; /* index in AtomSpace */
unsigned framename : 28; /* index in AtomSpace */
#else
unsigned nil2 : 2; /* not used */
unsigned nil3 : 2; /* not used */
unsigned framename :24; /* index in AtomSpace */
unsigned nil2 : 2; /* not used */
unsigned nil3 : 2; /* not used */
unsigned framename : 24; /* index in AtomSpace */
#endif /* BIGVM */
DLword ntsize; /* size of NameTable */
unsigned nlocals : 8; /* ?? */
unsigned fvaroffset : 8;
/* DLword offset from head of NameTable */
/* NameTable of variable length is following with this structure. */
DLword ntsize; /* size of NameTable */
unsigned nlocals : 8; /* ?? */
unsigned fvaroffset : 8;
/* DLword offset from head of NameTable */
/* NameTable of variable length is following with this structure. */
} FNHEAD;
typedef struct frameex1{
unsigned flags :3;
unsigned fast :1;
unsigned nil2 :1; /* not used, prev: This frame treats N-func */
unsigned incall :1;
unsigned validnametable :1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned nopush :1;
unsigned usecount :8;
DLword alink; /* alink pointer (Low addr) */
typedef struct frameex1 {
unsigned flags : 3;
unsigned fast : 1;
unsigned nil2 : 1; /* not used, prev: This frame treats N-func */
unsigned incall : 1;
unsigned validnametable : 1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned nopush : 1;
unsigned usecount : 8;
DLword alink; /* alink pointer (Low addr) */
#ifdef BIGVM
LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */
LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */
#else
DLword lofnheader; /* pointer to FunctionHeader (Low addr) */
unsigned hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
unsigned hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
DLword lofnheader; /* pointer to FunctionHeader (Low addr) */
unsigned hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
unsigned hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
#endif /* BIGVM */
DLword nextblock; /* pointer to FreeStackBlock */
DLword pc; /* Program counter */
DLword nextblock; /* pointer to FreeStackBlock */
DLword pc; /* Program counter */
#ifdef BIGVM
LispPTR nametable; /* ptr to NameTable of this FrameEx (Hi2 addr) */
LispPTR nametable; /* ptr to NameTable of this FrameEx (Hi2 addr) */
#else
DLword lonametable; /* ptr to NameTable of this FrameEx (Low addr) */
unsigned hi1nametable :8; /* ptr to NameTable of this FrameEx (Hi1 addr) */
unsigned hi2nametable :8; /* ptr to NameTable of this FrameEx (Hi2 addr) */
DLword lonametable; /* ptr to NameTable of this FrameEx (Low addr) */
unsigned hi1nametable : 8; /* ptr to NameTable of this FrameEx (Hi1 addr) */
unsigned hi2nametable : 8; /* ptr to NameTable of this FrameEx (Hi2 addr) */
#endif /* BIGVM */
DLword blink; /* blink pointer (Low addr) */
DLword clink; /* clink pointer (Low addr) */
DLword blink; /* blink pointer (Low addr) */
DLword clink; /* clink pointer (Low addr) */
} FX;
typedef struct frameex2{
unsigned flags :3;
unsigned fast :1;
unsigned nil2 :1; /* not used, prev: This frame treats N-func */
unsigned incall :1;
unsigned validnametable :1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned nopush :1;
unsigned usecount :8;
DLword alink; /* alink pointer (Low addr) */
LispPTR fnheader; /* pointer to FunctionHeader */
DLword nextblock; /* pointer to FreeStackBlock */
DLword pc; /* Program counter */
LispPTR nametable; /* address of NameTable */
DLword blink; /* blink pointer (Low addr) */
DLword clink; /* clink pointer (Low addr) */
typedef struct frameex2 {
unsigned flags : 3;
unsigned fast : 1;
unsigned nil2 : 1; /* not used, prev: This frame treats N-func */
unsigned incall : 1;
unsigned validnametable : 1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned nopush : 1;
unsigned usecount : 8;
DLword alink; /* alink pointer (Low addr) */
LispPTR fnheader; /* pointer to FunctionHeader */
DLword nextblock; /* pointer to FreeStackBlock */
DLword pc; /* Program counter */
LispPTR nametable; /* address of NameTable */
DLword blink; /* blink pointer (Low addr) */
DLword clink; /* clink pointer (Low addr) */
} FX2;
typedef struct fxblock {
unsigned flagbyte : 8;
unsigned nil : 23;
unsigned slowp : 1;
unsigned flagbyte : 8;
unsigned nil : 23;
unsigned slowp : 1;
} FXBLOCK;
typedef struct basic_frame {
unsigned flags : 3;
unsigned nil : 3;
unsigned residual: 1;
unsigned padding : 1;
unsigned usecnt : 8;
DLword ivar; /* stk offset of IVARs for this frame ?? */
unsigned flags : 3;
unsigned nil : 3;
unsigned residual : 1;
unsigned padding : 1;
unsigned usecnt : 8;
DLword ivar; /* stk offset of IVARs for this frame ?? */
} Bframe;
typedef struct stkword {
unsigned short flags :3;
unsigned short nil :5;
unsigned short usecount :8;
} StackWord;
unsigned short flags : 3;
unsigned short nil : 5;
unsigned short usecount : 8;
} StackWord;
typedef struct stack_block {
DLword flagword;
DLword size;
} STKBLK;
typedef struct stack_block {
DLword flagword;
DLword size;
} STKBLK;
/* Lisp DATATYPE STACKP */
typedef struct stackp {
DLword stackp0;
DLword edfxp;
DLword stackp0;
DLword edfxp;
} STACKP;
/*************************************************************/
/* Pointer-dereferencing macros for one-word structure ptrs */
/*************************************************************/
/*************************************************************/
/* Pointer-dereferencing macros for one-word structure ptrs */
/*************************************************************/
#define BFRAMEPTR(ptr) ((Bframe *)(ptr))
#define STKWORDPTR(ptr) ((StackWord *)(ptr))
#else
/*******************************************************/
/* Byte-swapped/Word-swapped definitions of stack */
/*******************************************************/
typedef struct fnhead
{
short na; /* Numbers of arguments */
DLword stkmin; /* ?? */
DLword startpc;
/* head of ByteCodes, DLword offset from stkmin */
short pv; /* ?? */
/*******************************************************/
/* Byte-swapped/Word-swapped definitions of stack */
/*******************************************************/
typedef struct fnhead {
short na; /* Numbers of arguments */
DLword stkmin; /* ?? */
DLword startpc;
/* head of ByteCodes, DLword offset from stkmin */
short pv; /* ?? */
#ifdef BIGVM
unsigned framename :28; /* index in AtomSpace */
unsigned framename : 28; /* index in AtomSpace */
#else
unsigned framename :24; /* index in AtomSpace */
unsigned nil3 : 2; /* not used */
unsigned nil2 : 2; /* not used */
unsigned framename : 24; /* index in AtomSpace */
unsigned nil3 : 2; /* not used */
unsigned nil2 : 2; /* not used */
#endif /* BIGVM */
unsigned argtype : 2; /* ?? */
unsigned byteswapped : 1; /* code was reswapped. */
unsigned nil4 : 1; /* not used, prev: native translated? */
unsigned fvaroffset : 8;
/* DLword offset from head of NameTable */
unsigned nlocals :8; /* ?? */
DLword ntsize; /* size of NameTable */
/* NameTable of variable length is following with this structure. */
} FNHEAD;
unsigned argtype : 2; /* ?? */
unsigned byteswapped : 1; /* code was reswapped. */
unsigned nil4 : 1; /* not used, prev: native translated? */
unsigned fvaroffset : 8;
/* DLword offset from head of NameTable */
unsigned nlocals : 8; /* ?? */
DLword ntsize; /* size of NameTable */
/* NameTable of variable length is following with this structure. */
} FNHEAD;
typedef struct frameex1{
DLword alink; /* alink pointer (Low addr) */
unsigned usecount :8;
unsigned nopush :1;
unsigned validnametable :1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned incall :1;
unsigned nil2 :1; /* not used, prev: This frame treats N-func */
unsigned fast :1;
unsigned flags :3; /* hi word */
typedef struct frameex1 {
DLword alink; /* alink pointer (Low addr) */
unsigned usecount : 8;
unsigned nopush : 1;
unsigned validnametable : 1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned incall : 1;
unsigned nil2 : 1; /* not used, prev: This frame treats N-func */
unsigned fast : 1;
unsigned flags : 3; /* hi word */
#ifdef BIGVM
LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */
LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */
#else
unsigned hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
unsigned hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
DLword lofnheader; /* pointer to FunctionHeader (Low addr) */
unsigned hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
unsigned hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
DLword lofnheader; /* pointer to FunctionHeader (Low addr) */
#endif /* BIGVM */
DLword pc; /* Program counter */
DLword nextblock; /* pointer to FreeStackBlock */
DLword pc; /* Program counter */
DLword nextblock; /* pointer to FreeStackBlock */
#ifdef BIGVM
LispPTR nametable; /* pointer to NameTable of this FX (Hi2 addr) */
LispPTR nametable; /* pointer to NameTable of this FX (Hi2 addr) */
#else
unsigned hi2nametable :8; /* pointer to NameTable of this FX (Hi2 addr) */
unsigned hi1nametable :8; /* pointer to NameTable of this FX (Hi1 addr) */
DLword lonametable; /* pointer to NameTable of this FX (Low addr) */
unsigned hi2nametable : 8; /* pointer to NameTable of this FX (Hi2 addr) */
unsigned hi1nametable : 8; /* pointer to NameTable of this FX (Hi1 addr) */
DLword lonametable; /* pointer to NameTable of this FX (Low addr) */
#endif /* BIGVM */
DLword clink; /* clink pointer (Low addr) */
DLword blink; /* blink pointer (Low addr) */
DLword clink; /* clink pointer (Low addr) */
DLword blink; /* blink pointer (Low addr) */
} FX;
typedef struct frameex2{
DLword alink; /* alink pointer (Low addr) */
unsigned usecount :8;
unsigned nopush :1;
unsigned validnametable :1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned incall :1;
unsigned nil2 :1; /* not used, prev: This frame treats N-func */
unsigned fast :1;
unsigned flags :3;
typedef struct frameex2 {
DLword alink; /* alink pointer (Low addr) */
unsigned usecount : 8;
unsigned nopush : 1;
unsigned validnametable : 1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned incall : 1;
unsigned nil2 : 1; /* not used, prev: This frame treats N-func */
unsigned fast : 1;
unsigned flags : 3;
LispPTR fnheader; /* pointer to FunctionHeader (swapped) */
LispPTR fnheader; /* pointer to FunctionHeader (swapped) */
DLword pc; /* Program counter */
DLword nextblock; /* pointer to FreeStackBlock */
DLword pc; /* Program counter */
DLword nextblock; /* pointer to FreeStackBlock */
LispPTR nametable; /* address of NameTable (swapped) */
LispPTR nametable; /* address of NameTable (swapped) */
DLword clink; /* clink pointer (Low addr) */
DLword blink; /* blink pointer (Low addr) */
DLword clink; /* clink pointer (Low addr) */
DLword blink; /* blink pointer (Low addr) */
} FX2;
typedef struct fxblock {
unsigned slowp : 1;
unsigned nil : 23;
unsigned flagbyte : 8;
unsigned slowp : 1;
unsigned nil : 23;
unsigned flagbyte : 8;
} FXBLOCK;
typedef struct basic_frame {
DLword ivar;
unsigned usecnt : 8;
unsigned padding : 1;
unsigned residual: 1;
unsigned nil : 3;
unsigned flags : 3;
DLword ivar;
unsigned usecnt : 8;
unsigned padding : 1;
unsigned residual : 1;
unsigned nil : 3;
unsigned flags : 3;
} Bframe;
typedef struct stkword
{
USHORT usecount :8;
USHORT nil :5;
USHORT flags :3;
} StackWord;
typedef struct stkword {
USHORT usecount : 8;
USHORT nil : 5;
USHORT flags : 3;
} StackWord;
typedef struct stack_block
{
DLword size;
DLword flagword;
} STKBLK;
typedef struct stack_block {
DLword size;
DLword flagword;
} STKBLK;
/* Lisp DATATYPE STACKP */
typedef struct stackp
{
DLword edfxp;
DLword stackp0;
} STACKP;
typedef struct stackp {
DLword edfxp;
DLword stackp0;
} STACKP;
/*************************************************************/
/* Pointer-dereferencing macros for one-word structure ptrs */
/*************************************************************/
/*************************************************************/
/* Pointer-dereferencing macros for one-word structure ptrs */
/*************************************************************/
#define BFRAMEPTR(ptr) ((Bframe *)(ptr))
#define STKWORDPTR(ptr) ((StackWord *) (2^(UNSIGNED)(ptr)))
#define STKWORDPTR(ptr) ((StackWord *)(2 ^ (UNSIGNED)(ptr)))
#endif
#define STKWORD(stkptr) ((StackWord *)WORDPTR(stkptr))
#define FX_INVALIDP(fx68k) (((fx68k)==0) || ((DLword*)(fx68k)==Stackspace))
#define FX_size(fx68k) (((FX*)(fx68k))->nextblock - LOLOC(LADDR_from_68k(fx68k)))
#define FSBP(ptr68k) ( ((STKBLK*)(ptr68k))->flagword == STK_FSB_WORD )
#define FSB_size(ptr68k) (((STKBLK*)(ptr68k))->size)
#define FX_INVALIDP(fx68k) (((fx68k) == 0) || ((DLword *)(fx68k) == Stackspace))
#define FX_size(fx68k) (((FX *)(fx68k))->nextblock - LOLOC(LADDR_from_68k(fx68k)))
#define FSBP(ptr68k) (((STKBLK *)(ptr68k))->flagword == STK_FSB_WORD)
#define FSB_size(ptr68k) (((STKBLK *)(ptr68k))->size)
/** Following suff assumes fx is 68kptr and val is LISP_LO_OFFSET **/
#define DUMMYBF(fx) ( ((DLword*)(fx))-DLWORDSPER_CELL )
#define SLOWP(fx) (((FXBLOCK*)(fx))->slowp)
#define FASTP(fx) (!SLOWP(fx))
#define SET_FASTP_NIL(fx68k) { \
if(FASTP(fx68k)){ \
((FX*)fx68k)->blink=StkOffset_from_68K(DUMMYBF(fx68k));\
((FX*)fx68k)->clink=((FX*)fx68k)->alink;\
SLOWP(fx68k)=T; }}
#define DUMMYBF(fx) (((DLword *)(fx)) - DLWORDSPER_CELL)
#define SLOWP(fx) (((FXBLOCK *)(fx))->slowp)
#define FASTP(fx) (!SLOWP(fx))
#define SET_FASTP_NIL(fx68k) \
{ \
if (FASTP(fx68k)) { \
((FX *)fx68k)->blink = StkOffset_from_68K(DUMMYBF(fx68k)); \
((FX *)fx68k)->clink = ((FX *)fx68k)->alink; \
SLOWP(fx68k) = T; \
} \
}
#define GETALINK(fx) ((((fx)->alink) & 0xfffe)-FRAMESIZE)
#define SETALINK(fx,val) {if(FASTP(fx)) \
{((FX*)(fx))->blink=LADDR_from_68k(DUMMYBF(fx));\
((FX*)(fx))->clink=((FX*)(fx))->alink;}\
((FX*)(fx))->alink=(val)+FRAMESIZE+1;}
#define GETALINK(fx) ((((fx)->alink) & 0xfffe) - FRAMESIZE)
#define SETALINK(fx, val) \
{ \
if (FASTP(fx)) { \
((FX *)(fx))->blink = LADDR_from_68k(DUMMYBF(fx)); \
((FX *)(fx))->clink = ((FX *)(fx))->alink; \
} \
((FX *)(fx))->alink = (val) + FRAMESIZE + 1; \
}
#define GETBLINK(fx) (SLOWP(fx) ? ((FX*)(fx))->blink : LOLOC(LADDR_from_68k(DUMMYBF(fx))))
#define SETBLINK(fx,val) { ((FX*)(fx))->blink =(val);\
if(FASTP(fx)){\
((FX*)(fx))->clink=((FX*)(fx))->alink; \
SLOWP(fx)=1;}}
#define GETBLINK(fx) (SLOWP(fx) ? ((FX *)(fx))->blink : LOLOC(LADDR_from_68k(DUMMYBF(fx))))
#define SETBLINK(fx, val) \
{ \
((FX *)(fx))->blink = (val); \
if (FASTP(fx)) { \
((FX *)(fx))->clink = ((FX *)(fx))->alink; \
SLOWP(fx) = 1; \
} \
}
#define GETCLINK(fx) (SLOWP(fx) ? (((FX*)(fx))->clink -FRAMESIZE):(((FX*)(fx))->alink -FRAMESIZE))
#define SETCLINK(fx,val) { ((FX*)(fx))->clink = (val) +FRAMESIZE;\
if(FASTP((fx))){\
((FX*)(fx))->blink=LADDR_from_68k(DUMMYBF(fx));\
SLOWP(fx)=1;}}
#define GETCLINK(fx) \
(SLOWP(fx) ? (((FX *)(fx))->clink - FRAMESIZE) : (((FX *)(fx))->alink - FRAMESIZE))
#define SETCLINK(fx, val) \
{ \
((FX *)(fx))->clink = (val) + FRAMESIZE; \
if (FASTP((fx))) { \
((FX *)(fx))->blink = LADDR_from_68k(DUMMYBF(fx)); \
SLOWP(fx) = 1; \
} \
}
#define SETACLINK(fx,val) {if(FASTP(fx)) \
{((FX*)(fx))->blink=LADDR_from_68k(DUMMYBF(fx));}\
((FX*)(fx))->clink= (val) + FRAMESIZE;\
((FX*)(fx))->alink= ((FX*)(fx))->clink +1; }
#define SETACLINK(fx, val) \
{ \
if (FASTP(fx)) { ((FX *)(fx))->blink = LADDR_from_68k(DUMMYBF(fx)); } \
((FX *)(fx))->clink = (val) + FRAMESIZE; \
((FX *)(fx))->alink = ((FX *)(fx))->clink + 1; \
}
#ifdef BIGVM
#define SWAP_FNHEAD
@ -354,28 +352,24 @@ typedef struct stackp
#define SWAP_FNHEAD(x) swapx(x)
#endif /* BIGVM */
#define GETNAMETABLE(fx) \
((struct fnhead *) Addr68k_from_LADDR(SWAP_FNHEAD( \
((((FX2 *)fx)->validnametable) \
? ((FX2 *)fx)->nametable \
: ((FX2 *)fx)->fnheader \
)) & POINTERMASK))
#define GETNAMETABLE(fx) \
((struct fnhead *)Addr68k_from_LADDR( \
SWAP_FNHEAD( \
((((FX2 *)fx)->validnametable) ? ((FX2 *)fx)->nametable : ((FX2 *)fx)->fnheader)) & \
POINTERMASK))
#define MAKEFREEBLOCK(ptr68k,size) \
{ \
if ((size) <= 0) error("creating 0 long FSP"); \
*((LispPTR*)(ptr68k))=(STK_FSB_WORD << 16) | ((DLword)(size)); \
#define MAKEFREEBLOCK(ptr68k, size) \
{ \
if ((size) <= 0) error("creating 0 long FSP"); \
*((LispPTR *)(ptr68k)) = (STK_FSB_WORD << 16) | ((DLword)(size)); \
}
#define SETUPGUARDBLOCK(ptr68k,size) \
{ \
if ((size) <= 0) error("creating 0 long Guard block"); \
( *((LispPTR*)(ptr68k))=(STK_GUARD_WORD << 16) | ((DLword)(size)) ); \
#define SETUPGUARDBLOCK(ptr68k, size) \
{ \
if ((size) <= 0) error("creating 0 long Guard block"); \
(*((LispPTR *)(ptr68k)) = (STK_GUARD_WORD << 16) | ((DLword)(size))); \
}
/************************************************************************/
/* */
/* Stack-checking macros */
@ -388,62 +382,55 @@ typedef struct stackp
#include <stdio.h>
#define S_CHECK(condition, msg) \
{ \
if(!(condition)) \
{ \
printf("\n\nStack check failed: %s.\n\n", (msg)); \
error("S_Check.."); \
} \
#define S_CHECK(condition, msg) \
{ \
if (!(condition)) { \
printf("\n\nStack check failed: %s.\n\n", (msg)); \
error("S_Check.."); \
} \
}
#define S_WARN(condition, msg, scanptr) \
{ \
if(!(condition)) \
{ \
printf("\n\nStack check failed at %p: %s.\n\n", (scanptr), (msg)); \
} \
#define S_WARN(condition, msg, scanptr) \
{ \
if (!(condition)) { printf("\n\nStack check failed at %p: %s.\n\n", (scanptr), (msg)); } \
}
#define CHECK_BF(bf68k) check_BF(bf68k)
#define CHECK_FX(fx68k) check_FX(fx68k)
#define PreMoveFrameCheck(fx68k) \
{ LispPTR *tos_on_stack; \
if(check_stack_rooms(fx68k) > 1000) \
{ \
warn("moveframe:there is more than 100 words SPACE for FX"); \
printf("# When calling "); \
tos_on_stack=(LispPTR*)Addr68k_from_StkOffset((fx68k)->nextblock - 2); \
print_atomname(*tos_on_stack); \
printf("\n"); \
stack_check(0); \
} \
#define PreMoveFrameCheck(fx68k) \
{ \
LispPTR *tos_on_stack; \
if (check_stack_rooms(fx68k) > 1000) { \
warn("moveframe:there is more than 100 words SPACE for FX"); \
printf("# When calling "); \
tos_on_stack = (LispPTR *)Addr68k_from_StkOffset((fx68k)->nextblock - 2); \
print_atomname(*tos_on_stack); \
printf("\n"); \
stack_check(0); \
} \
}
#else /* STACKCHECK */
#define S_CHECK(condition,msg) {}
#define S_WARN(condition, msg, scanptr) {}
#define PreMoveFrameCheck(fx68k) {}
#define CHECK_BF(bf68k) {}
#define CHECK_FX(fx68k) {}
#define S_CHECK(condition, msg) \
{}
#define S_WARN(condition, msg, scanptr) \
{}
#define PreMoveFrameCheck(fx68k) \
{}
#define CHECK_BF(bf68k) \
{}
#define CHECK_FX(fx68k) \
{}
#endif /* STACKCHECK */
#define STK_MIN(fnobj) ((fnobj->stkmin /* NOT NEEDED in stkmin +STK_SAFE */) << 1)
#define STK_END_COMPUTE(stk_end,fnobj) \
( (UNSIGNED)(stk_end) - STK_MIN(fnobj) )
#define STK_END_COMPUTE(stk_end, fnobj) ((UNSIGNED)(stk_end)-STK_MIN(fnobj))
#define CLR_IRQ \
{Irq_Stk_Check = STK_END_COMPUTE((Irq_Stk_End = (UNSIGNED) EndSTKP), \
FuncObj); \
}
#define CLR_IRQ \
{ Irq_Stk_Check = STK_END_COMPUTE((Irq_Stk_End = (UNSIGNED)EndSTKP), FuncObj); }
#endif

View File

@ -1,8 +1,7 @@
#ifndef TOS1DEFS_H
#define TOS1DEFS_H 1
/* $Id: tos1defs.h,v 1.2 1999/01/03 02:06:27 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* $Id: tos1defs.h,v 1.2 1999/01/03 02:06:27 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
/************************************************************************/
/* */
@ -21,60 +20,77 @@
/************************************************************************/
#ifndef BYTESWAP
/********************************************************/
/* Normal byte-order definitions, for e.g., 68020s */
/********************************************************/
/********************************************************/
/* Normal byte-order definitions, for e.g., 68020s */
/********************************************************/
/* These are the TOS manipulation Macros */
#define HARD_PUSH(x) *(CSTKPTRL++) = x
#define PUSH(x) {HARD_PUSH(TOPOFSTACK); TOPOFSTACK = x;}
#define POP TOPOFSTACK = *(--CSTKPTRL)
#define GET_TOS_1 *(CSTKPTR - 1)
#define GET_TOS_2 *(CSTKPTR - 2)
#define GET_POPPED *CSTKPTR
#define POP_TOS_1 *(--CSTKPTRL)
#define TOPOFSTACK tscache
#define GET_TOS_1_HI *((DLword *)(CSTKPTR - 1))
#define GET_TOS_1_LO *((DLword *)(CSTKPTR - 1)+1)
#define HARD_PUSH(x) *(CSTKPTRL++) = x
#define PUSH(x) \
{ \
HARD_PUSH(TOPOFSTACK); \
TOPOFSTACK = x; \
}
#define POP TOPOFSTACK = *(--CSTKPTRL)
#define GET_TOS_1 *(CSTKPTR - 1)
#define GET_TOS_2 *(CSTKPTR - 2)
#define GET_POPPED *CSTKPTR
#define POP_TOS_1 *(--CSTKPTRL)
#define TOPOFSTACK tscache
#define GET_TOS_1_HI *((DLword *)(CSTKPTR - 1))
#define GET_TOS_1_LO *((DLword *)(CSTKPTR - 1) + 1)
#else
/********************************************************/
/* Byte-swapped definitions, for e.g., 80386s */
/********************************************************/
/********************************************************/
/* Byte-swapped definitions, for e.g., 80386s */
/********************************************************/
/* These are the TOS manipulation Macros */
#define HARD_PUSH(x) *(CSTKPTRL++) = x
#define PUSH(x) {HARD_PUSH(TOPOFSTACK); TOPOFSTACK = x;}
#define POP TOPOFSTACK = *(--CSTKPTRL)
#define GET_TOS_1 *(CSTKPTR - 1)
#define GET_TOS_2 *(CSTKPTR - 2)
#define GET_POPPED *CSTKPTR
#define POP_TOS_1 *(--CSTKPTRL)
#define TOPOFSTACK tscache
#define GET_TOS_1_HI GETWORD((DLword *)(CSTKPTR - 1))
#define GET_TOS_1_LO GETWORD((DLword *)(CSTKPTR - 1)+1)
#define HARD_PUSH(x) *(CSTKPTRL++) = x
#define PUSH(x) \
{ \
HARD_PUSH(TOPOFSTACK); \
TOPOFSTACK = x; \
}
#define POP TOPOFSTACK = *(--CSTKPTRL)
#define GET_TOS_1 *(CSTKPTR - 1)
#define GET_TOS_2 *(CSTKPTR - 2)
#define GET_POPPED *CSTKPTR
#define POP_TOS_1 *(--CSTKPTRL)
#define TOPOFSTACK tscache
#define GET_TOS_1_HI GETWORD((DLword *)(CSTKPTR - 1))
#define GET_TOS_1_LO GETWORD((DLword *)(CSTKPTR - 1) + 1)
#endif /* BYTESWAP */
/* OPCODE interface routines */
#define StackPtrSave {CurrentStackPTR = (DLword *) (CSTKPTR-1);}
#define StackPtrRestore {CSTKPTRL = ((LispPTR *) CurrentStackPTR)+1;}
#define StackPtrSave \
{ CurrentStackPTR = (DLword *)(CSTKPTR - 1); }
#define StackPtrRestore \
{ CSTKPTRL = ((LispPTR *)CurrentStackPTR) + 1; }
#define EXT \
{ \
PC = pccache - 1; \
TopOfStack = TOPOFSTACK; \
StackPtrSave; \
}
#define RET \
{ \
pccache = PC + 1; \
StackPtrRestore; \
TOPOFSTACK = TopOfStack; \
}
#define EXT { PC=pccache-1; \
TopOfStack=TOPOFSTACK; \
StackPtrSave; }
#define RET { pccache=PC+1; \
StackPtrRestore; \
TOPOFSTACK = TopOfStack; }
#define NRET { RET; nextop0; }
#define NRET \
{ \
RET; \
nextop0; \
}
#endif /* TOS1DEFS_H */

974
inc/tosfns.h Executable file → Normal file

File diff suppressed because it is too large Load Diff