Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inc/address.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
/**********************************************************************/

/* NOTE: These MACRO should be used for the pointers in LISP SYSOUT */
#define LLSH(datum , n) ((datum )<< n)
#define LRSH(datum , n) ((datum) >> n)
#define LLSH(datum, n) ((datum) << (n))
#define LRSH(datum, n) ((datum) >> (n))

#define HILOC(ptr) (LRSH(((unsigned int)(ptr) & SEGMASK),16))
#define LOLOC(ptr) ((unsigned int)(ptr) & 0x0ffff)
Expand Down
2 changes: 1 addition & 1 deletion inc/adr68k.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@


/* translate LispPage to 68k address */
#define Addr68k_from_LPAGE(Lisp_page) (Addr68k_from_LADDR((Lisp_page << 8) ))
#define Addr68k_from_LPAGE(Lisp_page) (Addr68k_from_LADDR(((Lisp_page) << 8) ))



Expand Down
56 changes: 29 additions & 27 deletions inc/arith.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,69 +10,71 @@
/************************************************************************/

#define MAX_SMALL 65535 /* == 0x0000FFFF */
#define MIN_SMALL -65536 /* == 0xFFFF0000 */
#define MIN_SMALL (-65536) /* == 0xFFFF0000 */

#define MAX_FIXP 2147483647 /* == 0x7FFFFFFF */
#define MIN_FIXP -2147483648 /* == 0x80000000 */
#define MIN_FIXP (-2147483648) /* == 0x80000000 */

#define GetSmalldata(x) \
(((SEGMASK & x) == S_POSITIVE) \
? (0xFFFF & x) \
: (((SEGMASK & x) == S_NEGATIVE) ? (0xFFFF0000 | x) : error("Not smallp address")))
(((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)) \
((0xFFFF0000 & (x)) ? (((0xFFFF0000 & (x)) == 0xFFFF0000) ? (S_NEGATIVE | (0xFFFF & (x))) \
: error("Not Smallp data")) \
: (S_POSITIVE | (0xFFFF & x)))
: (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) \
do { \
dest = sour; /* access memory once */ \
switch (SEGMASK & dest) { \
case S_POSITIVE: dest = 0xFFFF & (dest); break; \
case S_NEGATIVE: dest = 0xFFFF0000 | (dest); break; \
(dest) = (sour); /* access memory once */ \
switch (SEGMASK & (dest)) { \
case S_POSITIVE: (dest) = 0xFFFF & (dest); break; \
case S_NEGATIVE: (dest) = 0xFFFF0000 | (dest); break; \
default: \
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
if (GetTypeNumber(dest) != TYPE_FIXP) goto label; \
dest = FIXP_VALUE(dest); \
(dest) = FIXP_VALUE(dest); \
} \
} while (0)

#define N_IGETNUMBER(sour, dest, label) \
do { \
dest = sour; /* access memory once */ \
switch (SEGMASK & dest) { \
case S_POSITIVE: dest = 0xFFFF & dest; break; \
case S_NEGATIVE: dest = 0xFFFF0000 | dest; break; \
(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_FIXP: (dest) = FIXP_VALUE(dest); break; \
case TYPE_FLOATP: { \
register float temp; \
temp = FLOATP_VALUE(dest); \
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
if ((temp > ((float)0x7fffffff)) || (temp < ((float)0x80000000))) goto label; \
dest = (int)temp; \
(dest) = (int)temp; \
} break; \
default: goto label; \
default: goto label; /* NOLINT(bugprone-macro-parentheses) */ \
} \
break; \
} \
} while (0)

#define ARITH_SWITCH(arg, result) \
do { \
switch ((int)arg & 0xFFFF0000) { \
case 0: result = (S_POSITIVE | (int)arg); break; \
case 0xFFFF0000: result = (S_NEGATIVE | (0xFFFF & (int)arg)); break; \
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)); \
*((int *)wordp) = (int)(arg); \
(result) = (LADDR_from_68k(wordp)); \
break; \
} \
} \
Expand Down Expand Up @@ -104,9 +106,9 @@

#define N_ARITH_SWITCH(arg) \
do { \
switch (arg & 0xFFFF0000) { \
case 0: return (S_POSITIVE | arg); \
case 0xFFFF0000: return (S_NEGATIVE | (0xFFFF & 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 */ \
Expand Down
2 changes: 1 addition & 1 deletion inc/bb.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
#define B_src_word_in_postloop src32lbit >= dst32lbit

/* VARIABLES */
#define F_num_loop ((dst32lbit + w) >> 5) - 1
#define F_num_loop (((dst32lbit + w) >> 5) - 1)
#define B_num_loop ((w - dst32rbit - 1) > 0) ? ((w - dst32rbit - 1) >> 5) : 0
#define F_preloop_mask ((dst32lbit) ? (~(0xFFFFFFFF << (32 - dst32lbit))) : 0xFFFFFFFF)
#define F_postloop_mask 0xFFFFFFFF << (31 - dst32rbit)
Expand Down
18 changes: 9 additions & 9 deletions inc/bitblt.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
#define ERROR PIX_SRC

#define PixOperation( SRCTYPE, OPERATION ) \
( SRCTYPE == ERASE ? \
(OPERATION == REPLACE ? PIX_NOT(PIX_SRC) : \
(OPERATION == PAINT ? PIX_NOT(PIX_SRC) | PIX_DST : \
(OPERATION == ERASE ? PIX_NOT(PIX_SRC) & PIX_DST : \
(OPERATION == INVERT ? PIX_NOT(PIX_SRC) ^ PIX_DST : ERROR)))) : \
( (SRCTYPE) == ERASE ? \
((OPERATION) == REPLACE ? PIX_NOT(PIX_SRC) : \
((OPERATION) == PAINT ? PIX_NOT(PIX_SRC) | PIX_DST : \
((OPERATION) == ERASE ? PIX_NOT(PIX_SRC) & PIX_DST : \
((OPERATION) == INVERT ? PIX_NOT(PIX_SRC) ^ PIX_DST : ERROR)))) : \
/* SRCTYPE == INPUT */ \
(OPERATION == REPLACE ? PIX_SRC : \
(OPERATION == PAINT ? PIX_SRC | PIX_DST : \
(OPERATION == ERASE ? PIX_SRC & PIX_DST : \
(OPERATION == INVERT ? PIX_SRC ^ PIX_DST : ERROR)))))
((OPERATION) == REPLACE ? PIX_SRC : \
((OPERATION) == PAINT ? PIX_SRC | PIX_DST : \
((OPERATION) == ERASE ? PIX_SRC & PIX_DST : \
((OPERATION) == INVERT ? PIX_SRC ^ PIX_DST : ERROR)))))


extern DLword *EmMouseX68K, *EmMouseY68K;
Expand Down
22 changes: 11 additions & 11 deletions inc/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/* On 68010,68000 This Macro does not effect */

#ifdef NEWCDRCODING
#define CARFIELD(x) ((int)x & 0x0fffffff)
#define CARFIELD(x) ((int)(x) & 0x0fffffff)

/* CDR-Codes defs */
#define CDR_ONPAGE 8
Expand Down Expand Up @@ -124,7 +124,7 @@ typedef struct freec {

#endif /* BYTESWAP */

#define FREECONS(page, offset) ((freecons *)((DLword *)page + offset))
#define FREECONS(page, offset) ((freecons *)((DLword *)(page) + (offset)))

/************************************************************************/
/* */
Expand Down Expand Up @@ -375,20 +375,20 @@ struct cadr_cell {

#else
/* Good for old LITATOMS and new NEW-ATOMs */
#define GetDEFCELL68k(index) \
(((index & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_DEFN_OFFSET) \
#define GetDEFCELL68k(index) \
((((index) & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_DEFN_OFFSET) \
: GetDEFCELLlitatom(index))

#define GetVALCELL68k(index) \
(((index & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_VALUE_OFFSET) \
#define GetVALCELL68k(index) \
((((index) & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_VALUE_OFFSET) \
: GetVALCELLlitatom(index))

#define GetPnameCell(index) \
(((index & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PNAME_OFFSET) \
#define GetPnameCell(index) \
((((index) & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PNAME_OFFSET) \
: GetPnameCelllitatom(index))

#define GetPropCell(index) \
(((index & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PLIST_OFFSET) \
#define GetPropCell(index) \
((((index) & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PLIST_OFFSET) \
: GetPropCelllitatom(index))

/* Good only for old-style LITATOMS */
Expand Down Expand Up @@ -420,6 +420,6 @@ struct cadr_cell {
if (GetTypeNumber(parm) != TYPE_LISTP) { \
ERROR_EXIT(tos); \
} else \
dest = cadr(parm); \
(dest) = cadr(parm); \
}
#endif
2 changes: 1 addition & 1 deletion inc/devif.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ typedef struct
}
#endif /* XWINDOW */

#define OUTER_SB_WIDTH(dsp) (dsp->ScrollBarWidth + 2*(dsp->InternalBorderWidth))
#define OUTER_SB_WIDTH(dsp) ((dsp)->ScrollBarWidth + 2*((dsp)->InternalBorderWidth))

#ifndef min
#define min( a, b ) (((a)<(b))?(a):(b))
Expand Down
4 changes: 2 additions & 2 deletions inc/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ extern DLword *DISP_MAX_Address;
extern DLword *DisplayRegion68k;

#define in_display_segment(baseaddr) \
(((DisplayRegion68k <= baseaddr) && \
(baseaddr <=DISP_MAX_Address)) ? T :NIL )
(((DisplayRegion68k <= (baseaddr)) && \
((baseaddr) <= DISP_MAX_Address)) ? T : NIL )
#endif

#ifdef XWINDOW
Expand Down
40 changes: 20 additions & 20 deletions inc/gcdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/* IncAllocCnt is called only when *Reclaim_cnt_word != NIL */

#define IncAllocCnt(n) {\
if ((*Reclaim_cnt_word -= n) <= S_POSITIVE) {\
if ((*Reclaim_cnt_word -= (n)) <= S_POSITIVE) { \
/* time for GC */\
Irq_Stk_Check = Irq_Stk_End = 0;\
*Reclaim_cnt_word = S_POSITIVE;\
Expand All @@ -57,35 +57,35 @@

/* DecAllocCnt only called when *Reclaim_cnt_word != NIL */

#define DecAllocCnt(n) { *Reclaim_cnt_word += n; }
#define DecAllocCnt(n) { *Reclaim_cnt_word += (n); }

#define FreeLink(link) {\
GETGC(link) = 0;\
GETGC(link+1) = GETGC(HTcoll);\
GETGC(HTcoll) = (link - HTcoll);\
#define FreeLink(link) { \
GETGC(link) = 0; \
GETGC((link)+1) = GETGC(HTcoll); \
GETGC(HTcoll) = ((link) - HTcoll); \
}


/* Given the contents of an HTMAIN or HTCOLL entry,
get the link pointer (i.e., turn off the low bit) */
#define GetLinkptr(entry) (entry & 0x0fffffffe)
#define GetLinkptr(entry) ((entry) & 0x0fffffffe)


#define DelLink(link, prev, entry) { \
if (prev != (GCENTRY *)0) \
if ((prev) != (GCENTRY *)0) \
{ \
GETGC((GCENTRY *)prev + 1) = GETGC((GCENTRY *)link + 1); \
GETGC((GCENTRY *)(prev) + 1) = GETGC((GCENTRY *)(link) + 1); \
} \
else \
{ \
GETGC((GCENTRY *)entry) = GETGC((GCENTRY *)link + 1) | 1; \
GETGC((GCENTRY *)(entry)) = GETGC((GCENTRY *)(link) + 1) | 1; \
} \
FreeLink((GCENTRY *)link); \
link = (GCENTRY *)(HTcoll + GetLinkptr(GETGC((GCENTRY *)entry))); \
if (GETGC((GCENTRY *)link + 1) == 0) \
FreeLink((GCENTRY *)(link)); \
(link) = (GCENTRY *)(HTcoll + GetLinkptr(GETGC((GCENTRY *)(entry)))); \
if (GETGC((GCENTRY *)(link) + 1) == 0) \
{ \
GETGC((GCENTRY *)entry) = GETGC((GCENTRY *)link); \
FreeLink((GCENTRY *)link); \
GETGC((GCENTRY *)(entry)) = GETGC((GCENTRY *)(link)); \
FreeLink((GCENTRY *)(link)); \
} \
}

Expand All @@ -104,18 +104,18 @@
#define GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) { \
if (*Reclaim_cnt_word != NIL) \
val = htfind(ptr, case); \
(val) = htfind((ptr), (case)); \
else \
val = rec_htfind(ptr, case); \
} else val = NIL; \
(val) = rec_htfind((ptr), (case)); \
} else (val) = NIL; \
}

#define REC_GCLOOKUP(ptr, case) { if (RefCntP(ptr)) rec_htfind(ptr, case); }
#define REC_GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) \
val = rec_htfind(ptr, case); \
(val) = rec_htfind((ptr), (case)); \
else \
val = NIL; \
(val) = NIL; \
}

#define FRPLPTR(old , new) { \
Expand Down
Loading