From 62c6d5c2a45ea05d4cf13f69933ffe98d4d9cf84 Mon Sep 17 00:00:00 2001 From: David Brown Date: Thu, 1 Dec 2016 18:40:01 +0000 Subject: [PATCH] Update C bootstrap source. --- bootstrap/SYSTEM.h | 4 +- bootstrap/unix-44/Compiler.c | 2 +- bootstrap/unix-44/Configuration.c | 4 +- bootstrap/unix-44/Configuration.h | 2 +- bootstrap/unix-44/Files.c | 8 +-- bootstrap/unix-44/Files.h | 2 +- bootstrap/unix-44/Heap.c | 8 +-- bootstrap/unix-44/Heap.h | 2 +- bootstrap/unix-44/Modules.c | 83 +++++++++++++++++++++++- bootstrap/unix-44/Modules.h | 9 ++- bootstrap/unix-44/OPB.c | 20 ++---- bootstrap/unix-44/OPB.h | 2 +- bootstrap/unix-44/OPC.c | 2 +- bootstrap/unix-44/OPC.h | 2 +- bootstrap/unix-44/OPM.c | 22 ++++--- bootstrap/unix-44/OPM.h | 2 +- bootstrap/unix-44/OPP.c | 10 +-- bootstrap/unix-44/OPP.h | 2 +- bootstrap/unix-44/OPS.c | 2 +- bootstrap/unix-44/OPS.h | 2 +- bootstrap/unix-44/OPT.c | 8 +-- bootstrap/unix-44/OPT.h | 2 +- bootstrap/unix-44/OPV.c | 14 +++- bootstrap/unix-44/OPV.h | 2 +- bootstrap/unix-44/Out.c | 2 +- bootstrap/unix-44/Out.h | 2 +- bootstrap/unix-44/Platform.c | 95 ++-------------------------- bootstrap/unix-44/Platform.h | 9 +-- bootstrap/unix-44/Reals.c | 2 +- bootstrap/unix-44/Reals.h | 2 +- bootstrap/unix-44/Strings.c | 2 +- bootstrap/unix-44/Strings.h | 2 +- bootstrap/unix-44/Texts.c | 6 +- bootstrap/unix-44/Texts.h | 2 +- bootstrap/unix-44/VT100.c | 2 +- bootstrap/unix-44/VT100.h | 2 +- bootstrap/unix-44/extTools.c | 2 +- bootstrap/unix-44/extTools.h | 2 +- bootstrap/unix-48/Compiler.c | 2 +- bootstrap/unix-48/Configuration.c | 4 +- bootstrap/unix-48/Configuration.h | 2 +- bootstrap/unix-48/Files.c | 8 +-- bootstrap/unix-48/Files.h | 2 +- bootstrap/unix-48/Heap.c | 8 +-- bootstrap/unix-48/Heap.h | 2 +- bootstrap/unix-48/Modules.c | 83 +++++++++++++++++++++++- bootstrap/unix-48/Modules.h | 9 ++- bootstrap/unix-48/OPB.c | 20 ++---- bootstrap/unix-48/OPB.h | 2 +- bootstrap/unix-48/OPC.c | 2 +- bootstrap/unix-48/OPC.h | 2 +- bootstrap/unix-48/OPM.c | 22 ++++--- bootstrap/unix-48/OPM.h | 2 +- bootstrap/unix-48/OPP.c | 10 +-- bootstrap/unix-48/OPP.h | 2 +- bootstrap/unix-48/OPS.c | 2 +- bootstrap/unix-48/OPS.h | 2 +- bootstrap/unix-48/OPT.c | 8 +-- bootstrap/unix-48/OPT.h | 2 +- bootstrap/unix-48/OPV.c | 14 +++- bootstrap/unix-48/OPV.h | 2 +- bootstrap/unix-48/Out.c | 2 +- bootstrap/unix-48/Out.h | 2 +- bootstrap/unix-48/Platform.c | 95 ++-------------------------- bootstrap/unix-48/Platform.h | 9 +-- bootstrap/unix-48/Reals.c | 2 +- bootstrap/unix-48/Reals.h | 2 +- bootstrap/unix-48/Strings.c | 2 +- bootstrap/unix-48/Strings.h | 2 +- bootstrap/unix-48/Texts.c | 6 +- bootstrap/unix-48/Texts.h | 2 +- bootstrap/unix-48/VT100.c | 2 +- bootstrap/unix-48/VT100.h | 2 +- bootstrap/unix-48/extTools.c | 2 +- bootstrap/unix-48/extTools.h | 2 +- bootstrap/unix-88/Compiler.c | 2 +- bootstrap/unix-88/Configuration.c | 4 +- bootstrap/unix-88/Configuration.h | 2 +- bootstrap/unix-88/Files.c | 8 +-- bootstrap/unix-88/Files.h | 2 +- bootstrap/unix-88/Heap.c | 8 +-- bootstrap/unix-88/Heap.h | 2 +- bootstrap/unix-88/Modules.c | 83 +++++++++++++++++++++++- bootstrap/unix-88/Modules.h | 9 ++- bootstrap/unix-88/OPB.c | 20 ++---- bootstrap/unix-88/OPB.h | 2 +- bootstrap/unix-88/OPC.c | 2 +- bootstrap/unix-88/OPC.h | 2 +- bootstrap/unix-88/OPM.c | 22 ++++--- bootstrap/unix-88/OPM.h | 2 +- bootstrap/unix-88/OPP.c | 10 +-- bootstrap/unix-88/OPP.h | 2 +- bootstrap/unix-88/OPS.c | 2 +- bootstrap/unix-88/OPS.h | 2 +- bootstrap/unix-88/OPT.c | 8 +-- bootstrap/unix-88/OPT.h | 2 +- bootstrap/unix-88/OPV.c | 14 +++- bootstrap/unix-88/OPV.h | 2 +- bootstrap/unix-88/Out.c | 2 +- bootstrap/unix-88/Out.h | 2 +- bootstrap/unix-88/Platform.c | 95 ++-------------------------- bootstrap/unix-88/Platform.h | 9 +-- bootstrap/unix-88/Reals.c | 2 +- bootstrap/unix-88/Reals.h | 2 +- bootstrap/unix-88/Strings.c | 2 +- bootstrap/unix-88/Strings.h | 2 +- bootstrap/unix-88/Texts.c | 6 +- bootstrap/unix-88/Texts.h | 2 +- bootstrap/unix-88/VT100.c | 2 +- bootstrap/unix-88/VT100.h | 2 +- bootstrap/unix-88/extTools.c | 2 +- bootstrap/unix-88/extTools.h | 2 +- bootstrap/windows-48/Compiler.c | 2 +- bootstrap/windows-48/Configuration.c | 4 +- bootstrap/windows-48/Configuration.h | 2 +- bootstrap/windows-48/Files.c | 8 +-- bootstrap/windows-48/Files.h | 2 +- bootstrap/windows-48/Heap.c | 8 +-- bootstrap/windows-48/Heap.h | 2 +- bootstrap/windows-48/Modules.c | 85 ++++++++++++++++++++++++- bootstrap/windows-48/Modules.h | 9 ++- bootstrap/windows-48/OPB.c | 20 ++---- bootstrap/windows-48/OPB.h | 2 +- bootstrap/windows-48/OPC.c | 2 +- bootstrap/windows-48/OPC.h | 2 +- bootstrap/windows-48/OPM.c | 22 ++++--- bootstrap/windows-48/OPM.h | 2 +- bootstrap/windows-48/OPP.c | 10 +-- bootstrap/windows-48/OPP.h | 2 +- bootstrap/windows-48/OPS.c | 2 +- bootstrap/windows-48/OPS.h | 2 +- bootstrap/windows-48/OPT.c | 8 +-- bootstrap/windows-48/OPT.h | 2 +- bootstrap/windows-48/OPV.c | 14 +++- bootstrap/windows-48/OPV.h | 2 +- bootstrap/windows-48/Out.c | 2 +- bootstrap/windows-48/Out.h | 2 +- bootstrap/windows-48/Platform.c | 92 +-------------------------- bootstrap/windows-48/Platform.h | 10 +-- bootstrap/windows-48/Reals.c | 2 +- bootstrap/windows-48/Reals.h | 2 +- bootstrap/windows-48/Strings.c | 2 +- bootstrap/windows-48/Strings.h | 2 +- bootstrap/windows-48/Texts.c | 6 +- bootstrap/windows-48/Texts.h | 2 +- bootstrap/windows-48/VT100.c | 2 +- bootstrap/windows-48/VT100.h | 2 +- bootstrap/windows-48/extTools.c | 2 +- bootstrap/windows-48/extTools.h | 2 +- bootstrap/windows-88/Compiler.c | 2 +- bootstrap/windows-88/Configuration.c | 4 +- bootstrap/windows-88/Configuration.h | 2 +- bootstrap/windows-88/Files.c | 8 +-- bootstrap/windows-88/Files.h | 2 +- bootstrap/windows-88/Heap.c | 8 +-- bootstrap/windows-88/Heap.h | 2 +- bootstrap/windows-88/Modules.c | 85 ++++++++++++++++++++++++- bootstrap/windows-88/Modules.h | 9 ++- bootstrap/windows-88/OPB.c | 20 ++---- bootstrap/windows-88/OPB.h | 2 +- bootstrap/windows-88/OPC.c | 2 +- bootstrap/windows-88/OPC.h | 2 +- bootstrap/windows-88/OPM.c | 22 ++++--- bootstrap/windows-88/OPM.h | 2 +- bootstrap/windows-88/OPP.c | 10 +-- bootstrap/windows-88/OPP.h | 2 +- bootstrap/windows-88/OPS.c | 2 +- bootstrap/windows-88/OPS.h | 2 +- bootstrap/windows-88/OPT.c | 8 +-- bootstrap/windows-88/OPT.h | 2 +- bootstrap/windows-88/OPV.c | 14 +++- bootstrap/windows-88/OPV.h | 2 +- bootstrap/windows-88/Out.c | 2 +- bootstrap/windows-88/Out.h | 2 +- bootstrap/windows-88/Platform.c | 92 +-------------------------- bootstrap/windows-88/Platform.h | 10 +-- bootstrap/windows-88/Reals.c | 2 +- bootstrap/windows-88/Reals.h | 2 +- bootstrap/windows-88/Strings.c | 2 +- bootstrap/windows-88/Strings.h | 2 +- bootstrap/windows-88/Texts.c | 6 +- bootstrap/windows-88/Texts.h | 2 +- bootstrap/windows-88/VT100.c | 2 +- bootstrap/windows-88/VT100.h | 2 +- bootstrap/windows-88/extTools.c | 2 +- bootstrap/windows-88/extTools.h | 2 +- 186 files changed, 854 insertions(+), 870 deletions(-) diff --git a/bootstrap/SYSTEM.h b/bootstrap/SYSTEM.h index ff4c724d..f6936068 100644 --- a/bootstrap/SYSTEM.h +++ b/bootstrap/SYSTEM.h @@ -258,10 +258,10 @@ extern void Heap_INCREF(); // Main module initialisation, registration and finalisation -extern void Platform_Init(INT32 argc, ADDRESS argv); +extern void Modules_Init(INT32 argc, ADDRESS argv); extern void Heap_FINALL(); -#define __INIT(argc, argv) static void *m; Platform_Init(argc, (ADDRESS)&argv); +#define __INIT(argc, argv) static void *m; Modules_Init(argc, (ADDRESS)&argv); #define __REGMAIN(name, enum) m = Heap_REGMOD((CHAR*)name,enum) #define __FINI Heap_FINALL(); return 0 diff --git a/bootstrap/unix-44/Compiler.c b/bootstrap/unix-44/Compiler.c index 29524a91..e59d7615 100644 --- a/bootstrap/unix-44/Compiler.c +++ b/bootstrap/unix-44/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Configuration.c b/bootstrap/unix-44/Configuration.c index 54214f70..01281cfc 100644 --- a/bootstrap/unix-44/Configuration.c +++ b/bootstrap/unix-44/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/unix-44/Configuration.h b/bootstrap/unix-44/Configuration.h index 1e6381e9..98f85767 100644 --- a/bootstrap/unix-44/Configuration.h +++ b/bootstrap/unix-44/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-44/Files.c b/bootstrap/unix-44/Files.c index 763569cc..f39534fc 100644 --- a/bootstrap/unix-44/Files.c +++ b/bootstrap/unix-44/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -237,7 +237,7 @@ static void Files_Deregister (CHAR *name, ADDRESS name__len) if (osfile != NIL) { __ASSERT(!osfile->tempFile, 0); __ASSERT(osfile->fd >= 0, 0); - __COPY(osfile->workName, osfile->registerName, 101); + __MOVE(osfile->workName, osfile->registerName, 101); Files_GetTempName(osfile->registerName, 101, (void*)osfile->workName, 101); osfile->tempFile = 1; osfile->state = 0; @@ -262,7 +262,7 @@ static void Files_Create (Files_File f) } else { __ASSERT(f->state == 2, 0); Files_Deregister(f->registerName, 101); - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } @@ -823,7 +823,7 @@ void Files_Register (Files_File f) if (errcode != 0) { Files_Err((CHAR*)"Couldn't rename temp name as register name", 43, f, errcode); } - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } diff --git a/bootstrap/unix-44/Files.h b/bootstrap/unix-44/Files.h index 28a97c05..e124b950 100644 --- a/bootstrap/unix-44/Files.h +++ b/bootstrap/unix-44/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-44/Heap.c b/bootstrap/unix-44/Heap.c index af8fd777..b6abc8f3 100644 --- a/bootstrap/unix-44/Heap.c +++ b/bootstrap/unix-44/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -105,12 +105,12 @@ static void Heap_Sift (INT32 l, INT32 r, INT32 *a, ADDRESS a__len); export void Heap_Unlock (void); extern void *Heap__init(); -extern ADDRESS Platform_MainStackFrame; +extern ADDRESS Modules_MainStackFrame; extern ADDRESS Platform_OSAllocate(ADDRESS size); #define Heap_HeapModuleInit() Heap__init() #define Heap_ModulesHalt(code) Modules_Halt(code) +#define Heap_ModulesMainStackFrame() Modules_MainStackFrame #define Heap_OSAllocate(size) Platform_OSAllocate(size) -#define Heap_PlatformMainStackFrame() Platform_MainStackFrame void Heap_Lock (void) { @@ -599,7 +599,7 @@ static void Heap_MarkStack (INT32 n, INT32 *cand, ADDRESS cand__len) if (n == 0) { nofcand = 0; sp = (ADDRESS)&frame; - stack0 = Heap_PlatformMainStackFrame(); + stack0 = Heap_ModulesMainStackFrame(); inc = (ADDRESS)&align.p - (ADDRESS)&align; if (sp > stack0) { inc = -inc; diff --git a/bootstrap/unix-44/Heap.h b/bootstrap/unix-44/Heap.h index cc058553..82ebd04d 100644 --- a/bootstrap/unix-44/Heap.h +++ b/bootstrap/unix-44/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-44/Modules.c b/bootstrap/unix-44/Modules.c index 9aedc826..0290d664 100644 --- a/bootstrap/unix-44/Modules.c +++ b/bootstrap/unix-44/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -43,24 +43,105 @@ typedef export INT16 Modules_res; export CHAR Modules_resMsg[256]; export Modules_ModuleName Modules_imported, Modules_importing; +export INT32 Modules_MainStackFrame; +export INT16 Modules_ArgCount; +export INT32 Modules_ArgVector; export ADDRESS *Modules_ModuleDesc__typ; export ADDRESS *Modules_CmdDesc__typ; static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len); +export INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); export void Modules_AssertFail (INT32 code); static void Modules_DisplayHaltCode (INT32 code); export void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +export void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +export void Modules_GetIntArg (INT16 n, INT32 *val); export void Modules_Halt (INT32 code); +export void Modules_Init (INT32 argc, INT32 argvadr); export Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); export Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); static void Modules_errch (CHAR c); static void Modules_errint (INT32 l); static void Modules_errstring (CHAR *s, ADDRESS s__len); +extern void Heap_InitHeap(); +extern void *Modules__init(void); +#define Modules_InitHeap() Heap_InitHeap() +#define Modules_ModulesInit() Modules__init() #define Modules_modules() (Modules_Module)Heap_modules #define Modules_setmodules(m) Heap_modules = m +typedef + INT32 (*ArgVecPtr__14)[1]; + +void Modules_Init (INT32 argc, INT32 argvadr) +{ + ArgVecPtr__14 av = NIL; + Modules_MainStackFrame = argvadr; + Modules_ArgCount = __VAL(INT16, argc); + av = (ArgVecPtr__14)(ADDRESS)argvadr; + Modules_ArgVector = (*av)[0]; + Modules_InitHeap(); + Modules_ModulesInit(); +} + +typedef + CHAR (*ArgPtr__9)[1024]; + +typedef + ArgPtr__9 (*ArgVec__10)[1024]; + +void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len) +{ + ArgVec__10 av = NIL; + if (n < Modules_ArgCount) { + av = (ArgVec__10)(ADDRESS)Modules_ArgVector; + __COPY(*(*av)[__X(n, 1024)], val, val__len); + } +} + +void Modules_GetIntArg (INT16 n, INT32 *val) +{ + CHAR s[64]; + INT32 k, d, i; + s[0] = 0x00; + Modules_GetArg(n, (void*)s, 64); + i = 0; + if (s[0] == '-') { + i = 1; + } + k = 0; + d = (INT16)s[__X(i, 64)] - 48; + while ((d >= 0 && d <= 9)) { + k = k * 10 + d; + i += 1; + d = (INT16)s[__X(i, 64)] - 48; + } + if (s[0] == '-') { + k = -k; + i -= 1; + } + if (i > 0) { + *val = k; + } +} + +INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len) +{ + INT16 i; + CHAR arg[256]; + __DUP(s, s__len, CHAR); + i = 0; + Modules_GetArg(i, (void*)arg, 256); + while ((i < Modules_ArgCount && __STRCMP(s, arg) != 0)) { + i += 1; + Modules_GetArg(i, (void*)arg, 256); + } + __DEL(s); + return i; +} + static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len) { INT16 i, j; diff --git a/bootstrap/unix-44/Modules.h b/bootstrap/unix-44/Modules.h index 568db414..3ab94701 100644 --- a/bootstrap/unix-44/Modules.h +++ b/bootstrap/unix-44/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h @@ -39,13 +39,20 @@ typedef import INT16 Modules_res; import CHAR Modules_resMsg[256]; import Modules_ModuleName Modules_imported, Modules_importing; +import INT32 Modules_MainStackFrame; +import INT16 Modules_ArgCount; +import INT32 Modules_ArgVector; import ADDRESS *Modules_ModuleDesc__typ; import ADDRESS *Modules_CmdDesc__typ; +import INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); import void Modules_AssertFail (INT32 code); import void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +import void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +import void Modules_GetIntArg (INT16 n, INT32 *val); import void Modules_Halt (INT32 code); +import void Modules_Init (INT32 argc, INT32 argvadr); import Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); import Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); import void *Modules__init(void); diff --git a/bootstrap/unix-44/OPB.c b/bootstrap/unix-44/OPB.c index 2e03b5fc..d9e826b8 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -253,7 +253,7 @@ OPT_Node OPB_NewString (OPS_String str, INT64 len) x->conval->intval = -1; x->conval->intval2 = OPM_Longint(len); x->conval->ext = OPT_NewExt(); - __COPY(str, *x->conval->ext, 256); + __MOVE(str, *x->conval->ext, 256); return x; } @@ -1624,23 +1624,19 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) g = 8; } if (x == y) { + } else if ((((y->comp == 2 && y->BaseTyp == x->BaseTyp)) && y->n <= x->n)) { + } else if ((y->comp == 3 && y->BaseTyp == x->BaseTyp)) { } else if (x->BaseTyp == OPT_chartyp) { if (g == 8) { if (ynode->conval->intval2 > x->n) { OPB_err(114); } - } else if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { } else { OPB_err(113); } } else { OPB_err(113); } - } else if ((x->comp == 3 && x->BaseTyp == OPT_chartyp)) { - if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { - } else { - OPB_err(113); - } } else if (x->comp == 4) { if (x == y) { } else if (y->comp == 4) { @@ -2536,7 +2532,6 @@ void OPB_Return (OPT_Node *x, OPT_Object proc) void OPB_Assign (OPT_Node *x, OPT_Node y) { OPT_Node z = NIL; - INT8 subcl; if ((*x)->class >= 7) { OPB_err(56); } @@ -2562,13 +2557,8 @@ void OPB_Assign (OPT_Node *x, OPT_Node y) y->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(0)); } - if ((((((__IN((*x)->typ->comp, 0x0c, 32) && (*x)->typ->BaseTyp == OPT_chartyp)) && __IN(y->typ->comp, 0x0c, 32))) && y->typ->BaseTyp == OPT_chartyp)) { - subcl = 18; - } else { - subcl = 0; - } OPB_BindNodes(19, OPT_notyp, &*x, y); - (*x)->subcl = subcl; + (*x)->subcl = 0; } void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ) diff --git a/bootstrap/unix-44/OPB.h b/bootstrap/unix-44/OPB.h index 6641207d..2c396170 100644 --- a/bootstrap/unix-44/OPB.h +++ b/bootstrap/unix-44/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-44/OPC.c b/bootstrap/unix-44/OPC.c index fd11366a..5f4dc826 100644 --- a/bootstrap/unix-44/OPC.c +++ b/bootstrap/unix-44/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/OPC.h b/bootstrap/unix-44/OPC.h index 4eff8cf5..f9bc06a4 100644 --- a/bootstrap/unix-44/OPC.h +++ b/bootstrap/unix-44/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index 58701bfc..1732c950 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -8,6 +8,7 @@ #include "SYSTEM.h" #include "Configuration.h" #include "Files.h" +#include "Modules.h" #include "Out.h" #include "Platform.h" #include "Strings.h" @@ -266,7 +267,7 @@ static void OPM_ScanOptions (CHAR *s, ADDRESS s__len) BOOLEAN OPM_OpenPar (void) { CHAR s[256]; - if (Platform_ArgCount == 1) { + if (Modules_ArgCount == 1) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"Oberon-2 compiler v", 20); OPM_LogWStr(Configuration_versionLong, 75); @@ -362,16 +363,16 @@ BOOLEAN OPM_OpenPar (void) OPM_Options = 0xa9; OPM_S = 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } OPM_GlobalAddressSize = OPM_AddressSize; OPM_GlobalAlignment = OPM_Alignment; - __COPY(OPM_Model, OPM_GlobalModel, 10); + __MOVE(OPM_Model, OPM_GlobalModel, 10); OPM_GlobalOptions = OPM_Options; return 1; } @@ -410,16 +411,16 @@ void OPM_InitOptions (void) CHAR searchpath[1024], modules[1024]; CHAR MODULES[1024]; OPM_Options = OPM_GlobalOptions; - __COPY(OPM_GlobalModel, OPM_Model, 10); + __MOVE(OPM_GlobalModel, OPM_Model, 10); OPM_Alignment = OPM_GlobalAlignment; OPM_AddressSize = OPM_GlobalAddressSize; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } if (__IN(15, OPM_Options, 32)) { OPM_Options |= __SETOF(10,32); @@ -472,11 +473,11 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) CHAR s[256]; *done = 0; OPM_curpos = 0; - if (OPM_S >= Platform_ArgCount) { + if (OPM_S >= Modules_ArgCount) { return; } s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); __NEW(T, Texts_TextDesc); Texts_Open(T, s, 256); OPM_LogWStr(s, 256); @@ -1070,6 +1071,7 @@ export void *OPM__init(void) __DEFMOD; __MODULE_IMPORT(Configuration); __MODULE_IMPORT(Files); + __MODULE_IMPORT(Modules); __MODULE_IMPORT(Out); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); diff --git a/bootstrap/unix-44/OPM.h b/bootstrap/unix-44/OPM.h index 4dd3d03b..979995c8 100644 --- a/bootstrap/unix-44/OPM.h +++ b/bootstrap/unix-44/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-44/OPP.c b/bootstrap/unix-44/OPP.c index d4922137..69624c1f 100644 --- a/bootstrap/unix-44/OPP.c +++ b/bootstrap/unix-44/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -527,7 +527,7 @@ static void OPP_selector (OPT_Node *x) } else if (OPP_sym == 18) { OPS_Get(&OPP_sym); if (OPP_sym == 38) { - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPS_Get(&OPP_sym); if ((*x)->typ != NIL) { if ((*x)->typ->form == 11) { @@ -867,7 +867,7 @@ static void OPP_Receiver (INT8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct } else { *mode = 1; } - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckSym(38); OPP_CheckSym(20); if (OPP_sym == 38) { @@ -1030,7 +1030,7 @@ static void TProcDecl__23 (void) } OPP_Receiver(&objMode, objName, &objTyp, &recTyp); if (OPP_sym == 38) { - __COPY(OPS_name, *ProcedureDeclaration__16_s->name, 256); + __MOVE(OPS_name, *ProcedureDeclaration__16_s->name, 256); OPP_CheckMark(&*ProcedureDeclaration__16_s->vis); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp, &*ProcedureDeclaration__16_s->fwd); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp->BaseTyp, &baseProc); @@ -1129,7 +1129,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) TProcDecl__23(); } else if (OPP_sym == 38) { OPT_Find(&fwd); - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckMark(&vis); if ((vis != 0 && mode == 6)) { mode = 7; diff --git a/bootstrap/unix-44/OPP.h b/bootstrap/unix-44/OPP.h index 2814e733..b748e221 100644 --- a/bootstrap/unix-44/OPP.h +++ b/bootstrap/unix-44/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-44/OPS.c b/bootstrap/unix-44/OPS.c index 7218afe1..eee78d80 100644 --- a/bootstrap/unix-44/OPS.c +++ b/bootstrap/unix-44/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/OPS.h b/bootstrap/unix-44/OPS.h index a860454b..7ab70899 100644 --- a/bootstrap/unix-44/OPS.h +++ b/bootstrap/unix-44/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-44/OPT.c b/bootstrap/unix-44/OPT.c index 7b7f6fbc..40f61458 100644 --- a/bootstrap/unix-44/OPT.c +++ b/bootstrap/unix-44/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -434,8 +434,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); OPT_SYSimported = 0; - __COPY(name, OPT_SelfName, 256); - __COPY(name, OPT_topScope->name, 256); + __MOVE(name, OPT_SelfName, 256); + __MOVE(name, OPT_topScope->name, 256); OPT_GlbMod[0] = OPT_topScope; OPT_nofGmod = 1; OPT_newsf = __IN(4, opt, 32); @@ -1186,7 +1186,7 @@ static void OPT_InStruct (OPT_Struct *typ) } *typ = OPT_NewStr(0, 1); } else { - __COPY(name, obj->name, 256); + __MOVE(name, obj->name, 256); OPT_InsertImport(obj, &OPT_GlbMod[__X(mno, 64)]->right, &old); if (old != NIL) { OPT_FPrintObj(old); diff --git a/bootstrap/unix-44/OPT.h b/bootstrap/unix-44/OPT.h index 86256024..67996e8e 100644 --- a/bootstrap/unix-44/OPT.h +++ b/bootstrap/unix-44/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-44/OPV.c b/bootstrap/unix-44/OPV.c index eb5ad767..fb6ac690 100644 --- a/bootstrap/unix-44/OPV.c +++ b/bootstrap/unix-44/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -163,7 +163,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte } scope = obj->scope; scope->leaf = 1; - __COPY(obj->name, scope->name, 256); + __MOVE(obj->name, scope->name, 256); OPV_Stamp(scope->name); if (mode == 9) { obj->adr = 1; @@ -1286,7 +1286,17 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) OPM_WriteString((CHAR*)", ", 3); if (r->typ == OPT_stringtyp) { OPM_WriteInt(r->conval->intval2); + } else if (r->typ->comp == 3) { + OPM_WriteString((CHAR*)"__X(", 5); + OPC_Len(r->obj, r->typ, 0); + OPM_WriteString((CHAR*)" * ", 4); + OPM_WriteInt(r->typ->BaseTyp->size); + OPM_WriteString((CHAR*)", ", 3); + OPM_WriteInt(l->typ->size); + OPM_Write(')'); } else { + __ASSERT(r->typ->comp == 2, 0); + __ASSERT(r->typ->size <= l->typ->size, 0); OPM_WriteInt(r->typ->size); } OPM_Write(')'); diff --git a/bootstrap/unix-44/OPV.h b/bootstrap/unix-44/OPV.h index 9a8653a0..43aaf24a 100644 --- a/bootstrap/unix-44/OPV.h +++ b/bootstrap/unix-44/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-44/Out.c b/bootstrap/unix-44/Out.c index 1508a8bb..a03cf592 100644 --- a/bootstrap/unix-44/Out.c +++ b/bootstrap/unix-44/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Out.h b/bootstrap/unix-44/Out.h index b273390e..27f2c9bb 100644 --- a/bootstrap/unix-44/Out.h +++ b/bootstrap/unix-44/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/unix-44/Platform.c b/bootstrap/unix-44/Platform.c index 9a2555d2..1fc766bf 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -7,37 +7,18 @@ #include "SYSTEM.h" -typedef - CHAR (*Platform_ArgPtr)[1024]; - -typedef - Platform_ArgPtr (*Platform_ArgVec)[1024]; - -typedef - INT32 (*Platform_ArgVecPtr)[1]; - -typedef - CHAR (*Platform_EnvPtr)[1024]; - typedef struct Platform_FileIdentity { INT32 volume, index, mtime; } Platform_FileIdentity; -typedef - void (*Platform_HaltProcedure)(INT32); - typedef void (*Platform_SignalHandler)(INT32); export BOOLEAN Platform_LittleEndian; -export INT32 Platform_MainStackFrame; export INT16 Platform_PID; export CHAR Platform_CWD[256]; -export INT16 Platform_ArgCount; -export INT32 Platform_ArgVector; -static Platform_HaltProcedure Platform_HaltHandler; static INT32 Platform_TimeStart; export INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; export CHAR Platform_NL[3]; @@ -45,7 +26,6 @@ export CHAR Platform_NL[3]; export ADDRESS *Platform_FileIdentity__typ; export BOOLEAN Platform_Absent (INT16 e); -export INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); export INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); export INT16 Platform_Close (INT32 h); export BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -53,15 +33,12 @@ export void Platform_Delay (INT32 ms); export BOOLEAN Platform_DifferentFilesystems (INT16 e); export INT16 Platform_Error (void); export void Platform_Exit (INT32 code); -export void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); export void Platform_GetClock (INT32 *t, INT32 *d); export void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -export void Platform_GetIntArg (INT16 n, INT32 *val); export void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); export INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); export INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); export BOOLEAN Platform_Inaccessible (INT16 e); -export void Platform_Init (INT32 argc, INT32 argvadr); export BOOLEAN Platform_Interrupted (INT16 e); export BOOLEAN Platform_IsConsole (INT32 h); export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); @@ -117,8 +94,6 @@ export BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS #define Platform_EROFS() EROFS #define Platform_ETIMEDOUT() ETIMEDOUT #define Platform_EXDEV() EXDEV -extern void Heap_InitHeap(); -#define Platform_HeapInitHeap() Heap_InitHeap() #define Platform_allocate(size) (ADDRESS)((void*)malloc((size_t)size)) #define Platform_chdir(n, n__len) chdir((char*)n) #define Platform_closefile(fd) close(fd) @@ -129,7 +104,7 @@ extern void Heap_InitHeap(); #define Platform_fsync(fd) fsync(fd) #define Platform_ftruncate(fd, l) ftruncate(fd, l) #define Platform_getcwd(cwd, cwd__len) getcwd((char*)cwd, cwd__len) -#define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var) +#define Platform_getenv(var, var__len) getenv((char*)var) #define Platform_getpid() (INTEGER)getpid() #define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0) #define Platform_isatty(fd) isatty(fd) @@ -213,21 +188,14 @@ void Platform_OSFree (INT32 address) Platform_free(address); } -void Platform_Init (INT32 argc, INT32 argvadr) -{ - Platform_ArgVecPtr av = NIL; - Platform_MainStackFrame = argvadr; - Platform_ArgCount = __VAL(INT16, argc); - av = (Platform_ArgVecPtr)(ADDRESS)argvadr; - Platform_ArgVector = (*av)[0]; - Platform_HeapInitHeap(); -} +typedef + CHAR (*EnvPtr__78)[1024]; BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) { - Platform_EnvPtr p = NIL; + EnvPtr__78 p = NIL; __DUP(var, var__len, CHAR); - p = Platform_getenv(var, var__len); + p = (EnvPtr__78)(ADDRESS)Platform_getenv(var, var__len); if (p != NIL) { __COPY(*p, val, val__len); } @@ -244,56 +212,6 @@ void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) __DEL(var); } -void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len) -{ - Platform_ArgVec av = NIL; - if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector; - __COPY(*(*av)[__X(n, 1024)], val, val__len); - } -} - -void Platform_GetIntArg (INT16 n, INT32 *val) -{ - CHAR s[64]; - INT32 k, d, i; - s[0] = 0x00; - Platform_GetArg(n, (void*)s, 64); - i = 0; - if (s[0] == '-') { - i = 1; - } - k = 0; - d = (INT16)s[__X(i, 64)] - 48; - while ((d >= 0 && d <= 9)) { - k = k * 10 + d; - i += 1; - d = (INT16)s[__X(i, 64)] - 48; - } - if (s[0] == '-') { - k = -k; - i -= 1; - } - if (i > 0) { - *val = k; - } -} - -INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len) -{ - INT16 i; - CHAR arg[256]; - __DUP(s, s__len, CHAR); - i = 0; - Platform_GetArg(i, (void*)arg, 256); - while ((i < Platform_ArgCount && __STRCMP(s, arg) != 0)) { - i += 1; - Platform_GetArg(i, (void*)arg, 256); - } - __DEL(s); - return i; -} - void Platform_SetInterruptHandler (Platform_SignalHandler handler) { Platform_sethandler(2, handler); @@ -587,7 +505,6 @@ export void *Platform__init(void) __INITYP(Platform_FileIdentity, Platform_FileIdentity, 0); /* BEGIN */ Platform_TestLittleEndian(); - Platform_HaltHandler = NIL; Platform_TimeStart = 0; Platform_TimeStart = Platform_Time(); Platform_PID = Platform_getpid(); diff --git a/bootstrap/unix-44/Platform.h b/bootstrap/unix-44/Platform.h index 315a17e0..9be32cda 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h @@ -16,18 +16,14 @@ typedef import BOOLEAN Platform_LittleEndian; -import INT32 Platform_MainStackFrame; import INT16 Platform_PID; import CHAR Platform_CWD[256]; -import INT16 Platform_ArgCount; -import INT32 Platform_ArgVector; import INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; import CHAR Platform_NL[3]; import ADDRESS *Platform_FileIdentity__typ; import BOOLEAN Platform_Absent (INT16 e); -import INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); import INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); import INT16 Platform_Close (INT32 h); import BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -35,15 +31,12 @@ import void Platform_Delay (INT32 ms); import BOOLEAN Platform_DifferentFilesystems (INT16 e); import INT16 Platform_Error (void); import void Platform_Exit (INT32 code); -import void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); import void Platform_GetClock (INT32 *t, INT32 *d); import void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -import void Platform_GetIntArg (INT16 n, INT32 *val); import void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); import INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); import INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); import BOOLEAN Platform_Inaccessible (INT16 e); -import void Platform_Init (INT32 argc, INT32 argvadr); import BOOLEAN Platform_Interrupted (INT16 e); import BOOLEAN Platform_IsConsole (INT32 h); import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); diff --git a/bootstrap/unix-44/Reals.c b/bootstrap/unix-44/Reals.c index ee1f94ca..e4149017 100644 --- a/bootstrap/unix-44/Reals.c +++ b/bootstrap/unix-44/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Reals.h b/bootstrap/unix-44/Reals.h index 16a16b7a..e3bfadb5 100644 --- a/bootstrap/unix-44/Reals.h +++ b/bootstrap/unix-44/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-44/Strings.c b/bootstrap/unix-44/Strings.c index b60bb504..a3f1e808 100644 --- a/bootstrap/unix-44/Strings.c +++ b/bootstrap/unix-44/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/Strings.h b/bootstrap/unix-44/Strings.h index adf86c42..b192b7bb 100644 --- a/bootstrap/unix-44/Strings.h +++ b/bootstrap/unix-44/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-44/Texts.c b/bootstrap/unix-44/Texts.c index ea3662c0..376db061 100644 --- a/bootstrap/unix-44/Texts.c +++ b/bootstrap/unix-44/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -394,8 +394,8 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, ADDRESS *msg__t e->file = (*(Texts_Alien*)&E)->file; e->org = (*(Texts_Alien*)&E)->org; e->span = (*(Texts_Alien*)&E)->span; - __COPY((*(Texts_Alien*)&E)->mod, e->mod, 32); - __COPY((*(Texts_Alien*)&E)->proc, e->proc, 32); + __MOVE((*(Texts_Alien*)&E)->mod, e->mod, 32); + __MOVE((*(Texts_Alien*)&E)->proc, e->proc, 32); (*msg__).e = (Texts_Elem)e; } else __WITHCHK; } else if (__IS(msg__typ, Texts_IdentifyMsg, 1)) { diff --git a/bootstrap/unix-44/Texts.h b/bootstrap/unix-44/Texts.h index beb1d7c1..4ea56de1 100644 --- a/bootstrap/unix-44/Texts.h +++ b/bootstrap/unix-44/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-44/VT100.c b/bootstrap/unix-44/VT100.c index f0e444ea..7a2a840d 100644 --- a/bootstrap/unix-44/VT100.c +++ b/bootstrap/unix-44/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/VT100.h b/bootstrap/unix-44/VT100.h index 0f1bc5ac..5a3fe6d0 100644 --- a/bootstrap/unix-44/VT100.h +++ b/bootstrap/unix-44/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/unix-44/extTools.c b/bootstrap/unix-44/extTools.c index 43e5cb69..657534b4 100644 --- a/bootstrap/unix-44/extTools.c +++ b/bootstrap/unix-44/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-44/extTools.h b/bootstrap/unix-44/extTools.h index 784b684d..6ad7abb0 100644 --- a/bootstrap/unix-44/extTools.h +++ b/bootstrap/unix-44/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-48/Compiler.c b/bootstrap/unix-48/Compiler.c index 29524a91..e59d7615 100644 --- a/bootstrap/unix-48/Compiler.c +++ b/bootstrap/unix-48/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Configuration.c b/bootstrap/unix-48/Configuration.c index 54214f70..01281cfc 100644 --- a/bootstrap/unix-48/Configuration.c +++ b/bootstrap/unix-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/unix-48/Configuration.h b/bootstrap/unix-48/Configuration.h index 1e6381e9..98f85767 100644 --- a/bootstrap/unix-48/Configuration.h +++ b/bootstrap/unix-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-48/Files.c b/bootstrap/unix-48/Files.c index 763569cc..f39534fc 100644 --- a/bootstrap/unix-48/Files.c +++ b/bootstrap/unix-48/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -237,7 +237,7 @@ static void Files_Deregister (CHAR *name, ADDRESS name__len) if (osfile != NIL) { __ASSERT(!osfile->tempFile, 0); __ASSERT(osfile->fd >= 0, 0); - __COPY(osfile->workName, osfile->registerName, 101); + __MOVE(osfile->workName, osfile->registerName, 101); Files_GetTempName(osfile->registerName, 101, (void*)osfile->workName, 101); osfile->tempFile = 1; osfile->state = 0; @@ -262,7 +262,7 @@ static void Files_Create (Files_File f) } else { __ASSERT(f->state == 2, 0); Files_Deregister(f->registerName, 101); - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } @@ -823,7 +823,7 @@ void Files_Register (Files_File f) if (errcode != 0) { Files_Err((CHAR*)"Couldn't rename temp name as register name", 43, f, errcode); } - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } diff --git a/bootstrap/unix-48/Files.h b/bootstrap/unix-48/Files.h index 28a97c05..e124b950 100644 --- a/bootstrap/unix-48/Files.h +++ b/bootstrap/unix-48/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-48/Heap.c b/bootstrap/unix-48/Heap.c index af8fd777..b6abc8f3 100644 --- a/bootstrap/unix-48/Heap.c +++ b/bootstrap/unix-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -105,12 +105,12 @@ static void Heap_Sift (INT32 l, INT32 r, INT32 *a, ADDRESS a__len); export void Heap_Unlock (void); extern void *Heap__init(); -extern ADDRESS Platform_MainStackFrame; +extern ADDRESS Modules_MainStackFrame; extern ADDRESS Platform_OSAllocate(ADDRESS size); #define Heap_HeapModuleInit() Heap__init() #define Heap_ModulesHalt(code) Modules_Halt(code) +#define Heap_ModulesMainStackFrame() Modules_MainStackFrame #define Heap_OSAllocate(size) Platform_OSAllocate(size) -#define Heap_PlatformMainStackFrame() Platform_MainStackFrame void Heap_Lock (void) { @@ -599,7 +599,7 @@ static void Heap_MarkStack (INT32 n, INT32 *cand, ADDRESS cand__len) if (n == 0) { nofcand = 0; sp = (ADDRESS)&frame; - stack0 = Heap_PlatformMainStackFrame(); + stack0 = Heap_ModulesMainStackFrame(); inc = (ADDRESS)&align.p - (ADDRESS)&align; if (sp > stack0) { inc = -inc; diff --git a/bootstrap/unix-48/Heap.h b/bootstrap/unix-48/Heap.h index cc058553..82ebd04d 100644 --- a/bootstrap/unix-48/Heap.h +++ b/bootstrap/unix-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-48/Modules.c b/bootstrap/unix-48/Modules.c index 9aedc826..0290d664 100644 --- a/bootstrap/unix-48/Modules.c +++ b/bootstrap/unix-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -43,24 +43,105 @@ typedef export INT16 Modules_res; export CHAR Modules_resMsg[256]; export Modules_ModuleName Modules_imported, Modules_importing; +export INT32 Modules_MainStackFrame; +export INT16 Modules_ArgCount; +export INT32 Modules_ArgVector; export ADDRESS *Modules_ModuleDesc__typ; export ADDRESS *Modules_CmdDesc__typ; static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len); +export INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); export void Modules_AssertFail (INT32 code); static void Modules_DisplayHaltCode (INT32 code); export void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +export void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +export void Modules_GetIntArg (INT16 n, INT32 *val); export void Modules_Halt (INT32 code); +export void Modules_Init (INT32 argc, INT32 argvadr); export Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); export Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); static void Modules_errch (CHAR c); static void Modules_errint (INT32 l); static void Modules_errstring (CHAR *s, ADDRESS s__len); +extern void Heap_InitHeap(); +extern void *Modules__init(void); +#define Modules_InitHeap() Heap_InitHeap() +#define Modules_ModulesInit() Modules__init() #define Modules_modules() (Modules_Module)Heap_modules #define Modules_setmodules(m) Heap_modules = m +typedef + INT32 (*ArgVecPtr__14)[1]; + +void Modules_Init (INT32 argc, INT32 argvadr) +{ + ArgVecPtr__14 av = NIL; + Modules_MainStackFrame = argvadr; + Modules_ArgCount = __VAL(INT16, argc); + av = (ArgVecPtr__14)(ADDRESS)argvadr; + Modules_ArgVector = (*av)[0]; + Modules_InitHeap(); + Modules_ModulesInit(); +} + +typedef + CHAR (*ArgPtr__9)[1024]; + +typedef + ArgPtr__9 (*ArgVec__10)[1024]; + +void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len) +{ + ArgVec__10 av = NIL; + if (n < Modules_ArgCount) { + av = (ArgVec__10)(ADDRESS)Modules_ArgVector; + __COPY(*(*av)[__X(n, 1024)], val, val__len); + } +} + +void Modules_GetIntArg (INT16 n, INT32 *val) +{ + CHAR s[64]; + INT32 k, d, i; + s[0] = 0x00; + Modules_GetArg(n, (void*)s, 64); + i = 0; + if (s[0] == '-') { + i = 1; + } + k = 0; + d = (INT16)s[__X(i, 64)] - 48; + while ((d >= 0 && d <= 9)) { + k = k * 10 + d; + i += 1; + d = (INT16)s[__X(i, 64)] - 48; + } + if (s[0] == '-') { + k = -k; + i -= 1; + } + if (i > 0) { + *val = k; + } +} + +INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len) +{ + INT16 i; + CHAR arg[256]; + __DUP(s, s__len, CHAR); + i = 0; + Modules_GetArg(i, (void*)arg, 256); + while ((i < Modules_ArgCount && __STRCMP(s, arg) != 0)) { + i += 1; + Modules_GetArg(i, (void*)arg, 256); + } + __DEL(s); + return i; +} + static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len) { INT16 i, j; diff --git a/bootstrap/unix-48/Modules.h b/bootstrap/unix-48/Modules.h index 568db414..3ab94701 100644 --- a/bootstrap/unix-48/Modules.h +++ b/bootstrap/unix-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h @@ -39,13 +39,20 @@ typedef import INT16 Modules_res; import CHAR Modules_resMsg[256]; import Modules_ModuleName Modules_imported, Modules_importing; +import INT32 Modules_MainStackFrame; +import INT16 Modules_ArgCount; +import INT32 Modules_ArgVector; import ADDRESS *Modules_ModuleDesc__typ; import ADDRESS *Modules_CmdDesc__typ; +import INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); import void Modules_AssertFail (INT32 code); import void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +import void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +import void Modules_GetIntArg (INT16 n, INT32 *val); import void Modules_Halt (INT32 code); +import void Modules_Init (INT32 argc, INT32 argvadr); import Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); import Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); import void *Modules__init(void); diff --git a/bootstrap/unix-48/OPB.c b/bootstrap/unix-48/OPB.c index 2e03b5fc..d9e826b8 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -253,7 +253,7 @@ OPT_Node OPB_NewString (OPS_String str, INT64 len) x->conval->intval = -1; x->conval->intval2 = OPM_Longint(len); x->conval->ext = OPT_NewExt(); - __COPY(str, *x->conval->ext, 256); + __MOVE(str, *x->conval->ext, 256); return x; } @@ -1624,23 +1624,19 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) g = 8; } if (x == y) { + } else if ((((y->comp == 2 && y->BaseTyp == x->BaseTyp)) && y->n <= x->n)) { + } else if ((y->comp == 3 && y->BaseTyp == x->BaseTyp)) { } else if (x->BaseTyp == OPT_chartyp) { if (g == 8) { if (ynode->conval->intval2 > x->n) { OPB_err(114); } - } else if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { } else { OPB_err(113); } } else { OPB_err(113); } - } else if ((x->comp == 3 && x->BaseTyp == OPT_chartyp)) { - if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { - } else { - OPB_err(113); - } } else if (x->comp == 4) { if (x == y) { } else if (y->comp == 4) { @@ -2536,7 +2532,6 @@ void OPB_Return (OPT_Node *x, OPT_Object proc) void OPB_Assign (OPT_Node *x, OPT_Node y) { OPT_Node z = NIL; - INT8 subcl; if ((*x)->class >= 7) { OPB_err(56); } @@ -2562,13 +2557,8 @@ void OPB_Assign (OPT_Node *x, OPT_Node y) y->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(0)); } - if ((((((__IN((*x)->typ->comp, 0x0c, 32) && (*x)->typ->BaseTyp == OPT_chartyp)) && __IN(y->typ->comp, 0x0c, 32))) && y->typ->BaseTyp == OPT_chartyp)) { - subcl = 18; - } else { - subcl = 0; - } OPB_BindNodes(19, OPT_notyp, &*x, y); - (*x)->subcl = subcl; + (*x)->subcl = 0; } void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ) diff --git a/bootstrap/unix-48/OPB.h b/bootstrap/unix-48/OPB.h index 6641207d..2c396170 100644 --- a/bootstrap/unix-48/OPB.h +++ b/bootstrap/unix-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-48/OPC.c b/bootstrap/unix-48/OPC.c index fd11366a..5f4dc826 100644 --- a/bootstrap/unix-48/OPC.c +++ b/bootstrap/unix-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/OPC.h b/bootstrap/unix-48/OPC.h index 4eff8cf5..f9bc06a4 100644 --- a/bootstrap/unix-48/OPC.h +++ b/bootstrap/unix-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index 58701bfc..1732c950 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -8,6 +8,7 @@ #include "SYSTEM.h" #include "Configuration.h" #include "Files.h" +#include "Modules.h" #include "Out.h" #include "Platform.h" #include "Strings.h" @@ -266,7 +267,7 @@ static void OPM_ScanOptions (CHAR *s, ADDRESS s__len) BOOLEAN OPM_OpenPar (void) { CHAR s[256]; - if (Platform_ArgCount == 1) { + if (Modules_ArgCount == 1) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"Oberon-2 compiler v", 20); OPM_LogWStr(Configuration_versionLong, 75); @@ -362,16 +363,16 @@ BOOLEAN OPM_OpenPar (void) OPM_Options = 0xa9; OPM_S = 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } OPM_GlobalAddressSize = OPM_AddressSize; OPM_GlobalAlignment = OPM_Alignment; - __COPY(OPM_Model, OPM_GlobalModel, 10); + __MOVE(OPM_Model, OPM_GlobalModel, 10); OPM_GlobalOptions = OPM_Options; return 1; } @@ -410,16 +411,16 @@ void OPM_InitOptions (void) CHAR searchpath[1024], modules[1024]; CHAR MODULES[1024]; OPM_Options = OPM_GlobalOptions; - __COPY(OPM_GlobalModel, OPM_Model, 10); + __MOVE(OPM_GlobalModel, OPM_Model, 10); OPM_Alignment = OPM_GlobalAlignment; OPM_AddressSize = OPM_GlobalAddressSize; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } if (__IN(15, OPM_Options, 32)) { OPM_Options |= __SETOF(10,32); @@ -472,11 +473,11 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) CHAR s[256]; *done = 0; OPM_curpos = 0; - if (OPM_S >= Platform_ArgCount) { + if (OPM_S >= Modules_ArgCount) { return; } s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); __NEW(T, Texts_TextDesc); Texts_Open(T, s, 256); OPM_LogWStr(s, 256); @@ -1070,6 +1071,7 @@ export void *OPM__init(void) __DEFMOD; __MODULE_IMPORT(Configuration); __MODULE_IMPORT(Files); + __MODULE_IMPORT(Modules); __MODULE_IMPORT(Out); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); diff --git a/bootstrap/unix-48/OPM.h b/bootstrap/unix-48/OPM.h index 4dd3d03b..979995c8 100644 --- a/bootstrap/unix-48/OPM.h +++ b/bootstrap/unix-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-48/OPP.c b/bootstrap/unix-48/OPP.c index d4922137..69624c1f 100644 --- a/bootstrap/unix-48/OPP.c +++ b/bootstrap/unix-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -527,7 +527,7 @@ static void OPP_selector (OPT_Node *x) } else if (OPP_sym == 18) { OPS_Get(&OPP_sym); if (OPP_sym == 38) { - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPS_Get(&OPP_sym); if ((*x)->typ != NIL) { if ((*x)->typ->form == 11) { @@ -867,7 +867,7 @@ static void OPP_Receiver (INT8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct } else { *mode = 1; } - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckSym(38); OPP_CheckSym(20); if (OPP_sym == 38) { @@ -1030,7 +1030,7 @@ static void TProcDecl__23 (void) } OPP_Receiver(&objMode, objName, &objTyp, &recTyp); if (OPP_sym == 38) { - __COPY(OPS_name, *ProcedureDeclaration__16_s->name, 256); + __MOVE(OPS_name, *ProcedureDeclaration__16_s->name, 256); OPP_CheckMark(&*ProcedureDeclaration__16_s->vis); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp, &*ProcedureDeclaration__16_s->fwd); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp->BaseTyp, &baseProc); @@ -1129,7 +1129,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) TProcDecl__23(); } else if (OPP_sym == 38) { OPT_Find(&fwd); - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckMark(&vis); if ((vis != 0 && mode == 6)) { mode = 7; diff --git a/bootstrap/unix-48/OPP.h b/bootstrap/unix-48/OPP.h index 2814e733..b748e221 100644 --- a/bootstrap/unix-48/OPP.h +++ b/bootstrap/unix-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-48/OPS.c b/bootstrap/unix-48/OPS.c index 7218afe1..eee78d80 100644 --- a/bootstrap/unix-48/OPS.c +++ b/bootstrap/unix-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/OPS.h b/bootstrap/unix-48/OPS.h index a860454b..7ab70899 100644 --- a/bootstrap/unix-48/OPS.h +++ b/bootstrap/unix-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-48/OPT.c b/bootstrap/unix-48/OPT.c index aa53a484..174aae08 100644 --- a/bootstrap/unix-48/OPT.c +++ b/bootstrap/unix-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -434,8 +434,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); OPT_SYSimported = 0; - __COPY(name, OPT_SelfName, 256); - __COPY(name, OPT_topScope->name, 256); + __MOVE(name, OPT_SelfName, 256); + __MOVE(name, OPT_topScope->name, 256); OPT_GlbMod[0] = OPT_topScope; OPT_nofGmod = 1; OPT_newsf = __IN(4, opt, 32); @@ -1186,7 +1186,7 @@ static void OPT_InStruct (OPT_Struct *typ) } *typ = OPT_NewStr(0, 1); } else { - __COPY(name, obj->name, 256); + __MOVE(name, obj->name, 256); OPT_InsertImport(obj, &OPT_GlbMod[__X(mno, 64)]->right, &old); if (old != NIL) { OPT_FPrintObj(old); diff --git a/bootstrap/unix-48/OPT.h b/bootstrap/unix-48/OPT.h index 86256024..67996e8e 100644 --- a/bootstrap/unix-48/OPT.h +++ b/bootstrap/unix-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-48/OPV.c b/bootstrap/unix-48/OPV.c index eb5ad767..fb6ac690 100644 --- a/bootstrap/unix-48/OPV.c +++ b/bootstrap/unix-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -163,7 +163,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte } scope = obj->scope; scope->leaf = 1; - __COPY(obj->name, scope->name, 256); + __MOVE(obj->name, scope->name, 256); OPV_Stamp(scope->name); if (mode == 9) { obj->adr = 1; @@ -1286,7 +1286,17 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) OPM_WriteString((CHAR*)", ", 3); if (r->typ == OPT_stringtyp) { OPM_WriteInt(r->conval->intval2); + } else if (r->typ->comp == 3) { + OPM_WriteString((CHAR*)"__X(", 5); + OPC_Len(r->obj, r->typ, 0); + OPM_WriteString((CHAR*)" * ", 4); + OPM_WriteInt(r->typ->BaseTyp->size); + OPM_WriteString((CHAR*)", ", 3); + OPM_WriteInt(l->typ->size); + OPM_Write(')'); } else { + __ASSERT(r->typ->comp == 2, 0); + __ASSERT(r->typ->size <= l->typ->size, 0); OPM_WriteInt(r->typ->size); } OPM_Write(')'); diff --git a/bootstrap/unix-48/OPV.h b/bootstrap/unix-48/OPV.h index 9a8653a0..43aaf24a 100644 --- a/bootstrap/unix-48/OPV.h +++ b/bootstrap/unix-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-48/Out.c b/bootstrap/unix-48/Out.c index 1508a8bb..a03cf592 100644 --- a/bootstrap/unix-48/Out.c +++ b/bootstrap/unix-48/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Out.h b/bootstrap/unix-48/Out.h index b273390e..27f2c9bb 100644 --- a/bootstrap/unix-48/Out.h +++ b/bootstrap/unix-48/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/unix-48/Platform.c b/bootstrap/unix-48/Platform.c index 9a2555d2..1fc766bf 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -7,37 +7,18 @@ #include "SYSTEM.h" -typedef - CHAR (*Platform_ArgPtr)[1024]; - -typedef - Platform_ArgPtr (*Platform_ArgVec)[1024]; - -typedef - INT32 (*Platform_ArgVecPtr)[1]; - -typedef - CHAR (*Platform_EnvPtr)[1024]; - typedef struct Platform_FileIdentity { INT32 volume, index, mtime; } Platform_FileIdentity; -typedef - void (*Platform_HaltProcedure)(INT32); - typedef void (*Platform_SignalHandler)(INT32); export BOOLEAN Platform_LittleEndian; -export INT32 Platform_MainStackFrame; export INT16 Platform_PID; export CHAR Platform_CWD[256]; -export INT16 Platform_ArgCount; -export INT32 Platform_ArgVector; -static Platform_HaltProcedure Platform_HaltHandler; static INT32 Platform_TimeStart; export INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; export CHAR Platform_NL[3]; @@ -45,7 +26,6 @@ export CHAR Platform_NL[3]; export ADDRESS *Platform_FileIdentity__typ; export BOOLEAN Platform_Absent (INT16 e); -export INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); export INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); export INT16 Platform_Close (INT32 h); export BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -53,15 +33,12 @@ export void Platform_Delay (INT32 ms); export BOOLEAN Platform_DifferentFilesystems (INT16 e); export INT16 Platform_Error (void); export void Platform_Exit (INT32 code); -export void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); export void Platform_GetClock (INT32 *t, INT32 *d); export void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -export void Platform_GetIntArg (INT16 n, INT32 *val); export void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); export INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); export INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); export BOOLEAN Platform_Inaccessible (INT16 e); -export void Platform_Init (INT32 argc, INT32 argvadr); export BOOLEAN Platform_Interrupted (INT16 e); export BOOLEAN Platform_IsConsole (INT32 h); export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); @@ -117,8 +94,6 @@ export BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS #define Platform_EROFS() EROFS #define Platform_ETIMEDOUT() ETIMEDOUT #define Platform_EXDEV() EXDEV -extern void Heap_InitHeap(); -#define Platform_HeapInitHeap() Heap_InitHeap() #define Platform_allocate(size) (ADDRESS)((void*)malloc((size_t)size)) #define Platform_chdir(n, n__len) chdir((char*)n) #define Platform_closefile(fd) close(fd) @@ -129,7 +104,7 @@ extern void Heap_InitHeap(); #define Platform_fsync(fd) fsync(fd) #define Platform_ftruncate(fd, l) ftruncate(fd, l) #define Platform_getcwd(cwd, cwd__len) getcwd((char*)cwd, cwd__len) -#define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var) +#define Platform_getenv(var, var__len) getenv((char*)var) #define Platform_getpid() (INTEGER)getpid() #define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0) #define Platform_isatty(fd) isatty(fd) @@ -213,21 +188,14 @@ void Platform_OSFree (INT32 address) Platform_free(address); } -void Platform_Init (INT32 argc, INT32 argvadr) -{ - Platform_ArgVecPtr av = NIL; - Platform_MainStackFrame = argvadr; - Platform_ArgCount = __VAL(INT16, argc); - av = (Platform_ArgVecPtr)(ADDRESS)argvadr; - Platform_ArgVector = (*av)[0]; - Platform_HeapInitHeap(); -} +typedef + CHAR (*EnvPtr__78)[1024]; BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) { - Platform_EnvPtr p = NIL; + EnvPtr__78 p = NIL; __DUP(var, var__len, CHAR); - p = Platform_getenv(var, var__len); + p = (EnvPtr__78)(ADDRESS)Platform_getenv(var, var__len); if (p != NIL) { __COPY(*p, val, val__len); } @@ -244,56 +212,6 @@ void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) __DEL(var); } -void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len) -{ - Platform_ArgVec av = NIL; - if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector; - __COPY(*(*av)[__X(n, 1024)], val, val__len); - } -} - -void Platform_GetIntArg (INT16 n, INT32 *val) -{ - CHAR s[64]; - INT32 k, d, i; - s[0] = 0x00; - Platform_GetArg(n, (void*)s, 64); - i = 0; - if (s[0] == '-') { - i = 1; - } - k = 0; - d = (INT16)s[__X(i, 64)] - 48; - while ((d >= 0 && d <= 9)) { - k = k * 10 + d; - i += 1; - d = (INT16)s[__X(i, 64)] - 48; - } - if (s[0] == '-') { - k = -k; - i -= 1; - } - if (i > 0) { - *val = k; - } -} - -INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len) -{ - INT16 i; - CHAR arg[256]; - __DUP(s, s__len, CHAR); - i = 0; - Platform_GetArg(i, (void*)arg, 256); - while ((i < Platform_ArgCount && __STRCMP(s, arg) != 0)) { - i += 1; - Platform_GetArg(i, (void*)arg, 256); - } - __DEL(s); - return i; -} - void Platform_SetInterruptHandler (Platform_SignalHandler handler) { Platform_sethandler(2, handler); @@ -587,7 +505,6 @@ export void *Platform__init(void) __INITYP(Platform_FileIdentity, Platform_FileIdentity, 0); /* BEGIN */ Platform_TestLittleEndian(); - Platform_HaltHandler = NIL; Platform_TimeStart = 0; Platform_TimeStart = Platform_Time(); Platform_PID = Platform_getpid(); diff --git a/bootstrap/unix-48/Platform.h b/bootstrap/unix-48/Platform.h index 315a17e0..9be32cda 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h @@ -16,18 +16,14 @@ typedef import BOOLEAN Platform_LittleEndian; -import INT32 Platform_MainStackFrame; import INT16 Platform_PID; import CHAR Platform_CWD[256]; -import INT16 Platform_ArgCount; -import INT32 Platform_ArgVector; import INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; import CHAR Platform_NL[3]; import ADDRESS *Platform_FileIdentity__typ; import BOOLEAN Platform_Absent (INT16 e); -import INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); import INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); import INT16 Platform_Close (INT32 h); import BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -35,15 +31,12 @@ import void Platform_Delay (INT32 ms); import BOOLEAN Platform_DifferentFilesystems (INT16 e); import INT16 Platform_Error (void); import void Platform_Exit (INT32 code); -import void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); import void Platform_GetClock (INT32 *t, INT32 *d); import void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -import void Platform_GetIntArg (INT16 n, INT32 *val); import void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); import INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); import INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); import BOOLEAN Platform_Inaccessible (INT16 e); -import void Platform_Init (INT32 argc, INT32 argvadr); import BOOLEAN Platform_Interrupted (INT16 e); import BOOLEAN Platform_IsConsole (INT32 h); import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); diff --git a/bootstrap/unix-48/Reals.c b/bootstrap/unix-48/Reals.c index ee1f94ca..e4149017 100644 --- a/bootstrap/unix-48/Reals.c +++ b/bootstrap/unix-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Reals.h b/bootstrap/unix-48/Reals.h index 16a16b7a..e3bfadb5 100644 --- a/bootstrap/unix-48/Reals.h +++ b/bootstrap/unix-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-48/Strings.c b/bootstrap/unix-48/Strings.c index b60bb504..a3f1e808 100644 --- a/bootstrap/unix-48/Strings.c +++ b/bootstrap/unix-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/Strings.h b/bootstrap/unix-48/Strings.h index adf86c42..b192b7bb 100644 --- a/bootstrap/unix-48/Strings.h +++ b/bootstrap/unix-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-48/Texts.c b/bootstrap/unix-48/Texts.c index c9010809..4fa93c49 100644 --- a/bootstrap/unix-48/Texts.c +++ b/bootstrap/unix-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -394,8 +394,8 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, ADDRESS *msg__t e->file = (*(Texts_Alien*)&E)->file; e->org = (*(Texts_Alien*)&E)->org; e->span = (*(Texts_Alien*)&E)->span; - __COPY((*(Texts_Alien*)&E)->mod, e->mod, 32); - __COPY((*(Texts_Alien*)&E)->proc, e->proc, 32); + __MOVE((*(Texts_Alien*)&E)->mod, e->mod, 32); + __MOVE((*(Texts_Alien*)&E)->proc, e->proc, 32); (*msg__).e = (Texts_Elem)e; } else __WITHCHK; } else if (__IS(msg__typ, Texts_IdentifyMsg, 1)) { diff --git a/bootstrap/unix-48/Texts.h b/bootstrap/unix-48/Texts.h index 16b07b6f..235cecb4 100644 --- a/bootstrap/unix-48/Texts.h +++ b/bootstrap/unix-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-48/VT100.c b/bootstrap/unix-48/VT100.c index f0e444ea..7a2a840d 100644 --- a/bootstrap/unix-48/VT100.c +++ b/bootstrap/unix-48/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/VT100.h b/bootstrap/unix-48/VT100.h index 0f1bc5ac..5a3fe6d0 100644 --- a/bootstrap/unix-48/VT100.h +++ b/bootstrap/unix-48/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/unix-48/extTools.c b/bootstrap/unix-48/extTools.c index 43e5cb69..657534b4 100644 --- a/bootstrap/unix-48/extTools.c +++ b/bootstrap/unix-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-48/extTools.h b/bootstrap/unix-48/extTools.h index 784b684d..6ad7abb0 100644 --- a/bootstrap/unix-48/extTools.h +++ b/bootstrap/unix-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/unix-88/Compiler.c b/bootstrap/unix-88/Compiler.c index 29524a91..e59d7615 100644 --- a/bootstrap/unix-88/Compiler.c +++ b/bootstrap/unix-88/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Configuration.c b/bootstrap/unix-88/Configuration.c index 54214f70..01281cfc 100644 --- a/bootstrap/unix-88/Configuration.c +++ b/bootstrap/unix-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/unix-88/Configuration.h b/bootstrap/unix-88/Configuration.h index 1e6381e9..98f85767 100644 --- a/bootstrap/unix-88/Configuration.h +++ b/bootstrap/unix-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/unix-88/Files.c b/bootstrap/unix-88/Files.c index e2cf2f3a..0c219af5 100644 --- a/bootstrap/unix-88/Files.c +++ b/bootstrap/unix-88/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -237,7 +237,7 @@ static void Files_Deregister (CHAR *name, ADDRESS name__len) if (osfile != NIL) { __ASSERT(!osfile->tempFile, 0); __ASSERT(osfile->fd >= 0, 0); - __COPY(osfile->workName, osfile->registerName, 101); + __MOVE(osfile->workName, osfile->registerName, 101); Files_GetTempName(osfile->registerName, 101, (void*)osfile->workName, 101); osfile->tempFile = 1; osfile->state = 0; @@ -262,7 +262,7 @@ static void Files_Create (Files_File f) } else { __ASSERT(f->state == 2, 0); Files_Deregister(f->registerName, 101); - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } @@ -823,7 +823,7 @@ void Files_Register (Files_File f) if (errcode != 0) { Files_Err((CHAR*)"Couldn't rename temp name as register name", 43, f, errcode); } - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } diff --git a/bootstrap/unix-88/Files.h b/bootstrap/unix-88/Files.h index 0da4768b..4a1cbfe9 100644 --- a/bootstrap/unix-88/Files.h +++ b/bootstrap/unix-88/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/unix-88/Heap.c b/bootstrap/unix-88/Heap.c index 95dd55ee..222162d5 100644 --- a/bootstrap/unix-88/Heap.c +++ b/bootstrap/unix-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -105,12 +105,12 @@ static void Heap_Sift (INT64 l, INT64 r, INT64 *a, ADDRESS a__len); export void Heap_Unlock (void); extern void *Heap__init(); -extern ADDRESS Platform_MainStackFrame; +extern ADDRESS Modules_MainStackFrame; extern ADDRESS Platform_OSAllocate(ADDRESS size); #define Heap_HeapModuleInit() Heap__init() #define Heap_ModulesHalt(code) Modules_Halt(code) +#define Heap_ModulesMainStackFrame() Modules_MainStackFrame #define Heap_OSAllocate(size) Platform_OSAllocate(size) -#define Heap_PlatformMainStackFrame() Platform_MainStackFrame void Heap_Lock (void) { @@ -599,7 +599,7 @@ static void Heap_MarkStack (INT64 n, INT64 *cand, ADDRESS cand__len) if (n == 0) { nofcand = 0; sp = (ADDRESS)&frame; - stack0 = Heap_PlatformMainStackFrame(); + stack0 = Heap_ModulesMainStackFrame(); inc = (ADDRESS)&align.p - (ADDRESS)&align; if (sp > stack0) { inc = -inc; diff --git a/bootstrap/unix-88/Heap.h b/bootstrap/unix-88/Heap.h index b96e0160..585db2f0 100644 --- a/bootstrap/unix-88/Heap.h +++ b/bootstrap/unix-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/unix-88/Modules.c b/bootstrap/unix-88/Modules.c index 9b72d021..b0cf5fd9 100644 --- a/bootstrap/unix-88/Modules.c +++ b/bootstrap/unix-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -43,24 +43,105 @@ typedef export INT16 Modules_res; export CHAR Modules_resMsg[256]; export Modules_ModuleName Modules_imported, Modules_importing; +export INT64 Modules_MainStackFrame; +export INT16 Modules_ArgCount; +export INT64 Modules_ArgVector; export ADDRESS *Modules_ModuleDesc__typ; export ADDRESS *Modules_CmdDesc__typ; static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len); +export INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); export void Modules_AssertFail (INT32 code); static void Modules_DisplayHaltCode (INT32 code); export void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +export void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +export void Modules_GetIntArg (INT16 n, INT32 *val); export void Modules_Halt (INT32 code); +export void Modules_Init (INT32 argc, INT64 argvadr); export Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); export Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); static void Modules_errch (CHAR c); static void Modules_errint (INT32 l); static void Modules_errstring (CHAR *s, ADDRESS s__len); +extern void Heap_InitHeap(); +extern void *Modules__init(void); +#define Modules_InitHeap() Heap_InitHeap() +#define Modules_ModulesInit() Modules__init() #define Modules_modules() (Modules_Module)Heap_modules #define Modules_setmodules(m) Heap_modules = m +typedef + INT64 (*ArgVecPtr__14)[1]; + +void Modules_Init (INT32 argc, INT64 argvadr) +{ + ArgVecPtr__14 av = NIL; + Modules_MainStackFrame = argvadr; + Modules_ArgCount = __VAL(INT16, argc); + av = (ArgVecPtr__14)(ADDRESS)argvadr; + Modules_ArgVector = (*av)[0]; + Modules_InitHeap(); + Modules_ModulesInit(); +} + +typedef + CHAR (*ArgPtr__9)[1024]; + +typedef + ArgPtr__9 (*ArgVec__10)[1024]; + +void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len) +{ + ArgVec__10 av = NIL; + if (n < Modules_ArgCount) { + av = (ArgVec__10)(ADDRESS)Modules_ArgVector; + __COPY(*(*av)[__X(n, 1024)], val, val__len); + } +} + +void Modules_GetIntArg (INT16 n, INT32 *val) +{ + CHAR s[64]; + INT32 k, d, i; + s[0] = 0x00; + Modules_GetArg(n, (void*)s, 64); + i = 0; + if (s[0] == '-') { + i = 1; + } + k = 0; + d = (INT16)s[__X(i, 64)] - 48; + while ((d >= 0 && d <= 9)) { + k = k * 10 + d; + i += 1; + d = (INT16)s[__X(i, 64)] - 48; + } + if (s[0] == '-') { + k = -k; + i -= 1; + } + if (i > 0) { + *val = k; + } +} + +INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len) +{ + INT16 i; + CHAR arg[256]; + __DUP(s, s__len, CHAR); + i = 0; + Modules_GetArg(i, (void*)arg, 256); + while ((i < Modules_ArgCount && __STRCMP(s, arg) != 0)) { + i += 1; + Modules_GetArg(i, (void*)arg, 256); + } + __DEL(s); + return i; +} + static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len) { INT16 i, j; diff --git a/bootstrap/unix-88/Modules.h b/bootstrap/unix-88/Modules.h index 568db414..a3e555ef 100644 --- a/bootstrap/unix-88/Modules.h +++ b/bootstrap/unix-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h @@ -39,13 +39,20 @@ typedef import INT16 Modules_res; import CHAR Modules_resMsg[256]; import Modules_ModuleName Modules_imported, Modules_importing; +import INT64 Modules_MainStackFrame; +import INT16 Modules_ArgCount; +import INT64 Modules_ArgVector; import ADDRESS *Modules_ModuleDesc__typ; import ADDRESS *Modules_CmdDesc__typ; +import INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); import void Modules_AssertFail (INT32 code); import void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +import void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +import void Modules_GetIntArg (INT16 n, INT32 *val); import void Modules_Halt (INT32 code); +import void Modules_Init (INT32 argc, INT64 argvadr); import Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); import Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); import void *Modules__init(void); diff --git a/bootstrap/unix-88/OPB.c b/bootstrap/unix-88/OPB.c index 2e03b5fc..d9e826b8 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -253,7 +253,7 @@ OPT_Node OPB_NewString (OPS_String str, INT64 len) x->conval->intval = -1; x->conval->intval2 = OPM_Longint(len); x->conval->ext = OPT_NewExt(); - __COPY(str, *x->conval->ext, 256); + __MOVE(str, *x->conval->ext, 256); return x; } @@ -1624,23 +1624,19 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) g = 8; } if (x == y) { + } else if ((((y->comp == 2 && y->BaseTyp == x->BaseTyp)) && y->n <= x->n)) { + } else if ((y->comp == 3 && y->BaseTyp == x->BaseTyp)) { } else if (x->BaseTyp == OPT_chartyp) { if (g == 8) { if (ynode->conval->intval2 > x->n) { OPB_err(114); } - } else if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { } else { OPB_err(113); } } else { OPB_err(113); } - } else if ((x->comp == 3 && x->BaseTyp == OPT_chartyp)) { - if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { - } else { - OPB_err(113); - } } else if (x->comp == 4) { if (x == y) { } else if (y->comp == 4) { @@ -2536,7 +2532,6 @@ void OPB_Return (OPT_Node *x, OPT_Object proc) void OPB_Assign (OPT_Node *x, OPT_Node y) { OPT_Node z = NIL; - INT8 subcl; if ((*x)->class >= 7) { OPB_err(56); } @@ -2562,13 +2557,8 @@ void OPB_Assign (OPT_Node *x, OPT_Node y) y->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(0)); } - if ((((((__IN((*x)->typ->comp, 0x0c, 32) && (*x)->typ->BaseTyp == OPT_chartyp)) && __IN(y->typ->comp, 0x0c, 32))) && y->typ->BaseTyp == OPT_chartyp)) { - subcl = 18; - } else { - subcl = 0; - } OPB_BindNodes(19, OPT_notyp, &*x, y); - (*x)->subcl = subcl; + (*x)->subcl = 0; } void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ) diff --git a/bootstrap/unix-88/OPB.h b/bootstrap/unix-88/OPB.h index 6641207d..2c396170 100644 --- a/bootstrap/unix-88/OPB.h +++ b/bootstrap/unix-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/unix-88/OPC.c b/bootstrap/unix-88/OPC.c index fd11366a..5f4dc826 100644 --- a/bootstrap/unix-88/OPC.c +++ b/bootstrap/unix-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/OPC.h b/bootstrap/unix-88/OPC.h index 4eff8cf5..f9bc06a4 100644 --- a/bootstrap/unix-88/OPC.h +++ b/bootstrap/unix-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/unix-88/OPM.c b/bootstrap/unix-88/OPM.c index e4915a3e..f52cb5e2 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -8,6 +8,7 @@ #include "SYSTEM.h" #include "Configuration.h" #include "Files.h" +#include "Modules.h" #include "Out.h" #include "Platform.h" #include "Strings.h" @@ -266,7 +267,7 @@ static void OPM_ScanOptions (CHAR *s, ADDRESS s__len) BOOLEAN OPM_OpenPar (void) { CHAR s[256]; - if (Platform_ArgCount == 1) { + if (Modules_ArgCount == 1) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"Oberon-2 compiler v", 20); OPM_LogWStr(Configuration_versionLong, 75); @@ -362,16 +363,16 @@ BOOLEAN OPM_OpenPar (void) OPM_Options = 0xa9; OPM_S = 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } OPM_GlobalAddressSize = OPM_AddressSize; OPM_GlobalAlignment = OPM_Alignment; - __COPY(OPM_Model, OPM_GlobalModel, 10); + __MOVE(OPM_Model, OPM_GlobalModel, 10); OPM_GlobalOptions = OPM_Options; return 1; } @@ -410,16 +411,16 @@ void OPM_InitOptions (void) CHAR searchpath[1024], modules[1024]; CHAR MODULES[1024]; OPM_Options = OPM_GlobalOptions; - __COPY(OPM_GlobalModel, OPM_Model, 10); + __MOVE(OPM_GlobalModel, OPM_Model, 10); OPM_Alignment = OPM_GlobalAlignment; OPM_AddressSize = OPM_GlobalAddressSize; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } if (__IN(15, OPM_Options, 32)) { OPM_Options |= __SETOF(10,32); @@ -472,11 +473,11 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) CHAR s[256]; *done = 0; OPM_curpos = 0; - if (OPM_S >= Platform_ArgCount) { + if (OPM_S >= Modules_ArgCount) { return; } s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); __NEW(T, Texts_TextDesc); Texts_Open(T, s, 256); OPM_LogWStr(s, 256); @@ -1070,6 +1071,7 @@ export void *OPM__init(void) __DEFMOD; __MODULE_IMPORT(Configuration); __MODULE_IMPORT(Files); + __MODULE_IMPORT(Modules); __MODULE_IMPORT(Out); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); diff --git a/bootstrap/unix-88/OPM.h b/bootstrap/unix-88/OPM.h index 4dd3d03b..979995c8 100644 --- a/bootstrap/unix-88/OPM.h +++ b/bootstrap/unix-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/unix-88/OPP.c b/bootstrap/unix-88/OPP.c index a08cee09..954279d4 100644 --- a/bootstrap/unix-88/OPP.c +++ b/bootstrap/unix-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -527,7 +527,7 @@ static void OPP_selector (OPT_Node *x) } else if (OPP_sym == 18) { OPS_Get(&OPP_sym); if (OPP_sym == 38) { - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPS_Get(&OPP_sym); if ((*x)->typ != NIL) { if ((*x)->typ->form == 11) { @@ -867,7 +867,7 @@ static void OPP_Receiver (INT8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct } else { *mode = 1; } - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckSym(38); OPP_CheckSym(20); if (OPP_sym == 38) { @@ -1030,7 +1030,7 @@ static void TProcDecl__23 (void) } OPP_Receiver(&objMode, objName, &objTyp, &recTyp); if (OPP_sym == 38) { - __COPY(OPS_name, *ProcedureDeclaration__16_s->name, 256); + __MOVE(OPS_name, *ProcedureDeclaration__16_s->name, 256); OPP_CheckMark(&*ProcedureDeclaration__16_s->vis); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp, &*ProcedureDeclaration__16_s->fwd); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp->BaseTyp, &baseProc); @@ -1129,7 +1129,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) TProcDecl__23(); } else if (OPP_sym == 38) { OPT_Find(&fwd); - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckMark(&vis); if ((vis != 0 && mode == 6)) { mode = 7; diff --git a/bootstrap/unix-88/OPP.h b/bootstrap/unix-88/OPP.h index 2814e733..b748e221 100644 --- a/bootstrap/unix-88/OPP.h +++ b/bootstrap/unix-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/unix-88/OPS.c b/bootstrap/unix-88/OPS.c index 7218afe1..eee78d80 100644 --- a/bootstrap/unix-88/OPS.c +++ b/bootstrap/unix-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/OPS.h b/bootstrap/unix-88/OPS.h index a860454b..7ab70899 100644 --- a/bootstrap/unix-88/OPS.h +++ b/bootstrap/unix-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/unix-88/OPT.c b/bootstrap/unix-88/OPT.c index de44eed9..b58d6175 100644 --- a/bootstrap/unix-88/OPT.c +++ b/bootstrap/unix-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -434,8 +434,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); OPT_SYSimported = 0; - __COPY(name, OPT_SelfName, 256); - __COPY(name, OPT_topScope->name, 256); + __MOVE(name, OPT_SelfName, 256); + __MOVE(name, OPT_topScope->name, 256); OPT_GlbMod[0] = OPT_topScope; OPT_nofGmod = 1; OPT_newsf = __IN(4, opt, 32); @@ -1186,7 +1186,7 @@ static void OPT_InStruct (OPT_Struct *typ) } *typ = OPT_NewStr(0, 1); } else { - __COPY(name, obj->name, 256); + __MOVE(name, obj->name, 256); OPT_InsertImport(obj, &OPT_GlbMod[__X(mno, 64)]->right, &old); if (old != NIL) { OPT_FPrintObj(old); diff --git a/bootstrap/unix-88/OPT.h b/bootstrap/unix-88/OPT.h index 86256024..67996e8e 100644 --- a/bootstrap/unix-88/OPT.h +++ b/bootstrap/unix-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/unix-88/OPV.c b/bootstrap/unix-88/OPV.c index 7a7ce5c1..22c12372 100644 --- a/bootstrap/unix-88/OPV.c +++ b/bootstrap/unix-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -163,7 +163,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte } scope = obj->scope; scope->leaf = 1; - __COPY(obj->name, scope->name, 256); + __MOVE(obj->name, scope->name, 256); OPV_Stamp(scope->name); if (mode == 9) { obj->adr = 1; @@ -1286,7 +1286,17 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) OPM_WriteString((CHAR*)", ", 3); if (r->typ == OPT_stringtyp) { OPM_WriteInt(r->conval->intval2); + } else if (r->typ->comp == 3) { + OPM_WriteString((CHAR*)"__X(", 5); + OPC_Len(r->obj, r->typ, 0); + OPM_WriteString((CHAR*)" * ", 4); + OPM_WriteInt(r->typ->BaseTyp->size); + OPM_WriteString((CHAR*)", ", 3); + OPM_WriteInt(l->typ->size); + OPM_Write(')'); } else { + __ASSERT(r->typ->comp == 2, 0); + __ASSERT(r->typ->size <= l->typ->size, 0); OPM_WriteInt(r->typ->size); } OPM_Write(')'); diff --git a/bootstrap/unix-88/OPV.h b/bootstrap/unix-88/OPV.h index 9a8653a0..43aaf24a 100644 --- a/bootstrap/unix-88/OPV.h +++ b/bootstrap/unix-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/unix-88/Out.c b/bootstrap/unix-88/Out.c index 1508a8bb..a03cf592 100644 --- a/bootstrap/unix-88/Out.c +++ b/bootstrap/unix-88/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Out.h b/bootstrap/unix-88/Out.h index b273390e..27f2c9bb 100644 --- a/bootstrap/unix-88/Out.h +++ b/bootstrap/unix-88/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/unix-88/Platform.c b/bootstrap/unix-88/Platform.c index a211fab4..eadd3813 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -7,37 +7,18 @@ #include "SYSTEM.h" -typedef - CHAR (*Platform_ArgPtr)[1024]; - -typedef - Platform_ArgPtr (*Platform_ArgVec)[1024]; - -typedef - INT64 (*Platform_ArgVecPtr)[1]; - -typedef - CHAR (*Platform_EnvPtr)[1024]; - typedef struct Platform_FileIdentity { INT32 volume, index, mtime; } Platform_FileIdentity; -typedef - void (*Platform_HaltProcedure)(INT32); - typedef void (*Platform_SignalHandler)(INT32); export BOOLEAN Platform_LittleEndian; -export INT64 Platform_MainStackFrame; export INT16 Platform_PID; export CHAR Platform_CWD[256]; -export INT16 Platform_ArgCount; -export INT64 Platform_ArgVector; -static Platform_HaltProcedure Platform_HaltHandler; static INT32 Platform_TimeStart; export INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; export CHAR Platform_NL[3]; @@ -45,7 +26,6 @@ export CHAR Platform_NL[3]; export ADDRESS *Platform_FileIdentity__typ; export BOOLEAN Platform_Absent (INT16 e); -export INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); export INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); export INT16 Platform_Close (INT32 h); export BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -53,15 +33,12 @@ export void Platform_Delay (INT32 ms); export BOOLEAN Platform_DifferentFilesystems (INT16 e); export INT16 Platform_Error (void); export void Platform_Exit (INT32 code); -export void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); export void Platform_GetClock (INT32 *t, INT32 *d); export void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -export void Platform_GetIntArg (INT16 n, INT32 *val); export void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); export INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); export INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); export BOOLEAN Platform_Inaccessible (INT16 e); -export void Platform_Init (INT32 argc, INT64 argvadr); export BOOLEAN Platform_Interrupted (INT16 e); export BOOLEAN Platform_IsConsole (INT32 h); export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); @@ -117,8 +94,6 @@ export BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS #define Platform_EROFS() EROFS #define Platform_ETIMEDOUT() ETIMEDOUT #define Platform_EXDEV() EXDEV -extern void Heap_InitHeap(); -#define Platform_HeapInitHeap() Heap_InitHeap() #define Platform_allocate(size) (ADDRESS)((void*)malloc((size_t)size)) #define Platform_chdir(n, n__len) chdir((char*)n) #define Platform_closefile(fd) close(fd) @@ -129,7 +104,7 @@ extern void Heap_InitHeap(); #define Platform_fsync(fd) fsync(fd) #define Platform_ftruncate(fd, l) ftruncate(fd, l) #define Platform_getcwd(cwd, cwd__len) getcwd((char*)cwd, cwd__len) -#define Platform_getenv(var, var__len) (Platform_EnvPtr)getenv((char*)var) +#define Platform_getenv(var, var__len) getenv((char*)var) #define Platform_getpid() (INTEGER)getpid() #define Platform_gettimeval() struct timeval tv; gettimeofday(&tv,0) #define Platform_isatty(fd) isatty(fd) @@ -213,21 +188,14 @@ void Platform_OSFree (INT64 address) Platform_free(address); } -void Platform_Init (INT32 argc, INT64 argvadr) -{ - Platform_ArgVecPtr av = NIL; - Platform_MainStackFrame = argvadr; - Platform_ArgCount = __VAL(INT16, argc); - av = (Platform_ArgVecPtr)(ADDRESS)argvadr; - Platform_ArgVector = (*av)[0]; - Platform_HeapInitHeap(); -} +typedef + CHAR (*EnvPtr__78)[1024]; BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) { - Platform_EnvPtr p = NIL; + EnvPtr__78 p = NIL; __DUP(var, var__len, CHAR); - p = Platform_getenv(var, var__len); + p = (EnvPtr__78)(ADDRESS)Platform_getenv(var, var__len); if (p != NIL) { __COPY(*p, val, val__len); } @@ -244,56 +212,6 @@ void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) __DEL(var); } -void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len) -{ - Platform_ArgVec av = NIL; - if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector; - __COPY(*(*av)[__X(n, 1024)], val, val__len); - } -} - -void Platform_GetIntArg (INT16 n, INT32 *val) -{ - CHAR s[64]; - INT32 k, d, i; - s[0] = 0x00; - Platform_GetArg(n, (void*)s, 64); - i = 0; - if (s[0] == '-') { - i = 1; - } - k = 0; - d = (INT16)s[__X(i, 64)] - 48; - while ((d >= 0 && d <= 9)) { - k = k * 10 + d; - i += 1; - d = (INT16)s[__X(i, 64)] - 48; - } - if (s[0] == '-') { - k = -k; - i -= 1; - } - if (i > 0) { - *val = k; - } -} - -INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len) -{ - INT16 i; - CHAR arg[256]; - __DUP(s, s__len, CHAR); - i = 0; - Platform_GetArg(i, (void*)arg, 256); - while ((i < Platform_ArgCount && __STRCMP(s, arg) != 0)) { - i += 1; - Platform_GetArg(i, (void*)arg, 256); - } - __DEL(s); - return i; -} - void Platform_SetInterruptHandler (Platform_SignalHandler handler) { Platform_sethandler(2, handler); @@ -587,7 +505,6 @@ export void *Platform__init(void) __INITYP(Platform_FileIdentity, Platform_FileIdentity, 0); /* BEGIN */ Platform_TestLittleEndian(); - Platform_HaltHandler = NIL; Platform_TimeStart = 0; Platform_TimeStart = Platform_Time(); Platform_PID = Platform_getpid(); diff --git a/bootstrap/unix-88/Platform.h b/bootstrap/unix-88/Platform.h index 131a8aa8..ee748a4f 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h @@ -16,18 +16,14 @@ typedef import BOOLEAN Platform_LittleEndian; -import INT64 Platform_MainStackFrame; import INT16 Platform_PID; import CHAR Platform_CWD[256]; -import INT16 Platform_ArgCount; -import INT64 Platform_ArgVector; import INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; import CHAR Platform_NL[3]; import ADDRESS *Platform_FileIdentity__typ; import BOOLEAN Platform_Absent (INT16 e); -import INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); import INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); import INT16 Platform_Close (INT32 h); import BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -35,15 +31,12 @@ import void Platform_Delay (INT32 ms); import BOOLEAN Platform_DifferentFilesystems (INT16 e); import INT16 Platform_Error (void); import void Platform_Exit (INT32 code); -import void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); import void Platform_GetClock (INT32 *t, INT32 *d); import void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -import void Platform_GetIntArg (INT16 n, INT32 *val); import void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); import INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); import INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); import BOOLEAN Platform_Inaccessible (INT16 e); -import void Platform_Init (INT32 argc, INT64 argvadr); import BOOLEAN Platform_Interrupted (INT16 e); import BOOLEAN Platform_IsConsole (INT32 h); import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); diff --git a/bootstrap/unix-88/Reals.c b/bootstrap/unix-88/Reals.c index ee1f94ca..e4149017 100644 --- a/bootstrap/unix-88/Reals.c +++ b/bootstrap/unix-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Reals.h b/bootstrap/unix-88/Reals.h index 16a16b7a..e3bfadb5 100644 --- a/bootstrap/unix-88/Reals.h +++ b/bootstrap/unix-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/unix-88/Strings.c b/bootstrap/unix-88/Strings.c index b60bb504..a3f1e808 100644 --- a/bootstrap/unix-88/Strings.c +++ b/bootstrap/unix-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/Strings.h b/bootstrap/unix-88/Strings.h index adf86c42..b192b7bb 100644 --- a/bootstrap/unix-88/Strings.h +++ b/bootstrap/unix-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/unix-88/Texts.c b/bootstrap/unix-88/Texts.c index 0bb7d871..a7cc3ff1 100644 --- a/bootstrap/unix-88/Texts.c +++ b/bootstrap/unix-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -394,8 +394,8 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, ADDRESS *msg__t e->file = (*(Texts_Alien*)&E)->file; e->org = (*(Texts_Alien*)&E)->org; e->span = (*(Texts_Alien*)&E)->span; - __COPY((*(Texts_Alien*)&E)->mod, e->mod, 32); - __COPY((*(Texts_Alien*)&E)->proc, e->proc, 32); + __MOVE((*(Texts_Alien*)&E)->mod, e->mod, 32); + __MOVE((*(Texts_Alien*)&E)->proc, e->proc, 32); (*msg__).e = (Texts_Elem)e; } else __WITHCHK; } else if (__IS(msg__typ, Texts_IdentifyMsg, 1)) { diff --git a/bootstrap/unix-88/Texts.h b/bootstrap/unix-88/Texts.h index b1eafc02..8c1b9016 100644 --- a/bootstrap/unix-88/Texts.h +++ b/bootstrap/unix-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/unix-88/VT100.c b/bootstrap/unix-88/VT100.c index f0e444ea..7a2a840d 100644 --- a/bootstrap/unix-88/VT100.c +++ b/bootstrap/unix-88/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/VT100.h b/bootstrap/unix-88/VT100.h index 0f1bc5ac..5a3fe6d0 100644 --- a/bootstrap/unix-88/VT100.h +++ b/bootstrap/unix-88/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/unix-88/extTools.c b/bootstrap/unix-88/extTools.c index 43e5cb69..657534b4 100644 --- a/bootstrap/unix-88/extTools.c +++ b/bootstrap/unix-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/unix-88/extTools.h b/bootstrap/unix-88/extTools.h index 784b684d..6ad7abb0 100644 --- a/bootstrap/unix-88/extTools.h +++ b/bootstrap/unix-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-48/Compiler.c b/bootstrap/windows-48/Compiler.c index 29524a91..e59d7615 100644 --- a/bootstrap/windows-48/Compiler.c +++ b/bootstrap/windows-48/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Configuration.c b/bootstrap/windows-48/Configuration.c index 54214f70..01281cfc 100644 --- a/bootstrap/windows-48/Configuration.c +++ b/bootstrap/windows-48/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/windows-48/Configuration.h b/bootstrap/windows-48/Configuration.h index 1e6381e9..98f85767 100644 --- a/bootstrap/windows-48/Configuration.h +++ b/bootstrap/windows-48/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-48/Files.c b/bootstrap/windows-48/Files.c index aa879424..841d80d9 100644 --- a/bootstrap/windows-48/Files.c +++ b/bootstrap/windows-48/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -237,7 +237,7 @@ static void Files_Deregister (CHAR *name, ADDRESS name__len) if (osfile != NIL) { __ASSERT(!osfile->tempFile, 0); __ASSERT(osfile->fd >= 0, 0); - __COPY(osfile->workName, osfile->registerName, 101); + __MOVE(osfile->workName, osfile->registerName, 101); Files_GetTempName(osfile->registerName, 101, (void*)osfile->workName, 101); osfile->tempFile = 1; osfile->state = 0; @@ -262,7 +262,7 @@ static void Files_Create (Files_File f) } else { __ASSERT(f->state == 2, 0); Files_Deregister(f->registerName, 101); - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } @@ -823,7 +823,7 @@ void Files_Register (Files_File f) if (errcode != 0) { Files_Err((CHAR*)"Couldn't rename temp name as register name", 43, f, errcode); } - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } diff --git a/bootstrap/windows-48/Files.h b/bootstrap/windows-48/Files.h index fa8f3e8d..dab76a88 100644 --- a/bootstrap/windows-48/Files.h +++ b/bootstrap/windows-48/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-48/Heap.c b/bootstrap/windows-48/Heap.c index af8fd777..b6abc8f3 100644 --- a/bootstrap/windows-48/Heap.c +++ b/bootstrap/windows-48/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -105,12 +105,12 @@ static void Heap_Sift (INT32 l, INT32 r, INT32 *a, ADDRESS a__len); export void Heap_Unlock (void); extern void *Heap__init(); -extern ADDRESS Platform_MainStackFrame; +extern ADDRESS Modules_MainStackFrame; extern ADDRESS Platform_OSAllocate(ADDRESS size); #define Heap_HeapModuleInit() Heap__init() #define Heap_ModulesHalt(code) Modules_Halt(code) +#define Heap_ModulesMainStackFrame() Modules_MainStackFrame #define Heap_OSAllocate(size) Platform_OSAllocate(size) -#define Heap_PlatformMainStackFrame() Platform_MainStackFrame void Heap_Lock (void) { @@ -599,7 +599,7 @@ static void Heap_MarkStack (INT32 n, INT32 *cand, ADDRESS cand__len) if (n == 0) { nofcand = 0; sp = (ADDRESS)&frame; - stack0 = Heap_PlatformMainStackFrame(); + stack0 = Heap_ModulesMainStackFrame(); inc = (ADDRESS)&align.p - (ADDRESS)&align; if (sp > stack0) { inc = -inc; diff --git a/bootstrap/windows-48/Heap.h b/bootstrap/windows-48/Heap.h index cc058553..82ebd04d 100644 --- a/bootstrap/windows-48/Heap.h +++ b/bootstrap/windows-48/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-48/Modules.c b/bootstrap/windows-48/Modules.c index 9aedc826..98b3a7e9 100644 --- a/bootstrap/windows-48/Modules.c +++ b/bootstrap/windows-48/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -43,24 +43,105 @@ typedef export INT16 Modules_res; export CHAR Modules_resMsg[256]; export Modules_ModuleName Modules_imported, Modules_importing; +export INT32 Modules_MainStackFrame; +export INT16 Modules_ArgCount; +export INT32 Modules_ArgVector; export ADDRESS *Modules_ModuleDesc__typ; export ADDRESS *Modules_CmdDesc__typ; static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len); +export INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); export void Modules_AssertFail (INT32 code); static void Modules_DisplayHaltCode (INT32 code); export void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +export void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +export void Modules_GetIntArg (INT16 n, INT32 *val); export void Modules_Halt (INT32 code); +export void Modules_Init (INT32 argc, INT32 argvadr); export Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); export Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); static void Modules_errch (CHAR c); static void Modules_errint (INT32 l); static void Modules_errstring (CHAR *s, ADDRESS s__len); +extern void Heap_InitHeap(); +extern void *Modules__init(void); +#define Modules_InitHeap() Heap_InitHeap() +#define Modules_ModulesInit() Modules__init() #define Modules_modules() (Modules_Module)Heap_modules #define Modules_setmodules(m) Heap_modules = m +typedef + INT32 (*ArgVecPtr__14)[1]; + +void Modules_Init (INT32 argc, INT32 argvadr) +{ + ArgVecPtr__14 av = NIL; + Modules_MainStackFrame = argvadr; + Modules_ArgCount = __VAL(INT16, argc); + av = (ArgVecPtr__14)(ADDRESS)argvadr; + Modules_ArgVector = (*av)[0]; + Modules_InitHeap(); + Modules_ModulesInit(); +} + +typedef + CHAR (*ArgPtr__9)[1024]; + +typedef + ArgPtr__9 (*ArgVec__10)[1024]; + +void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len) +{ + ArgVec__10 av = NIL; + if (n < Modules_ArgCount) { + av = (ArgVec__10)(ADDRESS)Modules_ArgVector; + __COPY(*(*av)[__X(n, 1024)], val, val__len); + } +} + +void Modules_GetIntArg (INT16 n, INT32 *val) +{ + CHAR s[64]; + INT32 k, d, i; + s[0] = 0x00; + Modules_GetArg(n, (void*)s, 64); + i = 0; + if (s[0] == '-') { + i = 1; + } + k = 0; + d = (INT16)s[__X(i, 64)] - 48; + while ((d >= 0 && d <= 9)) { + k = k * 10 + d; + i += 1; + d = (INT16)s[__X(i, 64)] - 48; + } + if (s[0] == '-') { + k = -k; + i -= 1; + } + if (i > 0) { + *val = k; + } +} + +INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len) +{ + INT16 i; + CHAR arg[256]; + __DUP(s, s__len, CHAR); + i = 0; + Modules_GetArg(i, (void*)arg, 256); + while ((i < Modules_ArgCount && __STRCMP(s, arg) != 0)) { + i += 1; + Modules_GetArg(i, (void*)arg, 256); + } + __DEL(s); + return i; +} + static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len) { INT16 i, j; @@ -165,7 +246,7 @@ void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all) static void Modules_errch (CHAR c) { INT16 e; - e = Platform_Write(1, (ADDRESS)&c, 1); + e = Platform_Write(Platform_StdOut, (ADDRESS)&c, 1); } static void Modules_errstring (CHAR *s, ADDRESS s__len) diff --git a/bootstrap/windows-48/Modules.h b/bootstrap/windows-48/Modules.h index 568db414..3ab94701 100644 --- a/bootstrap/windows-48/Modules.h +++ b/bootstrap/windows-48/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h @@ -39,13 +39,20 @@ typedef import INT16 Modules_res; import CHAR Modules_resMsg[256]; import Modules_ModuleName Modules_imported, Modules_importing; +import INT32 Modules_MainStackFrame; +import INT16 Modules_ArgCount; +import INT32 Modules_ArgVector; import ADDRESS *Modules_ModuleDesc__typ; import ADDRESS *Modules_CmdDesc__typ; +import INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); import void Modules_AssertFail (INT32 code); import void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +import void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +import void Modules_GetIntArg (INT16 n, INT32 *val); import void Modules_Halt (INT32 code); +import void Modules_Init (INT32 argc, INT32 argvadr); import Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); import Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); import void *Modules__init(void); diff --git a/bootstrap/windows-48/OPB.c b/bootstrap/windows-48/OPB.c index 2e03b5fc..d9e826b8 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -253,7 +253,7 @@ OPT_Node OPB_NewString (OPS_String str, INT64 len) x->conval->intval = -1; x->conval->intval2 = OPM_Longint(len); x->conval->ext = OPT_NewExt(); - __COPY(str, *x->conval->ext, 256); + __MOVE(str, *x->conval->ext, 256); return x; } @@ -1624,23 +1624,19 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) g = 8; } if (x == y) { + } else if ((((y->comp == 2 && y->BaseTyp == x->BaseTyp)) && y->n <= x->n)) { + } else if ((y->comp == 3 && y->BaseTyp == x->BaseTyp)) { } else if (x->BaseTyp == OPT_chartyp) { if (g == 8) { if (ynode->conval->intval2 > x->n) { OPB_err(114); } - } else if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { } else { OPB_err(113); } } else { OPB_err(113); } - } else if ((x->comp == 3 && x->BaseTyp == OPT_chartyp)) { - if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { - } else { - OPB_err(113); - } } else if (x->comp == 4) { if (x == y) { } else if (y->comp == 4) { @@ -2536,7 +2532,6 @@ void OPB_Return (OPT_Node *x, OPT_Object proc) void OPB_Assign (OPT_Node *x, OPT_Node y) { OPT_Node z = NIL; - INT8 subcl; if ((*x)->class >= 7) { OPB_err(56); } @@ -2562,13 +2557,8 @@ void OPB_Assign (OPT_Node *x, OPT_Node y) y->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(0)); } - if ((((((__IN((*x)->typ->comp, 0x0c, 32) && (*x)->typ->BaseTyp == OPT_chartyp)) && __IN(y->typ->comp, 0x0c, 32))) && y->typ->BaseTyp == OPT_chartyp)) { - subcl = 18; - } else { - subcl = 0; - } OPB_BindNodes(19, OPT_notyp, &*x, y); - (*x)->subcl = subcl; + (*x)->subcl = 0; } void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ) diff --git a/bootstrap/windows-48/OPB.h b/bootstrap/windows-48/OPB.h index 6641207d..2c396170 100644 --- a/bootstrap/windows-48/OPB.h +++ b/bootstrap/windows-48/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-48/OPC.c b/bootstrap/windows-48/OPC.c index fd11366a..5f4dc826 100644 --- a/bootstrap/windows-48/OPC.c +++ b/bootstrap/windows-48/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/OPC.h b/bootstrap/windows-48/OPC.h index 4eff8cf5..f9bc06a4 100644 --- a/bootstrap/windows-48/OPC.h +++ b/bootstrap/windows-48/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index 58701bfc..1732c950 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -8,6 +8,7 @@ #include "SYSTEM.h" #include "Configuration.h" #include "Files.h" +#include "Modules.h" #include "Out.h" #include "Platform.h" #include "Strings.h" @@ -266,7 +267,7 @@ static void OPM_ScanOptions (CHAR *s, ADDRESS s__len) BOOLEAN OPM_OpenPar (void) { CHAR s[256]; - if (Platform_ArgCount == 1) { + if (Modules_ArgCount == 1) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"Oberon-2 compiler v", 20); OPM_LogWStr(Configuration_versionLong, 75); @@ -362,16 +363,16 @@ BOOLEAN OPM_OpenPar (void) OPM_Options = 0xa9; OPM_S = 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } OPM_GlobalAddressSize = OPM_AddressSize; OPM_GlobalAlignment = OPM_Alignment; - __COPY(OPM_Model, OPM_GlobalModel, 10); + __MOVE(OPM_Model, OPM_GlobalModel, 10); OPM_GlobalOptions = OPM_Options; return 1; } @@ -410,16 +411,16 @@ void OPM_InitOptions (void) CHAR searchpath[1024], modules[1024]; CHAR MODULES[1024]; OPM_Options = OPM_GlobalOptions; - __COPY(OPM_GlobalModel, OPM_Model, 10); + __MOVE(OPM_GlobalModel, OPM_Model, 10); OPM_Alignment = OPM_GlobalAlignment; OPM_AddressSize = OPM_GlobalAddressSize; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } if (__IN(15, OPM_Options, 32)) { OPM_Options |= __SETOF(10,32); @@ -472,11 +473,11 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) CHAR s[256]; *done = 0; OPM_curpos = 0; - if (OPM_S >= Platform_ArgCount) { + if (OPM_S >= Modules_ArgCount) { return; } s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); __NEW(T, Texts_TextDesc); Texts_Open(T, s, 256); OPM_LogWStr(s, 256); @@ -1070,6 +1071,7 @@ export void *OPM__init(void) __DEFMOD; __MODULE_IMPORT(Configuration); __MODULE_IMPORT(Files); + __MODULE_IMPORT(Modules); __MODULE_IMPORT(Out); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); diff --git a/bootstrap/windows-48/OPM.h b/bootstrap/windows-48/OPM.h index 4dd3d03b..979995c8 100644 --- a/bootstrap/windows-48/OPM.h +++ b/bootstrap/windows-48/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/windows-48/OPP.c b/bootstrap/windows-48/OPP.c index d4922137..69624c1f 100644 --- a/bootstrap/windows-48/OPP.c +++ b/bootstrap/windows-48/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -527,7 +527,7 @@ static void OPP_selector (OPT_Node *x) } else if (OPP_sym == 18) { OPS_Get(&OPP_sym); if (OPP_sym == 38) { - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPS_Get(&OPP_sym); if ((*x)->typ != NIL) { if ((*x)->typ->form == 11) { @@ -867,7 +867,7 @@ static void OPP_Receiver (INT8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct } else { *mode = 1; } - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckSym(38); OPP_CheckSym(20); if (OPP_sym == 38) { @@ -1030,7 +1030,7 @@ static void TProcDecl__23 (void) } OPP_Receiver(&objMode, objName, &objTyp, &recTyp); if (OPP_sym == 38) { - __COPY(OPS_name, *ProcedureDeclaration__16_s->name, 256); + __MOVE(OPS_name, *ProcedureDeclaration__16_s->name, 256); OPP_CheckMark(&*ProcedureDeclaration__16_s->vis); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp, &*ProcedureDeclaration__16_s->fwd); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp->BaseTyp, &baseProc); @@ -1129,7 +1129,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) TProcDecl__23(); } else if (OPP_sym == 38) { OPT_Find(&fwd); - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckMark(&vis); if ((vis != 0 && mode == 6)) { mode = 7; diff --git a/bootstrap/windows-48/OPP.h b/bootstrap/windows-48/OPP.h index 2814e733..b748e221 100644 --- a/bootstrap/windows-48/OPP.h +++ b/bootstrap/windows-48/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-48/OPS.c b/bootstrap/windows-48/OPS.c index 7218afe1..eee78d80 100644 --- a/bootstrap/windows-48/OPS.c +++ b/bootstrap/windows-48/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/OPS.h b/bootstrap/windows-48/OPS.h index a860454b..7ab70899 100644 --- a/bootstrap/windows-48/OPS.h +++ b/bootstrap/windows-48/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-48/OPT.c b/bootstrap/windows-48/OPT.c index aa53a484..174aae08 100644 --- a/bootstrap/windows-48/OPT.c +++ b/bootstrap/windows-48/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -434,8 +434,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); OPT_SYSimported = 0; - __COPY(name, OPT_SelfName, 256); - __COPY(name, OPT_topScope->name, 256); + __MOVE(name, OPT_SelfName, 256); + __MOVE(name, OPT_topScope->name, 256); OPT_GlbMod[0] = OPT_topScope; OPT_nofGmod = 1; OPT_newsf = __IN(4, opt, 32); @@ -1186,7 +1186,7 @@ static void OPT_InStruct (OPT_Struct *typ) } *typ = OPT_NewStr(0, 1); } else { - __COPY(name, obj->name, 256); + __MOVE(name, obj->name, 256); OPT_InsertImport(obj, &OPT_GlbMod[__X(mno, 64)]->right, &old); if (old != NIL) { OPT_FPrintObj(old); diff --git a/bootstrap/windows-48/OPT.h b/bootstrap/windows-48/OPT.h index 86256024..67996e8e 100644 --- a/bootstrap/windows-48/OPT.h +++ b/bootstrap/windows-48/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-48/OPV.c b/bootstrap/windows-48/OPV.c index eb5ad767..fb6ac690 100644 --- a/bootstrap/windows-48/OPV.c +++ b/bootstrap/windows-48/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -163,7 +163,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte } scope = obj->scope; scope->leaf = 1; - __COPY(obj->name, scope->name, 256); + __MOVE(obj->name, scope->name, 256); OPV_Stamp(scope->name); if (mode == 9) { obj->adr = 1; @@ -1286,7 +1286,17 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) OPM_WriteString((CHAR*)", ", 3); if (r->typ == OPT_stringtyp) { OPM_WriteInt(r->conval->intval2); + } else if (r->typ->comp == 3) { + OPM_WriteString((CHAR*)"__X(", 5); + OPC_Len(r->obj, r->typ, 0); + OPM_WriteString((CHAR*)" * ", 4); + OPM_WriteInt(r->typ->BaseTyp->size); + OPM_WriteString((CHAR*)", ", 3); + OPM_WriteInt(l->typ->size); + OPM_Write(')'); } else { + __ASSERT(r->typ->comp == 2, 0); + __ASSERT(r->typ->size <= l->typ->size, 0); OPM_WriteInt(r->typ->size); } OPM_Write(')'); diff --git a/bootstrap/windows-48/OPV.h b/bootstrap/windows-48/OPV.h index 9a8653a0..43aaf24a 100644 --- a/bootstrap/windows-48/OPV.h +++ b/bootstrap/windows-48/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-48/Out.c b/bootstrap/windows-48/Out.c index 0edcb502..0d3f9e29 100644 --- a/bootstrap/windows-48/Out.c +++ b/bootstrap/windows-48/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Out.h b/bootstrap/windows-48/Out.h index b273390e..27f2c9bb 100644 --- a/bootstrap/windows-48/Out.h +++ b/bootstrap/windows-48/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index 78f4409a..4a164fb8 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -7,48 +7,26 @@ #include "SYSTEM.h" -typedef - CHAR (*Platform_ArgPtr)[1024]; - -typedef - Platform_ArgPtr (*Platform_ArgVec)[1024]; - -typedef - INT32 (*Platform_ArgVecPtr)[1]; - -typedef - CHAR (*Platform_EnvPtr)[1024]; - typedef struct Platform_FileIdentity { INT32 volume, indexhigh, indexlow, mtimehigh, mtimelow; } Platform_FileIdentity; -typedef - void (*Platform_HaltProcedure)(INT32); - typedef void (*Platform_SignalHandler)(INT32); export BOOLEAN Platform_LittleEndian; -export INT32 Platform_MainStackFrame; -export INT32 Platform_HaltCode; export INT16 Platform_PID; export CHAR Platform_CWD[4096]; -export INT16 Platform_ArgCount; -export INT32 Platform_ArgVector; -static Platform_HaltProcedure Platform_HaltHandler; static INT32 Platform_TimeStart; export INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; export INT32 Platform_StdIn, Platform_StdOut, Platform_StdErr; -static Platform_SignalHandler Platform_InterruptHandler; export CHAR Platform_NL[3]; export ADDRESS *Platform_FileIdentity__typ; export BOOLEAN Platform_Absent (INT16 e); -export INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); export INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); export INT16 Platform_Close (INT32 h); export BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -57,15 +35,12 @@ export BOOLEAN Platform_DifferentFilesystems (INT16 e); static void Platform_EnableVT100 (void); export INT16 Platform_Error (void); export void Platform_Exit (INT32 code); -export void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); export void Platform_GetClock (INT32 *t, INT32 *d); export void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -export void Platform_GetIntArg (INT16 n, INT32 *val); export void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); export INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); export INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); export BOOLEAN Platform_Inaccessible (INT16 e); -export void Platform_Init (INT32 argc, INT32 argvadr); export BOOLEAN Platform_Interrupted (INT16 e); export BOOLEAN Platform_IsConsole (INT32 h); export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); @@ -111,10 +86,8 @@ export BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS #define Platform_ERRORTOOMANYOPENFILES() ERROR_TOO_MANY_OPEN_FILES #define Platform_ERRORWRITEPROTECT() ERROR_WRITE_PROTECT #define Platform_ETIMEDOUT() WSAETIMEDOUT -extern void Heap_InitHeap(); #define Platform_GetConsoleMode(h, m) GetConsoleMode((HANDLE)h, (DWORD*)m) #define Platform_GetTickCount() (LONGINT)(UINT32)GetTickCount() -#define Platform_HeapInitHeap() Heap_InitHeap() #define Platform_SetConsoleMode(h, m) SetConsoleMode((HANDLE)h, (DWORD)m) #define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((ADDRESS)h) #define Platform_SetQuitHandler(h) SystemSetQuitHandler((ADDRESS)h) @@ -228,17 +201,6 @@ void Platform_OSFree (INT32 address) Platform_free(address); } -void Platform_Init (INT32 argc, INT32 argvadr) -{ - Platform_ArgVecPtr av = NIL; - Platform_MainStackFrame = argvadr; - Platform_ArgCount = __VAL(INT16, argc); - av = (Platform_ArgVecPtr)(ADDRESS)argvadr; - Platform_ArgVector = (*av)[0]; - Platform_HaltCode = -128; - Platform_HeapInitHeap(); -} - BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) { CHAR buf[4096]; @@ -265,56 +227,6 @@ void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) __DEL(var); } -void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len) -{ - Platform_ArgVec av = NIL; - if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector; - __COPY(*(*av)[__X(n, 1024)], val, val__len); - } -} - -void Platform_GetIntArg (INT16 n, INT32 *val) -{ - CHAR s[64]; - INT32 k, d, i; - s[0] = 0x00; - Platform_GetArg(n, (void*)s, 64); - i = 0; - if (s[0] == '-') { - i = 1; - } - k = 0; - d = (INT16)s[__X(i, 64)] - 48; - while ((d >= 0 && d <= 9)) { - k = k * 10 + d; - i += 1; - d = (INT16)s[__X(i, 64)] - 48; - } - if (s[0] == '-') { - k = -k; - i -= 1; - } - if (i > 0) { - *val = k; - } -} - -INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len) -{ - INT16 i; - CHAR arg[256]; - __DUP(s, s__len, CHAR); - i = 0; - Platform_GetArg(i, (void*)arg, 256); - while ((i < Platform_ArgCount && __STRCMP(s, arg) != 0)) { - i += 1; - Platform_GetArg(i, (void*)arg, 256); - } - __DEL(s); - return i; -} - void Platform_SetBadInstructionHandler (Platform_SignalHandler handler) { } @@ -646,8 +558,6 @@ export void *Platform__init(void) __INITYP(Platform_FileIdentity, Platform_FileIdentity, 0); /* BEGIN */ Platform_TestLittleEndian(); - Platform_HaltCode = -128; - Platform_HaltHandler = NIL; Platform_TimeStart = 0; Platform_TimeStart = Platform_Time(); Platform_CWD[0] = 0x00; diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index a4ad7737..adfe4173 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h @@ -16,12 +16,8 @@ typedef import BOOLEAN Platform_LittleEndian; -import INT32 Platform_MainStackFrame; -import INT32 Platform_HaltCode; import INT16 Platform_PID; import CHAR Platform_CWD[4096]; -import INT16 Platform_ArgCount; -import INT32 Platform_ArgVector; import INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; import INT32 Platform_StdIn, Platform_StdOut, Platform_StdErr; import CHAR Platform_NL[3]; @@ -29,7 +25,6 @@ import CHAR Platform_NL[3]; import ADDRESS *Platform_FileIdentity__typ; import BOOLEAN Platform_Absent (INT16 e); -import INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); import INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); import INT16 Platform_Close (INT32 h); import BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -37,15 +32,12 @@ import void Platform_Delay (INT32 ms); import BOOLEAN Platform_DifferentFilesystems (INT16 e); import INT16 Platform_Error (void); import void Platform_Exit (INT32 code); -import void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); import void Platform_GetClock (INT32 *t, INT32 *d); import void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -import void Platform_GetIntArg (INT16 n, INT32 *val); import void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); import INT16 Platform_Identify (INT32 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); import INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); import BOOLEAN Platform_Inaccessible (INT16 e); -import void Platform_Init (INT32 argc, INT32 argvadr); import BOOLEAN Platform_Interrupted (INT16 e); import BOOLEAN Platform_IsConsole (INT32 h); import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); diff --git a/bootstrap/windows-48/Reals.c b/bootstrap/windows-48/Reals.c index ee1f94ca..e4149017 100644 --- a/bootstrap/windows-48/Reals.c +++ b/bootstrap/windows-48/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Reals.h b/bootstrap/windows-48/Reals.h index 16a16b7a..e3bfadb5 100644 --- a/bootstrap/windows-48/Reals.h +++ b/bootstrap/windows-48/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-48/Strings.c b/bootstrap/windows-48/Strings.c index b60bb504..a3f1e808 100644 --- a/bootstrap/windows-48/Strings.c +++ b/bootstrap/windows-48/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/Strings.h b/bootstrap/windows-48/Strings.h index adf86c42..b192b7bb 100644 --- a/bootstrap/windows-48/Strings.h +++ b/bootstrap/windows-48/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-48/Texts.c b/bootstrap/windows-48/Texts.c index c9010809..4fa93c49 100644 --- a/bootstrap/windows-48/Texts.c +++ b/bootstrap/windows-48/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -394,8 +394,8 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, ADDRESS *msg__t e->file = (*(Texts_Alien*)&E)->file; e->org = (*(Texts_Alien*)&E)->org; e->span = (*(Texts_Alien*)&E)->span; - __COPY((*(Texts_Alien*)&E)->mod, e->mod, 32); - __COPY((*(Texts_Alien*)&E)->proc, e->proc, 32); + __MOVE((*(Texts_Alien*)&E)->mod, e->mod, 32); + __MOVE((*(Texts_Alien*)&E)->proc, e->proc, 32); (*msg__).e = (Texts_Elem)e; } else __WITHCHK; } else if (__IS(msg__typ, Texts_IdentifyMsg, 1)) { diff --git a/bootstrap/windows-48/Texts.h b/bootstrap/windows-48/Texts.h index 16b07b6f..235cecb4 100644 --- a/bootstrap/windows-48/Texts.h +++ b/bootstrap/windows-48/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-48/VT100.c b/bootstrap/windows-48/VT100.c index f0e444ea..7a2a840d 100644 --- a/bootstrap/windows-48/VT100.c +++ b/bootstrap/windows-48/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/VT100.h b/bootstrap/windows-48/VT100.h index 0f1bc5ac..5a3fe6d0 100644 --- a/bootstrap/windows-48/VT100.h +++ b/bootstrap/windows-48/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/windows-48/extTools.c b/bootstrap/windows-48/extTools.c index 43e5cb69..657534b4 100644 --- a/bootstrap/windows-48/extTools.c +++ b/bootstrap/windows-48/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-48/extTools.h b/bootstrap/windows-48/extTools.h index 784b684d..6ad7abb0 100644 --- a/bootstrap/windows-48/extTools.h +++ b/bootstrap/windows-48/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h diff --git a/bootstrap/windows-88/Compiler.c b/bootstrap/windows-88/Compiler.c index 29524a91..e59d7615 100644 --- a/bootstrap/windows-88/Compiler.c +++ b/bootstrap/windows-88/Compiler.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspamS */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Configuration.c b/bootstrap/windows-88/Configuration.c index 54214f70..01281cfc 100644 --- a/bootstrap/windows-88/Configuration.c +++ b/bootstrap/windows-88/Configuration.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -19,6 +19,6 @@ export void *Configuration__init(void) __DEFMOD; __REGMOD("Configuration", 0); /* BEGIN */ - __MOVE("2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); + __MOVE("2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8.", Configuration_versionLong, 75); __ENDMOD; } diff --git a/bootstrap/windows-88/Configuration.h b/bootstrap/windows-88/Configuration.h index 1e6381e9..98f85767 100644 --- a/bootstrap/windows-88/Configuration.h +++ b/bootstrap/windows-88/Configuration.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Configuration__h #define Configuration__h diff --git a/bootstrap/windows-88/Files.c b/bootstrap/windows-88/Files.c index f83fafeb..8ad0e207 100644 --- a/bootstrap/windows-88/Files.c +++ b/bootstrap/windows-88/Files.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -238,7 +238,7 @@ static void Files_Deregister (CHAR *name, ADDRESS name__len) if (osfile != NIL) { __ASSERT(!osfile->tempFile, 0); __ASSERT(osfile->fd >= 0, 0); - __COPY(osfile->workName, osfile->registerName, 101); + __MOVE(osfile->workName, osfile->registerName, 101); Files_GetTempName(osfile->registerName, 101, (void*)osfile->workName, 101); osfile->tempFile = 1; osfile->state = 0; @@ -263,7 +263,7 @@ static void Files_Create (Files_File f) } else { __ASSERT(f->state == 2, 0); Files_Deregister(f->registerName, 101); - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } @@ -825,7 +825,7 @@ void Files_Register (Files_File f) if (errcode != 0) { Files_Err((CHAR*)"Couldn't rename temp name as register name", 43, f, errcode); } - __COPY(f->registerName, f->workName, 101); + __MOVE(f->registerName, f->workName, 101); f->registerName[0] = 0x00; f->tempFile = 0; } diff --git a/bootstrap/windows-88/Files.h b/bootstrap/windows-88/Files.h index 1d930af8..3631e4aa 100644 --- a/bootstrap/windows-88/Files.h +++ b/bootstrap/windows-88/Files.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef Files__h #define Files__h diff --git a/bootstrap/windows-88/Heap.c b/bootstrap/windows-88/Heap.c index 95dd55ee..222162d5 100644 --- a/bootstrap/windows-88/Heap.c +++ b/bootstrap/windows-88/Heap.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -105,12 +105,12 @@ static void Heap_Sift (INT64 l, INT64 r, INT64 *a, ADDRESS a__len); export void Heap_Unlock (void); extern void *Heap__init(); -extern ADDRESS Platform_MainStackFrame; +extern ADDRESS Modules_MainStackFrame; extern ADDRESS Platform_OSAllocate(ADDRESS size); #define Heap_HeapModuleInit() Heap__init() #define Heap_ModulesHalt(code) Modules_Halt(code) +#define Heap_ModulesMainStackFrame() Modules_MainStackFrame #define Heap_OSAllocate(size) Platform_OSAllocate(size) -#define Heap_PlatformMainStackFrame() Platform_MainStackFrame void Heap_Lock (void) { @@ -599,7 +599,7 @@ static void Heap_MarkStack (INT64 n, INT64 *cand, ADDRESS cand__len) if (n == 0) { nofcand = 0; sp = (ADDRESS)&frame; - stack0 = Heap_PlatformMainStackFrame(); + stack0 = Heap_ModulesMainStackFrame(); inc = (ADDRESS)&align.p - (ADDRESS)&align; if (sp > stack0) { inc = -inc; diff --git a/bootstrap/windows-88/Heap.h b/bootstrap/windows-88/Heap.h index b96e0160..585db2f0 100644 --- a/bootstrap/windows-88/Heap.h +++ b/bootstrap/windows-88/Heap.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tsSF */ #ifndef Heap__h #define Heap__h diff --git a/bootstrap/windows-88/Modules.c b/bootstrap/windows-88/Modules.c index 9b72d021..c6884be5 100644 --- a/bootstrap/windows-88/Modules.c +++ b/bootstrap/windows-88/Modules.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -43,24 +43,105 @@ typedef export INT16 Modules_res; export CHAR Modules_resMsg[256]; export Modules_ModuleName Modules_imported, Modules_importing; +export INT64 Modules_MainStackFrame; +export INT16 Modules_ArgCount; +export INT64 Modules_ArgVector; export ADDRESS *Modules_ModuleDesc__typ; export ADDRESS *Modules_CmdDesc__typ; static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len); +export INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); export void Modules_AssertFail (INT32 code); static void Modules_DisplayHaltCode (INT32 code); export void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +export void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +export void Modules_GetIntArg (INT16 n, INT32 *val); export void Modules_Halt (INT32 code); +export void Modules_Init (INT32 argc, INT64 argvadr); export Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); export Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); static void Modules_errch (CHAR c); static void Modules_errint (INT32 l); static void Modules_errstring (CHAR *s, ADDRESS s__len); +extern void Heap_InitHeap(); +extern void *Modules__init(void); +#define Modules_InitHeap() Heap_InitHeap() +#define Modules_ModulesInit() Modules__init() #define Modules_modules() (Modules_Module)Heap_modules #define Modules_setmodules(m) Heap_modules = m +typedef + INT64 (*ArgVecPtr__14)[1]; + +void Modules_Init (INT32 argc, INT64 argvadr) +{ + ArgVecPtr__14 av = NIL; + Modules_MainStackFrame = argvadr; + Modules_ArgCount = __VAL(INT16, argc); + av = (ArgVecPtr__14)(ADDRESS)argvadr; + Modules_ArgVector = (*av)[0]; + Modules_InitHeap(); + Modules_ModulesInit(); +} + +typedef + CHAR (*ArgPtr__9)[1024]; + +typedef + ArgPtr__9 (*ArgVec__10)[1024]; + +void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len) +{ + ArgVec__10 av = NIL; + if (n < Modules_ArgCount) { + av = (ArgVec__10)(ADDRESS)Modules_ArgVector; + __COPY(*(*av)[__X(n, 1024)], val, val__len); + } +} + +void Modules_GetIntArg (INT16 n, INT32 *val) +{ + CHAR s[64]; + INT32 k, d, i; + s[0] = 0x00; + Modules_GetArg(n, (void*)s, 64); + i = 0; + if (s[0] == '-') { + i = 1; + } + k = 0; + d = (INT16)s[__X(i, 64)] - 48; + while ((d >= 0 && d <= 9)) { + k = k * 10 + d; + i += 1; + d = (INT16)s[__X(i, 64)] - 48; + } + if (s[0] == '-') { + k = -k; + i -= 1; + } + if (i > 0) { + *val = k; + } +} + +INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len) +{ + INT16 i; + CHAR arg[256]; + __DUP(s, s__len, CHAR); + i = 0; + Modules_GetArg(i, (void*)arg, 256); + while ((i < Modules_ArgCount && __STRCMP(s, arg) != 0)) { + i += 1; + Modules_GetArg(i, (void*)arg, 256); + } + __DEL(s); + return i; +} + static void Modules_Append (CHAR *a, ADDRESS a__len, CHAR *b, ADDRESS b__len) { INT16 i, j; @@ -165,7 +246,7 @@ void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all) static void Modules_errch (CHAR c) { INT16 e; - e = Platform_Write(1, (ADDRESS)&c, 1); + e = Platform_Write(Platform_StdOut, (ADDRESS)&c, 1); } static void Modules_errstring (CHAR *s, ADDRESS s__len) diff --git a/bootstrap/windows-88/Modules.h b/bootstrap/windows-88/Modules.h index 568db414..a3e555ef 100644 --- a/bootstrap/windows-88/Modules.h +++ b/bootstrap/windows-88/Modules.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Modules__h #define Modules__h @@ -39,13 +39,20 @@ typedef import INT16 Modules_res; import CHAR Modules_resMsg[256]; import Modules_ModuleName Modules_imported, Modules_importing; +import INT64 Modules_MainStackFrame; +import INT16 Modules_ArgCount; +import INT64 Modules_ArgVector; import ADDRESS *Modules_ModuleDesc__typ; import ADDRESS *Modules_CmdDesc__typ; +import INT16 Modules_ArgPos (CHAR *s, ADDRESS s__len); import void Modules_AssertFail (INT32 code); import void Modules_Free (CHAR *name, ADDRESS name__len, BOOLEAN all); +import void Modules_GetArg (INT16 n, CHAR *val, ADDRESS val__len); +import void Modules_GetIntArg (INT16 n, INT32 *val); import void Modules_Halt (INT32 code); +import void Modules_Init (INT32 argc, INT64 argvadr); import Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, ADDRESS name__len); import Modules_Module Modules_ThisMod (CHAR *name, ADDRESS name__len); import void *Modules__init(void); diff --git a/bootstrap/windows-88/OPB.c b/bootstrap/windows-88/OPB.c index 2e03b5fc..d9e826b8 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -253,7 +253,7 @@ OPT_Node OPB_NewString (OPS_String str, INT64 len) x->conval->intval = -1; x->conval->intval2 = OPM_Longint(len); x->conval->ext = OPT_NewExt(); - __COPY(str, *x->conval->ext, 256); + __MOVE(str, *x->conval->ext, 256); return x; } @@ -1624,23 +1624,19 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) g = 8; } if (x == y) { + } else if ((((y->comp == 2 && y->BaseTyp == x->BaseTyp)) && y->n <= x->n)) { + } else if ((y->comp == 3 && y->BaseTyp == x->BaseTyp)) { } else if (x->BaseTyp == OPT_chartyp) { if (g == 8) { if (ynode->conval->intval2 > x->n) { OPB_err(114); } - } else if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { } else { OPB_err(113); } } else { OPB_err(113); } - } else if ((x->comp == 3 && x->BaseTyp == OPT_chartyp)) { - if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { - } else { - OPB_err(113); - } } else if (x->comp == 4) { if (x == y) { } else if (y->comp == 4) { @@ -2536,7 +2532,6 @@ void OPB_Return (OPT_Node *x, OPT_Object proc) void OPB_Assign (OPT_Node *x, OPT_Node y) { OPT_Node z = NIL; - INT8 subcl; if ((*x)->class >= 7) { OPB_err(56); } @@ -2562,13 +2557,8 @@ void OPB_Assign (OPT_Node *x, OPT_Node y) y->conval->intval = 0; OPB_Index(&*x, OPB_NewIntConst(0)); } - if ((((((__IN((*x)->typ->comp, 0x0c, 32) && (*x)->typ->BaseTyp == OPT_chartyp)) && __IN(y->typ->comp, 0x0c, 32))) && y->typ->BaseTyp == OPT_chartyp)) { - subcl = 18; - } else { - subcl = 0; - } OPB_BindNodes(19, OPT_notyp, &*x, y); - (*x)->subcl = subcl; + (*x)->subcl = 0; } void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ) diff --git a/bootstrap/windows-88/OPB.h b/bootstrap/windows-88/OPB.h index 6641207d..2c396170 100644 --- a/bootstrap/windows-88/OPB.h +++ b/bootstrap/windows-88/OPB.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPB__h #define OPB__h diff --git a/bootstrap/windows-88/OPC.c b/bootstrap/windows-88/OPC.c index fd11366a..5f4dc826 100644 --- a/bootstrap/windows-88/OPC.c +++ b/bootstrap/windows-88/OPC.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/OPC.h b/bootstrap/windows-88/OPC.h index 4eff8cf5..f9bc06a4 100644 --- a/bootstrap/windows-88/OPC.h +++ b/bootstrap/windows-88/OPC.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPC__h #define OPC__h diff --git a/bootstrap/windows-88/OPM.c b/bootstrap/windows-88/OPM.c index e4915a3e..f52cb5e2 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -8,6 +8,7 @@ #include "SYSTEM.h" #include "Configuration.h" #include "Files.h" +#include "Modules.h" #include "Out.h" #include "Platform.h" #include "Strings.h" @@ -266,7 +267,7 @@ static void OPM_ScanOptions (CHAR *s, ADDRESS s__len) BOOLEAN OPM_OpenPar (void) { CHAR s[256]; - if (Platform_ArgCount == 1) { + if (Modules_ArgCount == 1) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"Oberon-2 compiler v", 20); OPM_LogWStr(Configuration_versionLong, 75); @@ -362,16 +363,16 @@ BOOLEAN OPM_OpenPar (void) OPM_Options = 0xa9; OPM_S = 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } OPM_GlobalAddressSize = OPM_AddressSize; OPM_GlobalAlignment = OPM_Alignment; - __COPY(OPM_Model, OPM_GlobalModel, 10); + __MOVE(OPM_Model, OPM_GlobalModel, 10); OPM_GlobalOptions = OPM_Options; return 1; } @@ -410,16 +411,16 @@ void OPM_InitOptions (void) CHAR searchpath[1024], modules[1024]; CHAR MODULES[1024]; OPM_Options = OPM_GlobalOptions; - __COPY(OPM_GlobalModel, OPM_Model, 10); + __MOVE(OPM_GlobalModel, OPM_Model, 10); OPM_Alignment = OPM_GlobalAlignment; OPM_AddressSize = OPM_GlobalAddressSize; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); while (s[0] == '-') { OPM_ScanOptions(s, 256); OPM_S += 1; s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); } if (__IN(15, OPM_Options, 32)) { OPM_Options |= __SETOF(10,32); @@ -472,11 +473,11 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) CHAR s[256]; *done = 0; OPM_curpos = 0; - if (OPM_S >= Platform_ArgCount) { + if (OPM_S >= Modules_ArgCount) { return; } s[0] = 0x00; - Platform_GetArg(OPM_S, (void*)s, 256); + Modules_GetArg(OPM_S, (void*)s, 256); __NEW(T, Texts_TextDesc); Texts_Open(T, s, 256); OPM_LogWStr(s, 256); @@ -1070,6 +1071,7 @@ export void *OPM__init(void) __DEFMOD; __MODULE_IMPORT(Configuration); __MODULE_IMPORT(Files); + __MODULE_IMPORT(Modules); __MODULE_IMPORT(Out); __MODULE_IMPORT(Platform); __MODULE_IMPORT(Strings); diff --git a/bootstrap/windows-88/OPM.h b/bootstrap/windows-88/OPM.h index 4dd3d03b..979995c8 100644 --- a/bootstrap/windows-88/OPM.h +++ b/bootstrap/windows-88/OPM.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPM__h #define OPM__h diff --git a/bootstrap/windows-88/OPP.c b/bootstrap/windows-88/OPP.c index a08cee09..954279d4 100644 --- a/bootstrap/windows-88/OPP.c +++ b/bootstrap/windows-88/OPP.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -527,7 +527,7 @@ static void OPP_selector (OPT_Node *x) } else if (OPP_sym == 18) { OPS_Get(&OPP_sym); if (OPP_sym == 38) { - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPS_Get(&OPP_sym); if ((*x)->typ != NIL) { if ((*x)->typ->form == 11) { @@ -867,7 +867,7 @@ static void OPP_Receiver (INT8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct } else { *mode = 1; } - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckSym(38); OPP_CheckSym(20); if (OPP_sym == 38) { @@ -1030,7 +1030,7 @@ static void TProcDecl__23 (void) } OPP_Receiver(&objMode, objName, &objTyp, &recTyp); if (OPP_sym == 38) { - __COPY(OPS_name, *ProcedureDeclaration__16_s->name, 256); + __MOVE(OPS_name, *ProcedureDeclaration__16_s->name, 256); OPP_CheckMark(&*ProcedureDeclaration__16_s->vis); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp, &*ProcedureDeclaration__16_s->fwd); OPT_FindField(*ProcedureDeclaration__16_s->name, recTyp->BaseTyp, &baseProc); @@ -1129,7 +1129,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) TProcDecl__23(); } else if (OPP_sym == 38) { OPT_Find(&fwd); - __COPY(OPS_name, name, 256); + __MOVE(OPS_name, name, 256); OPP_CheckMark(&vis); if ((vis != 0 && mode == 6)) { mode = 7; diff --git a/bootstrap/windows-88/OPP.h b/bootstrap/windows-88/OPP.h index 2814e733..b748e221 100644 --- a/bootstrap/windows-88/OPP.h +++ b/bootstrap/windows-88/OPP.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPP__h #define OPP__h diff --git a/bootstrap/windows-88/OPS.c b/bootstrap/windows-88/OPS.c index 7218afe1..eee78d80 100644 --- a/bootstrap/windows-88/OPS.c +++ b/bootstrap/windows-88/OPS.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/OPS.h b/bootstrap/windows-88/OPS.h index a860454b..7ab70899 100644 --- a/bootstrap/windows-88/OPS.h +++ b/bootstrap/windows-88/OPS.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */ #ifndef OPS__h #define OPS__h diff --git a/bootstrap/windows-88/OPT.c b/bootstrap/windows-88/OPT.c index de44eed9..b58d6175 100644 --- a/bootstrap/windows-88/OPT.c +++ b/bootstrap/windows-88/OPT.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -434,8 +434,8 @@ void OPT_Init (OPS_Name name, UINT32 opt) OPT_topScope = OPT_universe; OPT_OpenScope(0, NIL); OPT_SYSimported = 0; - __COPY(name, OPT_SelfName, 256); - __COPY(name, OPT_topScope->name, 256); + __MOVE(name, OPT_SelfName, 256); + __MOVE(name, OPT_topScope->name, 256); OPT_GlbMod[0] = OPT_topScope; OPT_nofGmod = 1; OPT_newsf = __IN(4, opt, 32); @@ -1186,7 +1186,7 @@ static void OPT_InStruct (OPT_Struct *typ) } *typ = OPT_NewStr(0, 1); } else { - __COPY(name, obj->name, 256); + __MOVE(name, obj->name, 256); OPT_InsertImport(obj, &OPT_GlbMod[__X(mno, 64)]->right, &old); if (old != NIL) { OPT_FPrintObj(old); diff --git a/bootstrap/windows-88/OPT.h b/bootstrap/windows-88/OPT.h index 86256024..67996e8e 100644 --- a/bootstrap/windows-88/OPT.h +++ b/bootstrap/windows-88/OPT.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPT__h #define OPT__h diff --git a/bootstrap/windows-88/OPV.c b/bootstrap/windows-88/OPV.c index 7a7ce5c1..22c12372 100644 --- a/bootstrap/windows-88/OPV.c +++ b/bootstrap/windows-88/OPV.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -163,7 +163,7 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte } scope = obj->scope; scope->leaf = 1; - __COPY(obj->name, scope->name, 256); + __MOVE(obj->name, scope->name, 256); OPV_Stamp(scope->name); if (mode == 9) { obj->adr = 1; @@ -1286,7 +1286,17 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) OPM_WriteString((CHAR*)", ", 3); if (r->typ == OPT_stringtyp) { OPM_WriteInt(r->conval->intval2); + } else if (r->typ->comp == 3) { + OPM_WriteString((CHAR*)"__X(", 5); + OPC_Len(r->obj, r->typ, 0); + OPM_WriteString((CHAR*)" * ", 4); + OPM_WriteInt(r->typ->BaseTyp->size); + OPM_WriteString((CHAR*)", ", 3); + OPM_WriteInt(l->typ->size); + OPM_Write(')'); } else { + __ASSERT(r->typ->comp == 2, 0); + __ASSERT(r->typ->size <= l->typ->size, 0); OPM_WriteInt(r->typ->size); } OPM_Write(')'); diff --git a/bootstrap/windows-88/OPV.h b/bootstrap/windows-88/OPV.h index 9a8653a0..43aaf24a 100644 --- a/bootstrap/windows-88/OPV.h +++ b/bootstrap/windows-88/OPV.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef OPV__h #define OPV__h diff --git a/bootstrap/windows-88/Out.c b/bootstrap/windows-88/Out.c index 0edcb502..0d3f9e29 100644 --- a/bootstrap/windows-88/Out.c +++ b/bootstrap/windows-88/Out.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Out.h b/bootstrap/windows-88/Out.h index b273390e..27f2c9bb 100644 --- a/bootstrap/windows-88/Out.h +++ b/bootstrap/windows-88/Out.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Out__h #define Out__h diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index ad0adb4d..bad7600e 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -7,48 +7,26 @@ #include "SYSTEM.h" -typedef - CHAR (*Platform_ArgPtr)[1024]; - -typedef - Platform_ArgPtr (*Platform_ArgVec)[1024]; - -typedef - INT64 (*Platform_ArgVecPtr)[1]; - -typedef - CHAR (*Platform_EnvPtr)[1024]; - typedef struct Platform_FileIdentity { INT32 volume, indexhigh, indexlow, mtimehigh, mtimelow; } Platform_FileIdentity; -typedef - void (*Platform_HaltProcedure)(INT32); - typedef void (*Platform_SignalHandler)(INT32); export BOOLEAN Platform_LittleEndian; -export INT64 Platform_MainStackFrame; -export INT32 Platform_HaltCode; export INT16 Platform_PID; export CHAR Platform_CWD[4096]; -export INT16 Platform_ArgCount; -export INT64 Platform_ArgVector; -static Platform_HaltProcedure Platform_HaltHandler; static INT32 Platform_TimeStart; export INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; export INT64 Platform_StdIn, Platform_StdOut, Platform_StdErr; -static Platform_SignalHandler Platform_InterruptHandler; export CHAR Platform_NL[3]; export ADDRESS *Platform_FileIdentity__typ; export BOOLEAN Platform_Absent (INT16 e); -export INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); export INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); export INT16 Platform_Close (INT64 h); export BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -57,15 +35,12 @@ export BOOLEAN Platform_DifferentFilesystems (INT16 e); static void Platform_EnableVT100 (void); export INT16 Platform_Error (void); export void Platform_Exit (INT32 code); -export void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); export void Platform_GetClock (INT32 *t, INT32 *d); export void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -export void Platform_GetIntArg (INT16 n, INT32 *val); export void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); export INT16 Platform_Identify (INT64 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); export INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); export BOOLEAN Platform_Inaccessible (INT16 e); -export void Platform_Init (INT32 argc, INT64 argvadr); export BOOLEAN Platform_Interrupted (INT16 e); export BOOLEAN Platform_IsConsole (INT64 h); export void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); @@ -111,10 +86,8 @@ export BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS #define Platform_ERRORTOOMANYOPENFILES() ERROR_TOO_MANY_OPEN_FILES #define Platform_ERRORWRITEPROTECT() ERROR_WRITE_PROTECT #define Platform_ETIMEDOUT() WSAETIMEDOUT -extern void Heap_InitHeap(); #define Platform_GetConsoleMode(h, m) GetConsoleMode((HANDLE)h, (DWORD*)m) #define Platform_GetTickCount() (LONGINT)(UINT32)GetTickCount() -#define Platform_HeapInitHeap() Heap_InitHeap() #define Platform_SetConsoleMode(h, m) SetConsoleMode((HANDLE)h, (DWORD)m) #define Platform_SetInterruptHandler(h) SystemSetInterruptHandler((ADDRESS)h) #define Platform_SetQuitHandler(h) SystemSetQuitHandler((ADDRESS)h) @@ -228,17 +201,6 @@ void Platform_OSFree (INT64 address) Platform_free(address); } -void Platform_Init (INT32 argc, INT64 argvadr) -{ - Platform_ArgVecPtr av = NIL; - Platform_MainStackFrame = argvadr; - Platform_ArgCount = __VAL(INT16, argc); - av = (Platform_ArgVecPtr)(ADDRESS)argvadr; - Platform_ArgVector = (*av)[0]; - Platform_HaltCode = -128; - Platform_HeapInitHeap(); -} - BOOLEAN Platform_getEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) { CHAR buf[4096]; @@ -265,56 +227,6 @@ void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len) __DEL(var); } -void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len) -{ - Platform_ArgVec av = NIL; - if (n < Platform_ArgCount) { - av = (Platform_ArgVec)(ADDRESS)Platform_ArgVector; - __COPY(*(*av)[__X(n, 1024)], val, val__len); - } -} - -void Platform_GetIntArg (INT16 n, INT32 *val) -{ - CHAR s[64]; - INT32 k, d, i; - s[0] = 0x00; - Platform_GetArg(n, (void*)s, 64); - i = 0; - if (s[0] == '-') { - i = 1; - } - k = 0; - d = (INT16)s[__X(i, 64)] - 48; - while ((d >= 0 && d <= 9)) { - k = k * 10 + d; - i += 1; - d = (INT16)s[__X(i, 64)] - 48; - } - if (s[0] == '-') { - k = -k; - i -= 1; - } - if (i > 0) { - *val = k; - } -} - -INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len) -{ - INT16 i; - CHAR arg[256]; - __DUP(s, s__len, CHAR); - i = 0; - Platform_GetArg(i, (void*)arg, 256); - while ((i < Platform_ArgCount && __STRCMP(s, arg) != 0)) { - i += 1; - Platform_GetArg(i, (void*)arg, 256); - } - __DEL(s); - return i; -} - void Platform_SetBadInstructionHandler (Platform_SignalHandler handler) { } @@ -646,8 +558,6 @@ export void *Platform__init(void) __INITYP(Platform_FileIdentity, Platform_FileIdentity, 0); /* BEGIN */ Platform_TestLittleEndian(); - Platform_HaltCode = -128; - Platform_HaltHandler = NIL; Platform_TimeStart = 0; Platform_TimeStart = Platform_Time(); Platform_CWD[0] = 0x00; diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index d2d424eb..7d53aaad 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Platform__h #define Platform__h @@ -16,12 +16,8 @@ typedef import BOOLEAN Platform_LittleEndian; -import INT64 Platform_MainStackFrame; -import INT32 Platform_HaltCode; import INT16 Platform_PID; import CHAR Platform_CWD[4096]; -import INT16 Platform_ArgCount; -import INT64 Platform_ArgVector; import INT16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; import INT64 Platform_StdIn, Platform_StdOut, Platform_StdErr; import CHAR Platform_NL[3]; @@ -29,7 +25,6 @@ import CHAR Platform_NL[3]; import ADDRESS *Platform_FileIdentity__typ; import BOOLEAN Platform_Absent (INT16 e); -import INT16 Platform_ArgPos (CHAR *s, ADDRESS s__len); import INT16 Platform_Chdir (CHAR *n, ADDRESS n__len); import INT16 Platform_Close (INT64 h); import BOOLEAN Platform_ConnectionFailed (INT16 e); @@ -37,15 +32,12 @@ import void Platform_Delay (INT32 ms); import BOOLEAN Platform_DifferentFilesystems (INT16 e); import INT16 Platform_Error (void); import void Platform_Exit (INT32 code); -import void Platform_GetArg (INT16 n, CHAR *val, ADDRESS val__len); import void Platform_GetClock (INT32 *t, INT32 *d); import void Platform_GetEnv (CHAR *var, ADDRESS var__len, CHAR *val, ADDRESS val__len); -import void Platform_GetIntArg (INT16 n, INT32 *val); import void Platform_GetTimeOfDay (INT32 *sec, INT32 *usec); import INT16 Platform_Identify (INT64 h, Platform_FileIdentity *identity, ADDRESS *identity__typ); import INT16 Platform_IdentifyByName (CHAR *n, ADDRESS n__len, Platform_FileIdentity *identity, ADDRESS *identity__typ); import BOOLEAN Platform_Inaccessible (INT16 e); -import void Platform_Init (INT32 argc, INT64 argvadr); import BOOLEAN Platform_Interrupted (INT16 e); import BOOLEAN Platform_IsConsole (INT64 h); import void Platform_MTimeAsClock (Platform_FileIdentity i, INT32 *t, INT32 *d); diff --git a/bootstrap/windows-88/Reals.c b/bootstrap/windows-88/Reals.c index ee1f94ca..e4149017 100644 --- a/bootstrap/windows-88/Reals.c +++ b/bootstrap/windows-88/Reals.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Reals.h b/bootstrap/windows-88/Reals.h index 16a16b7a..e3bfadb5 100644 --- a/bootstrap/windows-88/Reals.h +++ b/bootstrap/windows-88/Reals.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Reals__h #define Reals__h diff --git a/bootstrap/windows-88/Strings.c b/bootstrap/windows-88/Strings.c index b60bb504..a3f1e808 100644 --- a/bootstrap/windows-88/Strings.c +++ b/bootstrap/windows-88/Strings.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/Strings.h b/bootstrap/windows-88/Strings.h index adf86c42..b192b7bb 100644 --- a/bootstrap/windows-88/Strings.h +++ b/bootstrap/windows-88/Strings.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Strings__h #define Strings__h diff --git a/bootstrap/windows-88/Texts.c b/bootstrap/windows-88/Texts.c index 0bb7d871..a7cc3ff1 100644 --- a/bootstrap/windows-88/Texts.c +++ b/bootstrap/windows-88/Texts.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 @@ -394,8 +394,8 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, ADDRESS *msg__t e->file = (*(Texts_Alien*)&E)->file; e->org = (*(Texts_Alien*)&E)->org; e->span = (*(Texts_Alien*)&E)->span; - __COPY((*(Texts_Alien*)&E)->mod, e->mod, 32); - __COPY((*(Texts_Alien*)&E)->proc, e->proc, 32); + __MOVE((*(Texts_Alien*)&E)->mod, e->mod, 32); + __MOVE((*(Texts_Alien*)&E)->proc, e->proc, 32); (*msg__).e = (Texts_Elem)e; } else __WITHCHK; } else if (__IS(msg__typ, Texts_IdentifyMsg, 1)) { diff --git a/bootstrap/windows-88/Texts.h b/bootstrap/windows-88/Texts.h index b1eafc02..8c1b9016 100644 --- a/bootstrap/windows-88/Texts.h +++ b/bootstrap/windows-88/Texts.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef Texts__h #define Texts__h diff --git a/bootstrap/windows-88/VT100.c b/bootstrap/windows-88/VT100.c index f0e444ea..7a2a840d 100644 --- a/bootstrap/windows-88/VT100.c +++ b/bootstrap/windows-88/VT100.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/VT100.h b/bootstrap/windows-88/VT100.h index 0f1bc5ac..5a3fe6d0 100644 --- a/bootstrap/windows-88/VT100.h +++ b/bootstrap/windows-88/VT100.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef VT100__h #define VT100__h diff --git a/bootstrap/windows-88/extTools.c b/bootstrap/windows-88/extTools.c index 43e5cb69..657534b4 100644 --- a/bootstrap/windows-88/extTools.c +++ b/bootstrap/windows-88/extTools.c @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #define SHORTINT INT8 #define INTEGER INT16 diff --git a/bootstrap/windows-88/extTools.h b/bootstrap/windows-88/extTools.h index 784b684d..6ad7abb0 100644 --- a/bootstrap/windows-88/extTools.h +++ b/bootstrap/windows-88/extTools.h @@ -1,4 +1,4 @@ -/* voc 2.00 [2016/11/30]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ +/* voc 2.00 [2016/12/01]. Bootstrapping compiler for address size 8, alignment 8. xtspaSF */ #ifndef extTools__h #define extTools__h