1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-16 14:57:20 +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
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)
* [Discussions](https://github.com/Interlisp/medley/discussions) (Q&A, announcements, etc)
* [Medley's README](https://github.com/Interlisp/medley/blob/master/README.md)
@@ -33,18 +33,17 @@ $ cd maiko/bin
$ ./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`.
* 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`.
* There is a cmake configuration (TBD)
* 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-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 To Be Described here).
### Building For MacOS
* 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/
For the new arm64 MacOS 11, you'll need https://x.org which you can get via MacPorts or Brew.
An X-server for MacOS (and X11 client libraries) can be freely obtained at https://www.xquartz.org/releases
### 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.

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
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
OPTFLAGS = -O0 -g3
DFLAGS = $(XFLAGS) -DRELEASE=351
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 */
#define LLSH(datum , n) ((datum )<< n)
#define LRSH(datum , n) ((datum) >> n)
#define LLSH(datum, n) ((datum) << (n))
#define LRSH(datum, n) ((datum) >> (n))
#define HILOC(ptr) (LRSH(((unsigned int)(ptr) & SEGMASK),16))
#define LOLOC(ptr) ((unsigned int)(ptr) & 0x0ffff)

View File

@@ -48,7 +48,7 @@
/* translate LispPage to 68k address */
#define Addr68k_from_LPAGE(Lisp_page) (Addr68k_from_LADDR((Lisp_page << 8) ))
#define Addr68k_from_LPAGE(Lisp_page) (Addr68k_from_LADDR(((Lisp_page) << 8) ))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -21,7 +21,6 @@ void doko(void);
void dumpl(LispPTR laddr);
void dumps(LispPTR laddr);
void printPC(void);
int countchar(char *string);
void dump_bf(Bframe *bf);
void dump_fx(struct frameex1 *fx_addr68k);
void dump_stackframe(struct frameex1 *fx_addr68k);
@@ -29,11 +28,9 @@ void dump_CSTK(int before);
void btv(void);
int get_framename(struct frameex1 *fx_addr68k);
FX *get_nextFX(FX *fx);
int MAKEATOM(char *string);
LispPTR MAKEATOM(char *string);
LispPTR *MakeAtom68k(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 dtd_chain(DLword type);
void Trace_FNCall(int numargs, int atomindex, int arg1, LispPTR *tos);

View File

@@ -203,13 +203,13 @@
FN_STACK_CHECK; \
{ \
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); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if (LOCFNCELL->na >= 0) { \
register int RESTARGS; \
RESTARGS = argcount - LOCFNCELL->na; \
RESTARGS = (argcount) - LOCFNCELL->na; \
while (RESTARGS < 0) { \
HARD_PUSH(NIL_PTR); \
RESTARGS++; \

View File

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

View File

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

View File

@@ -77,14 +77,14 @@ extern int Dummy_errno;
separate_version(tname, tver, 0); \
\
if ((pp = (char *)strrchr(tname, '.')) == NULL) { \
*text = '\0'; \
*(text) = '\0'; \
} else { \
*pp = '\0'; \
strcpy(text, pp + 1); \
} \
\
if ((pp = (char *)strrchr(pname, '.')) == NULL) { \
*pext = '\0'; \
*(pext) = '\0'; \
} else { \
*pp = '\0'; \
strcpy(pext, pp + 1); \
@@ -104,9 +104,9 @@ extern int Dummy_errno;
SetupMatch(tname, pname, text, pext, tver); \
\
if (match_pattern(tname, pname) && match_pattern(text, pext) && match_pattern(tver, ver)) \
goto matchtag; \
goto matchtag; /* NOLINT(bugprone-macro-parentheses) */ \
else \
goto unmatchtag; \
goto unmatchtag; /* NOLINT(bugprone-macro-parentheses) */ \
}
#define MatchP_Case(target, name, ver, matchtag, unmatchtag) \
@@ -120,9 +120,9 @@ extern int Dummy_errno;
SetupMatch(tname, pname, text, pext, tver); \
\
if (match_pattern(tname, pname) && match_pattern(text, pext) && match_pattern(tver, ver)) \
goto matchtag; \
goto matchtag; /* NOLINT(bugprone-macro-parentheses) */ \
else \
goto unmatchtag; \
goto unmatchtag; /* NOLINT(bugprone-macro-parentheses) */ \
}
/*
@@ -292,13 +292,13 @@ int MAXFINFO;
#define AllocFinfo(fp) \
{ \
if (FreeFinfoList != (FINFO *)NULL) { \
fp = FreeFinfoList; \
FreeFinfoList = fp->next; \
} else if ((fp = (FINFO *)calloc(1, sizeof(FINFO))) == NULL) { \
fp = (FINFO *)NULL; \
} else if ((fp->prop = (FPROP *)calloc(1, sizeof(FPROP))) == NULL) { \
(fp) = FreeFinfoList; \
FreeFinfoList = (fp)->next; \
} else if (((fp) = (FINFO *)calloc(1, sizeof(FINFO))) == NULL) { \
(fp) = (FINFO *)NULL; \
} else if (((fp)->prop = (FPROP *)calloc(1, sizeof(FPROP))) == NULL) { \
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) \
{ \
register FileName *centry; \
for (centry = varray, max_no = 0; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no > max_no) { \
max_no = centry->version_no; \
mentry = centry; \
for (centry = (varray), (max_no) = 0; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no > (max_no)) { \
(max_no) = centry->version_no; \
(mentry) = centry; \
} \
} \
}
@@ -2878,10 +2878,10 @@ static int make_directory(register char *dir)
#define FindLowestVersion(varray, mentry, min_no) \
{ \
register FileName *centry; \
for (centry = varray, min_no = MAXVERSION; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no < min_no && centry->version_no != 0) { \
min_no = centry->version_no; \
mentry = centry; \
for (centry = (varray), (min_no) = MAXVERSION; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no < (min_no) && centry->version_no != 0) { \
(min_no) = centry->version_no; \
(mentry) = centry; \
} \
} \
}
@@ -2915,10 +2915,10 @@ static int make_directory(register char *dir)
{ \
register FileName *centry; \
\
sentry = (FileName *)NULL; \
(sentry) = (FileName *)NULL; \
for (centry = varray; centry->version_no != LASTVERSIONARRAY; centry++) \
if (centry->version_no == ver_no) { \
sentry = centry; \
if (centry->version_no == (ver_no)) { \
(sentry) = centry; \
break; \
} \
}

View File

@@ -21,9 +21,8 @@
#include "dspifdefs.h"
#include "xinitdefs.h"
DspInterfaceRec _curdsp;
DspInterface currentdsp = &_curdsp;
DspInterfaceRec curdsp;
DspInterface currentdsp = &curdsp;
#ifdef XWINDOW
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) \
switch (SEGMASK & arg) { \
case ATOM_OFFSET: doit; \
case S_CHARACTER: doit; \
case S_POSITIVE: doitsmall; \
case S_NEGATIVE: doitsmall; \
#define IF_IMMEDIATE(arg, doit, doitsmall) \
switch (SEGMASK & (arg)) { \
case ATOM_OFFSET: doit; /* NOLINT(bugprone-macro-parentheses) */ \
case S_CHARACTER: doit; /* NOLINT(bugprone-macro-parentheses) */ \
case S_POSITIVE: doitsmall; /* NOLINT(bugprone-macro-parentheses) */ \
case S_NEGATIVE: doitsmall; /* NOLINT(bugprone-macro-parentheses) */ \
}
/************************************************************************/

View File

@@ -9,7 +9,7 @@
#include "version.h"
#ifdef USE_DLPI
#if defined(USE_DLPI)
#define PKTFILTER 1
#define NIOCSFLAGS SBIOCSFLAGS
#endif
@@ -34,9 +34,9 @@
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#ifdef USE_DLPI
#if defined(USE_DLPI)
#include "dlpidefs.h"
#else
#elif defined(USE_NIT)
#include <net/nit.h>
#endif
@@ -55,7 +55,7 @@
#endif /* OS4 */
#endif /* PKTFILTER */
#ifndef USE_DLPI
#if defined(USE_NIT)
#include <sys/mbuf.h>
#endif
#include <nlist.h>
@@ -73,7 +73,7 @@
#include "dbprint.h"
#include "etherdefs.h"
#ifdef USE_DLPI
#if defined(USE_DLPI)
#define NIOCSETF PFIOCSETF
#endif
@@ -245,7 +245,7 @@ LispPTR ether_suspend(LispPTR args[])
/* The trick here is to install a packet filter */
/* that rejects all packets, I think... */
#ifdef USE_DLPI
#if defined(USE_DLPI)
si.ic_cmd = PFIOCSETF;
si.ic_timout = -1;
@@ -257,7 +257,7 @@ LispPTR ether_suspend(LispPTR args[])
return (NIL);
}
#else
#elif defined(USE_NIT)
if (ioctl(ether_fd, NIOCSETF, &nopf) != 0) {
perror("ether_suspend: NIOCSETF failed\n");
return (NIL);
@@ -291,7 +291,7 @@ LispPTR ether_resume(LispPTR args[])
#else /* PKTFILTER */
/* Install a packet filter that accepts all packets we want */
#ifdef USE_DLPI
#if defined(USE_DLPI)
si.ic_cmd = PFIOCSETF;
si.ic_timout = -1;
@@ -303,7 +303,7 @@ LispPTR ether_resume(LispPTR args[])
return (NIL);
}
#else
#elif defined(USE_NIT)
if (ioctl(ether_fd, NIOCSETF, &goodpf) != 0) {
perror("ether_resume: NIOCSETF failed\n");
return (NIL);
@@ -763,9 +763,9 @@ void init_ifpage_ether() {
#ifdef MAIKO_ENABLE_ETHERNET
/* 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 */
#ifndef USE_DLPI
#if defined(USE_NIT)
struct sockaddr_nit snit;
#endif /* USE_DLPI */
#endif /* USE_NIT */
#endif /* MAIKO_ENABLE_ETHERNET */
/************************************************************************/
@@ -793,7 +793,7 @@ void init_ether() {
if it's already open here, it was opened by ldeether and
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
from NFSWATCH4.3
*/
@@ -832,9 +832,7 @@ void init_ether() {
}
seteuid(getuid());
}
#else
/* N O T D L P I C O D E */
#elif defined(USE_NIT)
#ifndef OS4
if (getuid() != geteuid()) {
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 */
/* install packetfilter that rejects everything */
#ifdef USE_DLPI
#if defined(USE_DLPI)
si.ic_cmd = PFIOCSETF;
si.ic_timout = -1;
@@ -1009,7 +1007,7 @@ void init_ether() {
return;
}
#else
#elif defined(USE_NIT)
if (ioctl(ether_fd, NIOCSETF, &nopf) != 0) {
perror("init_ether: nopf NIOCSETF failed:\n");
@@ -1028,9 +1026,9 @@ void init_ether() {
/* then throw away everything that's currently buffered there;
this descriptor may have been open since ldeether ran, with
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"); }
#else
#elif defined(USE_NIT)
{
FD_SET(ether_fd, &rfds);
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[14] = (DLword)((ether_host[4] << 8) + ether_host[5]);
/* and set up the packetfilter */
#ifdef USE_DLPI
#if defined(USE_DLPI)
si.ic_cmd = PFIOCSETF;
si.ic_timout = -1;
@@ -1066,7 +1064,7 @@ void init_ether() {
return;
}
#endif /* USE_DLPI */
#ifndef USE_DLPI
#if defined(USE_NIT)
DBPRINT(("INIT ETHER: Doing I_SETSIG.\n"));
if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) {
perror("init_ether: I_SETSIG failed:\n");
@@ -1074,7 +1072,7 @@ void init_ether() {
ether_fd = -1;
return;
}
#endif /* USE_DLPI */
#endif /* USE_NIT */
#endif /* PKTFILTER */
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 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
@@ -389,7 +389,7 @@ LispPTR N_OP_fvar_(register LispPTR tos, register int n) {
: (swapx((int)(x) + NEWATOM_VALUE_OFFSET)))
#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 */

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);
if (packindex < 0) {
printf("getting package index is failed \n");
printf("getting package index failed %s:%s\n", packname, char_base);
return (0xffffffff);
}

View File

@@ -46,15 +46,15 @@
#include "commondefs.h"
#include "gchtfinddefs.h"
#define min(a, b) ((a > b) ? b : a)
#define min(a, b) (((a) > (b)) ? (b) : (a))
#define ENDOFX 0
#define GCONST 111
#define Reprobefn(bits, index) (((bits ^ ((bits) >> 8)) & min(63, index)) | 1)
#define Fn16bits(a, b) ((a + b) & 0x0ffff)
#define Reprobefn(bits, index) ((((bits) ^ ((bits) >> 8)) & min(63, index)) | 1)
#define Fn16bits(a, b) (((a) + (b)) & 0x0ffff)
#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
typedef struct implicit_key_hash_table {

View File

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

View File

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

View File

@@ -74,7 +74,7 @@
#define Boundp(frame_field) ((frame_field) == 0)
#define Stkref(ptr) REC_GCLOOKUP(ptr, STKREF)
#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 HENTRY ((struct hashentry *)(entry))
#define HTMAIN_ENTRY_COUNT (HTMAIN_SIZE >> 1)

View File

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

View File

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

View File

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

View File

@@ -41,7 +41,7 @@
#define MAKE_FXCOPY(fx68k) \
{ \
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; \
CHECK_FX(fx68k); \
}
@@ -211,8 +211,13 @@ retry: /* this is retry entry after MAKE_FXCOPY etc */
} else {
if (CURRENTFX->nopush) {
CURRENTFX->nopush = NIL;
CurrentStackPTR = next68k - 2;
TopOfStack = *((LispPTR *)CurrentStackPTR);
if (CURRENTFX->mvscase) {
CurrentStackPTR = next68k;
CURRENTFX->mvscase = NIL;
} else {
CurrentStackPTR = next68k - 2;
TopOfStack = *((LispPTR *)CurrentStackPTR);
}
CurrentStackPTR -= 2;
} else

View File

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

View File

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

View File

@@ -21,7 +21,7 @@ int main(int argc, char *argv[]) { return (0); }
#include <string.h>
#include <unistd.h>
#ifdef USE_DLPI
#if defined(USE_DLPI)
#include <sys/stream.h>
#include <sys/stropts.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/if_ether.h>
#include <sys/ioctl.h>
#ifndef USE_DLPI
#if defined(USE_NIT)
#include <net/nit.h>
#ifdef OS4
#include <stropts.h>
#include <net/nit_if.h>
#include <net/nit_pf.h>
#endif /* OS4 */
#endif /* USE_DLPI */
#endif /* USE_NIT */
#include <nlist.h>
#include <fcntl.h>
@@ -75,7 +75,7 @@ char filetorun[30] = "lde";
int main(int argc, char *argv[]) {
char Earg[30], Ename[30], **newargv;
int i;
#ifdef USE_DLPI
#if defined(USE_DLPI)
static struct packetfilt pf = {0, 1, {ENF_PUSHZERO}};
struct strioctl si;
#endif /* USE_DLPI */
@@ -97,7 +97,7 @@ int main(int argc, char *argv[]) {
*/
if (!geteuid()) {
#ifdef USE_DLPI
#if defined(USE_DLPI)
/* Use DLPI to connect to the ethernet. This code is stolen
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);
#else
/* N O T D L P I C O D E */
#elif defined(USE_NIT)
#ifndef OS4
if ((ether_fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW)) >= 0) {
#else /* OS4 */
if ((ether_fd = open("/dev/nit", O_RDWR)) >= 0) {
#endif /* OS4 */
@@ -230,10 +227,10 @@ int main(int argc, char *argv[]) {
/* then if the net is active, spit out the ether info */
if (ether_fd > 0) {
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],
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],
ether_host[3], ether_host[4], ether_host[5], Ename);
#endif /* USE_DLPI */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -69,6 +69,8 @@ newframe:
fnhead = (struct fnhead *)FuncObj;
pc = (ByteCode *)PC + 3; /* to skip the miscn opcode we're in now */
} else {
unbind_count = 0; /* different frame */
fnhead = (struct fnhead *)Addr68k_from_LADDR(POINTERMASK & SWA_FNHEAD((int)caller->fnheader));
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 */
if (caller == immediate_caller) PC = pc + (FN_OPCODE_SIZE - 3);
#endif /* BIGATOMS */
else
else {
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));
}
break;
@@ -271,26 +278,22 @@ LispPTR make_value_list(int argcount, LispPTR *argarray) {
void simulate_unbind(FX2 *frame, int unbind_count, FX2 *returner) {
int unbind;
LispPTR *stackptr = (LispPTR *)(Stackspace + frame->nextblock);
LispPTR *stack_pointer = (LispPTR *)(Stackspace + frame->nextblock);
for (unbind = 0; unbind < unbind_count; unbind++) {
register int value;
register LispPTR *lastpvar;
int bindnvalues;
for (; ((int)*--stackptr >= 0);)
; /* find the binding mark */
value = (int)*stackptr;
lastpvar = (LispPTR *)((DLword *)frame + FRAMESIZE + 2 + GetLoWord(value));
;
bindnvalues = (~value) >> 16;
for (value = bindnvalues; --value >= 0;) { *--lastpvar = 0xffffffff; }
/* This line caused \NSMAIL.READ.HEADING to smash memory, */
/* 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); */
register int num;
register LispPTR *ppvar;
register int i;
register LispPTR value;
for (; (((int)*--(stack_pointer)) >= 0);)
;
value = *stack_pointer;
num = (~value) >> 16;
ppvar = (LispPTR *)((DLword *)frame + FRAMESIZE + 2 + GetLoWord(value));
for (i = num; --i >= 0;) { *--ppvar = 0xffffffff; }
}
if (returner)
returner->fast = 0; /* since we've destroyed contiguity */
/* if (returner)
returner->fast = 0; since we've destroyed contiguity */
/* in the stack, but that only
matters if there's a return. */
}

View File

@@ -29,7 +29,6 @@
/***********************************************************/
#include <stdio.h>
#include <time.h>
#include "lispemul.h"
#include "address.h"
#include "adr68k.h"
@@ -780,20 +779,6 @@ void OP_subrcall(int subr_no, int argnum) {
break;
}
#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: {
char errtext[200];
sprintf(errtext, "OP_subrcall: Invalid alpha byte 0%o", ((*(PC + 1)) & 0xff));

View File

@@ -42,9 +42,11 @@
*/
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <string.h>
#include "lispemul.h"
#include "lispmap.h"
@@ -57,7 +59,9 @@
#include "debug.h"
#include "dbprint.h"
#include "tosfns.h"
#include "array.h"
#include "commondefs.h"
#include "testtooldefs.h"
#include "dbgtooldefs.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 index;
PACKAGE *package;
NEWSTRINGP *namestring;
DLword len2;
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));
namestring = (NEWSTRINGP *)Addr68k_from_LADDR(package->NAME);
pname = (char *)Addr68k_from_LADDR(namestring->base);
@@ -322,7 +327,7 @@ void trace_listpDTD(void) {
void a68k(LispPTR lispptr) {
DLword *val;
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);
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);
putchar('\n');
@@ -377,7 +382,7 @@ void dump_fnbody(LispPTR fnblockaddr)
for (i = 20; i < (fnobj->startpc); i += 2) {
int word;
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);
@@ -813,7 +818,7 @@ void doko(void) {
printf(" At ");
print_atomname(FuncObj->framename);
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) ***/
@@ -847,18 +852,6 @@ void printPC(void) {
printf("PC: O%o ", pc);
}
/***************************/
int countchar(char *string) {
int cnt = 0;
while (*string != '\0') {
string++;
cnt++;
}
return (cnt);
}
void dump_bf(Bframe *bf) {
DLword *ptr;
printf("\n*** Basic Frame");
@@ -881,7 +874,7 @@ void dump_bf(Bframe *bf) {
}
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('[');
if (BFRAMEPTR(bf)->residual) printf("Residual, ");
if (BFRAMEPTR(bf)->padding) printf("Padded, ");
@@ -1024,10 +1017,8 @@ FX *get_nextFX(FX *fx) {
} /* get_nextFX end */
int MAKEATOM(char *string) {
int length;
length = countchar(string);
return (make_atom(string, 0, length, 0));
LispPTR MAKEATOM(char *string) {
return (make_atom(string, 0, strlen(string), 0));
}
/************************************************************************/
@@ -1040,8 +1031,11 @@ int MAKEATOM(char *string) {
/************************************************************************/
LispPTR *MakeAtom68k(char *string) {
int index;
index = make_atom(string, 0, countchar(string), 0);
LispPTR index;
index = make_atom(string, 0, strlen(string), 0);
if (index == 0xffffffff) {
error("MakeAtom68k: no such atom found");
}
#ifdef BIGVM
index = (ATOMS_HI << 16) + (index * 10) + NEWATOM_VALUE_OFFSET;
#else
@@ -1070,44 +1064,6 @@ void GETTOPVAL(char *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)
*/

View File

@@ -45,7 +45,7 @@ unsigned long tick_count = 0; /* approx 18 ticks per sec */
#include <sys/time.h>
#endif /* DOS */
#ifdef USE_DLPI
#if defined(USE_DLPI)
#include <stropts.h>
extern int ether_fd;
#endif
@@ -546,7 +546,7 @@ static void int_io_init() {
perror("ioctl on X fd - SETSIG for input handling failed");
#endif
#ifdef USE_DLPI
#if defined(USE_DLPI)
DBPRINT(("INIT ETHER: Doing I_SETSIG.\n"));
if (ether_fd > 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";
#endif /* DOS */
#define ADD_RANGEP(address) \
if ((address < 0) || (POINTERMASK < address)) { \
printf("Address out of range.\n"); \
return (T); \
#define ADD_RANGEP(address) \
if (((address) < 0) || (POINTERMASK < (address))) { \
printf("Address out of range.\n"); \
return (T); \
}
#define URMAXCOMM 512
@@ -1083,7 +1083,7 @@ int device_after_raid() {
#ifdef MAIKO_ENABLE_ETHERNET
init_ether();
#ifdef USE_DLPI
#if defined(USE_DLPI)
if (ether_fd > 0)
if (ioctl(ether_fd, I_SETSIG, S_INPUT) != 0) {
perror("after-uraid: I_SETSIG for ether failed:\n");

View File

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

View File

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

View File

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

View File

@@ -213,14 +213,8 @@ void getXsignaldata(DspInterface dsp)
case Button3: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, FALSE); break;
case Button4: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFT, FALSE); break;
case Button5: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFTMIDDLE, FALSE); break;
#if 0
/* Button6 and Button7 are not defined, but these values are generated by
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
case Button5 + 1: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHT, FALSE); break;
case Button5 + 2: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHTMIDDLE, FALSE); break;
default: break;
}
DoRing();
@@ -233,11 +227,8 @@ void getXsignaldata(DspInterface dsp)
case Button3: PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, TRUE); break;
case Button4: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFT, TRUE); break;
case Button5: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_LEFTMIDDLE, TRUE); break;
#if 0
/* See above for key press */
case Button5 + 1: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHTMIDDLE, TRUE); break;
case Button5 + 2: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHT, TRUE); break;
#endif
case Button5 + 1: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHT, TRUE); break;
case Button5 + 2: PUTBASEBIT68K(EmRealUtilin68K, KEYSET_RIGHTMIDDLE, TRUE); break;
default: break;
}
DoRing();