From 5fa05ac3d76e0bf0cb7e39e4180ae29ff26670ce Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Wed, 20 Jul 2022 10:45:37 -0700 Subject: [PATCH] Cleanup types in URaid and move declarations to separate include file (#428) --- bin/makefile-tail | 10 +++++----- inc/uraidextdefs.h | 23 +++++++++++++++++++++++ src/common.c | 15 +++------------ src/dbgtool.c | 8 +------- src/subr.c | 3 +-- src/testtool.c | 6 +----- src/uraid.c | 35 ++++++++++++++++------------------- 7 files changed, 50 insertions(+), 50 deletions(-) create mode 100644 inc/uraidextdefs.h diff --git a/bin/makefile-tail b/bin/makefile-tail index 9e552b3..90ef5ed 100644 --- a/bin/makefile-tail +++ b/bin/makefile-tail @@ -212,7 +212,7 @@ $(OBJECTDIR)dbgtool.o: $(SRCDIR)dbgtool.c $(REQUIRED-INCS) \ $(INCDIR)adr68k.h $(INCDIR)lsptypes.h $(INCDIR)lspglob.h $(INCDIR)ifpage.h \ $(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)emlglob.h $(INCDIR)cell.h \ $(INCDIR)stack.h $(INCDIR)dbgtooldefs.h $(INCDIR)kprintdefs.h \ - $(INCDIR)testtooldefs.h + $(INCDIR)testtooldefs.h $(INCDIR)uraidextdefs.h $(CC) $(RFLAGS) $(SRCDIR)dbgtool.c -o $(OBJECTDIR)dbgtool.o $(OBJECTDIR)dlpi.o: $(SRCDIR)dlpi.c \ @@ -233,7 +233,7 @@ $(OBJECTDIR)testtool.o: $(SRCDIR)testtool.c $(REQUIRED-INCS) \ $(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)emlglob.h $(INCDIR)cell.h \ $(INCDIR)debug.h $(INCDIR)dbprint.h $(INCDIR)tosfns.h $(INCDIR)testtooldefs.h \ $(INCDIR)stack.h $(INCDIR)dbgtooldefs.h $(INCDIR)gcarraydefs.h \ - $(INCDIR)kprintdefs.h $(INCDIR)mkatomdefs.h + $(INCDIR)kprintdefs.h $(INCDIR)mkatomdefs.h $(INCDIR)uraidextdefs.h $(CC) $(RFLAGS) $(SRCDIR)testtool.c -o $(OBJECTDIR)testtool.o $(OBJECTDIR)allocmds.o: $(SRCDIR)allocmds.c $(REQUIRED-INCS) \ @@ -382,7 +382,7 @@ $(OBJECTDIR)common.o: $(SRCDIR)common.c $(REQUIRED-INCS) \ $(INCDIR)lispemul.h $(INCDIR)lispmap.h \ $(INCDIR)adr68k.h $(INCDIR)lspglob.h $(INCDIR)ifpage.h $(INCDIR)iopage.h \ $(INCDIR)miscstat.h $(INCDIR)emlglob.h $(INCDIR)stack.h $(INCDIR)dbprint.h \ - $(INCDIR)commondefs.h $(INCDIR)kprintdefs.h $(INCDIR)uraiddefs.h + $(INCDIR)commondefs.h $(INCDIR)kprintdefs.h $(INCDIR)uraiddefs.h $(INCDIR)uraidextdefs.h $(CC) $(RFLAGS) $(SRCDIR)common.c -o $(OBJECTDIR)common.o $(OBJECTDIR)conspage.o: $(SRCDIR)conspage.c $(REQUIRED-INCS) \ @@ -807,7 +807,7 @@ $(OBJECTDIR)subr.o: $(SRCDIR)subr.c $(REQUIRED-INCS) \ $(INCDIR)gcrdefs.h $(INCDIR)inetdefs.h $(INCDIR)kbdsubrsdefs.h \ $(INCDIR)mkcelldefs.h $(INCDIR)osmsgdefs.h $(INCDIR)rpcdefs.h \ $(INCDIR)storagedefs.h $(INCDIR)timerdefs.h $(INCDIR)ufsdefs.h \ - $(INCDIR)unixcommdefs.h $(INCDIR)uutilsdefs.h $(INCDIR)vmemsavedefs.h + $(INCDIR)unixcommdefs.h $(INCDIR)uraidextdefs.h $(INCDIR)uutilsdefs.h $(INCDIR)vmemsavedefs.h $(CC) $(RFLAGS) $(SRCDIR)subr.c -o $(OBJECTDIR)subr.o $(OBJECTDIR)miscn.o: $(SRCDIR)miscn.c $(REQUIRED-INCS) \ @@ -880,7 +880,7 @@ $(OBJECTDIR)uraid.o: $(SRCDIR)uraid.c $(REQUIRED-INCS) \ $(INCDIR)gcarraydefs.h $(INCDIR)initdspdefs.h $(INCDIR)initkbddefs.h \ $(INCDIR)kprintdefs.h $(INCDIR)llstkdefs.h $(INCDIR)mkatomdefs.h \ $(INCDIR)returndefs.h $(INCDIR)testtooldefs.h $(INCDIR)timerdefs.h \ - $(INCDIR)vmemsavedefs.h $(INCDIR)devif.h + $(INCDIR)uraidextdefs.h $(INCDIR)vmemsavedefs.h $(INCDIR)devif.h $(CC) $(RFLAGS) $(SRCDIR)uraid.c -o $(OBJECTDIR)uraid.o $(OBJECTDIR)rpc.o: $(SRCDIR)rpc.c $(REQUIRED-INCS) \ diff --git a/inc/uraidextdefs.h b/inc/uraidextdefs.h new file mode 100644 index 0000000..82df2d0 --- /dev/null +++ b/inc/uraidextdefs.h @@ -0,0 +1,23 @@ +#ifndef URAIDEXTDEFS_H +#define URAIDEXTDEFS_H 1 + +#include "stack.h" /* for FX */ +#include "lispemul.h" /* for LispPTR */ + +#define URMAXFXNUM 2000 +#define URMAXCOMM 512 +#define URSCAN_ALINK 0 +#define URSCAN_CLINK 1 + +extern FX *URaid_FXarray[URMAXFXNUM]; +extern char URaid_arg1[URMAXCOMM / 2]; +extern char URaid_arg2[URMAXCOMM / 2]; +extern char URaid_comm; +extern char URaid_inputstring[URMAXCOMM]; +extern const char *URaid_errmess; +extern int URaid_ArrMAXIndex; +extern int URaid_argnum; +extern int URaid_currentFX; +extern int URaid_scanlink; +extern LispPTR Uraid_mess; +#endif diff --git a/src/common.c b/src/common.c index 94d85be..0aea648 100644 --- a/src/common.c +++ b/src/common.c @@ -28,6 +28,7 @@ #include "commondefs.h" #include "kprintdefs.h" #include "uraiddefs.h" +#include "uraidextdefs.h" void stab() { DBPRINT(("Now in stab\n")); } @@ -40,7 +41,6 @@ error And exit.(takeshi) ******************************************************************/ -#define URMAXFXNUM 100 extern fd_set LispReadFds; extern int LispWindowFd, LispKbdFd; @@ -48,20 +48,10 @@ extern struct screen LispScreen; extern int displaywidth, displayheight; extern DLword *DisplayRegion68k; extern int FrameBufferFd; -extern char URaid_inputstring[]; -extern char URaid_comm; -extern char URaid_arg1[256]; -extern char URaid_arg2[10]; -extern int URaid_argnum; -extern const char *URaid_errmess; -extern int URaid_currentFX; -extern FX *URaid_FXarray[]; extern jmp_buf BT_jumpbuf; extern jmp_buf SD_jumpbuf; extern int BT_temp; /* holds the continue-character the user typed */ -LispPTR Uraid_mess = NIL; - /* Currentry Don't care Ether re-initial */ /* Medley only */ @@ -73,7 +63,8 @@ LispPTR Uraid_mess = NIL; /* */ /************************************************************************/ -#define URMAXCOMM 512 +LispPTR Uraid_mess = NIL; + int error(const char *cp) { char *ptr; if (device_before_raid() < 0) { diff --git a/src/dbgtool.c b/src/dbgtool.c index 1cbb691..6e2f9fa 100644 --- a/src/dbgtool.c +++ b/src/dbgtool.c @@ -39,6 +39,7 @@ #include "dbgtooldefs.h" #include "kprintdefs.h" #include "testtooldefs.h" +#include "uraidextdefs.h" #define LOCAL_PVAR 0xFFFF #ifdef BIGATOMS @@ -57,13 +58,6 @@ #define NAMETABLE DLword #endif -#define URMAXFXNUM 2000 -#define URSCAN_ALINK 0 -#define URSCAN_CLINK 1 -extern int URaid_scanlink; -extern int URaid_currentFX; -extern FX *URaid_FXarray[]; -extern int URaid_ArrMAXIndex; int BT_lines; int BT_temp; jmp_buf BT_jumpbuf; diff --git a/src/subr.c b/src/subr.c index 7204e7b..adad834 100644 --- a/src/subr.c +++ b/src/subr.c @@ -62,6 +62,7 @@ #include "ufsdefs.h" #include "unixcommdefs.h" #include "uutilsdefs.h" +#include "uraidextdefs.h" #include "vmemsavedefs.h" #ifdef MAIKO_ENABLE_FOREIGN_FUNCTION_INTERFACE #include "foreigndefs.h" @@ -79,8 +80,6 @@ extern LispPTR *PENDINGINTERRUPT68k; */ /***********************************************************/ -extern LispPTR Uraid_mess; - LispPTR subr_lisperror(); /* 0377 */ char *atom_to_str(LispPTR atom_index) { diff --git a/src/testtool.c b/src/testtool.c index 7c0450f..6e98366 100644 --- a/src/testtool.c +++ b/src/testtool.c @@ -67,14 +67,10 @@ #include "gcarraydefs.h" #include "kprintdefs.h" #include "mkatomdefs.h" +#include "uraidextdefs.h" -#define URMAXFXNUM 100 #define URSCAN_ALINK 0 #define URSCAN_CLINK 1 -extern int URaid_scanlink; -extern int URaid_currentFX; -extern FX *URaid_FXarray[]; -extern int URaid_ArrMAXIndex; /************************************************************************/ /* */ diff --git a/src/uraid.c b/src/uraid.c index 65b8364..d33cb8d 100644 --- a/src/uraid.c +++ b/src/uraid.c @@ -61,6 +61,7 @@ #include "bitblt.h" #include "uraiddefs.h" +#include "uraidextdefs.h" #include "dbgtooldefs.h" #include "gcarraydefs.h" #include "initdspdefs.h" @@ -156,7 +157,7 @@ extern int Inited_Color; #endif /* COLOR */ #ifdef DOS -char *URaid_summary1 = +static const char *URaid_summary1 = "\n-- Stack display commands\n\ c\t\t\tChecks all user stack contents\n\ f number\t\tDisplays stack frame for that frame number (decimal)\n\ @@ -164,7 +165,7 @@ k type\t\t\tChanges the type of stack link following. (a|c)\n\ l [type]\t\tBack Trace for specified type stack. (k|m|r|g|p|u|)\n\ \t\t\tDisplay next frame.\n"; -char *URaid_summary2 = +static const char *URaid_summary2 = "\n-- Memory display commands\n\ a litatom\t\tDisplays the top-level value of the litatom\n\ B Xaddress\t\tPrint the contents of the arrayblock at that address.\n\ @@ -179,7 +180,7 @@ x Xaddress [xnum]\tHex-Dump xnum (16-bit) words starting at Xaddress\n\ @ litatom val\t\tSets TOPVAL of litatom to Decimal-val\n\ < Xaddress Xval\t\tSets the (16-bit) word at the address to Xval\n"; -char *URaid_summary3 = +static const char *URaid_summary3 = "\n-- Continue or exit commands\n\ e\t\t\tExit to DOS\n\ h\t\t\tDo a HARDRESET\n\ @@ -190,7 +191,7 @@ v filename\t\tSave the virtual memory on the filename(Not Bootable)\n\ !\t\t\tPrints the error message passed from the emulator\n\ ?\t\t\tDisplay this summary"; #else -char *URaid_summary = +static const char *URaid_summary = "---URAID command summary---\n\ \n-- Stack display commands\n\ c\t\t\tChecks all user stack contents\n\ @@ -229,11 +230,6 @@ v filename\t\tSaves the virtual memory on the filename (Not Bootable)\n\ return (T); \ } -#define URMAXCOMM 512 -#define URMAXFXNUM 2000 -#define URSCAN_ALINK 0 -#define URSCAN_CLINK 1 - /*** URaid G vals ***/ int URaid_scanlink = URSCAN_ALINK; int URaid_currentFX = URMAXFXNUM + 1; @@ -265,9 +261,9 @@ extern int PrintMaxLevel; /* for print level */ LispPTR parse_atomstring(char *string) { char *start, *packageptr, *nameptr; - int packagelen = 0; - int namelen = 0; - int cnt; + DLword packagelen = 0; + DLword namelen = 0; + DLword cnt; LispPTR aindex; for (cnt = 0, start = string; *string != '\0'; string++, cnt++) { @@ -349,7 +345,8 @@ unsigned int uGetTN(unsigned int address) { /***********************************************************************/ LispPTR uraid_commands() { - int num, address, val; + int num, val; + LispPTR address; char *endpointer; LispPTR index; DefCell *defcell68k; @@ -386,7 +383,7 @@ LispPTR uraid_commands() { return (T); } errno = 0; - num = strtoul(URaid_arg1, &endpointer, 10); + num = (int)strtoul(URaid_arg1, &endpointer, 10); if (errno != 0 || *endpointer != '\0') { /* com read fails */ printf("Illegal argument, not decimal number\n"); return (T); @@ -510,13 +507,13 @@ LispPTR uraid_commands() { break; case 'O': { /* print instance from Laddr. Not documented */ - int objaddr; + LispPTR objaddr; if (URaid_argnum == 1) { printf("PRINT-INSTANCE: O HEX-LispAddress\n"); return (T); } errno = 0; - objaddr = strtoul(URaid_arg1, &endpointer, 16); + objaddr = (LispPTR)strtoul(URaid_arg1, &endpointer, 16); if (errno != 0 || *endpointer != '\0') { printf("Arg not HEX number\n"); return (T); @@ -531,7 +528,7 @@ LispPTR uraid_commands() { /**HEXNUMP(URaid_arg1,"Not Address");**/ errno = 0; - address = strtoul(URaid_arg1, &endpointer, 16); + address = (LispPTR)strtoul(URaid_arg1, &endpointer, 16); if (errno != 0 || *endpointer != '\0') { printf("Arg not HEX number\n"); return (T); @@ -618,7 +615,7 @@ LispPTR uraid_commands() { return (T); } errno = 0; - address = strtoul(URaid_arg1, &endpointer, 16); + address = (LispPTR)strtoul(URaid_arg1, &endpointer, 16); if (errno != 0 || *endpointer != '\0') { printf("Arg(Xaddress) not Xaddress\n"); return (T); @@ -706,7 +703,7 @@ LispPTR uraid_commands() { ***/ errno = 0; - address = strtol(URaid_arg1, &endpointer, 16); + address = (LispPTR)strtol(URaid_arg1, &endpointer, 16); if (errno != 0 || *endpointer != '\0') { printf("Arg(Xaddress) not Xaddress\n"); return (T);