1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-22 16:58:03 +00:00

Compare commits

..

15 Commits

Author SHA1 Message Date
Larry Masinter
d625665cde WIP still, trying for a fix 2021-05-24 12:26:31 -07:00
Larry Masinter
c0850ddb52 WIP still; now it looks like inlineC.h but it still fails 2021-05-15 16:10:06 -07:00
Larry Masinter
68d4a61bf1 WIP: make variable types in simulate_unbind match OP_unbind 2021-05-15 12:21:06 -07:00
Abe Jellinek
91fe7d51f9 Correct Medley GitHub link in README (#380) 2021-04-14 09:38:11 -07:00
Nick Briggs
a5410ef93d Cleanup USE_DPLI usage (#378)
Until now, the only differentiation between using DLPI and using NIT for
the ethernet interface was expressed as a function of USE_DLPI.

This commit makes explicit when code is for the DLPI interface or the NIT
interface, with USE_DLPI and USE_NIT.  This is setup for using the BPF
interface to the ethernet as an alternative.
2021-04-07 20:51:28 -07:00
Abe Jellinek
5ce292ed32 Command line: fix potential buffer overruns in argument/env variable handling (#375)
* Fix buffer overrun vulnerability: use strncpy

read_Xoption uses a char buffer defined in main.c with length
MAXPATHLEN, aka PATH_MAX in POSIX. Unfortunately it was using strcpy to
copy from the command-line arguments (via argv) and the environment (via
getenv) without any bounds checking whatsoever. This could very easily
cause an overflow.

It's unlikely that a user will want to provide a path longer than
PATH_MAX-1 (a generous 1023 bytes on my machine). If they try, we should
stop them from causing any damage.

* Use strlcpy instead of strncpy

Thanks to Nick Briggs for the suggestion. It would be best to use
sizeof(sysout_name) instead of hardcoding a reference to the PATH_MAX
constant, but unfortunately sysout_name is an extern in xrdopt.c and so
the compiler doesn't know its size. I don't want to mess with that
coupling in this commit, because I assume there was a reason for doing
it that way rather than putting sysout_name in a header; I'll keep the
scope of the changes here small.

* Revert "Use strlcpy instead of strncpy"

Ah. This is not great. Turns out strlcpy is a nonstandard BSD extension
with its own set of problems
[https://en.wikibooks.org/wiki/C_Programming/C_Reference/nonstandard/strlcpy]
that we may be best served by avoiding. On Linux, it's only accessible
through libbsd, and we have no other reason (as far as I can tell) to
require that. Unless we want to provide our own strlcpy implementation,
we should stick with strncpy. It's far safer than what was there before
and doesn't present any edge cases in this scenario that are apparent to
me.
2021-04-05 14:43:37 -07:00
Nick Briggs
081e2288ff Enable X mouse buttons 6 and 7 for horizontal scrolling. (#367) 2021-03-29 14:03:14 -07:00
Nick Briggs
c4873d0ff8 Improvements to package/atom access in the sysout from maiko C code (#372)
* Display atom name in error message if get_package_atom() fails

* Various fixes to package/atom handling in testtool.c

Remove S_TOPVAL and S_MAKEATOM which only existed to deal with an old issue
with dbx where you supposedly couldn't enter a string with "\" in it.

Remove countchar(), which is functionally identical to  strlen(), and adjust
code that used it.

Adjust return type of MAKEATOM() to be the LispPTR that it should be, instead of int.

Limit find_package_from_name() to examining only the number of entries that are
present in the *PACKAGE-FROM-INDEX* array, instead of walking off the end.

MakeAtom68k() now drops into uraid() if asked to look up an atom that does not exist
(Make... is a misnomer, it will never *make* the atom, only lookup an existing
one)
2021-03-29 14:01:10 -07:00
Nick Briggs
01a8948a7d Rename _curXXX structures to curXXX to avoid leading underscore (#376) 2021-03-29 12:34:32 -07:00
Nick Briggs
36ccd9a5f5 warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses] (#374)
Except where the expansion would be syntactically invalid,
for example "goto macroarg;" detection of which is a bug in clang-tidy,
so warn it off with a NOLINT...(bugprone-macro-parentheses)
2021-03-20 16:31:23 -07:00
Larry Masinter
f6da80f8b3 add makefile-init-linux.x86_64 (#373) 2021-03-18 15:45:02 -07:00
Nick Briggs
be4d4c771e Fix printf format warnings in testtool.c (#369)
Conversion of PC output from octal to hexadecimal will be handled separately as there are multiple places that this change needs to take place.
2021-03-18 15:40:02 -07:00
Nick Briggs
d025ff0101 Add makefile fragment for INIT processing for macOS on x86_64 (#371) 2021-03-15 20:52:45 -07:00
Larry Masinter
22ae23552c Update README.md for simplified Mac instructions (#370)
* Update README.md

* update (new M1)
2021-03-03 17:17:04 -08:00
Nick Briggs
082bd15542 Add makefile fragment for armv7l systems that self-identify as aarch64 instead (#368)
Closes #361
2021-02-24 19:24:19 -08:00
57 changed files with 586 additions and 568 deletions

View File

@@ -4,9 +4,9 @@ Maiko is the implementation of the Medley Interlisp virtual machine, for a
byte-coded Lisp instruction set and some low-level functions for byte-coded Lisp instruction set and some low-level functions for
connecting with Lisp for access to display (via X11) and disk etc. connecting with Lisp for access to display (via X11) and disk etc.
Newcomers should check out the [Medley Interlisp Introduction](https://github.com/Interlisp/medley/wiki/Medley-Interlisp-Introduction). For an overview, see [Medley Interlisp Introduction](https://github.com/Interlisp/medley/wiki/Medley-Interlisp-Introduction).
See [the Medley repository](https://github.org/Interlisp/medley) for See [the Medley repository](https://github.com/Interlisp/medley) for
* [Issues](https://github.com/Interlisp/medley/issues) (note that maiko issues are there too) * [Issues](https://github.com/Interlisp/medley/issues) (note that maiko issues are there too)
* [Discussions](https://github.com/Interlisp/medley/discussions) (Q&A, announcements, etc) * [Discussions](https://github.com/Interlisp/medley/discussions) (Q&A, announcements, etc)
* [Medley's README](https://github.com/Interlisp/medley/blob/master/README.md) * [Medley's README](https://github.com/Interlisp/medley/blob/master/README.md)
@@ -33,18 +33,17 @@ $ cd maiko/bin
$ ./makeright x $ ./makeright x
``` ```
* The build will (attempt to) detect the OS-type and cpu-type. It will build binaries `lde` and `ldex` in `../ostype.cputype` (with .o files in `..ostype.cputype-x`. For example, Linux on a 64-bit x86 will use `linux.x86_64`, while MacOS 11 on (new) Mac will use `darwin.arm64`. * The build will (attempt to) detect the OS-type and cpu-type. It will build binaries `lde` and `ldex` in `../ostype.cputype` (with .o files in `..ostype.cputype-x`. For example, Linux on a 64-bit x86 will use `linux.x86_64`, while MacOS 11 on a (new M1) Mac will use `darwin.aarch64`.
* If you prefer using `gcc` over `clang`, you will need to edit the makefile fragment for your configuration (`makefile-ostype.cputype-x1) and comment out the line (with a #) that defines `CC` for `clang` and uncomment the line (delete the #) for the line that defines `CC` for `gcc`. * If you prefer using `gcc` over `clang`, you will need to edit the makefile fragment for your configuration (`makefile-ostype.cputype-x`) and comment out the line (with a #) that defines `CC` for `clang` and uncomment the line (delete the #) for the line that defines `CC` for `gcc`.
* There is a cmake configuration (TBD) * There is a cmake configuration (TBD To Be Described here).
### Building For MacOS ### Building For MacOS
* Running on MacOS requires an X server, and building on a Mac requires X client libraries. * Running on MacOS requires an X server, and building on a Mac requires X client libraries.
An X-server for x86 MacOS (and X11 client libraries) can be freely obtained at https://www.xquartz.org/ An X-server for MacOS (and X11 client libraries) can be freely obtained at https://www.xquartz.org/releases
For the new arm64 MacOS 11, you'll need https://x.org which you can get via MacPorts or Brew.
### Building for Windows 10 ### Building for Windows 10
Windows 10 currently requires "Docker for Desktop" or WSL2 -- basically a Linux virtual machine -- and a (Windows X-server). Windows 10 currently requires "Docker for Desktop" or WSL2 and a (Windows X-server).
See [Medley's README](https://github.com/Interlisp/medley/blob/master/README.md) for more. See [Medley's README](https://github.com/Interlisp/medley/blob/master/README.md) for more.

View File

@@ -0,0 +1,28 @@
# Options for MacOS, x86_64 processor, X windows, for INIT processing
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -I/opt/X11/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O0 -g
DEBUGFLAGS = # -DDEBUG -DOPTRACE
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
LDFLAGS = -L/opt/X11/lib -lX11 -lm
LDELDFLAGS = -L/opt/X11/lib -lX11 -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -0,0 +1,29 @@
# Options for Linux, x86 processor, X windows, for INIT processing
#CC = gcc -m64 $(GCC_CFLAGS)
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2, for INIT we want unoptimized in case we need to debug it
OPTFLAGS = -O0 -g
DEBUGFLAGS =
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -0,0 +1,27 @@
# Options for Linux, ARMv7 and X-Window
CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -17,7 +17,7 @@ XFILES = $(OBJECTDIR)xmkicon.o \
XFLAGS = -DXWINDOW XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2. # OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3 OPTFLAGS = -O0 -g3
DFLAGS = $(XFLAGS) -DRELEASE=351 DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm

View File

@@ -29,8 +29,8 @@
/**********************************************************************/ /**********************************************************************/
/* NOTE: These MACRO should be used for the pointers in LISP SYSOUT */ /* NOTE: These MACRO should be used for the pointers in LISP SYSOUT */
#define LLSH(datum , n) ((datum )<< n) #define LLSH(datum, n) ((datum) << (n))
#define LRSH(datum , n) ((datum) >> n) #define LRSH(datum, n) ((datum) >> (n))
#define HILOC(ptr) (LRSH(((unsigned int)(ptr) & SEGMASK),16)) #define HILOC(ptr) (LRSH(((unsigned int)(ptr) & SEGMASK),16))
#define LOLOC(ptr) ((unsigned int)(ptr) & 0x0ffff) #define LOLOC(ptr) ((unsigned int)(ptr) & 0x0ffff)

View File

@@ -48,7 +48,7 @@
/* translate LispPage to 68k address */ /* 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) ))

View File

@@ -10,20 +10,20 @@
/************************************************************************/ /************************************************************************/
#define MAX_SMALL 65535 /* == 0x0000FFFF */ #define MAX_SMALL 65535 /* == 0x0000FFFF */
#define MIN_SMALL -65536 /* == 0xFFFF0000 */ #define MIN_SMALL (-65536) /* == 0xFFFF0000 */
#define MAX_FIXP 2147483647 /* == 0x7FFFFFFF */ #define MAX_FIXP 2147483647 /* == 0x7FFFFFFF */
#define MIN_FIXP -2147483648 /* == 0x80000000 */ #define MIN_FIXP (-2147483648) /* == 0x80000000 */
#define GetSmalldata(x) \ #define GetSmalldata(x) \
(((SEGMASK & x) == S_POSITIVE) \ (((SEGMASK & (x)) == S_POSITIVE) \
? (0xFFFF & x) \ ? (0xFFFF & (x)) \
: (((SEGMASK & x) == S_NEGATIVE) ? (0xFFFF0000 | x) : error("Not smallp address"))) : (((SEGMASK & (x)) == S_NEGATIVE) ? (0xFFFF0000 | (x)) : error("Not smallp address")))
#define GetSmallp(x) \ #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")) \ : error("Not Smallp data")) \
: (S_POSITIVE | (0xFFFF & x))) : (S_POSITIVE | (0xFFFF & (x))))
#define FIXP_VALUE(dest) *((int *)Addr68k_from_LADDR(dest)) #define FIXP_VALUE(dest) *((int *)Addr68k_from_LADDR(dest))
@@ -31,32 +31,34 @@
#define N_GETNUMBER(sour, dest, label) \ #define N_GETNUMBER(sour, dest, label) \
do { \ do { \
dest = sour; /* access memory once */ \ (dest) = (sour); /* access memory once */ \
switch (SEGMASK & dest) { \ switch (SEGMASK & (dest)) { \
case S_POSITIVE: dest = 0xFFFF & (dest); break; \ case S_POSITIVE: (dest) = 0xFFFF & (dest); break; \
case S_NEGATIVE: dest = 0xFFFF0000 | (dest); break; \ case S_NEGATIVE: (dest) = 0xFFFF0000 | (dest); break; \
default: \ default: \
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
if (GetTypeNumber(dest) != TYPE_FIXP) goto label; \ if (GetTypeNumber(dest) != TYPE_FIXP) goto label; \
dest = FIXP_VALUE(dest); \ (dest) = FIXP_VALUE(dest); \
} \ } \
} while (0) } while (0)
#define N_IGETNUMBER(sour, dest, label) \ #define N_IGETNUMBER(sour, dest, label) \
do { \ do { \
dest = sour; /* access memory once */ \ (dest) = (sour); /* access memory once */ \
switch (SEGMASK & dest) { \ switch (SEGMASK & (dest)) { \
case S_POSITIVE: dest = 0xFFFF & dest; break; \ case S_POSITIVE: (dest) = 0xFFFF & (dest); break; \
case S_NEGATIVE: dest = 0xFFFF0000 | dest; break; \ case S_NEGATIVE: (dest) = 0xFFFF0000 | (dest); break; \
default: \ default: \
switch (GetTypeNumber(dest)) { \ switch (GetTypeNumber(dest)) { \
case TYPE_FIXP: dest = FIXP_VALUE(dest); break; \ case TYPE_FIXP: (dest) = FIXP_VALUE(dest); break; \
case TYPE_FLOATP: { \ case TYPE_FLOATP: { \
register float temp; \ register float temp; \
temp = FLOATP_VALUE(dest); \ temp = FLOATP_VALUE(dest); \
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
if ((temp > ((float)0x7fffffff)) || (temp < ((float)0x80000000))) goto label; \ if ((temp > ((float)0x7fffffff)) || (temp < ((float)0x80000000))) goto label; \
dest = (int)temp; \ (dest) = (int)temp; \
} break; \ } break; \
default: goto label; \ default: goto label; /* NOLINT(bugprone-macro-parentheses) */ \
} \ } \
break; \ break; \
} \ } \
@@ -64,15 +66,15 @@
#define ARITH_SWITCH(arg, result) \ #define ARITH_SWITCH(arg, result) \
do { \ do { \
switch ((int)arg & 0xFFFF0000) { \ switch ((int)(arg) & 0xFFFF0000) { \
case 0: result = (S_POSITIVE | (int)arg); break; \ case 0: (result) = (S_POSITIVE | (int)(arg)); break; \
case 0xFFFF0000: result = (S_NEGATIVE | (0xFFFF & (int)arg)); break; \ case 0xFFFF0000: (result) = (S_NEGATIVE | (0xFFFF & (int)(arg))); break; \
default: { \ default: { \
register LispPTR *wordp; \ register LispPTR *wordp; \
/* arg is FIXP, call createcell */ \ /* arg is FIXP, call createcell */ \
wordp = (LispPTR *)createcell68k(TYPE_FIXP); \ wordp = (LispPTR *)createcell68k(TYPE_FIXP); \
*((int *)wordp) = (int)arg; \ *((int *)wordp) = (int)(arg); \
result = (LADDR_from_68k(wordp)); \ (result) = (LADDR_from_68k(wordp)); \
break; \ break; \
} \ } \
} \ } \
@@ -104,9 +106,9 @@
#define N_ARITH_SWITCH(arg) \ #define N_ARITH_SWITCH(arg) \
do { \ do { \
switch (arg & 0xFFFF0000) { \ switch ((arg) & 0xFFFF0000) { \
case 0: return (S_POSITIVE | arg); \ case 0: return (S_POSITIVE | (arg)); \
case 0xFFFF0000: return (S_NEGATIVE | (0xFFFF & arg)); \ case 0xFFFF0000: return (S_NEGATIVE | (0xFFFF & (arg))); \
default: { \ default: { \
register LispPTR *fixpp; \ register LispPTR *fixpp; \
/* arg is FIXP, call createcell */ \ /* arg is FIXP, call createcell */ \

View File

@@ -140,7 +140,7 @@
#define B_src_word_in_postloop src32lbit >= dst32lbit #define B_src_word_in_postloop src32lbit >= dst32lbit
/* VARIABLES */ /* 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 B_num_loop ((w - dst32rbit - 1) > 0) ? ((w - dst32rbit - 1) >> 5) : 0
#define F_preloop_mask ((dst32lbit) ? (~(0xFFFFFFFF << (32 - dst32lbit))) : 0xFFFFFFFF) #define F_preloop_mask ((dst32lbit) ? (~(0xFFFFFFFF << (32 - dst32lbit))) : 0xFFFFFFFF)
#define F_postloop_mask 0xFFFFFFFF << (31 - dst32rbit) #define F_postloop_mask 0xFFFFFFFF << (31 - dst32rbit)

View File

@@ -27,16 +27,16 @@
#define ERROR PIX_SRC #define ERROR PIX_SRC
#define PixOperation( SRCTYPE, OPERATION ) \ #define PixOperation( SRCTYPE, OPERATION ) \
( SRCTYPE == ERASE ? \ ( (SRCTYPE) == ERASE ? \
(OPERATION == REPLACE ? PIX_NOT(PIX_SRC) : \ ((OPERATION) == REPLACE ? PIX_NOT(PIX_SRC) : \
(OPERATION == PAINT ? PIX_NOT(PIX_SRC) | PIX_DST : \ ((OPERATION) == PAINT ? PIX_NOT(PIX_SRC) | PIX_DST : \
(OPERATION == ERASE ? PIX_NOT(PIX_SRC) & PIX_DST : \ ((OPERATION) == ERASE ? PIX_NOT(PIX_SRC) & PIX_DST : \
(OPERATION == INVERT ? PIX_NOT(PIX_SRC) ^ PIX_DST : ERROR)))) : \ ((OPERATION) == INVERT ? PIX_NOT(PIX_SRC) ^ PIX_DST : ERROR)))) : \
/* SRCTYPE == INPUT */ \ /* SRCTYPE == INPUT */ \
(OPERATION == REPLACE ? PIX_SRC : \ ((OPERATION) == REPLACE ? PIX_SRC : \
(OPERATION == PAINT ? PIX_SRC | PIX_DST : \ ((OPERATION) == PAINT ? PIX_SRC | PIX_DST : \
(OPERATION == ERASE ? PIX_SRC & PIX_DST : \ ((OPERATION) == ERASE ? PIX_SRC & PIX_DST : \
(OPERATION == INVERT ? PIX_SRC ^ PIX_DST : ERROR))))) ((OPERATION) == INVERT ? PIX_SRC ^ PIX_DST : ERROR)))))
extern DLword *EmMouseX68K, *EmMouseY68K; extern DLword *EmMouseX68K, *EmMouseY68K;

View File

@@ -29,7 +29,7 @@
/* On 68010,68000 This Macro does not effect */ /* On 68010,68000 This Macro does not effect */
#ifdef NEWCDRCODING #ifdef NEWCDRCODING
#define CARFIELD(x) ((int)x & 0x0fffffff) #define CARFIELD(x) ((int)(x) & 0x0fffffff)
/* CDR-Codes defs */ /* CDR-Codes defs */
#define CDR_ONPAGE 8 #define CDR_ONPAGE 8
@@ -124,7 +124,7 @@ typedef struct freec {
#endif /* BYTESWAP */ #endif /* BYTESWAP */
#define FREECONS(page, offset) ((freecons *)((DLword *)page + offset)) #define FREECONS(page, offset) ((freecons *)((DLword *)(page) + (offset)))
/************************************************************************/ /************************************************************************/
/* */ /* */
@@ -375,20 +375,20 @@ struct cadr_cell {
#else #else
/* Good for old LITATOMS and new NEW-ATOMs */ /* Good for old LITATOMS and new NEW-ATOMs */
#define GetDEFCELL68k(index) \ #define GetDEFCELL68k(index) \
(((index & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_DEFN_OFFSET) \ ((((index) & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_DEFN_OFFSET) \
: GetDEFCELLlitatom(index)) : GetDEFCELLlitatom(index))
#define GetVALCELL68k(index) \ #define GetVALCELL68k(index) \
(((index & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_VALUE_OFFSET) \ ((((index) & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_VALUE_OFFSET) \
: GetVALCELLlitatom(index)) : GetVALCELLlitatom(index))
#define GetPnameCell(index) \ #define GetPnameCell(index) \
(((index & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PNAME_OFFSET) \ ((((index) & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PNAME_OFFSET) \
: GetPnameCelllitatom(index)) : GetPnameCelllitatom(index))
#define GetPropCell(index) \ #define GetPropCell(index) \
(((index & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PLIST_OFFSET) \ ((((index) & SEGMASK) != 0) ? (LispPTR *)(Addr68k_from_LADDR(index) + NEWATOM_PLIST_OFFSET) \
: GetPropCelllitatom(index)) : GetPropCelllitatom(index))
/* Good only for old-style LITATOMS */ /* Good only for old-style LITATOMS */
@@ -420,6 +420,6 @@ struct cadr_cell {
if (GetTypeNumber(parm) != TYPE_LISTP) { \ if (GetTypeNumber(parm) != TYPE_LISTP) { \
ERROR_EXIT(tos); \ ERROR_EXIT(tos); \
} else \ } else \
dest = cadr(parm); \ (dest) = cadr(parm); \
} }
#endif #endif

View File

@@ -271,7 +271,7 @@ typedef struct
} }
#endif /* XWINDOW */ #endif /* XWINDOW */
#define OUTER_SB_WIDTH(dsp) (dsp->ScrollBarWidth + 2*(dsp->InternalBorderWidth)) #define OUTER_SB_WIDTH(dsp) ((dsp)->ScrollBarWidth + 2*((dsp)->InternalBorderWidth))
#ifndef min #ifndef min
#define min( a, b ) (((a)<(b))?(a):(b)) #define min( a, b ) (((a)<(b))?(a):(b))

View File

@@ -66,8 +66,8 @@ extern DLword *DISP_MAX_Address;
extern DLword *DisplayRegion68k; extern DLword *DisplayRegion68k;
#define in_display_segment(baseaddr) \ #define in_display_segment(baseaddr) \
(((DisplayRegion68k <= baseaddr) && \ (((DisplayRegion68k <= (baseaddr)) && \
(baseaddr <=DISP_MAX_Address)) ? T :NIL ) ((baseaddr) <= DISP_MAX_Address)) ? T : NIL )
#endif #endif
#ifdef XWINDOW #ifdef XWINDOW

View File

@@ -48,7 +48,7 @@
/* IncAllocCnt is called only when *Reclaim_cnt_word != NIL */ /* IncAllocCnt is called only when *Reclaim_cnt_word != NIL */
#define IncAllocCnt(n) {\ #define IncAllocCnt(n) {\
if ((*Reclaim_cnt_word -= n) <= S_POSITIVE) {\ if ((*Reclaim_cnt_word -= (n)) <= S_POSITIVE) { \
/* time for GC */\ /* time for GC */\
Irq_Stk_Check = Irq_Stk_End = 0;\ Irq_Stk_Check = Irq_Stk_End = 0;\
*Reclaim_cnt_word = S_POSITIVE;\ *Reclaim_cnt_word = S_POSITIVE;\
@@ -57,35 +57,35 @@
/* DecAllocCnt only called when *Reclaim_cnt_word != NIL */ /* 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) {\ #define FreeLink(link) { \
GETGC(link) = 0;\ GETGC(link) = 0; \
GETGC(link+1) = GETGC(HTcoll);\ GETGC((link)+1) = GETGC(HTcoll); \
GETGC(HTcoll) = (link - HTcoll);\ GETGC(HTcoll) = ((link) - HTcoll); \
} }
/* Given the contents of an HTMAIN or HTCOLL entry, /* Given the contents of an HTMAIN or HTCOLL entry,
get the link pointer (i.e., turn off the low bit) */ 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) { \ #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 \ else \
{ \ { \
GETGC((GCENTRY *)entry) = GETGC((GCENTRY *)link + 1) | 1; \ GETGC((GCENTRY *)(entry)) = GETGC((GCENTRY *)(link) + 1) | 1; \
} \ } \
FreeLink((GCENTRY *)link); \ FreeLink((GCENTRY *)(link)); \
link = (GCENTRY *)(HTcoll + GetLinkptr(GETGC((GCENTRY *)entry))); \ (link) = (GCENTRY *)(HTcoll + GetLinkptr(GETGC((GCENTRY *)(entry)))); \
if (GETGC((GCENTRY *)link + 1) == 0) \ if (GETGC((GCENTRY *)(link) + 1) == 0) \
{ \ { \
GETGC((GCENTRY *)entry) = GETGC((GCENTRY *)link); \ GETGC((GCENTRY *)(entry)) = GETGC((GCENTRY *)(link)); \
FreeLink((GCENTRY *)link); \ FreeLink((GCENTRY *)(link)); \
} \ } \
} }
@@ -104,18 +104,18 @@
#define GCLOOKUPV(ptr, case, val) { \ #define GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) { \ if (RefCntP(ptr)) { \
if (*Reclaim_cnt_word != NIL) \ if (*Reclaim_cnt_word != NIL) \
val = htfind(ptr, case); \ (val) = htfind((ptr), (case)); \
else \ else \
val = rec_htfind(ptr, case); \ (val) = rec_htfind((ptr), (case)); \
} else val = NIL; \ } else (val) = NIL; \
} }
#define REC_GCLOOKUP(ptr, case) { if (RefCntP(ptr)) rec_htfind(ptr, case); } #define REC_GCLOOKUP(ptr, case) { if (RefCntP(ptr)) rec_htfind(ptr, case); }
#define REC_GCLOOKUPV(ptr, case, val) { \ #define REC_GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) \ if (RefCntP(ptr)) \
val = rec_htfind(ptr, case); \ (val) = rec_htfind((ptr), (case)); \
else \ else \
val = NIL; \ (val) = NIL; \
} }
#define FRPLPTR(old , new) { \ #define FRPLPTR(old , new) { \

View File

@@ -211,7 +211,7 @@
#define JUMPMACRO(x) \ #define JUMPMACRO(x) \
do { \ do { \
CHECK_INTERRUPT; \ CHECK_INTERRUPT; \
PCMACL += x; \ PCMACL += (x); \
nextop0; \ nextop0; \
} while (0) } while (0)
@@ -221,7 +221,7 @@
{ \ { \
CHECK_INTERRUPT; \ CHECK_INTERRUPT; \
POP; \ POP; \
PCMACL += x; \ PCMACL += (x); \
nextop0; \ nextop0; \
} \ } \
} while (0) } while (0)
@@ -231,7 +231,7 @@
{ \ { \
CHECK_INTERRUPT; \ CHECK_INTERRUPT; \
POP; \ POP; \
PCMACL += x; \ PCMACL += (x); \
nextop0; \ nextop0; \
} \ } \
} while (0) } while (0)
@@ -239,13 +239,13 @@
#define GETBASE_N(N) \ #define GETBASE_N(N) \
do { \ do { \
TOPOFSTACK = \ TOPOFSTACK = \
(S_POSITIVE | GETWORD((DLword *)Addr68k_from_LADDR((POINTERMASK & TOPOFSTACK) + N))); \ (S_POSITIVE | GETWORD((DLword *)Addr68k_from_LADDR((POINTERMASK & TOPOFSTACK) + (N)))); \
nextop2; \ nextop2; \
} while (0) } while (0)
#define GETBASEPTR_N(N) \ #define GETBASEPTR_N(N) \
do { \ do { \
TOPOFSTACK = (POINTERMASK & *((LispPTR *)Addr68k_from_LADDR((POINTERMASK & TOPOFSTACK) + N))); \ TOPOFSTACK = (POINTERMASK & *((LispPTR *)Addr68k_from_LADDR((POINTERMASK & TOPOFSTACK) + (N)))); \
nextop2; \ nextop2; \
} while (0) } while (0)
#define PUTBASEBYTE \ #define PUTBASEBYTE \
@@ -288,44 +288,44 @@
nextop1; \ nextop1; \
} while (0) } while (0)
#define PUTBASEPTR_N(n) \ #define PUTBASEPTR_N(n) \
do { \ do { \
register int base; \ register int base; \
base = POINTERMASK & POP_TOS_1; \ base = POINTERMASK & POP_TOS_1; \
*((LispPTR *)Addr68k_from_LADDR(base + n)) = TOPOFSTACK; \ *((LispPTR *)Addr68k_from_LADDR(base + (n))) = TOPOFSTACK; \
TOPOFSTACK = base; \ TOPOFSTACK = base; \
nextop2; \ nextop2; \
} while (0) } while (0)
#define PUTBASE_N(n) \ #define PUTBASE_N(n) \
do { \ do { \
register int base; \ register int base; \
if (GetHiWord(TOPOFSTACK) != (S_POSITIVE >> 16)) goto op_ufn; \ if (GetHiWord(TOPOFSTACK) != (S_POSITIVE >> 16)) goto op_ufn; \
base = POINTERMASK & POP_TOS_1; \ base = POINTERMASK & POP_TOS_1; \
GETWORD((DLword *)Addr68k_from_LADDR(base + n)) = GetLoWord(TOPOFSTACK); \ GETWORD((DLword *)Addr68k_from_LADDR(base + (n))) = GetLoWord(TOPOFSTACK); \
TOPOFSTACK = base; \ TOPOFSTACK = base; \
nextop2; \ nextop2; \
} while (0) } while (0)
#define PVARX(x) \ #define PVARX(x) \
do { \ do { \
PUSH(GetLongWord((DLword *)PVAR + x)); \ PUSH(GetLongWord((DLword *)PVAR + (x))); \
nextop2; \ nextop2; \
} while (0) } while (0)
#define PVARX_(x) \ #define PVARX_(x) \
do { \ do { \
*((LispPTR *)((DLword *)PVAR + x)) = TOPOFSTACK; \ *((LispPTR *)((DLword *)PVAR + (x))) = TOPOFSTACK; \
nextop2; \ nextop2; \
} while (0) } while (0)
#define IVARX(x) \ #define IVARX(x) \
do { \ do { \
PUSH(GetLongWord((DLword *)IVAR + x)); \ PUSH(GetLongWord((DLword *)IVAR + (x))); \
nextop2; \ nextop2; \
} while (0) } while (0)
#define IVARX_(x) \ #define IVARX_(x) \
do { \ do { \
*((LispPTR *)((DLword *)IVAR + x)) = TOPOFSTACK; \ *((LispPTR *)((DLword *)IVAR + (x))) = TOPOFSTACK; \
nextop2; \ nextop2; \
} while (0) } while (0)
#ifndef BIGATOMS #ifndef BIGATOMS
@@ -565,14 +565,14 @@
nextop1; \ nextop1; \
} while (0) } while (0)
#define GETBITS_N_M(a, b) \ #define GETBITS_N_M(a, b) \
do { \ do { \
register int temp, bb = b; \ register int temp, bb = b; \
temp = 0xF & bb; \ temp = 0xF & bb; \
TOPOFSTACK = S_POSITIVE | (((GETWORD(Addr68k_from_LADDR(POINTERMASK & (TOPOFSTACK + a)))) >> \ TOPOFSTACK = S_POSITIVE | (((GETWORD(Addr68k_from_LADDR(POINTERMASK & (TOPOFSTACK + (a))))) >> \
(16 - ((0xF & (bb >> 4)) + temp + 1))) & \ (16 - ((0xF & (bb >> 4)) + temp + 1))) & \
n_mask_array[temp]); \ n_mask_array[temp]); \
nextop3; \ nextop3; \
} while (0) } while (0)
#define PUTBITS_N_M(a, b) \ #define PUTBITS_N_M(a, b) \
@@ -583,7 +583,7 @@
register int shift_size, field_size, fmask; \ register int shift_size, field_size, fmask; \
if ((SEGMASK & TOPOFSTACK) != S_POSITIVE) { goto op_ufn; }; \ if ((SEGMASK & TOPOFSTACK) != S_POSITIVE) { goto op_ufn; }; \
base = POINTERMASK & POP_TOS_1; \ base = POINTERMASK & POP_TOS_1; \
pword = (DLword *)Addr68k_from_LADDR(base + a); \ pword = (DLword *)Addr68k_from_LADDR(base + (a)); \
field_size = 0xF & bb; \ field_size = 0xF & bb; \
shift_size = 15 - (0xF & (bb >> 4)) - field_size; \ shift_size = 15 - (0xF & (bb >> 4)) - field_size; \
fmask = n_mask_array[field_size] << shift_size; \ fmask = n_mask_array[field_size] << shift_size; \
@@ -633,16 +633,16 @@
nextop1; \ nextop1; \
} while (0) } while (0)
#define TYPEP(n) \ #define TYPEP(n) \
do { \ do { \
if ((DLword)GetTypeNumber(TOPOFSTACK) != n) TOPOFSTACK = NIL_PTR; \ if ((DLword)GetTypeNumber(TOPOFSTACK) != (n)) TOPOFSTACK = NIL_PTR; \
nextop2; \ nextop2; \
} while (0) } while (0)
#define TYPEMASK(n) \ #define TYPEMASK(n) \
do { \ do { \
if ((((DLword)GetTypeEntry(TOPOFSTACK)) & ((DLword)n << 8)) == 0) TOPOFSTACK = NIL_PTR; \ if ((((DLword)GetTypeEntry(TOPOFSTACK)) & ((DLword)(n) << 8)) == 0) TOPOFSTACK = NIL_PTR; \
nextop2; \ nextop2; \
} while (0) } while (0)
#define INSTANCEP(atom_index) \ #define INSTANCEP(atom_index) \
@@ -651,16 +651,16 @@
nextop_atom; \ nextop_atom; \
} while (0) } while (0)
#define STOREN(n) \ #define STOREN(n) \
do { \ do { \
*(CSTKPTR - ((n + 2) >> 1)) = TOPOFSTACK; \ *(CSTKPTR - (((n) + 2) >> 1)) = TOPOFSTACK; \
nextop2; \ nextop2; \
} while (0) } while (0)
#define COPYN(n) \ #define COPYN(n) \
do { \ do { \
PUSH(*(CSTKPTR - ((n + 2) >> 1))); \ PUSH(*(CSTKPTR - (((n) + 2) >> 1))); \
nextop2; \ nextop2; \
} while (0) } while (0)
#define POPN(n) \ #define POPN(n) \
@@ -792,16 +792,16 @@
} while (0) } while (0)
#endif /* BIGVM */ #endif /* BIGVM */
#define FVAR(n) \ #define FVAR(n) \
do { \ do { \
register LispPTR *chain; \ register LispPTR *chain; \
chain = (LispPTR *)(PVar + n); \ chain = (LispPTR *)(PVar + (n)); \
if (WBITSPTR(chain)->LSB) { \ if (WBITSPTR(chain)->LSB) { \
PUSH(GetLongWord(Addr68k_from_LADDR(POINTERMASK &swapx(native_newframe(n >> 1))))); \ PUSH(GetLongWord(Addr68k_from_LADDR(POINTERMASK &swapx(native_newframe((n) >> 1))))); \
nextop1; \ nextop1; \
} /* if(((WBITS */ \ } /* if(((WBITS */ \
PUSH(GetLongWord(Addr68k_from_LADDR(POINTERMASK &swapx(*chain)))); \ PUSH(GetLongWord(Addr68k_from_LADDR(POINTERMASK &swapx(*chain)))); \
nextop1; \ nextop1; \
} while (0) } while (0)
#define FVARX(n) \ #define FVARX(n) \

View File

@@ -97,16 +97,16 @@ struct state {
/***** Get_DLword(ptr) ptr is char* ***/ /***** Get_DLword(ptr) ptr is char* ***/
#ifndef UNALIGNED_FETCH_OK #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 #else
#define Get_DLword(ptr) *(((DLword *)WORDPTR(ptr))) #define Get_DLword(ptr) *(((DLword *)WORDPTR(ptr)))
#endif #endif
#ifdef BIGVM #ifdef BIGVM
#define Get_Pointer(ptr) \ #define Get_Pointer(ptr) \
((Get_BYTE(ptr) << 24) | (Get_BYTE(ptr + 1) << 16) | (Get_BYTE(ptr + 2) << 8) | Get_BYTE(ptr + 3)) ((Get_BYTE(ptr) << 24) | (Get_BYTE((ptr) + 1) << 16) | (Get_BYTE((ptr) + 2) << 8) | Get_BYTE((ptr) + 3))
#else #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 */ #endif /* BIGVM */
#define Get_code_BYTE Get_BYTE #define Get_code_BYTE Get_BYTE
@@ -241,11 +241,11 @@ struct state {
/* Fetching 2 bytes to make a word -- always do it the hard way */ /* 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!! */ /* 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 #ifdef BIGVM
#define Get_Pointer(ptr) \ #define Get_Pointer(ptr) \
((Get_BYTE(ptr) << 24) | (Get_BYTE(ptr + 1) << 16) | (Get_BYTE(ptr + 2) << 8) | Get_BYTE(ptr + 3)) ((Get_BYTE(ptr) << 24) | (Get_BYTE((ptr) + 1) << 16) | (Get_BYTE((ptr) + 2) << 8) | Get_BYTE((ptr) + 3))
#else #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 */ #endif /* BIGVM */
@@ -336,7 +336,7 @@ extern struct state MachineState;
offset: word offset from base offset: word offset from base
return: DLword* return: DLword*
****************************************************/ ****************************************************/
#define MakeAddr(base, offset) ((DLword *)(base + (int)offset)) #define MakeAddr(base, offset) ((DLword *)((base) + (int)(offset)))
/**************************************************** /****************************************************
GetHiWord: GetHiWord:
@@ -369,10 +369,10 @@ PopCStack:
PopStackTo: CSTK -> Place PopStackTo: CSTK -> Place
#define PopStackTo(Place) {Place= *((LispPTR *)(--CurrentStackPTR)); CurrentStackPTR--; } #define PopStackTo(Place) {Place= *((LispPTR *)(--CurrentStackPTR)); CurrentStackPTR--; }
*****************************************************/ *****************************************************/
#define PopStackTo(Place) \ #define PopStackTo(Place) \
do { \ do { \
Place = *((LispPTR *)(CurrentStackPTR)); \ (Place) = *((LispPTR *)(CurrentStackPTR)); \
CurrentStackPTR -= 2; \ CurrentStackPTR -= 2; \
} while (0) } while (0)
/**************************************************** /****************************************************
@@ -399,7 +399,7 @@ PushStack:
SmashStack: SmashStack:
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR-1))=x) #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 Get_BYTE(byteptr) byteptr: pointer to 8 bit data
@@ -416,7 +416,7 @@ DOSTACKOVERFLOW(argnum,bytenum) if it needs hardreturn-cleanup
#define DOSTACKOVERFLOW(argnum, bytenum) \ #define DOSTACKOVERFLOW(argnum, bytenum) \
do { \ do { \
if (do_stackoverflow(T)) { \ if (do_stackoverflow(T)) { \
PushStack(S_POSITIVE | argnum); \ PushStack(S_POSITIVE | (argnum)); \
contextsw(SubovFXP, bytenum, 1); \ contextsw(SubovFXP, bytenum, 1); \
return; \ return; \
} \ } \
@@ -505,7 +505,7 @@ DOSTACKOVERFLOW(argnum,bytenum) if it needs hardreturn-cleanup
#define SFS_ARRAYSWITCHED 3 #define SFS_ARRAYSWITCHED 3
#define SFS_FULLYSWITCHED 4 #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 */
@@ -586,7 +586,7 @@ typedef struct newatom {
#ifdef BIGVM #ifdef BIGVM
#define GETFPTOVP(b, o) b[o] #define GETFPTOVP(b, o) b[o]
#define GETPAGEOK(b, o) (b[o] >> 16) #define GETPAGEOK(b, o) ((b)[o] >> 16)
#else #else
#define GETFPTOVP GETWORDBASEWORD #define GETFPTOVP GETWORDBASEWORD
#define GETPAGEOK GETWORDBASEWORD #define GETPAGEOK GETWORDBASEWORD

View File

@@ -36,12 +36,12 @@
extern DLword *Lisp_world; /* To access LispSysout area */ extern DLword *Lisp_world; /* To access LispSysout area */
#define ToLispTime(x) ((int)x + 29969152) #define ToLispTime(x) ((int)(x) + 29969152)
/* For getfileinfo. For WDATE&RDATE */ /* For getfileinfo. For WDATE&RDATE */
/* 29969152 == (timer.c)LISP_UNIX_TIME_DIFF */ /* 29969152 == (timer.c)LISP_UNIX_TIME_DIFF */
/* - 61200 == - 17hours */ /* - 61200 == - 17hours */
#define ToUnixTime(x) ((int)x - 29969152) #define ToUnixTime(x) ((int)(x) - 29969152)
/* For getfileinfo. For WDATE&RDATE */ /* For getfileinfo. For WDATE&RDATE */
/* 29969152 == (timer.c)LISP_UNIX_TIME_DIFF */ /* 29969152 == (timer.c)LISP_UNIX_TIME_DIFF */
@@ -92,7 +92,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
lf_base = ((char *)(Addr68k_from_LADDR(lf_arrayp->base))) \ lf_base = ((char *)(Addr68k_from_LADDR(lf_arrayp->base))) \
+ ((int)(lf_arrayp->offset)); \ + ((int)(lf_arrayp->offset)); \
strncpy(C, lf_base, lf_length); \ strncpy(C, lf_base, lf_length); \
C[lf_length] = '\0'; \ (C)[lf_length] = '\0'; \
break; \ break; \
\ \
case FAT_CHAR_TYPENUMBER: \ case FAT_CHAR_TYPENUMBER: \
@@ -121,7 +121,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
lf_base = ((char *)(Addr68k_from_LADDR(lf_arrayp->base))) \ lf_base = ((char *)(Addr68k_from_LADDR(lf_arrayp->base))) \
+ ((int)(lf_arrayp->offset)); \ + ((int)(lf_arrayp->offset)); \
StrNCpyFromLispToC(C , lf_base , lf_length ); \ StrNCpyFromLispToC(C , lf_base , lf_length ); \
C[lf_length] = '\0'; \ (C)[lf_length] = '\0'; \
break; \ break; \
\ \
case FAT_CHAR_TYPENUMBER: \ case FAT_CHAR_TYPENUMBER: \
@@ -153,16 +153,16 @@ extern DLword *Lisp_world; /* To access LispSysout area */
{ \ { \
OneDArray *lf_arrayp; \ OneDArray *lf_arrayp; \
lf_arrayp = (OneDArray *)(Addr68k_from_LADDR(LispString)); \ lf_arrayp = (OneDArray *)(Addr68k_from_LADDR(LispString)); \
switch(lf_arrayp->typenumber) \ switch(lf_arrayp->typenumber) \
{ \ { \
case THIN_CHAR_TYPENUMBER: \ case THIN_CHAR_TYPENUMBER: \
Length = lf_arrayp->fillpointer; \ (Length) = lf_arrayp->fillpointer; \
FatP = 0; \ (FatP) = 0; \
break; \ break; \
\ \
case FAT_CHAR_TYPENUMBER: \ case FAT_CHAR_TYPENUMBER: \
Length = lf_arrayp->fillpointer * 2; \ (Length) = lf_arrayp->fillpointer * 2; \
FatP = 1; \ (FatP) = 1; \
break; \ break; \
default: \ default: \
error("LispStringLength: Not a character array.\n"); \ error("LispStringLength: Not a character array.\n"); \
@@ -183,24 +183,24 @@ extern DLword *Lisp_world; /* To access LispSysout area */
{ \ { \
LispPTR *lf_naddress; \ LispPTR *lf_naddress; \
lf_naddress = (LispPTR *)(Addr68k_from_LADDR(lstringp)); \ lf_naddress = (LispPTR *)(Addr68k_from_LADDR(lstringp)); \
cstringp = (char *)(Addr68k_from_LADDR(((OneDArray *)lf_naddress)->base)); \ (cstringp) = (char *)(Addr68k_from_LADDR(((OneDArray *)lf_naddress)->base)); \
} }
#ifndef min #ifndef min
#define min(a, b) ((a <= b)?a:b) #define min(a, b) (((a) <= (b))?(a):(b))
#endif /* min */ #endif /* min */
#define LispNumToCInt(Lisp) \ #define LispNumToCInt(Lisp) \
( ((Lisp & SEGMASK) == S_POSITIVE) ? \ ( (((Lisp) & SEGMASK) == S_POSITIVE) ? \
(Lisp & 0xFFFF) : (*((int *)(Addr68k_from_LADDR(Lisp)))) ) ((Lisp) & 0xFFFF) : (*((int *)(Addr68k_from_LADDR(Lisp)))) )
#define UPLOWDIFF 0x20 #define UPLOWDIFF 0x20
#define DOWNCASE(name){ \ #define DOWNCASE(name){ \
\ \
char *lf_cp; \ char *lf_cp; \
\ \
for(lf_cp = name; *lf_cp!='\0'; ++lf_cp) \ for(lf_cp = (name); *lf_cp!='\0'; ++lf_cp) \
if((*lf_cp >= 'A') && (*lf_cp <= 'Z')) *lf_cp += UPLOWDIFF; \ if((*lf_cp >= 'A') && (*lf_cp <= 'Z')) *lf_cp += UPLOWDIFF; \
} }
@@ -208,7 +208,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
\ \
char *lf_cp; \ char *lf_cp; \
\ \
for(lf_cp = name; *lf_cp!='\0'; ++lf_cp) \ for(lf_cp = (name); *lf_cp!='\0'; ++lf_cp) \
if((*lf_cp >= 'a') && (*lf_cp <= 'z')) *lf_cp -= UPLOWDIFF; \ if((*lf_cp >= 'a') && (*lf_cp <= 'z')) *lf_cp -= UPLOWDIFF; \
} }
@@ -219,16 +219,16 @@ extern DLword *Lisp_world; /* To access LispSysout area */
TIMEOUT(lf_result = stat(name, &lf_statbuf)); \ TIMEOUT(lf_result = stat(name, &lf_statbuf)); \
if (lf_result < 0) { \ if (lf_result < 0) { \
*Lisp_errno = errno; \ *Lisp_errno = errno; \
type = 0; \ (type) = 0; \
} else { \ } else { \
switch (lf_statbuf.st_mode & S_IFMT) { \ switch (lf_statbuf.st_mode & S_IFMT) { \
\ \
case S_IFDIR: \ case S_IFDIR: \
type = -1; \ (type) = -1; \
break; \ break; \
\ \
case S_IFREG: \ case S_IFREG: \
type = 1; \ (type) = 1; \
break; \ break; \
\ \
default: \ default: \
@@ -236,7 +236,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
* Should we deal with the other \ * Should we deal with the other \
* types? \ * types? \
*/ \ */ \
type = 0; \ (type) = 0; \
break; \ break; \
} \ } \
} \ } \
@@ -272,20 +272,21 @@ extern DLword *Lisp_world; /* To access LispSysout area */
} }
#define STREQ(name1, name2)( \ #define STREQ(name1, name2)( \
(*name1 == *name2) && (strcmp(name1, name2) == 0) \ (*(name1) == *(name2)) && (strcmp(name1, name2) == 0) \
) )
#define SPECIALFILEMARK -1 #define SPECIALFILEMARK (-1)
#define NumericStringP(str, truetag, falsetag) { \ #define NumericStringP(str, truetag, falsetag) { \
char *lfn_cp; \ char *lfn_cp; \
\ \
if (*str == '\0') goto falsetag; \ /* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
if (*(str) == '\0') goto falsetag; \
\ \
for(lfn_cp = str; *lfn_cp!='\0'; ++lfn_cp) \ for(lfn_cp = str; *lfn_cp!='\0'; ++lfn_cp) \
if(*lfn_cp < '0' || '9' < *lfn_cp) \ if(*lfn_cp < '0' || '9' < *lfn_cp) \
goto falsetag; \ goto falsetag; /* NOLINT(bugprone-macro-parentheses) */ \
goto truetag; \ goto truetag; /* NOLINT(bugprone-macro-parentheses) */ \
} }
/* /*
@@ -392,16 +393,16 @@ extern DLword *Lisp_world; /* To access LispSysout area */
\ \
NO: \ NO: \
/* Dealt with as version 1 unless vlessp */ \ /* Dealt with as version 1 unless vlessp */ \
if (!vlessp) strcat(pathname, ";1"); \ if (!(vlessp)) strcat(pathname, ";1"); \
CONT: \ CONT: \
lf_cp--; /* Just for label */ \ lf_cp--; /* Just for label */ \
} else { \ } else { \
/* Dealt with as version 1 unless vlessp. */ \ /* Dealt with as version 1 unless vlessp. */ \
if (!vlessp) strcat(pathname, ";1"); \ if (!(vlessp)) strcat(pathname, ";1"); \
} \ } \
} else { \ } else { \
/* Dealt with as version 1 unless vlessp. */ \ /* Dealt with as version 1 unless vlessp. */ \
if (!vlessp) strcat(pathname, ";1"); \ if (!(vlessp)) strcat(pathname, ";1"); \
} \ } \
} }
@@ -444,7 +445,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
} \ } \
} \ } \
if (lf_cp1 == (lf_cp2 - 1)) { \ if (lf_cp1 == (lf_cp2 - 1)) { \
if (lf_cp1 == dir) { \ if (lf_cp1 == (dir)) { \
/* dir is a root directory. */ \ /* dir is a root directory. */ \
strcpy(fname, "/"); \ strcpy(fname, "/"); \
strcat(fname, name); \ strcat(fname, name); \
@@ -479,7 +480,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
*/ */
#define ConcNameAndVersion(name, ver, rname){ \ #define ConcNameAndVersion(name, ver, rname){ \
if (*ver != '\0') { \ if (*(ver) != '\0') { \
strcpy(rname, name); \ strcpy(rname, name); \
strcat(rname, ".~"); \ strcat(rname, ".~"); \
strcat(rname, ver); \ strcat(rname, ver); \
@@ -493,18 +494,18 @@ extern DLword *Lisp_world; /* To access LispSysout area */
#define MAXVERSION 999999999 #define MAXVERSION 999999999
#define LASTVERSIONARRAY -1 #define LASTVERSIONARRAY (-1)
#define VERSIONARRAYLENGTH 200 #define VERSIONARRAYLENGTH 200
#define NoFileP(varray) \ #define NoFileP(varray) \
((varray->version_no == LASTVERSIONARRAY)? 1 : 0) (((varray)->version_no == LASTVERSIONARRAY)? 1 : 0)
#ifdef DOS #ifdef DOS
#define OnlyVersionlessP(varray) 0 #define OnlyVersionlessP(varray) 0
#else #else
#define OnlyVersionlessP(varray) \ #define OnlyVersionlessP(varray) \
((varray->version_no == 0 && (varray + 1)->version_no == LASTVERSIONARRAY) ? \ (((varray)->version_no == 0 && ((varray) + 1)->version_no == LASTVERSIONARRAY) ? \
1 : 0) 1 : 0)
#endif /* DOS */ #endif /* DOS */

View File

@@ -38,20 +38,20 @@
/* */ /* */
/************************************************************************/ /************************************************************************/
#define N_MakeFloat(arg, dest, tos){ \ #define N_MakeFloat(arg, dest, tos){ \
switch (SEGMASK & (LispPTR)arg) { \ switch (SEGMASK & (LispPTR)(arg)) { \
case S_POSITIVE: \ case S_POSITIVE: \
dest = (float)(0xFFFF & (LispPTR)arg); \ (dest) = (float)(0xFFFF & (LispPTR)(arg)); \
break; \ break; \
case S_NEGATIVE: \ case S_NEGATIVE: \
dest = (float)((int)(0xFFFF0000 | (LispPTR)arg)); \ (dest) = (float)((int)(0xFFFF0000 | (LispPTR)(arg))); \
break; \ break; \
default: \ default: \
switch (GetTypeNumber(arg)) { \ switch (GetTypeNumber(arg)) { \
case TYPE_FLOATP: \ case TYPE_FLOATP: \
dest = *((float *)Addr68k_from_LADDR(arg)); \ (dest) = *((float *)Addr68k_from_LADDR(arg)); \
break; \ break; \
case TYPE_FIXP: \ case TYPE_FIXP: \
dest = (float)(*((int *)Addr68k_from_LADDR(arg))); \ (dest) = (float)(*((int *)Addr68k_from_LADDR(arg)));\
break; \ break; \
default: ERROR_EXIT(tos); \ default: ERROR_EXIT(tos); \
} \ } \
@@ -61,11 +61,11 @@
#define N_GetPos(arg, dest, tos){ \ #define N_GetPos(arg, dest, tos){ \
if ((arg & SEGMASK) == S_POSITIVE) \ if (((arg) & SEGMASK) == S_POSITIVE) \
dest = arg & 0xFFFF; \ (dest) = (arg) & 0xFFFF; \
else { \ else { \
if (GetTypeNumber(arg) != TYPE_FIXP) ERROR_EXIT(tos); \ if (GetTypeNumber(arg) != TYPE_FIXP) ERROR_EXIT(tos); \
if ((dest = *((int *)Addr68k_from_LADDR(arg))) & 0x80000000) \ if (((dest) = *((int *)Addr68k_from_LADDR(arg))) & 0x80000000) \
ERROR_EXIT(tos); \ ERROR_EXIT(tos); \
} \ } \
} }

View File

@@ -71,9 +71,9 @@
midpunt = LOLOC(LADDR_from_68k(CURRENTFX)); \ midpunt = LOLOC(LADDR_from_68k(CURRENTFX)); \
PVar=(DLword *) \ PVar=(DLword *) \
Addr68k_from_StkOffset( \ Addr68k_from_StkOffset( \
(GETWORD(((DLword *)InterfacePage) +fxnum))) \ (GETWORD(((DLword *)InterfacePage) + (fxnum)))) \
+ FRAMESIZE; \ + FRAMESIZE; \
GETWORD(((DLword *)InterfacePage) +fxnum) = midpunt ; \ GETWORD(((DLword *)InterfacePage) + (fxnum)) = midpunt ; \
} }

View File

@@ -78,7 +78,7 @@ typedef struct fnhead {
typedef struct frameex1 { typedef struct frameex1 {
unsigned flags : 3; unsigned flags : 3;
unsigned fast : 1; unsigned fast : 1;
unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ unsigned mvscase : 1; /* was not used, prev: This frame treats N-func */
unsigned incall : 1; unsigned incall : 1;
unsigned validnametable : 1; unsigned validnametable : 1;
/* 0: look for FunctionHeader /* 0: look for FunctionHeader
@@ -109,7 +109,7 @@ typedef struct frameex1 {
typedef struct frameex2 { typedef struct frameex2 {
unsigned flags : 3; unsigned flags : 3;
unsigned fast : 1; unsigned fast : 1;
unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ unsigned mvscase : 1; /* not used, prev: This frame treats N-func */
unsigned incall : 1; unsigned incall : 1;
unsigned validnametable : 1; unsigned validnametable : 1;
/* 0: look for FunctionHeader /* 0: look for FunctionHeader
@@ -200,7 +200,7 @@ typedef struct frameex1 {
/* 0: look for FunctionHeader /* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */ 1: look for NameTable on this FrameEx */
unsigned incall : 1; unsigned incall : 1;
unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ unsigned mvscase : 1; /* not used, prev: This frame treats N-func */
unsigned fast : 1; unsigned fast : 1;
unsigned flags : 3; /* hi word */ unsigned flags : 3; /* hi word */
@@ -235,7 +235,7 @@ typedef struct frameex2 {
/* 0: look for FunctionHeader /* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */ 1: look for NameTable on this FrameEx */
unsigned incall : 1; unsigned incall : 1;
unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ unsigned mvscase : 1; /* not used, prev: This frame treats N-func */
unsigned fast : 1; unsigned fast : 1;
unsigned flags : 3; unsigned flags : 3;
@@ -301,13 +301,13 @@ typedef struct stackp {
#define DUMMYBF(fx) (((DLword *)(fx)) - DLWORDSPER_CELL) #define DUMMYBF(fx) (((DLword *)(fx)) - DLWORDSPER_CELL)
#define SLOWP(fx) (((FXBLOCK *)(fx))->slowp) #define SLOWP(fx) (((FXBLOCK *)(fx))->slowp)
#define FASTP(fx) (!SLOWP(fx)) #define FASTP(fx) (!SLOWP(fx))
#define SET_FASTP_NIL(fx68k) \ #define SET_FASTP_NIL(fx68k) \
{ \ { \
if (FASTP(fx68k)) { \ if (FASTP(fx68k)) { \
((FX *)fx68k)->blink = StkOffset_from_68K(DUMMYBF(fx68k)); \ ((FX *)(fx68k))->blink = StkOffset_from_68K(DUMMYBF(fx68k)); \
((FX *)fx68k)->clink = ((FX *)fx68k)->alink; \ ((FX *)(fx68k))->clink = ((FX *)(fx68k))->alink; \
SLOWP(fx68k) = T; \ SLOWP(fx68k) = T; \
} \ } \
} }
#define GETALINK(fx) ((((fx)->alink) & 0xfffe) - FRAMESIZE) #define GETALINK(fx) ((((fx)->alink) & 0xfffe) - FRAMESIZE)
@@ -354,10 +354,10 @@ typedef struct stackp {
#define SWAP_FNHEAD(x) swapx(x) #define SWAP_FNHEAD(x) swapx(x)
#endif /* BIGVM */ #endif /* BIGVM */
#define GETNAMETABLE(fx) \ #define GETNAMETABLE(fx) \
((struct fnhead *)Addr68k_from_LADDR( \ ((struct fnhead *)Addr68k_from_LADDR( \
SWAP_FNHEAD( \ SWAP_FNHEAD( \
((((FX2 *)fx)->validnametable) ? ((FX2 *)fx)->nametable : ((FX2 *)fx)->fnheader)) & \ ((((FX2 *)(fx))->validnametable) ? ((FX2 *)(fx))->nametable : ((FX2 *)(fx))->fnheader)) & \
POINTERMASK)) POINTERMASK))
#define MAKEFREEBLOCK(ptr68k, size) \ #define MAKEFREEBLOCK(ptr68k, size) \
@@ -429,7 +429,7 @@ typedef struct stackp {
#endif /* STACKCHECK */ #endif /* STACKCHECK */
#define STK_MIN(fnobj) ((fnobj->stkmin /* NOT NEEDED in stkmin +STK_SAFE */) << 1) #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))

View File

@@ -191,6 +191,4 @@
#define user_subr_DUMMY 012 #define user_subr_DUMMY 012
#define user_subr_SAMPLE_USER_SUBR 00 #define user_subr_SAMPLE_USER_SUBR 00
/* Experimental yield */
#define sb_YIELD 0322
#endif #endif

View File

@@ -21,7 +21,6 @@ void doko(void);
void dumpl(LispPTR laddr); void dumpl(LispPTR laddr);
void dumps(LispPTR laddr); void dumps(LispPTR laddr);
void printPC(void); void printPC(void);
int countchar(char *string);
void dump_bf(Bframe *bf); void dump_bf(Bframe *bf);
void dump_fx(struct frameex1 *fx_addr68k); void dump_fx(struct frameex1 *fx_addr68k);
void dump_stackframe(struct frameex1 *fx_addr68k); void dump_stackframe(struct frameex1 *fx_addr68k);
@@ -29,11 +28,9 @@ void dump_CSTK(int before);
void btv(void); void btv(void);
int get_framename(struct frameex1 *fx_addr68k); int get_framename(struct frameex1 *fx_addr68k);
FX *get_nextFX(FX *fx); FX *get_nextFX(FX *fx);
int MAKEATOM(char *string); LispPTR MAKEATOM(char *string);
LispPTR *MakeAtom68k(char *string); LispPTR *MakeAtom68k(char *string);
void GETTOPVAL(char *string); void GETTOPVAL(char *string);
void S_TOPVAL(char *string);
int S_MAKEATOM(char *string);
void all_stack_dump(DLword start, DLword end, DLword silent); void all_stack_dump(DLword start, DLword end, DLword silent);
void dtd_chain(DLword type); void dtd_chain(DLword type);
void Trace_FNCall(int numargs, int atomindex, int arg1, LispPTR *tos); void Trace_FNCall(int numargs, int atomindex, int arg1, LispPTR *tos);

View File

@@ -203,13 +203,13 @@
FN_STACK_CHECK; \ FN_STACK_CHECK; \
{ \ { \
register UNSIGNED newivar; \ register UNSIGNED newivar; \
newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR - argcount + 1)); \ newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR - (argcount) + 1)); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \ BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \
} \ } \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \ HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if (LOCFNCELL->na >= 0) { \ if (LOCFNCELL->na >= 0) { \
register int RESTARGS; \ register int RESTARGS; \
RESTARGS = argcount - LOCFNCELL->na; \ RESTARGS = (argcount) - LOCFNCELL->na; \
while (RESTARGS < 0) { \ while (RESTARGS < 0) { \
HARD_PUSH(NIL_PTR); \ HARD_PUSH(NIL_PTR); \
RESTARGS++; \ RESTARGS++; \

View File

@@ -249,29 +249,29 @@ extern int ScreenLocked; /* for mouse tracking */
(EQ Operation (QUOTE ERASE))) 0) (EQ Operation (QUOTE ERASE))) 0)
(T 1)))))) (T 1))))))
*****************************************************************/ *****************************************************************/
#define PixOperationLisp(SRCTYPE, OPERATION) \ #define PixOperationLisp(SRCTYPE, OPERATION) \
(SRCTYPE == INVERT_atom \ ((SRCTYPE) == INVERT_atom \
? (OPERATION == REPLACE_atom \ ? ((OPERATION) == REPLACE_atom \
? PIX_NOT(PIX_SRC) \ ? PIX_NOT(PIX_SRC) \
: (OPERATION == PAINT_atom \ : ((OPERATION) == PAINT_atom \
? PIX_NOT(PIX_SRC) | PIX_DST \ ? PIX_NOT(PIX_SRC) | PIX_DST \
: (OPERATION == ERASE_atom \ : ((OPERATION) == ERASE_atom \
? PIX_SRC & PIX_DST \ ? PIX_SRC & PIX_DST \
: (OPERATION == INVERT_atom ? PIX_NOT(PIX_SRC) ^ PIX_DST : ERROR)))) \ : ((OPERATION) == INVERT_atom ? PIX_NOT(PIX_SRC) ^ PIX_DST : ERROR)))) \
: /* SRCTYPE == INPUT, TEXTURE */ \ : /* SRCTYPE == INPUT, TEXTURE */ \
(OPERATION == REPLACE_atom \ ((OPERATION) == REPLACE_atom \
? PIX_SRC \ ? PIX_SRC \
: (OPERATION == PAINT_atom \ : ((OPERATION) == PAINT_atom \
? PIX_SRC | PIX_DST \ ? PIX_SRC | PIX_DST \
: (OPERATION == ERASE_atom \ : ((OPERATION) == ERASE_atom \
? PIX_NOT(PIX_SRC) & PIX_DST \ ? PIX_NOT(PIX_SRC) & PIX_DST \
: (OPERATION == INVERT_atom ? PIX_SRC ^ PIX_DST : ERROR))))) : ((OPERATION) == INVERT_atom ? PIX_SRC ^ PIX_DST : ERROR)))))
#define bbop(SRCTYPE, OPERATION) \ #define bbop(SRCTYPE, OPERATION) \
(OPERATION == PAINT_atom \ ((OPERATION) == PAINT_atom \
? op_fn_or \ ? op_fn_or \
: (OPERATION == ERASE_atom ? op_fn_and \ : ((OPERATION) == ERASE_atom ? op_fn_and \
: (OPERATION == INVERT_atom ? op_fn_xor : op_repl_src))) : ((OPERATION) == INVERT_atom ? op_fn_xor : op_repl_src)))
/********************************************************/ /********************************************************/
/* */ /* */
@@ -284,9 +284,9 @@ extern int ScreenLocked; /* for mouse tracking */
/* */ /* */
/********************************************************/ /********************************************************/
#define bbsrc_type(SRCTYPE, OPERATION) \ #define bbsrc_type(SRCTYPE, OPERATION) \
(SRCTYPE == INVERT_atom ? (OPERATION == ERASE_atom ? 0 : 1) /* SRCTYPE == INPUT, TEXTURE */ \ ((SRCTYPE) == INVERT_atom ? ((OPERATION) == ERASE_atom ? 0 : 1) /* SRCTYPE == INPUT, TEXTURE */ \
: (OPERATION == ERASE_atom ? 1 : 0)) : ((OPERATION) == ERASE_atom ? 1 : 0))
extern struct pixrect *SrcePixRect, *DestPixRect, *TexturePixRect; extern struct pixrect *SrcePixRect, *DestPixRect, *TexturePixRect;
extern struct pixrect *BlackTexturePixRect, *WhiteTexturePixRect; extern struct pixrect *BlackTexturePixRect, *WhiteTexturePixRect;

View File

@@ -777,7 +777,7 @@ void nts(struct frameex1 *fxp) {
#define VARTYPE_PVAR (2) #define VARTYPE_PVAR (2)
#define VARTYPE_IVAR (0) #define VARTYPE_IVAR (0)
#define VAROFFSET(X) (X & 0xFFFFFFF) #define VAROFFSET(X) ((X) & 0xFFFFFFF)
void nt1(LispPTR *start, int size, char *str) { void nt1(LispPTR *start, int size, char *str) {
LispPTR *endp, *entry2p; LispPTR *endp, *entry2p;

View File

@@ -77,14 +77,14 @@ extern int Dummy_errno;
separate_version(tname, tver, 0); \ separate_version(tname, tver, 0); \
\ \
if ((pp = (char *)strrchr(tname, '.')) == NULL) { \ if ((pp = (char *)strrchr(tname, '.')) == NULL) { \
*text = '\0'; \ *(text) = '\0'; \
} else { \ } else { \
*pp = '\0'; \ *pp = '\0'; \
strcpy(text, pp + 1); \ strcpy(text, pp + 1); \
} \ } \
\ \
if ((pp = (char *)strrchr(pname, '.')) == NULL) { \ if ((pp = (char *)strrchr(pname, '.')) == NULL) { \
*pext = '\0'; \ *(pext) = '\0'; \
} else { \ } else { \
*pp = '\0'; \ *pp = '\0'; \
strcpy(pext, pp + 1); \ strcpy(pext, pp + 1); \
@@ -104,9 +104,9 @@ extern int Dummy_errno;
SetupMatch(tname, pname, text, pext, tver); \ SetupMatch(tname, pname, text, pext, tver); \
\ \
if (match_pattern(tname, pname) && match_pattern(text, pext) && match_pattern(tver, ver)) \ if (match_pattern(tname, pname) && match_pattern(text, pext) && match_pattern(tver, ver)) \
goto matchtag; \ goto matchtag; /* NOLINT(bugprone-macro-parentheses) */ \
else \ else \
goto unmatchtag; \ goto unmatchtag; /* NOLINT(bugprone-macro-parentheses) */ \
} }
#define MatchP_Case(target, name, ver, matchtag, unmatchtag) \ #define MatchP_Case(target, name, ver, matchtag, unmatchtag) \
@@ -120,9 +120,9 @@ extern int Dummy_errno;
SetupMatch(tname, pname, text, pext, tver); \ SetupMatch(tname, pname, text, pext, tver); \
\ \
if (match_pattern(tname, pname) && match_pattern(text, pext) && match_pattern(tver, ver)) \ if (match_pattern(tname, pname) && match_pattern(text, pext) && match_pattern(tver, ver)) \
goto matchtag; \ goto matchtag; /* NOLINT(bugprone-macro-parentheses) */ \
else \ else \
goto unmatchtag; \ goto unmatchtag; /* NOLINT(bugprone-macro-parentheses) */ \
} }
/* /*
@@ -292,13 +292,13 @@ int MAXFINFO;
#define AllocFinfo(fp) \ #define AllocFinfo(fp) \
{ \ { \
if (FreeFinfoList != (FINFO *)NULL) { \ if (FreeFinfoList != (FINFO *)NULL) { \
fp = FreeFinfoList; \ (fp) = FreeFinfoList; \
FreeFinfoList = fp->next; \ FreeFinfoList = (fp)->next; \
} else if ((fp = (FINFO *)calloc(1, sizeof(FINFO))) == NULL) { \ } else if (((fp) = (FINFO *)calloc(1, sizeof(FINFO))) == NULL) { \
fp = (FINFO *)NULL; \ (fp) = (FINFO *)NULL; \
} else if ((fp->prop = (FPROP *)calloc(1, sizeof(FPROP))) == NULL) { \ } else if (((fp)->prop = (FPROP *)calloc(1, sizeof(FPROP))) == NULL) { \
free(fp); \ free(fp); \
fp = (FINFO *)NULL; \ (fp) = (FINFO *)NULL; \
} \ } \
} }

View File

@@ -2830,10 +2830,10 @@ static int make_directory(register char *dir)
#define FindHighestVersion(varray, mentry, max_no) \ #define FindHighestVersion(varray, mentry, max_no) \
{ \ { \
register FileName *centry; \ register FileName *centry; \
for (centry = varray, max_no = 0; centry->version_no != LASTVERSIONARRAY; centry++) { \ for (centry = (varray), (max_no) = 0; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no > max_no) { \ if (centry->version_no > (max_no)) { \
max_no = centry->version_no; \ (max_no) = centry->version_no; \
mentry = centry; \ (mentry) = centry; \
} \ } \
} \ } \
} }
@@ -2878,10 +2878,10 @@ static int make_directory(register char *dir)
#define FindLowestVersion(varray, mentry, min_no) \ #define FindLowestVersion(varray, mentry, min_no) \
{ \ { \
register FileName *centry; \ register FileName *centry; \
for (centry = varray, min_no = MAXVERSION; centry->version_no != LASTVERSIONARRAY; centry++) { \ for (centry = (varray), (min_no) = MAXVERSION; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no < min_no && centry->version_no != 0) { \ if (centry->version_no < (min_no) && centry->version_no != 0) { \
min_no = centry->version_no; \ (min_no) = centry->version_no; \
mentry = centry; \ (mentry) = centry; \
} \ } \
} \ } \
} }
@@ -2915,10 +2915,10 @@ static int make_directory(register char *dir)
{ \ { \
register FileName *centry; \ register FileName *centry; \
\ \
sentry = (FileName *)NULL; \ (sentry) = (FileName *)NULL; \
for (centry = varray; centry->version_no != LASTVERSIONARRAY; centry++) \ for (centry = varray; centry->version_no != LASTVERSIONARRAY; centry++) \
if (centry->version_no == ver_no) { \ if (centry->version_no == (ver_no)) { \
sentry = centry; \ (sentry) = centry; \
break; \ break; \
} \ } \
} }

View File

@@ -21,9 +21,8 @@
#include "dspifdefs.h" #include "dspifdefs.h"
#include "xinitdefs.h" #include "xinitdefs.h"
DspInterfaceRec _curdsp; DspInterfaceRec curdsp;
DspInterface currentdsp = &curdsp;
DspInterface currentdsp = &_curdsp;
#ifdef XWINDOW #ifdef XWINDOW
extern int LispDisplayRequestedWidth; extern int LispDisplayRequestedWidth;

View File

@@ -68,12 +68,12 @@ BIGNUM (integer that can't be represented bigger than 32 bits)
*/ */
#define IF_IMMEDIATE(arg, doit, doitsmall) \ #define IF_IMMEDIATE(arg, doit, doitsmall) \
switch (SEGMASK & arg) { \ switch (SEGMASK & (arg)) { \
case ATOM_OFFSET: doit; \ case ATOM_OFFSET: doit; /* NOLINT(bugprone-macro-parentheses) */ \
case S_CHARACTER: doit; \ case S_CHARACTER: doit; /* NOLINT(bugprone-macro-parentheses) */ \
case S_POSITIVE: doitsmall; \ case S_POSITIVE: doitsmall; /* NOLINT(bugprone-macro-parentheses) */ \
case S_NEGATIVE: doitsmall; \ case S_NEGATIVE: doitsmall; /* NOLINT(bugprone-macro-parentheses) */ \
} }
/************************************************************************/ /************************************************************************/

View File

@@ -9,7 +9,7 @@
#include "version.h" #include "version.h"
#ifdef USE_DLPI #if defined(USE_DLPI)
#define PKTFILTER 1 #define PKTFILTER 1
#define NIOCSFLAGS SBIOCSFLAGS #define NIOCSFLAGS SBIOCSFLAGS
#endif #endif
@@ -34,9 +34,9 @@
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#ifdef USE_DLPI #if defined(USE_DLPI)
#include "dlpidefs.h" #include "dlpidefs.h"
#else #elif defined(USE_NIT)
#include <net/nit.h> #include <net/nit.h>
#endif #endif
@@ -55,7 +55,7 @@
#endif /* OS4 */ #endif /* OS4 */
#endif /* PKTFILTER */ #endif /* PKTFILTER */
#ifndef USE_DLPI #if defined(USE_NIT)
#include <sys/mbuf.h> #include <sys/mbuf.h>
#endif #endif
#include <nlist.h> #include <nlist.h>
@@ -73,7 +73,7 @@
#include "dbprint.h" #include "dbprint.h"
#include "etherdefs.h" #include "etherdefs.h"
#ifdef USE_DLPI #if defined(USE_DLPI)
#define NIOCSETF PFIOCSETF #define NIOCSETF PFIOCSETF
#endif #endif
@@ -245,7 +245,7 @@ LispPTR ether_suspend(LispPTR args[])
/* The trick here is to install a packet filter */ /* The trick here is to install a packet filter */
/* that rejects all packets, I think... */ /* that rejects all packets, I think... */
#ifdef USE_DLPI #if defined(USE_DLPI)
si.ic_cmd = PFIOCSETF; si.ic_cmd = PFIOCSETF;
si.ic_timout = -1; si.ic_timout = -1;
@@ -257,7 +257,7 @@ LispPTR ether_suspend(LispPTR args[])
return (NIL); return (NIL);
} }
#else #elif defined(USE_NIT)
if (ioctl(ether_fd, NIOCSETF, &nopf) != 0) { if (ioctl(ether_fd, NIOCSETF, &nopf) != 0) {
perror("ether_suspend: NIOCSETF failed\n"); perror("ether_suspend: NIOCSETF failed\n");
return (NIL); return (NIL);
@@ -291,7 +291,7 @@ LispPTR ether_resume(LispPTR args[])
#else /* PKTFILTER */ #else /* PKTFILTER */
/* Install a packet filter that accepts all packets we want */ /* Install a packet filter that accepts all packets we want */
#ifdef USE_DLPI #if defined(USE_DLPI)
si.ic_cmd = PFIOCSETF; si.ic_cmd = PFIOCSETF;
si.ic_timout = -1; si.ic_timout = -1;
@@ -303,7 +303,7 @@ LispPTR ether_resume(LispPTR args[])
return (NIL); return (NIL);
} }
#else #elif defined(USE_NIT)
if (ioctl(ether_fd, NIOCSETF, &goodpf) != 0) { if (ioctl(ether_fd, NIOCSETF, &goodpf) != 0) {
perror("ether_resume: NIOCSETF failed\n"); perror("ether_resume: NIOCSETF failed\n");
return (NIL); return (NIL);
@@ -763,9 +763,9 @@ void init_ifpage_ether() {
#ifdef MAIKO_ENABLE_ETHERNET #ifdef MAIKO_ENABLE_ETHERNET
/* this needs to be a global so the name can be set by main() in Ctest */ /* this needs to be a global so the name can be set by main() in Ctest */
/* But MAIKO_ENABLE_ETHERNET doesn't support NIT, so dyke it out for MAIKO_ENABLE_ETHERNET */ /* But MAIKO_ENABLE_ETHERNET doesn't support NIT, so dyke it out for MAIKO_ENABLE_ETHERNET */
#ifndef USE_DLPI #if defined(USE_NIT)
struct sockaddr_nit snit; struct sockaddr_nit snit;
#endif /* USE_DLPI */ #endif /* USE_NIT */
#endif /* MAIKO_ENABLE_ETHERNET */ #endif /* MAIKO_ENABLE_ETHERNET */
/************************************************************************/ /************************************************************************/
@@ -793,7 +793,7 @@ void init_ether() {
if it's already open here, it was opened by ldeether and if it's already open here, it was opened by ldeether and
all the appropriate stuff was done to it there. all the appropriate stuff was done to it there.
*/ */
#ifdef USE_DLPI #if defined(USE_DLPI)
/* Use DLPI to connect to the ethernet. This code is stolen /* Use DLPI to connect to the ethernet. This code is stolen
from NFSWATCH4.3 from NFSWATCH4.3
*/ */
@@ -832,9 +832,7 @@ void init_ether() {
} }
seteuid(getuid()); seteuid(getuid());
} }
#else #elif defined(USE_NIT)
/* N O T D L P I C O D E */
#ifndef OS4 #ifndef OS4
if (getuid() != geteuid()) { if (getuid() != geteuid()) {
if ((ether_fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW)) >= 0) { if ((ether_fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW)) >= 0) {
@@ -995,7 +993,7 @@ void init_ether() {
/* first and foremost, flush out ether_fd's buffers and filter it */ /* first and foremost, flush out ether_fd's buffers and filter it */
/* install packetfilter that rejects everything */ /* install packetfilter that rejects everything */
#ifdef USE_DLPI #if defined(USE_DLPI)
si.ic_cmd = PFIOCSETF; si.ic_cmd = PFIOCSETF;
si.ic_timout = -1; si.ic_timout = -1;
@@ -1009,7 +1007,7 @@ void init_ether() {
return; return;
} }
#else #elif defined(USE_NIT)
if (ioctl(ether_fd, NIOCSETF, &nopf) != 0) { if (ioctl(ether_fd, NIOCSETF, &nopf) != 0) {
perror("init_ether: nopf NIOCSETF failed:\n"); perror("init_ether: nopf NIOCSETF failed:\n");
@@ -1028,9 +1026,9 @@ void init_ether() {
/* then throw away everything that's currently buffered there; /* then throw away everything that's currently buffered there;
this descriptor may have been open since ldeether ran, with this descriptor may have been open since ldeether ran, with
no filtering; a busy net will have stuffed it full */ no filtering; a busy net will have stuffed it full */
#ifdef USE_DLPI #if defined(USE_DLPI)
if (ioctl(ether_fd, I_FLUSH, (char *)FLUSHR) < 0) { perror("init_ether I_FLUSH"); } if (ioctl(ether_fd, I_FLUSH, (char *)FLUSHR) < 0) { perror("init_ether I_FLUSH"); }
#else #elif defined(USE_NIT)
{ {
FD_SET(ether_fd, &rfds); FD_SET(ether_fd, &rfds);
while (select(32, &rfds, NULL, NULL, &EtherTimeout) > 0) while (select(32, &rfds, NULL, NULL, &EtherTimeout) > 0)
@@ -1044,7 +1042,7 @@ void init_ether() {
goodpf.Pf_Filter[11] = (DLword)((ether_host[2] << 8) + ether_host[3]); goodpf.Pf_Filter[11] = (DLword)((ether_host[2] << 8) + ether_host[3]);
goodpf.Pf_Filter[14] = (DLword)((ether_host[4] << 8) + ether_host[5]); goodpf.Pf_Filter[14] = (DLword)((ether_host[4] << 8) + ether_host[5]);
/* and set up the packetfilter */ /* and set up the packetfilter */
#ifdef USE_DLPI #if defined(USE_DLPI)
si.ic_cmd = PFIOCSETF; si.ic_cmd = PFIOCSETF;
si.ic_timout = -1; si.ic_timout = -1;
@@ -1066,7 +1064,7 @@ void init_ether() {
return; return;
} }
#endif /* USE_DLPI */ #endif /* USE_DLPI */
#ifndef USE_DLPI #if defined(USE_NIT)
DBPRINT(("INIT ETHER: Doing I_SETSIG.\n")); DBPRINT(("INIT ETHER: Doing I_SETSIG.\n"));
if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) { if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) {
perror("init_ether: I_SETSIG failed:\n"); perror("init_ether: I_SETSIG failed:\n");
@@ -1074,7 +1072,7 @@ void init_ether() {
ether_fd = -1; ether_fd = -1;
return; return;
} }
#endif /* USE_DLPI */ #endif /* USE_NIT */
#endif /* PKTFILTER */ #endif /* PKTFILTER */
if (ether_fd < 0) error ("ether_fd is -1, but enet opened??"); if (ether_fd < 0) error ("ether_fd is -1, but enet opened??");

View File

@@ -374,7 +374,7 @@ LispPTR N_OP_fvar_(register LispPTR tos, register int n) {
#define VALS_HI_RET(x) ((int)(x) << 17) + VALS_HI + ((unsigned short)(x) >> 15) #define VALS_HI_RET(x) ((int)(x) << 17) + VALS_HI + ((unsigned short)(x) >> 15)
#define STK_HI_RET(x) ((int)(x) << 16) | 1 | ((unsigned int)(x) >> 16) #define STK_HI_RET(x) (((int)(x) << 16) | 1 | ((unsigned int)(x) >> 16))
#else #else
@@ -389,7 +389,7 @@ LispPTR N_OP_fvar_(register LispPTR tos, register int n) {
: (swapx((int)(x) + NEWATOM_VALUE_OFFSET))) : (swapx((int)(x) + NEWATOM_VALUE_OFFSET)))
#endif /* BIGVM */ #endif /* BIGVM */
#define STK_HI_RET(x) ((unsigned int)(x) << 16) | 1 | ((unsigned int)(x) >> 16) #define STK_HI_RET(x) (((unsigned int)(x) << 16) | 1 | ((unsigned int)(x) >> 16))
#endif /* BIGATOMS */ #endif /* BIGATOMS */

View File

@@ -278,7 +278,7 @@ LispPTR get_package_atom(const char *char_base, DLword charlen, const char *pack
packindex = find_package_from_name(packname, packlen); packindex = find_package_from_name(packname, packlen);
if (packindex < 0) { if (packindex < 0) {
printf("getting package index is failed \n"); printf("getting package index failed %s:%s\n", packname, char_base);
return (0xffffffff); return (0xffffffff);
} }

View File

@@ -46,15 +46,15 @@
#include "commondefs.h" #include "commondefs.h"
#include "gchtfinddefs.h" #include "gchtfinddefs.h"
#define min(a, b) ((a > b) ? b : a) #define min(a, b) (((a) > (b)) ? (b) : (a))
#define ENDOFX 0 #define ENDOFX 0
#define GCONST 111 #define GCONST 111
#define Reprobefn(bits, index) (((bits ^ ((bits) >> 8)) & min(63, index)) | 1) #define Reprobefn(bits, index) ((((bits) ^ ((bits) >> 8)) & min(63, index)) | 1)
#define Fn16bits(a, b) ((a + b) & 0x0ffff) #define Fn16bits(a, b) (((a) + (b)) & 0x0ffff)
#define Hashingbits(item) (HILOC(item) ^ (((LOLOC(item) & 0x1fff) << 3) ^ (LOLOC(item) >> 9))) #define Hashingbits(item) (HILOC(item) ^ (((LOLOC(item) & 0x1fff) << 3) ^ (LOLOC(item) >> 9)))
#define Getikvalue(base, index) (*(LispPTR *)Addr68k_from_LADDR(base + (index << 1))) #define Getikvalue(base, index) (*(LispPTR *)Addr68k_from_LADDR((base) + ((index) << 1)))
#ifndef BYTESWAP #ifndef BYTESWAP
typedef struct implicit_key_hash_table { typedef struct implicit_key_hash_table {

View File

@@ -72,8 +72,8 @@
#define Boundp(frame_field) ((frame_field == 0) ? 1 : 0) #define Boundp(frame_field) ((frame_field == 0) ? 1 : 0)
#endif /* NEVER */ #endif /* NEVER */
#define min(a, b) ((a > b) ? b : a) #define min(a, b) (((a) > (b)) ? (b) : (a))
#define Trailer(ldatum, datum68) (ldatum + 2 * (datum68->arlen - ARRAYBLOCKTRAILERCELLS)) #define Trailer(ldatum, datum68) ((ldatum) + 2 * ((datum68)->arlen - ARRAYBLOCKTRAILERCELLS))
#define BucketIndex(n) min(integerlength(n), MAXBUCKETINDEX) #define BucketIndex(n) min(integerlength(n), MAXBUCKETINDEX)
#define FreeBlockChainN(n) ((POINTERMASK & *FreeBlockBuckets_word) + 2 * BucketIndex(n)) #define FreeBlockChainN(n) ((POINTERMASK & *FreeBlockBuckets_word) + 2 * BucketIndex(n))

View File

@@ -24,12 +24,12 @@
#include "gcrdefs.h" #include "gcrdefs.h"
#include "storagedefs.h" #include "storagedefs.h"
#define Evenp(num, prim) ((num % prim) == 0) #define Evenp(num, prim) (((num) % (prim)) == 0)
#ifdef BIGVM #ifdef BIGVM
/* HTCOLLMAX should be in half-entries, not in words */ /* HTCOLLMAX should be in half-entries, not in words */
#define HTCOLLMAX (HTCOLL_SIZE / DLWORDSPER_CELL) - 16 #define HTCOLLMAX ((HTCOLL_SIZE / DLWORDSPER_CELL) - 16)
#else #else
#define HTCOLLMAX HTCOLL_SIZE - 16 #define HTCOLLMAX (HTCOLL_SIZE - 16)
#endif /* BIGVM */ #endif /* BIGVM */
/* GetLink gets a new entry from the GC collision table */ /* GetLink gets a new entry from the GC collision table */
@@ -43,10 +43,10 @@
return (NIL); \ return (NIL); \
}; \ }; \
GETGC((GCENTRY *)HTcoll + 1) = linkoff + 2; \ GETGC((GCENTRY *)HTcoll + 1) = linkoff + 2; \
var = (GCENTRY *)(HTcoll + linkoff); \ (var) = (GCENTRY *)(HTcoll + linkoff); \
} else { \ } else { \
GETGC(HTcoll) = GETGC((GCENTRY *)(HTcoll + linkoff + 1)); \ GETGC(HTcoll) = GETGC((GCENTRY *)(HTcoll + linkoff + 1)); \
var = (GCENTRY *)(HTcoll + linkoff); \ (var) = (GCENTRY *)(HTcoll + linkoff); \
} \ } \
} }
@@ -82,20 +82,20 @@
* NewEntry is never called in the course of the reclamation. * NewEntry is never called in the course of the reclamation.
* Thus STKREF case is not needed. * Thus STKREF case is not needed.
*/ */
#define NewEntry(entry, hiptr, casep, ptr) \ #define NewEntry(entry, hiptr, casep, ptr) \
{ \ { \
switch (casep) { \ switch (casep) { \
case ADDREF: \ case ADDREF: \
GETGC(entry) = hiptr | (2 << HTCNTSHIFT); /* set count = 2 */ \ GETGC(entry) = (hiptr) | (2 << HTCNTSHIFT); /* set count = 2 */ \
IncAllocCnt(1); \ IncAllocCnt(1); \
return NIL; /* not new 0 entry */ \ return NIL; /* not new 0 entry */ \
case DELREF: \ case DELREF: \
GETGC(entry) = hiptr; /* set count = 0 */ \ GETGC(entry) = hiptr; /* set count = 0 */ \
IncAllocCnt(1); \ IncAllocCnt(1); \
return ptr; /* new 0 entry */ \ return ptr; /* new 0 entry */ \
default: error("GC error: new entry touches stack bit"); \ default: error("GC error: new entry touches stack bit"); \
return NIL; /* NOT REACHED */ \ return NIL; /* NOT REACHED */ \
} \ } \
} }
/* /*
@@ -106,13 +106,13 @@
{ \ { \
switch (casep) { \ switch (casep) { \
case ADDREF: \ case ADDREF: \
GETGC(entry) = hiptr | (2 << HTCNTSHIFT); /* set count = 2 */ \ GETGC(entry) = (hiptr) | (2 << HTCNTSHIFT); /* set count = 2 */ \
return NIL; /* not new 0 entry */ \ return NIL; /* not new 0 entry */ \
case DELREF: \ case DELREF: \
GETGC(entry) = hiptr; /* set count = 0 */ \ GETGC(entry) = hiptr; /* set count = 0 */ \
return ptr; /* new 0 entry */ \ return ptr; /* new 0 entry */ \
case STKREF: /* set refcnt to 1, stack bit to 1 */ \ case STKREF: /* set refcnt to 1, stack bit to 1 */ \
GETGC(entry) = hiptr | (1 << HTCNTSHIFT) | HTSTKMASK; \ GETGC(entry) = (hiptr) | (1 << HTCNTSHIFT) | HTSTKMASK; \
return NIL; \ return NIL; \
default: error("GC error: new entry when turning off stack bit"); \ default: error("GC error: new entry when turning off stack bit"); \
return NIL; /* NOT REACHED */ \ return NIL; /* NOT REACHED */ \
@@ -134,29 +134,29 @@
*/ */
#define ModEntry(entry, contents, ptr, casep, remove) \ #define ModEntry(entry, contents, ptr, casep, remove) \
{ \ { \
if ((contents & HTCNTMASK) == HTCNTMASK) { /* overflow; return non-zero */ \ if (((contents) & HTCNTMASK) == HTCNTMASK) { /* overflow; return non-zero */ \
modify_big_reference_count(entry, casep, ptr); \ modify_big_reference_count(entry, casep, ptr); \
return NIL; \ return NIL; \
} \ } \
switch (casep) { \ switch (casep) { \
case ADDREF: \ case ADDREF: \
contents += (1 << HTCNTSHIFT); \ (contents) += (1 << HTCNTSHIFT); \
if ((contents & HTCNTMASK) == HTCNTMASK) { /* overflow */ \ if (((contents) & HTCNTMASK) == HTCNTMASK) { /* overflow */ \
GETGC(entry) = contents; \ GETGC(entry) = contents; \
enter_big_reference_count(ptr); \ enter_big_reference_count(ptr); \
return NIL; \ return NIL; \
} \ } \
if ((contents & HTCNTSTKMASK) == (1 << HTCNTSHIFT)) { \ if (((contents) & HTCNTSTKMASK) == (1 << HTCNTSHIFT)) { \
DecAllocCnt(1); \ DecAllocCnt(1); \
goto remove; \ goto remove; /* NOLINT(bugprone-macro-parentheses) */ \
} \ } \
break; \ break; \
case DELREF: \ case DELREF: \
if ((contents >> HTCNTSHIFT) == 0) error("attempt to decrement 0 reference count"); \ if (((contents) >> HTCNTSHIFT) == 0) error("attempt to decrement 0 reference count"); \
contents -= (1 << HTCNTSHIFT); \ (contents) -= (1 << HTCNTSHIFT); \
if ((contents & HTCNTSTKMASK) == (1 << HTCNTSHIFT)) { \ if (((contents) & HTCNTSTKMASK) == (1 << HTCNTSHIFT)) { \
DecAllocCnt(1); \ DecAllocCnt(1); \
goto remove; \ goto remove; /* NOLINT(bugprone-macro-parentheses) */ \
} \ } \
break; \ break; \
default: error("GC error: mod entry touches stack bit"); \ default: error("GC error: mod entry touches stack bit"); \
@@ -171,14 +171,14 @@
*/ */
#define RecModEntry(entry, contents, ptr, casep, remove) \ #define RecModEntry(entry, contents, ptr, casep, remove) \
{ \ { \
if ((contents & HTCNTMASK) == HTCNTMASK) { /* overflow; return non-zero */ \ if (((contents) & HTCNTMASK) == HTCNTMASK) { /* overflow; return non-zero */ \
modify_big_reference_count(entry, casep, ptr); \ modify_big_reference_count(entry, casep, ptr); \
return NIL; \ return NIL; \
} \ } \
switch (casep) { \ switch (casep) { \
case ADDREF: \ case ADDREF: \
contents += (1 << HTCNTSHIFT); \ (contents) += (1 << HTCNTSHIFT); \
if ((contents & HTCNTMASK) == HTCNTMASK) { \ if (((contents) & HTCNTMASK) == HTCNTMASK) { \
/* overflow */ \ /* overflow */ \
GETGC(entry) = contents; \ GETGC(entry) = contents; \
enter_big_reference_count(ptr); \ enter_big_reference_count(ptr); \
@@ -186,11 +186,11 @@
} \ } \
break; /* check for possibly deleting entry */ \ break; /* check for possibly deleting entry */ \
case DELREF: \ case DELREF: \
if ((contents >> HTCNTSHIFT) == 0) error("attempt to decrement 0 reference count"); \ if (((contents) >> HTCNTSHIFT) == 0) error("attempt to decrement 0 reference count"); \
contents -= (1 << HTCNTSHIFT); \ (contents) -= (1 << HTCNTSHIFT); \
break; \ break; \
case STKREF: \ case STKREF: \
GETGC(entry) = contents | HTSTKMASK; \ GETGC(entry) = (contents) | HTSTKMASK; \
return NIL; \ return NIL; \
/* \ /* \
case UNSTKREF: \ case UNSTKREF: \
@@ -198,7 +198,8 @@
break; \ break; \
*/ \ */ \
} \ } \
if ((contents & HTCNTSTKMASK) == (1 << HTCNTSHIFT)) goto remove; \ /* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
if (((contents) & HTCNTSTKMASK) == (1 << HTCNTSHIFT)) goto remove; \
GETGC(entry) = contents; \ GETGC(entry) = contents; \
return NIL; \ return NIL; \
} }

View File

@@ -74,7 +74,7 @@
#define Boundp(frame_field) ((frame_field) == 0) #define Boundp(frame_field) ((frame_field) == 0)
#define Stkref(ptr) REC_GCLOOKUP(ptr, STKREF) #define Stkref(ptr) REC_GCLOOKUP(ptr, STKREF)
#define GcreclaimLp(ptr) \ #define GcreclaimLp(ptr) \
while ((ptr = gcreccell(ptr)) != NIL) REC_GCLOOKUP(ptr, ADDREF) while (((ptr) = gcreccell(ptr)) != NIL) REC_GCLOOKUP(ptr, ADDREF)
#define HTLPTR ((struct htlinkptr *)(entry)) #define HTLPTR ((struct htlinkptr *)(entry))
#define HENTRY ((struct hashentry *)(entry)) #define HENTRY ((struct hashentry *)(entry))
#define HTMAIN_ENTRY_COUNT (HTMAIN_SIZE >> 1) #define HTMAIN_ENTRY_COUNT (HTMAIN_SIZE >> 1)

View File

@@ -44,12 +44,12 @@
#define HTBIGENTRYSIZE 4 #define HTBIGENTRYSIZE 4
#define WORDSPERPAGE 256 #define WORDSPERPAGE 256
#define MAXTYPENUMBER INIT_TYPENUM #define MAXTYPENUMBER INIT_TYPENUM
#define Oddp(num) (((num % 2) != 0) ? 1 : 0) #define Oddp(num) ((((num) % 2) != 0) ? 1 : 0)
#define Evenp(num, prim) (((num % prim) == 0) ? 1 : 0) #define Evenp(num, prim) ((((num) % (prim)) == 0) ? 1 : 0)
#define Increment_Allocation_Count(n) \ #define Increment_Allocation_Count(n) \
if (*Reclaim_cnt_word != NIL) { \ if (*Reclaim_cnt_word != NIL) { \
if (*Reclaim_cnt_word > n) \ if (*Reclaim_cnt_word > (n)) \
(*Reclaim_cnt_word) -= n; \ (*Reclaim_cnt_word) -= (n); \
else { \ else { \
*Reclaim_cnt_word = NIL; \ *Reclaim_cnt_word = NIL; \
doreclaim(); \ doreclaim(); \

View File

@@ -91,16 +91,16 @@
#endif /* NEWCDRCODING */ #endif /* NEWCDRCODING */
#define TODO_LIMIT 1000 #define TODO_LIMIT 1000
#define ADD_TO_DO(ptr, offset) \ #define ADD_TO_DO(ptr, offset) \
if (do_count < TODO_LIMIT) { \ if (do_count < TODO_LIMIT) { \
if (ptr & 0xF0000000) error("illegal ptr in addtodo"); \ if ((ptr) & 0xF0000000) error("illegal ptr in addtodo"); \
to_do[do_count] = (ptr); \ to_do[do_count] = (ptr); \
to_do_offset[do_count] = offset; \ to_do_offset[do_count] = offset; \
todo_uses++; \ todo_uses++; \
/*REC_GCLOOKUP((ptr), ADDREF);*/ \ /*REC_GCLOOKUP((ptr), ADDREF);*/ \
do_count++; \ do_count++; \
} else { /* error("GC missing some to-do's"); */ \ } else { /* error("GC missing some to-do's"); */ \
todo_misses++; \ todo_misses++; \
} }
unsigned todo_uses = 0; unsigned todo_uses = 0;

View File

@@ -56,7 +56,7 @@
#ifdef BIGVM #ifdef BIGVM
#define HTSTKBIT 0x10000 /* = 512 */ #define HTSTKBIT 0x10000 /* = 512 */
#define HTENDS ((struct hashentry *)htlptr) #define HTENDS ((struct hashentry *)htlptr)
#define GetStkCnt(entry1) (entry1 >> 16) #define GetStkCnt(entry1) ((entry1) >> 16)
#else #else
#define HTSTKBIT 0x200 /* = 512 */ #define HTSTKBIT 0x200 /* = 512 */
#define HTENDS ((struct hashentry *)htlptr) #define HTENDS ((struct hashentry *)htlptr)

View File

@@ -41,7 +41,7 @@
#define MAKE_FXCOPY(fx68k) \ #define MAKE_FXCOPY(fx68k) \
{ \ { \
BEFORE_CONTEXTSW; \ BEFORE_CONTEXTSW; \
if ((fx68k = (FX *)make_FXcopy(fx68k)) == 0) { return (1); /* Whole space exhausted */ } \ if (((fx68k) = (FX *)make_FXcopy(fx68k)) == 0) { return (1); /* Whole space exhausted */ } \
AFTER_CONTEXTSW; \ AFTER_CONTEXTSW; \
CHECK_FX(fx68k); \ CHECK_FX(fx68k); \
} }
@@ -211,8 +211,13 @@ retry: /* this is retry entry after MAKE_FXCOPY etc */
} else { } else {
if (CURRENTFX->nopush) { if (CURRENTFX->nopush) {
CURRENTFX->nopush = NIL; CURRENTFX->nopush = NIL;
CurrentStackPTR = next68k - 2; if (CURRENTFX->mvscase) {
TopOfStack = *((LispPTR *)CurrentStackPTR); CurrentStackPTR = next68k;
CURRENTFX->mvscase = NIL;
} else {
CurrentStackPTR = next68k - 2;
TopOfStack = *((LispPTR *)CurrentStackPTR);
}
CurrentStackPTR -= 2; CurrentStackPTR -= 2;
} else } else

View File

@@ -16,8 +16,8 @@
#include "dbprint.h" #include "dbprint.h"
#include "devif.h" #include "devif.h"
KbdInterfaceRec _curkbd; KbdInterfaceRec curkbd;
KbdInterface currentkbd = &_curkbd; KbdInterface currentkbd = &curkbd;
#ifdef DOS #ifdef DOS
extern void Kbd_event(); extern void Kbd_event();

View File

@@ -545,22 +545,22 @@ typedef struct {
LispPTR CUDATA; LispPTR CUDATA;
} CURSOR; } CURSOR;
#define CursorClippingX(posx, width) \ #define CursorClippingX(posx, width) \
{ \ { \
if (displaywidth < (posx + HARD_CURSORWIDTH)) { \ if (displaywidth < ((posx) + HARD_CURSORWIDTH)) { \
LastCursorClippingX = width = displaywidth - posx; \ LastCursorClippingX = (width) = displaywidth - (posx); \
} else { \ } else { \
LastCursorClippingX = width = HARD_CURSORWIDTH; \ LastCursorClippingX = (width) = HARD_CURSORWIDTH; \
} \ } \
} }
#define CursorClippingY(posy, height) \ #define CursorClippingY(posy, height) \
{ \ { \
if (displayheight < (posy + HARD_CURSORHEIGHT)) { \ if (displayheight < ((posy) + HARD_CURSORHEIGHT)) { \
LastCursorClippingY = height = displayheight - posy; \ LastCursorClippingY = (height) = displayheight - (posy); \
} else { \ } else { \
LastCursorClippingY = height = HARD_CURSORHEIGHT; \ LastCursorClippingY = (height) = HARD_CURSORHEIGHT; \
} \ } \
} }
extern int displaywidth, displayheight; extern int displaywidth, displayheight;

View File

@@ -21,7 +21,7 @@ int main(int argc, char *argv[]) { return (0); }
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#ifdef USE_DLPI #if defined(USE_DLPI)
#include <sys/stream.h> #include <sys/stream.h>
#include <sys/stropts.h> #include <sys/stropts.h>
#include <sys/pfmod.h> #include <sys/pfmod.h>
@@ -53,14 +53,14 @@ char *devices[] = {"le0", "le1", "le2", "le3", "le4", "ie0", "ie1", "i
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifndef USE_DLPI #if defined(USE_NIT)
#include <net/nit.h> #include <net/nit.h>
#ifdef OS4 #ifdef OS4
#include <stropts.h> #include <stropts.h>
#include <net/nit_if.h> #include <net/nit_if.h>
#include <net/nit_pf.h> #include <net/nit_pf.h>
#endif /* OS4 */ #endif /* OS4 */
#endif /* USE_DLPI */ #endif /* USE_NIT */
#include <nlist.h> #include <nlist.h>
#include <fcntl.h> #include <fcntl.h>
@@ -75,7 +75,7 @@ char filetorun[30] = "lde";
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
char Earg[30], Ename[30], **newargv; char Earg[30], Ename[30], **newargv;
int i; int i;
#ifdef USE_DLPI #if defined(USE_DLPI)
static struct packetfilt pf = {0, 1, {ENF_PUSHZERO}}; static struct packetfilt pf = {0, 1, {ENF_PUSHZERO}};
struct strioctl si; struct strioctl si;
#endif /* USE_DLPI */ #endif /* USE_DLPI */
@@ -97,7 +97,7 @@ int main(int argc, char *argv[]) {
*/ */
if (!geteuid()) { if (!geteuid()) {
#ifdef USE_DLPI #if defined(USE_DLPI)
/* Use DLPI to connect to the ethernet. This code is stolen /* Use DLPI to connect to the ethernet. This code is stolen
from NFSWATCH4.3 from NFSWATCH4.3
*/ */
@@ -127,13 +127,10 @@ int main(int argc, char *argv[]) {
fcntl(ether_fd, F_SETFL, fcntl(ether_fd, F_GETFL, 0) | O_NONBLOCK); fcntl(ether_fd, F_SETFL, fcntl(ether_fd, F_GETFL, 0) | O_NONBLOCK);
#else #elif defined(USE_NIT)
/* N O T D L P I C O D E */
#ifndef OS4 #ifndef OS4
if ((ether_fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW)) >= 0) { if ((ether_fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW)) >= 0) {
#else /* OS4 */ #else /* OS4 */
if ((ether_fd = open("/dev/nit", O_RDWR)) >= 0) { if ((ether_fd = open("/dev/nit", O_RDWR)) >= 0) {
#endif /* OS4 */ #endif /* OS4 */
@@ -230,10 +227,10 @@ int main(int argc, char *argv[]) {
/* then if the net is active, spit out the ether info */ /* then if the net is active, spit out the ether info */
if (ether_fd > 0) { if (ether_fd > 0) {
newargv[i++] = "-E"; newargv[i++] = "-E";
#ifdef USE_DLPI #if defined(USE_DLPI)
sprintf(Earg, "%d:%x:%x:%x:%x:%x:%x", ether_fd, ether_host[0], ether_host[1], ether_host[2], sprintf(Earg, "%d:%x:%x:%x:%x:%x:%x", ether_fd, ether_host[0], ether_host[1], ether_host[2],
ether_host[3], ether_host[4], ether_host[5]); ether_host[3], ether_host[4], ether_host[5]);
#else #elif defined(USE_NIT)
sprintf(Earg, "%d:%x:%x:%x:%x:%x:%x:%s", ether_fd, ether_host[0], ether_host[1], ether_host[2], sprintf(Earg, "%d:%x:%x:%x:%x:%x:%x:%s", ether_fd, ether_host[0], ether_host[1], ether_host[2],
ether_host[3], ether_host[4], ether_host[5], Ename); ether_host[3], ether_host[4], ether_host[5], Ename);
#endif /* USE_DLPI */ #endif /* USE_DLPI */

View File

@@ -31,13 +31,13 @@ unsigned int BMask_tbl[] = {0xf, 7, 3, 1};
/*************************************************************** /***************************************************************
Macro:WriteLongW Macro:WriteLongW
**************************************************************/ **************************************************************/
#define WriteLongW(srcpattern, destptr, op1, op2) \ #define WriteLongW(srcpattern, destptr, op1, op2) \
{ \ { \
register int cnt; \ register int cnt; \
register u_char *des, *src; \ register u_char *des, *src; \
for (cnt = 0, des = (u_char *)destptr, src = (u_char *)(&(srcpattern)); cnt < 4; \ for (cnt = 0, des = (u_char *)(destptr), src = (u_char *)(&(srcpattern)); cnt < 4; \
cnt++, des++, src++) \ cnt++, des++, src++) \
(*des) op1(*src); \ (*des) op1(*src); \
} }
/*************************************************************** /***************************************************************
@@ -104,14 +104,14 @@ unsigned int BMask_tbl[] = {0xf, 7, 3, 1};
case 1: \ case 1: \
case 2: \ case 2: \
case 3: \ case 3: \
destc = (u_char *)dstLptr; \ destc = (u_char *)(dstLptr); \
while (width--) { \ while ((width)--) { \
if (BitMaskArray[mod = (offset % 16)] & *srcw) \ if (BitMaskArray[mod = ((offset) % 16)] & *srcw) \
(*destc++) op1(color1); \ (*destc++) op1(color1); \
else \ else \
(*destc++) op1(color0); \ (*destc++) op1(color0); \
if (mod == 15) srcw++; \ if (mod == 15) srcw++; \
offset++; \ (offset)++; \
} /* WHILE END */ \ } /* WHILE END */ \
break; \ break; \
default:; /* error */ \ default:; /* error */ \

View File

@@ -58,7 +58,7 @@ static const char il_string[] = "INTERLISP";
#define METH_CACHE_INDEX(CLASS, SELECTOR) (1023 & ((CLASS) ^ (SELECTOR))) #define METH_CACHE_INDEX(CLASS, SELECTOR) (1023 & ((CLASS) ^ (SELECTOR)))
#define IV_CACHE_INDEX(VARLIST, IV) (1023 & ((VARLIST) ^ (IV))) #define IV_CACHE_INDEX(VARLIST, IV) (1023 & ((VARLIST) ^ (IV)))
#define LC_TYPEP(obj, typeATOM) (DTD_FROM_LADDR((obj)) == typeATOM) #define LC_TYPEP(obj, typeATOM) (DTD_FROM_LADDR((obj)) == (typeATOM))
#define INSTANCEP(obj) (LC_TYPEP((obj), atom_instance)) #define INSTANCEP(obj) (LC_TYPEP((obj), atom_instance))
#define CLASSP(obj) (LC_TYPEP((obj), atom_class)) #define CLASSP(obj) (LC_TYPEP((obj), atom_class))
@@ -80,10 +80,10 @@ static const char il_string[] = "INTERLISP";
#define GET_IV_INDEX(objptr, iv, dest, otherwise) \ #define GET_IV_INDEX(objptr, iv, dest, otherwise) \
{ \ { \
register struct LCIVCacheEntry *ce; \ register struct LCIVCacheEntry *ce; \
register LispPTR iNames = objptr->iNames; \ register LispPTR iNames = (objptr)->iNames; \
\ \
ce = &(LCIVCache[IV_CACHE_INDEX(iNames, iv)]); \ ce = &(LCIVCache[IV_CACHE_INDEX(iNames, iv)]); \
if (ce->iNames == iNames && ce->iv == iv) { \ if (ce->iNames == iNames && ce->iv == (iv)) { \
(dest) = POSINT_FROM_SMALLP(ce->index); \ (dest) = POSINT_FROM_SMALLP(ce->index); \
} else { \ } else { \
if (!Listp(iNames)) { \ if (!Listp(iNames)) { \
@@ -91,8 +91,8 @@ static const char il_string[] = "INTERLISP";
} else { \ } else { \
register int i = 0; \ register int i = 0; \
while (1) { \ while (1) { \
if (car(iNames) == iv) { \ if (car(iNames) == (iv)) { \
ce->iNames = objptr->iNames; \ ce->iNames = (objptr)->iNames; \
ce->iv = iv; \ ce->iv = iv; \
ce->index = SMALLP_FROM_POSINT(i); \ ce->index = SMALLP_FROM_POSINT(i); \
(dest) = i; \ (dest) = i; \

View File

@@ -87,7 +87,7 @@ LispPTR fmemb(register LispPTR item, register LispPTR list) {
if (GetTypeNumber(parm) != TYPE_LISTP) { \ if (GetTypeNumber(parm) != TYPE_LISTP) { \
SAVE_ERROR_EXIT2(tcstk, tos); \ SAVE_ERROR_EXIT2(tcstk, tos); \
} else \ } else \
dest = cadr(parm); \ (dest) = cadr(parm); \
} }
LispPTR N_OP_listget(register LispPTR plist, register LispPTR tos) { LispPTR N_OP_listget(register LispPTR plist, register LispPTR tos) {

View File

@@ -36,7 +36,7 @@
#endif /* DOS */ #endif /* DOS */
#ifdef MAIKO_ENABLE_ETHERNET #ifdef MAIKO_ENABLE_ETHERNET
#ifndef USE_DLPI #if defined(USE_NIT)
#include <net/nit.h> /* needed for Ethernet stuff below */ #include <net/nit.h> /* needed for Ethernet stuff below */
#endif /* USE_DLPI */ #endif /* USE_DLPI */
#endif /* MAIKO_ENABLE_ETHERNET */ #endif /* MAIKO_ENABLE_ETHERNET */
@@ -428,7 +428,7 @@ int main(int argc, char *argv[])
else if (!strcmp(argv[i], "-E")) { /**** ethernet info ****/ else if (!strcmp(argv[i], "-E")) { /**** ethernet info ****/
#ifdef MAIKO_ENABLE_ETHERNET #ifdef MAIKO_ENABLE_ETHERNET
int b0, b1, b2, b3, b4, b5; int b0, b1, b2, b3, b4, b5;
#ifdef USE_DLPI #if defined(USE_DLPI)
if (argc > ++i && if (argc > ++i &&
sscanf(argv[i], "%d:%x:%x:%x:%x:%x:%x", &ether_fd, &b0, &b1, &b2, &b3, &b4, &b5) == 7) sscanf(argv[i], "%d:%x:%x:%x:%x:%x:%x", &ether_fd, &b0, &b1, &b2, &b3, &b4, &b5) == 7)
#else #else

View File

@@ -17,8 +17,8 @@
#include "dbprint.h" #include "dbprint.h"
#include "devif.h" #include "devif.h"
MouseInterfaceRec _curmouse; MouseInterfaceRec curmouse;
MouseInterface currentmouse = &_curmouse; MouseInterface currentmouse = &curmouse;
#ifdef DOS #ifdef DOS
#include <dos.h> #include <dos.h>

View File

@@ -69,6 +69,8 @@ newframe:
fnhead = (struct fnhead *)FuncObj; fnhead = (struct fnhead *)FuncObj;
pc = (ByteCode *)PC + 3; /* to skip the miscn opcode we're in now */ pc = (ByteCode *)PC + 3; /* to skip the miscn opcode we're in now */
} else { } else {
unbind_count = 0; /* different frame */
fnhead = (struct fnhead *)Addr68k_from_LADDR(POINTERMASK & SWA_FNHEAD((int)caller->fnheader)); fnhead = (struct fnhead *)Addr68k_from_LADDR(POINTERMASK & SWA_FNHEAD((int)caller->fnheader));
pc = (ByteCode *)fnhead + (caller->pc); pc = (ByteCode *)fnhead + (caller->pc);
} }
@@ -98,9 +100,14 @@ newpc:
/* BUT 3's not enough for big atoms, so add diff between FN op size & MISCN op size */ /* BUT 3's not enough for big atoms, so add diff between FN op size & MISCN op size */
if (caller == immediate_caller) PC = pc + (FN_OPCODE_SIZE - 3); if (caller == immediate_caller) PC = pc + (FN_OPCODE_SIZE - 3);
#endif /* BIGATOMS */ #endif /* BIGATOMS */
else {
else
caller->pc = (UNSIGNED)pc + FN_OPCODE_SIZE - (UNSIGNED)fnhead; caller->pc = (UNSIGNED)pc + FN_OPCODE_SIZE - (UNSIGNED)fnhead;
/* skip over FN opcode when we get there */
prevcaller->fast = 0;
caller->mvscase = 1;
caller->nopush = 1;
}
return (make_value_list(arg_count, args)); return (make_value_list(arg_count, args));
} }
break; break;
@@ -271,26 +278,22 @@ LispPTR make_value_list(int argcount, LispPTR *argarray) {
void simulate_unbind(FX2 *frame, int unbind_count, FX2 *returner) { void simulate_unbind(FX2 *frame, int unbind_count, FX2 *returner) {
int unbind; int unbind;
LispPTR *stackptr = (LispPTR *)(Stackspace + frame->nextblock); LispPTR *stack_pointer = (LispPTR *)(Stackspace + frame->nextblock);
for (unbind = 0; unbind < unbind_count; unbind++) { for (unbind = 0; unbind < unbind_count; unbind++) {
register int value; register int num;
register LispPTR *lastpvar; register LispPTR *ppvar;
int bindnvalues; register int i;
for (; ((int)*--stackptr >= 0);) register LispPTR value;
; /* find the binding mark */
value = (int)*stackptr; for (; (((int)*--(stack_pointer)) >= 0);)
lastpvar = (LispPTR *)((DLword *)frame + FRAMESIZE + 2 + GetLoWord(value)); ;
; value = *stack_pointer;
bindnvalues = (~value) >> 16; num = (~value) >> 16;
for (value = bindnvalues; --value >= 0;) { *--lastpvar = 0xffffffff; } ppvar = (LispPTR *)((DLword *)frame + FRAMESIZE + 2 + GetLoWord(value));
/* This line caused \NSMAIL.READ.HEADING to smash memory, */ for (i = num; --i >= 0;) { *--ppvar = 0xffffffff; }
/* so I removed it 21 Jul 91 --JDS. This was the only */
/* difference between this function and the UNWIND code */
/* in inlineC.h */
/* MAKEFREEBLOCK(stackptr, (DLword *)stackptr-nextblock); */
} }
if (returner) /* if (returner)
returner->fast = 0; /* since we've destroyed contiguity */ returner->fast = 0; since we've destroyed contiguity */
/* in the stack, but that only /* in the stack, but that only
matters if there's a return. */ matters if there's a return. */
} }

View File

@@ -29,7 +29,6 @@
/***********************************************************/ /***********************************************************/
#include <stdio.h> #include <stdio.h>
#include <time.h>
#include "lispemul.h" #include "lispemul.h"
#include "address.h" #include "address.h"
#include "adr68k.h" #include "adr68k.h"
@@ -780,20 +779,6 @@ void OP_subrcall(int subr_no, int argnum) {
break; break;
} }
#endif /* LPSOLVE */ #endif /* LPSOLVE */
case sb_YIELD: {
struct timespec rqts = {0, 833333};
unsigned sleepnanos;
POP_SUBR_ARGS;
N_GETNUMBER(args[0], sleepnanos, ret_nil);
if (sleepnanos > 999999999) {
TopOfStack = NIL;
break;
}
rqts.tv_nsec = sleepnanos;
nanosleep(&rqts, NULL);
TopOfStack = ATOM_T;
break;
}
default: { default: {
char errtext[200]; char errtext[200];
sprintf(errtext, "OP_subrcall: Invalid alpha byte 0%o", ((*(PC + 1)) & 0xff)); sprintf(errtext, "OP_subrcall: Invalid alpha byte 0%o", ((*(PC + 1)) & 0xff));

View File

@@ -42,9 +42,11 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <setjmp.h> #include <setjmp.h>
#include <string.h>
#include "lispemul.h" #include "lispemul.h"
#include "lispmap.h" #include "lispmap.h"
@@ -57,7 +59,9 @@
#include "debug.h" #include "debug.h"
#include "dbprint.h" #include "dbprint.h"
#include "tosfns.h" #include "tosfns.h"
#include "array.h"
#include "commondefs.h"
#include "testtooldefs.h" #include "testtooldefs.h"
#include "dbgtooldefs.h" #include "dbgtooldefs.h"
#include "gcarraydefs.h" #include "gcarraydefs.h"
@@ -106,16 +110,17 @@ void print_atomname(LispPTR index)
/* */ /* */
/************************************************************************/ /************************************************************************/
#define PACKAGES_LIMIT 255
/** GET PACKAGE INDEX from PACKAGE FULL NAME */
int find_package_from_name(const char *packname, int len) { int find_package_from_name(const char *packname, int len) {
int index; int index;
PACKAGE *package; PACKAGE *package;
NEWSTRINGP *namestring; NEWSTRINGP *namestring;
DLword len2; DLword len2;
char *pname; char *pname;
struct arrayheader *pi_array;
for (index = 1; index <= PACKAGES_LIMIT; index++) { /* assumes the *PACKAGE-FROM-INDEX* array is simple with no offset */
pi_array = (struct arrayheader *)Addr68k_from_LADDR(*Package_from_Index_word);
for (index = 1; index < pi_array->totalsize; index++) {
package = (PACKAGE *)Addr68k_from_LADDR(aref1(*Package_from_Index_word, index)); package = (PACKAGE *)Addr68k_from_LADDR(aref1(*Package_from_Index_word, index));
namestring = (NEWSTRINGP *)Addr68k_from_LADDR(package->NAME); namestring = (NEWSTRINGP *)Addr68k_from_LADDR(package->NAME);
pname = (char *)Addr68k_from_LADDR(namestring->base); pname = (char *)Addr68k_from_LADDR(namestring->base);
@@ -322,7 +327,7 @@ void trace_listpDTD(void) {
void a68k(LispPTR lispptr) { void a68k(LispPTR lispptr) {
DLword *val; DLword *val;
val = Addr68k_from_LADDR(lispptr); val = Addr68k_from_LADDR(lispptr);
printf("68k: 0x%x (%d)\n", val, val); printf("68k: %p (%"PRIuPTR")\n", (void *)val, (uintptr_t)val);
} }
/************************************************************************/ /************************************************************************/
@@ -358,7 +363,7 @@ void dump_fnbody(LispPTR fnblockaddr)
fnobj = (struct fnhead *)Addr68k_from_LADDR(fnblockaddr); fnobj = (struct fnhead *)Addr68k_from_LADDR(fnblockaddr);
printf("***DUMP Func Obj << "); printf("***DUMP Func Obj << ");
printf("start at 0x%x lisp address(0x%x 68k)\n", LADDR_from_68k(fnobj), fnobj); printf("start at 0x%x lisp address(%p 68k)\n", LADDR_from_68k(fnobj), fnobj);
print(fnobj->framename); print(fnobj->framename);
putchar('\n'); putchar('\n');
@@ -377,7 +382,7 @@ void dump_fnbody(LispPTR fnblockaddr)
for (i = 20; i < (fnobj->startpc); i += 2) { for (i = 20; i < (fnobj->startpc); i += 2) {
int word; int word;
word = (int)(0xffff & (GETWORD((DLword *)(scratch + i)))); word = (int)(0xffff & (GETWORD((DLword *)(scratch + i))));
printf(" 0x%x(0x%x 68k): 0%6o 0x%4x\n", LADDR_from_68k(scratch + i), scratch + i, word, word); printf(" 0x%x(%p 68k): 0%6o 0x%4x\n", LADDR_from_68k(scratch + i), scratch + i, word, word);
} }
scratch = (DLbyte *)fnobj + (fnobj->startpc); scratch = (DLbyte *)fnobj + (fnobj->startpc);
@@ -813,7 +818,7 @@ void doko(void) {
printf(" At "); printf(" At ");
print_atomname(FuncObj->framename); print_atomname(FuncObj->framename);
putchar('\n'); putchar('\n');
printf(" PC cnt = 0%o\n", ((UNSIGNED)(PC) - (UNSIGNED)FuncObj)); printf(" PC cnt = 0%"PRIoPTR"\n", ((UNSIGNED)(PC) - (UNSIGNED)FuncObj));
} }
/**** dump specified area (in 32 bit width) ***/ /**** dump specified area (in 32 bit width) ***/
@@ -847,18 +852,6 @@ void printPC(void) {
printf("PC: O%o ", pc); printf("PC: O%o ", pc);
} }
/***************************/
int countchar(char *string) {
int cnt = 0;
while (*string != '\0') {
string++;
cnt++;
}
return (cnt);
}
void dump_bf(Bframe *bf) { void dump_bf(Bframe *bf) {
DLword *ptr; DLword *ptr;
printf("\n*** Basic Frame"); printf("\n*** Basic Frame");
@@ -881,7 +874,7 @@ void dump_bf(Bframe *bf) {
} }
printflags: printflags:
printf("\n %x : %x %x ", LADDR_from_68k(bf), *bf, *(bf + 1)); printf("\n %x : %x %x ", LADDR_from_68k(bf), *(DLword *)bf, *((DLword *)bf + 1));
putchar('['); putchar('[');
if (BFRAMEPTR(bf)->residual) printf("Residual, "); if (BFRAMEPTR(bf)->residual) printf("Residual, ");
if (BFRAMEPTR(bf)->padding) printf("Padded, "); if (BFRAMEPTR(bf)->padding) printf("Padded, ");
@@ -1024,10 +1017,8 @@ FX *get_nextFX(FX *fx) {
} /* get_nextFX end */ } /* get_nextFX end */
int MAKEATOM(char *string) { LispPTR MAKEATOM(char *string) {
int length; return (make_atom(string, 0, strlen(string), 0));
length = countchar(string);
return (make_atom(string, 0, length, 0));
} }
/************************************************************************/ /************************************************************************/
@@ -1040,8 +1031,11 @@ int MAKEATOM(char *string) {
/************************************************************************/ /************************************************************************/
LispPTR *MakeAtom68k(char *string) { LispPTR *MakeAtom68k(char *string) {
int index; LispPTR index;
index = make_atom(string, 0, countchar(string), 0); index = make_atom(string, 0, strlen(string), 0);
if (index == 0xffffffff) {
error("MakeAtom68k: no such atom found");
}
#ifdef BIGVM #ifdef BIGVM
index = (ATOMS_HI << 16) + (index * 10) + NEWATOM_VALUE_OFFSET; index = (ATOMS_HI << 16) + (index * 10) + NEWATOM_VALUE_OFFSET;
#else #else
@@ -1070,44 +1064,6 @@ void GETTOPVAL(char *string) {
printf("'%s': no such symbol.\n", string); printf("'%s': no such symbol.\n", string);
} }
/************************************************************************/
/* */
/* S _ T O P V A L */
/* */
/* Given a string that's an atom name minus the initial \, */
/* print the atom's top-level value. This is here because */
/* DBX won't put \'s in strings you type. */
/* */
/************************************************************************/
void S_TOPVAL(char *string) {
int index;
LispPTR *cell68k;
int length;
char dummy[256];
dummy[0] = '\\';
for (length = 1; *string != '\0'; length++, string++) { dummy[length] = *string; }
index = make_atom(dummy, 0, length, 0);
cell68k = (LispPTR *)GetVALCELL68k(index);
print(*cell68k);
}
/***************/
int S_MAKEATOM(char *string) {
int index = 0;
int length;
char dummy[256];
dummy[0] = '\\';
for (length = 1; *string != '\0'; length++, string++) { dummy[length] = *string; }
index = make_atom(dummy, 0, length, 0);
printf("#Atomindex : %d\n", index);
return (index);
}
/****************************************************************************/ /****************************************************************************/
/* all_stack_dump(start,end) /* all_stack_dump(start,end)
*/ */

View File

@@ -45,7 +45,7 @@ unsigned long tick_count = 0; /* approx 18 ticks per sec */
#include <sys/time.h> #include <sys/time.h>
#endif /* DOS */ #endif /* DOS */
#ifdef USE_DLPI #if defined(USE_DLPI)
#include <stropts.h> #include <stropts.h>
extern int ether_fd; extern int ether_fd;
#endif #endif
@@ -546,7 +546,7 @@ static void int_io_init() {
perror("ioctl on X fd - SETSIG for input handling failed"); perror("ioctl on X fd - SETSIG for input handling failed");
#endif #endif
#ifdef USE_DLPI #if defined(USE_DLPI)
DBPRINT(("INIT ETHER: Doing I_SETSIG.\n")); DBPRINT(("INIT ETHER: Doing I_SETSIG.\n"));
if (ether_fd > 0) if (ether_fd > 0)
if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) { if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) {

View File

@@ -243,10 +243,10 @@ v filename\t\tSaves the virtual memory on the filename (Not Bootable)\n\
?\t\t\tDisplays this summary"; ?\t\t\tDisplays this summary";
#endif /* DOS */ #endif /* DOS */
#define ADD_RANGEP(address) \ #define ADD_RANGEP(address) \
if ((address < 0) || (POINTERMASK < address)) { \ if (((address) < 0) || (POINTERMASK < (address))) { \
printf("Address out of range.\n"); \ printf("Address out of range.\n"); \
return (T); \ return (T); \
} }
#define URMAXCOMM 512 #define URMAXCOMM 512
@@ -1083,7 +1083,7 @@ int device_after_raid() {
#ifdef MAIKO_ENABLE_ETHERNET #ifdef MAIKO_ENABLE_ETHERNET
init_ether(); init_ether();
#ifdef USE_DLPI #if defined(USE_DLPI)
if (ether_fd > 0) if (ether_fd > 0)
if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) { if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) {
perror("after-uraid: I_SETSIG for ether failed:\n"); perror("after-uraid: I_SETSIG for ether failed:\n");

View File

@@ -67,12 +67,12 @@
/* Error return values from VMEMSAVE */ /* Error return values from VMEMSAVE */
#define COMPLETESYSOUT NIL #define COMPLETESYSOUT NIL
#define BADFILENAME S_POSITIVE | 1 #define BADFILENAME (S_POSITIVE | 1)
#define NOFILESPACE S_POSITIVE | 2 #define NOFILESPACE (S_POSITIVE | 2)
#define FILECANNOTOPEN S_POSITIVE | 3 #define FILECANNOTOPEN (S_POSITIVE | 3)
#define FILECANNOTSEEK S_POSITIVE | 4 #define FILECANNOTSEEK (S_POSITIVE | 4)
#define FILECANNOTWRITE S_POSITIVE | 5 #define FILECANNOTWRITE (S_POSITIVE | 5)
#define FILETIMEOUT S_POSITIVE | 6 #define FILETIMEOUT (S_POSITIVE | 6)
extern int LispWindowFd; extern int LispWindowFd;
extern struct pixrect *CursorBitMap, *InvisibleCursorBitMap; extern struct pixrect *CursorBitMap, *InvisibleCursorBitMap;

View File

@@ -43,8 +43,9 @@
#endif /* OS5 */ #endif /* OS5 */
#define PERCENT_OF_SCREEN 95 #define PERCENT_OF_SCREEN 95
#define DISPLAY_MAX 65536 * 16 * 2 /* same magic number is */ /* DISPLAY_MAX same magic number is in ldsout.c */
/* in loadsysout.c */ #define DISPLAY_MAX (65536 * 16 * 2)
extern DLword *Lisp_world; extern DLword *Lisp_world;
extern char Display_Name[128]; extern char Display_Name[128];
extern DLword *DisplayRegion68k; extern DLword *DisplayRegion68k;

View File

@@ -17,10 +17,11 @@
#include <sys/file.h> #include <sys/file.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#ifdef MAIKO_ENABLE_ETHERNET #ifdef MAIKO_ENABLE_ETHERNET
#ifndef USE_DLPI #if defined(USE_NIT)
#include <net/nit.h> /* needed for Ethernet stuff below */ #include <net/nit.h> /* needed for Ethernet stuff below */
#endif /* USE_DLPI */ #endif /* USE_NIT */
#endif /* MAIKO_ENABLE_ETHERNET */ #endif /* MAIKO_ENABLE_ETHERNET */
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
@@ -91,9 +92,9 @@ extern int sysout_size, for_makeinit, please_fork;
#ifdef MAIKO_ENABLE_ETHERNET #ifdef MAIKO_ENABLE_ETHERNET
extern int ether_fd; extern int ether_fd;
extern u_char ether_host[6]; extern u_char ether_host[6];
#ifndef USE_DLPI #if defined(USE_NIT)
extern struct sockaddr_nit snit; extern struct sockaddr_nit snit;
#endif /* USE_DLPI */ #endif /* USE_NIT */
#endif /* MAIKO_ENABLE_ETHERNET */ #endif /* MAIKO_ENABLE_ETHERNET */
/************************************************************************/ /************************************************************************/
@@ -173,11 +174,11 @@ void read_Xoption(int *argc, char *argv[])
sysout_name[0] = '\0'; sysout_name[0] = '\0';
if (*argc == 2) /* There was probably a sysoutarg */ if (*argc == 2) /* There was probably a sysoutarg */
{ {
(void)strcpy(sysout_name, argv[1]); (void)strncpy(sysout_name, argv[1], PATH_MAX - 1);
} else if ((envname = getenv("LDESRCESYSOUT")) != NULL) { } else if ((envname = getenv("LDESRCESYSOUT")) != NULL) {
strcpy(sysout_name, envname); strncpy(sysout_name, envname, PATH_MAX - 1);
} else if ((envname = getenv("LDESOURCESYSOUT")) != NULL) } else if ((envname = getenv("LDESOURCESYSOUT")) != NULL)
strcpy(sysout_name, envname); strncpy(sysout_name, envname, PATH_MAX - 1);
else { else {
envname = getenv("HOME"); envname = getenv("HOME");
(void)strcat(sysout_name, envname); (void)strcat(sysout_name, envname);
@@ -296,12 +297,12 @@ void read_Xoption(int *argc, char *argv[])
if (XrmGetResource(rDB, "ldex.EtherNet", "Ldex.EtherNet", str_type, &value) == True) { if (XrmGetResource(rDB, "ldex.EtherNet", "Ldex.EtherNet", str_type, &value) == True) {
int b0, b1, b2, b3, b4, b5; int b0, b1, b2, b3, b4, b5;
(void)strncpy(tmp, value.addr, (int)value.size); (void)strncpy(tmp, value.addr, (int)value.size);
#ifdef USE_DLPI #if defined(USE_DLPI)
if (sscanf(tmp, "%d:%x:%x:%x:%x:%x:%x", &ether_fd, &b0, &b1, &b2, &b3, &b4, &b5) == 7) if (sscanf(tmp, "%d:%x:%x:%x:%x:%x:%x", &ether_fd, &b0, &b1, &b2, &b3, &b4, &b5) == 7)
#else #elif defined(USE_NIT)
if (sscanf(tmp, "%d:%x:%x:%x:%x:%x:%x:%s", &ether_fd, &b0, &b1, &b2, &b3, &b4, &b5, if (sscanf(tmp, "%d:%x:%x:%x:%x:%x:%x:%s", &ether_fd, &b0, &b1, &b2, &b3, &b4, &b5,
snit.snit_ifname) == 8) snit.snit_ifname) == 8)
#endif /* USE_DLPI */ #endif /* USE_NIT */
{ {
ether_host[0] = b0; ether_host[0] = b0;
ether_host[1] = b1; ether_host[1] = b1;

View File

@@ -213,14 +213,8 @@ void getXsignaldata(DspInterface dsp)
case Button3: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, FALSE); break; case Button3: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, FALSE); break;
case Button4: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFT, FALSE); break; case Button4: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFT, FALSE); break;
case Button5: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFTMIDDLE, FALSE); break; case Button5: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFTMIDDLE, FALSE); break;
#if 0 case Button5 + 1: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHT, FALSE); break;
/* Button6 and Button7 are not defined, but these values are generated by case Button5 + 2: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHTMIDDLE, FALSE); break;
macOS for the left and right scrolling movements.
Leave them out for now, until we've sorted out the up and down scrolling.
*/
case Button5 + 1: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHTMIDDLE, FALSE); break;
case Button5 + 2: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHT, FALSE); break;
#endif
default: break; default: break;
} }
DoRing(); DoRing();
@@ -233,11 +227,8 @@ void getXsignaldata(DspInterface dsp)
case Button3: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, TRUE); break; case Button3: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, TRUE); break;
case Button4: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFT, TRUE); break; case Button4: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFT, TRUE); break;
case Button5: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFTMIDDLE, TRUE); break; case Button5: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFTMIDDLE, TRUE); break;
#if 0 case Button5 + 1: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHT, TRUE); break;
/* See above for key press */ case Button5 + 2: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHTMIDDLE, TRUE); break;
case Button5 + 1: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHTMIDDLE, TRUE); break;
case Button5 + 2: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHT, TRUE); break;
#endif
default: break; default: break;
} }
DoRing(); DoRing();