From 2435eb4b4aacc97b21ef76cd18eca4ab8f6bc0a0 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 29 Sep 2015 21:31:32 -0400 Subject: [PATCH] Renumbered libraries again to fix symbolics w/units interaction. --- newrpl-ui.pro | 8 ++--- newrpl/{lib-58-matrix.c => lib-52-matrix.c} | 10 +++--- newrpl/{lib-60-units.c => lib-54-units.c} | 34 ++++++++++++++----- .../{lib-52-symbolic.c => lib-56-symbolic.c} | 12 +++---- newrpl/libraries.h | 6 ++-- newrpl/romlibs.c | 14 ++++---- 6 files changed, 50 insertions(+), 34 deletions(-) rename newrpl/{lib-58-matrix.c => lib-52-matrix.c} (99%) rename newrpl/{lib-60-units.c => lib-54-units.c} (98%) rename newrpl/{lib-52-symbolic.c => lib-56-symbolic.c} (99%) diff --git a/newrpl-ui.pro b/newrpl-ui.pro index 847b840..cb4807d 100644 --- a/newrpl-ui.pro +++ b/newrpl-ui.pro @@ -109,14 +109,14 @@ SOURCES += main.cpp\ newrpl/dectranscen.c \ newrpl/backup.c \ newrpl/sanity.c \ - newrpl/lib-52-symbolic.c \ newrpl/lib-32-lam.c \ - newrpl/lib-58-matrix.c \ newrpl/lib-65-system.c \ firmware/hal_msgenglish.c \ newrpl/units.c \ - newrpl/lib-60-units.c \ - newrpl/lib-62-lists.c + newrpl/lib-62-lists.c \ + newrpl/lib-56-symbolic.c \ + newrpl/lib-52-matrix.c \ + newrpl/lib-54-units.c HEADERS += mainwindow.h \ qemuscreen.h \ diff --git a/newrpl/lib-58-matrix.c b/newrpl/lib-52-matrix.c similarity index 99% rename from newrpl/lib-58-matrix.c rename to newrpl/lib-52-matrix.c index d5821af..df0ff71 100644 --- a/newrpl/lib-58-matrix.c +++ b/newrpl/lib-52-matrix.c @@ -14,11 +14,11 @@ // ALL OTHER FUNCTIONS ARE LOCAL // MAIN LIBRARY NUMBER, CHANGE THIS FOR EACH LIBRARY -#define LIBRARY_NUMBER 58 -#define LIB_ENUM lib58_enum -#define LIB_NAMES lib58_names -#define LIB_HANDLER lib58_handler -#define LIB_NUMBEROFCMDS LIB58_NUMBEROFCMDS +#define LIBRARY_NUMBER 52 +#define LIB_ENUM lib52_enum +#define LIB_NAMES lib52_names +#define LIB_HANDLER lib52_handler +#define LIB_NUMBEROFCMDS LIB52_NUMBEROFCMDS // LIST OF LIBRARY NUMBERS WHERE THIS LIBRARY REGISTERS TO // HAS TO BE A HALFWORD LIST TERMINATED IN ZERO diff --git a/newrpl/lib-60-units.c b/newrpl/lib-54-units.c similarity index 98% rename from newrpl/lib-60-units.c rename to newrpl/lib-54-units.c index 3a2f99a..4b29023 100644 --- a/newrpl/lib-60-units.c +++ b/newrpl/lib-54-units.c @@ -17,13 +17,13 @@ // ALL OTHER FUNCTIONS ARE LOCAL // MAIN LIBRARY NUMBER, CHANGE THIS FOR EACH LIBRARY -#define LIBRARY_NUMBER 60 -#define LIB_ENUM lib60enum -#define LIB_NAMES lib60_names -#define LIB_HANDLER lib60_handler -#define LIB_TOKENINFO lib60_tokeninfo -#define LIB_NUMBEROFCMDS LIB60_NUMBEROFCMDS -#define ROMPTR_TABLE romptr_table60 +#define LIBRARY_NUMBER 54 +#define LIB_ENUM lib54enum +#define LIB_NAMES lib54_names +#define LIB_HANDLER lib54_handler +#define LIB_TOKENINFO lib54_tokeninfo +#define LIB_NUMBEROFCMDS LIB54_NUMBEROFCMDS +#define ROMPTR_TABLE romptr_table54 // LIST OF LIBRARY NUMBERS WHERE THIS LIBRARY REGISTERS TO // HAS TO BE A HALFWORD LIST TERMINATED IN ZERO @@ -1338,6 +1338,17 @@ void LIB_HANDLER() } // THERE IS A '_', NOW SPLIT THE TOKEN AND START A PROLOG OF A UNIT + + if( (*(ptr-1)==']') || (*(ptr-1)=='}') ) { + // LET THE MATRIX OR LIST FINISH COMPILING, THEN DO + // A UNIT-APPLY OPERATOR INSTEAD OF COMPILING A UNIT OBJECT + + BlankStart=NextTokenStart=(WORDPTR)utf8nskip((char * )TokenStart,(char *)BlankStart,f); + RetNum=ERR_NOTMINE_SPLITTOKEN; + return; + + } + rplCompileAppend(MKPROLOG(LIBRARY_NUMBER,0)); BlankStart=NextTokenStart=(WORDPTR)utf8nskip((char * )TokenStart,(char *)BlankStart,f); @@ -1392,7 +1403,9 @@ void LIB_HANDLER() rplDecompAppendChar('_'); // NO NEED TO USE BRACKETS UNLESS IT'S A SYMBOLIC - if(!DecompMode) closebracket=0; + if(DecompMode) rplDecompAppendChar('['); + else closebracket=0; + } @@ -1595,7 +1608,10 @@ void LIB_HANDLER() } case OPCODE_GETINFO: - if(ISPROLOG(*DecompileObject)) RetNum=OK_TOKENINFO | MKTOKENINFO(0,TITYPE_NUMBER,0,1); + if(ISPROLOG(*DecompileObject)) { + RetNum=OK_TOKENINFO | MKTOKENINFO(0,TITYPE_NUMBER,0,1); + return; + } libGetInfo2(*DecompileObject,(char **)LIB_NAMES,(BINT *)LIB_TOKENINFO,LIB_NUMBEROFCMDS); return; diff --git a/newrpl/lib-52-symbolic.c b/newrpl/lib-56-symbolic.c similarity index 99% rename from newrpl/lib-52-symbolic.c rename to newrpl/lib-56-symbolic.c index e8cd2d6..c561463 100644 --- a/newrpl/lib-52-symbolic.c +++ b/newrpl/lib-56-symbolic.c @@ -17,12 +17,12 @@ // ALL OTHER FUNCTIONS ARE LOCAL // MAIN LIBRARY NUMBER, CHANGE THIS FOR EACH LIBRARY -#define LIBRARY_NUMBER 52 -#define LIB_ENUM lib52enum -#define LIB_NAMES lib52_names -#define LIB_HANDLER lib52_handler -#define LIB_NUMBEROFCMDS LIB52_NUMBEROFCMDS -#define ROMPTR_TABLE romptr_table52 +#define LIBRARY_NUMBER 56 +#define LIB_ENUM lib56enum +#define LIB_NAMES lib56_names +#define LIB_HANDLER lib56_handler +#define LIB_NUMBEROFCMDS LIB56_NUMBEROFCMDS +#define ROMPTR_TABLE romptr_table56 // LIST OF LIBRARY NUMBERS WHERE THIS LIBRARY REGISTERS TO // HAS TO BE A HALFWORD LIST TERMINATED IN ZERO diff --git a/newrpl/libraries.h b/newrpl/libraries.h index db9303c..49b19d8 100644 --- a/newrpl/libraries.h +++ b/newrpl/libraries.h @@ -169,13 +169,13 @@ extern void libGetPTRFromID(WORDPTR *table,WORD id); // RESERVE (DOIDENT|8) FOR FUTURE FLAG USE IN SYMBOLICS #define DOMAXIDENT 47 // JUST A CONVENIENCE MACRO - MAXIMUM LIB NUMBER TAKEN BY IDENTS -#define DOUNIT 60 // UNIT OBJECT +#define DOUNIT 54 // UNIT OBJECT #define DOLIST 62 -#define DOSYMB 52 // SYMBOLIC OBJECT +#define DOSYMB 56 // SYMBOLIC OBJECT -#define DOMATRIX 58 // ARRAY OBJECT +#define DOMATRIX 52 // ARRAY OBJECT diff --git a/newrpl/romlibs.c b/newrpl/romlibs.c index a516fa8..7e0f3d7 100644 --- a/newrpl/romlibs.c +++ b/newrpl/romlibs.c @@ -27,9 +27,9 @@ extern void lib32_handler(); extern void lib52_handler(); -extern void lib58_handler(); +extern void lib54_handler(); -extern void lib60_handler(); +extern void lib56_handler(); extern void lib62_handler(); extern void lib64_handler(); @@ -100,14 +100,14 @@ const LIBHANDLER const ROMLibs[]={ // LIB 32 THRU 47 ARE IDENTS lib32_handler, - // SYMBOLICS + // MATRIX lib52_handler, - // MATRIX - lib58_handler, - // UNITS - lib60_handler, + lib54_handler, + + // SYMBOLIC + lib56_handler, // LISTS lib62_handler,