From e94d0f1cff9da5406f0cee36f85dc2e6f842de92 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 09:06:13 -0800 Subject: [PATCH 01/18] Correct capitalization of macOS in README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ea4b4c9..f625df7 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Bug reports, feature requests, fixes and improvements, support for additional pl ## Development Platforms -We are developing on FreeBSD, Linux, MacOS, and Solaris currently +We are developing on FreeBSD, Linux, macOS, and Solaris currently on arm7l, arm64, PowerPC, SPARC, i386, and x86_64 hardware. @@ -33,14 +33,14 @@ $ 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 a (new M1) Mac will use `darwin.aarch64`. +* 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 +### Building For macOS -* Running on MacOS requires an X server, and building on a Mac requires X client libraries. -An X-server for MacOS (and X11 client libraries) can be freely obtained at https://www.xquartz.org/releases +* Running on macOS requires an X server, and building on a Mac requires X client libraries. +An X-server for macOS (and X11 client libraries) can be freely obtained at https://www.xquartz.org/releases ### Building for Windows 10 From 2b5a34ebe989e19150d3014603cd7b29c9886fef Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 09:41:28 -0800 Subject: [PATCH 02/18] Correct parameter declarations for N_OP_cons (int => LispPTR) --- inc/conspagedefs.h | 2 +- src/conspage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/conspagedefs.h b/inc/conspagedefs.h index 49b79f2..56dacbd 100644 --- a/inc/conspagedefs.h +++ b/inc/conspagedefs.h @@ -2,6 +2,6 @@ #define CONSPAGEDEFS_H 1 #include "lispemul.h" /* for LispPTR */ struct conspage *next_conspage(void); -LispPTR N_OP_cons(int cons_car, int cons_cdr); +LispPTR N_OP_cons(LispPTR cons_car, LispPTR cons_cdr); LispPTR cons(LispPTR cons_car, LispPTR cons_cdr); #endif diff --git a/src/conspage.c b/src/conspage.c index 561bcfb..d493d84 100644 --- a/src/conspage.c +++ b/src/conspage.c @@ -292,7 +292,7 @@ static ConsCell *find_free_cons_cell(void) { */ /**********************************************************************/ -LispPTR N_OP_cons(int cons_car, int cons_cdr) { +LispPTR N_OP_cons(LispPTR cons_car, LispPTR cons_cdr) { extern struct dtd *ListpDTD; struct conspage *new_conspage; From 55b45aa2aaccffd5ab6935b0d8eb613a98cea019 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 10:00:36 -0800 Subject: [PATCH 03/18] Replace grammatically incorrect comments in rplaca/rplacd --- src/car-cdr.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/car-cdr.c b/src/car-cdr.c index d0f791e..1033382 100644 --- a/src/car-cdr.c +++ b/src/car-cdr.c @@ -129,10 +129,14 @@ LispPTR cdr(LispPTR datum) Edited by : Naoyuki Mitani */ /**********************************************************************/ - +/** + * Replace car of x with y + * + * @param x [in,out] LispPTR to object in which car will be replaced. + * @param y [in] LispPTR to object that will become new car of x. + * @return x, modified, or NIL if x is not a list. + */ LispPTR rplaca(LispPTR x, LispPTR y) -/* car of x will be smashed */ -/* y is a newly car object */ { ConsCell *x_68k; ConsCell *temp; @@ -182,10 +186,15 @@ LispPTR rplaca(LispPTR x, LispPTR y) static ConsCell *find_cdrable_pair(LispPTR carpart, LispPTR cdrpart); /* below... */ static ConsCell *find_close_cell(struct conspage *page, LispPTR oldcell); #endif +/** + * Replace cdr of x with y + * + * @param x [in,out] LispPTR to object in which cdr will be replaced. + * @param y [in] LispPTR to object that will become new cdr of x. + * @return x, modified, or errors if x is not a list. + */ LispPTR rplacd(LispPTR x, LispPTR y) -/* cdr of x will be smashed */ -/* y is a newly cdr object */ { ConsCell *x_68k; ConsCell *temp68k; From b3d27cdeceb9d25f24e3a24810f19ded84767b24 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 10:15:44 -0800 Subject: [PATCH 04/18] Clean up formatting of table in NEWCDRCODING.md --- docs/NEWCDRCODING.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/NEWCDRCODING.md b/docs/NEWCDRCODING.md index 4fe5a07..6aa4870 100644 --- a/docs/NEWCDRCODING.md +++ b/docs/NEWCDRCODING.md @@ -6,9 +6,9 @@ It is treated as an on-page indicator bit and a 3-bit scaled offset. Certain combinations are treated specially. -on-page| offset | interpretation --------|--------|---------------------------------------------------------------------------- - 1 | 0 | CDR is NIL - 1 | 1 - 7 | CDR is at 2*offset (counted in 32-bit cells) on same page - 0 | 0 | CDR is indirect, CDR(car) - 0 | 1 - 7 | CDR is not a cons cell but is in the car of cell at 2*offset on same page +| on-page | offset | interpretation | +|---------|---------|---------------------------------------------------------------------------| +| 1 | 0 | CDR is NIL | +| 1 | 1 - 7 | CDR is at 2*offset (counted in 32-bit cells) on same page | +| 0 | 0 | CDR is indirect, CDR(car) | +| 0 | 1 - 7 | CDR is not a cons cell but is in the car of cell at 2*offset on same page | From 3e1130909cd3c5b8e2fcdedb4ee914e42b114966 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 10:23:47 -0800 Subject: [PATCH 05/18] Simplify awkward if-test expression --- src/vesainit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vesainit.c b/src/vesainit.c index c9572cf..3c24827 100644 --- a/src/vesainit.c +++ b/src/vesainit.c @@ -232,7 +232,7 @@ void VESA_enter(DspInterface dsp) TPRINT(("Enter VESA_enter\n")); VESA_setmode(dsp->graphicsmode, TRUE); - if (!((VESA_describemode(dsp->graphicsmode) == 0))) { + if (VESA_describemode(dsp->graphicsmode) != 0) { _setvideomode(_DEFAULTMODE); _clearscreen(_GCLEARSCREEN); fprintf(stderr, "Can't set VESA mode %o.\n", dsp->graphicsmode); From d4cccd7878588fcce66a14dc1bc1f0768d77e47b Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 10:24:59 -0800 Subject: [PATCH 06/18] Simplify awkward if-test expression --- src/return.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/return.c b/src/return.c index 0872753..0b8a23b 100644 --- a/src/return.c +++ b/src/return.c @@ -94,7 +94,7 @@ void contextsw(DLword fxnum, DLword bytenum, DLword flags) printf("contextsw : %d \n", fxnum); #endif - if (!(fxnum == SubovFXP)) { + if (fxnum != SubovFXP) { /* interrupt disable during executing [special] function invoked by contextsw(\KEYHANDLER,\RESETSTACK,FAULT) */ From 5bd9de5e367d926e538acb927b2c776784e90965 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 12:06:28 -0800 Subject: [PATCH 07/18] Suppress empty-statement warning for XLOCK/XUNLOCK macro when not doing locking --- inc/xdefs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/xdefs.h b/inc/xdefs.h index d87ae6e..a193692 100755 --- a/inc/xdefs.h +++ b/inc/xdefs.h @@ -49,8 +49,8 @@ extern volatile sig_atomic_t XNeedSignal; XLocked--; \ } while (0) #else -#define XLOCK -#define XUNLOCK(dsp) +#define XLOCK do {} while (0) +#define XUNLOCK(dsp) do {} while (0) #endif /* LOCK_X_UPDATES */ #endif /* XDEFS_H */ From 3745c08f513d6534c9f8ed8e9a70e8691f69b9eb Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 12:07:10 -0800 Subject: [PATCH 08/18] Remove unused include files from asmbbt.c --- src/asmbbt.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/asmbbt.c b/src/asmbbt.c index 4974a68..22a6cf6 100644 --- a/src/asmbbt.c +++ b/src/asmbbt.c @@ -23,20 +23,7 @@ #include "version.h" #include "lispemul.h" -#include "lspglob.h" -#include "lispmap.h" -#include "lsptypes.h" -#include "emlglob.h" -#include "adr68k.h" -#include "address.h" -#include "arith.h" -#include "stack.h" -#include "cell.h" -#include "gcdata.h" - #include "bb.h" -#include "bitblt.h" -#include "pilotbbt.h" void bitblt(DLword *srcbase, DLword *dstbase, int sx, int dx, int w, int h, int srcbpl, int dstbpl, int backwardflg, int src_comp, int op, int gray, int num_gray, int curr_gray_line) { From ac14ce0e40b57764a5cdd5ba8eeb562e0e7ac415 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 12:11:47 -0800 Subject: [PATCH 09/18] Collapse conditionals with identical consequents --- src/initkbd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/initkbd.c b/src/initkbd.c index d8af8b1..e250b78 100644 --- a/src/initkbd.c +++ b/src/initkbd.c @@ -453,9 +453,7 @@ void keyboardtype(int fd) type = KB_SUN2; else if (strcmp("jle", key) == 0) type = KB_JLE; - else if (strcmp("X", key) == 0) - type = KB_X; - else if (strcmp("x", key) == 0) + else if (strcmp("X", key) == 0 || strcmp("x", key) == 0) type = KB_X; else type = KB_SUN3; /* default */ From 7c81d1fa086eeaac66ce14c733011cbfc20ca79a Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 12:42:31 -0800 Subject: [PATCH 10/18] Remove duplicate include version.h in xrdopt.c --- src/xrdopt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/xrdopt.c b/src/xrdopt.c index 1539b4f..55a1c3b 100644 --- a/src/xrdopt.c +++ b/src/xrdopt.c @@ -9,7 +9,7 @@ /* */ /************************************************************************/ -#include "version.h" +#include "version.h" // for MAIKO_ENABLE_ETHERNET #include // for XPointer, True, XParseGeometry, XResource... #include // for XrmoptionSepArg, XrmGetResource, Xrmoptio... @@ -20,7 +20,6 @@ #include // for strncpy, strcat, strcpy, strcmp #include // for u_char #include // for access, R_OK -#include "version.h" // for MAIKO_ENABLE_ETHERNET #include "xdefs.h" // for WINDOW_NAME #include "xrdoptdefs.h" // for print_Xusage, read_Xoption From 8e40ae88117b2f441c34add5f155113ec5156f3e Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 12:43:14 -0800 Subject: [PATCH 11/18] Remove duplicate include version.h in xlspwin.c --- src/xlspwin.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/xlspwin.c b/src/xlspwin.c index e1ac015..04975a4 100644 --- a/src/xlspwin.c +++ b/src/xlspwin.c @@ -22,7 +22,6 @@ #include "devif.h" // for (anonymous), MRegion, OUTER_SB_WIDTH, Defin... #include "keyboard.h" // for RING, KBEVENT, KB_ALLUP, KEYEVENTSIZE, MAXK... #include "lispemul.h" // for DLword, ATOM_T, LispPTR, NIL, T -#include "version.h" #include "xbitmaps.h" // for LISP_CURSOR, default_cursor, horizscroll_cu... #include "xcursordefs.h" // for set_Xcursor, init_Xcursor #include "xdefs.h" // for XLOCK, XUNLOCK From d19aec2fbfa9c885cb73b470f174763ba87fca74 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 12:44:02 -0800 Subject: [PATCH 12/18] Remove duplicate include version.h in xbbt.c --- src/xbbt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/xbbt.c b/src/xbbt.c index c04f224..27026e8 100644 --- a/src/xbbt.c +++ b/src/xbbt.c @@ -13,7 +13,6 @@ #include // for XFlush, XPutImage #include "devif.h" // for (anonymous), MRegion, DspInterface #include "lispemul.h" // for DLword -#include "version.h" #include "xbbtdefs.h" // for clipping_Xbitblt #include "xdefs.h" // for XLOCK, XUNLOCK From 88cde175fc9a96b1c767196faa780b6583965a4f Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 21 Feb 2023 12:47:11 -0800 Subject: [PATCH 13/18] Remove duplicate include version.h (loopsops.c, subr.c, z2.c) --- src/loopsops.c | 2 +- src/subr.c | 1 - src/z2.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/loopsops.c b/src/loopsops.c index 6b7c765..3544905 100644 --- a/src/loopsops.c +++ b/src/loopsops.c @@ -31,7 +31,7 @@ #include "lspglob.h" #include "lsptypes.h" // for GetDTD, GetTypeNumber, dtd, Listp, GETWORD #include "stack.h" // for frameex1, fnhead, BF_MARK, FX_MARK, STK_SAFE -#include "version.h" // for UNSIGNED, BIGVM + struct LCIVCacheEntry; struct LCInstance; diff --git a/src/subr.c b/src/subr.c index 7c9ee9e..8a3b931 100644 --- a/src/subr.c +++ b/src/subr.c @@ -62,7 +62,6 @@ #include "unixcommdefs.h" // for Unix_handlecomm #include "uraidextdefs.h" // for Uraid_mess #include "uutilsdefs.h" // for suspend_lisp, check_unix_password, unix_fu... -#include "version.h" // for UNSIGNED #include "vmemsavedefs.h" // for lisp_finish, vmem_save0 extern LispPTR *PENDINGINTERRUPT68k; diff --git a/src/z2.c b/src/z2.c index d5b846f..c33ce64 100644 --- a/src/z2.c +++ b/src/z2.c @@ -32,7 +32,6 @@ #include "lspglob.h" #include "lsptypes.h" // for Listp, GetTypeNumber, TYPE_LISTP #include "vars3defs.h" // for cadr -#include "version.h" #include "z2defs.h" // for N_OP_classoc, N_OP_clfmemb, N_OP_restlist /* N_OP_classoc() OP 33Q */ From 92df6316dc864bfb7b5d0ca9da56a5723ccdea68 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Thu, 9 Mar 2023 18:48:35 -0800 Subject: [PATCH 14/18] Use do {} while (0) pattern for FPCLEAR when it is a no-op --- inc/medleyfp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/medleyfp.h b/inc/medleyfp.h index a6dc94b..fbfca2b 100644 --- a/inc/medleyfp.h +++ b/inc/medleyfp.h @@ -41,12 +41,12 @@ extern volatile sig_atomic_t FP_error; #elif defined(DOS) #include -#define FPCLEAR +#define FPCLEAR do {} while (0) #define FPTEST(result) (_getrealerror() & ( I87_ZERO_DIVIDE | I87_OVERFLOW | I87_UNDERFLOW)) #else #include -#define FPCLEAR +#define FPCLEAR do {} while (0) #define FPTEST(result) (!isfinite(result)) #endif /* FLTINT */ From f16b01167e102c1563b832b7b3bcc6f0e6a7e415 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 10 Mar 2023 15:20:08 -0800 Subject: [PATCH 15/18] Remove LHS casts in old color code. Add void return types where needed. Add includes. --- src/rawcolor.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/rawcolor.c b/src/rawcolor.c index 9e2659e..9019c6d 100644 --- a/src/rawcolor.c +++ b/src/rawcolor.c @@ -33,9 +33,14 @@ #include "arith.h" #include "bitblt.h" #include "lldsp.h" - #include "bbtsubdefs.h" +#include "gcarraydefs.h" +#include "testtooldefs.h" +#include "lsthandldefs.h" +#include "car-cdrdefs.h" +#include "keyeventdefs.h" + #define IMIN(x, y) (((x) > (y)) ? (y) : (x)) #define IMAX(x, y) (((x) > (y)) ? (x) : (y)) @@ -94,9 +99,9 @@ LispPTR SLOWBLTCHAR_index; #define FReplaceSmallp(place, val, puntcase) \ { \ if ((0 <= (val)) && ((val) <= MAX_SMALL)) \ - (LispPTR)(place) = (LispPTR)(S_POSITIVE | (val)); \ + (place) = (LispPTR)(S_POSITIVE | (val)); \ else if (MIN_SMALL <= val) \ - (LispPTR)(place) = (LispPTR)(S_NEGATIVE | (0xffff & (val))); \ + (place) = (LispPTR)(S_NEGATIVE | (0xffff & (val))); \ else { \ puntcase; \ } \ @@ -125,7 +130,7 @@ LispPTR COLORSCREEN_index; /* if it's 0xffffffff, not yet initialized */ /* */ /************************************************************************/ -C_slowbltchar(LispPTR *args) +void C_slowbltchar(LispPTR *args) { Stream *n_dstream; DISPLAYDATA *n_dd; @@ -210,8 +215,8 @@ C_slowbltchar(LispPTR *args) w = *(DLword *)NativeAligned2FromLAddr(n_dd->ddcharimagewidths + Char8Code(charcode)); h = src_h; - (short)dst_x = (short)curx; - (short)dst_y = (short)cury - (short)n_csinfo->CHARSETDESCENT; + dst_x = (short)curx; + dst_y = (short)cury - (short)n_csinfo->CHARSETDESCENT; { /* clipping */ short left, right, bottom, top; From 0bd29ae643cd23e43958a00c8ff9a63180296aa5 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 10 Mar 2023 15:23:25 -0800 Subject: [PATCH 16/18] Remove extraneous extern declarations. Convert some int to LispPTR as appropriate. --- src/conspage.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/conspage.c b/src/conspage.c index d493d84..c503085 100644 --- a/src/conspage.c +++ b/src/conspage.c @@ -114,12 +114,10 @@ static void init_conspage(struct conspage *base, unsigned int link) /**********************************************************************/ struct conspage *next_conspage(void) { - extern struct dtd *ListpDTD; - struct conspage *page1; /* Allocated 1st MDS page */ struct conspage *page2; /* Allocated 2nd MDS page */ struct conspage *pg, *priorpg; - int next, prior; + LispPTR next, prior; #ifdef NEWCDRCODING /* Allocate 2 conspages and get 1st page base */ @@ -293,14 +291,12 @@ static ConsCell *find_free_cons_cell(void) { /**********************************************************************/ LispPTR N_OP_cons(LispPTR cons_car, LispPTR cons_cdr) { - extern struct dtd *ListpDTD; - struct conspage *new_conspage; ConsCell *new_cell; #ifndef NEWCDRCODING ConsCell *temp_cell; #endif - int new_page; /* hold the return val of nextconspage ,DL->int */ + LispPTR new_page; /* hold the return val of nextconspage */ GCLOOKUP(cons_cdr &= POINTERMASK, ADDREF); GCLOOKUP(cons_car, ADDREF); @@ -430,7 +426,7 @@ LispPTR N_OP_cons(LispPTR cons_car, LispPTR cons_cdr) { #ifdef NEWCDRCODING if (254 < ((new_page & 0xff) + ((new_cell->cdr_code & 7) << 1))) error("in CONS, cdr code too big."); -#endif /* NEWCDROCDING */ +#endif /* NEWCDRCODING */ return (new_page); } /* N_OP_cons() end */ From 6b69e0105f1c0ace08fb51809890e5a9281cc606 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 10 Mar 2023 15:24:24 -0800 Subject: [PATCH 17/18] int => LispPTR for dtd_nextpage. --- inc/lsptypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/lsptypes.h b/inc/lsptypes.h index 60a0b4b..ff07eaa 100644 --- a/inc/lsptypes.h +++ b/inc/lsptypes.h @@ -403,7 +403,7 @@ struct dtd { LispPTR dtd_typespecs; LispPTR dtd_ptrs ; int dtd_oldcnt; - int dtd_nextpage ; + LispPTR dtd_nextpage ; DLword dtd_supertype ; DLword dtd_typeentry ; }; From 087c7a053a0b13eefda0f657c48fd72d794f79d7 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Thu, 20 Apr 2023 18:19:04 -0700 Subject: [PATCH 18/18] Compiling with -DDTDDEBUG requires including testtooldefs.h in gcrcell.c --- src/gcrcell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gcrcell.c b/src/gcrcell.c index 3b69ead..17040c7 100644 --- a/src/gcrcell.c +++ b/src/gcrcell.c @@ -76,6 +76,9 @@ #include "lispemul.h" // for LispPTR, ConsCell, NIL, POINTERMASK, DLword #include "lspglob.h" // for ListpDTD #include "lsptypes.h" // for dtd, GetDTD, GetTypeNumber, TYPE_ARRAYBLOCK +#ifdef DTDDEBUG +#include "testtooldefs.h" +#endif #ifdef NEWCDRCODING #undef CONSPAGE_LAST