From 22a4f8e263cff9e49a9748e1db0f767f70ab8875 Mon Sep 17 00:00:00 2001 From: David Brown Date: Fri, 23 Sep 2016 13:04:24 +0100 Subject: [PATCH] Use SYSTEM.ADDRESS in libraries. Build all with -O2. Support INC(a,b) for any int a,b that support a:=a+b. --- bootstrap/unix-44/OPB.c | 2 +- bootstrap/unix-44/OPM.c | 6 +- bootstrap/unix-44/Platform.c | 6 +- bootstrap/unix-44/Platform.h | 2 +- bootstrap/unix-48/OPB.c | 2 +- bootstrap/unix-48/OPM.c | 6 +- bootstrap/unix-48/Platform.c | 6 +- bootstrap/unix-48/Platform.h | 2 +- bootstrap/unix-88/Configuration.c | 6 +- bootstrap/unix-88/Console.c | 42 ++-- bootstrap/unix-88/Console.h | 2 +- bootstrap/unix-88/Files.c | 186 ++++++++--------- bootstrap/unix-88/Files.h | 42 ++-- bootstrap/unix-88/Heap.c | 20 +- bootstrap/unix-88/Heap.h | 4 +- bootstrap/unix-88/Modules.c | 20 +- bootstrap/unix-88/Modules.h | 10 +- bootstrap/unix-88/OPB.c | 222 ++++++++++---------- bootstrap/unix-88/OPB.h | 6 +- bootstrap/unix-88/OPC.c | 228 ++++++++++----------- bootstrap/unix-88/OPC.h | 22 +- bootstrap/unix-88/OPM.c | 209 +++++++++---------- bootstrap/unix-88/OPM.h | 28 +-- bootstrap/unix-88/OPP.c | 88 ++++---- bootstrap/unix-88/OPS.c | 36 ++-- bootstrap/unix-88/OPS.h | 2 +- bootstrap/unix-88/OPT.c | 261 ++++++++++++------------ bootstrap/unix-88/OPT.h | 23 ++- bootstrap/unix-88/OPV.c | 144 ++++++------- bootstrap/unix-88/Platform.c | 266 ++++++++++++------------ bootstrap/unix-88/Platform.h | 88 ++++---- bootstrap/unix-88/Reals.c | 85 ++++---- bootstrap/unix-88/Reals.h | 14 +- bootstrap/unix-88/Strings.c | 68 +++---- bootstrap/unix-88/Strings.h | 12 +- bootstrap/unix-88/Texts.c | 230 ++++++++++----------- bootstrap/unix-88/Texts.h | 57 +++--- bootstrap/unix-88/Vishap.c | 28 +-- bootstrap/unix-88/errors.c | 6 +- bootstrap/unix-88/extTools.c | 10 +- bootstrap/unix-88/vt100.c | 102 +++++----- bootstrap/unix-88/vt100.h | 34 ++-- bootstrap/windows-48/OPB.c | 2 +- bootstrap/windows-48/OPM.c | 6 +- bootstrap/windows-48/Platform.c | 24 ++- bootstrap/windows-48/Platform.h | 6 +- bootstrap/windows-88/Configuration.c | 6 +- bootstrap/windows-88/Console.c | 42 ++-- bootstrap/windows-88/Console.h | 2 +- bootstrap/windows-88/Files.c | 186 ++++++++--------- bootstrap/windows-88/Files.h | 42 ++-- bootstrap/windows-88/Heap.c | 20 +- bootstrap/windows-88/Heap.h | 4 +- bootstrap/windows-88/Modules.c | 20 +- bootstrap/windows-88/Modules.h | 10 +- bootstrap/windows-88/OPB.c | 222 ++++++++++---------- bootstrap/windows-88/OPB.h | 6 +- bootstrap/windows-88/OPC.c | 228 ++++++++++----------- bootstrap/windows-88/OPC.h | 22 +- bootstrap/windows-88/OPM.c | 209 +++++++++---------- bootstrap/windows-88/OPM.h | 28 +-- bootstrap/windows-88/OPP.c | 88 ++++---- bootstrap/windows-88/OPS.c | 36 ++-- bootstrap/windows-88/OPS.h | 2 +- bootstrap/windows-88/OPT.c | 261 ++++++++++++------------ bootstrap/windows-88/OPT.h | 23 ++- bootstrap/windows-88/OPV.c | 144 ++++++------- bootstrap/windows-88/Platform.c | 292 ++++++++++++++------------- bootstrap/windows-88/Platform.h | 92 ++++----- bootstrap/windows-88/Reals.c | 85 ++++---- bootstrap/windows-88/Reals.h | 14 +- bootstrap/windows-88/Strings.c | 68 +++---- bootstrap/windows-88/Strings.h | 12 +- bootstrap/windows-88/Texts.c | 230 ++++++++++----------- bootstrap/windows-88/Texts.h | 57 +++--- bootstrap/windows-88/Vishap.c | 28 +-- bootstrap/windows-88/errors.c | 6 +- bootstrap/windows-88/extTools.c | 10 +- bootstrap/windows-88/vt100.c | 102 +++++----- bootstrap/windows-88/vt100.h | 34 ++-- makefile | 8 +- src/compiler/OPB.Mod | 4 +- src/compiler/OPM.cmdln.Mod | 18 +- src/library/s3/ethMD5.Mod | 3 +- src/library/s3/ethZlibBuffers.Mod | 22 +- src/library/ulm/ulmIO.Mod | 20 +- src/library/ulm/ulmSYSTEM.Mod | 6 +- src/library/v4/Args.Mod | 8 +- src/library/v4/Printer.Mod | 24 +-- src/system/Platformunix.Mod | 4 +- src/system/Platformwindows.Mod | 26 ++- src/tools/make/vishap.make | 2 +- 92 files changed, 2752 insertions(+), 2695 deletions(-) diff --git a/bootstrap/unix-44/OPB.c b/bootstrap/unix-44/OPB.c index af4f4fc4..e09bf1b4 100644 --- a/bootstrap/unix-44/OPB.c +++ b/bootstrap/unix-44/OPB.c @@ -2024,7 +2024,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p->typ = OPT_notyp; } else { if (x->typ != p->typ) { - if ((x->class == 7 && f == 4)) { + if ((f == 4 && (x->class == 7 || (p->typ->form == 4 && x->typ->size <= p->typ->size)))) { OPB_Convert(&x, p->typ); } else { OPB_err(111); diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index 039d1c77..2769f708 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -1124,8 +1124,8 @@ export void *OPM__init(void) OPM_AddressSize = 8; OPM_Alignment = 8; OPM_ShortintSize = 1; - OPM_IntegerSize = 4; - OPM_LongintSize = 8; - OPM_SetSize = 8; + OPM_IntegerSize = 2; + OPM_LongintSize = 4; + OPM_SetSize = 4; __ENDMOD; } diff --git a/bootstrap/unix-44/Platform.c b/bootstrap/unix-44/Platform.c index 9de57a27..2dacc4b8 100644 --- a/bootstrap/unix-44/Platform.c +++ b/bootstrap/unix-44/Platform.c @@ -92,7 +92,7 @@ export BOOLEAN Platform_TimedOut (int16 e); export BOOLEAN Platform_TooManyFiles (int16 e); export int16 Platform_Truncate (int32 h, int32 l); export int16 Platform_Unlink (CHAR *n, LONGINT n__len); -export int16 Platform_Write (int32 h, address p, address l); +export int16 Platform_Write (int32 h, address p, int32 l); static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 se, int32 *t, int32 *d); static void Platform_errch (CHAR c); static void Platform_errint (int32 l); @@ -144,7 +144,7 @@ extern void Heap_InitHeap(); #define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664) #define Platform_openro(n, n__len) open((char*)n, O_RDONLY) #define Platform_openrw(n, n__len) open((char*)n, O_RDWR) -#define Platform_readfile(fd, p, l) read(fd, (void*)(address)(p), l) +#define Platform_readfile(fd, p, l) (LONGINT)read(fd, (void*)(address)(p), l) #define Platform_rename(o, o__len, n, n__len) rename((char*)o, (char*)n) #define Platform_sectotm(s) struct tm *time = localtime((time_t*)&s) #define Platform_seekcur() SEEK_CUR @@ -547,7 +547,7 @@ int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n) __RETCHK; } -int16 Platform_Write (int32 h, address p, address l) +int16 Platform_Write (int32 h, address p, int32 l) { int16 _o_result; address written; diff --git a/bootstrap/unix-44/Platform.h b/bootstrap/unix-44/Platform.h index bc487769..32d37057 100644 --- a/bootstrap/unix-44/Platform.h +++ b/bootstrap/unix-44/Platform.h @@ -75,7 +75,7 @@ import BOOLEAN Platform_TimedOut (int16 e); import BOOLEAN Platform_TooManyFiles (int16 e); import int16 Platform_Truncate (int32 h, int32 l); import int16 Platform_Unlink (CHAR *n, LONGINT n__len); -import int16 Platform_Write (int32 h, address p, address l); +import int16 Platform_Write (int32 h, address p, int32 l); import BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); import void *Platform__init(void); diff --git a/bootstrap/unix-48/OPB.c b/bootstrap/unix-48/OPB.c index af4f4fc4..e09bf1b4 100644 --- a/bootstrap/unix-48/OPB.c +++ b/bootstrap/unix-48/OPB.c @@ -2024,7 +2024,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p->typ = OPT_notyp; } else { if (x->typ != p->typ) { - if ((x->class == 7 && f == 4)) { + if ((f == 4 && (x->class == 7 || (p->typ->form == 4 && x->typ->size <= p->typ->size)))) { OPB_Convert(&x, p->typ); } else { OPB_err(111); diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index 039d1c77..2769f708 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -1124,8 +1124,8 @@ export void *OPM__init(void) OPM_AddressSize = 8; OPM_Alignment = 8; OPM_ShortintSize = 1; - OPM_IntegerSize = 4; - OPM_LongintSize = 8; - OPM_SetSize = 8; + OPM_IntegerSize = 2; + OPM_LongintSize = 4; + OPM_SetSize = 4; __ENDMOD; } diff --git a/bootstrap/unix-48/Platform.c b/bootstrap/unix-48/Platform.c index 9de57a27..2dacc4b8 100644 --- a/bootstrap/unix-48/Platform.c +++ b/bootstrap/unix-48/Platform.c @@ -92,7 +92,7 @@ export BOOLEAN Platform_TimedOut (int16 e); export BOOLEAN Platform_TooManyFiles (int16 e); export int16 Platform_Truncate (int32 h, int32 l); export int16 Platform_Unlink (CHAR *n, LONGINT n__len); -export int16 Platform_Write (int32 h, address p, address l); +export int16 Platform_Write (int32 h, address p, int32 l); static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 se, int32 *t, int32 *d); static void Platform_errch (CHAR c); static void Platform_errint (int32 l); @@ -144,7 +144,7 @@ extern void Heap_InitHeap(); #define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664) #define Platform_openro(n, n__len) open((char*)n, O_RDONLY) #define Platform_openrw(n, n__len) open((char*)n, O_RDWR) -#define Platform_readfile(fd, p, l) read(fd, (void*)(address)(p), l) +#define Platform_readfile(fd, p, l) (LONGINT)read(fd, (void*)(address)(p), l) #define Platform_rename(o, o__len, n, n__len) rename((char*)o, (char*)n) #define Platform_sectotm(s) struct tm *time = localtime((time_t*)&s) #define Platform_seekcur() SEEK_CUR @@ -547,7 +547,7 @@ int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n) __RETCHK; } -int16 Platform_Write (int32 h, address p, address l) +int16 Platform_Write (int32 h, address p, int32 l) { int16 _o_result; address written; diff --git a/bootstrap/unix-48/Platform.h b/bootstrap/unix-48/Platform.h index bc487769..32d37057 100644 --- a/bootstrap/unix-48/Platform.h +++ b/bootstrap/unix-48/Platform.h @@ -75,7 +75,7 @@ import BOOLEAN Platform_TimedOut (int16 e); import BOOLEAN Platform_TooManyFiles (int16 e); import int16 Platform_Truncate (int32 h, int32 l); import int16 Platform_Unlink (CHAR *n, LONGINT n__len); -import int16 Platform_Write (int32 h, address p, address l); +import int16 Platform_Write (int32 h, address p, int32 l); import BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); import void *Platform__init(void); diff --git a/bootstrap/unix-88/Configuration.c b/bootstrap/unix-88/Configuration.c index fa5765f3..abdf151b 100644 --- a/bootstrap/unix-88/Configuration.c +++ b/bootstrap/unix-88/Configuration.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-88/Console.c b/bootstrap/unix-88/Console.c index 9d23b9fd..115e60f5 100644 --- a/bootstrap/unix-88/Console.c +++ b/bootstrap/unix-88/Console.c @@ -1,21 +1,21 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Platform.h" static CHAR Console_line[128]; -static int32 Console_pos; +static int16 Console_pos; export void Console_Bool (BOOLEAN b); export void Console_Char (CHAR ch); export void Console_Flush (void); -export void Console_Hex (int64 i); +export void Console_Hex (int32 i); export void Console_Int (int64 i, int64 n); export void Console_Ln (void); export void Console_Read (CHAR *ch); @@ -25,7 +25,7 @@ export void Console_String (CHAR *s, LONGINT s__len); void Console_Flush (void) { - int32 error; + int16 error; error = Platform_Write(1, (address)Console_line, Console_pos); Console_pos = 0; } @@ -44,7 +44,7 @@ void Console_Char (CHAR ch) void Console_String (CHAR *s, LONGINT s__len) { - int32 i; + int16 i; __DUP(s, s__len, CHAR); i = 0; while (s[__X(i, s__len)] != 0x00) { @@ -57,17 +57,17 @@ void Console_String (CHAR *s, LONGINT s__len) void Console_Int (int64 i, int64 n) { CHAR s[32]; - int64 i1, k; - if (i == __LSHL(1, 63, 64)) { - __MOVE("8085774586302733229", s, 20); - k = 19; + int32 i1, k; + if (i == (int64)__LSHL(1, 31, 32)) { + __MOVE("8463847412", s, 11); + k = 10; } else { - i1 = __ABS((int64)i); - s[0] = (CHAR)(__MOD(i1, 10) + 48); + i1 = __ABS(__VAL(int32, i)); + s[0] = (CHAR)((int)__MOD(i1, 10) + 48); i1 = __DIV(i1, 10); k = 1; while (i1 > 0) { - s[__X(k, 32)] = (CHAR)(__MOD(i1, 10) + 48); + s[__X(k, 32)] = (CHAR)((int)__MOD(i1, 10) + 48); i1 = __DIV(i1, 10); k += 1; } @@ -76,7 +76,7 @@ void Console_Int (int64 i, int64 n) s[__X(k, 32)] = '-'; k += 1; } - while (n > k) { + while (n > (int64)k) { Console_Char(' '); n -= 1; } @@ -100,11 +100,11 @@ void Console_Bool (BOOLEAN b) } } -void Console_Hex (int64 i) +void Console_Hex (int32 i) { - int32 k; + int16 k; int64 n; - k = -60; + k = -28; while (k <= 0) { n = __MASK(__ASH(i, k), -16); if (n <= 9) { @@ -118,8 +118,8 @@ void Console_Hex (int64 i) void Console_Read (CHAR *ch) { - int64 n; - int32 error; + int32 n; + int16 error; Console_Flush(); error = Platform_ReadBuf(0, (void*)&*ch, 1, &n); if (n != 1) { @@ -129,7 +129,7 @@ void Console_Read (CHAR *ch) void Console_ReadLine (CHAR *line, LONGINT line__len) { - int64 i; + int32 i; CHAR ch; Console_Flush(); i = 0; diff --git a/bootstrap/unix-88/Console.h b/bootstrap/unix-88/Console.h index 64d39044..b08c93ea 100644 --- a/bootstrap/unix-88/Console.h +++ b/bootstrap/unix-88/Console.h @@ -11,7 +11,7 @@ import void Console_Bool (BOOLEAN b); import void Console_Char (CHAR ch); import void Console_Flush (void); -import void Console_Hex (int64 i); +import void Console_Hex (int32 i); import void Console_Int (int64 i, int64 n); import void Console_Ln (void); import void Console_Read (CHAR *ch); diff --git a/bootstrap/unix-88/Files.c b/bootstrap/unix-88/Files.c index c63ea9c4..e7eb30f3 100644 --- a/bootstrap/unix-88/Files.c +++ b/bootstrap/unix-88/Files.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -18,7 +18,7 @@ typedef struct Files_BufDesc { Files_File f; BOOLEAN chg; - int64 org, size; + int32 org, size; SYSTEM_BYTE data[4096]; } Files_BufDesc; @@ -33,23 +33,23 @@ typedef Files_FileName workName, registerName; BOOLEAN tempFile; Platform_FileIdentity identity; - int64 fd, len, pos; + int32 fd, len, pos; Files_Buffer bufs[4]; - int32 swapper, state; + int16 swapper, state; Files_File next; } Files_FileDesc; typedef struct Files_Rider { - int64 res; + int32 res; BOOLEAN eof; Files_Buffer buf; - int64 org, offset; + int32 org, offset; } Files_Rider; static Files_File Files_files; -static int32 Files_tempno; +static int16 Files_tempno; static CHAR Files_HOME[1024]; static struct { LONGINT len[1]; @@ -62,50 +62,50 @@ export address *Files_Rider__typ; export Files_File Files_Base (Files_Rider *r, address *r__typ); static Files_File Files_CacheEntry (Platform_FileIdentity identity); -export void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res); +export void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res); export void Files_Close (Files_File f); static void Files_CloseOSFile (Files_File f); static void Files_Create (Files_File f); -export void Files_Delete (CHAR *name, LONGINT name__len, int32 *res); -static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 errcode); +export void Files_Delete (CHAR *name, LONGINT name__len, int16 *res); +static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode); static void Files_Finalize (SYSTEM_PTR o); static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *dest, LONGINT dest__len); static void Files_Flush (Files_Buffer buf); -export void Files_GetDate (Files_File f, int64 *t, int64 *d); +export void Files_GetDate (Files_File f, int32 *t, int32 *d); export void Files_GetName (Files_File f, CHAR *name, LONGINT name__len); static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *name, LONGINT name__len); static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len); -export int64 Files_Length (Files_File f); +export int32 Files_Length (Files_File f); static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT name__len, CHAR *dest, LONGINT dest__len); export Files_File Files_New (CHAR *name, LONGINT name__len); export Files_File Files_Old (CHAR *name, LONGINT name__len); -export int64 Files_Pos (Files_Rider *r, address *r__typ); +export int32 Files_Pos (Files_Rider *r, address *r__typ); export void Files_Purge (Files_File f); export void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x); export void Files_ReadBool (Files_Rider *R, address *R__typ, BOOLEAN *x); export void Files_ReadByte (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len); -export void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n); -export void Files_ReadInt (Files_Rider *R, address *R__typ, int32 *x); -export void Files_ReadLInt (Files_Rider *R, address *R__typ, int64 *x); +export void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n); +export void Files_ReadInt (Files_Rider *R, address *R__typ, int16 *x); +export void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); export void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); export void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); -export void Files_ReadNum (Files_Rider *R, address *R__typ, int64 *x); +export void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); export void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); export void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); export void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); export void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_Register (Files_File f); -export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int32 *res); -static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len); -export void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos); +export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); +static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len); +export void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos); export void Files_SetSearchPath (CHAR *path, LONGINT path__len); export void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x); export void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x); -export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n); -export void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x); -export void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x); +export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n); +export void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); +export void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); export void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -export void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); +export void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); export void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); export void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); export void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); @@ -113,7 +113,7 @@ export void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT #define Files_IdxTrap() __HALT(-1) -static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 errcode) +static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode) { __DUP(s, s__len, CHAR); Console_Ln(); @@ -142,7 +142,7 @@ static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 errcode) static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT name__len, CHAR *dest, LONGINT dest__len) { - int32 i, j; + int16 i, j; __DUP(dir, dir__len, CHAR); __DUP(name, name__len, CHAR); i = 0; @@ -167,7 +167,7 @@ static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *name, LONGINT name__len) { - int64 n, i, j; + int32 n, i, j; __DUP(finalName, finalName__len, CHAR); Files_tempno += 1; n = Files_tempno; @@ -199,7 +199,7 @@ static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *na name[i + 5] = '.'; i += 6; while (n > 0) { - name[i] = (CHAR)(__MOD(n, 10) + 48); + name[i] = (CHAR)((int)__MOD(n, 10) + 48); n = __DIV(n, 10); i += 1; } @@ -207,7 +207,7 @@ static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *na i += 1; n = Platform_PID; while (n > 0) { - name[i] = (CHAR)(__MOD(n, 10) + 48); + name[i] = (CHAR)((int)__MOD(n, 10) + 48); n = __DIV(n, 10); i += 1; } @@ -219,7 +219,7 @@ static void Files_Create (Files_File f) { Platform_FileIdentity identity; BOOLEAN done; - int32 error; + int16 error; CHAR err[32]; if (f->fd == -1) { if (f->state == 1) { @@ -256,7 +256,7 @@ static void Files_Create (Files_File f) static void Files_Flush (Files_Buffer buf) { - int32 error; + int16 error; Files_File f = NIL; if (buf->chg) { f = buf->f; @@ -280,7 +280,7 @@ static void Files_Flush (Files_Buffer buf) static void Files_CloseOSFile (Files_File f) { Files_File prev = NIL; - int32 error; + int16 error; if (Files_files == f) { Files_files = f->next; } else { @@ -300,8 +300,8 @@ static void Files_CloseOSFile (Files_File f) void Files_Close (Files_File f) { - int64 i; - int32 error; + int32 i; + int16 error; if (f->state != 1 || f->registerName[0] != 0x00) { Files_Create(f); i = 0; @@ -317,9 +317,9 @@ void Files_Close (Files_File f) } } -int64 Files_Length (Files_File f) +int32 Files_Length (Files_File f) { - int64 _o_result; + int32 _o_result; _o_result = f->len; return _o_result; } @@ -342,9 +342,9 @@ Files_File Files_New (CHAR *name, LONGINT name__len) return _o_result; } -static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len) +static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len) { - int32 i; + int16 i; CHAR ch; i = 0; if (Files_SearchPath == NIL) { @@ -388,7 +388,7 @@ static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len) static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len) { BOOLEAN _o_result; - int32 i; + int16 i; CHAR ch; i = 0; ch = name[0]; @@ -404,7 +404,7 @@ static Files_File Files_CacheEntry (Platform_FileIdentity identity) { Files_File _o_result; Files_File f = NIL; - int32 i, error; + int16 i, error; f = Files_files; while (f != NIL) { if (Platform_SameFile(identity, f->identity)) { @@ -434,11 +434,11 @@ Files_File Files_Old (CHAR *name, LONGINT name__len) { Files_File _o_result; Files_File f = NIL; - int64 fd; - int32 pos; + int32 fd; + int16 pos; BOOLEAN done; CHAR dir[256], path[256]; - int32 error; + int16 error; Platform_FileIdentity identity; __DUP(name, name__len, CHAR); if (name[0] != 0x00) { @@ -513,9 +513,9 @@ Files_File Files_Old (CHAR *name, LONGINT name__len) void Files_Purge (Files_File f) { - int32 i; + int16 i; Platform_FileIdentity identity; - int32 error; + int16 error; i = 0; while (i < 4) { if (f->bufs[i] != NIL) { @@ -535,27 +535,27 @@ void Files_Purge (Files_File f) Platform_SetMTime(&f->identity, Platform_FileIdentity__typ, identity); } -void Files_GetDate (Files_File f, int64 *t, int64 *d) +void Files_GetDate (Files_File f, int32 *t, int32 *d) { Platform_FileIdentity identity; - int32 error; + int16 error; Files_Create(f); error = Platform_Identify(f->fd, &identity, Platform_FileIdentity__typ); Platform_MTimeAsClock(identity, &*t, &*d); } -int64 Files_Pos (Files_Rider *r, address *r__typ) +int32 Files_Pos (Files_Rider *r, address *r__typ) { - int64 _o_result; + int32 _o_result; _o_result = (*r).org + (*r).offset; return _o_result; } -void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos) +void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos) { - int64 org, offset, i, n; + int32 org, offset, i, n; Files_Buffer buf = NIL; - int32 error; + int16 error; if (f != NIL) { if (pos > f->len) { pos = f->len; @@ -615,7 +615,7 @@ void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos) void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x) { - int64 offset; + int32 offset; Files_Buffer buf = NIL; buf = (*r).buf; offset = (*r).offset; @@ -637,9 +637,9 @@ void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x) } } -void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n) +void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n) { - int64 xpos, min, restInBuf, offset; + int32 xpos, min, restInBuf, offset; Files_Buffer buf = NIL; if (n > x__len) { Files_IdxTrap(); @@ -663,7 +663,7 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE(((address)buf->data) + offset, ((address)x) + xpos, min); + __MOVE((address)buf->data + (int64)offset, (address)x + (int64)xpos, min); offset += min; (*r).offset = offset; xpos += min; @@ -688,7 +688,7 @@ Files_File Files_Base (Files_Rider *r, address *r__typ) void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x) { Files_Buffer buf = NIL; - int64 offset; + int32 offset; buf = (*r).buf; offset = (*r).offset; if ((*r).org != buf->org || offset >= 4096) { @@ -706,9 +706,9 @@ void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x) (*r).res = 0; } -void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n) +void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n) { - int64 xpos, min, restInBuf, offset; + int32 xpos, min, restInBuf, offset; Files_Buffer buf = NIL; if (n > x__len) { Files_IdxTrap(); @@ -728,7 +728,7 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE(((address)x) + xpos, ((address)buf->data) + offset, min); + __MOVE((address)x + (int64)xpos, (address)buf->data + (int64)offset, min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -742,17 +742,17 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT (*r).res = 0; } -void Files_Delete (CHAR *name, LONGINT name__len, int32 *res) +void Files_Delete (CHAR *name, LONGINT name__len, int16 *res) { __DUP(name, name__len, CHAR); *res = Platform_Unlink((void*)name, name__len); __DEL(name); } -void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int32 *res) +void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res) { - int64 fdold, fdnew, n; - int32 error, ignore; + int32 fdold, fdnew, n; + int16 error, ignore; Platform_FileIdentity oldidentity, newidentity; CHAR buf[4096]; __DUP(old, old__len, CHAR); @@ -807,7 +807,7 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int void Files_Register (Files_File f) { - int32 idx, errcode; + int16 idx, errcode; Files_File f1 = NIL; CHAR file[104]; if ((f->state == 1 && f->registerName[0] != 0x00)) { @@ -826,7 +826,7 @@ void Files_Register (Files_File f) } } -void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res) +void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res) { __DUP(path, path__len, CHAR); *res = Platform_Chdir((void*)path, path__len); @@ -835,7 +835,7 @@ void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res) static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *dest, LONGINT dest__len) { - int64 i, j; + int32 i, j; if (!Platform_LittleEndian) { i = src__len; j = 0; @@ -854,26 +854,26 @@ void Files_ReadBool (Files_Rider *R, address *R__typ, BOOLEAN *x) Files_Read(&*R, R__typ, (CHAR*)(void*)&*x); } -void Files_ReadInt (Files_Rider *R, address *R__typ, int32 *x) +void Files_ReadInt (Files_Rider *R, address *R__typ, int16 *x) { CHAR b[2]; Files_ReadBytes(&*R, R__typ, (void*)b, 2, 2); - *x = b[0] + __ASHL(b[1], 8); + *x = (int16)b[0] + __ASHL((int16)b[1], 8); } -void Files_ReadLInt (Files_Rider *R, address *R__typ, int64 *x) +void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x) { CHAR b[4]; Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4); - *x = ((b[0] + __ASHL(b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); + *x = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); } void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x) { CHAR b[4]; - int64 l; + int32 l; Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4); - l = ((b[0] + __ASHL(b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); + l = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); *x = (SET)l; } @@ -893,7 +893,7 @@ void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x) void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) { - int32 i; + int16 i; CHAR ch; i = 0; do { @@ -905,7 +905,7 @@ void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) { - int32 i; + int16 i; CHAR ch; BOOLEAN b; i = 0; @@ -921,26 +921,26 @@ void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) } while (!b); } -void Files_ReadNum (Files_Rider *R, address *R__typ, int64 *x) +void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x) { int8 s; CHAR ch; - int64 n; + int32 n; s = 0; n = 0; Files_Read(&*R, R__typ, (void*)&ch); - while (ch >= 128) { - n += __ASH((int64)(ch - 128), s); + while ((int16)ch >= 128) { + n += __ASH(((int16)ch - 128), s); s += 7; Files_Read(&*R, R__typ, (void*)&ch); } - n += __ASH((int64)(__MASK(ch, -64) - __ASHL(__ASHR(ch, 6), 6)), s); + n += __ASH((__MASK((int16)ch, -64) - __ASHL(__ASHR((int16)ch, 6), 6)), s); *x = n; } void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x) { - int64 n; + int32 n; Files_ReadNum(&*R, R__typ, &n); *x = n; } @@ -950,7 +950,7 @@ void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x) Files_Write(&*R, R__typ, __VAL(CHAR, x)); } -void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x) +void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x) { CHAR b[2]; b[0] = (CHAR)x; @@ -958,7 +958,7 @@ void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x) Files_WriteBytes(&*R, R__typ, (void*)b, 2, 2); } -void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x) +void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x) { CHAR b[4]; b[0] = (CHAR)x; @@ -971,8 +971,8 @@ void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x) void Files_WriteSet (Files_Rider *R, address *R__typ, SET x) { CHAR b[4]; - int64 i; - i = (int64)x; + int32 i; + i = (int32)x; b[0] = (CHAR)i; b[1] = (CHAR)__ASHR(i, 8); b[2] = (CHAR)__ASHR(i, 16); @@ -996,7 +996,7 @@ void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x) void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) { - int32 i; + int16 i; i = 0; while (x[i] != 0x00) { i += 1; @@ -1004,7 +1004,7 @@ void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len Files_WriteBytes(&*R, R__typ, (void*)x, x__len * 1, i + 1); } -void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x) +void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x) { while (x < -64 || x > 63) { Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); @@ -1030,7 +1030,7 @@ void Files_GetName (Files_File f, CHAR *name, LONGINT name__len) static void Files_Finalize (SYSTEM_PTR o) { Files_File f = NIL; - int64 res; + int32 res; f = (Files_File)(address)o; if (f->fd >= 0) { Files_CloseOSFile(f); @@ -1058,9 +1058,9 @@ static void EnumPtrs(void (*P)(void*)) P(Files_SearchPath); } -__TDESC(Files_FileDesc, 1, 5) = {__TDFLDS("FileDesc", 304), {256, 264, 272, 280, 296, -48}}; -__TDESC(Files_BufDesc, 1, 1) = {__TDFLDS("BufDesc", 4128), {0, -16}}; -__TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 40), {16, -16}}; +__TDESC(Files_FileDesc, 1, 5) = {__TDFLDS("FileDesc", 280), {232, 240, 248, 256, 272, -48}}; +__TDESC(Files_BufDesc, 1, 1) = {__TDFLDS("BufDesc", 4120), {0, -16}}; +__TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 24), {8, -16}}; export void *Files__init(void) { diff --git a/bootstrap/unix-88/Files.h b/bootstrap/unix-88/Files.h index 645bc846..a371a423 100644 --- a/bootstrap/unix-88/Files.h +++ b/bootstrap/unix-88/Files.h @@ -10,16 +10,18 @@ typedef typedef struct Files_FileDesc { - char _prvt0[232]; - int64 fd; - char _prvt1[64]; + int64 _prvt0; + char _prvt1[208]; + int32 fd; + char _prvt2[60]; } Files_FileDesc; typedef struct Files_Rider { - int64 res; + int32 res; BOOLEAN eof; - char _prvt0[31]; + int64 _prvt0; + char _prvt1[8]; } Files_Rider; @@ -28,40 +30,40 @@ import address *Files_FileDesc__typ; import address *Files_Rider__typ; import Files_File Files_Base (Files_Rider *r, address *r__typ); -import void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res); +import void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res); import void Files_Close (Files_File f); -import void Files_Delete (CHAR *name, LONGINT name__len, int32 *res); -import void Files_GetDate (Files_File f, int64 *t, int64 *d); +import void Files_Delete (CHAR *name, LONGINT name__len, int16 *res); +import void Files_GetDate (Files_File f, int32 *t, int32 *d); import void Files_GetName (Files_File f, CHAR *name, LONGINT name__len); -import int64 Files_Length (Files_File f); +import int32 Files_Length (Files_File f); import Files_File Files_New (CHAR *name, LONGINT name__len); import Files_File Files_Old (CHAR *name, LONGINT name__len); -import int64 Files_Pos (Files_Rider *r, address *r__typ); +import int32 Files_Pos (Files_Rider *r, address *r__typ); import void Files_Purge (Files_File f); import void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x); import void Files_ReadBool (Files_Rider *R, address *R__typ, BOOLEAN *x); import void Files_ReadByte (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len); -import void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n); -import void Files_ReadInt (Files_Rider *R, address *R__typ, int32 *x); -import void Files_ReadLInt (Files_Rider *R, address *R__typ, int64 *x); +import void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n); +import void Files_ReadInt (Files_Rider *R, address *R__typ, int16 *x); +import void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); import void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); import void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); -import void Files_ReadNum (Files_Rider *R, address *R__typ, int64 *x); +import void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); import void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); import void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); import void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); import void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_Register (Files_File f); -import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int32 *res); -import void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos); +import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); +import void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos); import void Files_SetSearchPath (CHAR *path, LONGINT path__len); import void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x); import void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x); -import void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n); -import void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x); -import void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x); +import void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n); +import void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); +import void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); import void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -import void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); +import void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); import void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); import void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); import void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); diff --git a/bootstrap/unix-88/Heap.c b/bootstrap/unix-88/Heap.c index c87cfd6d..16ae9ffd 100644 --- a/bootstrap/unix-88/Heap.c +++ b/bootstrap/unix-88/Heap.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tsSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -54,11 +54,11 @@ typedef struct Heap_ModuleDesc { Heap_Module next; Heap_ModuleName name; - int64 refcnt; + int32 refcnt; Heap_Cmd cmds; address types; Heap_EnumProc enumPtrs; - int64 reserved1, reserved2; + int32 reserved1, reserved2; } Heap_ModuleDesc; @@ -70,9 +70,9 @@ static BOOLEAN Heap_firstTry; static address Heap_heap, Heap_heapend; export address Heap_heapsize; static Heap_FinNode Heap_fin; -static int32 Heap_lockdepth; +static int16 Heap_lockdepth; static BOOLEAN Heap_interrupted; -export int32 Heap_FileCount; +export int16 Heap_FileCount; export address *Heap_ModuleDesc__typ; export address *Heap_CmdDesc__typ; @@ -129,7 +129,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs) SYSTEM_PTR _o_result; Heap_Module m; if (__STRCMP(name, "Heap") == 0) { - __SYSNEW(m, 80); + __SYSNEW(m, 64); } else { __NEW(m, Heap_ModuleDesc); } @@ -602,7 +602,7 @@ static void Heap_MarkStack (address n, address *cand, LONGINT cand__len) while (sp != stack0) { __GET(sp, p, address); if ((p > Heap_heap && p < Heap_heapend)) { - if (nofcand == cand__len) { + if (nofcand == (int64)cand__len) { Heap_HeapSort(nofcand, (void*)cand, cand__len); Heap_MarkCandidates(nofcand, (void*)cand, cand__len); nofcand = 0; @@ -734,7 +734,7 @@ static void EnumPtrs(void (*P)(void*)) P(Heap_fin); } -__TDESC(Heap_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 80), {0, 40, -24}}; +__TDESC(Heap_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 64), {0, 32, -24}}; __TDESC(Heap_CmdDesc, 1, 1) = {__TDFLDS("CmdDesc", 40), {0, -16}}; __TDESC(Heap_FinDesc, 1, 1) = {__TDFLDS("FinDesc", 32), {0, -16}}; __TDESC(Heap__1, 1, 1) = {__TDFLDS("", 16), {8, -16}}; diff --git a/bootstrap/unix-88/Heap.h b/bootstrap/unix-88/Heap.h index b4829f2f..151a2d59 100644 --- a/bootstrap/unix-88/Heap.h +++ b/bootstrap/unix-88/Heap.h @@ -23,7 +23,7 @@ typedef typedef struct Heap_ModuleDesc { int64 _prvt0; - char _prvt1[72]; + char _prvt1[56]; } Heap_ModuleDesc; typedef @@ -32,7 +32,7 @@ typedef import SYSTEM_PTR Heap_modules; import address Heap_allocated, Heap_heapsize; -import int32 Heap_FileCount; +import int16 Heap_FileCount; import address *Heap_ModuleDesc__typ; diff --git a/bootstrap/unix-88/Modules.c b/bootstrap/unix-88/Modules.c index 23fec310..f844dfa9 100644 --- a/bootstrap/unix-88/Modules.c +++ b/bootstrap/unix-88/Modules.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" @@ -31,15 +31,15 @@ typedef struct Modules_ModuleDesc { Modules_Module next; Modules_ModuleName name; - int64 refcnt; + int32 refcnt; Modules_Cmd cmds; - int64 types; - void (*enumPtrs)(void(*)(int64)); - int64 reserved1, reserved2; + int32 types; + void (*enumPtrs)(void(*)(int32)); + int32 reserved1, reserved2; } Modules_ModuleDesc; -export int32 Modules_res; +export int16 Modules_res; export CHAR Modules_resMsg[256]; export Modules_ModuleName Modules_imported, Modules_importing; @@ -56,7 +56,7 @@ export Modules_Module Modules_ThisMod (CHAR *name, LONGINT name__len); static void Modules_Append (CHAR *a, LONGINT a__len, CHAR *b, LONGINT b__len) { - int32 i, j; + int16 i, j; __DUP(b, b__len, CHAR); i = 0; while (a[__X(i, a__len)] != 0x00) { @@ -160,7 +160,7 @@ void Modules_Free (CHAR *name, LONGINT name__len, BOOLEAN all) __DEL(name); } -__TDESC(Modules_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 80), {0, 40, -24}}; +__TDESC(Modules_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 64), {0, 32, -24}}; __TDESC(Modules_CmdDesc, 1, 1) = {__TDFLDS("CmdDesc", 40), {0, -16}}; export void *Modules__init(void) diff --git a/bootstrap/unix-88/Modules.h b/bootstrap/unix-88/Modules.h index 7cafac5f..060208c6 100644 --- a/bootstrap/unix-88/Modules.h +++ b/bootstrap/unix-88/Modules.h @@ -28,15 +28,15 @@ typedef struct Modules_ModuleDesc { Modules_Module next; Modules_ModuleName name; - int64 refcnt; + int32 refcnt; Modules_Cmd cmds; - int64 types; - void (*enumPtrs)(void(*)(int64)); - char _prvt0[16]; + int32 types; + void (*enumPtrs)(void(*)(int32)); + char _prvt0[8]; } Modules_ModuleDesc; -import int32 Modules_res; +import int16 Modules_res; import CHAR Modules_resMsg[256]; import Modules_ModuleName Modules_imported, Modules_importing; diff --git a/bootstrap/unix-88/OPB.c b/bootstrap/unix-88/OPB.c index 81077606..e09bf1b4 100644 --- a/bootstrap/unix-88/OPB.c +++ b/bootstrap/unix-88/OPB.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -11,13 +11,13 @@ export void (*OPB_typSize)(OPT_Struct); -static int32 OPB_exp; +static int16 OPB_exp; static int64 OPB_maxExp; export void OPB_Assign (OPT_Node *x, OPT_Node y); static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static int32 OPB_BoolToInt (BOOLEAN b); +static int16 OPB_BoolToInt (BOOLEAN b); export void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp); static void OPB_CharToString (OPT_Node n); static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode); @@ -25,9 +25,9 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo); export void OPB_CheckParameters (OPT_Object fp, OPT_Object ap, BOOLEAN checkNames); static void OPB_CheckProc (OPT_Struct x, OPT_Object y); static void OPB_CheckPtr (OPT_Node x, OPT_Node y); -static void OPB_CheckRealType (int32 f, int32 nr, OPT_Const x); +static void OPB_CheckRealType (int16 f, int16 nr, OPT_Const x); static void OPB_CheckReceiver (OPT_Node *x, OPT_Object fp); -static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y); +static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y); export void OPB_Construct (int8 class, OPT_Node *x, OPT_Node y); static void OPB_Convert (OPT_Node *x, OPT_Struct typ); export void OPB_DeRef (OPT_Node *x); @@ -56,17 +56,17 @@ export void OPB_Return (OPT_Node *x, OPT_Object proc); export void OPB_SetElem (OPT_Node *x); static void OPB_SetIntType (OPT_Node node); export void OPB_SetRange (OPT_Node *x, OPT_Node y); -export void OPB_StFct (OPT_Node *par0, int8 fctno, int32 parno); -export void OPB_StPar0 (OPT_Node *par0, int32 fctno); +export void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno); +export void OPB_StPar0 (OPT_Node *par0, int16 fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno); -export void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n); +export void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n); export void OPB_StaticLink (int8 dlev); export void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard); -static void OPB_err (int32 n); +static void OPB_err (int16 n); static int64 OPB_log (int64 x); -static void OPB_err (int32 n) +static void OPB_err (int16 n) { OPM_err(n); } @@ -128,9 +128,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y) *last = y; } -static int32 OPB_BoolToInt (BOOLEAN b) +static int16 OPB_BoolToInt (BOOLEAN b) { - int32 _o_result; + int16 _o_result; if (b) { _o_result = 1; return _o_result; @@ -323,18 +323,18 @@ void OPB_DeRef (OPT_Node *x) void OPB_Index (OPT_Node *x, OPT_Node y) { - int32 f; + int16 f; OPT_Struct typ = NIL; f = y->typ->form; if ((*x)->class >= 7) { OPB_err(79); - } else if (f != 4 || __IN(y->class, 0x0300, 64)) { + } else if (f != 4 || __IN(y->class, 0x0300, 32)) { OPB_err(80); y->typ = OPT_inttyp; } if ((*x)->typ->comp == 2) { typ = (*x)->typ->BaseTyp; - if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (*x)->typ->n))) { + if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (int64)(*x)->typ->n))) { OPB_err(81); } } else if ((*x)->typ->comp == 3) { @@ -355,7 +355,7 @@ void OPB_Field (OPT_Node *x, OPT_Object y) if ((*x)->class >= 7) { OPB_err(77); } - if ((y != NIL && __IN(y->mode, 0x2010, 64))) { + if ((y != NIL && __IN(y->mode, 0x2010, 32))) { OPB_BindNodes(2, y->typ, &*x, NIL); (*x)->obj = y; (*x)->readonly = (*x)->left->readonly || (y->vis == 2 && y->mnolev < 0); @@ -448,7 +448,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) void OPB_In (OPT_Node *x, OPT_Node y) { - int32 f; + int16 f; int64 k; f = (*x)->typ->form; if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) { @@ -459,7 +459,7 @@ void OPB_In (OPT_Node *x, OPT_Node y) if (k < 0 || k > (int64)OPM_MaxSet) { OPB_err(202); } else if (y->class == 7) { - (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 64)); + (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 32)); (*x)->obj = NIL; } else { OPB_BindNodes(12, OPT_booltyp, &*x, y); @@ -489,7 +489,7 @@ static int64 OPB_log (int64 x) return _o_result; } -static void OPB_CheckRealType (int32 f, int32 nr, OPT_Const x) +static void OPB_CheckRealType (int16 f, int16 nr, OPT_Const x) { LONGREAL min, max, r; if (f == 5) { @@ -529,7 +529,7 @@ static OPT_Node NewOp__29 (int8 op, OPT_Struct typ, OPT_Node z) void OPB_MOp (int8 op, OPT_Node *x) { - int32 f; + int16 f; OPT_Struct typ = NIL; OPT_Node z = NIL; struct MOp__28 _s; @@ -555,12 +555,12 @@ void OPB_MOp (int8 op, OPT_Node *x) } break; case 6: - if (!__IN(f, 0x70, 64)) { + if (!__IN(f, 0x70, 32)) { OPB_err(96); } break; case 7: - if (__IN(f, 0xf0, 64)) { + if (__IN(f, 0xf0, 32)) { if (z->class == 7) { if (f == 4) { if (z->conval->intval == (-9223372036854775807-1)) { @@ -569,7 +569,7 @@ void OPB_MOp (int8 op, OPT_Node *x) z->conval->intval = -z->conval->intval; OPB_SetIntType(z); } - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { z->conval->realval = -z->conval->realval; } else { z->conval->setval = ~z->conval->setval; @@ -583,7 +583,7 @@ void OPB_MOp (int8 op, OPT_Node *x) } break; case 21: - if (__IN(f, 0x70, 64)) { + if (__IN(f, 0x70, 32)) { if (z->class == 7) { if (f == 4) { if (z->conval->intval == (-9223372036854775807-1)) { @@ -606,7 +606,7 @@ void OPB_MOp (int8 op, OPT_Node *x) case 22: if (f == 3) { if (z->class == 7) { - z->conval->intval = __CAP((CHAR)z->conval->intval); + z->conval->intval = (int16)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { z = NewOp__29(op, typ, z); @@ -666,7 +666,7 @@ void OPB_MOp (int8 op, OPT_Node *x) static void OPB_CheckPtr (OPT_Node x, OPT_Node y) { - int32 g; + int16 g; OPT_Struct p = NIL, q = NIL, t = NIL; g = y->typ->form; if (g == 11) { @@ -730,7 +730,7 @@ void OPB_CheckParameters (OPT_Object fp, OPT_Object ap, BOOLEAN checkNames) static void OPB_CheckProc (OPT_Struct x, OPT_Object y) { - if (__IN(y->mode, 0x04c0, 64)) { + if (__IN(y->mode, 0x04c0, 32)) { if (y->mode == 6) { if (y->mnolev == 0) { y->mode = 7; @@ -750,17 +750,17 @@ static void OPB_CheckProc (OPT_Struct x, OPT_Object y) static struct ConstOp__13 { OPT_Node *x; - int32 *f; + int16 *f; OPT_Const *xval, *yval; struct ConstOp__13 *lnk; } *ConstOp__13_s; -static int32 ConstCmp__14 (void); +static int16 ConstCmp__14 (void); -static int32 ConstCmp__14 (void) +static int16 ConstCmp__14 (void) { - int32 _o_result; - int32 res; + int16 _o_result; + int16 res; switch (*ConstOp__13_s->f) { case 0: res = 9; @@ -824,9 +824,9 @@ static int32 ConstCmp__14 (void) return _o_result; } -static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) +static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) { - int32 f, g; + int16 f, g; OPT_Const xval = NIL, yval = NIL; int64 xv, yv; BOOLEAN temp; @@ -906,7 +906,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) } break; case 9: - if (!__IN(g, 0x1800, 64)) { + if (!__IN(g, 0x1800, 32)) { OPB_err(100); } break; @@ -937,7 +937,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) } else { OPB_err(204); } - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { temp = __ABS(yval->realval) <= (LONGREAL)1; if (temp || __ABS(xval->realval) <= 1.79769296342094e+308 / (LONGREAL)__ABS(yval->realval)) { xval->realval = xval->realval * yval->realval; @@ -961,7 +961,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) xval->realval = (LONGREAL)1; } x->typ = OPT_realtyp; - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { temp = __ABS(yval->realval) >= (LONGREAL)1; if (temp || __ABS(xval->realval) <= 1.79769296342094e+308 * __ABS(yval->realval)) { xval->realval = xval->realval / yval->realval; @@ -1015,7 +1015,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) } else { OPB_err(206); } - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { temp = (yval->realval >= (LONGREAL)0 && xval->realval <= 1.79769296342094e+308 - yval->realval); if (temp || (yval->realval < (LONGREAL)0 && xval->realval >= -1.79769296342094e+308 - yval->realval)) { xval->realval = xval->realval + yval->realval; @@ -1037,7 +1037,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) } else { OPB_err(207); } - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { temp = (yval->realval >= (LONGREAL)0 && xval->realval >= -1.79769296342094e+308 + yval->realval); if (temp || (yval->realval < (LONGREAL)0 && xval->realval <= 1.79769296342094e+308 + yval->realval)) { xval->realval = xval->realval - yval->realval; @@ -1065,28 +1065,28 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) xval->intval = OPB_BoolToInt(ConstCmp__14() != 9); break; case 11: - if (__IN(f, 0x0a84, 64)) { + if (__IN(f, 0x0a84, 32)) { OPB_err(108); } else { xval->intval = OPB_BoolToInt(ConstCmp__14() == 11); } break; case 12: - if (__IN(f, 0x0a84, 64)) { + if (__IN(f, 0x0a84, 32)) { OPB_err(108); } else { xval->intval = OPB_BoolToInt(ConstCmp__14() != 13); } break; case 13: - if (__IN(f, 0x0a84, 64)) { + if (__IN(f, 0x0a84, 32)) { OPB_err(108); } else { xval->intval = OPB_BoolToInt(ConstCmp__14() == 13); } break; case 14: - if (__IN(f, 0x0a84, 64)) { + if (__IN(f, 0x0a84, 32)) { OPB_err(108); } else { xval->intval = OPB_BoolToInt(ConstCmp__14() != 11); @@ -1104,7 +1104,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) static void OPB_Convert (OPT_Node *x, OPT_Struct typ) { OPT_Node node = NIL; - int32 f, g; + int16 f, g; int64 k; LONGREAL r; f = (*x)->typ->form; @@ -1119,7 +1119,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->conval->intval = 1; } } - } else if (__IN(g, 0x60, 64)) { + } else if (__IN(g, 0x60, 32)) { (*x)->conval->realval = (*x)->conval->intval; (*x)->conval->intval = -1; } else { @@ -1128,8 +1128,8 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) OPB_err(220); } } - } else if (__IN(f, 0x60, 64)) { - if (__IN(g, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { + if (__IN(g, 0x60, 32)) { OPB_CheckRealType(g, 203, (*x)->conval); } else { r = (*x)->conval->realval; @@ -1137,12 +1137,12 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) OPB_err(203); r = (LONGREAL)1; } - (*x)->conval->intval = __ENTIER(r); + (*x)->conval->intval = (int32)__ENTIER(r); OPB_SetIntType(*x); } } (*x)->obj = NIL; - } else if (((((*x)->class == 11 && (*x)->subcl == 20)) && ((*x)->left->typ->form < f || f > g))) { + } else if (((((*x)->class == 11 && (*x)->subcl == 20)) && ((int16)(*x)->left->typ->form < f || f > g))) { if ((*x)->left->typ == typ) { *x = (*x)->left; } @@ -1156,7 +1156,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) } static struct Op__38 { - int32 *f, *g; + int16 *f, *g; struct Op__38 *lnk; } *Op__38_s; @@ -1178,8 +1178,8 @@ static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) { BOOLEAN _o_result; BOOLEAN ok, xCharArr, yCharArr; - xCharArr = (__IN((*x)->typ->comp, 0x0c, 64) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 8; - yCharArr = (__IN((*y)->typ->comp, 0x0c, 64) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 8; + xCharArr = (__IN((*x)->typ->comp, 0x0c, 32) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 8; + yCharArr = (__IN((*y)->typ->comp, 0x0c, 32) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 8; if ((((xCharArr && *Op__38_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); *Op__38_s->g = 8; @@ -1208,7 +1208,7 @@ static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) { - int32 f, g; + int16 f, g; OPT_Node t = NIL, z = NIL; OPT_Struct typ = NIL; BOOLEAN do_; @@ -1238,7 +1238,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) case 4: if ((g == 4 && y->typ->size < z->typ->size)) { OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x70, 64)) { + } else if (__IN(g, 0x70, 32)) { OPB_Convert(&z, y->typ); } else { OPB_err(100); @@ -1247,23 +1247,23 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) case 5: if (g == 4) { OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x60, 64)) { + } else if (__IN(g, 0x60, 32)) { OPB_Convert(&z, y->typ); } else { OPB_err(100); } break; case 6: - if (__IN(g, 0x70, 64)) { + if (__IN(g, 0x70, 32)) { OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x60, 64)) { + } else if (__IN(g, 0x60, 32)) { OPB_Convert(&y, z->typ); } else { OPB_err(100); } break; case 9: - if (!__IN(g, 0x1800, 64)) { + if (!__IN(g, 0x1800, 32)) { OPB_err(100); } break; @@ -1324,7 +1324,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) y->obj = NIL; } } - } else if (!__IN(f, 0xe1, 64)) { + } else if (!__IN(f, 0xe1, 32)) { OPB_err(105); typ = OPT_undftyp; } @@ -1340,7 +1340,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) OPB_Convert(&z, OPT_realtyp); OPB_Convert(&y, OPT_realtyp); typ = OPT_realtyp; - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { if ((y->class == 7 && y->conval->realval == (LONGREAL)0)) { OPB_err(205); } @@ -1407,7 +1407,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) } break; case 6: - if (!__IN(f, 0xf1, 64)) { + if (!__IN(f, 0xf1, 32)) { OPB_err(105); typ = OPT_undftyp; } @@ -1426,7 +1426,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) } break; case 7: - if (!__IN(f, 0xf1, 64)) { + if (!__IN(f, 0xf1, 32)) { OPB_err(106); typ = OPT_undftyp; } @@ -1450,7 +1450,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x1aff, 64) || strings__41(&z, &y)) { + if (__IN(f, 0x1aff, 32) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); @@ -1459,7 +1459,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) NewOp__39(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x79, 64) || strings__41(&z, &y)) { + if (__IN(f, 0x79, 32) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1501,10 +1501,10 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y) } if (((*x)->class == 7 && y->class == 7)) { if (k <= l) { - (*x)->conval->setval = __SETRNG(k, l, 64); + (*x)->conval->setval = __SETRNG(k, l, 32); } else { OPB_err(201); - (*x)->conval->setval = __SETRNG(l, k, 64); + (*x)->conval->setval = __SETRNG(l, k, 32); } (*x)->obj = NIL; } else { @@ -1526,7 +1526,7 @@ void OPB_SetElem (OPT_Node *x) } else if ((*x)->class == 7) { k = (*x)->conval->intval; if ((0 <= k && k <= (int64)OPM_MaxSet)) { - (*x)->conval->setval = __SETOF(k,64); + (*x)->conval->setval = __SETOF(k,32); } else { OPB_err(202); } @@ -1540,9 +1540,9 @@ void OPB_SetElem (OPT_Node *x) static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) { OPT_Struct y = NIL; - int32 f, g; + int16 f, g; OPT_Struct p = NIL, q = NIL; - if (__IN(18, OPM_opt, 64)) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22); OPM_LogWLn(); @@ -1550,7 +1550,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) y = ynode->typ; f = x->form; g = y->form; - if (__IN(18, OPM_opt, 64)) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWStr((CHAR*)"y.form = ", 10); OPM_LogWNum(y->form, 0); OPM_LogWLn(); @@ -1571,7 +1571,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) case 0: case 8: break; case 1: - if (!((__IN(g, 0x1a, 64) && y->size == 1))) { + if (!((__IN(g, 0x1a, 32) && y->size == 1))) { OPB_err(113); } break; @@ -1586,12 +1586,12 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) } break; case 5: - if (!__IN(g, 0x30, 64)) { + if (!__IN(g, 0x30, 32)) { OPB_err(113); } break; case 6: - if (!__IN(g, 0x70, 64)) { + if (!__IN(g, 0x70, 32)) { OPB_err(113); } break; @@ -1639,7 +1639,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) if (ynode->conval->intval2 > x->n) { OPB_err(114); } - } else if ((__IN(y->comp, 0x0c, 64) && y->BaseTyp == OPT_chartyp)) { + } else if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { } else { OPB_err(113); } @@ -1647,7 +1647,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPB_err(113); } } else if ((x->comp == 3 && x->BaseTyp == OPT_chartyp)) { - if ((__IN(y->comp, 0x0c, 64) && y->BaseTyp == OPT_chartyp)) { + if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { } else { OPB_err(113); } @@ -1674,7 +1674,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPM_LogWLn(); break; } - if ((((((ynode->class == 7 && g < f)) && __IN(g, 0x30, 64))) && __IN(f, 0x70, 64))) { + if ((((((ynode->class == 7 && g < f)) && __IN(g, 0x30, 32))) && __IN(f, 0x70, 32))) { OPB_Convert(&ynode, x); } } @@ -1683,9 +1683,9 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo) { } -void OPB_StPar0 (OPT_Node *par0, int32 fctno) +void OPB_StPar0 (OPT_Node *par0, int16 fctno) { - int32 f; + int16 f; OPT_Struct typ = NIL; OPT_Node x = NIL; x = *par0; @@ -1712,7 +1712,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) OPB_err(76); } f = x->typ->BaseTyp->comp; - if (__IN(f, 0x1c, 64)) { + if (__IN(f, 0x1c, 32)) { if (f == 3) { typ = x->typ->BaseTyp; } @@ -1745,7 +1745,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) case 5: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { OPB_Convert(&x, OPT_linttyp); } else { OPB_err(111); @@ -1820,7 +1820,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) case 9: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (__IN(f, 0x11, 64)) { + } else if (__IN(f, 0x11, 32)) { OPB_Convert(&x, OPT_chartyp); } else { OPB_err(111); @@ -1881,7 +1881,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) } break; case 17: - if (!__IN(x->typ->comp, 0x0c, 64)) { + if (!__IN(x->typ->comp, 0x0c, 32)) { OPB_err(131); } break; @@ -1892,7 +1892,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) } if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (((!__IN(x->typ->comp, 0x0c, 64) || x->typ->BaseTyp->form != 3) && f != 8)) { + } else if (((!__IN(x->typ->comp, 0x0c, 32) || x->typ->BaseTyp->form != 3) && f != 8)) { OPB_err(111); } break; @@ -1916,7 +1916,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) if (x->class != 8) { OPB_err(110); x = OPB_NewIntConst(1); - } else if (__IN(f, 0x18fe, 64) || __IN(x->typ->comp, 0x14, 64)) { + } else if (__IN(f, 0x18fe, 32) || __IN(x->typ->comp, 0x14, 32)) { (*OPB_typSize)(x->typ); x->typ->pvused = 1; x = OPB_NewIntConst(x->typ->size); @@ -1931,7 +1931,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) case 22: case 23: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (!__IN(f, 0x9a, 64)) { + } else if (!__IN(f, 0x9a, 32)) { OPB_err(111); } break; @@ -1940,7 +1940,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) OPB_err(126); } else if ((((x->class == 7 && f == 4)) && x->typ->size < OPT_adrtyp->size)) { OPB_Convert(&x, OPT_adrtyp); - } else if (!((__IN(x->typ->form, 0x0810, 64) && x->typ->size == (int64)OPM_AddressSize))) { + } else if (!((__IN(x->typ->form, 0x0810, 32) && x->typ->size == OPM_AddressSize))) { OPB_err(111); x->typ = OPT_adrtyp; } @@ -1957,7 +1957,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) case 29: if (x->class != 8) { OPB_err(110); - } else if (__IN(f, 0x0501, 64) || x->typ->comp == 3) { + } else if (__IN(f, 0x0501, 32) || x->typ->comp == 3) { OPB_err(111); } break; @@ -2009,7 +2009,7 @@ static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) { - int32 f, L; + int16 f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; struct StPar1__52 _s; @@ -2024,7 +2024,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p->typ = OPT_notyp; } else { if (x->typ != p->typ) { - if ((x->class == 7 && f == 4)) { + if ((f == 4 && (x->class == 7 || (p->typ->form == 4 && x->typ->size <= p->typ->size)))) { OPB_Convert(&x, p->typ); } else { OPB_err(111); @@ -2053,11 +2053,11 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) } else if (x->typ->size == 1) { L = OPM_Integer(x->conval->intval); typ = p->typ; - while ((L > 0 && __IN(typ->comp, 0x0c, 64))) { + while ((L > 0 && __IN(typ->comp, 0x0c, 32))) { typ = typ->BaseTyp; L -= 1; } - if (L != 0 || !__IN(typ->comp, 0x0c, 64)) { + if (L != 0 || !__IN(typ->comp, 0x0c, 32)) { OPB_err(132); } else { x->obj = NIL; @@ -2081,7 +2081,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) case 18: if (OPB_NotVar(x)) { OPB_err(112); - } else if ((__IN(x->typ->comp, 0x0c, 64) && x->typ->BaseTyp->form == 3)) { + } else if ((__IN(x->typ->comp, 0x0c, 32) && x->typ->BaseTyp->form == 3)) { if (x->readonly) { OPB_err(76); } @@ -2103,8 +2103,8 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(208); p->conval->intval = 1; } else if (x->conval->intval >= 0) { - if (__ABS(p->conval->intval) <= __DIV(9223372036854775807, __ASH(1, x->conval->intval))) { - p->conval->intval = p->conval->intval * __ASH(1, x->conval->intval); + if (__ABS(p->conval->intval) <= __DIV(9223372036854775807, (int64)__ASH(1, x->conval->intval))) { + p->conval->intval = p->conval->intval * (int64)__ASH(1, x->conval->intval); } else { OPB_err(208); p->conval->intval = 1; @@ -2155,7 +2155,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) case 24: case 25: case 26: case 27: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (__IN(f, 0x18ff, 64)) { + } else if (__IN(f, 0x18ff, 32)) { if (fctno == 24 || fctno == 26) { if (OPB_NotVar(x)) { OPB_err(112); @@ -2181,7 +2181,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p->typ = OPT_booltyp; break; case 29: - if (((x->class == 8 || x->class == 9) || __IN(f, 0x0501, 64)) || x->typ->comp == 3) { + if (((x->class == 8 || x->class == 9) || __IN(f, 0x0501, 32)) || x->typ->comp == 3) { OPB_err(126); } if ((x->class != 7 && x->typ->size < p->typ->size)) { @@ -2213,7 +2213,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(126); } else if ((((x->class == 7 && f == 4)) && x->typ->size < OPT_adrtyp->size)) { OPB_Convert(&x, OPT_adrtyp); - } else if (!((__IN(x->typ->form, 0x0810, 64) && x->typ->size == (int64)OPM_AddressSize))) { + } else if (!((__IN(x->typ->form, 0x0810, 32) && x->typ->size == OPM_AddressSize))) { OPB_err(111); x->typ = OPT_adrtyp; } @@ -2251,10 +2251,10 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) StPar1__52_s = _s.lnk; } -void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n) +void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) { OPT_Node node = NIL; - int32 f; + int16 f; OPT_Node p = NIL; p = *par0; f = x->typ->form; @@ -2296,9 +2296,9 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n) *par0 = p; } -void OPB_StFct (OPT_Node *par0, int8 fctno, int32 parno) +void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno) { - int32 dim; + int16 dim; OPT_Node x = NIL, p = NIL; p = *par0; if (fctno <= 19) { @@ -2362,17 +2362,17 @@ void OPB_StFct (OPT_Node *par0, int8 fctno, int32 parno) static void OPB_DynArrParCheck (OPT_Struct ftyp, OPT_Struct atyp, BOOLEAN fvarpar) { - int32 f; + int16 f; f = atyp->comp; ftyp = ftyp->BaseTyp; atyp = atyp->BaseTyp; if ((fvarpar && ftyp == OPT_bytetyp)) { - if (!__IN(f, 0x0c, 64) || !((__IN(atyp->form, 0x1e, 64) && atyp->size == 1))) { - if (__IN(18, OPM_opt, 64)) { + if (!__IN(f, 0x0c, 32) || !((__IN(atyp->form, 0x1e, 32) && atyp->size == 1))) { + if (__IN(18, OPM_opt, 32)) { OPB_err(-301); } } - } else if (__IN(f, 0x0c, 64)) { + } else if (__IN(f, 0x0c, 32)) { if (ftyp->comp == 3) { OPB_DynArrParCheck(ftyp, atyp, fvarpar); } else if (ftyp != atyp) { @@ -2411,7 +2411,7 @@ static void OPB_CheckReceiver (OPT_Node *x, OPT_Object fp) void OPB_PrepCall (OPT_Node *x, OPT_Object *fpar) { - if (((*x)->obj != NIL && __IN((*x)->obj->mode, 0x22c0, 64))) { + if (((*x)->obj != NIL && __IN((*x)->obj->mode, 0x22c0, 32))) { *fpar = (*x)->obj->link; if ((*x)->obj->mode == 13) { OPB_CheckReceiver(&(*x)->left, *fpar); @@ -2451,7 +2451,7 @@ void OPB_Param (OPT_Node ap, OPT_Object fp) } } else if ((fp->typ == OPT_sysptrtyp && ap->typ->form == 11)) { } else if (ap->typ != fp->typ) { - if ((fp->typ->form == 1 && ((__IN(ap->typ->form, 0x1e, 64) && ap->typ->size == 1)))) { + if ((fp->typ->form == 1 && ((__IN(ap->typ->form, 0x1e, 32) && ap->typ->size == 1)))) { } else if ((ap->typ == OPT_adrtyp && fp->typ == OPT_IntType(ap->typ->size))) { } else { OPB_err(123); @@ -2481,7 +2481,7 @@ void OPB_StaticLink (int8 dlev) scope = OPT_topScope; while (dlev > 0) { dlev -= 1; - scope->link->conval->setval |= __SETOF(3,64); + scope->link->conval->setval |= __SETOF(3,32); scope = scope->left; } } @@ -2576,7 +2576,7 @@ 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, 64) && (*x)->typ->BaseTyp == OPT_chartyp)) && __IN(y->typ->comp, 0x0c, 64))) && y->typ->BaseTyp == OPT_chartyp)) { + 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; diff --git a/bootstrap/unix-88/OPB.h b/bootstrap/unix-88/OPB.h index 6863fee8..dc0085af 100644 --- a/bootstrap/unix-88/OPB.h +++ b/bootstrap/unix-88/OPB.h @@ -37,10 +37,10 @@ import void OPB_PrepCall (OPT_Node *x, OPT_Object *fpar); import void OPB_Return (OPT_Node *x, OPT_Object proc); import void OPB_SetElem (OPT_Node *x); import void OPB_SetRange (OPT_Node *x, OPT_Node y); -import void OPB_StFct (OPT_Node *par0, int8 fctno, int32 parno); -import void OPB_StPar0 (OPT_Node *par0, int32 fctno); +import void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno); +import void OPB_StPar0 (OPT_Node *par0, int16 fctno); import void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno); -import void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n); +import void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n); import void OPB_StaticLink (int8 dlev); import void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard); import void *OPB__init(void); diff --git a/bootstrap/unix-88/OPC.c b/bootstrap/unix-88/OPC.c index ee7f4baa..99353400 100644 --- a/bootstrap/unix-88/OPC.c +++ b/bootstrap/unix-88/OPC.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -10,26 +10,26 @@ #include "OPT.h" -static int32 OPC_indentLevel; +static int16 OPC_indentLevel; static int8 OPC_hashtab[105]; static CHAR OPC_keytab[50][9]; static BOOLEAN OPC_GlbPtrs; static CHAR OPC_BodyNameExt[13]; -export void OPC_Align (int64 *adr, int64 base); +export void OPC_Align (int32 *adr, int32 base); export void OPC_Andent (OPT_Struct typ); static void OPC_AnsiParamList (OPT_Object obj, BOOLEAN showParamNames); -export int64 OPC_BaseAlignment (OPT_Struct typ); +export int32 OPC_BaseAlignment (OPT_Struct typ); export OPT_Object OPC_BaseTProc (OPT_Object obj); export void OPC_BegBlk (void); export void OPC_BegStat (void); -static void OPC_CProcDefs (OPT_Object obj, int32 vis); -export void OPC_Case (int64 caseVal, int32 form); +static void OPC_CProcDefs (OPT_Object obj, int16 vis); +export void OPC_Case (int64 caseVal, int16 form); static void OPC_CharacterLiteral (int64 c); -export void OPC_Cmp (int32 rel); +export void OPC_Cmp (int16 rel); export void OPC_CompleteIdent (OPT_Object obj); -export void OPC_Constant (OPT_Const con, int32 form); +export void OPC_Constant (OPT_Const con, int16 form); static void OPC_DeclareBase (OPT_Object dcl); static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef); static void OPC_DeclareParams (OPT_Object par, BOOLEAN macro); @@ -46,45 +46,45 @@ export void OPC_EnterBody (void); export void OPC_EnterProc (OPT_Object proc); export void OPC_ExitBody (void); export void OPC_ExitProc (OPT_Object proc, BOOLEAN eoBlock, BOOLEAN implicitRet); -static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int64 *off, int64 *n, int64 *curAlign); -static void OPC_FillGap (int64 gap, int64 off, int64 align, int64 *n, int64 *curAlign); +static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int32 *off, int32 *n, int32 *curAlign); +static void OPC_FillGap (int32 gap, int32 off, int32 align, int32 *n, int32 *curAlign); export void OPC_GenBdy (OPT_Node n); -static void OPC_GenDynTypes (OPT_Node n, int32 vis); +static void OPC_GenDynTypes (OPT_Node n, int16 vis); export void OPC_GenEnumPtrs (OPT_Object var); export void OPC_GenHdr (OPT_Node n); export void OPC_GenHdrIncludes (void); static void OPC_GenHeaderMsg (void); -export void OPC_Halt (int64 n); +export void OPC_Halt (int32 n); export void OPC_Ident (OPT_Object obj); -static void OPC_IdentList (OPT_Object obj, int32 vis); +static void OPC_IdentList (OPT_Object obj, int16 vis); static void OPC_Include (CHAR *name, LONGINT name__len); -static void OPC_IncludeImports (OPT_Object obj, int32 vis); +static void OPC_IncludeImports (OPT_Object obj, int16 vis); export void OPC_Increment (BOOLEAN decrement); -export void OPC_Indent (int32 count); +export void OPC_Indent (int16 count); export void OPC_Init (void); static void OPC_InitImports (OPT_Object obj); static void OPC_InitKeywords (void); export void OPC_InitTDesc (OPT_Struct typ); static void OPC_InitTProcs (OPT_Object typ, OPT_Object obj); -export void OPC_IntLiteral (int64 n, int64 size); +export void OPC_IntLiteral (int64 n, int32 size); export void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim); static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName); -static int32 OPC_Length (CHAR *s, LONGINT s__len); -export int64 OPC_NofPtrs (OPT_Struct typ); -static int32 OPC_PerfectHash (CHAR *s, LONGINT s__len); +static int16 OPC_Length (CHAR *s, LONGINT s__len); +export int32 OPC_NofPtrs (OPT_Struct typ); +static int16 OPC_PerfectHash (CHAR *s, LONGINT s__len); static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len); static void OPC_ProcHeader (OPT_Object proc, BOOLEAN define); static void OPC_ProcPredefs (OPT_Object obj, int8 vis); static void OPC_PutBase (OPT_Struct typ); -static void OPC_PutPtrOffsets (OPT_Struct typ, int64 adr, int64 *cnt); +static void OPC_PutPtrOffsets (OPT_Struct typ, int32 adr, int32 *cnt); static void OPC_RegCmds (OPT_Object obj); export void OPC_SetInclude (BOOLEAN exclude); -export int64 OPC_SizeAlignment (int64 size); +export int32 OPC_SizeAlignment (int32 size); static void OPC_Stars (OPT_Struct typ, BOOLEAN *openClause); -static void OPC_Str1 (CHAR *s, LONGINT s__len, int64 x); -static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int64 l); +static void OPC_Str1 (CHAR *s, LONGINT s__len, int32 x); +static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l); export void OPC_TDescDecl (OPT_Struct typ); -export void OPC_TypeDefs (OPT_Object obj, int32 vis); +export void OPC_TypeDefs (OPT_Object obj, int16 vis); export void OPC_TypeOf (OPT_Object ap); static BOOLEAN OPC_Undefined (OPT_Object obj); @@ -95,14 +95,14 @@ void OPC_Init (void) __MOVE("__init(void)", OPC_BodyNameExt, 13); } -void OPC_Indent (int32 count) +void OPC_Indent (int16 count) { OPC_indentLevel += count; } void OPC_BegStat (void) { - int32 i; + int16 i; i = OPC_indentLevel; while (i > 0) { OPM_Write(0x09); @@ -138,10 +138,10 @@ void OPC_EndBlk0 (void) OPM_Write('}'); } -static void OPC_Str1 (CHAR *s, LONGINT s__len, int64 x) +static void OPC_Str1 (CHAR *s, LONGINT s__len, int32 x) { CHAR ch; - int32 i; + int16 i; __DUP(s, s__len, CHAR); ch = s[0]; i = 0; @@ -157,10 +157,10 @@ static void OPC_Str1 (CHAR *s, LONGINT s__len, int64 x) __DEL(s); } -static int32 OPC_Length (CHAR *s, LONGINT s__len) +static int16 OPC_Length (CHAR *s, LONGINT s__len) { - int32 _o_result; - int32 i; + int16 _o_result; + int16 i; i = 0; while (s[__X(i, s__len)] != 0x00) { i += 1; @@ -169,14 +169,14 @@ static int32 OPC_Length (CHAR *s, LONGINT s__len) return _o_result; } -static int32 OPC_PerfectHash (CHAR *s, LONGINT s__len) +static int16 OPC_PerfectHash (CHAR *s, LONGINT s__len) { - int32 _o_result; - int32 i, h; + int16 _o_result; + int16 i, h; i = 0; h = 0; while ((s[__X(i, s__len)] != 0x00 && i < 5)) { - h = 3 * h + s[__X(i, s__len)]; + h = 3 * h + (int16)s[__X(i, s__len)]; i += 1; } _o_result = (int)__MOD(h, 105); @@ -185,10 +185,10 @@ static int32 OPC_PerfectHash (CHAR *s, LONGINT s__len) void OPC_Ident (OPT_Object obj) { - int32 mode, level, h; + int16 mode, level, h; mode = obj->mode; level = obj->mnolev; - if ((__IN(mode, 0x62, 64) && level > 0) || __IN(mode, 0x14, 64)) { + if ((__IN(mode, 0x62, 32) && level > 0) || __IN(mode, 0x14, 32)) { OPM_WriteStringVar((void*)obj->name, 256); h = OPC_PerfectHash((void*)obj->name, 256); if (OPC_hashtab[__X(h, 105)] >= 0) { @@ -225,10 +225,10 @@ void OPC_Ident (OPT_Object obj) static void OPC_Stars (OPT_Struct typ, BOOLEAN *openClause) { - int32 pointers; + int16 pointers; *openClause = 0; if (((typ->strobj == NIL || typ->strobj->name[0] == 0x00) && typ->comp != 4)) { - if (__IN(typ->comp, 0x0c, 64)) { + if (__IN(typ->comp, 0x0c, 32)) { OPC_Stars(typ->BaseTyp, &*openClause); *openClause = typ->comp == 2; } else if (typ->form == 12) { @@ -261,7 +261,7 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef) { OPT_Struct typ = NIL; BOOLEAN varPar, openClause; - int32 form, comp; + int16 form, comp; typ = dcl->typ; varPar = ((dcl->mode == 2 && typ->comp != 2) || typ->comp == 3) || scopeDef; OPC_Stars(typ, &openClause); @@ -285,7 +285,7 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef) break; } else if ((form == 11 && typ->BaseTyp->comp != 3)) { openClause = 1; - } else if (form == 12 || __IN(comp, 0x0c, 64)) { + } else if (form == 12 || __IN(comp, 0x0c, 32)) { if (openClause) { OPM_Write(')'); openClause = 0; @@ -319,7 +319,7 @@ void OPC_Andent (OPT_Struct typ) static BOOLEAN OPC_Undefined (OPT_Object obj) { BOOLEAN _o_result; - _o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (int64)(3 + OPM_currFile))) && obj->linkadr != 2); + _o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (3 + OPM_currFile))) && obj->linkadr != 2); return _o_result; } @@ -327,8 +327,8 @@ static void OPC_DeclareBase (OPT_Object dcl) { OPT_Struct typ = NIL, prev = NIL; OPT_Object obj = NIL; - int32 nofdims; - int64 off, n, dummy; + int16 nofdims; + int32 off, n, dummy; typ = dcl->typ; prev = typ; while ((((((((typ->strobj == NIL || typ->comp == 3) || OPC_Undefined(typ->strobj)) && typ->comp != 4)) && typ->form != 10)) && !((typ->form == 11 && typ->BaseTyp->comp == 3)))) { @@ -387,12 +387,12 @@ static void OPC_DeclareBase (OPT_Object dcl) } } -int64 OPC_NofPtrs (OPT_Struct typ) +int32 OPC_NofPtrs (OPT_Struct typ) { - int64 _o_result; + int32 _o_result; OPT_Object fld = NIL; OPT_Struct btyp = NIL; - int64 n; + int32 n; if ((typ->form == 11 && typ->sysflag == 0)) { _o_result = 1; return _o_result; @@ -430,11 +430,11 @@ int64 OPC_NofPtrs (OPT_Struct typ) __RETCHK; } -static void OPC_PutPtrOffsets (OPT_Struct typ, int64 adr, int64 *cnt) +static void OPC_PutPtrOffsets (OPT_Struct typ, int32 adr, int32 *cnt) { OPT_Object fld = NIL; OPT_Struct btyp = NIL; - int64 n, i; + int32 n, i; if ((typ->form == 11 && typ->sysflag == 0)) { OPM_WriteInt(adr); OPM_WriteString((CHAR*)", ", 3); @@ -510,7 +510,7 @@ static void OPC_PutBase (OPT_Struct typ) static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName) { OPT_Struct typ = NIL; - int32 dim; + int16 dim; if (showParamName) { OPC_Ident(par); OPM_WriteString((CHAR*)"__len", 6); @@ -608,7 +608,7 @@ OPT_Object OPC_BaseTProc (OPT_Object obj) { OPT_Object _o_result; OPT_Struct typ = NIL, base = NIL; - int64 mno; + int32 mno; typ = obj->link->typ; if (typ->form == 11) { typ = typ->BaseTyp; @@ -690,7 +690,7 @@ static void OPC_DefineType (OPT_Struct str) if (str->BaseTyp->comp != 4) { OPC_DefineType(str->BaseTyp); } - } else if (__IN(str->comp, 0x0c, 64)) { + } else if (__IN(str->comp, 0x0c, 32)) { OPC_DefineType(str->BaseTyp); } else if (str->form == 12) { if (str->BaseTyp != OPT_notyp) { @@ -733,7 +733,7 @@ static void OPC_DefineType (OPT_Struct str) static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len) { BOOLEAN _o_result; - int32 i; + int16 i; BOOLEAN r; __DUP(y, y__len, CHAR); i = 0; @@ -746,14 +746,14 @@ static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len) return _o_result; } -static void OPC_CProcDefs (OPT_Object obj, int32 vis) +static void OPC_CProcDefs (OPT_Object obj, int16 vis) { - int32 i; + int16 i; OPT_ConstExt ext = NIL; - int32 _for__9; + int16 _for__9; if (obj != NIL) { OPC_CProcDefs(obj->left, vis); - if ((((obj->mode == 9 && obj->vis >= vis)) && obj->adr == 1)) { + if ((((obj->mode == 9 && (int16)obj->vis >= vis)) && obj->adr == 1)) { ext = obj->conval->ext; i = 1; if (((*ext)[1] != '#' && !(OPC_Prefixed(ext, (CHAR*)"extern ", 8) || OPC_Prefixed(ext, (CHAR*)"import ", 8)))) { @@ -762,7 +762,7 @@ static void OPC_CProcDefs (OPT_Object obj, int32 vis) OPC_DeclareParams(obj->link, 1); OPM_Write(0x09); } - _for__9 = (*obj->conval->ext)[0]; + _for__9 = (int16)(*obj->conval->ext)[0]; i = i; while (i <= _for__9) { OPM_Write((*obj->conval->ext)[__X(i, 256)]); @@ -774,7 +774,7 @@ static void OPC_CProcDefs (OPT_Object obj, int32 vis) } } -void OPC_TypeDefs (OPT_Object obj, int32 vis) +void OPC_TypeDefs (OPT_Object obj, int16 vis) { if (obj != NIL) { OPC_TypeDefs(obj->left, vis); @@ -806,7 +806,7 @@ static void OPC_DefAnonRecs (OPT_Node n) void OPC_TDescDecl (OPT_Struct typ) { - int64 nofptrs; + int32 nofptrs; OPT_Object o = NIL; OPC_BegStat(); OPM_WriteString((CHAR*)"__TDESC(", 9); @@ -821,7 +821,7 @@ void OPC_TDescDecl (OPT_Struct typ) OPC_Str1((CHAR*)", #), {", 8, typ->size); nofptrs = 0; OPC_PutPtrOffsets(typ, 0, &nofptrs); - OPC_Str1((CHAR*)"#}}", 4, -((nofptrs + 1) * (int64)OPM_AddressSize)); + OPC_Str1((CHAR*)"#}}", 4, -((nofptrs + 1) * OPM_AddressSize)); OPC_EndStat(); } @@ -843,7 +843,7 @@ void OPC_InitTDesc (OPT_Struct typ) } } -void OPC_Align (int64 *adr, int64 base) +void OPC_Align (int32 *adr, int32 base) { switch (base) { case 2: @@ -863,11 +863,11 @@ void OPC_Align (int64 *adr, int64 base) } } -int64 OPC_SizeAlignment (int64 size) +int32 OPC_SizeAlignment (int32 size) { - int64 _o_result; - int64 alignment; - if (size < (int64)OPM_Alignment) { + int32 _o_result; + int32 alignment; + if (size < OPM_Alignment) { alignment = 1; while (alignment < size) { alignment = __ASHL(alignment, 1); @@ -879,10 +879,10 @@ int64 OPC_SizeAlignment (int64 size) return _o_result; } -int64 OPC_BaseAlignment (OPT_Struct typ) +int32 OPC_BaseAlignment (OPT_Struct typ) { - int64 _o_result; - int64 alignment; + int32 _o_result; + int32 alignment; if (typ->form == 13) { if (typ->comp == 4) { alignment = __MASK(typ->align, -65536); @@ -896,9 +896,9 @@ int64 OPC_BaseAlignment (OPT_Struct typ) return _o_result; } -static void OPC_FillGap (int64 gap, int64 off, int64 align, int64 *n, int64 *curAlign) +static void OPC_FillGap (int32 gap, int32 off, int32 align, int32 *n, int32 *curAlign) { - int64 adr; + int32 adr; adr = off; OPC_Align(&adr, align); if ((*curAlign < align && gap - (adr - off) >= align)) { @@ -933,11 +933,11 @@ static void OPC_FillGap (int64 gap, int64 off, int64 align, int64 *n, int64 *cur } } -static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int64 *off, int64 *n, int64 *curAlign) +static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int32 *off, int32 *n, int32 *curAlign) { OPT_Object fld = NIL; OPT_Struct base = NIL; - int64 gap, adr, align, fldAlign; + int32 gap, adr, align, fldAlign; fld = typ->link; align = __MASK(typ->align, -65536); if (typ->BaseTyp != NIL) { @@ -981,7 +981,7 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int64 *off, int64 *n, i } } if (last) { - adr = typ->size - (int64)__ASHR(typ->sysflag, 8); + adr = typ->size - __ASHR(typ->sysflag, 8); if (adr == 0) { gap = 1; } else { @@ -993,16 +993,16 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int64 *off, int64 *n, i } } -static void OPC_IdentList (OPT_Object obj, int32 vis) +static void OPC_IdentList (OPT_Object obj, int16 vis) { OPT_Struct base = NIL; BOOLEAN first; - int32 lastvis; + int16 lastvis; base = NIL; first = 1; while ((obj != NIL && obj->mode != 13)) { - if ((__IN(vis, 0x05, 64) || (vis == 1 && obj->vis != 0)) || (vis == 3 && !obj->leaf)) { - if (obj->typ != base || obj->vis != lastvis) { + if ((__IN(vis, 0x05, 32) || (vis == 1 && obj->vis != 0)) || (vis == 3 && !obj->leaf)) { + if (obj->typ != base || (int16)obj->vis != lastvis) { if (!first) { OPC_EndStat(); } @@ -1045,7 +1045,7 @@ static void OPC_IdentList (OPT_Object obj, int32 vis) OPC_Ident(obj); OPM_WriteString((CHAR*)"__typ", 6); base = NIL; - } else if ((((((__IN(5, OPM_opt, 64) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { + } else if ((((((__IN(5, OPM_opt, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { OPM_WriteString((CHAR*)" = NIL", 7); } } @@ -1115,7 +1115,7 @@ static void OPC_ProcPredefs (OPT_Object obj, int8 vis) { if (obj != NIL) { OPC_ProcPredefs(obj->left, vis); - if ((((__IN(obj->mode, 0xc0, 64) && obj->vis >= vis)) && (obj->history != 4 || obj->mode == 6))) { + if ((((__IN(obj->mode, 0xc0, 32) && obj->vis >= vis)) && (obj->history != 4 || obj->mode == 6))) { if (vis == 1) { OPM_WriteString((CHAR*)"import ", 8); } else if (obj->vis == 0) { @@ -1141,18 +1141,18 @@ static void OPC_Include (CHAR *name, LONGINT name__len) __DEL(name); } -static void OPC_IncludeImports (OPT_Object obj, int32 vis) +static void OPC_IncludeImports (OPT_Object obj, int16 vis) { if (obj != NIL) { OPC_IncludeImports(obj->left, vis); - if ((((obj->mode == 11 && obj->mnolev != 0)) && OPT_GlbMod[__X(-obj->mnolev, 64)]->vis >= vis)) { + if ((((obj->mode == 11 && obj->mnolev != 0)) && (int16)OPT_GlbMod[__X(-obj->mnolev, 64)]->vis >= vis)) { OPC_Include(OPT_GlbMod[__X(-obj->mnolev, 64)]->name, 256); } OPC_IncludeImports(obj->right, vis); } } -static void OPC_GenDynTypes (OPT_Node n, int32 vis) +static void OPC_GenDynTypes (OPT_Node n, int16 vis) { OPT_Struct typ = NIL; while ((n != NIL && n->class == 14)) { @@ -1201,15 +1201,15 @@ void OPC_GenHdr (OPT_Node n) static void OPC_GenHeaderMsg (void) { - int32 i; + int16 i; OPM_WriteString((CHAR*)"/* ", 4); OPM_WriteString((CHAR*)"voc", 4); OPM_Write(' '); OPM_WriteString(Configuration_versionLong, 41); OPM_Write(' '); i = 0; - while (i <= 63) { - if (__IN(i, OPM_glbopt, 64)) { + while (i <= 31) { + if (__IN(i, OPM_glbopt, 32)) { switch (i) { case 0: OPM_Write('x'); @@ -1352,7 +1352,7 @@ static void OPC_InitImports (OPT_Object obj) void OPC_GenEnumPtrs (OPT_Object var) { OPT_Struct typ = NIL; - int64 n; + int32 n; OPC_GlbPtrs = 0; while (var != NIL) { typ = var->typ; @@ -1411,7 +1411,7 @@ void OPC_EnterBody (void) { OPM_WriteLn(); OPM_WriteString((CHAR*)"export ", 8); - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); OPM_WriteLn(); } else { @@ -1422,20 +1422,20 @@ void OPC_EnterBody (void) } OPC_BegBlk(); OPC_BegStat(); - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19); } else { OPM_WriteString((CHAR*)"__DEFMOD", 9); } OPC_EndStat(); - if ((__IN(10, OPM_opt, 64) && 0)) { + if ((__IN(10, OPM_opt, 32) && 0)) { OPC_BegStat(); OPM_WriteString((CHAR*)"/*don`t do it!*/ printf(\"DEMO VERSION: DO NOT USE THIS PROGRAM FOR ANY COMMERCIAL PURPOSE\\n\")", 94); OPC_EndStat(); } OPC_InitImports(OPT_topScope->right); OPC_BegStat(); - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__REGMAIN(\"", 12); } else { OPM_WriteString((CHAR*)"__REGMOD(\"", 11); @@ -1455,7 +1455,7 @@ void OPC_EnterBody (void) void OPC_ExitBody (void) { OPC_BegStat(); - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI;", 8); } else { OPM_WriteString((CHAR*)"__ENDMOD;", 10); @@ -1497,7 +1497,7 @@ void OPC_EnterProc (OPT_Object proc) { OPT_Object var = NIL, scope = NIL; OPT_Struct typ = NIL; - int32 dim; + int16 dim; if (proc->vis != 1) { OPM_WriteString((CHAR*)"static ", 8); } @@ -1537,7 +1537,7 @@ void OPC_EnterProc (OPT_Object proc) } var = proc->link; while (var != NIL) { - if ((((__IN(var->typ->comp, 0x0c, 64) && var->mode == 1)) && var->typ->sysflag == 0)) { + if ((((__IN(var->typ->comp, 0x0c, 32) && var->mode == 1)) && var->typ->sysflag == 0)) { OPC_BegStat(); if (var->typ->comp == 2) { OPM_WriteString((CHAR*)"__DUPARR(", 10); @@ -1585,7 +1585,7 @@ void OPC_EnterProc (OPT_Object proc) OPM_Write('.'); OPC_Ident(var); OPM_WriteString((CHAR*)" = ", 4); - if (__IN(var->typ->comp, 0x0c, 64)) { + if (__IN(var->typ->comp, 0x0c, 32)) { OPM_WriteString((CHAR*)"(void*)", 8); } else if (var->mode != 2) { OPM_Write('&'); @@ -1711,7 +1711,7 @@ void OPC_ExitProc (OPT_Object proc, BOOLEAN eoBlock, BOOLEAN implicitRet) void OPC_CompleteIdent (OPT_Object obj) { - int32 comp, level; + int16 comp, level; level = obj->mnolev; if (obj->adr == 1) { if (obj->typ->comp == 4) { @@ -1740,10 +1740,10 @@ void OPC_CompleteIdent (OPT_Object obj) void OPC_TypeOf (OPT_Object ap) { - int32 i; + int16 i; __ASSERT(ap->typ->comp == 4, 0); if (ap->mode == 2) { - if (ap->mnolev != OPM_level) { + if ((int16)ap->mnolev != OPM_level) { OPM_WriteStringVar((void*)ap->scope->name, 256); OPM_WriteString((CHAR*)"_s->", 5); OPC_Ident(ap); @@ -1759,7 +1759,7 @@ void OPC_TypeOf (OPT_Object ap) } } -void OPC_Cmp (int32 rel) +void OPC_Cmp (int16 rel) { switch (rel) { case 9: @@ -1803,15 +1803,15 @@ static void OPC_CharacterLiteral (int64 c) } } -static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int64 l) +static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l) { - int64 i; - int32 c; + int32 i; + int16 c; __DUP(s, s__len, CHAR); OPM_Write('"'); i = 0; while (i < l) { - c = s[__X(i, s__len)]; + c = (int16)s[__X(i, s__len)]; if (c < 32 || c > 126) { OPM_Write('\\'); OPM_Write((CHAR)(48 + __ASHR(c, 6))); @@ -1831,7 +1831,7 @@ static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int64 l) __DEL(s); } -void OPC_Case (int64 caseVal, int32 form) +void OPC_Case (int64 caseVal, int16 form) { CHAR ch; OPM_WriteString((CHAR*)"case ", 6); @@ -1869,12 +1869,12 @@ void OPC_Increment (BOOLEAN decrement) } } -void OPC_Halt (int64 n) +void OPC_Halt (int32 n) { OPC_Str1((CHAR*)"__HALT(#)", 10, n); } -void OPC_IntLiteral (int64 n, int64 size) +void OPC_IntLiteral (int64 n, int32 size) { if ((((size > 4 && n <= 2147483647)) && n > (-2147483647-1))) { OPM_WriteString((CHAR*)"((int", 6); @@ -1904,11 +1904,11 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) } } -void OPC_Constant (OPT_Const con, int32 form) +void OPC_Constant (OPT_Const con, int16 form) { - int32 i; + int16 i; SET s; - int64 hex; + int32 hex; BOOLEAN skipLeading; switch (form) { case 1: @@ -1933,13 +1933,13 @@ void OPC_Constant (OPT_Const con, int32 form) OPM_WriteString((CHAR*)"0x", 3); skipLeading = 1; s = con->setval; - i = 64; + i = 32; do { hex = 0; do { i -= 1; hex = __ASHL(hex, 1); - if (__IN(i, s, 64)) { + if (__IN(i, s, 32)) { hex += 1; } } while (!(__MASK(i, -8) == 0)); @@ -1975,7 +1975,7 @@ static void Enter__49 (CHAR *s, LONGINT s__len); static void Enter__49 (CHAR *s, LONGINT s__len) { - int32 h; + int16 h; __DUP(s, s__len, CHAR); h = OPC_PerfectHash((void*)s, s__len); OPC_hashtab[__X(h, 105)] = *InitKeywords__48_s->n; diff --git a/bootstrap/unix-88/OPC.h b/bootstrap/unix-88/OPC.h index 6fe30a31..4215947f 100644 --- a/bootstrap/unix-88/OPC.h +++ b/bootstrap/unix-88/OPC.h @@ -9,16 +9,16 @@ -import void OPC_Align (int64 *adr, int64 base); +import void OPC_Align (int32 *adr, int32 base); import void OPC_Andent (OPT_Struct typ); -import int64 OPC_BaseAlignment (OPT_Struct typ); +import int32 OPC_BaseAlignment (OPT_Struct typ); import OPT_Object OPC_BaseTProc (OPT_Object obj); import void OPC_BegBlk (void); import void OPC_BegStat (void); -import void OPC_Case (int64 caseVal, int32 form); -import void OPC_Cmp (int32 rel); +import void OPC_Case (int64 caseVal, int16 form); +import void OPC_Cmp (int16 rel); import void OPC_CompleteIdent (OPT_Object obj); -import void OPC_Constant (OPT_Const con, int32 form); +import void OPC_Constant (OPT_Const con, int16 form); import void OPC_DefineInter (OPT_Object proc); import void OPC_EndBlk (void); import void OPC_EndBlk0 (void); @@ -31,19 +31,19 @@ import void OPC_GenBdy (OPT_Node n); import void OPC_GenEnumPtrs (OPT_Object var); import void OPC_GenHdr (OPT_Node n); import void OPC_GenHdrIncludes (void); -import void OPC_Halt (int64 n); +import void OPC_Halt (int32 n); import void OPC_Ident (OPT_Object obj); import void OPC_Increment (BOOLEAN decrement); -import void OPC_Indent (int32 count); +import void OPC_Indent (int16 count); import void OPC_Init (void); import void OPC_InitTDesc (OPT_Struct typ); -import void OPC_IntLiteral (int64 n, int64 size); +import void OPC_IntLiteral (int64 n, int32 size); import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim); -import int64 OPC_NofPtrs (OPT_Struct typ); +import int32 OPC_NofPtrs (OPT_Struct typ); import void OPC_SetInclude (BOOLEAN exclude); -import int64 OPC_SizeAlignment (int64 size); +import int32 OPC_SizeAlignment (int32 size); import void OPC_TDescDecl (OPT_Struct typ); -import void OPC_TypeDefs (OPT_Object obj, int32 vis); +import void OPC_TypeDefs (OPT_Object obj, int16 vis); import void OPC_TypeOf (OPT_Object ap); import void *OPC__init(void); diff --git a/bootstrap/unix-88/OPM.c b/bootstrap/unix-88/OPM.c index 3f07341b..366d6522 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -19,23 +19,24 @@ typedef static CHAR OPM_SourceFileName[256]; -export int32 OPM_Alignment, OPM_AddressSize, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet; +export int16 OPM_Alignment, OPM_AddressSize, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet; export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; export BOOLEAN OPM_noerr; -export int64 OPM_curpos, OPM_errpos, OPM_breakpc; -export int32 OPM_currFile, OPM_level, OPM_pc, OPM_entno; +export int32 OPM_curpos, OPM_errpos, OPM_breakpc; +export int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno; export CHAR OPM_modName[32]; export CHAR OPM_objname[64]; export SET OPM_opt, OPM_glbopt; -static int64 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber, OPM_lasterrpos; +static int32 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber; +static int64 OPM_lasterrpos; static Texts_Reader OPM_inR; static Texts_Text OPM_Log; static Texts_Writer OPM_W; static Files_Rider OPM_oldSF, OPM_newSF; static Files_Rider OPM_R[3]; static Files_File OPM_oldSFile, OPM_newSFile, OPM_HFile, OPM_BFile, OPM_HIFile; -static int32 OPM_S; +static int16 OPM_S; static CHAR OPM_OBERON[1024]; static CHAR OPM_MODULES[1024]; @@ -44,25 +45,25 @@ static void OPM_Append (Files_Rider *R, address *R__typ, Files_File F); export void OPM_CloseFiles (void); export void OPM_CloseOldSym (void); export void OPM_DeleteNewSym (void); -export void OPM_FPrint (int64 *fp, int64 val); -export void OPM_FPrintLReal (int64 *fp, LONGREAL lr); -export void OPM_FPrintReal (int64 *fp, REAL real); -export void OPM_FPrintSet (int64 *fp, SET set); +export void OPM_FPrint (int32 *fp, int64 val); +export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); +export void OPM_FPrintReal (int32 *fp, REAL real); +export void OPM_FPrintSet (int32 *fp, SET set); static void OPM_FindLine (Files_File f, Files_Rider *r, address *r__typ, int64 pos); export void OPM_Get (CHAR *ch); static void OPM_GetProperties (void); -static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int32 *size, int32 *align); +static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); export void OPM_InitOptions (void); -export int32 OPM_Integer (int64 n); -static void OPM_LogErrMsg (int32 n); +export int16 OPM_Integer (int64 n); +static void OPM_LogErrMsg (int16 n); export void OPM_LogW (CHAR ch); export void OPM_LogWLn (void); export void OPM_LogWNum (int64 i, int64 len); export void OPM_LogWStr (CHAR *s, LONGINT s__len); -export int64 OPM_Longint (int64 n); +export int32 OPM_Longint (int64 n); static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len); -export void OPM_Mark (int32 n, int64 pos); +export void OPM_Mark (int16 n, int64 pos); export void OPM_NewSym (CHAR *modName, LONGINT modName__len); export void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); @@ -70,10 +71,10 @@ export BOOLEAN OPM_OpenPar (void); export void OPM_RegisterNewSym (void); static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt); static void OPM_ShowLine (int64 pos); -export int64 OPM_SignedMaximum (int64 bytecount); -export int64 OPM_SignedMinimum (int64 bytecount); +export int64 OPM_SignedMaximum (int32 bytecount); +export int64 OPM_SignedMinimum (int32 bytecount); export void OPM_SymRCh (CHAR *ch); -export int64 OPM_SymRInt (void); +export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); export void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRReal (REAL *r); @@ -92,9 +93,9 @@ export void OPM_WriteReal (LONGREAL r, CHAR suffx); export void OPM_WriteString (CHAR *s, LONGINT s__len); export void OPM_WriteStringVar (CHAR *s, LONGINT s__len); export BOOLEAN OPM_eofSF (void); -export void OPM_err (int32 n); -static int64 OPM_minusop (int64 i); -static int64 OPM_power0 (int64 i, int64 j); +export void OPM_err (int16 n); +static int32 OPM_minusop (int32 i); +static int32 OPM_power0 (int32 i, int32 j); void OPM_LogW (CHAR ch) @@ -119,23 +120,23 @@ void OPM_LogWLn (void) Console_Ln(); } -int64 OPM_Longint (int64 n) -{ - int64 _o_result; - _o_result = (int64)n; - return _o_result; -} - -int32 OPM_Integer (int64 n) +int32 OPM_Longint (int64 n) { int32 _o_result; _o_result = __VAL(int32, n); return _o_result; } +int16 OPM_Integer (int64 n) +{ + int16 _o_result; + _o_result = __VAL(int16, n); + return _o_result; +} + static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) { - int32 i; + int16 i; __DUP(s, s__len, CHAR); i = 1; while (s[__X(i, s__len)] != 0x00) { @@ -219,23 +220,23 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) OPM_LogWStr((CHAR*)"-M option requires two following digits.", 41); OPM_LogWLn(); } else { - OPM_AddressSize = s[__X(i + 1, s__len)] - 48; - OPM_Alignment = s[__X(i + 2, s__len)] - 48; + OPM_AddressSize = (int16)s[__X(i + 1, s__len)] - 48; + OPM_Alignment = (int16)s[__X(i + 2, s__len)] - 48; i += 2; } break; case 'B': if (s[__X(i + 1, s__len)] != 0x00) { i += 1; - OPM_IntegerSize = s[__X(i, s__len)] - 48; + OPM_IntegerSize = (int16)s[__X(i, s__len)] - 48; } if (s[__X(i + 1, s__len)] != 0x00) { i += 1; - OPM_AddressSize = s[__X(i, s__len)] - 48; + OPM_AddressSize = (int16)s[__X(i, s__len)] - 48; } if (s[__X(i + 1, s__len)] != 0x00) { i += 1; - OPM_Alignment = s[__X(i, s__len)] - 48; + OPM_Alignment = (int16)s[__X(i, s__len)] - 48; } __ASSERT(OPM_IntegerSize == 2 || OPM_IntegerSize == 4, 0); __ASSERT(OPM_AddressSize == 4 || OPM_AddressSize == 8, 0); @@ -385,9 +386,9 @@ void OPM_InitOptions (void) s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); } - if (__IN(15, OPM_opt, 64)) { - OPM_glbopt |= __SETOF(10,64); - OPM_opt |= __SETOF(10,64); + if (__IN(15, OPM_opt, 32)) { + OPM_glbopt |= __SETOF(10,32); + OPM_opt |= __SETOF(10,32); } OPM_GetProperties(); } @@ -395,7 +396,7 @@ void OPM_InitOptions (void) void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len) { Texts_Text T = NIL; - int64 beg, end, time; + int32 beg, end, time; CHAR s[256]; *done = 0; OPM_curpos = 0; @@ -443,7 +444,7 @@ void OPM_Get (CHAR *ch) static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len) { - int32 i, j; + int16 i, j; CHAR ch; __DUP(ext, ext__len, CHAR); i = 0; @@ -465,28 +466,28 @@ static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGIN __DEL(ext); } -static void OPM_LogErrMsg (int32 n) +static void OPM_LogErrMsg (int16 n) { Texts_Scanner S; Texts_Text T = NIL; CHAR ch; - int32 i; + int16 i; CHAR buf[1024]; if (n >= 0) { - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"31m", 4); } OPM_LogWStr((CHAR*)" err ", 7); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"35m", 4); } OPM_LogWStr((CHAR*)" warning ", 11); n = -n; - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } @@ -498,18 +499,18 @@ static void OPM_LogErrMsg (int32 n) static void OPM_FindLine (Files_File f, Files_Rider *r, address *r__typ, int64 pos) { CHAR ch, cheol; - if (pos < OPM_ErrorLineStartPos) { + if (pos < (int64)OPM_ErrorLineStartPos) { OPM_ErrorLineStartPos = 0; OPM_ErrorLineLimitPos = 0; OPM_ErrorLineNumber = 0; } - if (pos < OPM_ErrorLineLimitPos) { + if (pos < (int64)OPM_ErrorLineLimitPos) { Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos); return; } Files_Set(&*r, r__typ, f, OPM_ErrorLineLimitPos); Files_Read(&*r, r__typ, (void*)&ch); - while ((OPM_ErrorLineLimitPos < pos && !(*r).eof)) { + while (((int64)OPM_ErrorLineLimitPos < pos && !(*r).eof)) { OPM_ErrorLineStartPos = OPM_ErrorLineLimitPos; OPM_ErrorLineNumber += 1; while ((((ch != 0x00 && ch != 0x0d)) && ch != 0x0a)) { @@ -532,7 +533,7 @@ static void OPM_ShowLine (int64 pos) Files_File f = NIL; Files_Rider r; CHAR line[1023]; - int32 i; + int16 i; CHAR ch; f = Files_Old(OPM_SourceFileName, 256); OPM_FindLine(f, &r, Files_Rider__typ, pos); @@ -551,25 +552,25 @@ static void OPM_ShowLine (int64 pos) OPM_LogWStr(line, 1023); OPM_LogWLn(); OPM_LogWStr((CHAR*)" ", 7); - if (pos >= OPM_ErrorLineLimitPos) { + if (pos >= (int64)OPM_ErrorLineLimitPos) { pos = OPM_ErrorLineLimitPos - 1; } - i = (int32)OPM_Longint(pos - OPM_ErrorLineStartPos); + i = (int16)OPM_Longint(pos - (int64)OPM_ErrorLineStartPos); while (i > 0) { OPM_LogW(' '); i -= 1; } - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogW('^'); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } Files_Close(f); } -void OPM_Mark (int32 n, int64 pos) +void OPM_Mark (int16 n, int64 pos) { if (pos == -1) { pos = 0; @@ -621,49 +622,51 @@ void OPM_Mark (int32 n, int64 pos) } } -void OPM_err (int32 n) +void OPM_err (int16 n) { OPM_Mark(n, OPM_errpos); } -void OPM_FPrint (int64 *fp, int64 val) +void OPM_FPrint (int32 *fp, int64 val) { - *fp = __ROTL((int64)((SET)*fp ^ (SET)val), 1, 64); + *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32); } -void OPM_FPrintSet (int64 *fp, SET set) +void OPM_FPrintSet (int32 *fp, SET set) { - OPM_FPrint(&*fp, (int64)set); + OPM_FPrint(&*fp, (int32)set); } -void OPM_FPrintReal (int64 *fp, REAL real) +void OPM_FPrintReal (int32 *fp, REAL real) { - int32 i; - int64 l; - __GET((address)&real, i, int32); - l = i; + int16 i; + int32 l; + __GET((address)&real, l, int32); OPM_FPrint(&*fp, l); } -void OPM_FPrintLReal (int64 *fp, LONGREAL lr) +void OPM_FPrintLReal (int32 *fp, LONGREAL lr) { - int64 l, h; - OPM_FPrint(&*fp, __VAL(int64, lr)); + int32 l, h; + __GET((address)&lr, l, int32); + __GET((address)&lr + 4, h, int32); + OPM_FPrint(&*fp, l); + OPM_FPrint(&*fp, h); } -static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int32 *size, int32 *align) +static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align) { __DUP(name, name__len, CHAR); if (((*S).class == 1 && __STRCMP((*S).s, name) == 0)) { Texts_Scan(&*S, S__typ); if ((*S).class == 3) { - *size = (int32)(*S).i; + *size = (int16)(*S).i; Texts_Scan(&*S, S__typ); } else { OPM_Mark(-157, -1); } if ((*S).class == 3) { - *align = (int32)(*S).i; + *align = (int16)(*S).i; Texts_Scan(&*S, S__typ); } else { OPM_Mark(-157, -1); @@ -674,17 +677,17 @@ static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONG __DEL(name); } -static int64 OPM_minusop (int64 i) +static int32 OPM_minusop (int32 i) { - int64 _o_result; + int32 _o_result; _o_result = -i; return _o_result; } -static int64 OPM_power0 (int64 i, int64 j) +static int32 OPM_power0 (int32 i, int32 j) { - int64 _o_result; - int64 k, p; + int32 _o_result; + int32 k, p; k = 1; p = i; do { @@ -721,7 +724,7 @@ static void OPM_VerboseListSizes (void) OPM_LogWLn(); } -int64 OPM_SignedMaximum (int64 bytecount) +int64 OPM_SignedMaximum (int32 bytecount) { int64 _o_result; int64 result; @@ -731,7 +734,7 @@ int64 OPM_SignedMaximum (int64 bytecount) return _o_result; } -int64 OPM_SignedMinimum (int64 bytecount) +int64 OPM_SignedMinimum (int32 bytecount) { int64 _o_result; _o_result = -OPM_SignedMaximum(bytecount) - 1; @@ -746,7 +749,7 @@ static void OPM_GetProperties (void) OPM_MinLReal = -OPM_MaxLReal; OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1; OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize); - if (__IN(18, OPM_opt, 64)) { + if (__IN(18, OPM_opt, 32)) { OPM_VerboseListSizes(); } } @@ -756,10 +759,10 @@ void OPM_SymRCh (CHAR *ch) Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&*ch); } -int64 OPM_SymRInt (void) +int32 OPM_SymRInt (void) { - int64 _o_result; - int64 k; + int32 _o_result; + int32 k; Files_ReadNum(&OPM_oldSF, Files_Rider__typ, &k); _o_result = k; return _o_result; @@ -776,7 +779,7 @@ int64 OPM_SymRInt64 (void) void OPM_SymRSet (SET *s) { - Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int64*)&*s); + Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); } void OPM_SymRReal (REAL *r) @@ -830,7 +833,7 @@ void OPM_SymWInt (int64 i) void OPM_SymWSet (SET s) { - Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int64)s); + Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int32)s); } void OPM_SymWReal (REAL r) @@ -845,7 +848,7 @@ void OPM_SymWLReal (LONGREAL lr) void OPM_RegisterNewSym (void) { - if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_opt, 64)) { + if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_opt, 32)) { Files_Register(OPM_newSFile); } } @@ -874,7 +877,7 @@ void OPM_Write (CHAR ch) void OPM_WriteString (CHAR *s, LONGINT s__len) { - int32 i; + int16 i; i = 0; while (s[__X(i, s__len)] != 0x00) { i += 1; @@ -884,7 +887,7 @@ void OPM_WriteString (CHAR *s, LONGINT s__len) void OPM_WriteStringVar (CHAR *s, LONGINT s__len) { - int32 i; + int16 i; i = 0; while (s[__X(i, s__len)] != 0x00) { i += 1; @@ -948,14 +951,14 @@ void OPM_WriteReal (LONGREAL r, CHAR suffx) Texts_Reader R; CHAR s[32]; CHAR ch; - int32 i; - if ((((r < OPM_SignedMaximum(OPM_LongintSize) && r > OPM_SignedMinimum(OPM_LongintSize))) && r == (__ENTIER(r)))) { + int16 i; + if ((((r < OPM_SignedMaximum(OPM_LongintSize) && r > OPM_SignedMinimum(OPM_LongintSize))) && r == ((int32)__ENTIER(r)))) { if (suffx == 'f') { OPM_WriteString((CHAR*)"(REAL)", 7); } else { OPM_WriteString((CHAR*)"(LONGREAL)", 11); } - OPM_WriteInt(__ENTIER(r)); + OPM_WriteInt((int32)__ENTIER(r)); } else { Texts_OpenWriter(&W, Texts_Writer__typ); if (suffx == 'f') { @@ -1036,7 +1039,7 @@ void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len) void OPM_CloseFiles (void) { CHAR FName[32]; - int32 res; + int16 res; if (OPM_noerr) { OPM_LogWStr((CHAR*)" ", 3); OPM_LogWNum(Files_Pos(&OPM_R[1], Files_Rider__typ), 0); @@ -1044,10 +1047,10 @@ void OPM_CloseFiles (void) } if (OPM_noerr) { if (__STRCMP(OPM_modName, "SYSTEM") == 0) { - if (!__IN(10, OPM_opt, 64)) { + if (!__IN(10, OPM_opt, 32)) { Files_Register(OPM_BFile); } - } else if (!__IN(10, OPM_opt, 64)) { + } else if (!__IN(10, OPM_opt, 32)) { OPM_Append(&OPM_R[2], Files_Rider__typ, OPM_HFile); Files_Register(OPM_HIFile); Files_Register(OPM_BFile); @@ -1073,12 +1076,12 @@ void OPM_CloseFiles (void) static void EnumPtrs(void (*P)(void*)) { - __ENUMR(&OPM_inR, Texts_Reader__typ, 96, 1, P); + __ENUMR(&OPM_inR, Texts_Reader__typ, 72, 1, P); P(OPM_Log); - __ENUMR(&OPM_W, Texts_Writer__typ, 72, 1, P); - __ENUMR(&OPM_oldSF, Files_Rider__typ, 40, 1, P); - __ENUMR(&OPM_newSF, Files_Rider__typ, 40, 1, P); - __ENUMR(OPM_R, Files_Rider__typ, 40, 3, P); + __ENUMR(&OPM_W, Texts_Writer__typ, 56, 1, P); + __ENUMR(&OPM_oldSF, Files_Rider__typ, 24, 1, P); + __ENUMR(&OPM_newSF, Files_Rider__typ, 24, 1, P); + __ENUMR(OPM_R, Files_Rider__typ, 24, 3, P); P(OPM_oldSFile); P(OPM_newSFile); P(OPM_HFile); @@ -1121,8 +1124,8 @@ export void *OPM__init(void) OPM_AddressSize = 8; OPM_Alignment = 8; OPM_ShortintSize = 1; - OPM_IntegerSize = 4; - OPM_LongintSize = 8; - OPM_SetSize = 8; + OPM_IntegerSize = 2; + OPM_LongintSize = 4; + OPM_SetSize = 4; __ENDMOD; } diff --git a/bootstrap/unix-88/OPM.h b/bootstrap/unix-88/OPM.h index 765b9680..a6b7990c 100644 --- a/bootstrap/unix-88/OPM.h +++ b/bootstrap/unix-88/OPM.h @@ -6,12 +6,12 @@ #include "SYSTEM.h" -import int32 OPM_Alignment, OPM_AddressSize, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet; +import int16 OPM_Alignment, OPM_AddressSize, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet; import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; import BOOLEAN OPM_noerr; -import int64 OPM_curpos, OPM_errpos, OPM_breakpc; -import int32 OPM_currFile, OPM_level, OPM_pc, OPM_entno; +import int32 OPM_curpos, OPM_errpos, OPM_breakpc; +import int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno; import CHAR OPM_modName[32]; import CHAR OPM_objname[64]; import SET OPM_opt, OPM_glbopt; @@ -20,29 +20,29 @@ import SET OPM_opt, OPM_glbopt; import void OPM_CloseFiles (void); import void OPM_CloseOldSym (void); import void OPM_DeleteNewSym (void); -import void OPM_FPrint (int64 *fp, int64 val); -import void OPM_FPrintLReal (int64 *fp, LONGREAL lr); -import void OPM_FPrintReal (int64 *fp, REAL real); -import void OPM_FPrintSet (int64 *fp, SET set); +import void OPM_FPrint (int32 *fp, int64 val); +import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); +import void OPM_FPrintReal (int32 *fp, REAL real); +import void OPM_FPrintSet (int32 *fp, SET set); import void OPM_Get (CHAR *ch); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_InitOptions (void); -import int32 OPM_Integer (int64 n); +import int16 OPM_Integer (int64 n); import void OPM_LogW (CHAR ch); import void OPM_LogWLn (void); import void OPM_LogWNum (int64 i, int64 len); import void OPM_LogWStr (CHAR *s, LONGINT s__len); -import int64 OPM_Longint (int64 n); -import void OPM_Mark (int32 n, int64 pos); +import int32 OPM_Longint (int64 n); +import void OPM_Mark (int16 n, int64 pos); import void OPM_NewSym (CHAR *modName, LONGINT modName__len); import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); import void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); import BOOLEAN OPM_OpenPar (void); import void OPM_RegisterNewSym (void); -import int64 OPM_SignedMaximum (int64 bytecount); -import int64 OPM_SignedMinimum (int64 bytecount); +import int64 OPM_SignedMaximum (int32 bytecount); +import int64 OPM_SignedMinimum (int32 bytecount); import void OPM_SymRCh (CHAR *ch); -import int64 OPM_SymRInt (void); +import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); import void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRReal (REAL *r); @@ -60,7 +60,7 @@ import void OPM_WriteReal (LONGREAL r, CHAR suffx); import void OPM_WriteString (CHAR *s, LONGINT s__len); import void OPM_WriteStringVar (CHAR *s, LONGINT s__len); import BOOLEAN OPM_eofSF (void); -import void OPM_err (int32 n); +import void OPM_err (int16 n); import void *OPM__init(void); diff --git a/bootstrap/unix-88/OPP.c b/bootstrap/unix-88/OPP.c index 9b25c35f..74f93e77 100644 --- a/bootstrap/unix-88/OPP.c +++ b/bootstrap/unix-88/OPP.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPB.h" @@ -11,7 +11,7 @@ #include "OPT.h" struct OPP__1 { - int64 low, high; + int32 low, high; }; typedef @@ -19,9 +19,9 @@ typedef static int8 OPP_sym, OPP_level; -static int32 OPP_LoopLevel; +static int16 OPP_LoopLevel; static OPT_Node OPP_TDinit, OPP_lastTDinit; -static int32 OPP_nofFwdPtr; +static int16 OPP_nofFwdPtr; static OPT_Struct OPP_FwdPtr[64]; export address *OPP__1__typ; @@ -29,10 +29,10 @@ export address *OPP__1__typ; static void OPP_ActualParameters (OPT_Node *aparlist, OPT_Object fpar); static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned); static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq); -static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP_CaseTable tab); +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP_CaseTable tab); static void OPP_CheckMark (int8 *vis); -static void OPP_CheckSym (int32 s); -static void OPP_CheckSysFlag (int32 *sysflag, int32 default_); +static void OPP_CheckSym (int16 s); +static void OPP_CheckSysFlag (int16 *sysflag, int16 default_); static void OPP_ConstExpression (OPT_Node *x); static void OPP_Element (OPT_Node *x); static void OPP_Expression (OPT_Node *x); @@ -51,19 +51,19 @@ static void OPP_StatSeq (OPT_Node *stat); static void OPP_Term (OPT_Node *x); static void OPP_Type (OPT_Struct *typ, OPT_Struct *banned); static void OPP_TypeDecl (OPT_Struct *typ, OPT_Struct *banned); -static void OPP_err (int32 n); +static void OPP_err (int16 n); static void OPP_qualident (OPT_Object *id); static void OPP_selector (OPT_Node *x); -static void OPP_err (int32 n) +static void OPP_err (int16 n) { OPM_err(n); } -static void OPP_CheckSym (int32 s) +static void OPP_CheckSym (int16 s) { - if (OPP_sym == s) { + if ((int16)OPP_sym == s) { OPS_Get(&OPP_sym); } else { OPM_err(s); @@ -94,7 +94,7 @@ static void OPP_qualident (OPT_Object *id) obj->adr = 0; } else { lev = obj->mnolev; - if ((__IN(obj->mode, 0x06, 64) && lev != OPP_level)) { + if ((__IN(obj->mode, 0x06, 32) && lev != OPP_level)) { obj->leaf = 0; if (lev > 0) { OPB_StaticLink(OPP_level - lev); @@ -131,7 +131,7 @@ static void OPP_CheckMark (int8 *vis) } } -static void OPP_CheckSysFlag (int32 *sysflag, int32 default_) +static void OPP_CheckSysFlag (int16 *sysflag, int16 default_) { OPT_Node x = NIL; int64 sf; @@ -162,7 +162,7 @@ static void OPP_RecordType (OPT_Struct *typ, OPT_Struct *banned) { OPT_Object fld = NIL, first = NIL, last = NIL, base = NIL; OPT_Struct ftyp = NIL; - int32 sysflag; + int16 sysflag; *typ = OPT_NewStr(13, 4); (*typ)->BaseTyp = NIL; OPP_CheckSysFlag(&sysflag, -1); @@ -255,7 +255,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned) { OPT_Node x = NIL; int64 n; - int32 sysflag; + int16 sysflag; OPP_CheckSysFlag(&sysflag, 0); if (OPP_sym == 25) { *typ = OPT_NewStr(13, 3); @@ -325,7 +325,7 @@ static void OPP_PointerType (OPT_Struct *typ) } else { OPP_qualident(&id); if (id->mode == 5) { - if (__IN(id->typ->comp, 0x1c, 64)) { + if (__IN(id->typ->comp, 0x1c, 32)) { (*typ)->BaseTyp = id->typ; } else { (*typ)->BaseTyp = OPT_undftyp; @@ -338,7 +338,7 @@ static void OPP_PointerType (OPT_Struct *typ) } } else { OPP_Type(&(*typ)->BaseTyp, &OPT_notyp); - if (!__IN((*typ)->BaseTyp->comp, 0x1c, 64)) { + if (!__IN((*typ)->BaseTyp->comp, 0x1c, 32)) { (*typ)->BaseTyp = OPT_undftyp; OPP_err(57); } @@ -629,8 +629,8 @@ static void OPP_StandProcCall (OPT_Node *x) { OPT_Node y = NIL; int8 m; - int32 n; - m = (int8)((int32)(*x)->obj->adr); + int16 n; + m = (int8)((int16)(*x)->obj->adr); n = 0; if (OPP_sym == 30) { OPS_Get(&OPP_sym); @@ -931,7 +931,7 @@ static void TProcDecl__23 (void); static void GetCode__19 (void) { OPT_ConstExt ext = NIL; - int32 n; + int16 n; int64 c; ext = OPT_NewExt(); (*ProcedureDeclaration__16_s->proc)->conval->ext = ext; @@ -966,7 +966,7 @@ static void GetCode__19 (void) } } } - (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1,64); + (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1,32); } static void GetParams__21 (void) @@ -996,9 +996,9 @@ static void GetParams__21 (void) static void Body__17 (void) { OPT_Node procdec = NIL, statseq = NIL; - int64 c; + int32 c; c = OPM_errpos; - (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1,64); + (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1,32); OPP_CheckSym(39); OPP_Block(&procdec, &statseq); OPB_Enter(&procdec, statseq, *ProcedureDeclaration__16_s->proc); @@ -1041,7 +1041,7 @@ static void TProcDecl__23 (void) if ((*ProcedureDeclaration__16_s->fwd != NIL && (*ProcedureDeclaration__16_s->fwd)->mnolev != OPP_level)) { *ProcedureDeclaration__16_s->fwd = NIL; } - if ((((*ProcedureDeclaration__16_s->fwd != NIL && (*ProcedureDeclaration__16_s->fwd)->mode == 13)) && !__IN(1, (*ProcedureDeclaration__16_s->fwd)->conval->setval, 64))) { + if ((((*ProcedureDeclaration__16_s->fwd != NIL && (*ProcedureDeclaration__16_s->fwd)->mode == 13)) && !__IN(1, (*ProcedureDeclaration__16_s->fwd)->conval->setval, 32))) { *ProcedureDeclaration__16_s->proc = OPT_NewObj(); (*ProcedureDeclaration__16_s->proc)->leaf = 1; if ((*ProcedureDeclaration__16_s->fwd)->vis != *ProcedureDeclaration__16_s->vis) { @@ -1075,7 +1075,7 @@ static void TProcDecl__23 (void) if ((((((baseProc->vis == 1 && (*ProcedureDeclaration__16_s->proc)->vis == 0)) && recTyp->strobj != NIL)) && recTyp->strobj->vis == 1)) { OPP_err(109); } - (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(2,64); + (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(2,32); } if (!*ProcedureDeclaration__16_s->forward) { Body__17(); @@ -1118,7 +1118,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) } else { OPP_err(38); } - if ((__IN(mode, 0x0600, 64) && !OPT_SYSimported)) { + if ((__IN(mode, 0x0600, 32) && !OPT_SYSimported)) { OPP_err(135); } OPS_Get(&OPP_sym); @@ -1135,7 +1135,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) if ((fwd != NIL && (fwd->mnolev != OPP_level || fwd->mode == 8))) { fwd = NIL; } - if ((((fwd != NIL && __IN(fwd->mode, 0xc0, 64))) && !__IN(1, fwd->conval->setval, 64))) { + if ((((fwd != NIL && __IN(fwd->mode, 0xc0, 32))) && !__IN(1, fwd->conval->setval, 32))) { proc = OPT_NewObj(); proc->leaf = 1; if (fwd->vis != vis) { @@ -1168,17 +1168,17 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) ProcedureDeclaration__16_s = _s.lnk; } -static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP_CaseTable tab) +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP_CaseTable tab) { OPT_Node x = NIL, y = NIL, lastlab = NIL; - int32 i, f; - int64 xval, yval; + int16 i, f; + int32 xval, yval; *lab = NIL; lastlab = NIL; for (;;) { OPP_ConstExpression(&x); f = x->typ->form; - if (__IN(f, 0x18, 64)) { + if (__IN(f, 0x18, 32)) { xval = OPM_Longint(x->conval->intval); } else { OPP_err(61); @@ -1188,14 +1188,14 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP if (!(LabelTyp->form == 4) || LabelTyp->size < x->typ->size) { OPP_err(60); } - } else if (LabelTyp->form != f) { + } else if ((int16)LabelTyp->form != f) { OPP_err(60); } if (OPP_sym == 21) { OPS_Get(&OPP_sym); OPP_ConstExpression(&y); yval = OPM_Longint(y->conval->intval); - if ((y->typ->form != f && !((f == 4 && y->typ->form == 4)))) { + if (((int16)y->typ->form != f && !((f == 4 && y->typ->form == 4)))) { OPP_err(60); } if (yval < xval) { @@ -1239,7 +1239,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP } static struct StatSeq__30 { - int64 *pos; + int32 *pos; struct StatSeq__30 *lnk; } *StatSeq__30_s; @@ -1249,8 +1249,8 @@ static void SetPos__35 (OPT_Node x); static void CasePart__31 (OPT_Node *x) { - int32 n; - int64 low, high; + int16 n; + int32 low, high; BOOLEAN e; OPP_CaseTable tab; OPT_Node cases = NIL, lab = NIL, y = NIL, lastcase = NIL; @@ -1258,7 +1258,7 @@ static void CasePart__31 (OPT_Node *x) *StatSeq__30_s->pos = OPM_errpos; if ((*x)->class == 8 || (*x)->class == 9) { OPP_err(126); - } else if (!__IN((*x)->typ->form, 0x18, 64)) { + } else if (!__IN((*x)->typ->form, 0x18, 32)) { OPP_err(125); } OPP_CheckSym(25); @@ -1333,7 +1333,7 @@ static void OPP_StatSeq (OPT_Node *stat) OPT_Struct idtyp = NIL; BOOLEAN e; OPT_Node s = NIL, x = NIL, y = NIL, z = NIL, apar = NIL, last = NIL, lastif = NIL; - int64 pos; + int32 pos; OPS_Name name; struct StatSeq__30 _s; _s.pos = &pos; @@ -1626,7 +1626,7 @@ static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq) OPT_Struct typ = NIL; OPT_Object obj = NIL, first = NIL, last = NIL; OPT_Node x = NIL, lastdec = NIL; - int32 i; + int16 i; first = NIL; last = NIL; OPP_nofFwdPtr = 0; @@ -1675,7 +1675,7 @@ static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq) if (obj->typ->strobj == NIL) { obj->typ->strobj = obj; } - if (__IN(obj->typ->comp, 0x1c, 64)) { + if (__IN(obj->typ->comp, 0x1c, 32)) { i = 0; while (i < OPP_nofFwdPtr) { typ = OPP_FwdPtr[__X(i, 64)]; @@ -1779,7 +1779,7 @@ void OPP_Module (OPT_Node *prog, SET opt) { OPS_Name impName, aliasName; OPT_Node procdec = NIL, statseq = NIL; - int64 c; + int32 c; BOOLEAN done; OPS_Init(); OPP_LoopLevel = 0; @@ -1880,7 +1880,7 @@ static void EnumPtrs(void (*P)(void*)) __ENUMP(OPP_FwdPtr, 64, P); } -__TDESC(OPP__1, 1, 0) = {__TDFLDS("", 16), {-8}}; +__TDESC(OPP__1, 1, 0) = {__TDFLDS("", 8), {-8}}; export void *OPP__init(void) { diff --git a/bootstrap/unix-88/OPS.c b/bootstrap/unix-88/OPS.c index cd24b8ee..0cac83bd 100644 --- a/bootstrap/unix-88/OPS.c +++ b/bootstrap/unix-88/OPS.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -16,7 +16,7 @@ typedef export OPS_Name OPS_name; export OPS_String OPS_str; -export int32 OPS_numtyp; +export int16 OPS_numtyp; export int64 OPS_intval; export REAL OPS_realval; export LONGREAL OPS_lrlval; @@ -28,17 +28,17 @@ static void OPS_Identifier (int8 *sym); export void OPS_Init (void); static void OPS_Number (void); static void OPS_Str (int8 *sym); -static void OPS_err (int32 n); +static void OPS_err (int16 n); -static void OPS_err (int32 n) +static void OPS_err (int16 n) { OPM_err(n); } static void OPS_Str (int8 *sym) { - int32 i; + int16 i; CHAR och; i = 0; och = OPS_ch; @@ -64,7 +64,7 @@ static void OPS_Str (int8 *sym) if (OPS_intval == 2) { *sym = 35; OPS_numtyp = 1; - OPS_intval = OPS_str[0]; + OPS_intval = (int16)OPS_str[0]; } else { *sym = 37; } @@ -72,7 +72,7 @@ static void OPS_Str (int8 *sym) static void OPS_Identifier (int8 *sym) { - int32 i; + int16 i; i = 0; do { OPS_name[i] = OPS_ch; @@ -91,10 +91,10 @@ static struct Number__6 { struct Number__6 *lnk; } *Number__6_s; -static int32 Ord__7 (CHAR ch, BOOLEAN hex); -static LONGREAL Ten__9 (int32 e); +static int16 Ord__7 (CHAR ch, BOOLEAN hex); +static LONGREAL Ten__9 (int16 e); -static LONGREAL Ten__9 (int32 e) +static LONGREAL Ten__9 (int16 e) { LONGREAL _o_result; LONGREAL x, p; @@ -113,14 +113,14 @@ static LONGREAL Ten__9 (int32 e) return _o_result; } -static int32 Ord__7 (CHAR ch, BOOLEAN hex) +static int16 Ord__7 (CHAR ch, BOOLEAN hex) { - int32 _o_result; + int16 _o_result; if (ch <= '9') { - _o_result = ch - 48; + _o_result = (int16)ch - 48; return _o_result; } else if (hex) { - _o_result = (ch - 65) + 10; + _o_result = ((int16)ch - 65) + 10; return _o_result; } else { OPS_err(2); @@ -132,7 +132,7 @@ static int32 Ord__7 (CHAR ch, BOOLEAN hex) static void OPS_Number (void) { - int32 i, m, n, d, e; + int16 i, m, n, d, e; CHAR dig[24]; LONGREAL f; CHAR expCh; @@ -235,7 +235,7 @@ static void OPS_Number (void) do { n = Ord__7(OPS_ch, 0); OPM_Get(&OPS_ch); - if (e <= __DIV(2147483647 - n, 10)) { + if (e <= __DIV(32767 - n, 10)) { e = e * 10 + n; } else { OPS_err(203); diff --git a/bootstrap/unix-88/OPS.h b/bootstrap/unix-88/OPS.h index bcc2ae4d..caef45f4 100644 --- a/bootstrap/unix-88/OPS.h +++ b/bootstrap/unix-88/OPS.h @@ -14,7 +14,7 @@ typedef import OPS_Name OPS_name; import OPS_String OPS_str; -import int32 OPS_numtyp; +import int16 OPS_numtyp; import int64 OPS_intval; import REAL OPS_realval; import LONGREAL OPS_lrlval; diff --git a/bootstrap/unix-88/OPT.c b/bootstrap/unix-88/OPT.c index 41686385..d40808d2 100644 --- a/bootstrap/unix-88/OPT.c +++ b/bootstrap/unix-88/OPT.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -17,15 +17,16 @@ typedef typedef struct OPT_ConstDesc { OPT_ConstExt ext; - int64 intval, intval2; + int64 intval; + int32 intval2; SET setval; LONGREAL realval; } OPT_ConstDesc; typedef struct OPT_ExpCtxt { - int64 reffp; - int32 ref; + int32 reffp; + int16 ref; int8 nofm; int8 locmno[64]; } OPT_ExpCtxt; @@ -38,12 +39,12 @@ typedef typedef struct OPT_ImpCtxt { - int64 nextTag, reffp; - int32 nofr, minr, nofm; + int32 nextTag, reffp; + int16 nofr, minr, nofm; BOOLEAN self; OPT_Struct ref[255]; OPT_Object old[255]; - int64 pvfp[255]; + int32 pvfp[255]; int8 glbmno[64]; } OPT_ImpCtxt; @@ -67,20 +68,20 @@ typedef BOOLEAN leaf; int8 mode, mnolev, vis, history; BOOLEAN used, fpdone; - int64 fprint; + int32 fprint; OPT_Struct typ; OPT_Const conval; - int64 adr, linkadr; - int32 x; + int32 adr, linkadr; + int16 x; } OPT_ObjDesc; typedef struct OPT_StrDesc { int8 form, comp, mno, extlev; - int32 ref, sysflag; - int64 n, size, align, txtpos; + int16 ref, sysflag; + int32 n, size, align, txtpos; BOOLEAN allocated, pbused, pvused, fpdone, idfpdone; - int64 idfp, pbfp, pvfp; + int32 idfp, pbfp, pvfp; OPT_Struct BaseTyp; OPT_Object link, strobj; } OPT_StrDesc; @@ -97,7 +98,7 @@ export BOOLEAN OPT_SYSimported; static OPT_Object OPT_universe, OPT_syslink; static OPT_ImpCtxt OPT_impCtxt; static OPT_ExpCtxt OPT_expCtxt; -static int64 OPT_nofhdfld; +static int32 OPT_nofhdfld; static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew; export address *OPT_ConstDesc__typ; @@ -110,22 +111,22 @@ export address *OPT_ExpCtxt__typ; export void OPT_Close (void); export void OPT_CloseScope (void); static void OPT_DebugStruct (OPT_Struct btyp); -static void OPT_EnterBoolConst (OPS_Name name, int64 value); -static void OPT_EnterProc (OPS_Name name, int32 num); -static void OPT_EnterTyp (OPS_Name name, int8 form, int32 size, OPT_Struct *res); +static void OPT_EnterBoolConst (OPS_Name name, int32 value); +static void OPT_EnterProc (OPS_Name name, int16 num); +static void OPT_EnterTyp (OPS_Name name, int8 form, int16 size, OPT_Struct *res); static void OPT_EnterTypeAlias (OPS_Name name, OPT_Object *res); export void OPT_Export (BOOLEAN *ext, BOOLEAN *new); -export void OPT_FPrintErr (OPT_Object obj, int32 errcode); -static void OPT_FPrintName (int64 *fp, CHAR *name, LONGINT name__len); +export void OPT_FPrintErr (OPT_Object obj, int16 errcode); +static void OPT_FPrintName (int32 *fp, CHAR *name, LONGINT name__len); export void OPT_FPrintObj (OPT_Object obj); -static void OPT_FPrintSign (int64 *fp, OPT_Struct result, OPT_Object par); +static void OPT_FPrintSign (int32 *fp, OPT_Struct result, OPT_Object par); export void OPT_FPrintStr (OPT_Struct typ); export void OPT_Find (OPT_Object *res); export void OPT_FindField (OPS_Name name, OPT_Struct typ, OPT_Object *res); export void OPT_FindImport (OPT_Object mod, OPT_Object *res); export void OPT_IdFPrint (OPT_Struct typ); export void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); -static void OPT_InConstant (int64 f, OPT_Const conval); +static void OPT_InConstant (int32 f, OPT_Const conval); static OPT_Object OPT_InFld (void); static void OPT_InMod (int8 *mno); static void OPT_InName (CHAR *name, LONGINT name__len); @@ -133,13 +134,13 @@ static OPT_Object OPT_InObj (int8 mno); static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (int8 mno); -static OPT_Struct OPT_InTyp (int64 tag); +static OPT_Struct OPT_InTyp (int32 tag); export void OPT_Init (OPS_Name name, SET opt); static void OPT_InitStruct (OPT_Struct *typ, int8 form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); -export int32 OPT_IntSize (int64 n); -export OPT_Struct OPT_IntType (int64 size); +export int16 OPT_IntSize (int64 n); +export OPT_Struct OPT_IntType (int32 size); export OPT_Const OPT_NewConst (void); export OPT_ConstExt OPT_NewExt (void); export OPT_Node OPT_NewNode (int8 class); @@ -147,27 +148,27 @@ export OPT_Object OPT_NewObj (void); export OPT_Struct OPT_NewStr (int8 form, int8 comp); export void OPT_OpenScope (int8 level, OPT_Object owner); static void OPT_OutConstant (OPT_Object obj); -static void OPT_OutFlds (OPT_Object fld, int64 adr, BOOLEAN visible); -static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int64 adr); -static void OPT_OutMod (int32 mno); +static void OPT_OutFlds (OPT_Object fld, int32 adr, BOOLEAN visible); +static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int32 adr); +static void OPT_OutMod (int16 mno); static void OPT_OutName (CHAR *name, LONGINT name__len); static void OPT_OutObj (OPT_Object obj); static void OPT_OutSign (OPT_Struct result, OPT_Object par); static void OPT_OutStr (OPT_Struct typ); static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj); -export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int32 dir); -static void OPT_err (int32 n); +export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); +static void OPT_err (int16 n); -static void OPT_err (int32 n) +static void OPT_err (int16 n) { OPM_err(n); } -int32 OPT_IntSize (int64 n) +int16 OPT_IntSize (int64 n) { - int32 _o_result; - int32 bytes; + int16 _o_result; + int16 bytes; if (n < 0) { n = -(n + 1); } @@ -179,7 +180,7 @@ int32 OPT_IntSize (int64 n) return _o_result; } -OPT_Struct OPT_IntType (int64 size) +OPT_Struct OPT_IntType (int32 size) { OPT_Struct _o_result; if (size <= OPT_int8typ->size) { @@ -198,10 +199,10 @@ OPT_Struct OPT_IntType (int64 size) return _o_result; } -OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int32 dir) +OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir) { OPT_Struct _o_result; - int32 i; + int16 i; __ASSERT(x->form == 4, 0); __ASSERT(x->BaseTyp == OPT_undftyp, 0); __ASSERT(dir == 1 || dir == -1, 0); @@ -323,15 +324,15 @@ void OPT_Init (OPS_Name name, SET opt) __COPY(name, OPT_topScope->name, 256); OPT_GlbMod[0] = OPT_topScope; OPT_nofGmod = 1; - OPT_newsf = __IN(4, opt, 64); - OPT_findpc = __IN(8, opt, 64); - OPT_extsf = OPT_newsf || __IN(9, opt, 64); + OPT_newsf = __IN(4, opt, 32); + OPT_findpc = __IN(8, opt, 32); + OPT_extsf = OPT_newsf || __IN(9, opt, 32); OPT_sfpresent = 1; } void OPT_Close (void) { - int32 i; + int16 i; OPT_CloseScope(); i = 0; while (i < 64) { @@ -461,14 +462,14 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj) *obj = ob1; } -static void OPT_FPrintName (int64 *fp, CHAR *name, LONGINT name__len) +static void OPT_FPrintName (int32 *fp, CHAR *name, LONGINT name__len) { - int32 i; + int16 i; CHAR ch; i = 0; do { ch = name[__X(i, name__len)]; - OPM_FPrint(&*fp, ch); + OPM_FPrint(&*fp, (int16)ch); i += 1; } while (!(ch == 0x00)); } @@ -506,7 +507,7 @@ static void OPT_DebugStruct (OPT_Struct btyp) OPM_LogWLn(); } -static void OPT_FPrintSign (int64 *fp, OPT_Struct result, OPT_Object par) +static void OPT_FPrintSign (int32 *fp, OPT_Struct result, OPT_Object par) { OPT_IdFPrint(result); OPM_FPrint(&*fp, result->idfp); @@ -522,8 +523,8 @@ void OPT_IdFPrint (OPT_Struct typ) { OPT_Struct btyp = NIL; OPT_Object strobj = NIL; - int64 idfp; - int32 f, c; + int32 idfp; + int16 f, c; if (!typ->idfpdone) { typ->idfpdone = 1; idfp = 0; @@ -552,17 +553,17 @@ void OPT_IdFPrint (OPT_Struct typ) } static struct FPrintStr__13 { - int64 *pbfp, *pvfp; + int32 *pbfp, *pvfp; struct FPrintStr__13 *lnk; } *FPrintStr__13_s; -static void FPrintFlds__14 (OPT_Object fld, int64 adr, BOOLEAN visible); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int64 adr); +static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible); +static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr); static void FPrintTProcs__18 (OPT_Object obj); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int64 adr) +static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr) { - int64 i, j, n; + int32 i, j, n; OPT_Struct btyp = NIL; if (typ->comp == 4) { FPrintFlds__14(typ->link, adr, 0); @@ -592,7 +593,7 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int64 adr) } } -static void FPrintFlds__14 (OPT_Object fld, int64 adr, BOOLEAN visible) +static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible) { while ((fld != NIL && fld->mode == 4)) { if ((fld->vis != 0 && visible)) { @@ -627,10 +628,10 @@ static void FPrintTProcs__18 (OPT_Object obj) void OPT_FPrintStr (OPT_Struct typ) { - int32 f, c; + int16 f, c; OPT_Struct btyp = NIL; OPT_Object strobj = NIL, bstrobj = NIL; - int64 pbfp, pvfp; + int32 pbfp, pvfp; struct FPrintStr__13 _s; _s.pbfp = &pbfp; _s.pvfp = &pvfp; @@ -658,7 +659,7 @@ void OPT_FPrintStr (OPT_Struct typ) pvfp = pbfp; } } else if (f == 12) { - } else if (__IN(c, 0x0c, 64)) { + } else if (__IN(c, 0x0c, 32)) { OPT_FPrintStr(btyp); OPM_FPrint(&pbfp, btyp->pvfp); pvfp = pbfp; @@ -691,8 +692,8 @@ void OPT_FPrintStr (OPT_Struct typ) void OPT_FPrintObj (OPT_Object obj) { - int64 fprint; - int32 f, m; + int32 fprint; + int16 f, m; REAL rval; OPT_ConstExt ext = NIL; if (!obj->fpdone) { @@ -729,16 +730,16 @@ void OPT_FPrintObj (OPT_Object obj) OPM_FPrint(&fprint, obj->vis); OPT_FPrintStr(obj->typ); OPM_FPrint(&fprint, obj->typ->pbfp); - } else if (__IN(obj->mode, 0x0480, 64)) { + } else if (__IN(obj->mode, 0x0480, 32)) { OPT_FPrintSign(&fprint, obj->typ, obj->link); } else if (obj->mode == 9) { OPT_FPrintSign(&fprint, obj->typ, obj->link); ext = obj->conval->ext; - m = (*ext)[0]; + m = (int16)(*ext)[0]; f = 1; OPM_FPrint(&fprint, m); while (f <= m) { - OPM_FPrint(&fprint, (*ext)[__X(f, 256)]); + OPM_FPrint(&fprint, (int16)(*ext)[__X(f, 256)]); f += 1; } } else if (obj->mode == 5) { @@ -749,9 +750,9 @@ void OPT_FPrintObj (OPT_Object obj) } } -void OPT_FPrintErr (OPT_Object obj, int32 errcode) +void OPT_FPrintErr (OPT_Object obj, int16 errcode) { - int32 i, j; + int16 i, j; CHAR ch; if (obj->mnolev != 0) { __COPY(OPT_GlbMod[__X(-obj->mnolev, 64)]->name, OPM_objname, 64); @@ -841,7 +842,7 @@ void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old) static void OPT_InName (CHAR *name, LONGINT name__len) { - int32 i; + int16 i; CHAR ch; i = 0; do { @@ -855,7 +856,7 @@ static void OPT_InMod (int8 *mno) { OPT_Object head = NIL; OPS_Name name; - int64 mn; + int32 mn; int8 i; mn = OPM_SymRInt(); if (mn == 0) { @@ -893,16 +894,16 @@ static void OPT_InMod (int8 *mno) } } -static void OPT_InConstant (int64 f, OPT_Const conval) +static void OPT_InConstant (int32 f, OPT_Const conval) { CHAR ch; - int32 i; + int16 i; OPT_ConstExt ext = NIL; REAL rval; switch (f) { case 1: case 3: case 2: OPM_SymRCh(&ch); - conval->intval = ch; + conval->intval = (int16)ch; break; case 4: conval->intval = OPM_SymRInt(); @@ -945,7 +946,7 @@ static void OPT_InConstant (int64 f, OPT_Const conval) static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par) { OPT_Object last = NIL, new = NIL; - int64 tag; + int32 tag; OPT_InStruct(&*res); tag = OPM_SymRInt(); last = NIL; @@ -973,7 +974,7 @@ static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par) static OPT_Object OPT_InFld (void) { OPT_Object _o_result; - int64 tag; + int32 tag; OPT_Object obj = NIL; tag = OPT_impCtxt.nextTag; obj = OPT_NewObj(); @@ -1005,7 +1006,7 @@ static OPT_Object OPT_InFld (void) static OPT_Object OPT_InTProc (int8 mno) { OPT_Object _o_result; - int64 tag; + int32 tag; OPT_Object obj = NIL; tag = OPT_impCtxt.nextTag; obj = OPT_NewObj(); @@ -1030,7 +1031,7 @@ static OPT_Object OPT_InTProc (int8 mno) return _o_result; } -static OPT_Struct OPT_InTyp (int64 tag) +static OPT_Struct OPT_InTyp (int32 tag) { OPT_Struct _o_result; if (tag == 4) { @@ -1046,8 +1047,8 @@ static OPT_Struct OPT_InTyp (int64 tag) static void OPT_InStruct (OPT_Struct *typ) { int8 mno; - int32 ref; - int64 tag; + int16 ref; + int32 tag; OPS_Name name; OPT_Struct t = NIL; OPT_Object obj = NIL, last = NIL, fld = NIL, old = NIL, dummy = NIL; @@ -1103,7 +1104,7 @@ static void OPT_InStruct (OPT_Struct *typ) obj->vis = 0; tag = OPM_SymRInt(); if (tag == 35) { - (*typ)->sysflag = (int32)OPM_SymRInt(); + (*typ)->sysflag = (int16)OPM_SymRInt(); tag = OPM_SymRInt(); } switch (tag) { @@ -1228,11 +1229,11 @@ static void OPT_InStruct (OPT_Struct *typ) static OPT_Object OPT_InObj (int8 mno) { OPT_Object _o_result; - int32 i, s; + int16 i, s; CHAR ch; OPT_Object obj = NIL, old = NIL; OPT_Struct typ = NIL; - int64 tag; + int32 tag; OPT_ConstExt ext = NIL; tag = OPT_impCtxt.nextTag; if (tag == 19) { @@ -1265,7 +1266,7 @@ static OPT_Object OPT_InObj (int8 mno) obj->mode = 9; ext = OPT_NewExt(); obj->conval->ext = ext; - s = (int32)OPM_SymRInt(); + s = (int16)OPM_SymRInt(); (*ext)[0] = (CHAR)s; i = 1; while (i <= s) { @@ -1374,7 +1375,7 @@ void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done) static void OPT_OutName (CHAR *name, LONGINT name__len) { - int32 i; + int16 i; CHAR ch; i = 0; do { @@ -1384,7 +1385,7 @@ static void OPT_OutName (CHAR *name, LONGINT name__len) } while (!(ch == 0x00)); } -static void OPT_OutMod (int32 mno) +static void OPT_OutMod (int16 mno) { if (OPT_expCtxt.locmno[__X(mno, 64)] < 0) { OPM_SymWInt(16); @@ -1396,9 +1397,9 @@ static void OPT_OutMod (int32 mno) } } -static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int64 adr) +static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int32 adr) { - int64 i, j, n; + int32 i, j, n; OPT_Struct btyp = NIL; if (typ->comp == 4) { OPT_OutFlds(typ->link, adr, 0); @@ -1428,7 +1429,7 @@ static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int64 adr) } } -static void OPT_OutFlds (OPT_Object fld, int64 adr, BOOLEAN visible) +static void OPT_OutFlds (OPT_Object fld, int32 adr, BOOLEAN visible) { while ((fld != NIL && fld->mode == 4)) { if ((fld->vis != 0 && visible)) { @@ -1583,7 +1584,7 @@ static void OPT_OutStr (OPT_Struct typ) static void OPT_OutConstant (OPT_Object obj) { - int32 f; + int16 f; REAL rval; f = obj->typ->form; OPM_SymWInt(f); @@ -1618,11 +1619,11 @@ static void OPT_OutConstant (OPT_Object obj) static void OPT_OutObj (OPT_Object obj) { - int32 i, j; + int16 i, j; OPT_ConstExt ext = NIL; if (obj != NIL) { OPT_OutObj(obj->left); - if (__IN(obj->mode, 0x06ea, 64)) { + if (__IN(obj->mode, 0x06ea, 32)) { if (obj->history == 4) { OPT_FPrintErr(obj, 250); } else if (obj->vis != 0) { @@ -1685,7 +1686,7 @@ static void OPT_OutObj (OPT_Object obj) OPM_SymWInt(33); OPT_OutSign(obj->typ, obj->link); ext = obj->conval->ext; - j = (*ext)[0]; + j = (int16)(*ext)[0]; i = 1; OPM_SymWInt(j); while (i <= j) { @@ -1708,7 +1709,7 @@ static void OPT_OutObj (OPT_Object obj) void OPT_Export (BOOLEAN *ext, BOOLEAN *new) { - int32 i; + int16 i; int8 nofmod; BOOLEAN done; OPT_symExtended = 0; @@ -1732,7 +1733,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) } OPT_OutObj(OPT_topScope->right); *ext = (OPT_sfpresent && OPT_symExtended); - *new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 64); + *new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 32); if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) { *new = 1; if (!OPT_extsf) { @@ -1762,7 +1763,7 @@ static void OPT_InitStruct (OPT_Struct *typ, int8 form) (*typ)->idfpdone = 1; } -static void OPT_EnterBoolConst (OPS_Name name, int64 value) +static void OPT_EnterBoolConst (OPS_Name name, int32 value) { OPT_Object obj = NIL; OPS_Name name__copy; @@ -1774,7 +1775,7 @@ static void OPT_EnterBoolConst (OPS_Name name, int64 value) obj->conval->intval = value; } -static void OPT_EnterTyp (OPS_Name name, int8 form, int32 size, OPT_Struct *res) +static void OPT_EnterTyp (OPS_Name name, int8 form, int16 size, OPT_Struct *res) { OPT_Object obj = NIL; OPT_Struct typ = NIL; @@ -1809,7 +1810,7 @@ static void OPT_EnterTypeAlias (OPS_Name name, OPT_Object *res) *res = obj; } -static void OPT_EnterProc (OPS_Name name, int32 num) +static void OPT_EnterProc (OPS_Name name, int16 num) { OPT_Object obj = NIL; OPS_Name name__copy; @@ -1849,46 +1850,46 @@ static void EnumPtrs(void (*P)(void*)) __ENUMP(OPT_GlbMod, 64, P); P(OPT_universe); P(OPT_syslink); - __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 6216, 1, P); + __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 5184, 1, P); } -__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 40), {0, -16}}; -__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 344), {0, 8, 16, 24, 304, 312, -56}}; -__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 104), {80, 88, 96, -32}}; +__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 32), {0, -16}}; +__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 336), {0, 8, 16, 24, 304, 312, -56}}; +__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 72), {48, 56, 64, -32}}; __TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 56), {0, 8, 16, 32, 40, 48, -56}}; -__TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 6216), {32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, - 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, - 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, 400, 408, - 416, 424, 432, 440, 448, 456, 464, 472, 480, 488, 496, 504, 512, 520, 528, 536, - 544, 552, 560, 568, 576, 584, 592, 600, 608, 616, 624, 632, 640, 648, 656, 664, - 672, 680, 688, 696, 704, 712, 720, 728, 736, 744, 752, 760, 768, 776, 784, 792, - 800, 808, 816, 824, 832, 840, 848, 856, 864, 872, 880, 888, 896, 904, 912, 920, - 928, 936, 944, 952, 960, 968, 976, 984, 992, 1000, 1008, 1016, 1024, 1032, 1040, 1048, - 1056, 1064, 1072, 1080, 1088, 1096, 1104, 1112, 1120, 1128, 1136, 1144, 1152, 1160, 1168, 1176, - 1184, 1192, 1200, 1208, 1216, 1224, 1232, 1240, 1248, 1256, 1264, 1272, 1280, 1288, 1296, 1304, - 1312, 1320, 1328, 1336, 1344, 1352, 1360, 1368, 1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, - 1440, 1448, 1456, 1464, 1472, 1480, 1488, 1496, 1504, 1512, 1520, 1528, 1536, 1544, 1552, 1560, - 1568, 1576, 1584, 1592, 1600, 1608, 1616, 1624, 1632, 1640, 1648, 1656, 1664, 1672, 1680, 1688, - 1696, 1704, 1712, 1720, 1728, 1736, 1744, 1752, 1760, 1768, 1776, 1784, 1792, 1800, 1808, 1816, - 1824, 1832, 1840, 1848, 1856, 1864, 1872, 1880, 1888, 1896, 1904, 1912, 1920, 1928, 1936, 1944, - 1952, 1960, 1968, 1976, 1984, 1992, 2000, 2008, 2016, 2024, 2032, 2040, 2048, 2056, 2064, 2072, - 2080, 2088, 2096, 2104, 2112, 2120, 2128, 2136, 2144, 2152, 2160, 2168, 2176, 2184, 2192, 2200, - 2208, 2216, 2224, 2232, 2240, 2248, 2256, 2264, 2272, 2280, 2288, 2296, 2304, 2312, 2320, 2328, - 2336, 2344, 2352, 2360, 2368, 2376, 2384, 2392, 2400, 2408, 2416, 2424, 2432, 2440, 2448, 2456, - 2464, 2472, 2480, 2488, 2496, 2504, 2512, 2520, 2528, 2536, 2544, 2552, 2560, 2568, 2576, 2584, - 2592, 2600, 2608, 2616, 2624, 2632, 2640, 2648, 2656, 2664, 2672, 2680, 2688, 2696, 2704, 2712, - 2720, 2728, 2736, 2744, 2752, 2760, 2768, 2776, 2784, 2792, 2800, 2808, 2816, 2824, 2832, 2840, - 2848, 2856, 2864, 2872, 2880, 2888, 2896, 2904, 2912, 2920, 2928, 2936, 2944, 2952, 2960, 2968, - 2976, 2984, 2992, 3000, 3008, 3016, 3024, 3032, 3040, 3048, 3056, 3064, 3072, 3080, 3088, 3096, - 3104, 3112, 3120, 3128, 3136, 3144, 3152, 3160, 3168, 3176, 3184, 3192, 3200, 3208, 3216, 3224, - 3232, 3240, 3248, 3256, 3264, 3272, 3280, 3288, 3296, 3304, 3312, 3320, 3328, 3336, 3344, 3352, - 3360, 3368, 3376, 3384, 3392, 3400, 3408, 3416, 3424, 3432, 3440, 3448, 3456, 3464, 3472, 3480, - 3488, 3496, 3504, 3512, 3520, 3528, 3536, 3544, 3552, 3560, 3568, 3576, 3584, 3592, 3600, 3608, - 3616, 3624, 3632, 3640, 3648, 3656, 3664, 3672, 3680, 3688, 3696, 3704, 3712, 3720, 3728, 3736, - 3744, 3752, 3760, 3768, 3776, 3784, 3792, 3800, 3808, 3816, 3824, 3832, 3840, 3848, 3856, 3864, - 3872, 3880, 3888, 3896, 3904, 3912, 3920, 3928, 3936, 3944, 3952, 3960, 3968, 3976, 3984, 3992, - 4000, 4008, 4016, 4024, 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088, 4096, 4104, -4088}}; -__TDESC(OPT_ExpCtxt, 1, 0) = {__TDFLDS("ExpCtxt", 80), {-8}}; +__TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 5184), {16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, + 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, + 272, 280, 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, + 400, 408, 416, 424, 432, 440, 448, 456, 464, 472, 480, 488, 496, 504, 512, 520, + 528, 536, 544, 552, 560, 568, 576, 584, 592, 600, 608, 616, 624, 632, 640, 648, + 656, 664, 672, 680, 688, 696, 704, 712, 720, 728, 736, 744, 752, 760, 768, 776, + 784, 792, 800, 808, 816, 824, 832, 840, 848, 856, 864, 872, 880, 888, 896, 904, + 912, 920, 928, 936, 944, 952, 960, 968, 976, 984, 992, 1000, 1008, 1016, 1024, 1032, + 1040, 1048, 1056, 1064, 1072, 1080, 1088, 1096, 1104, 1112, 1120, 1128, 1136, 1144, 1152, 1160, + 1168, 1176, 1184, 1192, 1200, 1208, 1216, 1224, 1232, 1240, 1248, 1256, 1264, 1272, 1280, 1288, + 1296, 1304, 1312, 1320, 1328, 1336, 1344, 1352, 1360, 1368, 1376, 1384, 1392, 1400, 1408, 1416, + 1424, 1432, 1440, 1448, 1456, 1464, 1472, 1480, 1488, 1496, 1504, 1512, 1520, 1528, 1536, 1544, + 1552, 1560, 1568, 1576, 1584, 1592, 1600, 1608, 1616, 1624, 1632, 1640, 1648, 1656, 1664, 1672, + 1680, 1688, 1696, 1704, 1712, 1720, 1728, 1736, 1744, 1752, 1760, 1768, 1776, 1784, 1792, 1800, + 1808, 1816, 1824, 1832, 1840, 1848, 1856, 1864, 1872, 1880, 1888, 1896, 1904, 1912, 1920, 1928, + 1936, 1944, 1952, 1960, 1968, 1976, 1984, 1992, 2000, 2008, 2016, 2024, 2032, 2040, 2048, 2056, + 2064, 2072, 2080, 2088, 2096, 2104, 2112, 2120, 2128, 2136, 2144, 2152, 2160, 2168, 2176, 2184, + 2192, 2200, 2208, 2216, 2224, 2232, 2240, 2248, 2256, 2264, 2272, 2280, 2288, 2296, 2304, 2312, + 2320, 2328, 2336, 2344, 2352, 2360, 2368, 2376, 2384, 2392, 2400, 2408, 2416, 2424, 2432, 2440, + 2448, 2456, 2464, 2472, 2480, 2488, 2496, 2504, 2512, 2520, 2528, 2536, 2544, 2552, 2560, 2568, + 2576, 2584, 2592, 2600, 2608, 2616, 2624, 2632, 2640, 2648, 2656, 2664, 2672, 2680, 2688, 2696, + 2704, 2712, 2720, 2728, 2736, 2744, 2752, 2760, 2768, 2776, 2784, 2792, 2800, 2808, 2816, 2824, + 2832, 2840, 2848, 2856, 2864, 2872, 2880, 2888, 2896, 2904, 2912, 2920, 2928, 2936, 2944, 2952, + 2960, 2968, 2976, 2984, 2992, 3000, 3008, 3016, 3024, 3032, 3040, 3048, 3056, 3064, 3072, 3080, + 3088, 3096, 3104, 3112, 3120, 3128, 3136, 3144, 3152, 3160, 3168, 3176, 3184, 3192, 3200, 3208, + 3216, 3224, 3232, 3240, 3248, 3256, 3264, 3272, 3280, 3288, 3296, 3304, 3312, 3320, 3328, 3336, + 3344, 3352, 3360, 3368, 3376, 3384, 3392, 3400, 3408, 3416, 3424, 3432, 3440, 3448, 3456, 3464, + 3472, 3480, 3488, 3496, 3504, 3512, 3520, 3528, 3536, 3544, 3552, 3560, 3568, 3576, 3584, 3592, + 3600, 3608, 3616, 3624, 3632, 3640, 3648, 3656, 3664, 3672, 3680, 3688, 3696, 3704, 3712, 3720, + 3728, 3736, 3744, 3752, 3760, 3768, 3776, 3784, 3792, 3800, 3808, 3816, 3824, 3832, 3840, 3848, + 3856, 3864, 3872, 3880, 3888, 3896, 3904, 3912, 3920, 3928, 3936, 3944, 3952, 3960, 3968, 3976, + 3984, 3992, 4000, 4008, 4016, 4024, 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088, -4088}}; +__TDESC(OPT_ExpCtxt, 1, 0) = {__TDFLDS("ExpCtxt", 72), {-8}}; export void *OPT__init(void) { diff --git a/bootstrap/unix-88/OPT.h b/bootstrap/unix-88/OPT.h index 697eb2c9..0bd1f189 100644 --- a/bootstrap/unix-88/OPT.h +++ b/bootstrap/unix-88/OPT.h @@ -15,7 +15,8 @@ typedef typedef struct OPT_ConstDesc { OPT_ConstExt ext; - int64 intval, intval2; + int64 intval; + int32 intval2; SET setval; LONGREAL realval; } OPT_ConstDesc; @@ -46,20 +47,20 @@ typedef BOOLEAN leaf; int8 mode, mnolev, vis, history; BOOLEAN used, fpdone; - int64 fprint; + int32 fprint; OPT_Struct typ; OPT_Const conval; - int64 adr, linkadr; - int32 x; + int32 adr, linkadr; + int16 x; } OPT_ObjDesc; typedef struct OPT_StrDesc { int8 form, comp, mno, extlev; - int32 ref, sysflag; - int64 n, size, align, txtpos; + int16 ref, sysflag; + int32 n, size, align, txtpos; BOOLEAN allocated, pbused, pvused; - char _prvt0[24]; + char _prvt0[16]; OPT_Struct BaseTyp; OPT_Object link, strobj; } OPT_StrDesc; @@ -82,7 +83,7 @@ import address *OPT_NodeDesc__typ; import void OPT_Close (void); import void OPT_CloseScope (void); import void OPT_Export (BOOLEAN *ext, BOOLEAN *new); -import void OPT_FPrintErr (OPT_Object obj, int32 errcode); +import void OPT_FPrintErr (OPT_Object obj, int16 errcode); import void OPT_FPrintObj (OPT_Object obj); import void OPT_FPrintStr (OPT_Struct typ); import void OPT_Find (OPT_Object *res); @@ -93,15 +94,15 @@ import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); import void OPT_Init (OPS_Name name, SET opt); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); -import int32 OPT_IntSize (int64 n); -import OPT_Struct OPT_IntType (int64 size); +import int16 OPT_IntSize (int64 n); +import OPT_Struct OPT_IntType (int32 size); import OPT_Const OPT_NewConst (void); import OPT_ConstExt OPT_NewExt (void); import OPT_Node OPT_NewNode (int8 class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (int8 form, int8 comp); import void OPT_OpenScope (int8 level, OPT_Object owner); -import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int32 dir); +import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); import void *OPT__init(void); diff --git a/bootstrap/unix-88/OPV.c b/bootstrap/unix-88/OPV.c index b57b2868..8ef2c450 100644 --- a/bootstrap/unix-88/OPV.c +++ b/bootstrap/unix-88/OPV.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPC.h" @@ -12,51 +12,51 @@ typedef struct OPV_ExitInfo { - int32 level, label; + int16 level, label; } OPV_ExitInfo; -static int32 OPV_stamp; -static int64 OPV_recno; +static int16 OPV_stamp; +static int32 OPV_recno; static OPV_ExitInfo OPV_exit; -static int32 OPV_nofExitLabels; +static int16 OPV_nofExitLabels; export address *OPV_ExitInfo__typ; static void OPV_ActualPar (OPT_Node n, OPT_Object fp); export void OPV_AdrAndSize (OPT_Object topScope); static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc); -static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int32 prec); +static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec); static void OPV_DefineTDescs (OPT_Node n); -static void OPV_Entier (OPT_Node n, int32 prec); +static void OPV_Entier (OPT_Node n, int16 prec); static void OPV_GetTProcNum (OPT_Object obj); static void OPV_IfStat (OPT_Node n, BOOLEAN withtrap, OPT_Object outerProc); static BOOLEAN OPV_ImplicitReturn (OPT_Node n); -static void OPV_Index (OPT_Node n, OPT_Node d, int32 prec, int32 dim); +static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim); export void OPV_Init (void); static void OPV_InitTDescs (OPT_Node n); static void OPV_Len (OPT_Node n, int64 dim); export void OPV_Module (OPT_Node prog); static void OPV_NewArr (OPT_Node d, OPT_Node x); -static void OPV_ParIntLiteral (int64 n, int64 size); -static int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp); +static void OPV_ParIntLiteral (int64 n, int32 size); +static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp); static BOOLEAN OPV_SideEffects (OPT_Node n); -static void OPV_SizeCast (int64 from, int64 to); +static void OPV_SizeCast (int32 from, int32 to); static void OPV_Stamp (OPS_Name s); static OPT_Object OPV_SuperProc (OPT_Node n); static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported); static void OPV_TraverseRecord (OPT_Struct typ); export void OPV_TypSize (OPT_Struct typ); static void OPV_TypeOf (OPT_Node n); -static void OPV_design (OPT_Node n, int32 prec); -static void OPV_expr (OPT_Node n, int32 prec); +static void OPV_design (OPT_Node n, int16 prec); +static void OPV_expr (OPT_Node n, int16 prec); static void OPV_stat (OPT_Node n, OPT_Object outerProc); void OPV_TypSize (OPT_Struct typ) { - int32 f, c; - int64 offset, size, base, fbase, off0; + int16 f, c; + int32 offset, size, base, fbase, off0; OPT_Object fld = NIL; OPT_Struct btyp = NIL; if (typ == OPT_undftyp) { @@ -71,7 +71,7 @@ void OPV_TypSize (OPT_Struct typ) base = 1; } else { OPV_TypSize(btyp); - offset = btyp->size - (int64)__ASHR(btyp->sysflag, 8); + offset = btyp->size - __ASHR(btyp->sysflag, 8); base = btyp->align; } fld = typ->link; @@ -99,7 +99,7 @@ void OPV_TypSize (OPT_Struct typ) } typ->size = offset; typ->align = base; - typ->sysflag = __MASK(typ->sysflag, -256) + (int32)__ASHL(offset - off0, 8); + typ->sysflag = __MASK(typ->sysflag, -256) + (int16)__ASHL(offset - off0, 8); } else if (c == 2) { OPV_TypSize(typ->BaseTyp); typ->size = typ->n * typ->BaseTyp->size; @@ -133,7 +133,7 @@ void OPV_Init (void) static void OPV_GetTProcNum (OPT_Object obj) { - int64 oldPos; + int32 oldPos; OPT_Struct typ = NIL; OPT_Object redef = NIL; oldPos = OPM_errpos; @@ -145,7 +145,7 @@ static void OPV_GetTProcNum (OPT_Object obj) OPT_FindField(obj->name, typ->BaseTyp, &redef); if (redef != NIL) { obj->adr = __ASHL(__ASHR(redef->adr, 16), 16); - if (!__IN(2, obj->conval->setval, 64)) { + if (!__IN(2, obj->conval->setval, 32)) { OPM_err(119); } } else { @@ -169,7 +169,7 @@ static void OPV_TraverseRecord (OPT_Struct typ) static void OPV_Stamp (OPS_Name s) { - int32 i, j, k; + int16 i, j, k; CHAR n[10]; OPV_stamp += 1; i = 0; @@ -199,7 +199,7 @@ static void OPV_Stamp (OPS_Name s) static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported) { - int32 mode; + int16 mode; OPT_Object scope = NIL; OPT_Struct typ = NIL; if (obj != NIL) { @@ -225,12 +225,12 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte OPV_TypSize(obj->typ); } if (!exported) { - if ((__IN(mode, 0x60, 64) && obj->mnolev > 0)) { + if ((__IN(mode, 0x60, 32) && obj->mnolev > 0)) { OPV_Stamp(obj->name); } - if (__IN(mode, 0x26, 64)) { + if (__IN(mode, 0x26, 32)) { obj->scope = outerScope; - } else if (__IN(mode, 0x26c0, 64)) { + } else if (__IN(mode, 0x26c0, 32)) { if (obj->conval->setval == 0x0) { OPM_err(129); } @@ -275,9 +275,9 @@ void OPV_AdrAndSize (OPT_Object topScope) OPT_sysptrtyp->strobj->linkadr = 2; } -static int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp) +static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp) { - int32 _o_result; + int16 _o_result; switch (class) { case 7: case 0: case 2: case 4: case 9: case 13: @@ -285,7 +285,7 @@ static int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp return _o_result; break; case 5: - if (__IN(3, OPM_opt, 64)) { + if (__IN(3, OPM_opt, 32)) { _o_result = 10; return _o_result; } else { @@ -294,7 +294,7 @@ static int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp } break; case 1: - if (__IN(comp, 0x0c, 64)) { + if (__IN(comp, 0x0c, 32)) { _o_result = 10; return _o_result; } else { @@ -439,9 +439,9 @@ static BOOLEAN OPV_SideEffects (OPT_Node n) __RETCHK; } -static void OPV_Entier (OPT_Node n, int32 prec) +static void OPV_Entier (OPT_Node n, int16 prec) { - if (__IN(n->typ->form, 0x60, 64)) { + if (__IN(n->typ->form, 0x60, 32)) { OPM_WriteString((CHAR*)"__ENTIER(", 10); OPV_expr(n, -1); OPM_Write(')'); @@ -450,7 +450,7 @@ static void OPV_Entier (OPT_Node n, int32 prec) } } -static void OPV_SizeCast (int64 from, int64 to) +static void OPV_SizeCast (int32 from, int32 to) { if ((from != to && (from > 4 || to != 4))) { OPM_WriteString((CHAR*)"(int", 5); @@ -459,9 +459,9 @@ static void OPV_SizeCast (int64 from, int64 to) } } -static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int32 prec) +static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec) { - int32 from, to; + int16 from, to; from = n->typ->form; to = newtype->form; if (to == 7) { @@ -471,7 +471,7 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int32 prec) OPM_WriteInt(__ASHL(newtype->size, 3)); OPM_Write(')'); } else if (to == 4) { - if ((newtype->size < n->typ->size && __IN(2, OPM_opt, 64))) { + if ((newtype->size < n->typ->size && __IN(2, OPM_opt, 32))) { OPM_WriteString((CHAR*)"__SHORT", 8); if (OPV_SideEffects(n)) { OPM_Write('F'); @@ -486,7 +486,7 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int32 prec) OPV_Entier(n, 9); } } else if (to == 3) { - if (__IN(2, OPM_opt, 64)) { + if (__IN(2, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__CHR", 6); if (OPV_SideEffects(n)) { OPM_Write('F'); @@ -509,7 +509,7 @@ static void OPV_TypeOf (OPT_Node n) OPM_WriteString((CHAR*)"__TYPEOF(", 10); OPV_expr(n, -1); OPM_Write(')'); - } else if (__IN(n->class, 0x15, 64)) { + } else if (__IN(n->class, 0x15, 32)) { OPC_Andent(n->typ); OPM_WriteString((CHAR*)"__typ", 6); } else if (n->class == 3) { @@ -525,9 +525,9 @@ static void OPV_TypeOf (OPT_Node n) } } -static void OPV_Index (OPT_Node n, OPT_Node d, int32 prec, int32 dim) +static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim) { - if (!__IN(0, OPM_opt, 64) || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) { + if (!__IN(0, OPM_opt, 32) || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) { OPV_expr(n->right, prec); } else { if (OPV_SideEffects(n->right)) { @@ -542,18 +542,18 @@ static void OPV_Index (OPT_Node n, OPT_Node d, int32 prec, int32 dim) } } -static void OPV_design (OPT_Node n, int32 prec) +static void OPV_design (OPT_Node n, int16 prec) { OPT_Object obj = NIL; OPT_Struct typ = NIL; - int32 class, designPrec, comp; + int16 class, designPrec, comp; OPT_Node d = NIL, x = NIL; - int32 dims, i, _for__27; + int16 dims, i, _for__27; comp = n->typ->comp; obj = n->obj; class = n->class; designPrec = OPV_Precedence(class, n->subcl, n->typ->form, comp); - if ((((((class == 0 && obj->mnolev > 0)) && obj->mnolev != OPM_level)) && prec == 10)) { + if ((((((class == 0 && obj->mnolev > 0)) && (int16)obj->mnolev != OPM_level)) && prec == 10)) { designPrec = 9; } if (prec > designPrec) { @@ -570,7 +570,7 @@ static void OPV_design (OPT_Node n, int32 prec) OPC_CompleteIdent(n->obj); break; case 1: - if (!__IN(comp, 0x0c, 64)) { + if (!__IN(comp, 0x0c, 32)) { OPM_Write('*'); } OPC_CompleteIdent(n->obj); @@ -632,7 +632,7 @@ static void OPV_design (OPT_Node n, int32 prec) } if (n->typ->comp == 3) { OPM_Write(')'); - while ((int64)i < __ASHR(d->typ->size - 4, 2)) { + while (i < __ASHR(d->typ->size - 4, 2)) { OPM_WriteString((CHAR*)" * ", 4); OPV_Len(d, i); i += 1; @@ -649,10 +649,10 @@ static void OPV_design (OPT_Node n, int32 prec) case 5: typ = n->typ; obj = n->left->obj; - if (__IN(3, OPM_opt, 64)) { + if (__IN(3, OPM_opt, 32)) { if (typ->comp == 4) { OPM_WriteString((CHAR*)"__GUARDR(", 10); - if (obj->mnolev != OPM_level) { + if ((int16)obj->mnolev != OPM_level) { OPM_WriteStringVar((void*)obj->scope->name, 256); OPM_WriteString((CHAR*)"__curr->", 9); OPC_Ident(obj); @@ -688,7 +688,7 @@ static void OPV_design (OPT_Node n, int32 prec) } break; case 6: - if (__IN(3, OPM_opt, 64)) { + if (__IN(3, OPM_opt, 32)) { if (n->left->class == 1) { OPM_WriteString((CHAR*)"__GUARDEQR(", 12); OPC_CompleteIdent(n->left->obj); @@ -721,7 +721,7 @@ static void OPV_design (OPT_Node n, int32 prec) } } -static void OPV_ParIntLiteral (int64 n, int64 size) +static void OPV_ParIntLiteral (int64 n, int32 size) { OPM_WriteInt(n); } @@ -729,7 +729,7 @@ static void OPV_ParIntLiteral (int64 n, int64 size) static void OPV_ActualPar (OPT_Node n, OPT_Object fp) { OPT_Struct typ = NIL, aptyp = NIL; - int32 comp, form, mode, prec, dim; + int16 comp, form, mode, prec, dim; OPM_Write('('); while (n != NIL) { typ = fp->typ; @@ -743,7 +743,7 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp) OPM_WriteString((CHAR*)"*)", 3); prec = 10; } - if (!__IN(n->typ->comp, 0x0c, 64)) { + if (!__IN(n->typ->comp, 0x0c, 32)) { if (mode == 2) { if (typ != n->typ) { OPM_WriteString((CHAR*)"(void*)", 8); @@ -751,7 +751,7 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp) OPM_Write('&'); prec = 9; } else { - if ((__IN(comp, 0x0c, 64) && n->class == 7)) { + if ((__IN(comp, 0x0c, 32) && n->class == 7)) { OPM_WriteString((CHAR*)"(CHAR*)", 8); } else if ((((form == 11 && typ != n->typ)) && n->typ != OPT_niltyp)) { OPM_WriteString((CHAR*)"(void*)", 8); @@ -821,9 +821,9 @@ static OPT_Object OPV_SuperProc (OPT_Node n) return _o_result; } -static void OPV_expr (OPT_Node n, int32 prec) +static void OPV_expr (OPT_Node n, int16 prec) { - int32 class, subclass, form, exprPrec; + int16 class, subclass, form, exprPrec; OPT_Struct typ = NIL; OPT_Node l = NIL, r = NIL; OPT_Object proc = NIL; @@ -833,7 +833,7 @@ static void OPV_expr (OPT_Node n, int32 prec) l = n->left; r = n->right; exprPrec = OPV_Precedence(class, subclass, form, n->typ->comp); - if ((exprPrec <= prec && __IN(class, 0x3ce0, 64))) { + if ((exprPrec <= prec && __IN(class, 0x3ce0, 32))) { OPM_Write('('); } switch (class) { @@ -913,18 +913,18 @@ static void OPV_expr (OPT_Node n, int32 prec) if (l->class == 1) { OPC_CompleteIdent(l->obj); } else { - if ((l->typ->form != 8 && !__IN(l->typ->comp, 0x0c, 64))) { + if ((l->typ->form != 8 && !__IN(l->typ->comp, 0x0c, 32))) { OPM_Write('&'); } OPV_expr(l, exprPrec); } break; case 29: - if (!__IN(l->class, 0x17, 64) || (((__IN(n->typ->form, 0x1890, 64) && __IN(l->typ->form, 0x1890, 64))) && n->typ->size == l->typ->size)) { + if (!__IN(l->class, 0x17, 32) || (((__IN(n->typ->form, 0x1890, 32) && __IN(l->typ->form, 0x1890, 32))) && n->typ->size == l->typ->size)) { OPM_Write('('); OPC_Ident(n->typ->strobj); OPM_Write(')'); - if (__IN(n->typ->form, 0x1800, 64) || __IN(l->typ->form, 0x1800, 64)) { + if (__IN(n->typ->form, 0x1800, 32) || __IN(l->typ->form, 0x1800, 32)) { OPM_WriteString((CHAR*)"(address)", 10); } OPV_expr(l, exprPrec); @@ -1021,12 +1021,12 @@ static void OPV_expr (OPT_Node n, int32 prec) } OPV_expr(l, -1); OPM_WriteString((CHAR*)", ", 3); - if ((((__IN(subclass, 0x18020000, 64) && r->class == 7)) && r->conval->intval < 0)) { + if ((((__IN(subclass, 0x18020000, 32) && r->class == 7)) && r->conval->intval < 0)) { OPM_WriteInt(-r->conval->intval); } else { OPV_expr(r, -1); } - if (__IN(subclass, 0x18008000, 64)) { + if (__IN(subclass, 0x18008000, 32)) { OPM_WriteString((CHAR*)", ", 3); if (subclass == 15) { OPM_WriteInt(__ASHL(r->typ->size, 3)); @@ -1038,7 +1038,7 @@ static void OPV_expr (OPT_Node n, int32 prec) break; case 9: case 10: case 11: case 12: case 13: case 14: - if (__IN(l->typ->form, 0x2100, 64)) { + if (__IN(l->typ->form, 0x2100, 32)) { OPM_WriteString((CHAR*)"__STRCMP(", 10); OPV_expr(l, -1); OPM_WriteString((CHAR*)", ", 3); @@ -1135,7 +1135,7 @@ static void OPV_expr (OPT_Node n, int32 prec) OPV_design(n, prec); break; } - if ((exprPrec <= prec && __IN(class, 0x3ca0, 64))) { + if ((exprPrec <= prec && __IN(class, 0x3ca0, 32))) { OPM_Write(')'); } } @@ -1145,7 +1145,7 @@ static void OPV_IfStat (OPT_Node n, BOOLEAN withtrap, OPT_Object outerProc) OPT_Node if_ = NIL; OPT_Object obj = NIL; OPT_Struct typ = NIL; - int64 adr; + int32 adr; if_ = n->left; while (if_ != NIL) { OPM_WriteString((CHAR*)"if ", 4); @@ -1196,7 +1196,7 @@ static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc) { OPT_Node switchCase = NIL, label = NIL; int64 low, high; - int32 form, i; + int16 form, i; OPM_WriteString((CHAR*)"switch ", 8); OPV_expr(n->left, 12); OPM_Write(' '); @@ -1263,7 +1263,7 @@ static BOOLEAN OPV_ImplicitReturn (OPT_Node n) static void OPV_NewArr (OPT_Node d, OPT_Node x) { OPT_Struct typ = NIL, base = NIL; - int32 nofdim, nofdyn; + int16 nofdim, nofdyn; typ = d->typ->BaseTyp; base = typ; nofdim = 0; @@ -1425,7 +1425,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) OPM_WriteString((CHAR*)", ", 3); OPC_Andent(n->left->typ->BaseTyp); OPM_WriteString((CHAR*)")", 2); - } else if (__IN(n->left->typ->BaseTyp->comp, 0x0c, 64)) { + } else if (__IN(n->left->typ->BaseTyp->comp, 0x0c, 32)) { OPV_NewArr(n->left, n->right); } break; @@ -1516,7 +1516,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) case 20: if (n->subcl != 32) { OPV_IfStat(n, 0, outerProc); - } else if (__IN(7, OPM_opt, 64)) { + } else if (__IN(7, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__ASSERT(", 10); OPV_expr(n->left->left->left, -1); OPM_WriteString((CHAR*)", ", 3); @@ -1582,7 +1582,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) break; case 26: if (OPM_level == 0) { - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI", 7); } else { OPM_WriteString((CHAR*)"__ENDMOD", 9); @@ -1618,7 +1618,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) OPM_LogWLn(); break; } - if (!__IN(n->class, 0x09744000, 64)) { + if (!__IN(n->class, 0x09744000, 32)) { OPC_EndStat(); } n = n->link; @@ -1627,7 +1627,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) void OPV_Module (OPT_Node prog) { - if (!__IN(10, OPM_opt, 64)) { + if (!__IN(10, OPM_opt, 32)) { OPC_GenHdr(prog->right); OPC_GenHdrIncludes(); } @@ -1635,7 +1635,7 @@ void OPV_Module (OPT_Node prog) OPV_stat(prog, NIL); } -__TDESC(OPV_ExitInfo, 1, 0) = {__TDFLDS("ExitInfo", 8), {-8}}; +__TDESC(OPV_ExitInfo, 1, 0) = {__TDFLDS("ExitInfo", 4), {-8}}; export void *OPV__init(void) { diff --git a/bootstrap/unix-88/Platform.c b/bootstrap/unix-88/Platform.c index 27df644a..016d1d64 100644 --- a/bootstrap/unix-88/Platform.c +++ b/bootstrap/unix-88/Platform.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -20,84 +20,84 @@ typedef typedef struct Platform_FileIdentity { - int64 volume, index, mtime; + int32 volume, index, mtime; } Platform_FileIdentity; typedef - void (*Platform_HaltProcedure)(int64); + void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int32); + void (*Platform_SignalHandler)(int16); export BOOLEAN Platform_LittleEndian; export address Platform_MainStackFrame; -export int64 Platform_HaltCode; -export int32 Platform_PID; +export int32 Platform_HaltCode; +export int16 Platform_PID; export CHAR Platform_CWD[256]; -export int32 Platform_ArgCount; +export int16 Platform_ArgCount; export address Platform_ArgVector; static Platform_HaltProcedure Platform_HaltHandler; -static int64 Platform_TimeStart; -export int32 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; +static int32 Platform_TimeStart; +export int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; export CHAR Platform_nl[3]; export address *Platform_FileIdentity__typ; -export BOOLEAN Platform_Absent (int32 e); -export int32 Platform_ArgPos (CHAR *s, LONGINT s__len); -export void Platform_AssertFail (int64 code); -export int32 Platform_Chdir (CHAR *n, LONGINT n__len); -export int32 Platform_Close (int64 h); -export BOOLEAN Platform_ConnectionFailed (int32 e); -export void Platform_Delay (int64 ms); -export BOOLEAN Platform_DifferentFilesystems (int32 e); -static void Platform_DisplayHaltCode (int64 code); -export int32 Platform_Error (void); -export void Platform_Exit (int32 code); -export void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len); -export void Platform_GetClock (int64 *t, int64 *d); +export BOOLEAN Platform_Absent (int16 e); +export int16 Platform_ArgPos (CHAR *s, LONGINT s__len); +export void Platform_AssertFail (int32 code); +export int16 Platform_Chdir (CHAR *n, LONGINT n__len); +export int16 Platform_Close (int32 h); +export BOOLEAN Platform_ConnectionFailed (int16 e); +export void Platform_Delay (int32 ms); +export BOOLEAN Platform_DifferentFilesystems (int16 e); +static void Platform_DisplayHaltCode (int32 code); +export int16 Platform_Error (void); +export void Platform_Exit (int16 code); +export void Platform_GetArg (int16 n, CHAR *val, LONGINT val__len); +export void Platform_GetClock (int32 *t, int32 *d); export void Platform_GetEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); -export void Platform_GetIntArg (int32 n, int64 *val); -export void Platform_GetTimeOfDay (int64 *sec, int64 *usec); -export void Platform_Halt (int64 code); -export int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, address *identity__typ); -export int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); -export BOOLEAN Platform_Inaccessible (int32 e); -export void Platform_Init (int32 argc, address argvadr); -export void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d); -export int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h); -export BOOLEAN Platform_NoSuchDirectory (int32 e); +export void Platform_GetIntArg (int16 n, int32 *val); +export void Platform_GetTimeOfDay (int32 *sec, int32 *usec); +export void Platform_Halt (int32 code); +export int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); +export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); +export BOOLEAN Platform_Inaccessible (int16 e); +export void Platform_Init (int16 argc, address argvadr); +export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); +export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); +export BOOLEAN Platform_NoSuchDirectory (int16 e); export address Platform_OSAllocate (address size); export void Platform_OSFree (address address); -export int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h); -export int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h); -export int32 Platform_Read (int64 h, address p, int64 l, int64 *n); -export int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n); -export int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); +export int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h); +export int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h); +export int16 Platform_Read (int32 h, address p, int32 l, int32 *n); +export int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n); +export int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); export BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); export BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); -export int32 Platform_Seek (int64 h, int64 offset, int32 whence); +export int16 Platform_Seek (int32 h, int32 offset, int16 whence); export void Platform_SetBadInstructionHandler (Platform_SignalHandler handler); export void Platform_SetHalt (Platform_HaltProcedure p); export void Platform_SetInterruptHandler (Platform_SignalHandler handler); export void Platform_SetMTime (Platform_FileIdentity *target, address *target__typ, Platform_FileIdentity source); export void Platform_SetQuitHandler (Platform_SignalHandler handler); -export int32 Platform_Size (int64 h, int64 *l); -export int32 Platform_Sync (int64 h); -export int32 Platform_System (CHAR *cmd, LONGINT cmd__len); +export int16 Platform_Size (int32 h, int32 *l); +export int16 Platform_Sync (int32 h); +export int16 Platform_System (CHAR *cmd, LONGINT cmd__len); static void Platform_TestLittleEndian (void); -export int64 Platform_Time (void); -export BOOLEAN Platform_TimedOut (int32 e); -export BOOLEAN Platform_TooManyFiles (int32 e); -export int32 Platform_Truncate (int64 h, int64 l); -export int32 Platform_Unlink (CHAR *n, LONGINT n__len); -export int32 Platform_Write (int64 h, address p, address l); -static void Platform_YMDHMStoClock (int64 ye, int64 mo, int64 da, int64 ho, int64 mi, int64 se, int64 *t, int64 *d); +export int32 Platform_Time (void); +export BOOLEAN Platform_TimedOut (int16 e); +export BOOLEAN Platform_TooManyFiles (int16 e); +export int16 Platform_Truncate (int32 h, int32 l); +export int16 Platform_Unlink (CHAR *n, LONGINT n__len); +export int16 Platform_Write (int32 h, address p, int32 l); +static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 se, int32 *t, int32 *d); static void Platform_errch (CHAR c); -static void Platform_errint (int64 l); +static void Platform_errint (int32 l); static void Platform_errln (void); -static void Platform_errposint (int64 l); +static void Platform_errposint (int32 l); export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); #include @@ -144,7 +144,7 @@ extern void Heap_InitHeap(); #define Platform_opennew(n, n__len) open((char*)n, O_CREAT | O_TRUNC | O_RDWR, 0664) #define Platform_openro(n, n__len) open((char*)n, O_RDONLY) #define Platform_openrw(n, n__len) open((char*)n, O_RDWR) -#define Platform_readfile(fd, p, l) read(fd, (void*)(address)(p), l) +#define Platform_readfile(fd, p, l) (LONGINT)read(fd, (void*)(address)(p), l) #define Platform_rename(o, o__len, n, n__len) rename((char*)o, (char*)n) #define Platform_sectotm(s) struct tm *time = localtime((time_t*)&s) #define Platform_seekcur() SEEK_CUR @@ -169,49 +169,49 @@ extern void Heap_InitHeap(); #define Platform_unlink(n, n__len) unlink((char*)n) #define Platform_writefile(fd, p, l) write(fd, (void*)(address)(p), l) -BOOLEAN Platform_TooManyFiles (int32 e) +BOOLEAN Platform_TooManyFiles (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_EMFILE() || e == Platform_ENFILE(); return _o_result; } -BOOLEAN Platform_NoSuchDirectory (int32 e) +BOOLEAN Platform_NoSuchDirectory (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_ENOENT(); return _o_result; } -BOOLEAN Platform_DifferentFilesystems (int32 e) +BOOLEAN Platform_DifferentFilesystems (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_EXDEV(); return _o_result; } -BOOLEAN Platform_Inaccessible (int32 e) +BOOLEAN Platform_Inaccessible (int16 e) { BOOLEAN _o_result; _o_result = (e == Platform_EACCES() || e == Platform_EROFS()) || e == Platform_EAGAIN(); return _o_result; } -BOOLEAN Platform_Absent (int32 e) +BOOLEAN Platform_Absent (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_ENOENT(); return _o_result; } -BOOLEAN Platform_TimedOut (int32 e) +BOOLEAN Platform_TimedOut (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_ETIMEDOUT(); return _o_result; } -BOOLEAN Platform_ConnectionFailed (int32 e) +BOOLEAN Platform_ConnectionFailed (int16 e) { BOOLEAN _o_result; _o_result = ((e == Platform_ECONNREFUSED() || e == Platform_ECONNABORTED()) || e == Platform_ENETUNREACH()) || e == Platform_EHOSTUNREACH(); @@ -230,7 +230,7 @@ void Platform_OSFree (address address) Platform_free(address); } -void Platform_Init (int32 argc, address argvadr) +void Platform_Init (int16 argc, address argvadr) { Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; @@ -264,7 +264,7 @@ void Platform_GetEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len) __DEL(var); } -void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len) +void Platform_GetArg (int16 n, CHAR *val, LONGINT val__len) { Platform_ArgVec av = NIL; if (n < Platform_ArgCount) { @@ -273,10 +273,10 @@ void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len) } } -void Platform_GetIntArg (int32 n, int64 *val) +void Platform_GetIntArg (int16 n, int32 *val) { CHAR s[64]; - int64 k, d, i; + int32 k, d, i; s[0] = 0x00; Platform_GetArg(n, (void*)s, 64); i = 0; @@ -284,11 +284,11 @@ void Platform_GetIntArg (int32 n, int64 *val) i = 1; } k = 0; - d = s[__X(i, 64)] - 48; + d = (int16)s[__X(i, 64)] - 48; while ((d >= 0 && d <= 9)) { k = k * 10 + d; i += 1; - d = s[__X(i, 64)] - 48; + d = (int16)s[__X(i, 64)] - 48; } if (s[0] == '-') { k = -k; @@ -299,10 +299,10 @@ void Platform_GetIntArg (int32 n, int64 *val) } } -int32 Platform_ArgPos (CHAR *s, LONGINT s__len) +int16 Platform_ArgPos (CHAR *s, LONGINT s__len) { - int32 _o_result; - int32 i; + int16 _o_result; + int16 i; CHAR arg[256]; __DUP(s, s__len, CHAR); i = 0; @@ -331,64 +331,64 @@ void Platform_SetBadInstructionHandler (Platform_SignalHandler handler) Platform_sethandler(4, handler); } -static void Platform_YMDHMStoClock (int64 ye, int64 mo, int64 da, int64 ho, int64 mi, int64 se, int64 *t, int64 *d) +static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 se, int32 *t, int32 *d) { - *d = (__ASHL(__MOD(ye, 100), 9) + __ASHL(mo + 1, 5)) + da; + *d = (__ASHL((int)__MOD(ye, 100), 9) + __ASHL(mo + 1, 5)) + da; *t = (__ASHL(ho, 12) + __ASHL(mi, 6)) + se; } -void Platform_GetClock (int64 *t, int64 *d) +void Platform_GetClock (int32 *t, int32 *d) { Platform_gettimeval(); Platform_sectotm(Platform_tvsec()); Platform_YMDHMStoClock(Platform_tmyear(), Platform_tmmon(), Platform_tmmday(), Platform_tmhour(), Platform_tmmin(), Platform_tmsec(), &*t, &*d); } -void Platform_GetTimeOfDay (int64 *sec, int64 *usec) +void Platform_GetTimeOfDay (int32 *sec, int32 *usec) { Platform_gettimeval(); *sec = Platform_tvsec(); *usec = Platform_tvusec(); } -int64 Platform_Time (void) +int32 Platform_Time (void) { - int64 _o_result; - int64 ms; + int32 _o_result; + int32 ms; Platform_gettimeval(); - ms = __DIVF(Platform_tvusec(), 1000) + Platform_tvsec() * 1000; - _o_result = __MOD(ms - Platform_TimeStart, 2147483647); + ms = (int)__DIVF(Platform_tvusec(), 1000) + Platform_tvsec() * 1000; + _o_result = (int)__MOD(ms - Platform_TimeStart, 2147483647); return _o_result; } -void Platform_Delay (int64 ms) +void Platform_Delay (int32 ms) { - int64 s, ns; + int32 s, ns; s = __DIV(ms, 1000); - ns = __MOD(ms, 1000) * 1000000; + ns = (int)__MOD(ms, 1000) * 1000000; Platform_nanosleep(s, ns); } -int32 Platform_System (CHAR *cmd, LONGINT cmd__len) +int16 Platform_System (CHAR *cmd, LONGINT cmd__len) { - int32 _o_result; + int16 _o_result; __DUP(cmd, cmd__len, CHAR); _o_result = Platform_system(cmd, cmd__len); __DEL(cmd); return _o_result; } -int32 Platform_Error (void) +int16 Platform_Error (void) { - int32 _o_result; + int16 _o_result; _o_result = Platform_err(); return _o_result; } -int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h) +int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h) { - int32 _o_result; - int32 fd; + int16 _o_result; + int16 fd; fd = Platform_openro(n, n__len); if (fd < 0) { _o_result = Platform_err(); @@ -401,10 +401,10 @@ int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h) __RETCHK; } -int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h) +int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h) { - int32 _o_result; - int32 fd; + int16 _o_result; + int16 fd; fd = Platform_openrw(n, n__len); if (fd < 0) { _o_result = Platform_err(); @@ -417,10 +417,10 @@ int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h) __RETCHK; } -int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h) +int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h) { - int32 _o_result; - int32 fd; + int16 _o_result; + int16 fd; fd = Platform_opennew(n, n__len); if (fd < 0) { _o_result = Platform_err(); @@ -433,9 +433,9 @@ int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h) __RETCHK; } -int32 Platform_Close (int64 h) +int16 Platform_Close (int32 h) { - int32 _o_result; + int16 _o_result; if (Platform_closefile(h) < 0) { _o_result = Platform_err(); return _o_result; @@ -446,9 +446,9 @@ int32 Platform_Close (int64 h) __RETCHK; } -int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, address *identity__typ) +int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ) { - int32 _o_result; + int16 _o_result; Platform_structstats(); if (Platform_fstat(h) < 0) { _o_result = Platform_err(); @@ -461,9 +461,9 @@ int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, address *iden return _o_result; } -int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ) +int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ) { - int32 _o_result; + int16 _o_result; __DUP(n, n__len, CHAR); Platform_structstats(); if (Platform_stat(n, n__len) < 0) { @@ -498,15 +498,15 @@ void Platform_SetMTime (Platform_FileIdentity *target, address *target__typ, Pla (*target).mtime = source.mtime; } -void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d) +void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d) { Platform_sectotm(i.mtime); Platform_YMDHMStoClock(Platform_tmyear(), Platform_tmmon(), Platform_tmmday(), Platform_tmhour(), Platform_tmmin(), Platform_tmsec(), &*t, &*d); } -int32 Platform_Size (int64 h, int64 *l) +int16 Platform_Size (int32 h, int32 *l) { - int32 _o_result; + int16 _o_result; Platform_structstats(); if (Platform_fstat(h) < 0) { _o_result = Platform_err(); @@ -517,9 +517,9 @@ int32 Platform_Size (int64 h, int64 *l) return _o_result; } -int32 Platform_Read (int64 h, address p, int64 l, int64 *n) +int16 Platform_Read (int32 h, address p, int32 l, int32 *n) { - int32 _o_result; + int16 _o_result; *n = Platform_readfile(h, p, l); if (*n < 0) { *n = 0; @@ -532,9 +532,9 @@ int32 Platform_Read (int64 h, address p, int64 l, int64 *n) __RETCHK; } -int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n) +int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n) { - int32 _o_result; + int16 _o_result; *n = Platform_readfile(h, (address)b, b__len); if (*n < 0) { *n = 0; @@ -547,9 +547,9 @@ int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n) __RETCHK; } -int32 Platform_Write (int64 h, address p, address l) +int16 Platform_Write (int32 h, address p, int32 l) { - int32 _o_result; + int16 _o_result; address written; written = Platform_writefile(h, p, l); if (written < 0) { @@ -562,9 +562,9 @@ int32 Platform_Write (int64 h, address p, address l) __RETCHK; } -int32 Platform_Sync (int64 h) +int16 Platform_Sync (int32 h) { - int32 _o_result; + int16 _o_result; if (Platform_fsync(h) < 0) { _o_result = Platform_err(); return _o_result; @@ -575,9 +575,9 @@ int32 Platform_Sync (int64 h) __RETCHK; } -int32 Platform_Seek (int64 h, int64 offset, int32 whence) +int16 Platform_Seek (int32 h, int32 offset, int16 whence) { - int32 _o_result; + int16 _o_result; if (Platform_lseek(h, offset, whence) < 0) { _o_result = Platform_err(); return _o_result; @@ -588,9 +588,9 @@ int32 Platform_Seek (int64 h, int64 offset, int32 whence) __RETCHK; } -int32 Platform_Truncate (int64 h, int64 l) +int16 Platform_Truncate (int32 h, int32 l) { - int32 _o_result; + int16 _o_result; if (Platform_ftruncate(h, l) < 0) { _o_result = Platform_err(); return _o_result; @@ -601,9 +601,9 @@ int32 Platform_Truncate (int64 h, int64 l) __RETCHK; } -int32 Platform_Unlink (CHAR *n, LONGINT n__len) +int16 Platform_Unlink (CHAR *n, LONGINT n__len) { - int32 _o_result; + int16 _o_result; if (Platform_unlink(n, n__len) < 0) { _o_result = Platform_err(); return _o_result; @@ -614,10 +614,10 @@ int32 Platform_Unlink (CHAR *n, LONGINT n__len) __RETCHK; } -int32 Platform_Chdir (CHAR *n, LONGINT n__len) +int16 Platform_Chdir (CHAR *n, LONGINT n__len) { - int32 _o_result; - int32 r; + int16 _o_result; + int16 r; r = Platform_chdir(n, n__len); Platform_getcwd((void*)Platform_CWD, 256); if (r < 0) { @@ -630,9 +630,9 @@ int32 Platform_Chdir (CHAR *n, LONGINT n__len) __RETCHK; } -int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len) +int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len) { - int32 _o_result; + int16 _o_result; if (Platform_rename(o, o__len, n, n__len) < 0) { _o_result = Platform_err(); return _o_result; @@ -643,7 +643,7 @@ int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len) __RETCHK; } -void Platform_Exit (int32 code) +void Platform_Exit (int16 code) { Platform_exit(code); } @@ -658,15 +658,15 @@ static void Platform_errln (void) Platform_errch(0x0a); } -static void Platform_errposint (int64 l) +static void Platform_errposint (int32 l) { if (l > 10) { Platform_errposint(__DIV(l, 10)); } - Platform_errch((CHAR)(48 + __MOD(l, 10))); + Platform_errch((CHAR)(48 + (int)__MOD(l, 10))); } -static void Platform_errint (int64 l) +static void Platform_errint (int32 l) { if (l < 0) { Platform_errch('-'); @@ -675,7 +675,7 @@ static void Platform_errint (int64 l) Platform_errposint(l); } -static void Platform_DisplayHaltCode (int64 code) +static void Platform_DisplayHaltCode (int32 code) { switch (code) { case -1: @@ -731,7 +731,7 @@ static void Platform_DisplayHaltCode (int64 code) } } -void Platform_Halt (int64 code) +void Platform_Halt (int32 code) { Platform_HaltCode = code; if (Platform_HaltHandler != NIL) { @@ -744,10 +744,10 @@ void Platform_Halt (int64 code) Platform_DisplayHaltCode(code); } Platform_errln(); - Platform_exit(__VAL(int32, code)); + Platform_exit(__VAL(int16, code)); } -void Platform_AssertFail (int64 code) +void Platform_AssertFail (int32 code) { Platform_errstring((CHAR*)"Assertion failure.", 19); if (code != 0) { @@ -756,7 +756,7 @@ void Platform_AssertFail (int64 code) Platform_errstring((CHAR*)".", 2); } Platform_errln(); - Platform_exit(__VAL(int32, code)); + Platform_exit(__VAL(int16, code)); } void Platform_SetHalt (Platform_HaltProcedure p) @@ -766,12 +766,12 @@ void Platform_SetHalt (Platform_HaltProcedure p) static void Platform_TestLittleEndian (void) { - int32 i; + int16 i; i = 1; __GET((address)&i, Platform_LittleEndian, BOOLEAN); } -__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 24), {-8}}; +__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 12), {-8}}; export void *Platform__init(void) { diff --git a/bootstrap/unix-88/Platform.h b/bootstrap/unix-88/Platform.h index f44cd9e8..32d37057 100644 --- a/bootstrap/unix-88/Platform.h +++ b/bootstrap/unix-88/Platform.h @@ -7,75 +7,75 @@ typedef struct Platform_FileIdentity { - int64 volume, index, mtime; + int32 volume, index, mtime; } Platform_FileIdentity; typedef - void (*Platform_HaltProcedure)(int64); + void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int32); + void (*Platform_SignalHandler)(int16); import BOOLEAN Platform_LittleEndian; import address Platform_MainStackFrame; -import int64 Platform_HaltCode; -import int32 Platform_PID; +import int32 Platform_HaltCode; +import int16 Platform_PID; import CHAR Platform_CWD[256]; -import int32 Platform_ArgCount; +import int16 Platform_ArgCount; import address Platform_ArgVector; -import int32 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; +import int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; import CHAR Platform_nl[3]; import address *Platform_FileIdentity__typ; -import BOOLEAN Platform_Absent (int32 e); -import int32 Platform_ArgPos (CHAR *s, LONGINT s__len); -import void Platform_AssertFail (int64 code); -import int32 Platform_Chdir (CHAR *n, LONGINT n__len); -import int32 Platform_Close (int64 h); -import BOOLEAN Platform_ConnectionFailed (int32 e); -import void Platform_Delay (int64 ms); -import BOOLEAN Platform_DifferentFilesystems (int32 e); -import int32 Platform_Error (void); -import void Platform_Exit (int32 code); -import void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len); -import void Platform_GetClock (int64 *t, int64 *d); +import BOOLEAN Platform_Absent (int16 e); +import int16 Platform_ArgPos (CHAR *s, LONGINT s__len); +import void Platform_AssertFail (int32 code); +import int16 Platform_Chdir (CHAR *n, LONGINT n__len); +import int16 Platform_Close (int32 h); +import BOOLEAN Platform_ConnectionFailed (int16 e); +import void Platform_Delay (int32 ms); +import BOOLEAN Platform_DifferentFilesystems (int16 e); +import int16 Platform_Error (void); +import void Platform_Exit (int16 code); +import void Platform_GetArg (int16 n, CHAR *val, LONGINT val__len); +import void Platform_GetClock (int32 *t, int32 *d); import void Platform_GetEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); -import void Platform_GetIntArg (int32 n, int64 *val); -import void Platform_GetTimeOfDay (int64 *sec, int64 *usec); -import void Platform_Halt (int64 code); -import int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, address *identity__typ); -import int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); -import BOOLEAN Platform_Inaccessible (int32 e); -import void Platform_Init (int32 argc, address argvadr); -import void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d); -import int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h); -import BOOLEAN Platform_NoSuchDirectory (int32 e); +import void Platform_GetIntArg (int16 n, int32 *val); +import void Platform_GetTimeOfDay (int32 *sec, int32 *usec); +import void Platform_Halt (int32 code); +import int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); +import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); +import BOOLEAN Platform_Inaccessible (int16 e); +import void Platform_Init (int16 argc, address argvadr); +import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); +import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); +import BOOLEAN Platform_NoSuchDirectory (int16 e); import address Platform_OSAllocate (address size); import void Platform_OSFree (address address); -import int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h); -import int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h); -import int32 Platform_Read (int64 h, address p, int64 l, int64 *n); -import int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n); -import int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); +import int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h); +import int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h); +import int16 Platform_Read (int32 h, address p, int32 l, int32 *n); +import int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n); +import int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); import BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); import BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); -import int32 Platform_Seek (int64 h, int64 offset, int32 whence); +import int16 Platform_Seek (int32 h, int32 offset, int16 whence); import void Platform_SetBadInstructionHandler (Platform_SignalHandler handler); import void Platform_SetHalt (Platform_HaltProcedure p); import void Platform_SetInterruptHandler (Platform_SignalHandler handler); import void Platform_SetMTime (Platform_FileIdentity *target, address *target__typ, Platform_FileIdentity source); import void Platform_SetQuitHandler (Platform_SignalHandler handler); -import int32 Platform_Size (int64 h, int64 *l); -import int32 Platform_Sync (int64 h); -import int32 Platform_System (CHAR *cmd, LONGINT cmd__len); -import int64 Platform_Time (void); -import BOOLEAN Platform_TimedOut (int32 e); -import BOOLEAN Platform_TooManyFiles (int32 e); -import int32 Platform_Truncate (int64 h, int64 l); -import int32 Platform_Unlink (CHAR *n, LONGINT n__len); -import int32 Platform_Write (int64 h, address p, address l); +import int16 Platform_Size (int32 h, int32 *l); +import int16 Platform_Sync (int32 h); +import int16 Platform_System (CHAR *cmd, LONGINT cmd__len); +import int32 Platform_Time (void); +import BOOLEAN Platform_TimedOut (int16 e); +import BOOLEAN Platform_TooManyFiles (int16 e); +import int16 Platform_Truncate (int32 h, int32 l); +import int16 Platform_Unlink (CHAR *n, LONGINT n__len); +import int16 Platform_Write (int32 h, address p, int32 l); import BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); import void *Platform__init(void); diff --git a/bootstrap/unix-88/Reals.c b/bootstrap/unix-88/Reals.c index 7678a81e..fe93e8be 100644 --- a/bootstrap/unix-88/Reals.c +++ b/bootstrap/unix-88/Reals.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -10,19 +10,19 @@ static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LONGINT d__len); -export void Reals_Convert (REAL x, int32 n, CHAR *d, LONGINT d__len); +export void Reals_Convert (REAL x, int16 n, CHAR *d, LONGINT d__len); export void Reals_ConvertH (REAL y, CHAR *d, LONGINT d__len); export void Reals_ConvertHL (LONGREAL x, CHAR *d, LONGINT d__len); -export void Reals_ConvertL (LONGREAL x, int32 n, CHAR *d, LONGINT d__len); -export int32 Reals_Expo (REAL x); -export int32 Reals_ExpoL (LONGREAL x); -export void Reals_SetExpo (REAL *x, int32 ex); -export REAL Reals_Ten (int32 e); -export LONGREAL Reals_TenL (int32 e); -static CHAR Reals_ToHex (int32 i); +export void Reals_ConvertL (LONGREAL x, int16 n, CHAR *d, LONGINT d__len); +export int16 Reals_Expo (REAL x); +export int16 Reals_ExpoL (LONGREAL x); +export void Reals_SetExpo (REAL *x, int16 ex); +export REAL Reals_Ten (int16 e); +export LONGREAL Reals_TenL (int16 e); +static CHAR Reals_ToHex (int16 i); -REAL Reals_Ten (int32 e) +REAL Reals_Ten (int16 e) { REAL _o_result; LONGREAL r, power; @@ -39,7 +39,7 @@ REAL Reals_Ten (int32 e) return _o_result; } -LONGREAL Reals_TenL (int32 e) +LONGREAL Reals_TenL (int16 e) { LONGREAL _o_result; LONGREAL r, power; @@ -59,54 +59,67 @@ LONGREAL Reals_TenL (int32 e) __RETCHK; } -int32 Reals_Expo (REAL x) +int16 Reals_Expo (REAL x) { - int32 _o_result; - int32 i; - __GET((address)&x + 2, i, int32); + int16 _o_result; + int16 i; + __GET((address)&x + 2, i, int16); _o_result = __MASK(__ASHR(i, 7), -256); return _o_result; } -void Reals_SetExpo (REAL *x, int32 ex) +void Reals_SetExpo (REAL *x, int16 ex) { CHAR c; __GET((address)x + 3, c, CHAR); - __PUT((address)x + 3, (CHAR)(__ASHL(__ASHR(c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); + __PUT((address)x + 3, (CHAR)(__ASHL(__ASHR((int16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); __GET((address)x + 2, c, CHAR); - __PUT((address)x + 2, (CHAR)(__MASK(c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); + __PUT((address)x + 2, (CHAR)(__MASK((int16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); } -int32 Reals_ExpoL (LONGREAL x) +int16 Reals_ExpoL (LONGREAL x) { - int32 _o_result; - int32 i; - __GET((address)&x + 6, i, int32); + int16 _o_result; + int16 i; + __GET((address)&x + 6, i, int16); _o_result = __MASK(__ASHR(i, 4), -2048); return _o_result; } -void Reals_ConvertL (LONGREAL x, int32 n, CHAR *d, LONGINT d__len) +void Reals_ConvertL (LONGREAL x, int16 n, CHAR *d, LONGINT d__len) { - int64 i, j, k; + int32 i, j, k; if (x < (LONGREAL)0) { x = -x; } k = 0; - i = __ENTIER(x); - while (k < (int64)n) { - d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48); + if (n > 9) { + i = (int32)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000); + j = (int32)__ENTIER(x - i * (LONGREAL)1000000000); + if (j < 0) { + j = 0; + } + while (k < 9) { + d[__X(k, d__len)] = (CHAR)((int)__MOD(j, 10) + 48); + j = __DIV(j, 10); + k += 1; + } + } else { + i = (int32)__ENTIER(x); + } + while (k < n) { + d[__X(k, d__len)] = (CHAR)((int)__MOD(i, 10) + 48); i = __DIV(i, 10); k += 1; } } -void Reals_Convert (REAL x, int32 n, CHAR *d, LONGINT d__len) +void Reals_Convert (REAL x, int16 n, CHAR *d, LONGINT d__len) { Reals_ConvertL(x, n, (void*)d, d__len); } -static CHAR Reals_ToHex (int32 i) +static CHAR Reals_ToHex (int16 i) { CHAR _o_result; if (i < 10) { @@ -121,15 +134,15 @@ static CHAR Reals_ToHex (int32 i) static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LONGINT d__len) { - int32 i; - int64 l; + int16 i; + int32 l; CHAR by; i = 0; l = b__len; - while ((int64)i < l) { + while (i < l) { by = __VAL(CHAR, b[__X(i, b__len)]); - d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR(by, 4)); - d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK(by, -16)); + d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int16)by, 4)); + d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int16)by, -16)); i += 1; } } diff --git a/bootstrap/unix-88/Reals.h b/bootstrap/unix-88/Reals.h index 4de192c6..e7cba0d8 100644 --- a/bootstrap/unix-88/Reals.h +++ b/bootstrap/unix-88/Reals.h @@ -8,15 +8,15 @@ -import void Reals_Convert (REAL x, int32 n, CHAR *d, LONGINT d__len); +import void Reals_Convert (REAL x, int16 n, CHAR *d, LONGINT d__len); import void Reals_ConvertH (REAL y, CHAR *d, LONGINT d__len); import void Reals_ConvertHL (LONGREAL x, CHAR *d, LONGINT d__len); -import void Reals_ConvertL (LONGREAL x, int32 n, CHAR *d, LONGINT d__len); -import int32 Reals_Expo (REAL x); -import int32 Reals_ExpoL (LONGREAL x); -import void Reals_SetExpo (REAL *x, int32 ex); -import REAL Reals_Ten (int32 e); -import LONGREAL Reals_TenL (int32 e); +import void Reals_ConvertL (LONGREAL x, int16 n, CHAR *d, LONGINT d__len); +import int16 Reals_Expo (REAL x); +import int16 Reals_ExpoL (LONGREAL x); +import void Reals_SetExpo (REAL *x, int16 ex); +import REAL Reals_Ten (int16 e); +import LONGREAL Reals_TenL (int16 e); import void *Reals__init(void); diff --git a/bootstrap/unix-88/Strings.c b/bootstrap/unix-88/Strings.c index 49fbdd21..427a0cc4 100644 --- a/bootstrap/unix-88/Strings.c +++ b/bootstrap/unix-88/Strings.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -11,22 +11,22 @@ export void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__len); export void Strings_Cap (CHAR *s, LONGINT s__len); -export void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n); -export void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHAR *dest, LONGINT dest__len); -export void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len); -export int32 Strings_Length (CHAR *s, LONGINT s__len); +export void Strings_Delete (CHAR *s, LONGINT s__len, int16 pos, int16 n); +export void Strings_Extract (CHAR *source, LONGINT source__len, int16 pos, int16 n, CHAR *dest, LONGINT dest__len); +export void Strings_Insert (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len); +export int16 Strings_Length (CHAR *s, LONGINT s__len); export BOOLEAN Strings_Match (CHAR *string, LONGINT string__len, CHAR *pattern, LONGINT pattern__len); -export int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int32 pos); -export void Strings_Replace (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len); +export int16 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int16 pos); +export void Strings_Replace (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len); -int32 Strings_Length (CHAR *s, LONGINT s__len) +int16 Strings_Length (CHAR *s, LONGINT s__len) { - int32 _o_result; - int32 i; + int16 _o_result; + int16 i; __DUP(s, s__len, CHAR); i = 0; - while (((int64)i < s__len && s[__X(i, s__len)] != 0x00)) { + while ((i < s__len && s[__X(i, s__len)] != 0x00)) { i += 1; } _o_result = i; @@ -36,24 +36,24 @@ int32 Strings_Length (CHAR *s, LONGINT s__len) void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__len) { - int32 n1, n2, i; + int16 n1, n2, i; __DUP(extra, extra__len, CHAR); n1 = Strings_Length(dest, dest__len); n2 = Strings_Length(extra, extra__len); i = 0; - while ((i < n2 && (int64)(i + n1) < dest__len)) { + while ((i < n2 && (i + n1) < dest__len)) { dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)]; i += 1; } - if ((int64)(i + n1) < dest__len) { + if ((i + n1) < dest__len) { dest[__X(i + n1, dest__len)] = 0x00; } __DEL(extra); } -void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len) +void Strings_Insert (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len) { - int32 n1, n2, i; + int16 n1, n2, i; __DUP(source, source__len, CHAR); n1 = Strings_Length(dest, dest__len); n2 = Strings_Length(source, source__len); @@ -64,10 +64,10 @@ void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, L Strings_Append(dest, dest__len, (void*)source, source__len); return; } - if ((int64)(pos + n2) < dest__len) { + if ((pos + n2) < dest__len) { i = n1; while (i >= pos) { - if ((int64)(i + n2) < dest__len) { + if ((i + n2) < dest__len) { dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)]; } i -= 1; @@ -81,9 +81,9 @@ void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, L __DEL(source); } -void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n) +void Strings_Delete (CHAR *s, LONGINT s__len, int16 pos, int16 n) { - int32 len, i; + int16 len, i; len = Strings_Length(s, s__len); if (pos < 0) { pos = 0; @@ -96,7 +96,7 @@ void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n) s[__X(i - n, s__len)] = s[__X(i, s__len)]; i += 1; } - if ((int64)(i - n) < s__len) { + if ((i - n) < s__len) { s[__X(i - n, s__len)] = 0x00; } } else { @@ -104,7 +104,7 @@ void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n) } } -void Strings_Replace (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len) +void Strings_Replace (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len) { __DUP(source, source__len, CHAR); Strings_Delete((void*)dest, dest__len, pos, pos + Strings_Length(source, source__len)); @@ -112,12 +112,12 @@ void Strings_Replace (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, __DEL(source); } -void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHAR *dest, LONGINT dest__len) +void Strings_Extract (CHAR *source, LONGINT source__len, int16 pos, int16 n, CHAR *dest, LONGINT dest__len) { - int32 len, destLen, i; + int16 len, destLen, i; __DUP(source, source__len, CHAR); len = Strings_Length(source, source__len); - destLen = (int32)dest__len - 1; + destLen = (int16)dest__len - 1; if (pos < 0) { pos = 0; } @@ -126,7 +126,7 @@ void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHA return; } i = 0; - while (((((int64)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) { + while (((((pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) { if (i < destLen) { dest[__X(i, dest__len)] = source[__X(pos + i, source__len)]; } @@ -136,10 +136,10 @@ void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHA __DEL(source); } -int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int32 pos) +int16 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int16 pos) { - int32 _o_result; - int32 n1, n2, i, j; + int16 _o_result; + int16 n1, n2, i, j; __DUP(pattern, pattern__len, CHAR); __DUP(s, s__len, CHAR); n1 = Strings_Length(s, s__len); @@ -174,7 +174,7 @@ int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, void Strings_Cap (CHAR *s, LONGINT s__len) { - int32 i; + int16 i; i = 0; while (s[__X(i, s__len)] != 0x00) { if (('a' <= s[__X(i, s__len)] && s[__X(i, s__len)] <= 'z')) { @@ -188,9 +188,9 @@ static struct Match__7 { struct Match__7 *lnk; } *Match__7_s; -static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__len, int32 n, int32 m); +static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__len, int16 n, int16 m); -static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__len, int32 n, int32 m) +static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__len, int16 n, int16 m) { BOOLEAN _o_result; while ((((n >= 0 && m >= 0)) && mask[__X(m, mask__len)] != '*')) { diff --git a/bootstrap/unix-88/Strings.h b/bootstrap/unix-88/Strings.h index 4dd0d2c3..44c51b2a 100644 --- a/bootstrap/unix-88/Strings.h +++ b/bootstrap/unix-88/Strings.h @@ -10,13 +10,13 @@ import void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__len); import void Strings_Cap (CHAR *s, LONGINT s__len); -import void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n); -import void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHAR *dest, LONGINT dest__len); -import void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len); -import int32 Strings_Length (CHAR *s, LONGINT s__len); +import void Strings_Delete (CHAR *s, LONGINT s__len, int16 pos, int16 n); +import void Strings_Extract (CHAR *source, LONGINT source__len, int16 pos, int16 n, CHAR *dest, LONGINT dest__len); +import void Strings_Insert (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len); +import int16 Strings_Length (CHAR *s, LONGINT s__len); import BOOLEAN Strings_Match (CHAR *string, LONGINT string__len, CHAR *pattern, LONGINT pattern__len); -import int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int32 pos); -import void Strings_Replace (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len); +import int16 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int16 pos); +import void Strings_Replace (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len); import void *Strings__init(void); diff --git a/bootstrap/unix-88/Texts.c b/bootstrap/unix-88/Texts.c index 6403ce33..8c41a062 100644 --- a/bootstrap/unix-88/Texts.c +++ b/bootstrap/unix-88/Texts.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Files.h" @@ -18,7 +18,7 @@ typedef typedef struct Texts_RunDesc { Texts_Run prev, next; - int64 len; + int32 len; Texts_FontsFont fnt; int8 col, voff; BOOLEAN ascii; @@ -41,26 +41,26 @@ typedef typedef struct Texts_ElemDesc { Texts_Run prev, next; - int64 len; + int32 len; Texts_FontsFont fnt; int8 col, voff; BOOLEAN ascii; - int64 W, H; + int32 W, H; Texts_Handler handle; Texts_Text base; } Texts_ElemDesc; struct Texts__1 { /* Texts_ElemDesc */ Texts_Run prev, next; - int64 len; + int32 len; Texts_FontsFont fnt; int8 col, voff; BOOLEAN ascii; - int64 W, H; + int32 W, H; Texts_Handler handle; Texts_Text base; Files_File file; - int64 org, span; + int32 org, span; CHAR mod[32], proc[32]; }; @@ -69,7 +69,7 @@ typedef typedef struct Texts_BufDesc { - int64 len; + int32 len; Texts_Run head; } Texts_BufDesc; @@ -83,8 +83,8 @@ typedef typedef struct Texts_FileMsg { /* Texts_ElemMsg */ - int32 id; - int64 pos; + int16 id; + int32 pos; Files_Rider r; } Texts_FileMsg; @@ -99,7 +99,7 @@ typedef } Texts_IdentifyMsg; typedef - void (*Texts_Notifier)(Texts_Text, int32, int64, int64); + void (*Texts_Notifier)(Texts_Text, int16, int32, int32); typedef struct Texts_PieceDesc *Texts_Piece; @@ -107,12 +107,12 @@ typedef typedef struct Texts_PieceDesc { Texts_Run prev, next; - int64 len; + int32 len; Texts_FontsFont fnt; int8 col, voff; BOOLEAN ascii; Files_File file; - int64 org; + int32 org; } Texts_PieceDesc; typedef @@ -123,7 +123,7 @@ typedef Texts_Elem elem; Files_Rider rider; Texts_Run run; - int64 org, off; + int32 org, off; } Texts_Reader; typedef @@ -134,10 +134,10 @@ typedef Texts_Elem elem; Files_Rider rider; Texts_Run run; - int64 org, off; + int32 org, off; CHAR nextCh; - int32 line, class; - int64 i; + int16 line, class; + int32 i; REAL x; LONGREAL y; CHAR c; @@ -147,10 +147,10 @@ typedef typedef struct Texts_TextDesc { - int64 len; + int32 len; Texts_Notifier notify; Texts_Run head, cache; - int64 corg; + int32 corg; } Texts_TextDesc; typedef @@ -183,50 +183,50 @@ export address *Texts_Writer__typ; export address *Texts__1__typ; export void Texts_Append (Texts_Text T, Texts_Buffer B); -export void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); static Texts_Elem Texts_CloneElem (Texts_Elem e); static Texts_Piece Texts_ClonePiece (Texts_Piece p); export void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); export void Texts_Copy (Texts_Buffer SB, Texts_Buffer DB); export void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE); -export void Texts_Delete (Texts_Text T, int64 beg, int64 end); +export void Texts_Delete (Texts_Text T, int32 beg, int32 end); export Texts_Text Texts_ElemBase (Texts_Elem E); -export int64 Texts_ElemPos (Texts_Elem E); -static void Texts_Find (Texts_Text T, int64 *pos, Texts_Run *u, int64 *org, int64 *off); +export int32 Texts_ElemPos (Texts_Elem E); +static void Texts_Find (Texts_Text T, int32 *pos, Texts_Run *u, int32 *org, int32 *off); static Texts_FontsFont Texts_FontsThis (CHAR *name, LONGINT name__len); static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, address *msg__typ); -export void Texts_Insert (Texts_Text T, int64 pos, Texts_Buffer B); +export void Texts_Insert (Texts_Text T, int32 pos, Texts_Buffer B); export void Texts_Load (Files_Rider *r, address *r__typ, Texts_Text T); static void Texts_Load0 (Files_Rider *r, address *r__typ, Texts_Text T); static void Texts_Merge (Texts_Text T, Texts_Run u, Texts_Run *v); export void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len); export void Texts_OpenBuf (Texts_Buffer B); -export void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int64 pos); -export void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int64 pos); +export void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int32 pos); +export void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int32 pos); export void Texts_OpenWriter (Texts_Writer *W, address *W__typ); -export int64 Texts_Pos (Texts_Reader *R, address *R__typ); +export int32 Texts_Pos (Texts_Reader *R, address *R__typ); export void Texts_Read (Texts_Reader *R, address *R__typ, CHAR *ch); export void Texts_ReadElem (Texts_Reader *R, address *R__typ); export void Texts_ReadPrevElem (Texts_Reader *R, address *R__typ); export void Texts_Recall (Texts_Buffer *B); -export void Texts_Save (Texts_Text T, int64 beg, int64 end, Texts_Buffer B); +export void Texts_Save (Texts_Text T, int32 beg, int32 end, Texts_Buffer B); export void Texts_Scan (Texts_Scanner *S, address *S__typ); export void Texts_SetColor (Texts_Writer *W, address *W__typ, int8 col); export void Texts_SetFont (Texts_Writer *W, address *W__typ, Texts_FontsFont fnt); export void Texts_SetOffset (Texts_Writer *W, address *W__typ, int8 voff); static void Texts_Splice (Texts_Run un, Texts_Run v, Texts_Run w, Texts_Text base); -static void Texts_Split (int64 off, Texts_Run *u, Texts_Run *un); +static void Texts_Split (int32 off, Texts_Run *u, Texts_Run *un); export void Texts_Store (Files_Rider *r, address *r__typ, Texts_Text T); export void Texts_Write (Texts_Writer *W, address *W__typ, CHAR ch); -export void Texts_WriteDate (Texts_Writer *W, address *W__typ, int64 t, int64 d); +export void Texts_WriteDate (Texts_Writer *W, address *W__typ, int32 t, int32 d); export void Texts_WriteElem (Texts_Writer *W, address *W__typ, Texts_Elem e); -export void Texts_WriteHex (Texts_Writer *W, address *W__typ, int64 x); +export void Texts_WriteHex (Texts_Writer *W, address *W__typ, int32 x); export void Texts_WriteInt (Texts_Writer *W, address *W__typ, int64 x, int64 n); export void Texts_WriteLn (Texts_Writer *W, address *W__typ); -export void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n); +export void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int16 n); export void Texts_WriteLongRealHex (Texts_Writer *W, address *W__typ, LONGREAL x); -export void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int32 n); -export void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int32 n, int32 k); +export void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int16 n); +export void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int16 n, int16 k); export void Texts_WriteRealHex (Texts_Writer *W, address *W__typ, REAL x); export void Texts_WriteString (Texts_Writer *W, address *W__typ, CHAR *s, LONGINT s__len); @@ -241,10 +241,10 @@ static Texts_FontsFont Texts_FontsThis (CHAR *name, LONGINT name__len) return _o_result; } -static void Texts_Find (Texts_Text T, int64 *pos, Texts_Run *u, int64 *org, int64 *off) +static void Texts_Find (Texts_Text T, int32 *pos, Texts_Run *u, int32 *org, int32 *off) { Texts_Run v = NIL; - int64 m; + int32 m; if (*pos >= T->len) { *pos = T->len; *u = T->head; @@ -274,7 +274,7 @@ static void Texts_Find (Texts_Text T, int64 *pos, Texts_Run *u, int64 *org, int6 } } -static void Texts_Split (int64 off, Texts_Run *u, Texts_Run *un) +static void Texts_Split (int32 off, Texts_Run *u, Texts_Run *un) { Texts_Piece p = NIL, U = NIL; if (off == 0) { @@ -373,11 +373,11 @@ Texts_Text Texts_ElemBase (Texts_Elem E) return _o_result; } -int64 Texts_ElemPos (Texts_Elem E) +int32 Texts_ElemPos (Texts_Elem E) { - int64 _o_result; + int32 _o_result; Texts_Run u = NIL; - int64 pos; + int32 pos; u = E->base->head->next; pos = 0; while (u != (void *) E) { @@ -392,7 +392,7 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, address *msg__t { Texts_Alien e = NIL; Files_Rider r; - int64 i; + int32 i; CHAR ch; if (__ISP(E, Texts__1, 2)) { if (__IS(msg__typ, Texts_CopyMsg, 1)) { @@ -468,10 +468,10 @@ void Texts_Recall (Texts_Buffer *B) Texts_del = NIL; } -void Texts_Save (Texts_Text T, int64 beg, int64 end, Texts_Buffer B) +void Texts_Save (Texts_Text T, int32 beg, int32 end, Texts_Buffer B) { Texts_Run u = NIL, v = NIL, w = NIL, wn = NIL; - int64 uo, ud, vo, vd; + int32 uo, ud, vo, vd; Texts_Find(T, &beg, &u, &uo, &ud); Texts_Find(T, &end, &v, &vo, &vd); w = B->head->prev; @@ -502,11 +502,11 @@ void Texts_Save (Texts_Text T, int64 beg, int64 end, Texts_Buffer B) B->len += end - beg; } -void Texts_Insert (Texts_Text T, int64 pos, Texts_Buffer B) +void Texts_Insert (Texts_Text T, int32 pos, Texts_Buffer B) { Texts_Run u = NIL, un = NIL, v = NIL; Texts_Piece p = NIL, q = NIL; - int64 uo, ud, len; + int32 uo, ud, len; Texts_Find(T, &pos, &u, &uo, &ud); Texts_Split(ud, &u, &un); len = B->len; @@ -525,7 +525,7 @@ void Texts_Insert (Texts_Text T, int64 pos, Texts_Buffer B) void Texts_Append (Texts_Text T, Texts_Buffer B) { Texts_Run v = NIL; - int64 pos, len; + int32 pos, len; pos = T->len; len = B->len; v = B->head->next; @@ -540,10 +540,10 @@ void Texts_Append (Texts_Text T, Texts_Buffer B) } } -void Texts_Delete (Texts_Text T, int64 beg, int64 end) +void Texts_Delete (Texts_Text T, int32 beg, int32 end) { Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL; - int64 co, uo, ud, vo, vd; + int32 co, uo, ud, vo, vd; Texts_Find(T, &beg, &u, &uo, &ud); Texts_Split(ud, &u, &un); c = T->cache; @@ -565,10 +565,10 @@ void Texts_Delete (Texts_Text T, int64 beg, int64 end) } } -void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff) +void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff) { Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL; - int64 co, uo, ud, vo, vd; + int32 co, uo, ud, vo, vd; Texts_Find(T, &beg, &u, &uo, &ud); Texts_Split(ud, &u, &un); c = T->cache; @@ -578,13 +578,13 @@ void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_Fonts T->cache = c; T->corg = co; while (un != vn) { - if ((__IN(0, sel, 64) && fnt != NIL)) { + if ((__IN(0, sel, 32) && fnt != NIL)) { un->fnt = fnt; } - if (__IN(1, sel, 64)) { + if (__IN(1, sel, 32)) { un->col = col; } - if (__IN(2, sel, 64)) { + if (__IN(2, sel, 32)) { un->voff = voff; } Texts_Merge(T, u, &un); @@ -604,7 +604,7 @@ void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_Fonts } } -void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int64 pos) +void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int32 pos) { Texts_Run u = NIL; if (pos >= T->len) { @@ -621,7 +621,7 @@ void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int64 pos void Texts_Read (Texts_Reader *R, address *R__typ, CHAR *ch) { Texts_Run u = NIL; - int64 pos; + int32 pos; CHAR nextch; u = (*R).run; (*R).fnt = u->fnt; @@ -713,14 +713,14 @@ void Texts_ReadPrevElem (Texts_Reader *R, address *R__typ) } } -int64 Texts_Pos (Texts_Reader *R, address *R__typ) +int32 Texts_Pos (Texts_Reader *R, address *R__typ) { - int64 _o_result; + int32 _o_result; _o_result = (*R).org + (*R).off; return _o_result; } -void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int64 pos) +void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int32 pos) { Texts_OpenReader((void*)&*S, S__typ, T, pos); (*S).line = 0; @@ -732,7 +732,7 @@ static struct Scan__31 { address *S__typ; CHAR *ch; BOOLEAN *negE; - int32 *e; + int16 *e; struct Scan__31 *lnk; } *Scan__31_s; @@ -751,7 +751,7 @@ static void ReadScaleFactor__32 (void) } } while (('0' <= *Scan__31_s->ch && *Scan__31_s->ch <= '9')) { - *Scan__31_s->e = (*Scan__31_s->e * 10 + *Scan__31_s->ch) - 48; + *Scan__31_s->e = (*Scan__31_s->e * 10 + (int16)*Scan__31_s->ch) - 48; Texts_Read((void*)&*Scan__31_s->S, Scan__31_s->S__typ, &*Scan__31_s->ch); } } @@ -761,8 +761,8 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) CHAR ch, term; BOOLEAN neg, negE, hex; int8 i, j, h; - int32 e; - int64 k; + int16 e; + int32 k; REAL x, f; LONGREAL y, g; CHAR d[32]; @@ -823,10 +823,10 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) if ('9' < ch) { if (('A' <= ch && ch <= 'F')) { hex = 1; - ch = (CHAR)(ch - 7); + ch = (CHAR)((int16)ch - 7); } else if (('a' <= ch && ch <= 'f')) { hex = 1; - ch = (CHAR)(ch - 39); + ch = (CHAR)((int16)ch - 39); } else { break; } @@ -838,13 +838,13 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) if (i - j > 8) { j = i - 8; } - k = d[__X(j, 32)] - 48; + k = (int16)d[__X(j, 32)] - 48; j += 1; if ((i - j == 7 && k >= 8)) { k -= 16; } while (j < i) { - k = __ASHL(k, 4) + (int64)(d[__X(j, 32)] - 48); + k = __ASHL(k, 4) + ((int16)d[__X(j, 32)] - 48); j += 1; } if (neg) { @@ -865,12 +865,12 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) y = (LONGREAL)0; g = (LONGREAL)1; do { - y = y * (LONGREAL)10 + (d[__X(j, 32)] - 48); + y = y * (LONGREAL)10 + ((int16)d[__X(j, 32)] - 48); j += 1; } while (!(j == h)); while (j < i) { g = g / (LONGREAL)(LONGREAL)10; - y = (d[__X(j, 32)] - 48) * g + y; + y = ((int16)d[__X(j, 32)] - 48) * g + y; j += 1; } ReadScaleFactor__32(); @@ -897,12 +897,12 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) x = (REAL)0; f = (REAL)1; do { - x = x * (REAL)10 + (d[__X(j, 32)] - 48); + x = x * (REAL)10 + ((int16)d[__X(j, 32)] - 48); j += 1; } while (!(j == h)); while (j < i) { f = f / (REAL)(REAL)10; - x = (d[__X(j, 32)] - 48) * f + x; + x = ((int16)d[__X(j, 32)] - 48) * f + x; j += 1; } if (ch == 'E') { @@ -934,7 +934,7 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) (*S).class = 3; k = 0; do { - k = k * 10 + (int64)(d[__X(j, 32)] - 48); + k = k * 10 + ((int16)d[__X(j, 32)] - 48); j += 1; } while (!(j == i)); if (neg) { @@ -1040,7 +1040,7 @@ void Texts_WriteLn (Texts_Writer *W, address *W__typ) void Texts_WriteString (Texts_Writer *W, address *W__typ, CHAR *s, LONGINT s__len) { - int32 i; + int16 i; __DUP(s, s__len, CHAR); i = 0; while (s[__X(i, s__len)] >= ' ') { @@ -1052,7 +1052,7 @@ void Texts_WriteString (Texts_Writer *W, address *W__typ, CHAR *s, LONGINT s__le void Texts_WriteInt (Texts_Writer *W, address *W__typ, int64 x, int64 n) { - int32 i; + int16 i; int64 x0; CHAR a[24]; i = 0; @@ -1085,10 +1085,10 @@ void Texts_WriteInt (Texts_Writer *W, address *W__typ, int64 x, int64 n) } while (!(i == 0)); } -void Texts_WriteHex (Texts_Writer *W, address *W__typ, int64 x) +void Texts_WriteHex (Texts_Writer *W, address *W__typ, int32 x) { - int32 i; - int64 y; + int16 i; + int32 y; CHAR a[20]; i = 0; Texts_Write(&*W, W__typ, ' '); @@ -1108,9 +1108,9 @@ void Texts_WriteHex (Texts_Writer *W, address *W__typ, int64 x) } while (!(i == 0)); } -void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int32 n) +void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int16 n) { - int32 e; + int16 e; REAL x0; CHAR d[9]; e = Reals_Expo(x); @@ -1181,15 +1181,15 @@ void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int32 n) static struct WriteRealFix__53 { Texts_Writer *W; address *W__typ; - int32 *i; + int16 *i; CHAR (*d)[9]; struct WriteRealFix__53 *lnk; } *WriteRealFix__53_s; -static void dig__54 (int32 n); -static void seq__56 (CHAR ch, int32 n); +static void dig__54 (int16 n); +static void seq__56 (CHAR ch, int16 n); -static void seq__56 (CHAR ch, int32 n) +static void seq__56 (CHAR ch, int16 n) { while (n > 0) { Texts_Write(&*WriteRealFix__53_s->W, WriteRealFix__53_s->W__typ, ch); @@ -1197,7 +1197,7 @@ static void seq__56 (CHAR ch, int32 n) } } -static void dig__54 (int32 n) +static void dig__54 (int16 n) { while (n > 0) { *WriteRealFix__53_s->i -= 1; @@ -1206,9 +1206,9 @@ static void dig__54 (int32 n) } } -void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int32 n, int32 k) +void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int16 n, int16 k) { - int32 e, i; + int16 e, i; CHAR sign; REAL x0; CHAR d[9]; @@ -1280,7 +1280,7 @@ void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int32 n, int3 void Texts_WriteRealHex (Texts_Writer *W, address *W__typ, REAL x) { - int32 i; + int16 i; CHAR d[8]; Reals_ConvertH(x, (void*)d, 8); i = 0; @@ -1290,9 +1290,9 @@ void Texts_WriteRealHex (Texts_Writer *W, address *W__typ, REAL x) } while (!(i == 8)); } -void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n) +void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int16 n) { - int32 e; + int16 e; LONGREAL x0; CHAR d[16]; e = Reals_ExpoL(x); @@ -1324,7 +1324,7 @@ void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n) } else { Texts_Write(&*W, W__typ, ' '); } - e = (int32)__ASHR((int64)(e - 1023) * 77, 8); + e = (int16)__ASHR((e - 1023) * 77, 8); if (e >= 0) { x = x / (LONGREAL)Reals_TenL(e); } else { @@ -1364,7 +1364,7 @@ void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n) void Texts_WriteLongRealHex (Texts_Writer *W, address *W__typ, LONGREAL x) { - int32 i; + int16 i; CHAR d[16]; Reals_ConvertHL(x, (void*)d, 16); i = 0; @@ -1380,16 +1380,16 @@ static struct WriteDate__43 { struct WriteDate__43 *lnk; } *WriteDate__43_s; -static void WritePair__44 (CHAR ch, int64 x); +static void WritePair__44 (CHAR ch, int32 x); -static void WritePair__44 (CHAR ch, int64 x) +static void WritePair__44 (CHAR ch, int32 x) { Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, ch); Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, (CHAR)(__DIV(x, 10) + 48)); - Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, (CHAR)(__MOD(x, 10) + 48)); + Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, (CHAR)((int)__MOD(x, 10) + 48)); } -void Texts_WriteDate (Texts_Writer *W, address *W__typ, int64 t, int64 d) +void Texts_WriteDate (Texts_Writer *W, address *W__typ, int32 t, int32 d) { struct WriteDate__43 _s; _s.W = W; _s.W__typ = W__typ; @@ -1413,14 +1413,14 @@ static struct Load0__16 { struct Load0__16 *lnk; } *Load0__16_s; -static void LoadElem__17 (Files_Rider *r, address *r__typ, int64 pos, int64 span, Texts_Elem *e); +static void LoadElem__17 (Files_Rider *r, address *r__typ, int32 pos, int32 span, Texts_Elem *e); -static void LoadElem__17 (Files_Rider *r, address *r__typ, int64 pos, int64 span, Texts_Elem *e) +static void LoadElem__17 (Files_Rider *r, address *r__typ, int32 pos, int32 span, Texts_Elem *e) { Modules_Module M = NIL; Modules_Command Cmd; Texts_Alien a = NIL; - int64 org, ew, eh; + int32 org, ew, eh; int8 eno; Texts_new = NIL; Files_ReadLInt(&*r, r__typ, &ew); @@ -1471,7 +1471,7 @@ static void Texts_Load0 (Files_Rider *r, address *r__typ, Texts_Text T) Texts_Run u = NIL, un = NIL; Texts_Piece p = NIL; Texts_Elem e = NIL; - int64 org, pos, hlen, plen; + int32 org, pos, hlen, plen; int8 ecnt, fno, fcnt, col, voff; Files_File f = NIL; Texts_FileMsg msg; @@ -1490,7 +1490,7 @@ static void Texts_Load0 (Files_Rider *r, address *r__typ, Texts_Text T) pos = Files_Pos(&*r, r__typ); f = Files_Base(&*r, r__typ); __NEW(u, Texts_RunDesc); - u->len = 9223372036854775807; + u->len = 2147483647; u->fnt = NIL; u->col = 15; T->head = u; @@ -1542,7 +1542,7 @@ static void Texts_Load0 (Files_Rider *r, address *r__typ, Texts_Text T) void Texts_Load (Files_Rider *r, address *r__typ, Texts_Text T) { - int32 tag; + int16 tag; Files_ReadInt(&*r, r__typ, &tag); if (tag != -4095) { Files_Set(&*r, r__typ, Files_Base(&*r, r__typ), Files_Pos(&*r, r__typ) - 2); @@ -1557,7 +1557,7 @@ void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len) Texts_Run u = NIL; Texts_Piece p = NIL; CHAR tag, version; - int64 hlen; + int32 hlen; __DUP(name, name__len, CHAR); f = Files_Old(name, name__len); if (f == NIL) { @@ -1570,7 +1570,7 @@ void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len) Texts_Load0(&r, Files_Rider__typ, T); } else { __NEW(u, Texts_RunDesc); - u->len = 9223372036854775807; + u->len = 2147483647; u->fnt = NIL; u->col = 15; __NEW(p, Texts_PieceDesc); @@ -1614,12 +1614,12 @@ static struct Store__39 { struct Store__39 *lnk; } *Store__39_s; -static void StoreElem__40 (Files_Rider *r, address *r__typ, int64 pos, Texts_Elem e); +static void StoreElem__40 (Files_Rider *r, address *r__typ, int32 pos, Texts_Elem e); -static void StoreElem__40 (Files_Rider *r, address *r__typ, int64 pos, Texts_Elem e) +static void StoreElem__40 (Files_Rider *r, address *r__typ, int32 pos, Texts_Elem e) { Files_Rider r1; - int64 org, span; + int32 org, span; int8 eno; __COPY((*Store__39_s->iden).mod, (*Store__39_s->mods)[__X(*Store__39_s->ecnt, 64)], 32); __COPY((*Store__39_s->iden).proc, (*Store__39_s->procs)[__X(*Store__39_s->ecnt, 64)], 32); @@ -1651,7 +1651,7 @@ void Texts_Store (Files_Rider *r, address *r__typ, Texts_Text T) Files_Rider r1; Texts_Run u = NIL, un = NIL; Texts_Elem e = NIL; - int64 org, pos, delta, hlen, rlen; + int32 org, pos, delta, hlen, rlen; int8 ecnt, fno, fcnt; CHAR ch; Texts_FileMsg msg; @@ -1769,7 +1769,7 @@ void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len) { Files_File f = NIL; Files_Rider r; - int32 i, res; + int16 i, res; CHAR bak[64]; __DUP(name, name__len, CHAR); f = Files_New(name, name__len); @@ -1803,16 +1803,16 @@ __TDESC(Texts_FontDesc, 1, 0) = {__TDFLDS("FontDesc", 32), {-8}}; __TDESC(Texts_RunDesc, 1, 3) = {__TDFLDS("RunDesc", 40), {0, 8, 24, -32}}; __TDESC(Texts_PieceDesc, 1, 4) = {__TDFLDS("PieceDesc", 56), {0, 8, 24, 40, -40}}; __TDESC(Texts_ElemMsg, 1, 0) = {__TDFLDS("ElemMsg", 1), {-8}}; -__TDESC(Texts_ElemDesc, 1, 4) = {__TDFLDS("ElemDesc", 72), {0, 8, 24, 64, -40}}; -__TDESC(Texts_FileMsg, 1, 1) = {__TDFLDS("FileMsg", 56), {32, -16}}; +__TDESC(Texts_ElemDesc, 1, 4) = {__TDFLDS("ElemDesc", 64), {0, 8, 24, 56, -40}}; +__TDESC(Texts_FileMsg, 1, 1) = {__TDFLDS("FileMsg", 32), {16, -16}}; __TDESC(Texts_CopyMsg, 1, 1) = {__TDFLDS("CopyMsg", 8), {0, -16}}; __TDESC(Texts_IdentifyMsg, 1, 0) = {__TDFLDS("IdentifyMsg", 64), {-8}}; __TDESC(Texts_BufDesc, 1, 1) = {__TDFLDS("BufDesc", 16), {8, -16}}; __TDESC(Texts_TextDesc, 1, 2) = {__TDFLDS("TextDesc", 40), {16, 24, -24}}; -__TDESC(Texts_Reader, 1, 4) = {__TDFLDS("Reader", 96), {8, 24, 48, 72, -40}}; -__TDESC(Texts_Scanner, 1, 4) = {__TDFLDS("Scanner", 208), {8, 24, 48, 72, -40}}; -__TDESC(Texts_Writer, 1, 4) = {__TDFLDS("Writer", 72), {0, 8, 40, 64, -40}}; -__TDESC(Texts__1, 1, 5) = {__TDFLDS("", 160), {0, 8, 24, 64, 72, -48}}; +__TDESC(Texts_Reader, 1, 4) = {__TDFLDS("Reader", 72), {8, 24, 40, 56, -40}}; +__TDESC(Texts_Scanner, 1, 4) = {__TDFLDS("Scanner", 168), {8, 24, 40, 56, -40}}; +__TDESC(Texts_Writer, 1, 4) = {__TDFLDS("Writer", 56), {0, 8, 32, 48, -40}}; +__TDESC(Texts__1, 1, 5) = {__TDFLDS("", 144), {0, 8, 24, 56, 64, -48}}; export void *Texts__init(void) { diff --git a/bootstrap/unix-88/Texts.h b/bootstrap/unix-88/Texts.h index e85157ed..fa080b7f 100644 --- a/bootstrap/unix-88/Texts.h +++ b/bootstrap/unix-88/Texts.h @@ -8,8 +8,8 @@ typedef struct Texts_BufDesc { - int64 len; - char _prvt0[8]; + int32 len; + int64 _prvt0; } Texts_BufDesc; typedef @@ -39,16 +39,17 @@ typedef typedef struct Texts_ElemDesc { - char _prvt0[40]; - int64 W, H; + int64 _prvt0; + char _prvt1[28]; + int32 W, H; Texts_Handler handle; - char _prvt1[8]; + char _prvt2[8]; } Texts_ElemDesc; typedef struct Texts_FileMsg { /* Texts_ElemMsg */ - int32 id; - int64 pos; + int16 id; + int32 pos; Files_Rider r; } Texts_FileMsg; @@ -69,7 +70,7 @@ typedef struct Texts_TextDesc *Texts_Text; typedef - void (*Texts_Notifier)(Texts_Text, int32, int64, int64); + void (*Texts_Notifier)(Texts_Text, int16, int32, int32); typedef struct Texts_Reader { @@ -77,7 +78,7 @@ typedef Texts_FontsFont fnt; int8 col, voff; Texts_Elem elem; - char _prvt0[64]; + char _prvt0[40]; } Texts_Reader; typedef @@ -86,10 +87,10 @@ typedef Texts_FontsFont fnt; int8 col, voff; Texts_Elem elem; - char _prvt0[64]; + char _prvt0[40]; CHAR nextCh; - int32 line, class; - int64 i; + int16 line, class; + int32 i; REAL x; LONGREAL y; CHAR c; @@ -99,9 +100,9 @@ typedef typedef struct Texts_TextDesc { - int64 len; + int32 len; Texts_Notifier notify; - char _prvt0[24]; + char _prvt0[20]; } Texts_TextDesc; typedef @@ -109,7 +110,7 @@ typedef Texts_Buffer buf; Texts_FontsFont fnt; int8 col, voff; - char _prvt0[54]; + char _prvt0[38]; } Texts_Writer; @@ -129,41 +130,41 @@ import address *Texts_Scanner__typ; import address *Texts_Writer__typ; import void Texts_Append (Texts_Text T, Texts_Buffer B); -import void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); import void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); import void Texts_Copy (Texts_Buffer SB, Texts_Buffer DB); import void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE); -import void Texts_Delete (Texts_Text T, int64 beg, int64 end); +import void Texts_Delete (Texts_Text T, int32 beg, int32 end); import Texts_Text Texts_ElemBase (Texts_Elem E); -import int64 Texts_ElemPos (Texts_Elem E); -import void Texts_Insert (Texts_Text T, int64 pos, Texts_Buffer B); +import int32 Texts_ElemPos (Texts_Elem E); +import void Texts_Insert (Texts_Text T, int32 pos, Texts_Buffer B); import void Texts_Load (Files_Rider *r, address *r__typ, Texts_Text T); import void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len); import void Texts_OpenBuf (Texts_Buffer B); -import void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int64 pos); -import void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int64 pos); +import void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int32 pos); +import void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int32 pos); import void Texts_OpenWriter (Texts_Writer *W, address *W__typ); -import int64 Texts_Pos (Texts_Reader *R, address *R__typ); +import int32 Texts_Pos (Texts_Reader *R, address *R__typ); import void Texts_Read (Texts_Reader *R, address *R__typ, CHAR *ch); import void Texts_ReadElem (Texts_Reader *R, address *R__typ); import void Texts_ReadPrevElem (Texts_Reader *R, address *R__typ); import void Texts_Recall (Texts_Buffer *B); -import void Texts_Save (Texts_Text T, int64 beg, int64 end, Texts_Buffer B); +import void Texts_Save (Texts_Text T, int32 beg, int32 end, Texts_Buffer B); import void Texts_Scan (Texts_Scanner *S, address *S__typ); import void Texts_SetColor (Texts_Writer *W, address *W__typ, int8 col); import void Texts_SetFont (Texts_Writer *W, address *W__typ, Texts_FontsFont fnt); import void Texts_SetOffset (Texts_Writer *W, address *W__typ, int8 voff); import void Texts_Store (Files_Rider *r, address *r__typ, Texts_Text T); import void Texts_Write (Texts_Writer *W, address *W__typ, CHAR ch); -import void Texts_WriteDate (Texts_Writer *W, address *W__typ, int64 t, int64 d); +import void Texts_WriteDate (Texts_Writer *W, address *W__typ, int32 t, int32 d); import void Texts_WriteElem (Texts_Writer *W, address *W__typ, Texts_Elem e); -import void Texts_WriteHex (Texts_Writer *W, address *W__typ, int64 x); +import void Texts_WriteHex (Texts_Writer *W, address *W__typ, int32 x); import void Texts_WriteInt (Texts_Writer *W, address *W__typ, int64 x, int64 n); import void Texts_WriteLn (Texts_Writer *W, address *W__typ); -import void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n); +import void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int16 n); import void Texts_WriteLongRealHex (Texts_Writer *W, address *W__typ, LONGREAL x); -import void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int32 n); -import void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int32 n, int32 k); +import void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int16 n); +import void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int16 n, int16 k); import void Texts_WriteRealHex (Texts_Writer *W, address *W__typ, REAL x); import void Texts_WriteString (Texts_Writer *W, address *W__typ, CHAR *s, LONGINT s__len); import void *Texts__init(void); diff --git a/bootstrap/unix-88/Vishap.c b/bootstrap/unix-88/Vishap.c index 5c6cada1..1ec89e33 100644 --- a/bootstrap/unix-88/Vishap.c +++ b/bootstrap/unix-88/Vishap.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspamSf */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -25,7 +25,7 @@ static CHAR Vishap_mname[256]; export void Vishap_Module (BOOLEAN *done); static void Vishap_PropagateElementaryTypeSizes (void); export void Vishap_Translate (void); -static void Vishap_Trap (int32 sig); +static void Vishap_Trap (int16 sig); void Vishap_Module (BOOLEAN *done) @@ -42,22 +42,22 @@ void Vishap_Module (BOOLEAN *done) OPC_Init(); OPV_Module(p); if (OPM_noerr) { - if ((__IN(10, OPM_opt, 64) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { + if ((__IN(10, OPM_opt, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { OPM_DeleteNewSym(); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" Main program.", 16); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { if (new) { - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" New symbol file.", 19); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } OPM_RegisterNewSym(); @@ -111,17 +111,17 @@ void Vishap_Translate (void) OPM_LogWLn(); Platform_Exit(1); } - if (!__IN(13, OPM_opt, 64)) { - if (__IN(14, OPM_opt, 64)) { + if (!__IN(13, OPM_opt, 32)) { + if (__IN(14, OPM_opt, 32)) { extTools_Assemble(OPM_modName, 32); } else { - if (!__IN(10, OPM_opt, 64)) { + if (!__IN(10, OPM_opt, 32)) { extTools_Assemble(OPM_modName, 32); Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048); Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048); Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048); } else { - extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 64), modulesobj, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 32), modulesobj, 2048); } } } @@ -129,7 +129,7 @@ void Vishap_Translate (void) } } -static void Vishap_Trap (int32 sig) +static void Vishap_Trap (int16 sig) { Heap_FINALL(); if (sig == 3) { diff --git a/bootstrap/unix-88/errors.c b/bootstrap/unix-88/errors.c index 4bb09433..0a40d5e9 100644 --- a/bootstrap/unix-88/errors.c +++ b/bootstrap/unix-88/errors.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/unix-88/extTools.c b/bootstrap/unix-88/extTools.c index d6bc2194..8be0b63d 100644 --- a/bootstrap/unix-88/extTools.c +++ b/bootstrap/unix-88/extTools.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -22,10 +22,10 @@ static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGIN static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGINT cmd__len) { - int32 r, status, exitcode; + int16 r, status, exitcode; __DUP(title, title__len, CHAR); __DUP(cmd, cmd__len, CHAR); - if (__IN(18, OPM_opt, 64)) { + if (__IN(18, OPM_opt, 32)) { Console_String(title, title__len); Console_String(cmd, cmd__len); Console_Ln(); diff --git a/bootstrap/unix-88/vt100.c b/bootstrap/unix-88/vt100.c index bb55d599..4f6a6c9d 100644 --- a/bootstrap/unix-88/vt100.c +++ b/bootstrap/unix-88/vt100.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" @@ -13,36 +13,36 @@ export CHAR vt100_CSI[5]; static CHAR vt100_tmpstr[32]; -export void vt100_CHA (int32 n); -export void vt100_CNL (int32 n); -export void vt100_CPL (int32 n); -export void vt100_CUB (int32 n); -export void vt100_CUD (int32 n); -export void vt100_CUF (int32 n); -export void vt100_CUP (int32 n, int32 m); -export void vt100_CUU (int32 n); +export void vt100_CHA (int16 n); +export void vt100_CNL (int16 n); +export void vt100_CPL (int16 n); +export void vt100_CUB (int16 n); +export void vt100_CUD (int16 n); +export void vt100_CUF (int16 n); +export void vt100_CUP (int16 n, int16 m); +export void vt100_CUU (int16 n); export void vt100_DECTCEMh (void); export void vt100_DECTCEMl (void); -export void vt100_DSR (int32 n); -export void vt100_ED (int32 n); -export void vt100_EL (int32 n); -static void vt100_EscSeq (int32 n, CHAR *letter, LONGINT letter__len); +export void vt100_DSR (int16 n); +export void vt100_ED (int16 n); +export void vt100_EL (int16 n); +static void vt100_EscSeq (int16 n, CHAR *letter, LONGINT letter__len); static void vt100_EscSeq0 (CHAR *letter, LONGINT letter__len); -static void vt100_EscSeq2 (int32 n, int32 m, CHAR *letter, LONGINT letter__len); -static void vt100_EscSeqSwapped (int32 n, CHAR *letter, LONGINT letter__len); -export void vt100_HVP (int32 n, int32 m); -export void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len); +static void vt100_EscSeq2 (int16 n, int16 m, CHAR *letter, LONGINT letter__len); +static void vt100_EscSeqSwapped (int16 n, CHAR *letter, LONGINT letter__len); +export void vt100_HVP (int16 n, int16 m); +export void vt100_IntToStr (int32 int_, CHAR *str, LONGINT str__len); export void vt100_RCP (void); -static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int32 start, int32 end); +static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int16 start, int16 end); export void vt100_SCP (void); -export void vt100_SD (int32 n); -export void vt100_SGR (int32 n); -export void vt100_SGR2 (int32 n, int32 m); -export void vt100_SU (int32 n); +export void vt100_SD (int16 n); +export void vt100_SGR (int16 n); +export void vt100_SGR2 (int16 n, int16 m); +export void vt100_SU (int16 n); export void vt100_SetAttr (CHAR *attr, LONGINT attr__len); -static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int32 start, int32 end) +static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int16 start, int16 end) { CHAR h; while (start < end) { @@ -54,15 +54,15 @@ static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int32 start, int32 end) } } -void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len) +void vt100_IntToStr (int32 int_, CHAR *str, LONGINT str__len) { CHAR b[21]; - int32 s, e; + int16 s, e; int8 maxLength; - maxLength = 20; - if (int_ == (-9223372036854775807-1)) { - __MOVE("-9223372036854775808", b, 21); - e = 20; + maxLength = 11; + if (int_ == (-2147483647-1)) { + __MOVE("-2147483648", b, 12); + e = 11; } else { if (int_ < 0) { b[0] = '-'; @@ -73,7 +73,7 @@ void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len) } e = s; do { - b[__X(e, 21)] = (CHAR)(__MOD(int_, 10) + 48); + b[__X(e, 21)] = (CHAR)((int)__MOD(int_, 10) + 48); int_ = __DIV(int_, 10); e += 1; } while (!(int_ == 0)); @@ -93,7 +93,7 @@ static void vt100_EscSeq0 (CHAR *letter, LONGINT letter__len) __DEL(letter); } -static void vt100_EscSeq (int32 n, CHAR *letter, LONGINT letter__len) +static void vt100_EscSeq (int16 n, CHAR *letter, LONGINT letter__len) { CHAR nstr[2]; CHAR cmd[7]; @@ -106,7 +106,7 @@ static void vt100_EscSeq (int32 n, CHAR *letter, LONGINT letter__len) __DEL(letter); } -static void vt100_EscSeqSwapped (int32 n, CHAR *letter, LONGINT letter__len) +static void vt100_EscSeqSwapped (int16 n, CHAR *letter, LONGINT letter__len) { CHAR nstr[2]; CHAR cmd[7]; @@ -119,7 +119,7 @@ static void vt100_EscSeqSwapped (int32 n, CHAR *letter, LONGINT letter__len) __DEL(letter); } -static void vt100_EscSeq2 (int32 n, int32 m, CHAR *letter, LONGINT letter__len) +static void vt100_EscSeq2 (int16 n, int16 m, CHAR *letter, LONGINT letter__len) { CHAR nstr[5], mstr[5]; CHAR cmd[12]; @@ -135,82 +135,82 @@ static void vt100_EscSeq2 (int32 n, int32 m, CHAR *letter, LONGINT letter__len) __DEL(letter); } -void vt100_CUU (int32 n) +void vt100_CUU (int16 n) { vt100_EscSeq(n, (CHAR*)"A", 2); } -void vt100_CUD (int32 n) +void vt100_CUD (int16 n) { vt100_EscSeq(n, (CHAR*)"B", 2); } -void vt100_CUF (int32 n) +void vt100_CUF (int16 n) { vt100_EscSeq(n, (CHAR*)"C", 2); } -void vt100_CUB (int32 n) +void vt100_CUB (int16 n) { vt100_EscSeq(n, (CHAR*)"D", 2); } -void vt100_CNL (int32 n) +void vt100_CNL (int16 n) { vt100_EscSeq(n, (CHAR*)"E", 2); } -void vt100_CPL (int32 n) +void vt100_CPL (int16 n) { vt100_EscSeq(n, (CHAR*)"F", 2); } -void vt100_CHA (int32 n) +void vt100_CHA (int16 n) { vt100_EscSeq(n, (CHAR*)"G", 2); } -void vt100_CUP (int32 n, int32 m) +void vt100_CUP (int16 n, int16 m) { vt100_EscSeq2(n, m, (CHAR*)"H", 2); } -void vt100_ED (int32 n) +void vt100_ED (int16 n) { vt100_EscSeq(n, (CHAR*)"J", 2); } -void vt100_EL (int32 n) +void vt100_EL (int16 n) { vt100_EscSeq(n, (CHAR*)"K", 2); } -void vt100_SU (int32 n) +void vt100_SU (int16 n) { vt100_EscSeq(n, (CHAR*)"S", 2); } -void vt100_SD (int32 n) +void vt100_SD (int16 n) { vt100_EscSeq(n, (CHAR*)"T", 2); } -void vt100_HVP (int32 n, int32 m) +void vt100_HVP (int16 n, int16 m) { vt100_EscSeq2(n, m, (CHAR*)"f", 2); } -void vt100_SGR (int32 n) +void vt100_SGR (int16 n) { vt100_EscSeq(n, (CHAR*)"m", 2); } -void vt100_SGR2 (int32 n, int32 m) +void vt100_SGR2 (int16 n, int16 m) { vt100_EscSeq2(n, m, (CHAR*)"m", 2); } -void vt100_DSR (int32 n) +void vt100_DSR (int16 n) { vt100_EscSeq(6, (CHAR*)"n", 2); } diff --git a/bootstrap/unix-88/vt100.h b/bootstrap/unix-88/vt100.h index 2bc7d18f..94f8add4 100644 --- a/bootstrap/unix-88/vt100.h +++ b/bootstrap/unix-88/vt100.h @@ -9,27 +9,27 @@ import CHAR vt100_CSI[5]; -import void vt100_CHA (int32 n); -import void vt100_CNL (int32 n); -import void vt100_CPL (int32 n); -import void vt100_CUB (int32 n); -import void vt100_CUD (int32 n); -import void vt100_CUF (int32 n); -import void vt100_CUP (int32 n, int32 m); -import void vt100_CUU (int32 n); +import void vt100_CHA (int16 n); +import void vt100_CNL (int16 n); +import void vt100_CPL (int16 n); +import void vt100_CUB (int16 n); +import void vt100_CUD (int16 n); +import void vt100_CUF (int16 n); +import void vt100_CUP (int16 n, int16 m); +import void vt100_CUU (int16 n); import void vt100_DECTCEMh (void); import void vt100_DECTCEMl (void); -import void vt100_DSR (int32 n); -import void vt100_ED (int32 n); -import void vt100_EL (int32 n); -import void vt100_HVP (int32 n, int32 m); -import void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len); +import void vt100_DSR (int16 n); +import void vt100_ED (int16 n); +import void vt100_EL (int16 n); +import void vt100_HVP (int16 n, int16 m); +import void vt100_IntToStr (int32 int_, CHAR *str, LONGINT str__len); import void vt100_RCP (void); import void vt100_SCP (void); -import void vt100_SD (int32 n); -import void vt100_SGR (int32 n); -import void vt100_SGR2 (int32 n, int32 m); -import void vt100_SU (int32 n); +import void vt100_SD (int16 n); +import void vt100_SGR (int16 n); +import void vt100_SGR2 (int16 n, int16 m); +import void vt100_SU (int16 n); import void vt100_SetAttr (CHAR *attr, LONGINT attr__len); import void *vt100__init(void); diff --git a/bootstrap/windows-48/OPB.c b/bootstrap/windows-48/OPB.c index af4f4fc4..e09bf1b4 100644 --- a/bootstrap/windows-48/OPB.c +++ b/bootstrap/windows-48/OPB.c @@ -2024,7 +2024,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p->typ = OPT_notyp; } else { if (x->typ != p->typ) { - if ((x->class == 7 && f == 4)) { + if ((f == 4 && (x->class == 7 || (p->typ->form == 4 && x->typ->size <= p->typ->size)))) { OPB_Convert(&x, p->typ); } else { OPB_err(111); diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index 039d1c77..2769f708 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -1124,8 +1124,8 @@ export void *OPM__init(void) OPM_AddressSize = 8; OPM_Alignment = 8; OPM_ShortintSize = 1; - OPM_IntegerSize = 4; - OPM_LongintSize = 8; - OPM_SetSize = 8; + OPM_IntegerSize = 2; + OPM_LongintSize = 4; + OPM_SetSize = 4; __ENDMOD; } diff --git a/bootstrap/windows-48/Platform.c b/bootstrap/windows-48/Platform.c index 54a94ae8..8aeae1b8 100644 --- a/bootstrap/windows-48/Platform.c +++ b/bootstrap/windows-48/Platform.c @@ -13,7 +13,7 @@ typedef Platform_ArgPtr (*Platform_ArgVec)[1024]; typedef - int32 (*Platform_ArgVecPtr)[1]; + address (*Platform_ArgVecPtr)[1]; typedef CHAR (*Platform_EnvPtr)[1024]; @@ -74,8 +74,8 @@ export address Platform_OSAllocate (address size); export void Platform_OSFree (address address); export int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h); export int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h); -export int16 Platform_Read (int32 h, address p, address l, address *n); -export int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, address *n); +export int16 Platform_Read (int32 h, address p, int32 l, int32 *n); +export int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n); export int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); export BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); export BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); @@ -92,7 +92,7 @@ export BOOLEAN Platform_TimedOut (int16 e); export BOOLEAN Platform_TooManyFiles (int16 e); export int16 Platform_Truncate (int32 h, int32 limit); export int16 Platform_Unlink (CHAR *n, LONGINT n__len); -export int16 Platform_Write (int32 h, int32 p, int32 l); +export int16 Platform_Write (int32 h, address p, int32 l); static void Platform_YMDHMStoClock (int16 ye, int16 mo, int16 da, int16 ho, int16 mi, int16 se, int32 *t, int32 *d); static void Platform_errch (CHAR c); static void Platform_errint (int32 l); @@ -543,41 +543,43 @@ int16 Platform_Size (int32 h, int32 *l) return _o_result; } -int16 Platform_Read (int32 h, address p, address l, address *n) +int16 Platform_Read (int32 h, address p, int32 l, int32 *n) { int16 _o_result; int16 result; - *n = 0; - result = Platform_readfile(h, p, l, &*n); + int32 lengthread; + result = Platform_readfile(h, p, l, &lengthread); if (result == 0) { *n = 0; _o_result = Platform_err(); return _o_result; } else { + *n = lengthread; _o_result = 0; return _o_result; } __RETCHK; } -int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, address *n) +int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n) { int16 _o_result; int16 result; - *n = 0; - result = Platform_readfile(h, (address)b, b__len, &*n); + int32 lengthread; + result = Platform_readfile(h, (address)b, b__len, &lengthread); if (result == 0) { *n = 0; _o_result = Platform_err(); return _o_result; } else { + *n = lengthread; _o_result = 0; return _o_result; } __RETCHK; } -int16 Platform_Write (int32 h, int32 p, int32 l) +int16 Platform_Write (int32 h, address p, int32 l) { int16 _o_result; if (Platform_writefile(h, p, l) == 0) { diff --git a/bootstrap/windows-48/Platform.h b/bootstrap/windows-48/Platform.h index 18ca5267..d62dd343 100644 --- a/bootstrap/windows-48/Platform.h +++ b/bootstrap/windows-48/Platform.h @@ -58,8 +58,8 @@ import address Platform_OSAllocate (address size); import void Platform_OSFree (address address); import int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h); import int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h); -import int16 Platform_Read (int32 h, address p, address l, address *n); -import int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, address *n); +import int16 Platform_Read (int32 h, address p, int32 l, int32 *n); +import int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n); import int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); import BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); import BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); @@ -75,7 +75,7 @@ import BOOLEAN Platform_TimedOut (int16 e); import BOOLEAN Platform_TooManyFiles (int16 e); import int16 Platform_Truncate (int32 h, int32 limit); import int16 Platform_Unlink (CHAR *n, LONGINT n__len); -import int16 Platform_Write (int32 h, int32 p, int32 l); +import int16 Platform_Write (int32 h, address p, int32 l); import BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); import void *Platform__init(void); diff --git a/bootstrap/windows-88/Configuration.c b/bootstrap/windows-88/Configuration.c index fa5765f3..abdf151b 100644 --- a/bootstrap/windows-88/Configuration.c +++ b/bootstrap/windows-88/Configuration.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-88/Console.c b/bootstrap/windows-88/Console.c index 939de5cc..7b492ced 100644 --- a/bootstrap/windows-88/Console.c +++ b/bootstrap/windows-88/Console.c @@ -1,21 +1,21 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Platform.h" static CHAR Console_line[128]; -static int32 Console_pos; +static int16 Console_pos; export void Console_Bool (BOOLEAN b); export void Console_Char (CHAR ch); export void Console_Flush (void); -export void Console_Hex (int64 i); +export void Console_Hex (int32 i); export void Console_Int (int64 i, int64 n); export void Console_Ln (void); export void Console_Read (CHAR *ch); @@ -25,7 +25,7 @@ export void Console_String (CHAR *s, LONGINT s__len); void Console_Flush (void) { - int32 error; + int16 error; error = Platform_Write(Platform_StdOut, (address)Console_line, Console_pos); Console_pos = 0; } @@ -44,7 +44,7 @@ void Console_Char (CHAR ch) void Console_String (CHAR *s, LONGINT s__len) { - int32 i; + int16 i; __DUP(s, s__len, CHAR); i = 0; while (s[__X(i, s__len)] != 0x00) { @@ -57,17 +57,17 @@ void Console_String (CHAR *s, LONGINT s__len) void Console_Int (int64 i, int64 n) { CHAR s[32]; - int64 i1, k; - if (i == __LSHL(1, 63, 64)) { - __MOVE("8085774586302733229", s, 20); - k = 19; + int32 i1, k; + if (i == (int64)__LSHL(1, 31, 32)) { + __MOVE("8463847412", s, 11); + k = 10; } else { - i1 = __ABS((int64)i); - s[0] = (CHAR)(__MOD(i1, 10) + 48); + i1 = __ABS(__VAL(int32, i)); + s[0] = (CHAR)((int)__MOD(i1, 10) + 48); i1 = __DIV(i1, 10); k = 1; while (i1 > 0) { - s[__X(k, 32)] = (CHAR)(__MOD(i1, 10) + 48); + s[__X(k, 32)] = (CHAR)((int)__MOD(i1, 10) + 48); i1 = __DIV(i1, 10); k += 1; } @@ -76,7 +76,7 @@ void Console_Int (int64 i, int64 n) s[__X(k, 32)] = '-'; k += 1; } - while (n > k) { + while (n > (int64)k) { Console_Char(' '); n -= 1; } @@ -100,11 +100,11 @@ void Console_Bool (BOOLEAN b) } } -void Console_Hex (int64 i) +void Console_Hex (int32 i) { - int32 k; + int16 k; int64 n; - k = -60; + k = -28; while (k <= 0) { n = __MASK(__ASH(i, k), -16); if (n <= 9) { @@ -118,8 +118,8 @@ void Console_Hex (int64 i) void Console_Read (CHAR *ch) { - int64 n; - int32 error; + int32 n; + int16 error; Console_Flush(); error = Platform_ReadBuf(Platform_StdIn, (void*)&*ch, 1, &n); if (n != 1) { @@ -129,7 +129,7 @@ void Console_Read (CHAR *ch) void Console_ReadLine (CHAR *line, LONGINT line__len) { - int64 i; + int32 i; CHAR ch; Console_Flush(); i = 0; diff --git a/bootstrap/windows-88/Console.h b/bootstrap/windows-88/Console.h index 64d39044..b08c93ea 100644 --- a/bootstrap/windows-88/Console.h +++ b/bootstrap/windows-88/Console.h @@ -11,7 +11,7 @@ import void Console_Bool (BOOLEAN b); import void Console_Char (CHAR ch); import void Console_Flush (void); -import void Console_Hex (int64 i); +import void Console_Hex (int32 i); import void Console_Int (int64 i, int64 n); import void Console_Ln (void); import void Console_Read (CHAR *ch); diff --git a/bootstrap/windows-88/Files.c b/bootstrap/windows-88/Files.c index 27fb9031..c30a1491 100644 --- a/bootstrap/windows-88/Files.c +++ b/bootstrap/windows-88/Files.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -18,7 +18,7 @@ typedef struct Files_BufDesc { Files_File f; BOOLEAN chg; - int64 org, size; + int32 org, size; SYSTEM_BYTE data[4096]; } Files_BufDesc; @@ -33,23 +33,23 @@ typedef Files_FileName workName, registerName; BOOLEAN tempFile; Platform_FileIdentity identity; - int64 fd, len, pos; + int32 fd, len, pos; Files_Buffer bufs[4]; - int32 swapper, state; + int16 swapper, state; Files_File next; } Files_FileDesc; typedef struct Files_Rider { - int64 res; + int32 res; BOOLEAN eof; Files_Buffer buf; - int64 org, offset; + int32 org, offset; } Files_Rider; static Files_File Files_files; -static int32 Files_tempno; +static int16 Files_tempno; static CHAR Files_HOME[1024]; static struct { LONGINT len[1]; @@ -62,50 +62,50 @@ export address *Files_Rider__typ; export Files_File Files_Base (Files_Rider *r, address *r__typ); static Files_File Files_CacheEntry (Platform_FileIdentity identity); -export void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res); +export void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res); export void Files_Close (Files_File f); static void Files_CloseOSFile (Files_File f); static void Files_Create (Files_File f); -export void Files_Delete (CHAR *name, LONGINT name__len, int32 *res); -static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 errcode); +export void Files_Delete (CHAR *name, LONGINT name__len, int16 *res); +static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode); static void Files_Finalize (SYSTEM_PTR o); static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *dest, LONGINT dest__len); static void Files_Flush (Files_Buffer buf); -export void Files_GetDate (Files_File f, int64 *t, int64 *d); +export void Files_GetDate (Files_File f, int32 *t, int32 *d); export void Files_GetName (Files_File f, CHAR *name, LONGINT name__len); static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *name, LONGINT name__len); static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len); -export int64 Files_Length (Files_File f); +export int32 Files_Length (Files_File f); static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT name__len, CHAR *dest, LONGINT dest__len); export Files_File Files_New (CHAR *name, LONGINT name__len); export Files_File Files_Old (CHAR *name, LONGINT name__len); -export int64 Files_Pos (Files_Rider *r, address *r__typ); +export int32 Files_Pos (Files_Rider *r, address *r__typ); export void Files_Purge (Files_File f); export void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x); export void Files_ReadBool (Files_Rider *R, address *R__typ, BOOLEAN *x); export void Files_ReadByte (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len); -export void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n); -export void Files_ReadInt (Files_Rider *R, address *R__typ, int32 *x); -export void Files_ReadLInt (Files_Rider *R, address *R__typ, int64 *x); +export void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n); +export void Files_ReadInt (Files_Rider *R, address *R__typ, int16 *x); +export void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); export void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); export void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); -export void Files_ReadNum (Files_Rider *R, address *R__typ, int64 *x); +export void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); export void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); export void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); export void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); export void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); export void Files_Register (Files_File f); -export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int32 *res); -static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len); -export void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos); +export void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); +static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len); +export void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos); export void Files_SetSearchPath (CHAR *path, LONGINT path__len); export void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x); export void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x); -export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n); -export void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x); -export void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x); +export void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n); +export void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); +export void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); export void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -export void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); +export void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); export void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); export void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); export void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); @@ -113,7 +113,7 @@ export void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT #define Files_IdxTrap() __HALT(-1) -static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 errcode) +static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode) { __DUP(s, s__len, CHAR); Console_Ln(); @@ -142,7 +142,7 @@ static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 errcode) static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT name__len, CHAR *dest, LONGINT dest__len) { - int32 i, j; + int16 i, j; __DUP(dir, dir__len, CHAR); __DUP(name, name__len, CHAR); i = 0; @@ -167,7 +167,7 @@ static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *name, LONGINT name__len) { - int64 n, i, j; + int32 n, i, j; __DUP(finalName, finalName__len, CHAR); Files_tempno += 1; n = Files_tempno; @@ -199,7 +199,7 @@ static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *na name[i + 5] = '.'; i += 6; while (n > 0) { - name[i] = (CHAR)(__MOD(n, 10) + 48); + name[i] = (CHAR)((int)__MOD(n, 10) + 48); n = __DIV(n, 10); i += 1; } @@ -207,7 +207,7 @@ static void Files_GetTempName (CHAR *finalName, LONGINT finalName__len, CHAR *na i += 1; n = Platform_PID; while (n > 0) { - name[i] = (CHAR)(__MOD(n, 10) + 48); + name[i] = (CHAR)((int)__MOD(n, 10) + 48); n = __DIV(n, 10); i += 1; } @@ -219,7 +219,7 @@ static void Files_Create (Files_File f) { Platform_FileIdentity identity; BOOLEAN done; - int32 error; + int16 error; CHAR err[32]; if (f->fd == -1) { if (f->state == 1) { @@ -256,7 +256,7 @@ static void Files_Create (Files_File f) static void Files_Flush (Files_Buffer buf) { - int32 error; + int16 error; Files_File f = NIL; if (buf->chg) { f = buf->f; @@ -280,7 +280,7 @@ static void Files_Flush (Files_Buffer buf) static void Files_CloseOSFile (Files_File f) { Files_File prev = NIL; - int32 error; + int16 error; if (Files_files == f) { Files_files = f->next; } else { @@ -300,8 +300,8 @@ static void Files_CloseOSFile (Files_File f) void Files_Close (Files_File f) { - int64 i; - int32 error; + int32 i; + int16 error; if (f->state != 1 || f->registerName[0] != 0x00) { Files_Create(f); i = 0; @@ -317,9 +317,9 @@ void Files_Close (Files_File f) } } -int64 Files_Length (Files_File f) +int32 Files_Length (Files_File f) { - int64 _o_result; + int32 _o_result; _o_result = f->len; return _o_result; } @@ -342,9 +342,9 @@ Files_File Files_New (CHAR *name, LONGINT name__len) return _o_result; } -static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len) +static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len) { - int32 i; + int16 i; CHAR ch; i = 0; if (Files_SearchPath == NIL) { @@ -388,7 +388,7 @@ static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len) static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len) { BOOLEAN _o_result; - int32 i; + int16 i; CHAR ch; i = 0; ch = name[0]; @@ -404,7 +404,7 @@ static Files_File Files_CacheEntry (Platform_FileIdentity identity) { Files_File _o_result; Files_File f = NIL; - int32 i, error; + int16 i, error; f = Files_files; while (f != NIL) { if (Platform_SameFile(identity, f->identity)) { @@ -434,11 +434,11 @@ Files_File Files_Old (CHAR *name, LONGINT name__len) { Files_File _o_result; Files_File f = NIL; - int64 fd; - int32 pos; + int32 fd; + int16 pos; BOOLEAN done; CHAR dir[256], path[256]; - int32 error; + int16 error; Platform_FileIdentity identity; __DUP(name, name__len, CHAR); if (name[0] != 0x00) { @@ -513,9 +513,9 @@ Files_File Files_Old (CHAR *name, LONGINT name__len) void Files_Purge (Files_File f) { - int32 i; + int16 i; Platform_FileIdentity identity; - int32 error; + int16 error; i = 0; while (i < 4) { if (f->bufs[i] != NIL) { @@ -535,27 +535,27 @@ void Files_Purge (Files_File f) Platform_SetMTime(&f->identity, Platform_FileIdentity__typ, identity); } -void Files_GetDate (Files_File f, int64 *t, int64 *d) +void Files_GetDate (Files_File f, int32 *t, int32 *d) { Platform_FileIdentity identity; - int32 error; + int16 error; Files_Create(f); error = Platform_Identify(f->fd, &identity, Platform_FileIdentity__typ); Platform_MTimeAsClock(identity, &*t, &*d); } -int64 Files_Pos (Files_Rider *r, address *r__typ) +int32 Files_Pos (Files_Rider *r, address *r__typ) { - int64 _o_result; + int32 _o_result; _o_result = (*r).org + (*r).offset; return _o_result; } -void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos) +void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos) { - int64 org, offset, i, n; + int32 org, offset, i, n; Files_Buffer buf = NIL; - int32 error; + int16 error; if (f != NIL) { if (pos > f->len) { pos = f->len; @@ -615,7 +615,7 @@ void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos) void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x) { - int64 offset; + int32 offset; Files_Buffer buf = NIL; buf = (*r).buf; offset = (*r).offset; @@ -637,9 +637,9 @@ void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x) } } -void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n) +void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n) { - int64 xpos, min, restInBuf, offset; + int32 xpos, min, restInBuf, offset; Files_Buffer buf = NIL; if (n > x__len) { Files_IdxTrap(); @@ -663,7 +663,7 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x } else { min = n; } - __MOVE(((address)buf->data) + offset, ((address)x) + xpos, min); + __MOVE((address)buf->data + (int64)offset, (address)x + (int64)xpos, min); offset += min; (*r).offset = offset; xpos += min; @@ -688,7 +688,7 @@ Files_File Files_Base (Files_Rider *r, address *r__typ) void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x) { Files_Buffer buf = NIL; - int64 offset; + int32 offset; buf = (*r).buf; offset = (*r).offset; if ((*r).org != buf->org || offset >= 4096) { @@ -706,9 +706,9 @@ void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x) (*r).res = 0; } -void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n) +void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n) { - int64 xpos, min, restInBuf, offset; + int32 xpos, min, restInBuf, offset; Files_Buffer buf = NIL; if (n > x__len) { Files_IdxTrap(); @@ -728,7 +728,7 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT } else { min = n; } - __MOVE(((address)x) + xpos, ((address)buf->data) + offset, min); + __MOVE((address)x + (int64)xpos, (address)buf->data + (int64)offset, min); offset += min; (*r).offset = offset; if (offset > buf->size) { @@ -742,17 +742,17 @@ void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT (*r).res = 0; } -void Files_Delete (CHAR *name, LONGINT name__len, int32 *res) +void Files_Delete (CHAR *name, LONGINT name__len, int16 *res) { __DUP(name, name__len, CHAR); *res = Platform_Unlink((void*)name, name__len); __DEL(name); } -void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int32 *res) +void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res) { - int64 fdold, fdnew, n; - int32 error, ignore; + int32 fdold, fdnew, n; + int16 error, ignore; Platform_FileIdentity oldidentity, newidentity; CHAR buf[4096]; __DUP(old, old__len, CHAR); @@ -807,7 +807,7 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int void Files_Register (Files_File f) { - int32 idx, errcode; + int16 idx, errcode; Files_File f1 = NIL; CHAR file[104]; if ((f->state == 1 && f->registerName[0] != 0x00)) { @@ -826,7 +826,7 @@ void Files_Register (Files_File f) } } -void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res) +void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res) { __DUP(path, path__len, CHAR); *res = Platform_Chdir((void*)path, path__len); @@ -835,7 +835,7 @@ void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res) static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *dest, LONGINT dest__len) { - int64 i, j; + int32 i, j; if (!Platform_LittleEndian) { i = src__len; j = 0; @@ -854,26 +854,26 @@ void Files_ReadBool (Files_Rider *R, address *R__typ, BOOLEAN *x) Files_Read(&*R, R__typ, (CHAR*)(void*)&*x); } -void Files_ReadInt (Files_Rider *R, address *R__typ, int32 *x) +void Files_ReadInt (Files_Rider *R, address *R__typ, int16 *x) { CHAR b[2]; Files_ReadBytes(&*R, R__typ, (void*)b, 2, 2); - *x = b[0] + __ASHL(b[1], 8); + *x = (int16)b[0] + __ASHL((int16)b[1], 8); } -void Files_ReadLInt (Files_Rider *R, address *R__typ, int64 *x) +void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x) { CHAR b[4]; Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4); - *x = ((b[0] + __ASHL(b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); + *x = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); } void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x) { CHAR b[4]; - int64 l; + int32 l; Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4); - l = ((b[0] + __ASHL(b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); + l = (((int16)b[0] + __ASHL((int16)b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24); *x = (SET)l; } @@ -893,7 +893,7 @@ void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x) void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) { - int32 i; + int16 i; CHAR ch; i = 0; do { @@ -905,7 +905,7 @@ void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) { - int32 i; + int16 i; CHAR ch; BOOLEAN b; i = 0; @@ -921,26 +921,26 @@ void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) } while (!b); } -void Files_ReadNum (Files_Rider *R, address *R__typ, int64 *x) +void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x) { int8 s; CHAR ch; - int64 n; + int32 n; s = 0; n = 0; Files_Read(&*R, R__typ, (void*)&ch); - while (ch >= 128) { - n += __ASH((int64)(ch - 128), s); + while ((int16)ch >= 128) { + n += __ASH(((int16)ch - 128), s); s += 7; Files_Read(&*R, R__typ, (void*)&ch); } - n += __ASH((int64)(__MASK(ch, -64) - __ASHL(__ASHR(ch, 6), 6)), s); + n += __ASH((__MASK((int16)ch, -64) - __ASHL(__ASHR((int16)ch, 6), 6)), s); *x = n; } void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x) { - int64 n; + int32 n; Files_ReadNum(&*R, R__typ, &n); *x = n; } @@ -950,7 +950,7 @@ void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x) Files_Write(&*R, R__typ, __VAL(CHAR, x)); } -void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x) +void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x) { CHAR b[2]; b[0] = (CHAR)x; @@ -958,7 +958,7 @@ void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x) Files_WriteBytes(&*R, R__typ, (void*)b, 2, 2); } -void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x) +void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x) { CHAR b[4]; b[0] = (CHAR)x; @@ -971,8 +971,8 @@ void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x) void Files_WriteSet (Files_Rider *R, address *R__typ, SET x) { CHAR b[4]; - int64 i; - i = (int64)x; + int32 i; + i = (int32)x; b[0] = (CHAR)i; b[1] = (CHAR)__ASHR(i, 8); b[2] = (CHAR)__ASHR(i, 16); @@ -996,7 +996,7 @@ void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x) void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len) { - int32 i; + int16 i; i = 0; while (x[i] != 0x00) { i += 1; @@ -1004,7 +1004,7 @@ void Files_WriteString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len Files_WriteBytes(&*R, R__typ, (void*)x, x__len * 1, i + 1); } -void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x) +void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x) { while (x < -64 || x > 63) { Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128)); @@ -1030,7 +1030,7 @@ void Files_GetName (Files_File f, CHAR *name, LONGINT name__len) static void Files_Finalize (SYSTEM_PTR o) { Files_File f = NIL; - int64 res; + int32 res; f = (Files_File)(address)o; if (f->fd >= 0) { Files_CloseOSFile(f); @@ -1058,9 +1058,9 @@ static void EnumPtrs(void (*P)(void*)) P(Files_SearchPath); } -__TDESC(Files_FileDesc, 1, 5) = {__TDFLDS("FileDesc", 320), {272, 280, 288, 296, 312, -48}}; -__TDESC(Files_BufDesc, 1, 1) = {__TDFLDS("BufDesc", 4128), {0, -16}}; -__TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 40), {16, -16}}; +__TDESC(Files_FileDesc, 1, 5) = {__TDFLDS("FileDesc", 288), {240, 248, 256, 264, 280, -48}}; +__TDESC(Files_BufDesc, 1, 1) = {__TDFLDS("BufDesc", 4120), {0, -16}}; +__TDESC(Files_Rider, 1, 1) = {__TDFLDS("Rider", 24), {8, -16}}; export void *Files__init(void) { diff --git a/bootstrap/windows-88/Files.h b/bootstrap/windows-88/Files.h index 399f2137..13fccd9a 100644 --- a/bootstrap/windows-88/Files.h +++ b/bootstrap/windows-88/Files.h @@ -10,16 +10,18 @@ typedef typedef struct Files_FileDesc { - char _prvt0[248]; - int64 fd; - char _prvt1[64]; + int64 _prvt0; + char _prvt1[216]; + int32 fd; + char _prvt2[60]; } Files_FileDesc; typedef struct Files_Rider { - int64 res; + int32 res; BOOLEAN eof; - char _prvt0[31]; + int64 _prvt0; + char _prvt1[8]; } Files_Rider; @@ -28,40 +30,40 @@ import address *Files_FileDesc__typ; import address *Files_Rider__typ; import Files_File Files_Base (Files_Rider *r, address *r__typ); -import void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int32 *res); +import void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res); import void Files_Close (Files_File f); -import void Files_Delete (CHAR *name, LONGINT name__len, int32 *res); -import void Files_GetDate (Files_File f, int64 *t, int64 *d); +import void Files_Delete (CHAR *name, LONGINT name__len, int16 *res); +import void Files_GetDate (Files_File f, int32 *t, int32 *d); import void Files_GetName (Files_File f, CHAR *name, LONGINT name__len); -import int64 Files_Length (Files_File f); +import int32 Files_Length (Files_File f); import Files_File Files_New (CHAR *name, LONGINT name__len); import Files_File Files_Old (CHAR *name, LONGINT name__len); -import int64 Files_Pos (Files_Rider *r, address *r__typ); +import int32 Files_Pos (Files_Rider *r, address *r__typ); import void Files_Purge (Files_File f); import void Files_Read (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x); import void Files_ReadBool (Files_Rider *R, address *R__typ, BOOLEAN *x); import void Files_ReadByte (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len); -import void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n); -import void Files_ReadInt (Files_Rider *R, address *R__typ, int32 *x); -import void Files_ReadLInt (Files_Rider *R, address *R__typ, int64 *x); +import void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n); +import void Files_ReadInt (Files_Rider *R, address *R__typ, int16 *x); +import void Files_ReadLInt (Files_Rider *R, address *R__typ, int32 *x); import void Files_ReadLReal (Files_Rider *R, address *R__typ, LONGREAL *x); import void Files_ReadLine (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); -import void Files_ReadNum (Files_Rider *R, address *R__typ, int64 *x); +import void Files_ReadNum (Files_Rider *R, address *R__typ, int32 *x); import void Files_ReadNum64 (Files_Rider *R, address *R__typ, int64 *x); import void Files_ReadReal (Files_Rider *R, address *R__typ, REAL *x); import void Files_ReadSet (Files_Rider *R, address *R__typ, SET *x); import void Files_ReadString (Files_Rider *R, address *R__typ, CHAR *x, LONGINT x__len); import void Files_Register (Files_File f); -import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int32 *res); -import void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int64 pos); +import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res); +import void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos); import void Files_SetSearchPath (CHAR *path, LONGINT path__len); import void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x); import void Files_WriteBool (Files_Rider *R, address *R__typ, BOOLEAN x); -import void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int64 n); -import void Files_WriteInt (Files_Rider *R, address *R__typ, int32 x); -import void Files_WriteLInt (Files_Rider *R, address *R__typ, int64 x); +import void Files_WriteBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n); +import void Files_WriteInt (Files_Rider *R, address *R__typ, int16 x); +import void Files_WriteLInt (Files_Rider *R, address *R__typ, int32 x); import void Files_WriteLReal (Files_Rider *R, address *R__typ, LONGREAL x); -import void Files_WriteNum (Files_Rider *R, address *R__typ, int64 x); +import void Files_WriteNum (Files_Rider *R, address *R__typ, int32 x); import void Files_WriteNum64 (Files_Rider *R, address *R__typ, int64 x); import void Files_WriteReal (Files_Rider *R, address *R__typ, REAL x); import void Files_WriteSet (Files_Rider *R, address *R__typ, SET x); diff --git a/bootstrap/windows-88/Heap.c b/bootstrap/windows-88/Heap.c index c87cfd6d..16ae9ffd 100644 --- a/bootstrap/windows-88/Heap.c +++ b/bootstrap/windows-88/Heap.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tsSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -54,11 +54,11 @@ typedef struct Heap_ModuleDesc { Heap_Module next; Heap_ModuleName name; - int64 refcnt; + int32 refcnt; Heap_Cmd cmds; address types; Heap_EnumProc enumPtrs; - int64 reserved1, reserved2; + int32 reserved1, reserved2; } Heap_ModuleDesc; @@ -70,9 +70,9 @@ static BOOLEAN Heap_firstTry; static address Heap_heap, Heap_heapend; export address Heap_heapsize; static Heap_FinNode Heap_fin; -static int32 Heap_lockdepth; +static int16 Heap_lockdepth; static BOOLEAN Heap_interrupted; -export int32 Heap_FileCount; +export int16 Heap_FileCount; export address *Heap_ModuleDesc__typ; export address *Heap_CmdDesc__typ; @@ -129,7 +129,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs) SYSTEM_PTR _o_result; Heap_Module m; if (__STRCMP(name, "Heap") == 0) { - __SYSNEW(m, 80); + __SYSNEW(m, 64); } else { __NEW(m, Heap_ModuleDesc); } @@ -602,7 +602,7 @@ static void Heap_MarkStack (address n, address *cand, LONGINT cand__len) while (sp != stack0) { __GET(sp, p, address); if ((p > Heap_heap && p < Heap_heapend)) { - if (nofcand == cand__len) { + if (nofcand == (int64)cand__len) { Heap_HeapSort(nofcand, (void*)cand, cand__len); Heap_MarkCandidates(nofcand, (void*)cand, cand__len); nofcand = 0; @@ -734,7 +734,7 @@ static void EnumPtrs(void (*P)(void*)) P(Heap_fin); } -__TDESC(Heap_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 80), {0, 40, -24}}; +__TDESC(Heap_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 64), {0, 32, -24}}; __TDESC(Heap_CmdDesc, 1, 1) = {__TDFLDS("CmdDesc", 40), {0, -16}}; __TDESC(Heap_FinDesc, 1, 1) = {__TDFLDS("FinDesc", 32), {0, -16}}; __TDESC(Heap__1, 1, 1) = {__TDFLDS("", 16), {8, -16}}; diff --git a/bootstrap/windows-88/Heap.h b/bootstrap/windows-88/Heap.h index b4829f2f..151a2d59 100644 --- a/bootstrap/windows-88/Heap.h +++ b/bootstrap/windows-88/Heap.h @@ -23,7 +23,7 @@ typedef typedef struct Heap_ModuleDesc { int64 _prvt0; - char _prvt1[72]; + char _prvt1[56]; } Heap_ModuleDesc; typedef @@ -32,7 +32,7 @@ typedef import SYSTEM_PTR Heap_modules; import address Heap_allocated, Heap_heapsize; -import int32 Heap_FileCount; +import int16 Heap_FileCount; import address *Heap_ModuleDesc__typ; diff --git a/bootstrap/windows-88/Modules.c b/bootstrap/windows-88/Modules.c index 23fec310..f844dfa9 100644 --- a/bootstrap/windows-88/Modules.c +++ b/bootstrap/windows-88/Modules.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" @@ -31,15 +31,15 @@ typedef struct Modules_ModuleDesc { Modules_Module next; Modules_ModuleName name; - int64 refcnt; + int32 refcnt; Modules_Cmd cmds; - int64 types; - void (*enumPtrs)(void(*)(int64)); - int64 reserved1, reserved2; + int32 types; + void (*enumPtrs)(void(*)(int32)); + int32 reserved1, reserved2; } Modules_ModuleDesc; -export int32 Modules_res; +export int16 Modules_res; export CHAR Modules_resMsg[256]; export Modules_ModuleName Modules_imported, Modules_importing; @@ -56,7 +56,7 @@ export Modules_Module Modules_ThisMod (CHAR *name, LONGINT name__len); static void Modules_Append (CHAR *a, LONGINT a__len, CHAR *b, LONGINT b__len) { - int32 i, j; + int16 i, j; __DUP(b, b__len, CHAR); i = 0; while (a[__X(i, a__len)] != 0x00) { @@ -160,7 +160,7 @@ void Modules_Free (CHAR *name, LONGINT name__len, BOOLEAN all) __DEL(name); } -__TDESC(Modules_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 80), {0, 40, -24}}; +__TDESC(Modules_ModuleDesc, 1, 2) = {__TDFLDS("ModuleDesc", 64), {0, 32, -24}}; __TDESC(Modules_CmdDesc, 1, 1) = {__TDFLDS("CmdDesc", 40), {0, -16}}; export void *Modules__init(void) diff --git a/bootstrap/windows-88/Modules.h b/bootstrap/windows-88/Modules.h index 7cafac5f..060208c6 100644 --- a/bootstrap/windows-88/Modules.h +++ b/bootstrap/windows-88/Modules.h @@ -28,15 +28,15 @@ typedef struct Modules_ModuleDesc { Modules_Module next; Modules_ModuleName name; - int64 refcnt; + int32 refcnt; Modules_Cmd cmds; - int64 types; - void (*enumPtrs)(void(*)(int64)); - char _prvt0[16]; + int32 types; + void (*enumPtrs)(void(*)(int32)); + char _prvt0[8]; } Modules_ModuleDesc; -import int32 Modules_res; +import int16 Modules_res; import CHAR Modules_resMsg[256]; import Modules_ModuleName Modules_imported, Modules_importing; diff --git a/bootstrap/windows-88/OPB.c b/bootstrap/windows-88/OPB.c index 81077606..e09bf1b4 100644 --- a/bootstrap/windows-88/OPB.c +++ b/bootstrap/windows-88/OPB.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -11,13 +11,13 @@ export void (*OPB_typSize)(OPT_Struct); -static int32 OPB_exp; +static int16 OPB_exp; static int64 OPB_maxExp; export void OPB_Assign (OPT_Node *x, OPT_Node y); static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y); -static int32 OPB_BoolToInt (BOOLEAN b); +static int16 OPB_BoolToInt (BOOLEAN b); export void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp); static void OPB_CharToString (OPT_Node n); static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode); @@ -25,9 +25,9 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo); export void OPB_CheckParameters (OPT_Object fp, OPT_Object ap, BOOLEAN checkNames); static void OPB_CheckProc (OPT_Struct x, OPT_Object y); static void OPB_CheckPtr (OPT_Node x, OPT_Node y); -static void OPB_CheckRealType (int32 f, int32 nr, OPT_Const x); +static void OPB_CheckRealType (int16 f, int16 nr, OPT_Const x); static void OPB_CheckReceiver (OPT_Node *x, OPT_Object fp); -static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y); +static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y); export void OPB_Construct (int8 class, OPT_Node *x, OPT_Node y); static void OPB_Convert (OPT_Node *x, OPT_Struct typ); export void OPB_DeRef (OPT_Node *x); @@ -56,17 +56,17 @@ export void OPB_Return (OPT_Node *x, OPT_Object proc); export void OPB_SetElem (OPT_Node *x); static void OPB_SetIntType (OPT_Node node); export void OPB_SetRange (OPT_Node *x, OPT_Node y); -export void OPB_StFct (OPT_Node *par0, int8 fctno, int32 parno); -export void OPB_StPar0 (OPT_Node *par0, int32 fctno); +export void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno); +export void OPB_StPar0 (OPT_Node *par0, int16 fctno); export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno); -export void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n); +export void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n); export void OPB_StaticLink (int8 dlev); export void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard); -static void OPB_err (int32 n); +static void OPB_err (int16 n); static int64 OPB_log (int64 x); -static void OPB_err (int32 n) +static void OPB_err (int16 n) { OPM_err(n); } @@ -128,9 +128,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y) *last = y; } -static int32 OPB_BoolToInt (BOOLEAN b) +static int16 OPB_BoolToInt (BOOLEAN b) { - int32 _o_result; + int16 _o_result; if (b) { _o_result = 1; return _o_result; @@ -323,18 +323,18 @@ void OPB_DeRef (OPT_Node *x) void OPB_Index (OPT_Node *x, OPT_Node y) { - int32 f; + int16 f; OPT_Struct typ = NIL; f = y->typ->form; if ((*x)->class >= 7) { OPB_err(79); - } else if (f != 4 || __IN(y->class, 0x0300, 64)) { + } else if (f != 4 || __IN(y->class, 0x0300, 32)) { OPB_err(80); y->typ = OPT_inttyp; } if ((*x)->typ->comp == 2) { typ = (*x)->typ->BaseTyp; - if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (*x)->typ->n))) { + if ((y->class == 7 && (y->conval->intval < 0 || y->conval->intval >= (int64)(*x)->typ->n))) { OPB_err(81); } } else if ((*x)->typ->comp == 3) { @@ -355,7 +355,7 @@ void OPB_Field (OPT_Node *x, OPT_Object y) if ((*x)->class >= 7) { OPB_err(77); } - if ((y != NIL && __IN(y->mode, 0x2010, 64))) { + if ((y != NIL && __IN(y->mode, 0x2010, 32))) { OPB_BindNodes(2, y->typ, &*x, NIL); (*x)->obj = y; (*x)->readonly = (*x)->left->readonly || (y->vis == 2 && y->mnolev < 0); @@ -448,7 +448,7 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard) void OPB_In (OPT_Node *x, OPT_Node y) { - int32 f; + int16 f; int64 k; f = (*x)->typ->form; if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) { @@ -459,7 +459,7 @@ void OPB_In (OPT_Node *x, OPT_Node y) if (k < 0 || k > (int64)OPM_MaxSet) { OPB_err(202); } else if (y->class == 7) { - (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 64)); + (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval, 32)); (*x)->obj = NIL; } else { OPB_BindNodes(12, OPT_booltyp, &*x, y); @@ -489,7 +489,7 @@ static int64 OPB_log (int64 x) return _o_result; } -static void OPB_CheckRealType (int32 f, int32 nr, OPT_Const x) +static void OPB_CheckRealType (int16 f, int16 nr, OPT_Const x) { LONGREAL min, max, r; if (f == 5) { @@ -529,7 +529,7 @@ static OPT_Node NewOp__29 (int8 op, OPT_Struct typ, OPT_Node z) void OPB_MOp (int8 op, OPT_Node *x) { - int32 f; + int16 f; OPT_Struct typ = NIL; OPT_Node z = NIL; struct MOp__28 _s; @@ -555,12 +555,12 @@ void OPB_MOp (int8 op, OPT_Node *x) } break; case 6: - if (!__IN(f, 0x70, 64)) { + if (!__IN(f, 0x70, 32)) { OPB_err(96); } break; case 7: - if (__IN(f, 0xf0, 64)) { + if (__IN(f, 0xf0, 32)) { if (z->class == 7) { if (f == 4) { if (z->conval->intval == (-9223372036854775807-1)) { @@ -569,7 +569,7 @@ void OPB_MOp (int8 op, OPT_Node *x) z->conval->intval = -z->conval->intval; OPB_SetIntType(z); } - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { z->conval->realval = -z->conval->realval; } else { z->conval->setval = ~z->conval->setval; @@ -583,7 +583,7 @@ void OPB_MOp (int8 op, OPT_Node *x) } break; case 21: - if (__IN(f, 0x70, 64)) { + if (__IN(f, 0x70, 32)) { if (z->class == 7) { if (f == 4) { if (z->conval->intval == (-9223372036854775807-1)) { @@ -606,7 +606,7 @@ void OPB_MOp (int8 op, OPT_Node *x) case 22: if (f == 3) { if (z->class == 7) { - z->conval->intval = __CAP((CHAR)z->conval->intval); + z->conval->intval = (int16)__CAP((CHAR)z->conval->intval); z->obj = NIL; } else { z = NewOp__29(op, typ, z); @@ -666,7 +666,7 @@ void OPB_MOp (int8 op, OPT_Node *x) static void OPB_CheckPtr (OPT_Node x, OPT_Node y) { - int32 g; + int16 g; OPT_Struct p = NIL, q = NIL, t = NIL; g = y->typ->form; if (g == 11) { @@ -730,7 +730,7 @@ void OPB_CheckParameters (OPT_Object fp, OPT_Object ap, BOOLEAN checkNames) static void OPB_CheckProc (OPT_Struct x, OPT_Object y) { - if (__IN(y->mode, 0x04c0, 64)) { + if (__IN(y->mode, 0x04c0, 32)) { if (y->mode == 6) { if (y->mnolev == 0) { y->mode = 7; @@ -750,17 +750,17 @@ static void OPB_CheckProc (OPT_Struct x, OPT_Object y) static struct ConstOp__13 { OPT_Node *x; - int32 *f; + int16 *f; OPT_Const *xval, *yval; struct ConstOp__13 *lnk; } *ConstOp__13_s; -static int32 ConstCmp__14 (void); +static int16 ConstCmp__14 (void); -static int32 ConstCmp__14 (void) +static int16 ConstCmp__14 (void) { - int32 _o_result; - int32 res; + int16 _o_result; + int16 res; switch (*ConstOp__13_s->f) { case 0: res = 9; @@ -824,9 +824,9 @@ static int32 ConstCmp__14 (void) return _o_result; } -static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) +static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y) { - int32 f, g; + int16 f, g; OPT_Const xval = NIL, yval = NIL; int64 xv, yv; BOOLEAN temp; @@ -906,7 +906,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) } break; case 9: - if (!__IN(g, 0x1800, 64)) { + if (!__IN(g, 0x1800, 32)) { OPB_err(100); } break; @@ -937,7 +937,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) } else { OPB_err(204); } - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { temp = __ABS(yval->realval) <= (LONGREAL)1; if (temp || __ABS(xval->realval) <= 1.79769296342094e+308 / (LONGREAL)__ABS(yval->realval)) { xval->realval = xval->realval * yval->realval; @@ -961,7 +961,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) xval->realval = (LONGREAL)1; } x->typ = OPT_realtyp; - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { temp = __ABS(yval->realval) >= (LONGREAL)1; if (temp || __ABS(xval->realval) <= 1.79769296342094e+308 * __ABS(yval->realval)) { xval->realval = xval->realval / yval->realval; @@ -1015,7 +1015,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) } else { OPB_err(206); } - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { temp = (yval->realval >= (LONGREAL)0 && xval->realval <= 1.79769296342094e+308 - yval->realval); if (temp || (yval->realval < (LONGREAL)0 && xval->realval >= -1.79769296342094e+308 - yval->realval)) { xval->realval = xval->realval + yval->realval; @@ -1037,7 +1037,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) } else { OPB_err(207); } - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { temp = (yval->realval >= (LONGREAL)0 && xval->realval >= -1.79769296342094e+308 + yval->realval); if (temp || (yval->realval < (LONGREAL)0 && xval->realval <= 1.79769296342094e+308 + yval->realval)) { xval->realval = xval->realval - yval->realval; @@ -1065,28 +1065,28 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) xval->intval = OPB_BoolToInt(ConstCmp__14() != 9); break; case 11: - if (__IN(f, 0x0a84, 64)) { + if (__IN(f, 0x0a84, 32)) { OPB_err(108); } else { xval->intval = OPB_BoolToInt(ConstCmp__14() == 11); } break; case 12: - if (__IN(f, 0x0a84, 64)) { + if (__IN(f, 0x0a84, 32)) { OPB_err(108); } else { xval->intval = OPB_BoolToInt(ConstCmp__14() != 13); } break; case 13: - if (__IN(f, 0x0a84, 64)) { + if (__IN(f, 0x0a84, 32)) { OPB_err(108); } else { xval->intval = OPB_BoolToInt(ConstCmp__14() == 13); } break; case 14: - if (__IN(f, 0x0a84, 64)) { + if (__IN(f, 0x0a84, 32)) { OPB_err(108); } else { xval->intval = OPB_BoolToInt(ConstCmp__14() != 11); @@ -1104,7 +1104,7 @@ static void OPB_ConstOp (int32 op, OPT_Node x, OPT_Node y) static void OPB_Convert (OPT_Node *x, OPT_Struct typ) { OPT_Node node = NIL; - int32 f, g; + int16 f, g; int64 k; LONGREAL r; f = (*x)->typ->form; @@ -1119,7 +1119,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) (*x)->conval->intval = 1; } } - } else if (__IN(g, 0x60, 64)) { + } else if (__IN(g, 0x60, 32)) { (*x)->conval->realval = (*x)->conval->intval; (*x)->conval->intval = -1; } else { @@ -1128,8 +1128,8 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) OPB_err(220); } } - } else if (__IN(f, 0x60, 64)) { - if (__IN(g, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { + if (__IN(g, 0x60, 32)) { OPB_CheckRealType(g, 203, (*x)->conval); } else { r = (*x)->conval->realval; @@ -1137,12 +1137,12 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) OPB_err(203); r = (LONGREAL)1; } - (*x)->conval->intval = __ENTIER(r); + (*x)->conval->intval = (int32)__ENTIER(r); OPB_SetIntType(*x); } } (*x)->obj = NIL; - } else if (((((*x)->class == 11 && (*x)->subcl == 20)) && ((*x)->left->typ->form < f || f > g))) { + } else if (((((*x)->class == 11 && (*x)->subcl == 20)) && ((int16)(*x)->left->typ->form < f || f > g))) { if ((*x)->left->typ == typ) { *x = (*x)->left; } @@ -1156,7 +1156,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ) } static struct Op__38 { - int32 *f, *g; + int16 *f, *g; struct Op__38 *lnk; } *Op__38_s; @@ -1178,8 +1178,8 @@ static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) { BOOLEAN _o_result; BOOLEAN ok, xCharArr, yCharArr; - xCharArr = (__IN((*x)->typ->comp, 0x0c, 64) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 8; - yCharArr = (__IN((*y)->typ->comp, 0x0c, 64) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 8; + xCharArr = (__IN((*x)->typ->comp, 0x0c, 32) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 8; + yCharArr = (__IN((*y)->typ->comp, 0x0c, 32) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 8; if ((((xCharArr && *Op__38_s->g == 3)) && (*y)->class == 7)) { OPB_CharToString(*y); *Op__38_s->g = 8; @@ -1208,7 +1208,7 @@ static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y) void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) { - int32 f, g; + int16 f, g; OPT_Node t = NIL, z = NIL; OPT_Struct typ = NIL; BOOLEAN do_; @@ -1238,7 +1238,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) case 4: if ((g == 4 && y->typ->size < z->typ->size)) { OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x70, 64)) { + } else if (__IN(g, 0x70, 32)) { OPB_Convert(&z, y->typ); } else { OPB_err(100); @@ -1247,23 +1247,23 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) case 5: if (g == 4) { OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x60, 64)) { + } else if (__IN(g, 0x60, 32)) { OPB_Convert(&z, y->typ); } else { OPB_err(100); } break; case 6: - if (__IN(g, 0x70, 64)) { + if (__IN(g, 0x70, 32)) { OPB_Convert(&y, z->typ); - } else if (__IN(g, 0x60, 64)) { + } else if (__IN(g, 0x60, 32)) { OPB_Convert(&y, z->typ); } else { OPB_err(100); } break; case 9: - if (!__IN(g, 0x1800, 64)) { + if (!__IN(g, 0x1800, 32)) { OPB_err(100); } break; @@ -1324,7 +1324,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) y->obj = NIL; } } - } else if (!__IN(f, 0xe1, 64)) { + } else if (!__IN(f, 0xe1, 32)) { OPB_err(105); typ = OPT_undftyp; } @@ -1340,7 +1340,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) OPB_Convert(&z, OPT_realtyp); OPB_Convert(&y, OPT_realtyp); typ = OPT_realtyp; - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { if ((y->class == 7 && y->conval->realval == (LONGREAL)0)) { OPB_err(205); } @@ -1407,7 +1407,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) } break; case 6: - if (!__IN(f, 0xf1, 64)) { + if (!__IN(f, 0xf1, 32)) { OPB_err(105); typ = OPT_undftyp; } @@ -1426,7 +1426,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) } break; case 7: - if (!__IN(f, 0xf1, 64)) { + if (!__IN(f, 0xf1, 32)) { OPB_err(106); typ = OPT_undftyp; } @@ -1450,7 +1450,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) } break; case 9: case 10: - if (__IN(f, 0x1aff, 64) || strings__41(&z, &y)) { + if (__IN(f, 0x1aff, 32) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPB_err(107); @@ -1459,7 +1459,7 @@ void OPB_Op (int8 op, OPT_Node *x, OPT_Node y) NewOp__39(op, typ, &z, y); break; case 11: case 12: case 13: case 14: - if (__IN(f, 0x79, 64) || strings__41(&z, &y)) { + if (__IN(f, 0x79, 32) || strings__41(&z, &y)) { typ = OPT_booltyp; } else { OPM_LogWLn(); @@ -1501,10 +1501,10 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y) } if (((*x)->class == 7 && y->class == 7)) { if (k <= l) { - (*x)->conval->setval = __SETRNG(k, l, 64); + (*x)->conval->setval = __SETRNG(k, l, 32); } else { OPB_err(201); - (*x)->conval->setval = __SETRNG(l, k, 64); + (*x)->conval->setval = __SETRNG(l, k, 32); } (*x)->obj = NIL; } else { @@ -1526,7 +1526,7 @@ void OPB_SetElem (OPT_Node *x) } else if ((*x)->class == 7) { k = (*x)->conval->intval; if ((0 <= k && k <= (int64)OPM_MaxSet)) { - (*x)->conval->setval = __SETOF(k,64); + (*x)->conval->setval = __SETOF(k,32); } else { OPB_err(202); } @@ -1540,9 +1540,9 @@ void OPB_SetElem (OPT_Node *x) static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) { OPT_Struct y = NIL; - int32 f, g; + int16 f, g; OPT_Struct p = NIL, q = NIL; - if (__IN(18, OPM_opt, 64)) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWLn(); OPM_LogWStr((CHAR*)"PROCEDURE CheckAssign", 22); OPM_LogWLn(); @@ -1550,7 +1550,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) y = ynode->typ; f = x->form; g = y->form; - if (__IN(18, OPM_opt, 64)) { + if (__IN(18, OPM_opt, 32)) { OPM_LogWStr((CHAR*)"y.form = ", 10); OPM_LogWNum(y->form, 0); OPM_LogWLn(); @@ -1571,7 +1571,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) case 0: case 8: break; case 1: - if (!((__IN(g, 0x1a, 64) && y->size == 1))) { + if (!((__IN(g, 0x1a, 32) && y->size == 1))) { OPB_err(113); } break; @@ -1586,12 +1586,12 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) } break; case 5: - if (!__IN(g, 0x30, 64)) { + if (!__IN(g, 0x30, 32)) { OPB_err(113); } break; case 6: - if (!__IN(g, 0x70, 64)) { + if (!__IN(g, 0x70, 32)) { OPB_err(113); } break; @@ -1639,7 +1639,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) if (ynode->conval->intval2 > x->n) { OPB_err(114); } - } else if ((__IN(y->comp, 0x0c, 64) && y->BaseTyp == OPT_chartyp)) { + } else if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { } else { OPB_err(113); } @@ -1647,7 +1647,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPB_err(113); } } else if ((x->comp == 3 && x->BaseTyp == OPT_chartyp)) { - if ((__IN(y->comp, 0x0c, 64) && y->BaseTyp == OPT_chartyp)) { + if ((__IN(y->comp, 0x0c, 32) && y->BaseTyp == OPT_chartyp)) { } else { OPB_err(113); } @@ -1674,7 +1674,7 @@ static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode) OPM_LogWLn(); break; } - if ((((((ynode->class == 7 && g < f)) && __IN(g, 0x30, 64))) && __IN(f, 0x70, 64))) { + if ((((((ynode->class == 7 && g < f)) && __IN(g, 0x30, 32))) && __IN(f, 0x70, 32))) { OPB_Convert(&ynode, x); } } @@ -1683,9 +1683,9 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo) { } -void OPB_StPar0 (OPT_Node *par0, int32 fctno) +void OPB_StPar0 (OPT_Node *par0, int16 fctno) { - int32 f; + int16 f; OPT_Struct typ = NIL; OPT_Node x = NIL; x = *par0; @@ -1712,7 +1712,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) OPB_err(76); } f = x->typ->BaseTyp->comp; - if (__IN(f, 0x1c, 64)) { + if (__IN(f, 0x1c, 32)) { if (f == 3) { typ = x->typ->BaseTyp; } @@ -1745,7 +1745,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) case 5: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (__IN(f, 0x60, 64)) { + } else if (__IN(f, 0x60, 32)) { OPB_Convert(&x, OPT_linttyp); } else { OPB_err(111); @@ -1820,7 +1820,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) case 9: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (__IN(f, 0x11, 64)) { + } else if (__IN(f, 0x11, 32)) { OPB_Convert(&x, OPT_chartyp); } else { OPB_err(111); @@ -1881,7 +1881,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) } break; case 17: - if (!__IN(x->typ->comp, 0x0c, 64)) { + if (!__IN(x->typ->comp, 0x0c, 32)) { OPB_err(131); } break; @@ -1892,7 +1892,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) } if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (((!__IN(x->typ->comp, 0x0c, 64) || x->typ->BaseTyp->form != 3) && f != 8)) { + } else if (((!__IN(x->typ->comp, 0x0c, 32) || x->typ->BaseTyp->form != 3) && f != 8)) { OPB_err(111); } break; @@ -1916,7 +1916,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) if (x->class != 8) { OPB_err(110); x = OPB_NewIntConst(1); - } else if (__IN(f, 0x18fe, 64) || __IN(x->typ->comp, 0x14, 64)) { + } else if (__IN(f, 0x18fe, 32) || __IN(x->typ->comp, 0x14, 32)) { (*OPB_typSize)(x->typ); x->typ->pvused = 1; x = OPB_NewIntConst(x->typ->size); @@ -1931,7 +1931,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) case 22: case 23: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (!__IN(f, 0x9a, 64)) { + } else if (!__IN(f, 0x9a, 32)) { OPB_err(111); } break; @@ -1940,7 +1940,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) OPB_err(126); } else if ((((x->class == 7 && f == 4)) && x->typ->size < OPT_adrtyp->size)) { OPB_Convert(&x, OPT_adrtyp); - } else if (!((__IN(x->typ->form, 0x0810, 64) && x->typ->size == (int64)OPM_AddressSize))) { + } else if (!((__IN(x->typ->form, 0x0810, 32) && x->typ->size == OPM_AddressSize))) { OPB_err(111); x->typ = OPT_adrtyp; } @@ -1957,7 +1957,7 @@ void OPB_StPar0 (OPT_Node *par0, int32 fctno) case 29: if (x->class != 8) { OPB_err(110); - } else if (__IN(f, 0x0501, 64) || x->typ->comp == 3) { + } else if (__IN(f, 0x0501, 32) || x->typ->comp == 3) { OPB_err(111); } break; @@ -2009,7 +2009,7 @@ static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) { - int32 f, L; + int16 f, L; OPT_Struct typ = NIL; OPT_Node p = NIL, t = NIL; struct StPar1__52 _s; @@ -2024,7 +2024,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p->typ = OPT_notyp; } else { if (x->typ != p->typ) { - if ((x->class == 7 && f == 4)) { + if ((f == 4 && (x->class == 7 || (p->typ->form == 4 && x->typ->size <= p->typ->size)))) { OPB_Convert(&x, p->typ); } else { OPB_err(111); @@ -2053,11 +2053,11 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) } else if (x->typ->size == 1) { L = OPM_Integer(x->conval->intval); typ = p->typ; - while ((L > 0 && __IN(typ->comp, 0x0c, 64))) { + while ((L > 0 && __IN(typ->comp, 0x0c, 32))) { typ = typ->BaseTyp; L -= 1; } - if (L != 0 || !__IN(typ->comp, 0x0c, 64)) { + if (L != 0 || !__IN(typ->comp, 0x0c, 32)) { OPB_err(132); } else { x->obj = NIL; @@ -2081,7 +2081,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) case 18: if (OPB_NotVar(x)) { OPB_err(112); - } else if ((__IN(x->typ->comp, 0x0c, 64) && x->typ->BaseTyp->form == 3)) { + } else if ((__IN(x->typ->comp, 0x0c, 32) && x->typ->BaseTyp->form == 3)) { if (x->readonly) { OPB_err(76); } @@ -2103,8 +2103,8 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(208); p->conval->intval = 1; } else if (x->conval->intval >= 0) { - if (__ABS(p->conval->intval) <= __DIV(9223372036854775807, __ASH(1, x->conval->intval))) { - p->conval->intval = p->conval->intval * __ASH(1, x->conval->intval); + if (__ABS(p->conval->intval) <= __DIV(9223372036854775807, (int64)__ASH(1, x->conval->intval))) { + p->conval->intval = p->conval->intval * (int64)__ASH(1, x->conval->intval); } else { OPB_err(208); p->conval->intval = 1; @@ -2155,7 +2155,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) case 24: case 25: case 26: case 27: if (x->class == 8 || x->class == 9) { OPB_err(126); - } else if (__IN(f, 0x18ff, 64)) { + } else if (__IN(f, 0x18ff, 32)) { if (fctno == 24 || fctno == 26) { if (OPB_NotVar(x)) { OPB_err(112); @@ -2181,7 +2181,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) p->typ = OPT_booltyp; break; case 29: - if (((x->class == 8 || x->class == 9) || __IN(f, 0x0501, 64)) || x->typ->comp == 3) { + if (((x->class == 8 || x->class == 9) || __IN(f, 0x0501, 32)) || x->typ->comp == 3) { OPB_err(126); } if ((x->class != 7 && x->typ->size < p->typ->size)) { @@ -2213,7 +2213,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) OPB_err(126); } else if ((((x->class == 7 && f == 4)) && x->typ->size < OPT_adrtyp->size)) { OPB_Convert(&x, OPT_adrtyp); - } else if (!((__IN(x->typ->form, 0x0810, 64) && x->typ->size == (int64)OPM_AddressSize))) { + } else if (!((__IN(x->typ->form, 0x0810, 32) && x->typ->size == OPM_AddressSize))) { OPB_err(111); x->typ = OPT_adrtyp; } @@ -2251,10 +2251,10 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno) StPar1__52_s = _s.lnk; } -void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n) +void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n) { OPT_Node node = NIL; - int32 f; + int16 f; OPT_Node p = NIL; p = *par0; f = x->typ->form; @@ -2296,9 +2296,9 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n) *par0 = p; } -void OPB_StFct (OPT_Node *par0, int8 fctno, int32 parno) +void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno) { - int32 dim; + int16 dim; OPT_Node x = NIL, p = NIL; p = *par0; if (fctno <= 19) { @@ -2362,17 +2362,17 @@ void OPB_StFct (OPT_Node *par0, int8 fctno, int32 parno) static void OPB_DynArrParCheck (OPT_Struct ftyp, OPT_Struct atyp, BOOLEAN fvarpar) { - int32 f; + int16 f; f = atyp->comp; ftyp = ftyp->BaseTyp; atyp = atyp->BaseTyp; if ((fvarpar && ftyp == OPT_bytetyp)) { - if (!__IN(f, 0x0c, 64) || !((__IN(atyp->form, 0x1e, 64) && atyp->size == 1))) { - if (__IN(18, OPM_opt, 64)) { + if (!__IN(f, 0x0c, 32) || !((__IN(atyp->form, 0x1e, 32) && atyp->size == 1))) { + if (__IN(18, OPM_opt, 32)) { OPB_err(-301); } } - } else if (__IN(f, 0x0c, 64)) { + } else if (__IN(f, 0x0c, 32)) { if (ftyp->comp == 3) { OPB_DynArrParCheck(ftyp, atyp, fvarpar); } else if (ftyp != atyp) { @@ -2411,7 +2411,7 @@ static void OPB_CheckReceiver (OPT_Node *x, OPT_Object fp) void OPB_PrepCall (OPT_Node *x, OPT_Object *fpar) { - if (((*x)->obj != NIL && __IN((*x)->obj->mode, 0x22c0, 64))) { + if (((*x)->obj != NIL && __IN((*x)->obj->mode, 0x22c0, 32))) { *fpar = (*x)->obj->link; if ((*x)->obj->mode == 13) { OPB_CheckReceiver(&(*x)->left, *fpar); @@ -2451,7 +2451,7 @@ void OPB_Param (OPT_Node ap, OPT_Object fp) } } else if ((fp->typ == OPT_sysptrtyp && ap->typ->form == 11)) { } else if (ap->typ != fp->typ) { - if ((fp->typ->form == 1 && ((__IN(ap->typ->form, 0x1e, 64) && ap->typ->size == 1)))) { + if ((fp->typ->form == 1 && ((__IN(ap->typ->form, 0x1e, 32) && ap->typ->size == 1)))) { } else if ((ap->typ == OPT_adrtyp && fp->typ == OPT_IntType(ap->typ->size))) { } else { OPB_err(123); @@ -2481,7 +2481,7 @@ void OPB_StaticLink (int8 dlev) scope = OPT_topScope; while (dlev > 0) { dlev -= 1; - scope->link->conval->setval |= __SETOF(3,64); + scope->link->conval->setval |= __SETOF(3,32); scope = scope->left; } } @@ -2576,7 +2576,7 @@ 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, 64) && (*x)->typ->BaseTyp == OPT_chartyp)) && __IN(y->typ->comp, 0x0c, 64))) && y->typ->BaseTyp == OPT_chartyp)) { + 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; diff --git a/bootstrap/windows-88/OPB.h b/bootstrap/windows-88/OPB.h index 6863fee8..dc0085af 100644 --- a/bootstrap/windows-88/OPB.h +++ b/bootstrap/windows-88/OPB.h @@ -37,10 +37,10 @@ import void OPB_PrepCall (OPT_Node *x, OPT_Object *fpar); import void OPB_Return (OPT_Node *x, OPT_Object proc); import void OPB_SetElem (OPT_Node *x); import void OPB_SetRange (OPT_Node *x, OPT_Node y); -import void OPB_StFct (OPT_Node *par0, int8 fctno, int32 parno); -import void OPB_StPar0 (OPT_Node *par0, int32 fctno); +import void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno); +import void OPB_StPar0 (OPT_Node *par0, int16 fctno); import void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno); -import void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n); +import void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n); import void OPB_StaticLink (int8 dlev); import void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard); import void *OPB__init(void); diff --git a/bootstrap/windows-88/OPC.c b/bootstrap/windows-88/OPC.c index ee7f4baa..99353400 100644 --- a/bootstrap/windows-88/OPC.c +++ b/bootstrap/windows-88/OPC.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -10,26 +10,26 @@ #include "OPT.h" -static int32 OPC_indentLevel; +static int16 OPC_indentLevel; static int8 OPC_hashtab[105]; static CHAR OPC_keytab[50][9]; static BOOLEAN OPC_GlbPtrs; static CHAR OPC_BodyNameExt[13]; -export void OPC_Align (int64 *adr, int64 base); +export void OPC_Align (int32 *adr, int32 base); export void OPC_Andent (OPT_Struct typ); static void OPC_AnsiParamList (OPT_Object obj, BOOLEAN showParamNames); -export int64 OPC_BaseAlignment (OPT_Struct typ); +export int32 OPC_BaseAlignment (OPT_Struct typ); export OPT_Object OPC_BaseTProc (OPT_Object obj); export void OPC_BegBlk (void); export void OPC_BegStat (void); -static void OPC_CProcDefs (OPT_Object obj, int32 vis); -export void OPC_Case (int64 caseVal, int32 form); +static void OPC_CProcDefs (OPT_Object obj, int16 vis); +export void OPC_Case (int64 caseVal, int16 form); static void OPC_CharacterLiteral (int64 c); -export void OPC_Cmp (int32 rel); +export void OPC_Cmp (int16 rel); export void OPC_CompleteIdent (OPT_Object obj); -export void OPC_Constant (OPT_Const con, int32 form); +export void OPC_Constant (OPT_Const con, int16 form); static void OPC_DeclareBase (OPT_Object dcl); static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef); static void OPC_DeclareParams (OPT_Object par, BOOLEAN macro); @@ -46,45 +46,45 @@ export void OPC_EnterBody (void); export void OPC_EnterProc (OPT_Object proc); export void OPC_ExitBody (void); export void OPC_ExitProc (OPT_Object proc, BOOLEAN eoBlock, BOOLEAN implicitRet); -static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int64 *off, int64 *n, int64 *curAlign); -static void OPC_FillGap (int64 gap, int64 off, int64 align, int64 *n, int64 *curAlign); +static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int32 *off, int32 *n, int32 *curAlign); +static void OPC_FillGap (int32 gap, int32 off, int32 align, int32 *n, int32 *curAlign); export void OPC_GenBdy (OPT_Node n); -static void OPC_GenDynTypes (OPT_Node n, int32 vis); +static void OPC_GenDynTypes (OPT_Node n, int16 vis); export void OPC_GenEnumPtrs (OPT_Object var); export void OPC_GenHdr (OPT_Node n); export void OPC_GenHdrIncludes (void); static void OPC_GenHeaderMsg (void); -export void OPC_Halt (int64 n); +export void OPC_Halt (int32 n); export void OPC_Ident (OPT_Object obj); -static void OPC_IdentList (OPT_Object obj, int32 vis); +static void OPC_IdentList (OPT_Object obj, int16 vis); static void OPC_Include (CHAR *name, LONGINT name__len); -static void OPC_IncludeImports (OPT_Object obj, int32 vis); +static void OPC_IncludeImports (OPT_Object obj, int16 vis); export void OPC_Increment (BOOLEAN decrement); -export void OPC_Indent (int32 count); +export void OPC_Indent (int16 count); export void OPC_Init (void); static void OPC_InitImports (OPT_Object obj); static void OPC_InitKeywords (void); export void OPC_InitTDesc (OPT_Struct typ); static void OPC_InitTProcs (OPT_Object typ, OPT_Object obj); -export void OPC_IntLiteral (int64 n, int64 size); +export void OPC_IntLiteral (int64 n, int32 size); export void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim); static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName); -static int32 OPC_Length (CHAR *s, LONGINT s__len); -export int64 OPC_NofPtrs (OPT_Struct typ); -static int32 OPC_PerfectHash (CHAR *s, LONGINT s__len); +static int16 OPC_Length (CHAR *s, LONGINT s__len); +export int32 OPC_NofPtrs (OPT_Struct typ); +static int16 OPC_PerfectHash (CHAR *s, LONGINT s__len); static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len); static void OPC_ProcHeader (OPT_Object proc, BOOLEAN define); static void OPC_ProcPredefs (OPT_Object obj, int8 vis); static void OPC_PutBase (OPT_Struct typ); -static void OPC_PutPtrOffsets (OPT_Struct typ, int64 adr, int64 *cnt); +static void OPC_PutPtrOffsets (OPT_Struct typ, int32 adr, int32 *cnt); static void OPC_RegCmds (OPT_Object obj); export void OPC_SetInclude (BOOLEAN exclude); -export int64 OPC_SizeAlignment (int64 size); +export int32 OPC_SizeAlignment (int32 size); static void OPC_Stars (OPT_Struct typ, BOOLEAN *openClause); -static void OPC_Str1 (CHAR *s, LONGINT s__len, int64 x); -static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int64 l); +static void OPC_Str1 (CHAR *s, LONGINT s__len, int32 x); +static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l); export void OPC_TDescDecl (OPT_Struct typ); -export void OPC_TypeDefs (OPT_Object obj, int32 vis); +export void OPC_TypeDefs (OPT_Object obj, int16 vis); export void OPC_TypeOf (OPT_Object ap); static BOOLEAN OPC_Undefined (OPT_Object obj); @@ -95,14 +95,14 @@ void OPC_Init (void) __MOVE("__init(void)", OPC_BodyNameExt, 13); } -void OPC_Indent (int32 count) +void OPC_Indent (int16 count) { OPC_indentLevel += count; } void OPC_BegStat (void) { - int32 i; + int16 i; i = OPC_indentLevel; while (i > 0) { OPM_Write(0x09); @@ -138,10 +138,10 @@ void OPC_EndBlk0 (void) OPM_Write('}'); } -static void OPC_Str1 (CHAR *s, LONGINT s__len, int64 x) +static void OPC_Str1 (CHAR *s, LONGINT s__len, int32 x) { CHAR ch; - int32 i; + int16 i; __DUP(s, s__len, CHAR); ch = s[0]; i = 0; @@ -157,10 +157,10 @@ static void OPC_Str1 (CHAR *s, LONGINT s__len, int64 x) __DEL(s); } -static int32 OPC_Length (CHAR *s, LONGINT s__len) +static int16 OPC_Length (CHAR *s, LONGINT s__len) { - int32 _o_result; - int32 i; + int16 _o_result; + int16 i; i = 0; while (s[__X(i, s__len)] != 0x00) { i += 1; @@ -169,14 +169,14 @@ static int32 OPC_Length (CHAR *s, LONGINT s__len) return _o_result; } -static int32 OPC_PerfectHash (CHAR *s, LONGINT s__len) +static int16 OPC_PerfectHash (CHAR *s, LONGINT s__len) { - int32 _o_result; - int32 i, h; + int16 _o_result; + int16 i, h; i = 0; h = 0; while ((s[__X(i, s__len)] != 0x00 && i < 5)) { - h = 3 * h + s[__X(i, s__len)]; + h = 3 * h + (int16)s[__X(i, s__len)]; i += 1; } _o_result = (int)__MOD(h, 105); @@ -185,10 +185,10 @@ static int32 OPC_PerfectHash (CHAR *s, LONGINT s__len) void OPC_Ident (OPT_Object obj) { - int32 mode, level, h; + int16 mode, level, h; mode = obj->mode; level = obj->mnolev; - if ((__IN(mode, 0x62, 64) && level > 0) || __IN(mode, 0x14, 64)) { + if ((__IN(mode, 0x62, 32) && level > 0) || __IN(mode, 0x14, 32)) { OPM_WriteStringVar((void*)obj->name, 256); h = OPC_PerfectHash((void*)obj->name, 256); if (OPC_hashtab[__X(h, 105)] >= 0) { @@ -225,10 +225,10 @@ void OPC_Ident (OPT_Object obj) static void OPC_Stars (OPT_Struct typ, BOOLEAN *openClause) { - int32 pointers; + int16 pointers; *openClause = 0; if (((typ->strobj == NIL || typ->strobj->name[0] == 0x00) && typ->comp != 4)) { - if (__IN(typ->comp, 0x0c, 64)) { + if (__IN(typ->comp, 0x0c, 32)) { OPC_Stars(typ->BaseTyp, &*openClause); *openClause = typ->comp == 2; } else if (typ->form == 12) { @@ -261,7 +261,7 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef) { OPT_Struct typ = NIL; BOOLEAN varPar, openClause; - int32 form, comp; + int16 form, comp; typ = dcl->typ; varPar = ((dcl->mode == 2 && typ->comp != 2) || typ->comp == 3) || scopeDef; OPC_Stars(typ, &openClause); @@ -285,7 +285,7 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef) break; } else if ((form == 11 && typ->BaseTyp->comp != 3)) { openClause = 1; - } else if (form == 12 || __IN(comp, 0x0c, 64)) { + } else if (form == 12 || __IN(comp, 0x0c, 32)) { if (openClause) { OPM_Write(')'); openClause = 0; @@ -319,7 +319,7 @@ void OPC_Andent (OPT_Struct typ) static BOOLEAN OPC_Undefined (OPT_Object obj) { BOOLEAN _o_result; - _o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (int64)(3 + OPM_currFile))) && obj->linkadr != 2); + _o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (3 + OPM_currFile))) && obj->linkadr != 2); return _o_result; } @@ -327,8 +327,8 @@ static void OPC_DeclareBase (OPT_Object dcl) { OPT_Struct typ = NIL, prev = NIL; OPT_Object obj = NIL; - int32 nofdims; - int64 off, n, dummy; + int16 nofdims; + int32 off, n, dummy; typ = dcl->typ; prev = typ; while ((((((((typ->strobj == NIL || typ->comp == 3) || OPC_Undefined(typ->strobj)) && typ->comp != 4)) && typ->form != 10)) && !((typ->form == 11 && typ->BaseTyp->comp == 3)))) { @@ -387,12 +387,12 @@ static void OPC_DeclareBase (OPT_Object dcl) } } -int64 OPC_NofPtrs (OPT_Struct typ) +int32 OPC_NofPtrs (OPT_Struct typ) { - int64 _o_result; + int32 _o_result; OPT_Object fld = NIL; OPT_Struct btyp = NIL; - int64 n; + int32 n; if ((typ->form == 11 && typ->sysflag == 0)) { _o_result = 1; return _o_result; @@ -430,11 +430,11 @@ int64 OPC_NofPtrs (OPT_Struct typ) __RETCHK; } -static void OPC_PutPtrOffsets (OPT_Struct typ, int64 adr, int64 *cnt) +static void OPC_PutPtrOffsets (OPT_Struct typ, int32 adr, int32 *cnt) { OPT_Object fld = NIL; OPT_Struct btyp = NIL; - int64 n, i; + int32 n, i; if ((typ->form == 11 && typ->sysflag == 0)) { OPM_WriteInt(adr); OPM_WriteString((CHAR*)", ", 3); @@ -510,7 +510,7 @@ static void OPC_PutBase (OPT_Struct typ) static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName) { OPT_Struct typ = NIL; - int32 dim; + int16 dim; if (showParamName) { OPC_Ident(par); OPM_WriteString((CHAR*)"__len", 6); @@ -608,7 +608,7 @@ OPT_Object OPC_BaseTProc (OPT_Object obj) { OPT_Object _o_result; OPT_Struct typ = NIL, base = NIL; - int64 mno; + int32 mno; typ = obj->link->typ; if (typ->form == 11) { typ = typ->BaseTyp; @@ -690,7 +690,7 @@ static void OPC_DefineType (OPT_Struct str) if (str->BaseTyp->comp != 4) { OPC_DefineType(str->BaseTyp); } - } else if (__IN(str->comp, 0x0c, 64)) { + } else if (__IN(str->comp, 0x0c, 32)) { OPC_DefineType(str->BaseTyp); } else if (str->form == 12) { if (str->BaseTyp != OPT_notyp) { @@ -733,7 +733,7 @@ static void OPC_DefineType (OPT_Struct str) static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len) { BOOLEAN _o_result; - int32 i; + int16 i; BOOLEAN r; __DUP(y, y__len, CHAR); i = 0; @@ -746,14 +746,14 @@ static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len) return _o_result; } -static void OPC_CProcDefs (OPT_Object obj, int32 vis) +static void OPC_CProcDefs (OPT_Object obj, int16 vis) { - int32 i; + int16 i; OPT_ConstExt ext = NIL; - int32 _for__9; + int16 _for__9; if (obj != NIL) { OPC_CProcDefs(obj->left, vis); - if ((((obj->mode == 9 && obj->vis >= vis)) && obj->adr == 1)) { + if ((((obj->mode == 9 && (int16)obj->vis >= vis)) && obj->adr == 1)) { ext = obj->conval->ext; i = 1; if (((*ext)[1] != '#' && !(OPC_Prefixed(ext, (CHAR*)"extern ", 8) || OPC_Prefixed(ext, (CHAR*)"import ", 8)))) { @@ -762,7 +762,7 @@ static void OPC_CProcDefs (OPT_Object obj, int32 vis) OPC_DeclareParams(obj->link, 1); OPM_Write(0x09); } - _for__9 = (*obj->conval->ext)[0]; + _for__9 = (int16)(*obj->conval->ext)[0]; i = i; while (i <= _for__9) { OPM_Write((*obj->conval->ext)[__X(i, 256)]); @@ -774,7 +774,7 @@ static void OPC_CProcDefs (OPT_Object obj, int32 vis) } } -void OPC_TypeDefs (OPT_Object obj, int32 vis) +void OPC_TypeDefs (OPT_Object obj, int16 vis) { if (obj != NIL) { OPC_TypeDefs(obj->left, vis); @@ -806,7 +806,7 @@ static void OPC_DefAnonRecs (OPT_Node n) void OPC_TDescDecl (OPT_Struct typ) { - int64 nofptrs; + int32 nofptrs; OPT_Object o = NIL; OPC_BegStat(); OPM_WriteString((CHAR*)"__TDESC(", 9); @@ -821,7 +821,7 @@ void OPC_TDescDecl (OPT_Struct typ) OPC_Str1((CHAR*)", #), {", 8, typ->size); nofptrs = 0; OPC_PutPtrOffsets(typ, 0, &nofptrs); - OPC_Str1((CHAR*)"#}}", 4, -((nofptrs + 1) * (int64)OPM_AddressSize)); + OPC_Str1((CHAR*)"#}}", 4, -((nofptrs + 1) * OPM_AddressSize)); OPC_EndStat(); } @@ -843,7 +843,7 @@ void OPC_InitTDesc (OPT_Struct typ) } } -void OPC_Align (int64 *adr, int64 base) +void OPC_Align (int32 *adr, int32 base) { switch (base) { case 2: @@ -863,11 +863,11 @@ void OPC_Align (int64 *adr, int64 base) } } -int64 OPC_SizeAlignment (int64 size) +int32 OPC_SizeAlignment (int32 size) { - int64 _o_result; - int64 alignment; - if (size < (int64)OPM_Alignment) { + int32 _o_result; + int32 alignment; + if (size < OPM_Alignment) { alignment = 1; while (alignment < size) { alignment = __ASHL(alignment, 1); @@ -879,10 +879,10 @@ int64 OPC_SizeAlignment (int64 size) return _o_result; } -int64 OPC_BaseAlignment (OPT_Struct typ) +int32 OPC_BaseAlignment (OPT_Struct typ) { - int64 _o_result; - int64 alignment; + int32 _o_result; + int32 alignment; if (typ->form == 13) { if (typ->comp == 4) { alignment = __MASK(typ->align, -65536); @@ -896,9 +896,9 @@ int64 OPC_BaseAlignment (OPT_Struct typ) return _o_result; } -static void OPC_FillGap (int64 gap, int64 off, int64 align, int64 *n, int64 *curAlign) +static void OPC_FillGap (int32 gap, int32 off, int32 align, int32 *n, int32 *curAlign) { - int64 adr; + int32 adr; adr = off; OPC_Align(&adr, align); if ((*curAlign < align && gap - (adr - off) >= align)) { @@ -933,11 +933,11 @@ static void OPC_FillGap (int64 gap, int64 off, int64 align, int64 *n, int64 *cur } } -static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int64 *off, int64 *n, int64 *curAlign) +static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int32 *off, int32 *n, int32 *curAlign) { OPT_Object fld = NIL; OPT_Struct base = NIL; - int64 gap, adr, align, fldAlign; + int32 gap, adr, align, fldAlign; fld = typ->link; align = __MASK(typ->align, -65536); if (typ->BaseTyp != NIL) { @@ -981,7 +981,7 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int64 *off, int64 *n, i } } if (last) { - adr = typ->size - (int64)__ASHR(typ->sysflag, 8); + adr = typ->size - __ASHR(typ->sysflag, 8); if (adr == 0) { gap = 1; } else { @@ -993,16 +993,16 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int64 *off, int64 *n, i } } -static void OPC_IdentList (OPT_Object obj, int32 vis) +static void OPC_IdentList (OPT_Object obj, int16 vis) { OPT_Struct base = NIL; BOOLEAN first; - int32 lastvis; + int16 lastvis; base = NIL; first = 1; while ((obj != NIL && obj->mode != 13)) { - if ((__IN(vis, 0x05, 64) || (vis == 1 && obj->vis != 0)) || (vis == 3 && !obj->leaf)) { - if (obj->typ != base || obj->vis != lastvis) { + if ((__IN(vis, 0x05, 32) || (vis == 1 && obj->vis != 0)) || (vis == 3 && !obj->leaf)) { + if (obj->typ != base || (int16)obj->vis != lastvis) { if (!first) { OPC_EndStat(); } @@ -1045,7 +1045,7 @@ static void OPC_IdentList (OPT_Object obj, int32 vis) OPC_Ident(obj); OPM_WriteString((CHAR*)"__typ", 6); base = NIL; - } else if ((((((__IN(5, OPM_opt, 64) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { + } else if ((((((__IN(5, OPM_opt, 32) && vis == 0)) && obj->mnolev > 0)) && obj->typ->form == 11)) { OPM_WriteString((CHAR*)" = NIL", 7); } } @@ -1115,7 +1115,7 @@ static void OPC_ProcPredefs (OPT_Object obj, int8 vis) { if (obj != NIL) { OPC_ProcPredefs(obj->left, vis); - if ((((__IN(obj->mode, 0xc0, 64) && obj->vis >= vis)) && (obj->history != 4 || obj->mode == 6))) { + if ((((__IN(obj->mode, 0xc0, 32) && obj->vis >= vis)) && (obj->history != 4 || obj->mode == 6))) { if (vis == 1) { OPM_WriteString((CHAR*)"import ", 8); } else if (obj->vis == 0) { @@ -1141,18 +1141,18 @@ static void OPC_Include (CHAR *name, LONGINT name__len) __DEL(name); } -static void OPC_IncludeImports (OPT_Object obj, int32 vis) +static void OPC_IncludeImports (OPT_Object obj, int16 vis) { if (obj != NIL) { OPC_IncludeImports(obj->left, vis); - if ((((obj->mode == 11 && obj->mnolev != 0)) && OPT_GlbMod[__X(-obj->mnolev, 64)]->vis >= vis)) { + if ((((obj->mode == 11 && obj->mnolev != 0)) && (int16)OPT_GlbMod[__X(-obj->mnolev, 64)]->vis >= vis)) { OPC_Include(OPT_GlbMod[__X(-obj->mnolev, 64)]->name, 256); } OPC_IncludeImports(obj->right, vis); } } -static void OPC_GenDynTypes (OPT_Node n, int32 vis) +static void OPC_GenDynTypes (OPT_Node n, int16 vis) { OPT_Struct typ = NIL; while ((n != NIL && n->class == 14)) { @@ -1201,15 +1201,15 @@ void OPC_GenHdr (OPT_Node n) static void OPC_GenHeaderMsg (void) { - int32 i; + int16 i; OPM_WriteString((CHAR*)"/* ", 4); OPM_WriteString((CHAR*)"voc", 4); OPM_Write(' '); OPM_WriteString(Configuration_versionLong, 41); OPM_Write(' '); i = 0; - while (i <= 63) { - if (__IN(i, OPM_glbopt, 64)) { + while (i <= 31) { + if (__IN(i, OPM_glbopt, 32)) { switch (i) { case 0: OPM_Write('x'); @@ -1352,7 +1352,7 @@ static void OPC_InitImports (OPT_Object obj) void OPC_GenEnumPtrs (OPT_Object var) { OPT_Struct typ = NIL; - int64 n; + int32 n; OPC_GlbPtrs = 0; while (var != NIL) { typ = var->typ; @@ -1411,7 +1411,7 @@ void OPC_EnterBody (void) { OPM_WriteLn(); OPM_WriteString((CHAR*)"export ", 8); - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"int main(int argc, char **argv)", 32); OPM_WriteLn(); } else { @@ -1422,20 +1422,20 @@ void OPC_EnterBody (void) } OPC_BegBlk(); OPC_BegStat(); - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__INIT(argc, argv)", 19); } else { OPM_WriteString((CHAR*)"__DEFMOD", 9); } OPC_EndStat(); - if ((__IN(10, OPM_opt, 64) && 0)) { + if ((__IN(10, OPM_opt, 32) && 0)) { OPC_BegStat(); OPM_WriteString((CHAR*)"/*don`t do it!*/ printf(\"DEMO VERSION: DO NOT USE THIS PROGRAM FOR ANY COMMERCIAL PURPOSE\\n\")", 94); OPC_EndStat(); } OPC_InitImports(OPT_topScope->right); OPC_BegStat(); - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__REGMAIN(\"", 12); } else { OPM_WriteString((CHAR*)"__REGMOD(\"", 11); @@ -1455,7 +1455,7 @@ void OPC_EnterBody (void) void OPC_ExitBody (void) { OPC_BegStat(); - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI;", 8); } else { OPM_WriteString((CHAR*)"__ENDMOD;", 10); @@ -1497,7 +1497,7 @@ void OPC_EnterProc (OPT_Object proc) { OPT_Object var = NIL, scope = NIL; OPT_Struct typ = NIL; - int32 dim; + int16 dim; if (proc->vis != 1) { OPM_WriteString((CHAR*)"static ", 8); } @@ -1537,7 +1537,7 @@ void OPC_EnterProc (OPT_Object proc) } var = proc->link; while (var != NIL) { - if ((((__IN(var->typ->comp, 0x0c, 64) && var->mode == 1)) && var->typ->sysflag == 0)) { + if ((((__IN(var->typ->comp, 0x0c, 32) && var->mode == 1)) && var->typ->sysflag == 0)) { OPC_BegStat(); if (var->typ->comp == 2) { OPM_WriteString((CHAR*)"__DUPARR(", 10); @@ -1585,7 +1585,7 @@ void OPC_EnterProc (OPT_Object proc) OPM_Write('.'); OPC_Ident(var); OPM_WriteString((CHAR*)" = ", 4); - if (__IN(var->typ->comp, 0x0c, 64)) { + if (__IN(var->typ->comp, 0x0c, 32)) { OPM_WriteString((CHAR*)"(void*)", 8); } else if (var->mode != 2) { OPM_Write('&'); @@ -1711,7 +1711,7 @@ void OPC_ExitProc (OPT_Object proc, BOOLEAN eoBlock, BOOLEAN implicitRet) void OPC_CompleteIdent (OPT_Object obj) { - int32 comp, level; + int16 comp, level; level = obj->mnolev; if (obj->adr == 1) { if (obj->typ->comp == 4) { @@ -1740,10 +1740,10 @@ void OPC_CompleteIdent (OPT_Object obj) void OPC_TypeOf (OPT_Object ap) { - int32 i; + int16 i; __ASSERT(ap->typ->comp == 4, 0); if (ap->mode == 2) { - if (ap->mnolev != OPM_level) { + if ((int16)ap->mnolev != OPM_level) { OPM_WriteStringVar((void*)ap->scope->name, 256); OPM_WriteString((CHAR*)"_s->", 5); OPC_Ident(ap); @@ -1759,7 +1759,7 @@ void OPC_TypeOf (OPT_Object ap) } } -void OPC_Cmp (int32 rel) +void OPC_Cmp (int16 rel) { switch (rel) { case 9: @@ -1803,15 +1803,15 @@ static void OPC_CharacterLiteral (int64 c) } } -static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int64 l) +static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l) { - int64 i; - int32 c; + int32 i; + int16 c; __DUP(s, s__len, CHAR); OPM_Write('"'); i = 0; while (i < l) { - c = s[__X(i, s__len)]; + c = (int16)s[__X(i, s__len)]; if (c < 32 || c > 126) { OPM_Write('\\'); OPM_Write((CHAR)(48 + __ASHR(c, 6))); @@ -1831,7 +1831,7 @@ static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int64 l) __DEL(s); } -void OPC_Case (int64 caseVal, int32 form) +void OPC_Case (int64 caseVal, int16 form) { CHAR ch; OPM_WriteString((CHAR*)"case ", 6); @@ -1869,12 +1869,12 @@ void OPC_Increment (BOOLEAN decrement) } } -void OPC_Halt (int64 n) +void OPC_Halt (int32 n) { OPC_Str1((CHAR*)"__HALT(#)", 10, n); } -void OPC_IntLiteral (int64 n, int64 size) +void OPC_IntLiteral (int64 n, int32 size) { if ((((size > 4 && n <= 2147483647)) && n > (-2147483647-1))) { OPM_WriteString((CHAR*)"((int", 6); @@ -1904,11 +1904,11 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim) } } -void OPC_Constant (OPT_Const con, int32 form) +void OPC_Constant (OPT_Const con, int16 form) { - int32 i; + int16 i; SET s; - int64 hex; + int32 hex; BOOLEAN skipLeading; switch (form) { case 1: @@ -1933,13 +1933,13 @@ void OPC_Constant (OPT_Const con, int32 form) OPM_WriteString((CHAR*)"0x", 3); skipLeading = 1; s = con->setval; - i = 64; + i = 32; do { hex = 0; do { i -= 1; hex = __ASHL(hex, 1); - if (__IN(i, s, 64)) { + if (__IN(i, s, 32)) { hex += 1; } } while (!(__MASK(i, -8) == 0)); @@ -1975,7 +1975,7 @@ static void Enter__49 (CHAR *s, LONGINT s__len); static void Enter__49 (CHAR *s, LONGINT s__len) { - int32 h; + int16 h; __DUP(s, s__len, CHAR); h = OPC_PerfectHash((void*)s, s__len); OPC_hashtab[__X(h, 105)] = *InitKeywords__48_s->n; diff --git a/bootstrap/windows-88/OPC.h b/bootstrap/windows-88/OPC.h index 6fe30a31..4215947f 100644 --- a/bootstrap/windows-88/OPC.h +++ b/bootstrap/windows-88/OPC.h @@ -9,16 +9,16 @@ -import void OPC_Align (int64 *adr, int64 base); +import void OPC_Align (int32 *adr, int32 base); import void OPC_Andent (OPT_Struct typ); -import int64 OPC_BaseAlignment (OPT_Struct typ); +import int32 OPC_BaseAlignment (OPT_Struct typ); import OPT_Object OPC_BaseTProc (OPT_Object obj); import void OPC_BegBlk (void); import void OPC_BegStat (void); -import void OPC_Case (int64 caseVal, int32 form); -import void OPC_Cmp (int32 rel); +import void OPC_Case (int64 caseVal, int16 form); +import void OPC_Cmp (int16 rel); import void OPC_CompleteIdent (OPT_Object obj); -import void OPC_Constant (OPT_Const con, int32 form); +import void OPC_Constant (OPT_Const con, int16 form); import void OPC_DefineInter (OPT_Object proc); import void OPC_EndBlk (void); import void OPC_EndBlk0 (void); @@ -31,19 +31,19 @@ import void OPC_GenBdy (OPT_Node n); import void OPC_GenEnumPtrs (OPT_Object var); import void OPC_GenHdr (OPT_Node n); import void OPC_GenHdrIncludes (void); -import void OPC_Halt (int64 n); +import void OPC_Halt (int32 n); import void OPC_Ident (OPT_Object obj); import void OPC_Increment (BOOLEAN decrement); -import void OPC_Indent (int32 count); +import void OPC_Indent (int16 count); import void OPC_Init (void); import void OPC_InitTDesc (OPT_Struct typ); -import void OPC_IntLiteral (int64 n, int64 size); +import void OPC_IntLiteral (int64 n, int32 size); import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim); -import int64 OPC_NofPtrs (OPT_Struct typ); +import int32 OPC_NofPtrs (OPT_Struct typ); import void OPC_SetInclude (BOOLEAN exclude); -import int64 OPC_SizeAlignment (int64 size); +import int32 OPC_SizeAlignment (int32 size); import void OPC_TDescDecl (OPT_Struct typ); -import void OPC_TypeDefs (OPT_Object obj, int32 vis); +import void OPC_TypeDefs (OPT_Object obj, int16 vis); import void OPC_TypeOf (OPT_Object ap); import void *OPC__init(void); diff --git a/bootstrap/windows-88/OPM.c b/bootstrap/windows-88/OPM.c index 3f07341b..366d6522 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -19,23 +19,24 @@ typedef static CHAR OPM_SourceFileName[256]; -export int32 OPM_Alignment, OPM_AddressSize, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet; +export int16 OPM_Alignment, OPM_AddressSize, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet; export int64 OPM_MaxIndex; export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; export BOOLEAN OPM_noerr; -export int64 OPM_curpos, OPM_errpos, OPM_breakpc; -export int32 OPM_currFile, OPM_level, OPM_pc, OPM_entno; +export int32 OPM_curpos, OPM_errpos, OPM_breakpc; +export int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno; export CHAR OPM_modName[32]; export CHAR OPM_objname[64]; export SET OPM_opt, OPM_glbopt; -static int64 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber, OPM_lasterrpos; +static int32 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber; +static int64 OPM_lasterrpos; static Texts_Reader OPM_inR; static Texts_Text OPM_Log; static Texts_Writer OPM_W; static Files_Rider OPM_oldSF, OPM_newSF; static Files_Rider OPM_R[3]; static Files_File OPM_oldSFile, OPM_newSFile, OPM_HFile, OPM_BFile, OPM_HIFile; -static int32 OPM_S; +static int16 OPM_S; static CHAR OPM_OBERON[1024]; static CHAR OPM_MODULES[1024]; @@ -44,25 +45,25 @@ static void OPM_Append (Files_Rider *R, address *R__typ, Files_File F); export void OPM_CloseFiles (void); export void OPM_CloseOldSym (void); export void OPM_DeleteNewSym (void); -export void OPM_FPrint (int64 *fp, int64 val); -export void OPM_FPrintLReal (int64 *fp, LONGREAL lr); -export void OPM_FPrintReal (int64 *fp, REAL real); -export void OPM_FPrintSet (int64 *fp, SET set); +export void OPM_FPrint (int32 *fp, int64 val); +export void OPM_FPrintLReal (int32 *fp, LONGREAL lr); +export void OPM_FPrintReal (int32 *fp, REAL real); +export void OPM_FPrintSet (int32 *fp, SET set); static void OPM_FindLine (Files_File f, Files_Rider *r, address *r__typ, int64 pos); export void OPM_Get (CHAR *ch); static void OPM_GetProperties (void); -static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int32 *size, int32 *align); +static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align); export void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); export void OPM_InitOptions (void); -export int32 OPM_Integer (int64 n); -static void OPM_LogErrMsg (int32 n); +export int16 OPM_Integer (int64 n); +static void OPM_LogErrMsg (int16 n); export void OPM_LogW (CHAR ch); export void OPM_LogWLn (void); export void OPM_LogWNum (int64 i, int64 len); export void OPM_LogWStr (CHAR *s, LONGINT s__len); -export int64 OPM_Longint (int64 n); +export int32 OPM_Longint (int64 n); static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len); -export void OPM_Mark (int32 n, int64 pos); +export void OPM_Mark (int16 n, int64 pos); export void OPM_NewSym (CHAR *modName, LONGINT modName__len); export void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); @@ -70,10 +71,10 @@ export BOOLEAN OPM_OpenPar (void); export void OPM_RegisterNewSym (void); static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt); static void OPM_ShowLine (int64 pos); -export int64 OPM_SignedMaximum (int64 bytecount); -export int64 OPM_SignedMinimum (int64 bytecount); +export int64 OPM_SignedMaximum (int32 bytecount); +export int64 OPM_SignedMinimum (int32 bytecount); export void OPM_SymRCh (CHAR *ch); -export int64 OPM_SymRInt (void); +export int32 OPM_SymRInt (void); export int64 OPM_SymRInt64 (void); export void OPM_SymRLReal (LONGREAL *lr); export void OPM_SymRReal (REAL *r); @@ -92,9 +93,9 @@ export void OPM_WriteReal (LONGREAL r, CHAR suffx); export void OPM_WriteString (CHAR *s, LONGINT s__len); export void OPM_WriteStringVar (CHAR *s, LONGINT s__len); export BOOLEAN OPM_eofSF (void); -export void OPM_err (int32 n); -static int64 OPM_minusop (int64 i); -static int64 OPM_power0 (int64 i, int64 j); +export void OPM_err (int16 n); +static int32 OPM_minusop (int32 i); +static int32 OPM_power0 (int32 i, int32 j); void OPM_LogW (CHAR ch) @@ -119,23 +120,23 @@ void OPM_LogWLn (void) Console_Ln(); } -int64 OPM_Longint (int64 n) -{ - int64 _o_result; - _o_result = (int64)n; - return _o_result; -} - -int32 OPM_Integer (int64 n) +int32 OPM_Longint (int64 n) { int32 _o_result; _o_result = __VAL(int32, n); return _o_result; } +int16 OPM_Integer (int64 n) +{ + int16 _o_result; + _o_result = __VAL(int16, n); + return _o_result; +} + static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) { - int32 i; + int16 i; __DUP(s, s__len, CHAR); i = 1; while (s[__X(i, s__len)] != 0x00) { @@ -219,23 +220,23 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt) OPM_LogWStr((CHAR*)"-M option requires two following digits.", 41); OPM_LogWLn(); } else { - OPM_AddressSize = s[__X(i + 1, s__len)] - 48; - OPM_Alignment = s[__X(i + 2, s__len)] - 48; + OPM_AddressSize = (int16)s[__X(i + 1, s__len)] - 48; + OPM_Alignment = (int16)s[__X(i + 2, s__len)] - 48; i += 2; } break; case 'B': if (s[__X(i + 1, s__len)] != 0x00) { i += 1; - OPM_IntegerSize = s[__X(i, s__len)] - 48; + OPM_IntegerSize = (int16)s[__X(i, s__len)] - 48; } if (s[__X(i + 1, s__len)] != 0x00) { i += 1; - OPM_AddressSize = s[__X(i, s__len)] - 48; + OPM_AddressSize = (int16)s[__X(i, s__len)] - 48; } if (s[__X(i + 1, s__len)] != 0x00) { i += 1; - OPM_Alignment = s[__X(i, s__len)] - 48; + OPM_Alignment = (int16)s[__X(i, s__len)] - 48; } __ASSERT(OPM_IntegerSize == 2 || OPM_IntegerSize == 4, 0); __ASSERT(OPM_AddressSize == 4 || OPM_AddressSize == 8, 0); @@ -385,9 +386,9 @@ void OPM_InitOptions (void) s[0] = 0x00; Platform_GetArg(OPM_S, (void*)s, 256); } - if (__IN(15, OPM_opt, 64)) { - OPM_glbopt |= __SETOF(10,64); - OPM_opt |= __SETOF(10,64); + if (__IN(15, OPM_opt, 32)) { + OPM_glbopt |= __SETOF(10,32); + OPM_opt |= __SETOF(10,32); } OPM_GetProperties(); } @@ -395,7 +396,7 @@ void OPM_InitOptions (void) void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len) { Texts_Text T = NIL; - int64 beg, end, time; + int32 beg, end, time; CHAR s[256]; *done = 0; OPM_curpos = 0; @@ -443,7 +444,7 @@ void OPM_Get (CHAR *ch) static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len) { - int32 i, j; + int16 i, j; CHAR ch; __DUP(ext, ext__len, CHAR); i = 0; @@ -465,28 +466,28 @@ static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGIN __DEL(ext); } -static void OPM_LogErrMsg (int32 n) +static void OPM_LogErrMsg (int16 n) { Texts_Scanner S; Texts_Text T = NIL; CHAR ch; - int32 i; + int16 i; CHAR buf[1024]; if (n >= 0) { - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"31m", 4); } OPM_LogWStr((CHAR*)" err ", 7); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"35m", 4); } OPM_LogWStr((CHAR*)" warning ", 11); n = -n; - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } @@ -498,18 +499,18 @@ static void OPM_LogErrMsg (int32 n) static void OPM_FindLine (Files_File f, Files_Rider *r, address *r__typ, int64 pos) { CHAR ch, cheol; - if (pos < OPM_ErrorLineStartPos) { + if (pos < (int64)OPM_ErrorLineStartPos) { OPM_ErrorLineStartPos = 0; OPM_ErrorLineLimitPos = 0; OPM_ErrorLineNumber = 0; } - if (pos < OPM_ErrorLineLimitPos) { + if (pos < (int64)OPM_ErrorLineLimitPos) { Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos); return; } Files_Set(&*r, r__typ, f, OPM_ErrorLineLimitPos); Files_Read(&*r, r__typ, (void*)&ch); - while ((OPM_ErrorLineLimitPos < pos && !(*r).eof)) { + while (((int64)OPM_ErrorLineLimitPos < pos && !(*r).eof)) { OPM_ErrorLineStartPos = OPM_ErrorLineLimitPos; OPM_ErrorLineNumber += 1; while ((((ch != 0x00 && ch != 0x0d)) && ch != 0x0a)) { @@ -532,7 +533,7 @@ static void OPM_ShowLine (int64 pos) Files_File f = NIL; Files_Rider r; CHAR line[1023]; - int32 i; + int16 i; CHAR ch; f = Files_Old(OPM_SourceFileName, 256); OPM_FindLine(f, &r, Files_Rider__typ, pos); @@ -551,25 +552,25 @@ static void OPM_ShowLine (int64 pos) OPM_LogWStr(line, 1023); OPM_LogWLn(); OPM_LogWStr((CHAR*)" ", 7); - if (pos >= OPM_ErrorLineLimitPos) { + if (pos >= (int64)OPM_ErrorLineLimitPos) { pos = OPM_ErrorLineLimitPos - 1; } - i = (int32)OPM_Longint(pos - OPM_ErrorLineStartPos); + i = (int16)OPM_Longint(pos - (int64)OPM_ErrorLineStartPos); while (i > 0) { OPM_LogW(' '); i -= 1; } - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogW('^'); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } Files_Close(f); } -void OPM_Mark (int32 n, int64 pos) +void OPM_Mark (int16 n, int64 pos) { if (pos == -1) { pos = 0; @@ -621,49 +622,51 @@ void OPM_Mark (int32 n, int64 pos) } } -void OPM_err (int32 n) +void OPM_err (int16 n) { OPM_Mark(n, OPM_errpos); } -void OPM_FPrint (int64 *fp, int64 val) +void OPM_FPrint (int32 *fp, int64 val) { - *fp = __ROTL((int64)((SET)*fp ^ (SET)val), 1, 64); + *fp = __ROTL((int32)((SET)*fp ^ __VAL(SET, val)), 1, 32); } -void OPM_FPrintSet (int64 *fp, SET set) +void OPM_FPrintSet (int32 *fp, SET set) { - OPM_FPrint(&*fp, (int64)set); + OPM_FPrint(&*fp, (int32)set); } -void OPM_FPrintReal (int64 *fp, REAL real) +void OPM_FPrintReal (int32 *fp, REAL real) { - int32 i; - int64 l; - __GET((address)&real, i, int32); - l = i; + int16 i; + int32 l; + __GET((address)&real, l, int32); OPM_FPrint(&*fp, l); } -void OPM_FPrintLReal (int64 *fp, LONGREAL lr) +void OPM_FPrintLReal (int32 *fp, LONGREAL lr) { - int64 l, h; - OPM_FPrint(&*fp, __VAL(int64, lr)); + int32 l, h; + __GET((address)&lr, l, int32); + __GET((address)&lr + 4, h, int32); + OPM_FPrint(&*fp, l); + OPM_FPrint(&*fp, h); } -static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int32 *size, int32 *align) +static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONGINT name__len, int16 *size, int16 *align) { __DUP(name, name__len, CHAR); if (((*S).class == 1 && __STRCMP((*S).s, name) == 0)) { Texts_Scan(&*S, S__typ); if ((*S).class == 3) { - *size = (int32)(*S).i; + *size = (int16)(*S).i; Texts_Scan(&*S, S__typ); } else { OPM_Mark(-157, -1); } if ((*S).class == 3) { - *align = (int32)(*S).i; + *align = (int16)(*S).i; Texts_Scan(&*S, S__typ); } else { OPM_Mark(-157, -1); @@ -674,17 +677,17 @@ static void OPM_GetProperty (Texts_Scanner *S, address *S__typ, CHAR *name, LONG __DEL(name); } -static int64 OPM_minusop (int64 i) +static int32 OPM_minusop (int32 i) { - int64 _o_result; + int32 _o_result; _o_result = -i; return _o_result; } -static int64 OPM_power0 (int64 i, int64 j) +static int32 OPM_power0 (int32 i, int32 j) { - int64 _o_result; - int64 k, p; + int32 _o_result; + int32 k, p; k = 1; p = i; do { @@ -721,7 +724,7 @@ static void OPM_VerboseListSizes (void) OPM_LogWLn(); } -int64 OPM_SignedMaximum (int64 bytecount) +int64 OPM_SignedMaximum (int32 bytecount) { int64 _o_result; int64 result; @@ -731,7 +734,7 @@ int64 OPM_SignedMaximum (int64 bytecount) return _o_result; } -int64 OPM_SignedMinimum (int64 bytecount) +int64 OPM_SignedMinimum (int32 bytecount) { int64 _o_result; _o_result = -OPM_SignedMaximum(bytecount) - 1; @@ -746,7 +749,7 @@ static void OPM_GetProperties (void) OPM_MinLReal = -OPM_MaxLReal; OPM_MaxSet = __ASHL(OPM_SetSize, 3) - 1; OPM_MaxIndex = OPM_SignedMaximum(OPM_AddressSize); - if (__IN(18, OPM_opt, 64)) { + if (__IN(18, OPM_opt, 32)) { OPM_VerboseListSizes(); } } @@ -756,10 +759,10 @@ void OPM_SymRCh (CHAR *ch) Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&*ch); } -int64 OPM_SymRInt (void) +int32 OPM_SymRInt (void) { - int64 _o_result; - int64 k; + int32 _o_result; + int32 k; Files_ReadNum(&OPM_oldSF, Files_Rider__typ, &k); _o_result = k; return _o_result; @@ -776,7 +779,7 @@ int64 OPM_SymRInt64 (void) void OPM_SymRSet (SET *s) { - Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int64*)&*s); + Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s); } void OPM_SymRReal (REAL *r) @@ -830,7 +833,7 @@ void OPM_SymWInt (int64 i) void OPM_SymWSet (SET s) { - Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int64)s); + Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int32)s); } void OPM_SymWReal (REAL r) @@ -845,7 +848,7 @@ void OPM_SymWLReal (LONGREAL lr) void OPM_RegisterNewSym (void) { - if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_opt, 64)) { + if (__STRCMP(OPM_modName, "SYSTEM") != 0 || __IN(10, OPM_opt, 32)) { Files_Register(OPM_newSFile); } } @@ -874,7 +877,7 @@ void OPM_Write (CHAR ch) void OPM_WriteString (CHAR *s, LONGINT s__len) { - int32 i; + int16 i; i = 0; while (s[__X(i, s__len)] != 0x00) { i += 1; @@ -884,7 +887,7 @@ void OPM_WriteString (CHAR *s, LONGINT s__len) void OPM_WriteStringVar (CHAR *s, LONGINT s__len) { - int32 i; + int16 i; i = 0; while (s[__X(i, s__len)] != 0x00) { i += 1; @@ -948,14 +951,14 @@ void OPM_WriteReal (LONGREAL r, CHAR suffx) Texts_Reader R; CHAR s[32]; CHAR ch; - int32 i; - if ((((r < OPM_SignedMaximum(OPM_LongintSize) && r > OPM_SignedMinimum(OPM_LongintSize))) && r == (__ENTIER(r)))) { + int16 i; + if ((((r < OPM_SignedMaximum(OPM_LongintSize) && r > OPM_SignedMinimum(OPM_LongintSize))) && r == ((int32)__ENTIER(r)))) { if (suffx == 'f') { OPM_WriteString((CHAR*)"(REAL)", 7); } else { OPM_WriteString((CHAR*)"(LONGREAL)", 11); } - OPM_WriteInt(__ENTIER(r)); + OPM_WriteInt((int32)__ENTIER(r)); } else { Texts_OpenWriter(&W, Texts_Writer__typ); if (suffx == 'f') { @@ -1036,7 +1039,7 @@ void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len) void OPM_CloseFiles (void) { CHAR FName[32]; - int32 res; + int16 res; if (OPM_noerr) { OPM_LogWStr((CHAR*)" ", 3); OPM_LogWNum(Files_Pos(&OPM_R[1], Files_Rider__typ), 0); @@ -1044,10 +1047,10 @@ void OPM_CloseFiles (void) } if (OPM_noerr) { if (__STRCMP(OPM_modName, "SYSTEM") == 0) { - if (!__IN(10, OPM_opt, 64)) { + if (!__IN(10, OPM_opt, 32)) { Files_Register(OPM_BFile); } - } else if (!__IN(10, OPM_opt, 64)) { + } else if (!__IN(10, OPM_opt, 32)) { OPM_Append(&OPM_R[2], Files_Rider__typ, OPM_HFile); Files_Register(OPM_HIFile); Files_Register(OPM_BFile); @@ -1073,12 +1076,12 @@ void OPM_CloseFiles (void) static void EnumPtrs(void (*P)(void*)) { - __ENUMR(&OPM_inR, Texts_Reader__typ, 96, 1, P); + __ENUMR(&OPM_inR, Texts_Reader__typ, 72, 1, P); P(OPM_Log); - __ENUMR(&OPM_W, Texts_Writer__typ, 72, 1, P); - __ENUMR(&OPM_oldSF, Files_Rider__typ, 40, 1, P); - __ENUMR(&OPM_newSF, Files_Rider__typ, 40, 1, P); - __ENUMR(OPM_R, Files_Rider__typ, 40, 3, P); + __ENUMR(&OPM_W, Texts_Writer__typ, 56, 1, P); + __ENUMR(&OPM_oldSF, Files_Rider__typ, 24, 1, P); + __ENUMR(&OPM_newSF, Files_Rider__typ, 24, 1, P); + __ENUMR(OPM_R, Files_Rider__typ, 24, 3, P); P(OPM_oldSFile); P(OPM_newSFile); P(OPM_HFile); @@ -1121,8 +1124,8 @@ export void *OPM__init(void) OPM_AddressSize = 8; OPM_Alignment = 8; OPM_ShortintSize = 1; - OPM_IntegerSize = 4; - OPM_LongintSize = 8; - OPM_SetSize = 8; + OPM_IntegerSize = 2; + OPM_LongintSize = 4; + OPM_SetSize = 4; __ENDMOD; } diff --git a/bootstrap/windows-88/OPM.h b/bootstrap/windows-88/OPM.h index 765b9680..a6b7990c 100644 --- a/bootstrap/windows-88/OPM.h +++ b/bootstrap/windows-88/OPM.h @@ -6,12 +6,12 @@ #include "SYSTEM.h" -import int32 OPM_Alignment, OPM_AddressSize, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet; +import int16 OPM_Alignment, OPM_AddressSize, OPM_SetSize, OPM_ShortintSize, OPM_IntegerSize, OPM_LongintSize, OPM_MaxSet; import int64 OPM_MaxIndex; import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal; import BOOLEAN OPM_noerr; -import int64 OPM_curpos, OPM_errpos, OPM_breakpc; -import int32 OPM_currFile, OPM_level, OPM_pc, OPM_entno; +import int32 OPM_curpos, OPM_errpos, OPM_breakpc; +import int16 OPM_currFile, OPM_level, OPM_pc, OPM_entno; import CHAR OPM_modName[32]; import CHAR OPM_objname[64]; import SET OPM_opt, OPM_glbopt; @@ -20,29 +20,29 @@ import SET OPM_opt, OPM_glbopt; import void OPM_CloseFiles (void); import void OPM_CloseOldSym (void); import void OPM_DeleteNewSym (void); -import void OPM_FPrint (int64 *fp, int64 val); -import void OPM_FPrintLReal (int64 *fp, LONGREAL lr); -import void OPM_FPrintReal (int64 *fp, REAL real); -import void OPM_FPrintSet (int64 *fp, SET set); +import void OPM_FPrint (int32 *fp, int64 val); +import void OPM_FPrintLReal (int32 *fp, LONGREAL lr); +import void OPM_FPrintReal (int32 *fp, REAL real); +import void OPM_FPrintSet (int32 *fp, SET set); import void OPM_Get (CHAR *ch); import void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len); import void OPM_InitOptions (void); -import int32 OPM_Integer (int64 n); +import int16 OPM_Integer (int64 n); import void OPM_LogW (CHAR ch); import void OPM_LogWLn (void); import void OPM_LogWNum (int64 i, int64 len); import void OPM_LogWStr (CHAR *s, LONGINT s__len); -import int64 OPM_Longint (int64 n); -import void OPM_Mark (int32 n, int64 pos); +import int32 OPM_Longint (int64 n); +import void OPM_Mark (int16 n, int64 pos); import void OPM_NewSym (CHAR *modName, LONGINT modName__len); import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done); import void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len); import BOOLEAN OPM_OpenPar (void); import void OPM_RegisterNewSym (void); -import int64 OPM_SignedMaximum (int64 bytecount); -import int64 OPM_SignedMinimum (int64 bytecount); +import int64 OPM_SignedMaximum (int32 bytecount); +import int64 OPM_SignedMinimum (int32 bytecount); import void OPM_SymRCh (CHAR *ch); -import int64 OPM_SymRInt (void); +import int32 OPM_SymRInt (void); import int64 OPM_SymRInt64 (void); import void OPM_SymRLReal (LONGREAL *lr); import void OPM_SymRReal (REAL *r); @@ -60,7 +60,7 @@ import void OPM_WriteReal (LONGREAL r, CHAR suffx); import void OPM_WriteString (CHAR *s, LONGINT s__len); import void OPM_WriteStringVar (CHAR *s, LONGINT s__len); import BOOLEAN OPM_eofSF (void); -import void OPM_err (int32 n); +import void OPM_err (int16 n); import void *OPM__init(void); diff --git a/bootstrap/windows-88/OPP.c b/bootstrap/windows-88/OPP.c index 9b25c35f..74f93e77 100644 --- a/bootstrap/windows-88/OPP.c +++ b/bootstrap/windows-88/OPP.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPB.h" @@ -11,7 +11,7 @@ #include "OPT.h" struct OPP__1 { - int64 low, high; + int32 low, high; }; typedef @@ -19,9 +19,9 @@ typedef static int8 OPP_sym, OPP_level; -static int32 OPP_LoopLevel; +static int16 OPP_LoopLevel; static OPT_Node OPP_TDinit, OPP_lastTDinit; -static int32 OPP_nofFwdPtr; +static int16 OPP_nofFwdPtr; static OPT_Struct OPP_FwdPtr[64]; export address *OPP__1__typ; @@ -29,10 +29,10 @@ export address *OPP__1__typ; static void OPP_ActualParameters (OPT_Node *aparlist, OPT_Object fpar); static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned); static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq); -static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP_CaseTable tab); +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP_CaseTable tab); static void OPP_CheckMark (int8 *vis); -static void OPP_CheckSym (int32 s); -static void OPP_CheckSysFlag (int32 *sysflag, int32 default_); +static void OPP_CheckSym (int16 s); +static void OPP_CheckSysFlag (int16 *sysflag, int16 default_); static void OPP_ConstExpression (OPT_Node *x); static void OPP_Element (OPT_Node *x); static void OPP_Expression (OPT_Node *x); @@ -51,19 +51,19 @@ static void OPP_StatSeq (OPT_Node *stat); static void OPP_Term (OPT_Node *x); static void OPP_Type (OPT_Struct *typ, OPT_Struct *banned); static void OPP_TypeDecl (OPT_Struct *typ, OPT_Struct *banned); -static void OPP_err (int32 n); +static void OPP_err (int16 n); static void OPP_qualident (OPT_Object *id); static void OPP_selector (OPT_Node *x); -static void OPP_err (int32 n) +static void OPP_err (int16 n) { OPM_err(n); } -static void OPP_CheckSym (int32 s) +static void OPP_CheckSym (int16 s) { - if (OPP_sym == s) { + if ((int16)OPP_sym == s) { OPS_Get(&OPP_sym); } else { OPM_err(s); @@ -94,7 +94,7 @@ static void OPP_qualident (OPT_Object *id) obj->adr = 0; } else { lev = obj->mnolev; - if ((__IN(obj->mode, 0x06, 64) && lev != OPP_level)) { + if ((__IN(obj->mode, 0x06, 32) && lev != OPP_level)) { obj->leaf = 0; if (lev > 0) { OPB_StaticLink(OPP_level - lev); @@ -131,7 +131,7 @@ static void OPP_CheckMark (int8 *vis) } } -static void OPP_CheckSysFlag (int32 *sysflag, int32 default_) +static void OPP_CheckSysFlag (int16 *sysflag, int16 default_) { OPT_Node x = NIL; int64 sf; @@ -162,7 +162,7 @@ static void OPP_RecordType (OPT_Struct *typ, OPT_Struct *banned) { OPT_Object fld = NIL, first = NIL, last = NIL, base = NIL; OPT_Struct ftyp = NIL; - int32 sysflag; + int16 sysflag; *typ = OPT_NewStr(13, 4); (*typ)->BaseTyp = NIL; OPP_CheckSysFlag(&sysflag, -1); @@ -255,7 +255,7 @@ static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned) { OPT_Node x = NIL; int64 n; - int32 sysflag; + int16 sysflag; OPP_CheckSysFlag(&sysflag, 0); if (OPP_sym == 25) { *typ = OPT_NewStr(13, 3); @@ -325,7 +325,7 @@ static void OPP_PointerType (OPT_Struct *typ) } else { OPP_qualident(&id); if (id->mode == 5) { - if (__IN(id->typ->comp, 0x1c, 64)) { + if (__IN(id->typ->comp, 0x1c, 32)) { (*typ)->BaseTyp = id->typ; } else { (*typ)->BaseTyp = OPT_undftyp; @@ -338,7 +338,7 @@ static void OPP_PointerType (OPT_Struct *typ) } } else { OPP_Type(&(*typ)->BaseTyp, &OPT_notyp); - if (!__IN((*typ)->BaseTyp->comp, 0x1c, 64)) { + if (!__IN((*typ)->BaseTyp->comp, 0x1c, 32)) { (*typ)->BaseTyp = OPT_undftyp; OPP_err(57); } @@ -629,8 +629,8 @@ static void OPP_StandProcCall (OPT_Node *x) { OPT_Node y = NIL; int8 m; - int32 n; - m = (int8)((int32)(*x)->obj->adr); + int16 n; + m = (int8)((int16)(*x)->obj->adr); n = 0; if (OPP_sym == 30) { OPS_Get(&OPP_sym); @@ -931,7 +931,7 @@ static void TProcDecl__23 (void); static void GetCode__19 (void) { OPT_ConstExt ext = NIL; - int32 n; + int16 n; int64 c; ext = OPT_NewExt(); (*ProcedureDeclaration__16_s->proc)->conval->ext = ext; @@ -966,7 +966,7 @@ static void GetCode__19 (void) } } } - (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1,64); + (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1,32); } static void GetParams__21 (void) @@ -996,9 +996,9 @@ static void GetParams__21 (void) static void Body__17 (void) { OPT_Node procdec = NIL, statseq = NIL; - int64 c; + int32 c; c = OPM_errpos; - (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1,64); + (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1,32); OPP_CheckSym(39); OPP_Block(&procdec, &statseq); OPB_Enter(&procdec, statseq, *ProcedureDeclaration__16_s->proc); @@ -1041,7 +1041,7 @@ static void TProcDecl__23 (void) if ((*ProcedureDeclaration__16_s->fwd != NIL && (*ProcedureDeclaration__16_s->fwd)->mnolev != OPP_level)) { *ProcedureDeclaration__16_s->fwd = NIL; } - if ((((*ProcedureDeclaration__16_s->fwd != NIL && (*ProcedureDeclaration__16_s->fwd)->mode == 13)) && !__IN(1, (*ProcedureDeclaration__16_s->fwd)->conval->setval, 64))) { + if ((((*ProcedureDeclaration__16_s->fwd != NIL && (*ProcedureDeclaration__16_s->fwd)->mode == 13)) && !__IN(1, (*ProcedureDeclaration__16_s->fwd)->conval->setval, 32))) { *ProcedureDeclaration__16_s->proc = OPT_NewObj(); (*ProcedureDeclaration__16_s->proc)->leaf = 1; if ((*ProcedureDeclaration__16_s->fwd)->vis != *ProcedureDeclaration__16_s->vis) { @@ -1075,7 +1075,7 @@ static void TProcDecl__23 (void) if ((((((baseProc->vis == 1 && (*ProcedureDeclaration__16_s->proc)->vis == 0)) && recTyp->strobj != NIL)) && recTyp->strobj->vis == 1)) { OPP_err(109); } - (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(2,64); + (*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(2,32); } if (!*ProcedureDeclaration__16_s->forward) { Body__17(); @@ -1118,7 +1118,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) } else { OPP_err(38); } - if ((__IN(mode, 0x0600, 64) && !OPT_SYSimported)) { + if ((__IN(mode, 0x0600, 32) && !OPT_SYSimported)) { OPP_err(135); } OPS_Get(&OPP_sym); @@ -1135,7 +1135,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) if ((fwd != NIL && (fwd->mnolev != OPP_level || fwd->mode == 8))) { fwd = NIL; } - if ((((fwd != NIL && __IN(fwd->mode, 0xc0, 64))) && !__IN(1, fwd->conval->setval, 64))) { + if ((((fwd != NIL && __IN(fwd->mode, 0xc0, 32))) && !__IN(1, fwd->conval->setval, 32))) { proc = OPT_NewObj(); proc->leaf = 1; if (fwd->vis != vis) { @@ -1168,17 +1168,17 @@ static void OPP_ProcedureDeclaration (OPT_Node *x) ProcedureDeclaration__16_s = _s.lnk; } -static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP_CaseTable tab) +static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int16 *n, OPP_CaseTable tab) { OPT_Node x = NIL, y = NIL, lastlab = NIL; - int32 i, f; - int64 xval, yval; + int16 i, f; + int32 xval, yval; *lab = NIL; lastlab = NIL; for (;;) { OPP_ConstExpression(&x); f = x->typ->form; - if (__IN(f, 0x18, 64)) { + if (__IN(f, 0x18, 32)) { xval = OPM_Longint(x->conval->intval); } else { OPP_err(61); @@ -1188,14 +1188,14 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP if (!(LabelTyp->form == 4) || LabelTyp->size < x->typ->size) { OPP_err(60); } - } else if (LabelTyp->form != f) { + } else if ((int16)LabelTyp->form != f) { OPP_err(60); } if (OPP_sym == 21) { OPS_Get(&OPP_sym); OPP_ConstExpression(&y); yval = OPM_Longint(y->conval->intval); - if ((y->typ->form != f && !((f == 4 && y->typ->form == 4)))) { + if (((int16)y->typ->form != f && !((f == 4 && y->typ->form == 4)))) { OPP_err(60); } if (yval < xval) { @@ -1239,7 +1239,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, int32 *n, OPP } static struct StatSeq__30 { - int64 *pos; + int32 *pos; struct StatSeq__30 *lnk; } *StatSeq__30_s; @@ -1249,8 +1249,8 @@ static void SetPos__35 (OPT_Node x); static void CasePart__31 (OPT_Node *x) { - int32 n; - int64 low, high; + int16 n; + int32 low, high; BOOLEAN e; OPP_CaseTable tab; OPT_Node cases = NIL, lab = NIL, y = NIL, lastcase = NIL; @@ -1258,7 +1258,7 @@ static void CasePart__31 (OPT_Node *x) *StatSeq__30_s->pos = OPM_errpos; if ((*x)->class == 8 || (*x)->class == 9) { OPP_err(126); - } else if (!__IN((*x)->typ->form, 0x18, 64)) { + } else if (!__IN((*x)->typ->form, 0x18, 32)) { OPP_err(125); } OPP_CheckSym(25); @@ -1333,7 +1333,7 @@ static void OPP_StatSeq (OPT_Node *stat) OPT_Struct idtyp = NIL; BOOLEAN e; OPT_Node s = NIL, x = NIL, y = NIL, z = NIL, apar = NIL, last = NIL, lastif = NIL; - int64 pos; + int32 pos; OPS_Name name; struct StatSeq__30 _s; _s.pos = &pos; @@ -1626,7 +1626,7 @@ static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq) OPT_Struct typ = NIL; OPT_Object obj = NIL, first = NIL, last = NIL; OPT_Node x = NIL, lastdec = NIL; - int32 i; + int16 i; first = NIL; last = NIL; OPP_nofFwdPtr = 0; @@ -1675,7 +1675,7 @@ static void OPP_Block (OPT_Node *procdec, OPT_Node *statseq) if (obj->typ->strobj == NIL) { obj->typ->strobj = obj; } - if (__IN(obj->typ->comp, 0x1c, 64)) { + if (__IN(obj->typ->comp, 0x1c, 32)) { i = 0; while (i < OPP_nofFwdPtr) { typ = OPP_FwdPtr[__X(i, 64)]; @@ -1779,7 +1779,7 @@ void OPP_Module (OPT_Node *prog, SET opt) { OPS_Name impName, aliasName; OPT_Node procdec = NIL, statseq = NIL; - int64 c; + int32 c; BOOLEAN done; OPS_Init(); OPP_LoopLevel = 0; @@ -1880,7 +1880,7 @@ static void EnumPtrs(void (*P)(void*)) __ENUMP(OPP_FwdPtr, 64, P); } -__TDESC(OPP__1, 1, 0) = {__TDFLDS("", 16), {-8}}; +__TDESC(OPP__1, 1, 0) = {__TDFLDS("", 8), {-8}}; export void *OPP__init(void) { diff --git a/bootstrap/windows-88/OPS.c b/bootstrap/windows-88/OPS.c index cd24b8ee..0cac83bd 100644 --- a/bootstrap/windows-88/OPS.c +++ b/bootstrap/windows-88/OPS.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin tspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -16,7 +16,7 @@ typedef export OPS_Name OPS_name; export OPS_String OPS_str; -export int32 OPS_numtyp; +export int16 OPS_numtyp; export int64 OPS_intval; export REAL OPS_realval; export LONGREAL OPS_lrlval; @@ -28,17 +28,17 @@ static void OPS_Identifier (int8 *sym); export void OPS_Init (void); static void OPS_Number (void); static void OPS_Str (int8 *sym); -static void OPS_err (int32 n); +static void OPS_err (int16 n); -static void OPS_err (int32 n) +static void OPS_err (int16 n) { OPM_err(n); } static void OPS_Str (int8 *sym) { - int32 i; + int16 i; CHAR och; i = 0; och = OPS_ch; @@ -64,7 +64,7 @@ static void OPS_Str (int8 *sym) if (OPS_intval == 2) { *sym = 35; OPS_numtyp = 1; - OPS_intval = OPS_str[0]; + OPS_intval = (int16)OPS_str[0]; } else { *sym = 37; } @@ -72,7 +72,7 @@ static void OPS_Str (int8 *sym) static void OPS_Identifier (int8 *sym) { - int32 i; + int16 i; i = 0; do { OPS_name[i] = OPS_ch; @@ -91,10 +91,10 @@ static struct Number__6 { struct Number__6 *lnk; } *Number__6_s; -static int32 Ord__7 (CHAR ch, BOOLEAN hex); -static LONGREAL Ten__9 (int32 e); +static int16 Ord__7 (CHAR ch, BOOLEAN hex); +static LONGREAL Ten__9 (int16 e); -static LONGREAL Ten__9 (int32 e) +static LONGREAL Ten__9 (int16 e) { LONGREAL _o_result; LONGREAL x, p; @@ -113,14 +113,14 @@ static LONGREAL Ten__9 (int32 e) return _o_result; } -static int32 Ord__7 (CHAR ch, BOOLEAN hex) +static int16 Ord__7 (CHAR ch, BOOLEAN hex) { - int32 _o_result; + int16 _o_result; if (ch <= '9') { - _o_result = ch - 48; + _o_result = (int16)ch - 48; return _o_result; } else if (hex) { - _o_result = (ch - 65) + 10; + _o_result = ((int16)ch - 65) + 10; return _o_result; } else { OPS_err(2); @@ -132,7 +132,7 @@ static int32 Ord__7 (CHAR ch, BOOLEAN hex) static void OPS_Number (void) { - int32 i, m, n, d, e; + int16 i, m, n, d, e; CHAR dig[24]; LONGREAL f; CHAR expCh; @@ -235,7 +235,7 @@ static void OPS_Number (void) do { n = Ord__7(OPS_ch, 0); OPM_Get(&OPS_ch); - if (e <= __DIV(2147483647 - n, 10)) { + if (e <= __DIV(32767 - n, 10)) { e = e * 10 + n; } else { OPS_err(203); diff --git a/bootstrap/windows-88/OPS.h b/bootstrap/windows-88/OPS.h index bcc2ae4d..caef45f4 100644 --- a/bootstrap/windows-88/OPS.h +++ b/bootstrap/windows-88/OPS.h @@ -14,7 +14,7 @@ typedef import OPS_Name OPS_name; import OPS_String OPS_str; -import int32 OPS_numtyp; +import int16 OPS_numtyp; import int64 OPS_intval; import REAL OPS_realval; import LONGREAL OPS_lrlval; diff --git a/bootstrap/windows-88/OPT.c b/bootstrap/windows-88/OPT.c index 41686385..d40808d2 100644 --- a/bootstrap/windows-88/OPT.c +++ b/bootstrap/windows-88/OPT.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPM.h" @@ -17,15 +17,16 @@ typedef typedef struct OPT_ConstDesc { OPT_ConstExt ext; - int64 intval, intval2; + int64 intval; + int32 intval2; SET setval; LONGREAL realval; } OPT_ConstDesc; typedef struct OPT_ExpCtxt { - int64 reffp; - int32 ref; + int32 reffp; + int16 ref; int8 nofm; int8 locmno[64]; } OPT_ExpCtxt; @@ -38,12 +39,12 @@ typedef typedef struct OPT_ImpCtxt { - int64 nextTag, reffp; - int32 nofr, minr, nofm; + int32 nextTag, reffp; + int16 nofr, minr, nofm; BOOLEAN self; OPT_Struct ref[255]; OPT_Object old[255]; - int64 pvfp[255]; + int32 pvfp[255]; int8 glbmno[64]; } OPT_ImpCtxt; @@ -67,20 +68,20 @@ typedef BOOLEAN leaf; int8 mode, mnolev, vis, history; BOOLEAN used, fpdone; - int64 fprint; + int32 fprint; OPT_Struct typ; OPT_Const conval; - int64 adr, linkadr; - int32 x; + int32 adr, linkadr; + int16 x; } OPT_ObjDesc; typedef struct OPT_StrDesc { int8 form, comp, mno, extlev; - int32 ref, sysflag; - int64 n, size, align, txtpos; + int16 ref, sysflag; + int32 n, size, align, txtpos; BOOLEAN allocated, pbused, pvused, fpdone, idfpdone; - int64 idfp, pbfp, pvfp; + int32 idfp, pbfp, pvfp; OPT_Struct BaseTyp; OPT_Object link, strobj; } OPT_StrDesc; @@ -97,7 +98,7 @@ export BOOLEAN OPT_SYSimported; static OPT_Object OPT_universe, OPT_syslink; static OPT_ImpCtxt OPT_impCtxt; static OPT_ExpCtxt OPT_expCtxt; -static int64 OPT_nofhdfld; +static int32 OPT_nofhdfld; static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew; export address *OPT_ConstDesc__typ; @@ -110,22 +111,22 @@ export address *OPT_ExpCtxt__typ; export void OPT_Close (void); export void OPT_CloseScope (void); static void OPT_DebugStruct (OPT_Struct btyp); -static void OPT_EnterBoolConst (OPS_Name name, int64 value); -static void OPT_EnterProc (OPS_Name name, int32 num); -static void OPT_EnterTyp (OPS_Name name, int8 form, int32 size, OPT_Struct *res); +static void OPT_EnterBoolConst (OPS_Name name, int32 value); +static void OPT_EnterProc (OPS_Name name, int16 num); +static void OPT_EnterTyp (OPS_Name name, int8 form, int16 size, OPT_Struct *res); static void OPT_EnterTypeAlias (OPS_Name name, OPT_Object *res); export void OPT_Export (BOOLEAN *ext, BOOLEAN *new); -export void OPT_FPrintErr (OPT_Object obj, int32 errcode); -static void OPT_FPrintName (int64 *fp, CHAR *name, LONGINT name__len); +export void OPT_FPrintErr (OPT_Object obj, int16 errcode); +static void OPT_FPrintName (int32 *fp, CHAR *name, LONGINT name__len); export void OPT_FPrintObj (OPT_Object obj); -static void OPT_FPrintSign (int64 *fp, OPT_Struct result, OPT_Object par); +static void OPT_FPrintSign (int32 *fp, OPT_Struct result, OPT_Object par); export void OPT_FPrintStr (OPT_Struct typ); export void OPT_Find (OPT_Object *res); export void OPT_FindField (OPS_Name name, OPT_Struct typ, OPT_Object *res); export void OPT_FindImport (OPT_Object mod, OPT_Object *res); export void OPT_IdFPrint (OPT_Struct typ); export void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); -static void OPT_InConstant (int64 f, OPT_Const conval); +static void OPT_InConstant (int32 f, OPT_Const conval); static OPT_Object OPT_InFld (void); static void OPT_InMod (int8 *mno); static void OPT_InName (CHAR *name, LONGINT name__len); @@ -133,13 +134,13 @@ static OPT_Object OPT_InObj (int8 mno); static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par); static void OPT_InStruct (OPT_Struct *typ); static OPT_Object OPT_InTProc (int8 mno); -static OPT_Struct OPT_InTyp (int64 tag); +static OPT_Struct OPT_InTyp (int32 tag); export void OPT_Init (OPS_Name name, SET opt); static void OPT_InitStruct (OPT_Struct *typ, int8 form); export void OPT_Insert (OPS_Name name, OPT_Object *obj); export void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); -export int32 OPT_IntSize (int64 n); -export OPT_Struct OPT_IntType (int64 size); +export int16 OPT_IntSize (int64 n); +export OPT_Struct OPT_IntType (int32 size); export OPT_Const OPT_NewConst (void); export OPT_ConstExt OPT_NewExt (void); export OPT_Node OPT_NewNode (int8 class); @@ -147,27 +148,27 @@ export OPT_Object OPT_NewObj (void); export OPT_Struct OPT_NewStr (int8 form, int8 comp); export void OPT_OpenScope (int8 level, OPT_Object owner); static void OPT_OutConstant (OPT_Object obj); -static void OPT_OutFlds (OPT_Object fld, int64 adr, BOOLEAN visible); -static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int64 adr); -static void OPT_OutMod (int32 mno); +static void OPT_OutFlds (OPT_Object fld, int32 adr, BOOLEAN visible); +static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int32 adr); +static void OPT_OutMod (int16 mno); static void OPT_OutName (CHAR *name, LONGINT name__len); static void OPT_OutObj (OPT_Object obj); static void OPT_OutSign (OPT_Struct result, OPT_Object par); static void OPT_OutStr (OPT_Struct typ); static void OPT_OutTProcs (OPT_Struct typ, OPT_Object obj); -export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int32 dir); -static void OPT_err (int32 n); +export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); +static void OPT_err (int16 n); -static void OPT_err (int32 n) +static void OPT_err (int16 n) { OPM_err(n); } -int32 OPT_IntSize (int64 n) +int16 OPT_IntSize (int64 n) { - int32 _o_result; - int32 bytes; + int16 _o_result; + int16 bytes; if (n < 0) { n = -(n + 1); } @@ -179,7 +180,7 @@ int32 OPT_IntSize (int64 n) return _o_result; } -OPT_Struct OPT_IntType (int64 size) +OPT_Struct OPT_IntType (int32 size) { OPT_Struct _o_result; if (size <= OPT_int8typ->size) { @@ -198,10 +199,10 @@ OPT_Struct OPT_IntType (int64 size) return _o_result; } -OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int32 dir) +OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir) { OPT_Struct _o_result; - int32 i; + int16 i; __ASSERT(x->form == 4, 0); __ASSERT(x->BaseTyp == OPT_undftyp, 0); __ASSERT(dir == 1 || dir == -1, 0); @@ -323,15 +324,15 @@ void OPT_Init (OPS_Name name, SET opt) __COPY(name, OPT_topScope->name, 256); OPT_GlbMod[0] = OPT_topScope; OPT_nofGmod = 1; - OPT_newsf = __IN(4, opt, 64); - OPT_findpc = __IN(8, opt, 64); - OPT_extsf = OPT_newsf || __IN(9, opt, 64); + OPT_newsf = __IN(4, opt, 32); + OPT_findpc = __IN(8, opt, 32); + OPT_extsf = OPT_newsf || __IN(9, opt, 32); OPT_sfpresent = 1; } void OPT_Close (void) { - int32 i; + int16 i; OPT_CloseScope(); i = 0; while (i < 64) { @@ -461,14 +462,14 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj) *obj = ob1; } -static void OPT_FPrintName (int64 *fp, CHAR *name, LONGINT name__len) +static void OPT_FPrintName (int32 *fp, CHAR *name, LONGINT name__len) { - int32 i; + int16 i; CHAR ch; i = 0; do { ch = name[__X(i, name__len)]; - OPM_FPrint(&*fp, ch); + OPM_FPrint(&*fp, (int16)ch); i += 1; } while (!(ch == 0x00)); } @@ -506,7 +507,7 @@ static void OPT_DebugStruct (OPT_Struct btyp) OPM_LogWLn(); } -static void OPT_FPrintSign (int64 *fp, OPT_Struct result, OPT_Object par) +static void OPT_FPrintSign (int32 *fp, OPT_Struct result, OPT_Object par) { OPT_IdFPrint(result); OPM_FPrint(&*fp, result->idfp); @@ -522,8 +523,8 @@ void OPT_IdFPrint (OPT_Struct typ) { OPT_Struct btyp = NIL; OPT_Object strobj = NIL; - int64 idfp; - int32 f, c; + int32 idfp; + int16 f, c; if (!typ->idfpdone) { typ->idfpdone = 1; idfp = 0; @@ -552,17 +553,17 @@ void OPT_IdFPrint (OPT_Struct typ) } static struct FPrintStr__13 { - int64 *pbfp, *pvfp; + int32 *pbfp, *pvfp; struct FPrintStr__13 *lnk; } *FPrintStr__13_s; -static void FPrintFlds__14 (OPT_Object fld, int64 adr, BOOLEAN visible); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int64 adr); +static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible); +static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr); static void FPrintTProcs__18 (OPT_Object obj); -static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int64 adr) +static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int32 adr) { - int64 i, j, n; + int32 i, j, n; OPT_Struct btyp = NIL; if (typ->comp == 4) { FPrintFlds__14(typ->link, adr, 0); @@ -592,7 +593,7 @@ static void FPrintHdFld__16 (OPT_Struct typ, OPT_Object fld, int64 adr) } } -static void FPrintFlds__14 (OPT_Object fld, int64 adr, BOOLEAN visible) +static void FPrintFlds__14 (OPT_Object fld, int32 adr, BOOLEAN visible) { while ((fld != NIL && fld->mode == 4)) { if ((fld->vis != 0 && visible)) { @@ -627,10 +628,10 @@ static void FPrintTProcs__18 (OPT_Object obj) void OPT_FPrintStr (OPT_Struct typ) { - int32 f, c; + int16 f, c; OPT_Struct btyp = NIL; OPT_Object strobj = NIL, bstrobj = NIL; - int64 pbfp, pvfp; + int32 pbfp, pvfp; struct FPrintStr__13 _s; _s.pbfp = &pbfp; _s.pvfp = &pvfp; @@ -658,7 +659,7 @@ void OPT_FPrintStr (OPT_Struct typ) pvfp = pbfp; } } else if (f == 12) { - } else if (__IN(c, 0x0c, 64)) { + } else if (__IN(c, 0x0c, 32)) { OPT_FPrintStr(btyp); OPM_FPrint(&pbfp, btyp->pvfp); pvfp = pbfp; @@ -691,8 +692,8 @@ void OPT_FPrintStr (OPT_Struct typ) void OPT_FPrintObj (OPT_Object obj) { - int64 fprint; - int32 f, m; + int32 fprint; + int16 f, m; REAL rval; OPT_ConstExt ext = NIL; if (!obj->fpdone) { @@ -729,16 +730,16 @@ void OPT_FPrintObj (OPT_Object obj) OPM_FPrint(&fprint, obj->vis); OPT_FPrintStr(obj->typ); OPM_FPrint(&fprint, obj->typ->pbfp); - } else if (__IN(obj->mode, 0x0480, 64)) { + } else if (__IN(obj->mode, 0x0480, 32)) { OPT_FPrintSign(&fprint, obj->typ, obj->link); } else if (obj->mode == 9) { OPT_FPrintSign(&fprint, obj->typ, obj->link); ext = obj->conval->ext; - m = (*ext)[0]; + m = (int16)(*ext)[0]; f = 1; OPM_FPrint(&fprint, m); while (f <= m) { - OPM_FPrint(&fprint, (*ext)[__X(f, 256)]); + OPM_FPrint(&fprint, (int16)(*ext)[__X(f, 256)]); f += 1; } } else if (obj->mode == 5) { @@ -749,9 +750,9 @@ void OPT_FPrintObj (OPT_Object obj) } } -void OPT_FPrintErr (OPT_Object obj, int32 errcode) +void OPT_FPrintErr (OPT_Object obj, int16 errcode) { - int32 i, j; + int16 i, j; CHAR ch; if (obj->mnolev != 0) { __COPY(OPT_GlbMod[__X(-obj->mnolev, 64)]->name, OPM_objname, 64); @@ -841,7 +842,7 @@ void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old) static void OPT_InName (CHAR *name, LONGINT name__len) { - int32 i; + int16 i; CHAR ch; i = 0; do { @@ -855,7 +856,7 @@ static void OPT_InMod (int8 *mno) { OPT_Object head = NIL; OPS_Name name; - int64 mn; + int32 mn; int8 i; mn = OPM_SymRInt(); if (mn == 0) { @@ -893,16 +894,16 @@ static void OPT_InMod (int8 *mno) } } -static void OPT_InConstant (int64 f, OPT_Const conval) +static void OPT_InConstant (int32 f, OPT_Const conval) { CHAR ch; - int32 i; + int16 i; OPT_ConstExt ext = NIL; REAL rval; switch (f) { case 1: case 3: case 2: OPM_SymRCh(&ch); - conval->intval = ch; + conval->intval = (int16)ch; break; case 4: conval->intval = OPM_SymRInt(); @@ -945,7 +946,7 @@ static void OPT_InConstant (int64 f, OPT_Const conval) static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par) { OPT_Object last = NIL, new = NIL; - int64 tag; + int32 tag; OPT_InStruct(&*res); tag = OPM_SymRInt(); last = NIL; @@ -973,7 +974,7 @@ static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par) static OPT_Object OPT_InFld (void) { OPT_Object _o_result; - int64 tag; + int32 tag; OPT_Object obj = NIL; tag = OPT_impCtxt.nextTag; obj = OPT_NewObj(); @@ -1005,7 +1006,7 @@ static OPT_Object OPT_InFld (void) static OPT_Object OPT_InTProc (int8 mno) { OPT_Object _o_result; - int64 tag; + int32 tag; OPT_Object obj = NIL; tag = OPT_impCtxt.nextTag; obj = OPT_NewObj(); @@ -1030,7 +1031,7 @@ static OPT_Object OPT_InTProc (int8 mno) return _o_result; } -static OPT_Struct OPT_InTyp (int64 tag) +static OPT_Struct OPT_InTyp (int32 tag) { OPT_Struct _o_result; if (tag == 4) { @@ -1046,8 +1047,8 @@ static OPT_Struct OPT_InTyp (int64 tag) static void OPT_InStruct (OPT_Struct *typ) { int8 mno; - int32 ref; - int64 tag; + int16 ref; + int32 tag; OPS_Name name; OPT_Struct t = NIL; OPT_Object obj = NIL, last = NIL, fld = NIL, old = NIL, dummy = NIL; @@ -1103,7 +1104,7 @@ static void OPT_InStruct (OPT_Struct *typ) obj->vis = 0; tag = OPM_SymRInt(); if (tag == 35) { - (*typ)->sysflag = (int32)OPM_SymRInt(); + (*typ)->sysflag = (int16)OPM_SymRInt(); tag = OPM_SymRInt(); } switch (tag) { @@ -1228,11 +1229,11 @@ static void OPT_InStruct (OPT_Struct *typ) static OPT_Object OPT_InObj (int8 mno) { OPT_Object _o_result; - int32 i, s; + int16 i, s; CHAR ch; OPT_Object obj = NIL, old = NIL; OPT_Struct typ = NIL; - int64 tag; + int32 tag; OPT_ConstExt ext = NIL; tag = OPT_impCtxt.nextTag; if (tag == 19) { @@ -1265,7 +1266,7 @@ static OPT_Object OPT_InObj (int8 mno) obj->mode = 9; ext = OPT_NewExt(); obj->conval->ext = ext; - s = (int32)OPM_SymRInt(); + s = (int16)OPM_SymRInt(); (*ext)[0] = (CHAR)s; i = 1; while (i <= s) { @@ -1374,7 +1375,7 @@ void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done) static void OPT_OutName (CHAR *name, LONGINT name__len) { - int32 i; + int16 i; CHAR ch; i = 0; do { @@ -1384,7 +1385,7 @@ static void OPT_OutName (CHAR *name, LONGINT name__len) } while (!(ch == 0x00)); } -static void OPT_OutMod (int32 mno) +static void OPT_OutMod (int16 mno) { if (OPT_expCtxt.locmno[__X(mno, 64)] < 0) { OPM_SymWInt(16); @@ -1396,9 +1397,9 @@ static void OPT_OutMod (int32 mno) } } -static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int64 adr) +static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int32 adr) { - int64 i, j, n; + int32 i, j, n; OPT_Struct btyp = NIL; if (typ->comp == 4) { OPT_OutFlds(typ->link, adr, 0); @@ -1428,7 +1429,7 @@ static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int64 adr) } } -static void OPT_OutFlds (OPT_Object fld, int64 adr, BOOLEAN visible) +static void OPT_OutFlds (OPT_Object fld, int32 adr, BOOLEAN visible) { while ((fld != NIL && fld->mode == 4)) { if ((fld->vis != 0 && visible)) { @@ -1583,7 +1584,7 @@ static void OPT_OutStr (OPT_Struct typ) static void OPT_OutConstant (OPT_Object obj) { - int32 f; + int16 f; REAL rval; f = obj->typ->form; OPM_SymWInt(f); @@ -1618,11 +1619,11 @@ static void OPT_OutConstant (OPT_Object obj) static void OPT_OutObj (OPT_Object obj) { - int32 i, j; + int16 i, j; OPT_ConstExt ext = NIL; if (obj != NIL) { OPT_OutObj(obj->left); - if (__IN(obj->mode, 0x06ea, 64)) { + if (__IN(obj->mode, 0x06ea, 32)) { if (obj->history == 4) { OPT_FPrintErr(obj, 250); } else if (obj->vis != 0) { @@ -1685,7 +1686,7 @@ static void OPT_OutObj (OPT_Object obj) OPM_SymWInt(33); OPT_OutSign(obj->typ, obj->link); ext = obj->conval->ext; - j = (*ext)[0]; + j = (int16)(*ext)[0]; i = 1; OPM_SymWInt(j); while (i <= j) { @@ -1708,7 +1709,7 @@ static void OPT_OutObj (OPT_Object obj) void OPT_Export (BOOLEAN *ext, BOOLEAN *new) { - int32 i; + int16 i; int8 nofmod; BOOLEAN done; OPT_symExtended = 0; @@ -1732,7 +1733,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new) } OPT_OutObj(OPT_topScope->right); *ext = (OPT_sfpresent && OPT_symExtended); - *new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 64); + *new = (!OPT_sfpresent || OPT_symNew) || __IN(17, OPM_opt, 32); if ((((OPM_noerr && OPT_sfpresent)) && OPT_impCtxt.reffp != OPT_expCtxt.reffp)) { *new = 1; if (!OPT_extsf) { @@ -1762,7 +1763,7 @@ static void OPT_InitStruct (OPT_Struct *typ, int8 form) (*typ)->idfpdone = 1; } -static void OPT_EnterBoolConst (OPS_Name name, int64 value) +static void OPT_EnterBoolConst (OPS_Name name, int32 value) { OPT_Object obj = NIL; OPS_Name name__copy; @@ -1774,7 +1775,7 @@ static void OPT_EnterBoolConst (OPS_Name name, int64 value) obj->conval->intval = value; } -static void OPT_EnterTyp (OPS_Name name, int8 form, int32 size, OPT_Struct *res) +static void OPT_EnterTyp (OPS_Name name, int8 form, int16 size, OPT_Struct *res) { OPT_Object obj = NIL; OPT_Struct typ = NIL; @@ -1809,7 +1810,7 @@ static void OPT_EnterTypeAlias (OPS_Name name, OPT_Object *res) *res = obj; } -static void OPT_EnterProc (OPS_Name name, int32 num) +static void OPT_EnterProc (OPS_Name name, int16 num) { OPT_Object obj = NIL; OPS_Name name__copy; @@ -1849,46 +1850,46 @@ static void EnumPtrs(void (*P)(void*)) __ENUMP(OPT_GlbMod, 64, P); P(OPT_universe); P(OPT_syslink); - __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 6216, 1, P); + __ENUMR(&OPT_impCtxt, OPT_ImpCtxt__typ, 5184, 1, P); } -__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 40), {0, -16}}; -__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 344), {0, 8, 16, 24, 304, 312, -56}}; -__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 104), {80, 88, 96, -32}}; +__TDESC(OPT_ConstDesc, 1, 1) = {__TDFLDS("ConstDesc", 32), {0, -16}}; +__TDESC(OPT_ObjDesc, 1, 6) = {__TDFLDS("ObjDesc", 336), {0, 8, 16, 24, 304, 312, -56}}; +__TDESC(OPT_StrDesc, 1, 3) = {__TDFLDS("StrDesc", 72), {48, 56, 64, -32}}; __TDESC(OPT_NodeDesc, 1, 6) = {__TDFLDS("NodeDesc", 56), {0, 8, 16, 32, 40, 48, -56}}; -__TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 6216), {32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, - 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, - 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, 400, 408, - 416, 424, 432, 440, 448, 456, 464, 472, 480, 488, 496, 504, 512, 520, 528, 536, - 544, 552, 560, 568, 576, 584, 592, 600, 608, 616, 624, 632, 640, 648, 656, 664, - 672, 680, 688, 696, 704, 712, 720, 728, 736, 744, 752, 760, 768, 776, 784, 792, - 800, 808, 816, 824, 832, 840, 848, 856, 864, 872, 880, 888, 896, 904, 912, 920, - 928, 936, 944, 952, 960, 968, 976, 984, 992, 1000, 1008, 1016, 1024, 1032, 1040, 1048, - 1056, 1064, 1072, 1080, 1088, 1096, 1104, 1112, 1120, 1128, 1136, 1144, 1152, 1160, 1168, 1176, - 1184, 1192, 1200, 1208, 1216, 1224, 1232, 1240, 1248, 1256, 1264, 1272, 1280, 1288, 1296, 1304, - 1312, 1320, 1328, 1336, 1344, 1352, 1360, 1368, 1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, - 1440, 1448, 1456, 1464, 1472, 1480, 1488, 1496, 1504, 1512, 1520, 1528, 1536, 1544, 1552, 1560, - 1568, 1576, 1584, 1592, 1600, 1608, 1616, 1624, 1632, 1640, 1648, 1656, 1664, 1672, 1680, 1688, - 1696, 1704, 1712, 1720, 1728, 1736, 1744, 1752, 1760, 1768, 1776, 1784, 1792, 1800, 1808, 1816, - 1824, 1832, 1840, 1848, 1856, 1864, 1872, 1880, 1888, 1896, 1904, 1912, 1920, 1928, 1936, 1944, - 1952, 1960, 1968, 1976, 1984, 1992, 2000, 2008, 2016, 2024, 2032, 2040, 2048, 2056, 2064, 2072, - 2080, 2088, 2096, 2104, 2112, 2120, 2128, 2136, 2144, 2152, 2160, 2168, 2176, 2184, 2192, 2200, - 2208, 2216, 2224, 2232, 2240, 2248, 2256, 2264, 2272, 2280, 2288, 2296, 2304, 2312, 2320, 2328, - 2336, 2344, 2352, 2360, 2368, 2376, 2384, 2392, 2400, 2408, 2416, 2424, 2432, 2440, 2448, 2456, - 2464, 2472, 2480, 2488, 2496, 2504, 2512, 2520, 2528, 2536, 2544, 2552, 2560, 2568, 2576, 2584, - 2592, 2600, 2608, 2616, 2624, 2632, 2640, 2648, 2656, 2664, 2672, 2680, 2688, 2696, 2704, 2712, - 2720, 2728, 2736, 2744, 2752, 2760, 2768, 2776, 2784, 2792, 2800, 2808, 2816, 2824, 2832, 2840, - 2848, 2856, 2864, 2872, 2880, 2888, 2896, 2904, 2912, 2920, 2928, 2936, 2944, 2952, 2960, 2968, - 2976, 2984, 2992, 3000, 3008, 3016, 3024, 3032, 3040, 3048, 3056, 3064, 3072, 3080, 3088, 3096, - 3104, 3112, 3120, 3128, 3136, 3144, 3152, 3160, 3168, 3176, 3184, 3192, 3200, 3208, 3216, 3224, - 3232, 3240, 3248, 3256, 3264, 3272, 3280, 3288, 3296, 3304, 3312, 3320, 3328, 3336, 3344, 3352, - 3360, 3368, 3376, 3384, 3392, 3400, 3408, 3416, 3424, 3432, 3440, 3448, 3456, 3464, 3472, 3480, - 3488, 3496, 3504, 3512, 3520, 3528, 3536, 3544, 3552, 3560, 3568, 3576, 3584, 3592, 3600, 3608, - 3616, 3624, 3632, 3640, 3648, 3656, 3664, 3672, 3680, 3688, 3696, 3704, 3712, 3720, 3728, 3736, - 3744, 3752, 3760, 3768, 3776, 3784, 3792, 3800, 3808, 3816, 3824, 3832, 3840, 3848, 3856, 3864, - 3872, 3880, 3888, 3896, 3904, 3912, 3920, 3928, 3936, 3944, 3952, 3960, 3968, 3976, 3984, 3992, - 4000, 4008, 4016, 4024, 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088, 4096, 4104, -4088}}; -__TDESC(OPT_ExpCtxt, 1, 0) = {__TDFLDS("ExpCtxt", 80), {-8}}; +__TDESC(OPT_ImpCtxt, 1, 510) = {__TDFLDS("ImpCtxt", 5184), {16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, + 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, + 272, 280, 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, + 400, 408, 416, 424, 432, 440, 448, 456, 464, 472, 480, 488, 496, 504, 512, 520, + 528, 536, 544, 552, 560, 568, 576, 584, 592, 600, 608, 616, 624, 632, 640, 648, + 656, 664, 672, 680, 688, 696, 704, 712, 720, 728, 736, 744, 752, 760, 768, 776, + 784, 792, 800, 808, 816, 824, 832, 840, 848, 856, 864, 872, 880, 888, 896, 904, + 912, 920, 928, 936, 944, 952, 960, 968, 976, 984, 992, 1000, 1008, 1016, 1024, 1032, + 1040, 1048, 1056, 1064, 1072, 1080, 1088, 1096, 1104, 1112, 1120, 1128, 1136, 1144, 1152, 1160, + 1168, 1176, 1184, 1192, 1200, 1208, 1216, 1224, 1232, 1240, 1248, 1256, 1264, 1272, 1280, 1288, + 1296, 1304, 1312, 1320, 1328, 1336, 1344, 1352, 1360, 1368, 1376, 1384, 1392, 1400, 1408, 1416, + 1424, 1432, 1440, 1448, 1456, 1464, 1472, 1480, 1488, 1496, 1504, 1512, 1520, 1528, 1536, 1544, + 1552, 1560, 1568, 1576, 1584, 1592, 1600, 1608, 1616, 1624, 1632, 1640, 1648, 1656, 1664, 1672, + 1680, 1688, 1696, 1704, 1712, 1720, 1728, 1736, 1744, 1752, 1760, 1768, 1776, 1784, 1792, 1800, + 1808, 1816, 1824, 1832, 1840, 1848, 1856, 1864, 1872, 1880, 1888, 1896, 1904, 1912, 1920, 1928, + 1936, 1944, 1952, 1960, 1968, 1976, 1984, 1992, 2000, 2008, 2016, 2024, 2032, 2040, 2048, 2056, + 2064, 2072, 2080, 2088, 2096, 2104, 2112, 2120, 2128, 2136, 2144, 2152, 2160, 2168, 2176, 2184, + 2192, 2200, 2208, 2216, 2224, 2232, 2240, 2248, 2256, 2264, 2272, 2280, 2288, 2296, 2304, 2312, + 2320, 2328, 2336, 2344, 2352, 2360, 2368, 2376, 2384, 2392, 2400, 2408, 2416, 2424, 2432, 2440, + 2448, 2456, 2464, 2472, 2480, 2488, 2496, 2504, 2512, 2520, 2528, 2536, 2544, 2552, 2560, 2568, + 2576, 2584, 2592, 2600, 2608, 2616, 2624, 2632, 2640, 2648, 2656, 2664, 2672, 2680, 2688, 2696, + 2704, 2712, 2720, 2728, 2736, 2744, 2752, 2760, 2768, 2776, 2784, 2792, 2800, 2808, 2816, 2824, + 2832, 2840, 2848, 2856, 2864, 2872, 2880, 2888, 2896, 2904, 2912, 2920, 2928, 2936, 2944, 2952, + 2960, 2968, 2976, 2984, 2992, 3000, 3008, 3016, 3024, 3032, 3040, 3048, 3056, 3064, 3072, 3080, + 3088, 3096, 3104, 3112, 3120, 3128, 3136, 3144, 3152, 3160, 3168, 3176, 3184, 3192, 3200, 3208, + 3216, 3224, 3232, 3240, 3248, 3256, 3264, 3272, 3280, 3288, 3296, 3304, 3312, 3320, 3328, 3336, + 3344, 3352, 3360, 3368, 3376, 3384, 3392, 3400, 3408, 3416, 3424, 3432, 3440, 3448, 3456, 3464, + 3472, 3480, 3488, 3496, 3504, 3512, 3520, 3528, 3536, 3544, 3552, 3560, 3568, 3576, 3584, 3592, + 3600, 3608, 3616, 3624, 3632, 3640, 3648, 3656, 3664, 3672, 3680, 3688, 3696, 3704, 3712, 3720, + 3728, 3736, 3744, 3752, 3760, 3768, 3776, 3784, 3792, 3800, 3808, 3816, 3824, 3832, 3840, 3848, + 3856, 3864, 3872, 3880, 3888, 3896, 3904, 3912, 3920, 3928, 3936, 3944, 3952, 3960, 3968, 3976, + 3984, 3992, 4000, 4008, 4016, 4024, 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088, -4088}}; +__TDESC(OPT_ExpCtxt, 1, 0) = {__TDFLDS("ExpCtxt", 72), {-8}}; export void *OPT__init(void) { diff --git a/bootstrap/windows-88/OPT.h b/bootstrap/windows-88/OPT.h index 697eb2c9..0bd1f189 100644 --- a/bootstrap/windows-88/OPT.h +++ b/bootstrap/windows-88/OPT.h @@ -15,7 +15,8 @@ typedef typedef struct OPT_ConstDesc { OPT_ConstExt ext; - int64 intval, intval2; + int64 intval; + int32 intval2; SET setval; LONGREAL realval; } OPT_ConstDesc; @@ -46,20 +47,20 @@ typedef BOOLEAN leaf; int8 mode, mnolev, vis, history; BOOLEAN used, fpdone; - int64 fprint; + int32 fprint; OPT_Struct typ; OPT_Const conval; - int64 adr, linkadr; - int32 x; + int32 adr, linkadr; + int16 x; } OPT_ObjDesc; typedef struct OPT_StrDesc { int8 form, comp, mno, extlev; - int32 ref, sysflag; - int64 n, size, align, txtpos; + int16 ref, sysflag; + int32 n, size, align, txtpos; BOOLEAN allocated, pbused, pvused; - char _prvt0[24]; + char _prvt0[16]; OPT_Struct BaseTyp; OPT_Object link, strobj; } OPT_StrDesc; @@ -82,7 +83,7 @@ import address *OPT_NodeDesc__typ; import void OPT_Close (void); import void OPT_CloseScope (void); import void OPT_Export (BOOLEAN *ext, BOOLEAN *new); -import void OPT_FPrintErr (OPT_Object obj, int32 errcode); +import void OPT_FPrintErr (OPT_Object obj, int16 errcode); import void OPT_FPrintObj (OPT_Object obj); import void OPT_FPrintStr (OPT_Struct typ); import void OPT_Find (OPT_Object *res); @@ -93,15 +94,15 @@ import void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done); import void OPT_Init (OPS_Name name, SET opt); import void OPT_Insert (OPS_Name name, OPT_Object *obj); import void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old); -import int32 OPT_IntSize (int64 n); -import OPT_Struct OPT_IntType (int64 size); +import int16 OPT_IntSize (int64 n); +import OPT_Struct OPT_IntType (int32 size); import OPT_Const OPT_NewConst (void); import OPT_ConstExt OPT_NewExt (void); import OPT_Node OPT_NewNode (int8 class); import OPT_Object OPT_NewObj (void); import OPT_Struct OPT_NewStr (int8 form, int8 comp); import void OPT_OpenScope (int8 level, OPT_Object owner); -import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int32 dir); +import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir); import void *OPT__init(void); diff --git a/bootstrap/windows-88/OPV.c b/bootstrap/windows-88/OPV.c index b57b2868..8ef2c450 100644 --- a/bootstrap/windows-88/OPV.c +++ b/bootstrap/windows-88/OPV.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "OPC.h" @@ -12,51 +12,51 @@ typedef struct OPV_ExitInfo { - int32 level, label; + int16 level, label; } OPV_ExitInfo; -static int32 OPV_stamp; -static int64 OPV_recno; +static int16 OPV_stamp; +static int32 OPV_recno; static OPV_ExitInfo OPV_exit; -static int32 OPV_nofExitLabels; +static int16 OPV_nofExitLabels; export address *OPV_ExitInfo__typ; static void OPV_ActualPar (OPT_Node n, OPT_Object fp); export void OPV_AdrAndSize (OPT_Object topScope); static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc); -static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int32 prec); +static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec); static void OPV_DefineTDescs (OPT_Node n); -static void OPV_Entier (OPT_Node n, int32 prec); +static void OPV_Entier (OPT_Node n, int16 prec); static void OPV_GetTProcNum (OPT_Object obj); static void OPV_IfStat (OPT_Node n, BOOLEAN withtrap, OPT_Object outerProc); static BOOLEAN OPV_ImplicitReturn (OPT_Node n); -static void OPV_Index (OPT_Node n, OPT_Node d, int32 prec, int32 dim); +static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim); export void OPV_Init (void); static void OPV_InitTDescs (OPT_Node n); static void OPV_Len (OPT_Node n, int64 dim); export void OPV_Module (OPT_Node prog); static void OPV_NewArr (OPT_Node d, OPT_Node x); -static void OPV_ParIntLiteral (int64 n, int64 size); -static int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp); +static void OPV_ParIntLiteral (int64 n, int32 size); +static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp); static BOOLEAN OPV_SideEffects (OPT_Node n); -static void OPV_SizeCast (int64 from, int64 to); +static void OPV_SizeCast (int32 from, int32 to); static void OPV_Stamp (OPS_Name s); static OPT_Object OPV_SuperProc (OPT_Node n); static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported); static void OPV_TraverseRecord (OPT_Struct typ); export void OPV_TypSize (OPT_Struct typ); static void OPV_TypeOf (OPT_Node n); -static void OPV_design (OPT_Node n, int32 prec); -static void OPV_expr (OPT_Node n, int32 prec); +static void OPV_design (OPT_Node n, int16 prec); +static void OPV_expr (OPT_Node n, int16 prec); static void OPV_stat (OPT_Node n, OPT_Object outerProc); void OPV_TypSize (OPT_Struct typ) { - int32 f, c; - int64 offset, size, base, fbase, off0; + int16 f, c; + int32 offset, size, base, fbase, off0; OPT_Object fld = NIL; OPT_Struct btyp = NIL; if (typ == OPT_undftyp) { @@ -71,7 +71,7 @@ void OPV_TypSize (OPT_Struct typ) base = 1; } else { OPV_TypSize(btyp); - offset = btyp->size - (int64)__ASHR(btyp->sysflag, 8); + offset = btyp->size - __ASHR(btyp->sysflag, 8); base = btyp->align; } fld = typ->link; @@ -99,7 +99,7 @@ void OPV_TypSize (OPT_Struct typ) } typ->size = offset; typ->align = base; - typ->sysflag = __MASK(typ->sysflag, -256) + (int32)__ASHL(offset - off0, 8); + typ->sysflag = __MASK(typ->sysflag, -256) + (int16)__ASHL(offset - off0, 8); } else if (c == 2) { OPV_TypSize(typ->BaseTyp); typ->size = typ->n * typ->BaseTyp->size; @@ -133,7 +133,7 @@ void OPV_Init (void) static void OPV_GetTProcNum (OPT_Object obj) { - int64 oldPos; + int32 oldPos; OPT_Struct typ = NIL; OPT_Object redef = NIL; oldPos = OPM_errpos; @@ -145,7 +145,7 @@ static void OPV_GetTProcNum (OPT_Object obj) OPT_FindField(obj->name, typ->BaseTyp, &redef); if (redef != NIL) { obj->adr = __ASHL(__ASHR(redef->adr, 16), 16); - if (!__IN(2, obj->conval->setval, 64)) { + if (!__IN(2, obj->conval->setval, 32)) { OPM_err(119); } } else { @@ -169,7 +169,7 @@ static void OPV_TraverseRecord (OPT_Struct typ) static void OPV_Stamp (OPS_Name s) { - int32 i, j, k; + int16 i, j, k; CHAR n[10]; OPV_stamp += 1; i = 0; @@ -199,7 +199,7 @@ static void OPV_Stamp (OPS_Name s) static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported) { - int32 mode; + int16 mode; OPT_Object scope = NIL; OPT_Struct typ = NIL; if (obj != NIL) { @@ -225,12 +225,12 @@ static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exporte OPV_TypSize(obj->typ); } if (!exported) { - if ((__IN(mode, 0x60, 64) && obj->mnolev > 0)) { + if ((__IN(mode, 0x60, 32) && obj->mnolev > 0)) { OPV_Stamp(obj->name); } - if (__IN(mode, 0x26, 64)) { + if (__IN(mode, 0x26, 32)) { obj->scope = outerScope; - } else if (__IN(mode, 0x26c0, 64)) { + } else if (__IN(mode, 0x26c0, 32)) { if (obj->conval->setval == 0x0) { OPM_err(129); } @@ -275,9 +275,9 @@ void OPV_AdrAndSize (OPT_Object topScope) OPT_sysptrtyp->strobj->linkadr = 2; } -static int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp) +static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp) { - int32 _o_result; + int16 _o_result; switch (class) { case 7: case 0: case 2: case 4: case 9: case 13: @@ -285,7 +285,7 @@ static int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp return _o_result; break; case 5: - if (__IN(3, OPM_opt, 64)) { + if (__IN(3, OPM_opt, 32)) { _o_result = 10; return _o_result; } else { @@ -294,7 +294,7 @@ static int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp } break; case 1: - if (__IN(comp, 0x0c, 64)) { + if (__IN(comp, 0x0c, 32)) { _o_result = 10; return _o_result; } else { @@ -439,9 +439,9 @@ static BOOLEAN OPV_SideEffects (OPT_Node n) __RETCHK; } -static void OPV_Entier (OPT_Node n, int32 prec) +static void OPV_Entier (OPT_Node n, int16 prec) { - if (__IN(n->typ->form, 0x60, 64)) { + if (__IN(n->typ->form, 0x60, 32)) { OPM_WriteString((CHAR*)"__ENTIER(", 10); OPV_expr(n, -1); OPM_Write(')'); @@ -450,7 +450,7 @@ static void OPV_Entier (OPT_Node n, int32 prec) } } -static void OPV_SizeCast (int64 from, int64 to) +static void OPV_SizeCast (int32 from, int32 to) { if ((from != to && (from > 4 || to != 4))) { OPM_WriteString((CHAR*)"(int", 5); @@ -459,9 +459,9 @@ static void OPV_SizeCast (int64 from, int64 to) } } -static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int32 prec) +static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec) { - int32 from, to; + int16 from, to; from = n->typ->form; to = newtype->form; if (to == 7) { @@ -471,7 +471,7 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int32 prec) OPM_WriteInt(__ASHL(newtype->size, 3)); OPM_Write(')'); } else if (to == 4) { - if ((newtype->size < n->typ->size && __IN(2, OPM_opt, 64))) { + if ((newtype->size < n->typ->size && __IN(2, OPM_opt, 32))) { OPM_WriteString((CHAR*)"__SHORT", 8); if (OPV_SideEffects(n)) { OPM_Write('F'); @@ -486,7 +486,7 @@ static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int32 prec) OPV_Entier(n, 9); } } else if (to == 3) { - if (__IN(2, OPM_opt, 64)) { + if (__IN(2, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__CHR", 6); if (OPV_SideEffects(n)) { OPM_Write('F'); @@ -509,7 +509,7 @@ static void OPV_TypeOf (OPT_Node n) OPM_WriteString((CHAR*)"__TYPEOF(", 10); OPV_expr(n, -1); OPM_Write(')'); - } else if (__IN(n->class, 0x15, 64)) { + } else if (__IN(n->class, 0x15, 32)) { OPC_Andent(n->typ); OPM_WriteString((CHAR*)"__typ", 6); } else if (n->class == 3) { @@ -525,9 +525,9 @@ static void OPV_TypeOf (OPT_Node n) } } -static void OPV_Index (OPT_Node n, OPT_Node d, int32 prec, int32 dim) +static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim) { - if (!__IN(0, OPM_opt, 64) || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) { + if (!__IN(0, OPM_opt, 32) || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) { OPV_expr(n->right, prec); } else { if (OPV_SideEffects(n->right)) { @@ -542,18 +542,18 @@ static void OPV_Index (OPT_Node n, OPT_Node d, int32 prec, int32 dim) } } -static void OPV_design (OPT_Node n, int32 prec) +static void OPV_design (OPT_Node n, int16 prec) { OPT_Object obj = NIL; OPT_Struct typ = NIL; - int32 class, designPrec, comp; + int16 class, designPrec, comp; OPT_Node d = NIL, x = NIL; - int32 dims, i, _for__27; + int16 dims, i, _for__27; comp = n->typ->comp; obj = n->obj; class = n->class; designPrec = OPV_Precedence(class, n->subcl, n->typ->form, comp); - if ((((((class == 0 && obj->mnolev > 0)) && obj->mnolev != OPM_level)) && prec == 10)) { + if ((((((class == 0 && obj->mnolev > 0)) && (int16)obj->mnolev != OPM_level)) && prec == 10)) { designPrec = 9; } if (prec > designPrec) { @@ -570,7 +570,7 @@ static void OPV_design (OPT_Node n, int32 prec) OPC_CompleteIdent(n->obj); break; case 1: - if (!__IN(comp, 0x0c, 64)) { + if (!__IN(comp, 0x0c, 32)) { OPM_Write('*'); } OPC_CompleteIdent(n->obj); @@ -632,7 +632,7 @@ static void OPV_design (OPT_Node n, int32 prec) } if (n->typ->comp == 3) { OPM_Write(')'); - while ((int64)i < __ASHR(d->typ->size - 4, 2)) { + while (i < __ASHR(d->typ->size - 4, 2)) { OPM_WriteString((CHAR*)" * ", 4); OPV_Len(d, i); i += 1; @@ -649,10 +649,10 @@ static void OPV_design (OPT_Node n, int32 prec) case 5: typ = n->typ; obj = n->left->obj; - if (__IN(3, OPM_opt, 64)) { + if (__IN(3, OPM_opt, 32)) { if (typ->comp == 4) { OPM_WriteString((CHAR*)"__GUARDR(", 10); - if (obj->mnolev != OPM_level) { + if ((int16)obj->mnolev != OPM_level) { OPM_WriteStringVar((void*)obj->scope->name, 256); OPM_WriteString((CHAR*)"__curr->", 9); OPC_Ident(obj); @@ -688,7 +688,7 @@ static void OPV_design (OPT_Node n, int32 prec) } break; case 6: - if (__IN(3, OPM_opt, 64)) { + if (__IN(3, OPM_opt, 32)) { if (n->left->class == 1) { OPM_WriteString((CHAR*)"__GUARDEQR(", 12); OPC_CompleteIdent(n->left->obj); @@ -721,7 +721,7 @@ static void OPV_design (OPT_Node n, int32 prec) } } -static void OPV_ParIntLiteral (int64 n, int64 size) +static void OPV_ParIntLiteral (int64 n, int32 size) { OPM_WriteInt(n); } @@ -729,7 +729,7 @@ static void OPV_ParIntLiteral (int64 n, int64 size) static void OPV_ActualPar (OPT_Node n, OPT_Object fp) { OPT_Struct typ = NIL, aptyp = NIL; - int32 comp, form, mode, prec, dim; + int16 comp, form, mode, prec, dim; OPM_Write('('); while (n != NIL) { typ = fp->typ; @@ -743,7 +743,7 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp) OPM_WriteString((CHAR*)"*)", 3); prec = 10; } - if (!__IN(n->typ->comp, 0x0c, 64)) { + if (!__IN(n->typ->comp, 0x0c, 32)) { if (mode == 2) { if (typ != n->typ) { OPM_WriteString((CHAR*)"(void*)", 8); @@ -751,7 +751,7 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp) OPM_Write('&'); prec = 9; } else { - if ((__IN(comp, 0x0c, 64) && n->class == 7)) { + if ((__IN(comp, 0x0c, 32) && n->class == 7)) { OPM_WriteString((CHAR*)"(CHAR*)", 8); } else if ((((form == 11 && typ != n->typ)) && n->typ != OPT_niltyp)) { OPM_WriteString((CHAR*)"(void*)", 8); @@ -821,9 +821,9 @@ static OPT_Object OPV_SuperProc (OPT_Node n) return _o_result; } -static void OPV_expr (OPT_Node n, int32 prec) +static void OPV_expr (OPT_Node n, int16 prec) { - int32 class, subclass, form, exprPrec; + int16 class, subclass, form, exprPrec; OPT_Struct typ = NIL; OPT_Node l = NIL, r = NIL; OPT_Object proc = NIL; @@ -833,7 +833,7 @@ static void OPV_expr (OPT_Node n, int32 prec) l = n->left; r = n->right; exprPrec = OPV_Precedence(class, subclass, form, n->typ->comp); - if ((exprPrec <= prec && __IN(class, 0x3ce0, 64))) { + if ((exprPrec <= prec && __IN(class, 0x3ce0, 32))) { OPM_Write('('); } switch (class) { @@ -913,18 +913,18 @@ static void OPV_expr (OPT_Node n, int32 prec) if (l->class == 1) { OPC_CompleteIdent(l->obj); } else { - if ((l->typ->form != 8 && !__IN(l->typ->comp, 0x0c, 64))) { + if ((l->typ->form != 8 && !__IN(l->typ->comp, 0x0c, 32))) { OPM_Write('&'); } OPV_expr(l, exprPrec); } break; case 29: - if (!__IN(l->class, 0x17, 64) || (((__IN(n->typ->form, 0x1890, 64) && __IN(l->typ->form, 0x1890, 64))) && n->typ->size == l->typ->size)) { + if (!__IN(l->class, 0x17, 32) || (((__IN(n->typ->form, 0x1890, 32) && __IN(l->typ->form, 0x1890, 32))) && n->typ->size == l->typ->size)) { OPM_Write('('); OPC_Ident(n->typ->strobj); OPM_Write(')'); - if (__IN(n->typ->form, 0x1800, 64) || __IN(l->typ->form, 0x1800, 64)) { + if (__IN(n->typ->form, 0x1800, 32) || __IN(l->typ->form, 0x1800, 32)) { OPM_WriteString((CHAR*)"(address)", 10); } OPV_expr(l, exprPrec); @@ -1021,12 +1021,12 @@ static void OPV_expr (OPT_Node n, int32 prec) } OPV_expr(l, -1); OPM_WriteString((CHAR*)", ", 3); - if ((((__IN(subclass, 0x18020000, 64) && r->class == 7)) && r->conval->intval < 0)) { + if ((((__IN(subclass, 0x18020000, 32) && r->class == 7)) && r->conval->intval < 0)) { OPM_WriteInt(-r->conval->intval); } else { OPV_expr(r, -1); } - if (__IN(subclass, 0x18008000, 64)) { + if (__IN(subclass, 0x18008000, 32)) { OPM_WriteString((CHAR*)", ", 3); if (subclass == 15) { OPM_WriteInt(__ASHL(r->typ->size, 3)); @@ -1038,7 +1038,7 @@ static void OPV_expr (OPT_Node n, int32 prec) break; case 9: case 10: case 11: case 12: case 13: case 14: - if (__IN(l->typ->form, 0x2100, 64)) { + if (__IN(l->typ->form, 0x2100, 32)) { OPM_WriteString((CHAR*)"__STRCMP(", 10); OPV_expr(l, -1); OPM_WriteString((CHAR*)", ", 3); @@ -1135,7 +1135,7 @@ static void OPV_expr (OPT_Node n, int32 prec) OPV_design(n, prec); break; } - if ((exprPrec <= prec && __IN(class, 0x3ca0, 64))) { + if ((exprPrec <= prec && __IN(class, 0x3ca0, 32))) { OPM_Write(')'); } } @@ -1145,7 +1145,7 @@ static void OPV_IfStat (OPT_Node n, BOOLEAN withtrap, OPT_Object outerProc) OPT_Node if_ = NIL; OPT_Object obj = NIL; OPT_Struct typ = NIL; - int64 adr; + int32 adr; if_ = n->left; while (if_ != NIL) { OPM_WriteString((CHAR*)"if ", 4); @@ -1196,7 +1196,7 @@ static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc) { OPT_Node switchCase = NIL, label = NIL; int64 low, high; - int32 form, i; + int16 form, i; OPM_WriteString((CHAR*)"switch ", 8); OPV_expr(n->left, 12); OPM_Write(' '); @@ -1263,7 +1263,7 @@ static BOOLEAN OPV_ImplicitReturn (OPT_Node n) static void OPV_NewArr (OPT_Node d, OPT_Node x) { OPT_Struct typ = NIL, base = NIL; - int32 nofdim, nofdyn; + int16 nofdim, nofdyn; typ = d->typ->BaseTyp; base = typ; nofdim = 0; @@ -1425,7 +1425,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) OPM_WriteString((CHAR*)", ", 3); OPC_Andent(n->left->typ->BaseTyp); OPM_WriteString((CHAR*)")", 2); - } else if (__IN(n->left->typ->BaseTyp->comp, 0x0c, 64)) { + } else if (__IN(n->left->typ->BaseTyp->comp, 0x0c, 32)) { OPV_NewArr(n->left, n->right); } break; @@ -1516,7 +1516,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) case 20: if (n->subcl != 32) { OPV_IfStat(n, 0, outerProc); - } else if (__IN(7, OPM_opt, 64)) { + } else if (__IN(7, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__ASSERT(", 10); OPV_expr(n->left->left->left, -1); OPM_WriteString((CHAR*)", ", 3); @@ -1582,7 +1582,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) break; case 26: if (OPM_level == 0) { - if (__IN(10, OPM_opt, 64)) { + if (__IN(10, OPM_opt, 32)) { OPM_WriteString((CHAR*)"__FINI", 7); } else { OPM_WriteString((CHAR*)"__ENDMOD", 9); @@ -1618,7 +1618,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) OPM_LogWLn(); break; } - if (!__IN(n->class, 0x09744000, 64)) { + if (!__IN(n->class, 0x09744000, 32)) { OPC_EndStat(); } n = n->link; @@ -1627,7 +1627,7 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc) void OPV_Module (OPT_Node prog) { - if (!__IN(10, OPM_opt, 64)) { + if (!__IN(10, OPM_opt, 32)) { OPC_GenHdr(prog->right); OPC_GenHdrIncludes(); } @@ -1635,7 +1635,7 @@ void OPV_Module (OPT_Node prog) OPV_stat(prog, NIL); } -__TDESC(OPV_ExitInfo, 1, 0) = {__TDFLDS("ExitInfo", 8), {-8}}; +__TDESC(OPV_ExitInfo, 1, 0) = {__TDFLDS("ExitInfo", 4), {-8}}; export void *OPV__init(void) { diff --git a/bootstrap/windows-88/Platform.c b/bootstrap/windows-88/Platform.c index 363a0045..59f9cfeb 100644 --- a/bootstrap/windows-88/Platform.c +++ b/bootstrap/windows-88/Platform.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -13,91 +13,91 @@ typedef Platform_ArgPtr (*Platform_ArgVec)[1024]; typedef - int64 (*Platform_ArgVecPtr)[1]; + address (*Platform_ArgVecPtr)[1]; typedef CHAR (*Platform_EnvPtr)[1024]; typedef struct Platform_FileIdentity { - int64 volume, indexhigh, indexlow, mtimehigh, mtimelow; + int32 volume, indexhigh, indexlow, mtimehigh, mtimelow; } Platform_FileIdentity; typedef - void (*Platform_HaltProcedure)(int64); + void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int32); + void (*Platform_SignalHandler)(int16); export BOOLEAN Platform_LittleEndian; export address Platform_MainStackFrame; -export int64 Platform_HaltCode; -export int32 Platform_PID; +export int32 Platform_HaltCode; +export int16 Platform_PID; export CHAR Platform_CWD[4096]; -export int32 Platform_ArgCount; +export int16 Platform_ArgCount; export address Platform_ArgVector; static Platform_HaltProcedure Platform_HaltHandler; -static int64 Platform_TimeStart; -export int32 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; -export int64 Platform_StdIn, Platform_StdOut, Platform_StdErr; +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 (int32 e); -export int32 Platform_ArgPos (CHAR *s, LONGINT s__len); -export void Platform_AssertFail (int64 code); -export int32 Platform_Chdir (CHAR *n, LONGINT n__len); -export int32 Platform_Close (int64 h); -export BOOLEAN Platform_ConnectionFailed (int32 e); -export void Platform_Delay (int64 ms); -export BOOLEAN Platform_DifferentFilesystems (int32 e); -static void Platform_DisplayHaltCode (int64 code); -export int32 Platform_Error (void); -export void Platform_Exit (int32 code); -export void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len); -export void Platform_GetClock (int64 *t, int64 *d); +export BOOLEAN Platform_Absent (int16 e); +export int16 Platform_ArgPos (CHAR *s, LONGINT s__len); +export void Platform_AssertFail (int32 code); +export int16 Platform_Chdir (CHAR *n, LONGINT n__len); +export int16 Platform_Close (int32 h); +export BOOLEAN Platform_ConnectionFailed (int16 e); +export void Platform_Delay (int32 ms); +export BOOLEAN Platform_DifferentFilesystems (int16 e); +static void Platform_DisplayHaltCode (int32 code); +export int16 Platform_Error (void); +export void Platform_Exit (int16 code); +export void Platform_GetArg (int16 n, CHAR *val, LONGINT val__len); +export void Platform_GetClock (int32 *t, int32 *d); export void Platform_GetEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); -export void Platform_GetIntArg (int32 n, int64 *val); -export void Platform_GetTimeOfDay (int64 *sec, int64 *usec); -export void Platform_Halt (int64 code); -export int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, address *identity__typ); -export int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); -export BOOLEAN Platform_Inaccessible (int32 e); -export void Platform_Init (int32 argc, address argvadr); -export void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d); -export int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h); -export BOOLEAN Platform_NoSuchDirectory (int32 e); +export void Platform_GetIntArg (int16 n, int32 *val); +export void Platform_GetTimeOfDay (int32 *sec, int32 *usec); +export void Platform_Halt (int32 code); +export int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); +export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); +export BOOLEAN Platform_Inaccessible (int16 e); +export void Platform_Init (int16 argc, address argvadr); +export void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); +export int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); +export BOOLEAN Platform_NoSuchDirectory (int16 e); export address Platform_OSAllocate (address size); export void Platform_OSFree (address address); -export int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h); -export int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h); -export int32 Platform_Read (int64 h, address p, address l, address *n); -export int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, address *n); -export int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); +export int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h); +export int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h); +export int16 Platform_Read (int32 h, address p, int32 l, int32 *n); +export int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n); +export int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); export BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); export BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); -export int32 Platform_Seek (int64 h, int64 o, int32 r); +export int16 Platform_Seek (int32 h, int32 o, int16 r); export void Platform_SetBadInstructionHandler (Platform_SignalHandler handler); export void Platform_SetHalt (Platform_HaltProcedure p); export void Platform_SetMTime (Platform_FileIdentity *target, address *target__typ, Platform_FileIdentity source); -export int32 Platform_Size (int64 h, int64 *l); -export int32 Platform_Sync (int64 h); -export int32 Platform_System (CHAR *cmd, LONGINT cmd__len); +export int16 Platform_Size (int32 h, int32 *l); +export int16 Platform_Sync (int32 h); +export int16 Platform_System (CHAR *cmd, LONGINT cmd__len); static void Platform_TestLittleEndian (void); -export int64 Platform_Time (void); -export BOOLEAN Platform_TimedOut (int32 e); -export BOOLEAN Platform_TooManyFiles (int32 e); -export int32 Platform_Truncate (int64 h, int64 limit); -export int32 Platform_Unlink (CHAR *n, LONGINT n__len); -export int32 Platform_Write (int64 h, int64 p, int64 l); -static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 se, int64 *t, int64 *d); +export int32 Platform_Time (void); +export BOOLEAN Platform_TimedOut (int16 e); +export BOOLEAN Platform_TooManyFiles (int16 e); +export int16 Platform_Truncate (int32 h, int32 limit); +export int16 Platform_Unlink (CHAR *n, LONGINT n__len); +export int16 Platform_Write (int32 h, address p, int32 l); +static void Platform_YMDHMStoClock (int16 ye, int16 mo, int16 da, int16 ho, int16 mi, int16 se, int32 *t, int32 *d); static void Platform_errch (CHAR c); -static void Platform_errint (int64 l); +static void Platform_errint (int32 l); static void Platform_errln (void); -static void Platform_errposint (int64 l); +static void Platform_errposint (int32 l); export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); #include "WindowsWrapper.h" @@ -181,49 +181,49 @@ extern void Heap_InitHeap(); #define Platform_waitForProcess() (INTEGER)WaitForSingleObject(pi.hProcess, INFINITE) #define Platform_writefile(fd, p, l) (INTEGER)WriteFile((HANDLE)fd, (void*)(p), (DWORD)l, 0,0) -BOOLEAN Platform_TooManyFiles (int32 e) +BOOLEAN Platform_TooManyFiles (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_ERRORTOOMANYOPENFILES(); return _o_result; } -BOOLEAN Platform_NoSuchDirectory (int32 e) +BOOLEAN Platform_NoSuchDirectory (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_ERRORPATHNOTFOUND(); return _o_result; } -BOOLEAN Platform_DifferentFilesystems (int32 e) +BOOLEAN Platform_DifferentFilesystems (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_ERRORNOTSAMEDEVICE(); return _o_result; } -BOOLEAN Platform_Inaccessible (int32 e) +BOOLEAN Platform_Inaccessible (int16 e) { BOOLEAN _o_result; _o_result = ((e == Platform_ERRORACCESSDENIED() || e == Platform_ERRORWRITEPROTECT()) || e == Platform_ERRORNOTREADY()) || e == Platform_ERRORSHARINGVIOLATION(); return _o_result; } -BOOLEAN Platform_Absent (int32 e) +BOOLEAN Platform_Absent (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_ERRORFILENOTFOUND() || e == Platform_ERRORPATHNOTFOUND(); return _o_result; } -BOOLEAN Platform_TimedOut (int32 e) +BOOLEAN Platform_TimedOut (int16 e) { BOOLEAN _o_result; _o_result = e == Platform_ETIMEDOUT(); return _o_result; } -BOOLEAN Platform_ConnectionFailed (int32 e) +BOOLEAN Platform_ConnectionFailed (int16 e) { BOOLEAN _o_result; _o_result = ((e == Platform_ECONNREFUSED() || e == Platform_ECONNABORTED()) || e == Platform_ENETUNREACH()) || e == Platform_EHOSTUNREACH(); @@ -242,7 +242,7 @@ void Platform_OSFree (address address) Platform_free(address); } -void Platform_Init (int32 argc, address argvadr) +void Platform_Init (int16 argc, address argvadr) { Platform_ArgVecPtr av = NIL; Platform_MainStackFrame = argvadr; @@ -257,7 +257,7 @@ BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__le { BOOLEAN _o_result; CHAR buf[4096]; - int32 res; + int16 res; __DUP(var, var__len, CHAR); res = Platform_getenv(var, var__len, (void*)buf, 4096); if ((res > 0 && res < 4096)) { @@ -282,7 +282,7 @@ void Platform_GetEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len) __DEL(var); } -void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len) +void Platform_GetArg (int16 n, CHAR *val, LONGINT val__len) { Platform_ArgVec av = NIL; if (n < Platform_ArgCount) { @@ -291,10 +291,10 @@ void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len) } } -void Platform_GetIntArg (int32 n, int64 *val) +void Platform_GetIntArg (int16 n, int32 *val) { CHAR s[64]; - int64 k, d, i; + int32 k, d, i; s[0] = 0x00; Platform_GetArg(n, (void*)s, 64); i = 0; @@ -302,11 +302,11 @@ void Platform_GetIntArg (int32 n, int64 *val) i = 1; } k = 0; - d = s[__X(i, 64)] - 48; + d = (int16)s[__X(i, 64)] - 48; while ((d >= 0 && d <= 9)) { k = k * 10 + d; i += 1; - d = s[__X(i, 64)] - 48; + d = (int16)s[__X(i, 64)] - 48; } if (s[0] == '-') { k = -k; @@ -317,10 +317,10 @@ void Platform_GetIntArg (int32 n, int64 *val) } } -int32 Platform_ArgPos (CHAR *s, LONGINT s__len) +int16 Platform_ArgPos (CHAR *s, LONGINT s__len) { - int32 _o_result; - int32 i; + int16 _o_result; + int16 i; CHAR arg[256]; __DUP(s, s__len, CHAR); i = 0; @@ -338,28 +338,28 @@ void Platform_SetBadInstructionHandler (Platform_SignalHandler handler) { } -static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 se, int64 *t, int64 *d) +static void Platform_YMDHMStoClock (int16 ye, int16 mo, int16 da, int16 ho, int16 mi, int16 se, int32 *t, int32 *d) { - *d = (__ASHL((int64)(int)__MOD(ye, 100), 9) + __ASHL((int64)(mo + 1), 5)) + (int64)da; - *t = (__ASHL((int64)ho, 12) + __ASHL((int64)mi, 6)) + (int64)se; + *d = (__ASHL((int)__MOD(ye, 100), 9) + __ASHL((mo + 1), 5)) + da; + *t = (__ASHL(ho, 12) + __ASHL(mi, 6)) + se; } -void Platform_GetClock (int64 *t, int64 *d) +void Platform_GetClock (int32 *t, int32 *d) { Platform_getLocalTime(); Platform_YMDHMStoClock(Platform_styear(), Platform_stmon(), Platform_stmday(), Platform_sthour(), Platform_stmin(), Platform_stsec(), &*t, &*d); } -int64 Platform_Time (void) +int32 Platform_Time (void) { - int64 _o_result; - int64 ms; + int32 _o_result; + int32 ms; ms = Platform_GetTickCount(); - _o_result = __MOD(ms - Platform_TimeStart, 2147483647); + _o_result = (int)__MOD(ms - Platform_TimeStart, 2147483647); return _o_result; } -void Platform_Delay (int64 ms) +void Platform_Delay (int32 ms) { while (ms > 30000) { Platform_sleep(30000); @@ -370,7 +370,7 @@ void Platform_Delay (int64 ms) } } -void Platform_GetTimeOfDay (int64 *sec, int64 *usec) +void Platform_GetTimeOfDay (int32 *sec, int32 *usec) { Platform_getLocalTime(); Platform_stToFt(); @@ -380,10 +380,10 @@ void Platform_GetTimeOfDay (int64 *sec, int64 *usec) *usec = Platform_uluSec(); } -int32 Platform_System (CHAR *cmd, LONGINT cmd__len) +int16 Platform_System (CHAR *cmd, LONGINT cmd__len) { - int32 _o_result; - int32 result; + int16 _o_result; + int16 result; __DUP(cmd, cmd__len, CHAR); result = 127; Platform_startupInfo(); @@ -399,17 +399,17 @@ int32 Platform_System (CHAR *cmd, LONGINT cmd__len) return _o_result; } -int32 Platform_Error (void) +int16 Platform_Error (void) { - int32 _o_result; + int16 _o_result; _o_result = Platform_err(); return _o_result; } -int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h) +int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h) { - int32 _o_result; - int64 fd; + int16 _o_result; + int32 fd; fd = Platform_openro(n, n__len); if (fd == Platform_invalidHandleValue()) { _o_result = Platform_err(); @@ -422,10 +422,10 @@ int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h) __RETCHK; } -int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h) +int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h) { - int32 _o_result; - int64 fd; + int16 _o_result; + int32 fd; fd = Platform_openrw(n, n__len); if (fd == Platform_invalidHandleValue()) { _o_result = Platform_err(); @@ -438,10 +438,10 @@ int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h) __RETCHK; } -int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h) +int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h) { - int32 _o_result; - int64 fd; + int16 _o_result; + int32 fd; fd = Platform_opennew(n, n__len); if (fd == Platform_invalidHandleValue()) { _o_result = Platform_err(); @@ -454,9 +454,9 @@ int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h) __RETCHK; } -int32 Platform_Close (int64 h) +int16 Platform_Close (int32 h) { - int32 _o_result; + int16 _o_result; if (Platform_closeHandle(h) == 0) { _o_result = Platform_err(); return _o_result; @@ -467,9 +467,9 @@ int32 Platform_Close (int64 h) __RETCHK; } -int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, address *identity__typ) +int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ) { - int32 _o_result; + int16 _o_result; Platform_byHandleFileInformation(); if (Platform_getFileInformationByHandle(h) == 0) { _o_result = Platform_err(); @@ -484,11 +484,11 @@ int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, address *iden return _o_result; } -int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ) +int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ) { - int32 _o_result; - int64 h; - int32 e, i; + int16 _o_result; + int32 h; + int16 e, i; __DUP(n, n__len, CHAR); e = Platform_OldRO((void*)n, n__len, &h); if (e != 0) { @@ -523,16 +523,16 @@ void Platform_SetMTime (Platform_FileIdentity *target, address *target__typ, Pla (*target).mtimelow = source.mtimelow; } -void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d) +void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d) { Platform_identityToFileTime(i); Platform_fileTimeToSysTime(); Platform_YMDHMStoClock(Platform_styear(), Platform_stmon(), Platform_stmday(), Platform_sthour(), Platform_stmin(), Platform_stsec(), &*t, &*d); } -int32 Platform_Size (int64 h, int64 *l) +int16 Platform_Size (int32 h, int32 *l) { - int32 _o_result; + int16 _o_result; Platform_largeInteger(); if (Platform_getFileSize(h) == 0) { _o_result = Platform_err(); @@ -543,43 +543,45 @@ int32 Platform_Size (int64 h, int64 *l) return _o_result; } -int32 Platform_Read (int64 h, address p, address l, address *n) +int16 Platform_Read (int32 h, address p, int32 l, int32 *n) { - int32 _o_result; - int32 result; - *n = 0; - result = Platform_readfile(h, p, l, &*n); + int16 _o_result; + int16 result; + int32 lengthread; + result = Platform_readfile(h, p, l, &lengthread); if (result == 0) { *n = 0; _o_result = Platform_err(); return _o_result; } else { + *n = lengthread; _o_result = 0; return _o_result; } __RETCHK; } -int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, address *n) +int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n) { - int32 _o_result; - int32 result; - *n = 0; - result = Platform_readfile(h, (address)b, b__len, &*n); + int16 _o_result; + int16 result; + int32 lengthread; + result = Platform_readfile(h, (address)b, b__len, &lengthread); if (result == 0) { *n = 0; _o_result = Platform_err(); return _o_result; } else { + *n = lengthread; _o_result = 0; return _o_result; } __RETCHK; } -int32 Platform_Write (int64 h, int64 p, int64 l) +int16 Platform_Write (int32 h, address p, int32 l) { - int32 _o_result; + int16 _o_result; if (Platform_writefile(h, p, l) == 0) { _o_result = Platform_err(); return _o_result; @@ -590,9 +592,9 @@ int32 Platform_Write (int64 h, int64 p, int64 l) __RETCHK; } -int32 Platform_Sync (int64 h) +int16 Platform_Sync (int32 h) { - int32 _o_result; + int16 _o_result; if (Platform_flushFileBuffers(h) == 0) { _o_result = Platform_err(); return _o_result; @@ -603,10 +605,10 @@ int32 Platform_Sync (int64 h) __RETCHK; } -int32 Platform_Seek (int64 h, int64 o, int32 r) +int16 Platform_Seek (int32 h, int32 o, int16 r) { - int32 _o_result; - int32 rc; + int16 _o_result; + int16 rc; Platform_largeInteger(); Platform_setFilePointerEx(h, o, r, &rc); if (rc == 0) { @@ -619,11 +621,11 @@ int32 Platform_Seek (int64 h, int64 o, int32 r) __RETCHK; } -int32 Platform_Truncate (int64 h, int64 limit) +int16 Platform_Truncate (int32 h, int32 limit) { - int32 _o_result; - int32 rc; - int64 oldpos; + int16 _o_result; + int16 rc; + int32 oldpos; Platform_largeInteger(); Platform_getFilePos(h, &oldpos, &rc); if (rc == 0) { @@ -648,9 +650,9 @@ int32 Platform_Truncate (int64 h, int64 limit) return _o_result; } -int32 Platform_Unlink (CHAR *n, LONGINT n__len) +int16 Platform_Unlink (CHAR *n, LONGINT n__len) { - int32 _o_result; + int16 _o_result; if (Platform_deleteFile(n, n__len) == 0) { _o_result = Platform_err(); return _o_result; @@ -661,10 +663,10 @@ int32 Platform_Unlink (CHAR *n, LONGINT n__len) __RETCHK; } -int32 Platform_Chdir (CHAR *n, LONGINT n__len) +int16 Platform_Chdir (CHAR *n, LONGINT n__len) { - int32 _o_result; - int32 r; + int16 _o_result; + int16 r; r = Platform_setCurrentDirectory(n, n__len); if (r == 0) { _o_result = Platform_err(); @@ -675,9 +677,9 @@ int32 Platform_Chdir (CHAR *n, LONGINT n__len) return _o_result; } -int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len) +int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len) { - int32 _o_result; + int16 _o_result; if (Platform_moveFile(o, o__len, n, n__len) == 0) { _o_result = Platform_err(); return _o_result; @@ -688,7 +690,7 @@ int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len) __RETCHK; } -void Platform_Exit (int32 code) +void Platform_Exit (int16 code) { Platform_exit(code); } @@ -704,15 +706,15 @@ static void Platform_errln (void) Platform_errch(0x0a); } -static void Platform_errposint (int64 l) +static void Platform_errposint (int32 l) { if (l > 10) { Platform_errposint(__DIV(l, 10)); } - Platform_errch((CHAR)(48 + __MOD(l, 10))); + Platform_errch((CHAR)(48 + (int)__MOD(l, 10))); } -static void Platform_errint (int64 l) +static void Platform_errint (int32 l) { if (l < 0) { Platform_errch('-'); @@ -721,7 +723,7 @@ static void Platform_errint (int64 l) Platform_errposint(l); } -static void Platform_DisplayHaltCode (int64 code) +static void Platform_DisplayHaltCode (int32 code) { switch (code) { case -1: @@ -777,7 +779,7 @@ static void Platform_DisplayHaltCode (int64 code) } } -void Platform_Halt (int64 code) +void Platform_Halt (int32 code) { Platform_HaltCode = code; if (Platform_HaltHandler != NIL) { @@ -790,10 +792,10 @@ void Platform_Halt (int64 code) Platform_DisplayHaltCode(code); } Platform_errln(); - Platform_exit(__VAL(int32, code)); + Platform_exit(__VAL(int16, code)); } -void Platform_AssertFail (int64 code) +void Platform_AssertFail (int32 code) { Platform_errstring((CHAR*)"Assertion failure.", 19); if (code != 0) { @@ -802,7 +804,7 @@ void Platform_AssertFail (int64 code) Platform_errstring((CHAR*)".", 2); } Platform_errln(); - Platform_exit(__VAL(int32, code)); + Platform_exit(__VAL(int16, code)); } void Platform_SetHalt (Platform_HaltProcedure p) @@ -812,12 +814,12 @@ void Platform_SetHalt (Platform_HaltProcedure p) static void Platform_TestLittleEndian (void) { - int32 i; + int16 i; i = 1; __GET((address)&i, Platform_LittleEndian, BOOLEAN); } -__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 40), {-8}}; +__TDESC(Platform_FileIdentity, 1, 0) = {__TDFLDS("FileIdentity", 20), {-8}}; export void *Platform__init(void) { diff --git a/bootstrap/windows-88/Platform.h b/bootstrap/windows-88/Platform.h index 6cab3690..d62dd343 100644 --- a/bootstrap/windows-88/Platform.h +++ b/bootstrap/windows-88/Platform.h @@ -7,75 +7,75 @@ typedef struct Platform_FileIdentity { - int64 _prvt0; - char _prvt1[32]; + int32 _prvt0; + char _prvt1[16]; } Platform_FileIdentity; typedef - void (*Platform_HaltProcedure)(int64); + void (*Platform_HaltProcedure)(int32); typedef - void (*Platform_SignalHandler)(int32); + void (*Platform_SignalHandler)(int16); import BOOLEAN Platform_LittleEndian; import address Platform_MainStackFrame; -import int64 Platform_HaltCode; -import int32 Platform_PID; +import int32 Platform_HaltCode; +import int16 Platform_PID; import CHAR Platform_CWD[4096]; -import int32 Platform_ArgCount; +import int16 Platform_ArgCount; import address Platform_ArgVector; -import int32 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; -import int64 Platform_StdIn, Platform_StdOut, Platform_StdErr; +import int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd; +import int32 Platform_StdIn, Platform_StdOut, Platform_StdErr; import CHAR Platform_nl[3]; import address *Platform_FileIdentity__typ; -import BOOLEAN Platform_Absent (int32 e); -import int32 Platform_ArgPos (CHAR *s, LONGINT s__len); -import void Platform_AssertFail (int64 code); -import int32 Platform_Chdir (CHAR *n, LONGINT n__len); -import int32 Platform_Close (int64 h); -import BOOLEAN Platform_ConnectionFailed (int32 e); -import void Platform_Delay (int64 ms); -import BOOLEAN Platform_DifferentFilesystems (int32 e); -import int32 Platform_Error (void); -import void Platform_Exit (int32 code); -import void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len); -import void Platform_GetClock (int64 *t, int64 *d); +import BOOLEAN Platform_Absent (int16 e); +import int16 Platform_ArgPos (CHAR *s, LONGINT s__len); +import void Platform_AssertFail (int32 code); +import int16 Platform_Chdir (CHAR *n, LONGINT n__len); +import int16 Platform_Close (int32 h); +import BOOLEAN Platform_ConnectionFailed (int16 e); +import void Platform_Delay (int32 ms); +import BOOLEAN Platform_DifferentFilesystems (int16 e); +import int16 Platform_Error (void); +import void Platform_Exit (int16 code); +import void Platform_GetArg (int16 n, CHAR *val, LONGINT val__len); +import void Platform_GetClock (int32 *t, int32 *d); import void Platform_GetEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); -import void Platform_GetIntArg (int32 n, int64 *val); -import void Platform_GetTimeOfDay (int64 *sec, int64 *usec); -import void Platform_Halt (int64 code); -import int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, address *identity__typ); -import int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); -import BOOLEAN Platform_Inaccessible (int32 e); -import void Platform_Init (int32 argc, address argvadr); -import void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d); -import int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h); -import BOOLEAN Platform_NoSuchDirectory (int32 e); +import void Platform_GetIntArg (int16 n, int32 *val); +import void Platform_GetTimeOfDay (int32 *sec, int32 *usec); +import void Platform_Halt (int32 code); +import int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ); +import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ); +import BOOLEAN Platform_Inaccessible (int16 e); +import void Platform_Init (int16 argc, address argvadr); +import void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d); +import int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h); +import BOOLEAN Platform_NoSuchDirectory (int16 e); import address Platform_OSAllocate (address size); import void Platform_OSFree (address address); -import int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h); -import int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h); -import int32 Platform_Read (int64 h, address p, address l, address *n); -import int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, address *n); -import int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); +import int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h); +import int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h); +import int16 Platform_Read (int32 h, address p, int32 l, int32 *n); +import int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n); +import int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len); import BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2); import BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2); -import int32 Platform_Seek (int64 h, int64 o, int32 r); +import int16 Platform_Seek (int32 h, int32 o, int16 r); import void Platform_SetBadInstructionHandler (Platform_SignalHandler handler); import void Platform_SetHalt (Platform_HaltProcedure p); import void Platform_SetMTime (Platform_FileIdentity *target, address *target__typ, Platform_FileIdentity source); -import int32 Platform_Size (int64 h, int64 *l); -import int32 Platform_Sync (int64 h); -import int32 Platform_System (CHAR *cmd, LONGINT cmd__len); -import int64 Platform_Time (void); -import BOOLEAN Platform_TimedOut (int32 e); -import BOOLEAN Platform_TooManyFiles (int32 e); -import int32 Platform_Truncate (int64 h, int64 limit); -import int32 Platform_Unlink (CHAR *n, LONGINT n__len); -import int32 Platform_Write (int64 h, int64 p, int64 l); +import int16 Platform_Size (int32 h, int32 *l); +import int16 Platform_Sync (int32 h); +import int16 Platform_System (CHAR *cmd, LONGINT cmd__len); +import int32 Platform_Time (void); +import BOOLEAN Platform_TimedOut (int16 e); +import BOOLEAN Platform_TooManyFiles (int16 e); +import int16 Platform_Truncate (int32 h, int32 limit); +import int16 Platform_Unlink (CHAR *n, LONGINT n__len); +import int16 Platform_Write (int32 h, address p, int32 l); import BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len); import void *Platform__init(void); diff --git a/bootstrap/windows-88/Reals.c b/bootstrap/windows-88/Reals.c index 7678a81e..fe93e8be 100644 --- a/bootstrap/windows-88/Reals.c +++ b/bootstrap/windows-88/Reals.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -10,19 +10,19 @@ static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LONGINT d__len); -export void Reals_Convert (REAL x, int32 n, CHAR *d, LONGINT d__len); +export void Reals_Convert (REAL x, int16 n, CHAR *d, LONGINT d__len); export void Reals_ConvertH (REAL y, CHAR *d, LONGINT d__len); export void Reals_ConvertHL (LONGREAL x, CHAR *d, LONGINT d__len); -export void Reals_ConvertL (LONGREAL x, int32 n, CHAR *d, LONGINT d__len); -export int32 Reals_Expo (REAL x); -export int32 Reals_ExpoL (LONGREAL x); -export void Reals_SetExpo (REAL *x, int32 ex); -export REAL Reals_Ten (int32 e); -export LONGREAL Reals_TenL (int32 e); -static CHAR Reals_ToHex (int32 i); +export void Reals_ConvertL (LONGREAL x, int16 n, CHAR *d, LONGINT d__len); +export int16 Reals_Expo (REAL x); +export int16 Reals_ExpoL (LONGREAL x); +export void Reals_SetExpo (REAL *x, int16 ex); +export REAL Reals_Ten (int16 e); +export LONGREAL Reals_TenL (int16 e); +static CHAR Reals_ToHex (int16 i); -REAL Reals_Ten (int32 e) +REAL Reals_Ten (int16 e) { REAL _o_result; LONGREAL r, power; @@ -39,7 +39,7 @@ REAL Reals_Ten (int32 e) return _o_result; } -LONGREAL Reals_TenL (int32 e) +LONGREAL Reals_TenL (int16 e) { LONGREAL _o_result; LONGREAL r, power; @@ -59,54 +59,67 @@ LONGREAL Reals_TenL (int32 e) __RETCHK; } -int32 Reals_Expo (REAL x) +int16 Reals_Expo (REAL x) { - int32 _o_result; - int32 i; - __GET((address)&x + 2, i, int32); + int16 _o_result; + int16 i; + __GET((address)&x + 2, i, int16); _o_result = __MASK(__ASHR(i, 7), -256); return _o_result; } -void Reals_SetExpo (REAL *x, int32 ex) +void Reals_SetExpo (REAL *x, int16 ex) { CHAR c; __GET((address)x + 3, c, CHAR); - __PUT((address)x + 3, (CHAR)(__ASHL(__ASHR(c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); + __PUT((address)x + 3, (CHAR)(__ASHL(__ASHR((int16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR); __GET((address)x + 2, c, CHAR); - __PUT((address)x + 2, (CHAR)(__MASK(c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); + __PUT((address)x + 2, (CHAR)(__MASK((int16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR); } -int32 Reals_ExpoL (LONGREAL x) +int16 Reals_ExpoL (LONGREAL x) { - int32 _o_result; - int32 i; - __GET((address)&x + 6, i, int32); + int16 _o_result; + int16 i; + __GET((address)&x + 6, i, int16); _o_result = __MASK(__ASHR(i, 4), -2048); return _o_result; } -void Reals_ConvertL (LONGREAL x, int32 n, CHAR *d, LONGINT d__len) +void Reals_ConvertL (LONGREAL x, int16 n, CHAR *d, LONGINT d__len) { - int64 i, j, k; + int32 i, j, k; if (x < (LONGREAL)0) { x = -x; } k = 0; - i = __ENTIER(x); - while (k < (int64)n) { - d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48); + if (n > 9) { + i = (int32)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000); + j = (int32)__ENTIER(x - i * (LONGREAL)1000000000); + if (j < 0) { + j = 0; + } + while (k < 9) { + d[__X(k, d__len)] = (CHAR)((int)__MOD(j, 10) + 48); + j = __DIV(j, 10); + k += 1; + } + } else { + i = (int32)__ENTIER(x); + } + while (k < n) { + d[__X(k, d__len)] = (CHAR)((int)__MOD(i, 10) + 48); i = __DIV(i, 10); k += 1; } } -void Reals_Convert (REAL x, int32 n, CHAR *d, LONGINT d__len) +void Reals_Convert (REAL x, int16 n, CHAR *d, LONGINT d__len) { Reals_ConvertL(x, n, (void*)d, d__len); } -static CHAR Reals_ToHex (int32 i) +static CHAR Reals_ToHex (int16 i) { CHAR _o_result; if (i < 10) { @@ -121,15 +134,15 @@ static CHAR Reals_ToHex (int32 i) static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LONGINT d__len) { - int32 i; - int64 l; + int16 i; + int32 l; CHAR by; i = 0; l = b__len; - while ((int64)i < l) { + while (i < l) { by = __VAL(CHAR, b[__X(i, b__len)]); - d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR(by, 4)); - d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK(by, -16)); + d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int16)by, 4)); + d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int16)by, -16)); i += 1; } } diff --git a/bootstrap/windows-88/Reals.h b/bootstrap/windows-88/Reals.h index 4de192c6..e7cba0d8 100644 --- a/bootstrap/windows-88/Reals.h +++ b/bootstrap/windows-88/Reals.h @@ -8,15 +8,15 @@ -import void Reals_Convert (REAL x, int32 n, CHAR *d, LONGINT d__len); +import void Reals_Convert (REAL x, int16 n, CHAR *d, LONGINT d__len); import void Reals_ConvertH (REAL y, CHAR *d, LONGINT d__len); import void Reals_ConvertHL (LONGREAL x, CHAR *d, LONGINT d__len); -import void Reals_ConvertL (LONGREAL x, int32 n, CHAR *d, LONGINT d__len); -import int32 Reals_Expo (REAL x); -import int32 Reals_ExpoL (LONGREAL x); -import void Reals_SetExpo (REAL *x, int32 ex); -import REAL Reals_Ten (int32 e); -import LONGREAL Reals_TenL (int32 e); +import void Reals_ConvertL (LONGREAL x, int16 n, CHAR *d, LONGINT d__len); +import int16 Reals_Expo (REAL x); +import int16 Reals_ExpoL (LONGREAL x); +import void Reals_SetExpo (REAL *x, int16 ex); +import REAL Reals_Ten (int16 e); +import LONGREAL Reals_TenL (int16 e); import void *Reals__init(void); diff --git a/bootstrap/windows-88/Strings.c b/bootstrap/windows-88/Strings.c index 49fbdd21..427a0cc4 100644 --- a/bootstrap/windows-88/Strings.c +++ b/bootstrap/windows-88/Strings.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" @@ -11,22 +11,22 @@ export void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__len); export void Strings_Cap (CHAR *s, LONGINT s__len); -export void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n); -export void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHAR *dest, LONGINT dest__len); -export void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len); -export int32 Strings_Length (CHAR *s, LONGINT s__len); +export void Strings_Delete (CHAR *s, LONGINT s__len, int16 pos, int16 n); +export void Strings_Extract (CHAR *source, LONGINT source__len, int16 pos, int16 n, CHAR *dest, LONGINT dest__len); +export void Strings_Insert (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len); +export int16 Strings_Length (CHAR *s, LONGINT s__len); export BOOLEAN Strings_Match (CHAR *string, LONGINT string__len, CHAR *pattern, LONGINT pattern__len); -export int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int32 pos); -export void Strings_Replace (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len); +export int16 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int16 pos); +export void Strings_Replace (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len); -int32 Strings_Length (CHAR *s, LONGINT s__len) +int16 Strings_Length (CHAR *s, LONGINT s__len) { - int32 _o_result; - int32 i; + int16 _o_result; + int16 i; __DUP(s, s__len, CHAR); i = 0; - while (((int64)i < s__len && s[__X(i, s__len)] != 0x00)) { + while ((i < s__len && s[__X(i, s__len)] != 0x00)) { i += 1; } _o_result = i; @@ -36,24 +36,24 @@ int32 Strings_Length (CHAR *s, LONGINT s__len) void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__len) { - int32 n1, n2, i; + int16 n1, n2, i; __DUP(extra, extra__len, CHAR); n1 = Strings_Length(dest, dest__len); n2 = Strings_Length(extra, extra__len); i = 0; - while ((i < n2 && (int64)(i + n1) < dest__len)) { + while ((i < n2 && (i + n1) < dest__len)) { dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)]; i += 1; } - if ((int64)(i + n1) < dest__len) { + if ((i + n1) < dest__len) { dest[__X(i + n1, dest__len)] = 0x00; } __DEL(extra); } -void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len) +void Strings_Insert (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len) { - int32 n1, n2, i; + int16 n1, n2, i; __DUP(source, source__len, CHAR); n1 = Strings_Length(dest, dest__len); n2 = Strings_Length(source, source__len); @@ -64,10 +64,10 @@ void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, L Strings_Append(dest, dest__len, (void*)source, source__len); return; } - if ((int64)(pos + n2) < dest__len) { + if ((pos + n2) < dest__len) { i = n1; while (i >= pos) { - if ((int64)(i + n2) < dest__len) { + if ((i + n2) < dest__len) { dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)]; } i -= 1; @@ -81,9 +81,9 @@ void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, L __DEL(source); } -void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n) +void Strings_Delete (CHAR *s, LONGINT s__len, int16 pos, int16 n) { - int32 len, i; + int16 len, i; len = Strings_Length(s, s__len); if (pos < 0) { pos = 0; @@ -96,7 +96,7 @@ void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n) s[__X(i - n, s__len)] = s[__X(i, s__len)]; i += 1; } - if ((int64)(i - n) < s__len) { + if ((i - n) < s__len) { s[__X(i - n, s__len)] = 0x00; } } else { @@ -104,7 +104,7 @@ void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n) } } -void Strings_Replace (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len) +void Strings_Replace (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len) { __DUP(source, source__len, CHAR); Strings_Delete((void*)dest, dest__len, pos, pos + Strings_Length(source, source__len)); @@ -112,12 +112,12 @@ void Strings_Replace (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, __DEL(source); } -void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHAR *dest, LONGINT dest__len) +void Strings_Extract (CHAR *source, LONGINT source__len, int16 pos, int16 n, CHAR *dest, LONGINT dest__len) { - int32 len, destLen, i; + int16 len, destLen, i; __DUP(source, source__len, CHAR); len = Strings_Length(source, source__len); - destLen = (int32)dest__len - 1; + destLen = (int16)dest__len - 1; if (pos < 0) { pos = 0; } @@ -126,7 +126,7 @@ void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHA return; } i = 0; - while (((((int64)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) { + while (((((pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) { if (i < destLen) { dest[__X(i, dest__len)] = source[__X(pos + i, source__len)]; } @@ -136,10 +136,10 @@ void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHA __DEL(source); } -int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int32 pos) +int16 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int16 pos) { - int32 _o_result; - int32 n1, n2, i, j; + int16 _o_result; + int16 n1, n2, i, j; __DUP(pattern, pattern__len, CHAR); __DUP(s, s__len, CHAR); n1 = Strings_Length(s, s__len); @@ -174,7 +174,7 @@ int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, void Strings_Cap (CHAR *s, LONGINT s__len) { - int32 i; + int16 i; i = 0; while (s[__X(i, s__len)] != 0x00) { if (('a' <= s[__X(i, s__len)] && s[__X(i, s__len)] <= 'z')) { @@ -188,9 +188,9 @@ static struct Match__7 { struct Match__7 *lnk; } *Match__7_s; -static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__len, int32 n, int32 m); +static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__len, int16 n, int16 m); -static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__len, int32 n, int32 m) +static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__len, int16 n, int16 m) { BOOLEAN _o_result; while ((((n >= 0 && m >= 0)) && mask[__X(m, mask__len)] != '*')) { diff --git a/bootstrap/windows-88/Strings.h b/bootstrap/windows-88/Strings.h index 4dd0d2c3..44c51b2a 100644 --- a/bootstrap/windows-88/Strings.h +++ b/bootstrap/windows-88/Strings.h @@ -10,13 +10,13 @@ import void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__len); import void Strings_Cap (CHAR *s, LONGINT s__len); -import void Strings_Delete (CHAR *s, LONGINT s__len, int32 pos, int32 n); -import void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHAR *dest, LONGINT dest__len); -import void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len); -import int32 Strings_Length (CHAR *s, LONGINT s__len); +import void Strings_Delete (CHAR *s, LONGINT s__len, int16 pos, int16 n); +import void Strings_Extract (CHAR *source, LONGINT source__len, int16 pos, int16 n, CHAR *dest, LONGINT dest__len); +import void Strings_Insert (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len); +import int16 Strings_Length (CHAR *s, LONGINT s__len); import BOOLEAN Strings_Match (CHAR *string, LONGINT string__len, CHAR *pattern, LONGINT pattern__len); -import int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int32 pos); -import void Strings_Replace (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len); +import int16 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int16 pos); +import void Strings_Replace (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len); import void *Strings__init(void); diff --git a/bootstrap/windows-88/Texts.c b/bootstrap/windows-88/Texts.c index 6403ce33..8c41a062 100644 --- a/bootstrap/windows-88/Texts.c +++ b/bootstrap/windows-88/Texts.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Files.h" @@ -18,7 +18,7 @@ typedef typedef struct Texts_RunDesc { Texts_Run prev, next; - int64 len; + int32 len; Texts_FontsFont fnt; int8 col, voff; BOOLEAN ascii; @@ -41,26 +41,26 @@ typedef typedef struct Texts_ElemDesc { Texts_Run prev, next; - int64 len; + int32 len; Texts_FontsFont fnt; int8 col, voff; BOOLEAN ascii; - int64 W, H; + int32 W, H; Texts_Handler handle; Texts_Text base; } Texts_ElemDesc; struct Texts__1 { /* Texts_ElemDesc */ Texts_Run prev, next; - int64 len; + int32 len; Texts_FontsFont fnt; int8 col, voff; BOOLEAN ascii; - int64 W, H; + int32 W, H; Texts_Handler handle; Texts_Text base; Files_File file; - int64 org, span; + int32 org, span; CHAR mod[32], proc[32]; }; @@ -69,7 +69,7 @@ typedef typedef struct Texts_BufDesc { - int64 len; + int32 len; Texts_Run head; } Texts_BufDesc; @@ -83,8 +83,8 @@ typedef typedef struct Texts_FileMsg { /* Texts_ElemMsg */ - int32 id; - int64 pos; + int16 id; + int32 pos; Files_Rider r; } Texts_FileMsg; @@ -99,7 +99,7 @@ typedef } Texts_IdentifyMsg; typedef - void (*Texts_Notifier)(Texts_Text, int32, int64, int64); + void (*Texts_Notifier)(Texts_Text, int16, int32, int32); typedef struct Texts_PieceDesc *Texts_Piece; @@ -107,12 +107,12 @@ typedef typedef struct Texts_PieceDesc { Texts_Run prev, next; - int64 len; + int32 len; Texts_FontsFont fnt; int8 col, voff; BOOLEAN ascii; Files_File file; - int64 org; + int32 org; } Texts_PieceDesc; typedef @@ -123,7 +123,7 @@ typedef Texts_Elem elem; Files_Rider rider; Texts_Run run; - int64 org, off; + int32 org, off; } Texts_Reader; typedef @@ -134,10 +134,10 @@ typedef Texts_Elem elem; Files_Rider rider; Texts_Run run; - int64 org, off; + int32 org, off; CHAR nextCh; - int32 line, class; - int64 i; + int16 line, class; + int32 i; REAL x; LONGREAL y; CHAR c; @@ -147,10 +147,10 @@ typedef typedef struct Texts_TextDesc { - int64 len; + int32 len; Texts_Notifier notify; Texts_Run head, cache; - int64 corg; + int32 corg; } Texts_TextDesc; typedef @@ -183,50 +183,50 @@ export address *Texts_Writer__typ; export address *Texts__1__typ; export void Texts_Append (Texts_Text T, Texts_Buffer B); -export void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +export void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); static Texts_Elem Texts_CloneElem (Texts_Elem e); static Texts_Piece Texts_ClonePiece (Texts_Piece p); export void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); export void Texts_Copy (Texts_Buffer SB, Texts_Buffer DB); export void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE); -export void Texts_Delete (Texts_Text T, int64 beg, int64 end); +export void Texts_Delete (Texts_Text T, int32 beg, int32 end); export Texts_Text Texts_ElemBase (Texts_Elem E); -export int64 Texts_ElemPos (Texts_Elem E); -static void Texts_Find (Texts_Text T, int64 *pos, Texts_Run *u, int64 *org, int64 *off); +export int32 Texts_ElemPos (Texts_Elem E); +static void Texts_Find (Texts_Text T, int32 *pos, Texts_Run *u, int32 *org, int32 *off); static Texts_FontsFont Texts_FontsThis (CHAR *name, LONGINT name__len); static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, address *msg__typ); -export void Texts_Insert (Texts_Text T, int64 pos, Texts_Buffer B); +export void Texts_Insert (Texts_Text T, int32 pos, Texts_Buffer B); export void Texts_Load (Files_Rider *r, address *r__typ, Texts_Text T); static void Texts_Load0 (Files_Rider *r, address *r__typ, Texts_Text T); static void Texts_Merge (Texts_Text T, Texts_Run u, Texts_Run *v); export void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len); export void Texts_OpenBuf (Texts_Buffer B); -export void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int64 pos); -export void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int64 pos); +export void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int32 pos); +export void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int32 pos); export void Texts_OpenWriter (Texts_Writer *W, address *W__typ); -export int64 Texts_Pos (Texts_Reader *R, address *R__typ); +export int32 Texts_Pos (Texts_Reader *R, address *R__typ); export void Texts_Read (Texts_Reader *R, address *R__typ, CHAR *ch); export void Texts_ReadElem (Texts_Reader *R, address *R__typ); export void Texts_ReadPrevElem (Texts_Reader *R, address *R__typ); export void Texts_Recall (Texts_Buffer *B); -export void Texts_Save (Texts_Text T, int64 beg, int64 end, Texts_Buffer B); +export void Texts_Save (Texts_Text T, int32 beg, int32 end, Texts_Buffer B); export void Texts_Scan (Texts_Scanner *S, address *S__typ); export void Texts_SetColor (Texts_Writer *W, address *W__typ, int8 col); export void Texts_SetFont (Texts_Writer *W, address *W__typ, Texts_FontsFont fnt); export void Texts_SetOffset (Texts_Writer *W, address *W__typ, int8 voff); static void Texts_Splice (Texts_Run un, Texts_Run v, Texts_Run w, Texts_Text base); -static void Texts_Split (int64 off, Texts_Run *u, Texts_Run *un); +static void Texts_Split (int32 off, Texts_Run *u, Texts_Run *un); export void Texts_Store (Files_Rider *r, address *r__typ, Texts_Text T); export void Texts_Write (Texts_Writer *W, address *W__typ, CHAR ch); -export void Texts_WriteDate (Texts_Writer *W, address *W__typ, int64 t, int64 d); +export void Texts_WriteDate (Texts_Writer *W, address *W__typ, int32 t, int32 d); export void Texts_WriteElem (Texts_Writer *W, address *W__typ, Texts_Elem e); -export void Texts_WriteHex (Texts_Writer *W, address *W__typ, int64 x); +export void Texts_WriteHex (Texts_Writer *W, address *W__typ, int32 x); export void Texts_WriteInt (Texts_Writer *W, address *W__typ, int64 x, int64 n); export void Texts_WriteLn (Texts_Writer *W, address *W__typ); -export void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n); +export void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int16 n); export void Texts_WriteLongRealHex (Texts_Writer *W, address *W__typ, LONGREAL x); -export void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int32 n); -export void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int32 n, int32 k); +export void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int16 n); +export void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int16 n, int16 k); export void Texts_WriteRealHex (Texts_Writer *W, address *W__typ, REAL x); export void Texts_WriteString (Texts_Writer *W, address *W__typ, CHAR *s, LONGINT s__len); @@ -241,10 +241,10 @@ static Texts_FontsFont Texts_FontsThis (CHAR *name, LONGINT name__len) return _o_result; } -static void Texts_Find (Texts_Text T, int64 *pos, Texts_Run *u, int64 *org, int64 *off) +static void Texts_Find (Texts_Text T, int32 *pos, Texts_Run *u, int32 *org, int32 *off) { Texts_Run v = NIL; - int64 m; + int32 m; if (*pos >= T->len) { *pos = T->len; *u = T->head; @@ -274,7 +274,7 @@ static void Texts_Find (Texts_Text T, int64 *pos, Texts_Run *u, int64 *org, int6 } } -static void Texts_Split (int64 off, Texts_Run *u, Texts_Run *un) +static void Texts_Split (int32 off, Texts_Run *u, Texts_Run *un) { Texts_Piece p = NIL, U = NIL; if (off == 0) { @@ -373,11 +373,11 @@ Texts_Text Texts_ElemBase (Texts_Elem E) return _o_result; } -int64 Texts_ElemPos (Texts_Elem E) +int32 Texts_ElemPos (Texts_Elem E) { - int64 _o_result; + int32 _o_result; Texts_Run u = NIL; - int64 pos; + int32 pos; u = E->base->head->next; pos = 0; while (u != (void *) E) { @@ -392,7 +392,7 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, address *msg__t { Texts_Alien e = NIL; Files_Rider r; - int64 i; + int32 i; CHAR ch; if (__ISP(E, Texts__1, 2)) { if (__IS(msg__typ, Texts_CopyMsg, 1)) { @@ -468,10 +468,10 @@ void Texts_Recall (Texts_Buffer *B) Texts_del = NIL; } -void Texts_Save (Texts_Text T, int64 beg, int64 end, Texts_Buffer B) +void Texts_Save (Texts_Text T, int32 beg, int32 end, Texts_Buffer B) { Texts_Run u = NIL, v = NIL, w = NIL, wn = NIL; - int64 uo, ud, vo, vd; + int32 uo, ud, vo, vd; Texts_Find(T, &beg, &u, &uo, &ud); Texts_Find(T, &end, &v, &vo, &vd); w = B->head->prev; @@ -502,11 +502,11 @@ void Texts_Save (Texts_Text T, int64 beg, int64 end, Texts_Buffer B) B->len += end - beg; } -void Texts_Insert (Texts_Text T, int64 pos, Texts_Buffer B) +void Texts_Insert (Texts_Text T, int32 pos, Texts_Buffer B) { Texts_Run u = NIL, un = NIL, v = NIL; Texts_Piece p = NIL, q = NIL; - int64 uo, ud, len; + int32 uo, ud, len; Texts_Find(T, &pos, &u, &uo, &ud); Texts_Split(ud, &u, &un); len = B->len; @@ -525,7 +525,7 @@ void Texts_Insert (Texts_Text T, int64 pos, Texts_Buffer B) void Texts_Append (Texts_Text T, Texts_Buffer B) { Texts_Run v = NIL; - int64 pos, len; + int32 pos, len; pos = T->len; len = B->len; v = B->head->next; @@ -540,10 +540,10 @@ void Texts_Append (Texts_Text T, Texts_Buffer B) } } -void Texts_Delete (Texts_Text T, int64 beg, int64 end) +void Texts_Delete (Texts_Text T, int32 beg, int32 end) { Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL; - int64 co, uo, ud, vo, vd; + int32 co, uo, ud, vo, vd; Texts_Find(T, &beg, &u, &uo, &ud); Texts_Split(ud, &u, &un); c = T->cache; @@ -565,10 +565,10 @@ void Texts_Delete (Texts_Text T, int64 beg, int64 end) } } -void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff) +void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff) { Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL; - int64 co, uo, ud, vo, vd; + int32 co, uo, ud, vo, vd; Texts_Find(T, &beg, &u, &uo, &ud); Texts_Split(ud, &u, &un); c = T->cache; @@ -578,13 +578,13 @@ void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_Fonts T->cache = c; T->corg = co; while (un != vn) { - if ((__IN(0, sel, 64) && fnt != NIL)) { + if ((__IN(0, sel, 32) && fnt != NIL)) { un->fnt = fnt; } - if (__IN(1, sel, 64)) { + if (__IN(1, sel, 32)) { un->col = col; } - if (__IN(2, sel, 64)) { + if (__IN(2, sel, 32)) { un->voff = voff; } Texts_Merge(T, u, &un); @@ -604,7 +604,7 @@ void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_Fonts } } -void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int64 pos) +void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int32 pos) { Texts_Run u = NIL; if (pos >= T->len) { @@ -621,7 +621,7 @@ void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int64 pos void Texts_Read (Texts_Reader *R, address *R__typ, CHAR *ch) { Texts_Run u = NIL; - int64 pos; + int32 pos; CHAR nextch; u = (*R).run; (*R).fnt = u->fnt; @@ -713,14 +713,14 @@ void Texts_ReadPrevElem (Texts_Reader *R, address *R__typ) } } -int64 Texts_Pos (Texts_Reader *R, address *R__typ) +int32 Texts_Pos (Texts_Reader *R, address *R__typ) { - int64 _o_result; + int32 _o_result; _o_result = (*R).org + (*R).off; return _o_result; } -void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int64 pos) +void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int32 pos) { Texts_OpenReader((void*)&*S, S__typ, T, pos); (*S).line = 0; @@ -732,7 +732,7 @@ static struct Scan__31 { address *S__typ; CHAR *ch; BOOLEAN *negE; - int32 *e; + int16 *e; struct Scan__31 *lnk; } *Scan__31_s; @@ -751,7 +751,7 @@ static void ReadScaleFactor__32 (void) } } while (('0' <= *Scan__31_s->ch && *Scan__31_s->ch <= '9')) { - *Scan__31_s->e = (*Scan__31_s->e * 10 + *Scan__31_s->ch) - 48; + *Scan__31_s->e = (*Scan__31_s->e * 10 + (int16)*Scan__31_s->ch) - 48; Texts_Read((void*)&*Scan__31_s->S, Scan__31_s->S__typ, &*Scan__31_s->ch); } } @@ -761,8 +761,8 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) CHAR ch, term; BOOLEAN neg, negE, hex; int8 i, j, h; - int32 e; - int64 k; + int16 e; + int32 k; REAL x, f; LONGREAL y, g; CHAR d[32]; @@ -823,10 +823,10 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) if ('9' < ch) { if (('A' <= ch && ch <= 'F')) { hex = 1; - ch = (CHAR)(ch - 7); + ch = (CHAR)((int16)ch - 7); } else if (('a' <= ch && ch <= 'f')) { hex = 1; - ch = (CHAR)(ch - 39); + ch = (CHAR)((int16)ch - 39); } else { break; } @@ -838,13 +838,13 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) if (i - j > 8) { j = i - 8; } - k = d[__X(j, 32)] - 48; + k = (int16)d[__X(j, 32)] - 48; j += 1; if ((i - j == 7 && k >= 8)) { k -= 16; } while (j < i) { - k = __ASHL(k, 4) + (int64)(d[__X(j, 32)] - 48); + k = __ASHL(k, 4) + ((int16)d[__X(j, 32)] - 48); j += 1; } if (neg) { @@ -865,12 +865,12 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) y = (LONGREAL)0; g = (LONGREAL)1; do { - y = y * (LONGREAL)10 + (d[__X(j, 32)] - 48); + y = y * (LONGREAL)10 + ((int16)d[__X(j, 32)] - 48); j += 1; } while (!(j == h)); while (j < i) { g = g / (LONGREAL)(LONGREAL)10; - y = (d[__X(j, 32)] - 48) * g + y; + y = ((int16)d[__X(j, 32)] - 48) * g + y; j += 1; } ReadScaleFactor__32(); @@ -897,12 +897,12 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) x = (REAL)0; f = (REAL)1; do { - x = x * (REAL)10 + (d[__X(j, 32)] - 48); + x = x * (REAL)10 + ((int16)d[__X(j, 32)] - 48); j += 1; } while (!(j == h)); while (j < i) { f = f / (REAL)(REAL)10; - x = (d[__X(j, 32)] - 48) * f + x; + x = ((int16)d[__X(j, 32)] - 48) * f + x; j += 1; } if (ch == 'E') { @@ -934,7 +934,7 @@ void Texts_Scan (Texts_Scanner *S, address *S__typ) (*S).class = 3; k = 0; do { - k = k * 10 + (int64)(d[__X(j, 32)] - 48); + k = k * 10 + ((int16)d[__X(j, 32)] - 48); j += 1; } while (!(j == i)); if (neg) { @@ -1040,7 +1040,7 @@ void Texts_WriteLn (Texts_Writer *W, address *W__typ) void Texts_WriteString (Texts_Writer *W, address *W__typ, CHAR *s, LONGINT s__len) { - int32 i; + int16 i; __DUP(s, s__len, CHAR); i = 0; while (s[__X(i, s__len)] >= ' ') { @@ -1052,7 +1052,7 @@ void Texts_WriteString (Texts_Writer *W, address *W__typ, CHAR *s, LONGINT s__le void Texts_WriteInt (Texts_Writer *W, address *W__typ, int64 x, int64 n) { - int32 i; + int16 i; int64 x0; CHAR a[24]; i = 0; @@ -1085,10 +1085,10 @@ void Texts_WriteInt (Texts_Writer *W, address *W__typ, int64 x, int64 n) } while (!(i == 0)); } -void Texts_WriteHex (Texts_Writer *W, address *W__typ, int64 x) +void Texts_WriteHex (Texts_Writer *W, address *W__typ, int32 x) { - int32 i; - int64 y; + int16 i; + int32 y; CHAR a[20]; i = 0; Texts_Write(&*W, W__typ, ' '); @@ -1108,9 +1108,9 @@ void Texts_WriteHex (Texts_Writer *W, address *W__typ, int64 x) } while (!(i == 0)); } -void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int32 n) +void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int16 n) { - int32 e; + int16 e; REAL x0; CHAR d[9]; e = Reals_Expo(x); @@ -1181,15 +1181,15 @@ void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int32 n) static struct WriteRealFix__53 { Texts_Writer *W; address *W__typ; - int32 *i; + int16 *i; CHAR (*d)[9]; struct WriteRealFix__53 *lnk; } *WriteRealFix__53_s; -static void dig__54 (int32 n); -static void seq__56 (CHAR ch, int32 n); +static void dig__54 (int16 n); +static void seq__56 (CHAR ch, int16 n); -static void seq__56 (CHAR ch, int32 n) +static void seq__56 (CHAR ch, int16 n) { while (n > 0) { Texts_Write(&*WriteRealFix__53_s->W, WriteRealFix__53_s->W__typ, ch); @@ -1197,7 +1197,7 @@ static void seq__56 (CHAR ch, int32 n) } } -static void dig__54 (int32 n) +static void dig__54 (int16 n) { while (n > 0) { *WriteRealFix__53_s->i -= 1; @@ -1206,9 +1206,9 @@ static void dig__54 (int32 n) } } -void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int32 n, int32 k) +void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int16 n, int16 k) { - int32 e, i; + int16 e, i; CHAR sign; REAL x0; CHAR d[9]; @@ -1280,7 +1280,7 @@ void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int32 n, int3 void Texts_WriteRealHex (Texts_Writer *W, address *W__typ, REAL x) { - int32 i; + int16 i; CHAR d[8]; Reals_ConvertH(x, (void*)d, 8); i = 0; @@ -1290,9 +1290,9 @@ void Texts_WriteRealHex (Texts_Writer *W, address *W__typ, REAL x) } while (!(i == 8)); } -void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n) +void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int16 n) { - int32 e; + int16 e; LONGREAL x0; CHAR d[16]; e = Reals_ExpoL(x); @@ -1324,7 +1324,7 @@ void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n) } else { Texts_Write(&*W, W__typ, ' '); } - e = (int32)__ASHR((int64)(e - 1023) * 77, 8); + e = (int16)__ASHR((e - 1023) * 77, 8); if (e >= 0) { x = x / (LONGREAL)Reals_TenL(e); } else { @@ -1364,7 +1364,7 @@ void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n) void Texts_WriteLongRealHex (Texts_Writer *W, address *W__typ, LONGREAL x) { - int32 i; + int16 i; CHAR d[16]; Reals_ConvertHL(x, (void*)d, 16); i = 0; @@ -1380,16 +1380,16 @@ static struct WriteDate__43 { struct WriteDate__43 *lnk; } *WriteDate__43_s; -static void WritePair__44 (CHAR ch, int64 x); +static void WritePair__44 (CHAR ch, int32 x); -static void WritePair__44 (CHAR ch, int64 x) +static void WritePair__44 (CHAR ch, int32 x) { Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, ch); Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, (CHAR)(__DIV(x, 10) + 48)); - Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, (CHAR)(__MOD(x, 10) + 48)); + Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, (CHAR)((int)__MOD(x, 10) + 48)); } -void Texts_WriteDate (Texts_Writer *W, address *W__typ, int64 t, int64 d) +void Texts_WriteDate (Texts_Writer *W, address *W__typ, int32 t, int32 d) { struct WriteDate__43 _s; _s.W = W; _s.W__typ = W__typ; @@ -1413,14 +1413,14 @@ static struct Load0__16 { struct Load0__16 *lnk; } *Load0__16_s; -static void LoadElem__17 (Files_Rider *r, address *r__typ, int64 pos, int64 span, Texts_Elem *e); +static void LoadElem__17 (Files_Rider *r, address *r__typ, int32 pos, int32 span, Texts_Elem *e); -static void LoadElem__17 (Files_Rider *r, address *r__typ, int64 pos, int64 span, Texts_Elem *e) +static void LoadElem__17 (Files_Rider *r, address *r__typ, int32 pos, int32 span, Texts_Elem *e) { Modules_Module M = NIL; Modules_Command Cmd; Texts_Alien a = NIL; - int64 org, ew, eh; + int32 org, ew, eh; int8 eno; Texts_new = NIL; Files_ReadLInt(&*r, r__typ, &ew); @@ -1471,7 +1471,7 @@ static void Texts_Load0 (Files_Rider *r, address *r__typ, Texts_Text T) Texts_Run u = NIL, un = NIL; Texts_Piece p = NIL; Texts_Elem e = NIL; - int64 org, pos, hlen, plen; + int32 org, pos, hlen, plen; int8 ecnt, fno, fcnt, col, voff; Files_File f = NIL; Texts_FileMsg msg; @@ -1490,7 +1490,7 @@ static void Texts_Load0 (Files_Rider *r, address *r__typ, Texts_Text T) pos = Files_Pos(&*r, r__typ); f = Files_Base(&*r, r__typ); __NEW(u, Texts_RunDesc); - u->len = 9223372036854775807; + u->len = 2147483647; u->fnt = NIL; u->col = 15; T->head = u; @@ -1542,7 +1542,7 @@ static void Texts_Load0 (Files_Rider *r, address *r__typ, Texts_Text T) void Texts_Load (Files_Rider *r, address *r__typ, Texts_Text T) { - int32 tag; + int16 tag; Files_ReadInt(&*r, r__typ, &tag); if (tag != -4095) { Files_Set(&*r, r__typ, Files_Base(&*r, r__typ), Files_Pos(&*r, r__typ) - 2); @@ -1557,7 +1557,7 @@ void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len) Texts_Run u = NIL; Texts_Piece p = NIL; CHAR tag, version; - int64 hlen; + int32 hlen; __DUP(name, name__len, CHAR); f = Files_Old(name, name__len); if (f == NIL) { @@ -1570,7 +1570,7 @@ void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len) Texts_Load0(&r, Files_Rider__typ, T); } else { __NEW(u, Texts_RunDesc); - u->len = 9223372036854775807; + u->len = 2147483647; u->fnt = NIL; u->col = 15; __NEW(p, Texts_PieceDesc); @@ -1614,12 +1614,12 @@ static struct Store__39 { struct Store__39 *lnk; } *Store__39_s; -static void StoreElem__40 (Files_Rider *r, address *r__typ, int64 pos, Texts_Elem e); +static void StoreElem__40 (Files_Rider *r, address *r__typ, int32 pos, Texts_Elem e); -static void StoreElem__40 (Files_Rider *r, address *r__typ, int64 pos, Texts_Elem e) +static void StoreElem__40 (Files_Rider *r, address *r__typ, int32 pos, Texts_Elem e) { Files_Rider r1; - int64 org, span; + int32 org, span; int8 eno; __COPY((*Store__39_s->iden).mod, (*Store__39_s->mods)[__X(*Store__39_s->ecnt, 64)], 32); __COPY((*Store__39_s->iden).proc, (*Store__39_s->procs)[__X(*Store__39_s->ecnt, 64)], 32); @@ -1651,7 +1651,7 @@ void Texts_Store (Files_Rider *r, address *r__typ, Texts_Text T) Files_Rider r1; Texts_Run u = NIL, un = NIL; Texts_Elem e = NIL; - int64 org, pos, delta, hlen, rlen; + int32 org, pos, delta, hlen, rlen; int8 ecnt, fno, fcnt; CHAR ch; Texts_FileMsg msg; @@ -1769,7 +1769,7 @@ void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len) { Files_File f = NIL; Files_Rider r; - int32 i, res; + int16 i, res; CHAR bak[64]; __DUP(name, name__len, CHAR); f = Files_New(name, name__len); @@ -1803,16 +1803,16 @@ __TDESC(Texts_FontDesc, 1, 0) = {__TDFLDS("FontDesc", 32), {-8}}; __TDESC(Texts_RunDesc, 1, 3) = {__TDFLDS("RunDesc", 40), {0, 8, 24, -32}}; __TDESC(Texts_PieceDesc, 1, 4) = {__TDFLDS("PieceDesc", 56), {0, 8, 24, 40, -40}}; __TDESC(Texts_ElemMsg, 1, 0) = {__TDFLDS("ElemMsg", 1), {-8}}; -__TDESC(Texts_ElemDesc, 1, 4) = {__TDFLDS("ElemDesc", 72), {0, 8, 24, 64, -40}}; -__TDESC(Texts_FileMsg, 1, 1) = {__TDFLDS("FileMsg", 56), {32, -16}}; +__TDESC(Texts_ElemDesc, 1, 4) = {__TDFLDS("ElemDesc", 64), {0, 8, 24, 56, -40}}; +__TDESC(Texts_FileMsg, 1, 1) = {__TDFLDS("FileMsg", 32), {16, -16}}; __TDESC(Texts_CopyMsg, 1, 1) = {__TDFLDS("CopyMsg", 8), {0, -16}}; __TDESC(Texts_IdentifyMsg, 1, 0) = {__TDFLDS("IdentifyMsg", 64), {-8}}; __TDESC(Texts_BufDesc, 1, 1) = {__TDFLDS("BufDesc", 16), {8, -16}}; __TDESC(Texts_TextDesc, 1, 2) = {__TDFLDS("TextDesc", 40), {16, 24, -24}}; -__TDESC(Texts_Reader, 1, 4) = {__TDFLDS("Reader", 96), {8, 24, 48, 72, -40}}; -__TDESC(Texts_Scanner, 1, 4) = {__TDFLDS("Scanner", 208), {8, 24, 48, 72, -40}}; -__TDESC(Texts_Writer, 1, 4) = {__TDFLDS("Writer", 72), {0, 8, 40, 64, -40}}; -__TDESC(Texts__1, 1, 5) = {__TDFLDS("", 160), {0, 8, 24, 64, 72, -48}}; +__TDESC(Texts_Reader, 1, 4) = {__TDFLDS("Reader", 72), {8, 24, 40, 56, -40}}; +__TDESC(Texts_Scanner, 1, 4) = {__TDFLDS("Scanner", 168), {8, 24, 40, 56, -40}}; +__TDESC(Texts_Writer, 1, 4) = {__TDFLDS("Writer", 56), {0, 8, 32, 48, -40}}; +__TDESC(Texts__1, 1, 5) = {__TDFLDS("", 144), {0, 8, 24, 56, 64, -48}}; export void *Texts__init(void) { diff --git a/bootstrap/windows-88/Texts.h b/bootstrap/windows-88/Texts.h index e85157ed..fa080b7f 100644 --- a/bootstrap/windows-88/Texts.h +++ b/bootstrap/windows-88/Texts.h @@ -8,8 +8,8 @@ typedef struct Texts_BufDesc { - int64 len; - char _prvt0[8]; + int32 len; + int64 _prvt0; } Texts_BufDesc; typedef @@ -39,16 +39,17 @@ typedef typedef struct Texts_ElemDesc { - char _prvt0[40]; - int64 W, H; + int64 _prvt0; + char _prvt1[28]; + int32 W, H; Texts_Handler handle; - char _prvt1[8]; + char _prvt2[8]; } Texts_ElemDesc; typedef struct Texts_FileMsg { /* Texts_ElemMsg */ - int32 id; - int64 pos; + int16 id; + int32 pos; Files_Rider r; } Texts_FileMsg; @@ -69,7 +70,7 @@ typedef struct Texts_TextDesc *Texts_Text; typedef - void (*Texts_Notifier)(Texts_Text, int32, int64, int64); + void (*Texts_Notifier)(Texts_Text, int16, int32, int32); typedef struct Texts_Reader { @@ -77,7 +78,7 @@ typedef Texts_FontsFont fnt; int8 col, voff; Texts_Elem elem; - char _prvt0[64]; + char _prvt0[40]; } Texts_Reader; typedef @@ -86,10 +87,10 @@ typedef Texts_FontsFont fnt; int8 col, voff; Texts_Elem elem; - char _prvt0[64]; + char _prvt0[40]; CHAR nextCh; - int32 line, class; - int64 i; + int16 line, class; + int32 i; REAL x; LONGREAL y; CHAR c; @@ -99,9 +100,9 @@ typedef typedef struct Texts_TextDesc { - int64 len; + int32 len; Texts_Notifier notify; - char _prvt0[24]; + char _prvt0[20]; } Texts_TextDesc; typedef @@ -109,7 +110,7 @@ typedef Texts_Buffer buf; Texts_FontsFont fnt; int8 col, voff; - char _prvt0[54]; + char _prvt0[38]; } Texts_Writer; @@ -129,41 +130,41 @@ import address *Texts_Scanner__typ; import address *Texts_Writer__typ; import void Texts_Append (Texts_Text T, Texts_Buffer B); -import void Texts_ChangeLooks (Texts_Text T, int64 beg, int64 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); +import void Texts_ChangeLooks (Texts_Text T, int32 beg, int32 end, SET sel, Texts_FontsFont fnt, int8 col, int8 voff); import void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len); import void Texts_Copy (Texts_Buffer SB, Texts_Buffer DB); import void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE); -import void Texts_Delete (Texts_Text T, int64 beg, int64 end); +import void Texts_Delete (Texts_Text T, int32 beg, int32 end); import Texts_Text Texts_ElemBase (Texts_Elem E); -import int64 Texts_ElemPos (Texts_Elem E); -import void Texts_Insert (Texts_Text T, int64 pos, Texts_Buffer B); +import int32 Texts_ElemPos (Texts_Elem E); +import void Texts_Insert (Texts_Text T, int32 pos, Texts_Buffer B); import void Texts_Load (Files_Rider *r, address *r__typ, Texts_Text T); import void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len); import void Texts_OpenBuf (Texts_Buffer B); -import void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int64 pos); -import void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int64 pos); +import void Texts_OpenReader (Texts_Reader *R, address *R__typ, Texts_Text T, int32 pos); +import void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int32 pos); import void Texts_OpenWriter (Texts_Writer *W, address *W__typ); -import int64 Texts_Pos (Texts_Reader *R, address *R__typ); +import int32 Texts_Pos (Texts_Reader *R, address *R__typ); import void Texts_Read (Texts_Reader *R, address *R__typ, CHAR *ch); import void Texts_ReadElem (Texts_Reader *R, address *R__typ); import void Texts_ReadPrevElem (Texts_Reader *R, address *R__typ); import void Texts_Recall (Texts_Buffer *B); -import void Texts_Save (Texts_Text T, int64 beg, int64 end, Texts_Buffer B); +import void Texts_Save (Texts_Text T, int32 beg, int32 end, Texts_Buffer B); import void Texts_Scan (Texts_Scanner *S, address *S__typ); import void Texts_SetColor (Texts_Writer *W, address *W__typ, int8 col); import void Texts_SetFont (Texts_Writer *W, address *W__typ, Texts_FontsFont fnt); import void Texts_SetOffset (Texts_Writer *W, address *W__typ, int8 voff); import void Texts_Store (Files_Rider *r, address *r__typ, Texts_Text T); import void Texts_Write (Texts_Writer *W, address *W__typ, CHAR ch); -import void Texts_WriteDate (Texts_Writer *W, address *W__typ, int64 t, int64 d); +import void Texts_WriteDate (Texts_Writer *W, address *W__typ, int32 t, int32 d); import void Texts_WriteElem (Texts_Writer *W, address *W__typ, Texts_Elem e); -import void Texts_WriteHex (Texts_Writer *W, address *W__typ, int64 x); +import void Texts_WriteHex (Texts_Writer *W, address *W__typ, int32 x); import void Texts_WriteInt (Texts_Writer *W, address *W__typ, int64 x, int64 n); import void Texts_WriteLn (Texts_Writer *W, address *W__typ); -import void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int32 n); +import void Texts_WriteLongReal (Texts_Writer *W, address *W__typ, LONGREAL x, int16 n); import void Texts_WriteLongRealHex (Texts_Writer *W, address *W__typ, LONGREAL x); -import void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int32 n); -import void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int32 n, int32 k); +import void Texts_WriteReal (Texts_Writer *W, address *W__typ, REAL x, int16 n); +import void Texts_WriteRealFix (Texts_Writer *W, address *W__typ, REAL x, int16 n, int16 k); import void Texts_WriteRealHex (Texts_Writer *W, address *W__typ, REAL x); import void Texts_WriteString (Texts_Writer *W, address *W__typ, CHAR *s, LONGINT s__len); import void *Texts__init(void); diff --git a/bootstrap/windows-88/Vishap.c b/bootstrap/windows-88/Vishap.c index 5c6cada1..1ec89e33 100644 --- a/bootstrap/windows-88/Vishap.c +++ b/bootstrap/windows-88/Vishap.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspamSf */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -25,7 +25,7 @@ static CHAR Vishap_mname[256]; export void Vishap_Module (BOOLEAN *done); static void Vishap_PropagateElementaryTypeSizes (void); export void Vishap_Translate (void); -static void Vishap_Trap (int32 sig); +static void Vishap_Trap (int16 sig); void Vishap_Module (BOOLEAN *done) @@ -42,22 +42,22 @@ void Vishap_Module (BOOLEAN *done) OPC_Init(); OPV_Module(p); if (OPM_noerr) { - if ((__IN(10, OPM_opt, 64) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { + if ((__IN(10, OPM_opt, 32) && __STRCMP(OPM_modName, "SYSTEM") != 0)) { OPM_DeleteNewSym(); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" Main program.", 16); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } } else { if (new) { - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"32m", 4); } OPM_LogWStr((CHAR*)" New symbol file.", 19); - if (!__IN(16, OPM_opt, 64)) { + if (!__IN(16, OPM_opt, 32)) { vt100_SetAttr((CHAR*)"0m", 3); } OPM_RegisterNewSym(); @@ -111,17 +111,17 @@ void Vishap_Translate (void) OPM_LogWLn(); Platform_Exit(1); } - if (!__IN(13, OPM_opt, 64)) { - if (__IN(14, OPM_opt, 64)) { + if (!__IN(13, OPM_opt, 32)) { + if (__IN(14, OPM_opt, 32)) { extTools_Assemble(OPM_modName, 32); } else { - if (!__IN(10, OPM_opt, 64)) { + if (!__IN(10, OPM_opt, 32)) { extTools_Assemble(OPM_modName, 32); Strings_Append((CHAR*)" ", 2, (void*)modulesobj, 2048); Strings_Append(OPM_modName, 32, (void*)modulesobj, 2048); Strings_Append((CHAR*)".o", 3, (void*)modulesobj, 2048); } else { - extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 64), modulesobj, 2048); + extTools_LinkMain((void*)OPM_modName, 32, __IN(15, OPM_opt, 32), modulesobj, 2048); } } } @@ -129,7 +129,7 @@ void Vishap_Translate (void) } } -static void Vishap_Trap (int32 sig) +static void Vishap_Trap (int16 sig) { Heap_FINALL(); if (sig == 3) { diff --git a/bootstrap/windows-88/errors.c b/bootstrap/windows-88/errors.c index 4bb09433..0a40d5e9 100644 --- a/bootstrap/windows-88/errors.c +++ b/bootstrap/windows-88/errors.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" diff --git a/bootstrap/windows-88/extTools.c b/bootstrap/windows-88/extTools.c index d6bc2194..8be0b63d 100644 --- a/bootstrap/windows-88/extTools.c +++ b/bootstrap/windows-88/extTools.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Configuration.h" @@ -22,10 +22,10 @@ static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGIN static void extTools_execute (CHAR *title, LONGINT title__len, CHAR *cmd, LONGINT cmd__len) { - int32 r, status, exitcode; + int16 r, status, exitcode; __DUP(title, title__len, CHAR); __DUP(cmd, cmd__len, CHAR); - if (__IN(18, OPM_opt, 64)) { + if (__IN(18, OPM_opt, 32)) { Console_String(title, title__len); Console_String(cmd, cmd__len); Console_Ln(); diff --git a/bootstrap/windows-88/vt100.c b/bootstrap/windows-88/vt100.c index bb55d599..4f6a6c9d 100644 --- a/bootstrap/windows-88/vt100.c +++ b/bootstrap/windows-88/vt100.c @@ -1,8 +1,8 @@ /* voc 1.95 [2016/09/23] for gcc LP64 on cygwin xtspaSfF */ -#define INTEGER int32 -#define LONGINT int64 -#define SET uint64 +#define INTEGER int16 +#define LONGINT int32 +#define SET uint32 #include "SYSTEM.h" #include "Console.h" @@ -13,36 +13,36 @@ export CHAR vt100_CSI[5]; static CHAR vt100_tmpstr[32]; -export void vt100_CHA (int32 n); -export void vt100_CNL (int32 n); -export void vt100_CPL (int32 n); -export void vt100_CUB (int32 n); -export void vt100_CUD (int32 n); -export void vt100_CUF (int32 n); -export void vt100_CUP (int32 n, int32 m); -export void vt100_CUU (int32 n); +export void vt100_CHA (int16 n); +export void vt100_CNL (int16 n); +export void vt100_CPL (int16 n); +export void vt100_CUB (int16 n); +export void vt100_CUD (int16 n); +export void vt100_CUF (int16 n); +export void vt100_CUP (int16 n, int16 m); +export void vt100_CUU (int16 n); export void vt100_DECTCEMh (void); export void vt100_DECTCEMl (void); -export void vt100_DSR (int32 n); -export void vt100_ED (int32 n); -export void vt100_EL (int32 n); -static void vt100_EscSeq (int32 n, CHAR *letter, LONGINT letter__len); +export void vt100_DSR (int16 n); +export void vt100_ED (int16 n); +export void vt100_EL (int16 n); +static void vt100_EscSeq (int16 n, CHAR *letter, LONGINT letter__len); static void vt100_EscSeq0 (CHAR *letter, LONGINT letter__len); -static void vt100_EscSeq2 (int32 n, int32 m, CHAR *letter, LONGINT letter__len); -static void vt100_EscSeqSwapped (int32 n, CHAR *letter, LONGINT letter__len); -export void vt100_HVP (int32 n, int32 m); -export void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len); +static void vt100_EscSeq2 (int16 n, int16 m, CHAR *letter, LONGINT letter__len); +static void vt100_EscSeqSwapped (int16 n, CHAR *letter, LONGINT letter__len); +export void vt100_HVP (int16 n, int16 m); +export void vt100_IntToStr (int32 int_, CHAR *str, LONGINT str__len); export void vt100_RCP (void); -static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int32 start, int32 end); +static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int16 start, int16 end); export void vt100_SCP (void); -export void vt100_SD (int32 n); -export void vt100_SGR (int32 n); -export void vt100_SGR2 (int32 n, int32 m); -export void vt100_SU (int32 n); +export void vt100_SD (int16 n); +export void vt100_SGR (int16 n); +export void vt100_SGR2 (int16 n, int16 m); +export void vt100_SU (int16 n); export void vt100_SetAttr (CHAR *attr, LONGINT attr__len); -static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int32 start, int32 end) +static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int16 start, int16 end) { CHAR h; while (start < end) { @@ -54,15 +54,15 @@ static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int32 start, int32 end) } } -void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len) +void vt100_IntToStr (int32 int_, CHAR *str, LONGINT str__len) { CHAR b[21]; - int32 s, e; + int16 s, e; int8 maxLength; - maxLength = 20; - if (int_ == (-9223372036854775807-1)) { - __MOVE("-9223372036854775808", b, 21); - e = 20; + maxLength = 11; + if (int_ == (-2147483647-1)) { + __MOVE("-2147483648", b, 12); + e = 11; } else { if (int_ < 0) { b[0] = '-'; @@ -73,7 +73,7 @@ void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len) } e = s; do { - b[__X(e, 21)] = (CHAR)(__MOD(int_, 10) + 48); + b[__X(e, 21)] = (CHAR)((int)__MOD(int_, 10) + 48); int_ = __DIV(int_, 10); e += 1; } while (!(int_ == 0)); @@ -93,7 +93,7 @@ static void vt100_EscSeq0 (CHAR *letter, LONGINT letter__len) __DEL(letter); } -static void vt100_EscSeq (int32 n, CHAR *letter, LONGINT letter__len) +static void vt100_EscSeq (int16 n, CHAR *letter, LONGINT letter__len) { CHAR nstr[2]; CHAR cmd[7]; @@ -106,7 +106,7 @@ static void vt100_EscSeq (int32 n, CHAR *letter, LONGINT letter__len) __DEL(letter); } -static void vt100_EscSeqSwapped (int32 n, CHAR *letter, LONGINT letter__len) +static void vt100_EscSeqSwapped (int16 n, CHAR *letter, LONGINT letter__len) { CHAR nstr[2]; CHAR cmd[7]; @@ -119,7 +119,7 @@ static void vt100_EscSeqSwapped (int32 n, CHAR *letter, LONGINT letter__len) __DEL(letter); } -static void vt100_EscSeq2 (int32 n, int32 m, CHAR *letter, LONGINT letter__len) +static void vt100_EscSeq2 (int16 n, int16 m, CHAR *letter, LONGINT letter__len) { CHAR nstr[5], mstr[5]; CHAR cmd[12]; @@ -135,82 +135,82 @@ static void vt100_EscSeq2 (int32 n, int32 m, CHAR *letter, LONGINT letter__len) __DEL(letter); } -void vt100_CUU (int32 n) +void vt100_CUU (int16 n) { vt100_EscSeq(n, (CHAR*)"A", 2); } -void vt100_CUD (int32 n) +void vt100_CUD (int16 n) { vt100_EscSeq(n, (CHAR*)"B", 2); } -void vt100_CUF (int32 n) +void vt100_CUF (int16 n) { vt100_EscSeq(n, (CHAR*)"C", 2); } -void vt100_CUB (int32 n) +void vt100_CUB (int16 n) { vt100_EscSeq(n, (CHAR*)"D", 2); } -void vt100_CNL (int32 n) +void vt100_CNL (int16 n) { vt100_EscSeq(n, (CHAR*)"E", 2); } -void vt100_CPL (int32 n) +void vt100_CPL (int16 n) { vt100_EscSeq(n, (CHAR*)"F", 2); } -void vt100_CHA (int32 n) +void vt100_CHA (int16 n) { vt100_EscSeq(n, (CHAR*)"G", 2); } -void vt100_CUP (int32 n, int32 m) +void vt100_CUP (int16 n, int16 m) { vt100_EscSeq2(n, m, (CHAR*)"H", 2); } -void vt100_ED (int32 n) +void vt100_ED (int16 n) { vt100_EscSeq(n, (CHAR*)"J", 2); } -void vt100_EL (int32 n) +void vt100_EL (int16 n) { vt100_EscSeq(n, (CHAR*)"K", 2); } -void vt100_SU (int32 n) +void vt100_SU (int16 n) { vt100_EscSeq(n, (CHAR*)"S", 2); } -void vt100_SD (int32 n) +void vt100_SD (int16 n) { vt100_EscSeq(n, (CHAR*)"T", 2); } -void vt100_HVP (int32 n, int32 m) +void vt100_HVP (int16 n, int16 m) { vt100_EscSeq2(n, m, (CHAR*)"f", 2); } -void vt100_SGR (int32 n) +void vt100_SGR (int16 n) { vt100_EscSeq(n, (CHAR*)"m", 2); } -void vt100_SGR2 (int32 n, int32 m) +void vt100_SGR2 (int16 n, int16 m) { vt100_EscSeq2(n, m, (CHAR*)"m", 2); } -void vt100_DSR (int32 n) +void vt100_DSR (int16 n) { vt100_EscSeq(6, (CHAR*)"n", 2); } diff --git a/bootstrap/windows-88/vt100.h b/bootstrap/windows-88/vt100.h index 2bc7d18f..94f8add4 100644 --- a/bootstrap/windows-88/vt100.h +++ b/bootstrap/windows-88/vt100.h @@ -9,27 +9,27 @@ import CHAR vt100_CSI[5]; -import void vt100_CHA (int32 n); -import void vt100_CNL (int32 n); -import void vt100_CPL (int32 n); -import void vt100_CUB (int32 n); -import void vt100_CUD (int32 n); -import void vt100_CUF (int32 n); -import void vt100_CUP (int32 n, int32 m); -import void vt100_CUU (int32 n); +import void vt100_CHA (int16 n); +import void vt100_CNL (int16 n); +import void vt100_CPL (int16 n); +import void vt100_CUB (int16 n); +import void vt100_CUD (int16 n); +import void vt100_CUF (int16 n); +import void vt100_CUP (int16 n, int16 m); +import void vt100_CUU (int16 n); import void vt100_DECTCEMh (void); import void vt100_DECTCEMl (void); -import void vt100_DSR (int32 n); -import void vt100_ED (int32 n); -import void vt100_EL (int32 n); -import void vt100_HVP (int32 n, int32 m); -import void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len); +import void vt100_DSR (int16 n); +import void vt100_ED (int16 n); +import void vt100_EL (int16 n); +import void vt100_HVP (int16 n, int16 m); +import void vt100_IntToStr (int32 int_, CHAR *str, LONGINT str__len); import void vt100_RCP (void); import void vt100_SCP (void); -import void vt100_SD (int32 n); -import void vt100_SGR (int32 n); -import void vt100_SGR2 (int32 n, int32 m); -import void vt100_SU (int32 n); +import void vt100_SD (int16 n); +import void vt100_SGR (int16 n); +import void vt100_SGR2 (int16 n, int16 m); +import void vt100_SU (int16 n); import void vt100_SetAttr (CHAR *attr, LONGINT attr__len); import void *vt100__init(void); diff --git a/makefile b/makefile index 37fa64a0..491b28f1 100644 --- a/makefile +++ b/makefile @@ -264,9 +264,9 @@ bootstrap: configuration rm -rf bootstrap/* make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=2 ADRSIZE=4 ALIGNMENT=4 PLATFORM=unix BUILDDIR=bootstrap/unix-44 && rm bootstrap/unix-44/*.sym make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=2 ADRSIZE=4 ALIGNMENT=8 PLATFORM=unix BUILDDIR=bootstrap/unix-48 && rm bootstrap/unix-48/*.sym - make -f src/tools/make/vishap.make -s translate MODEL=-OV INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=unix BUILDDIR=bootstrap/unix-88 && rm bootstrap/unix-88/*.sym + make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=unix BUILDDIR=bootstrap/unix-88 && rm bootstrap/unix-88/*.sym make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=2 ADRSIZE=4 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-48 && rm bootstrap/windows-48/*.sym - make -f src/tools/make/vishap.make -s translate MODEL=-OV INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-88 && rm bootstrap/windows-88/*.sym + make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-88 && rm bootstrap/windows-88/*.sym cp src/system/*.[ch] bootstrap @@ -274,9 +274,9 @@ bootstrapunclean: rm -rf bootstrap/* make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=2 ADRSIZE=4 ALIGNMENT=4 PLATFORM=unix BUILDDIR=bootstrap/unix-44 && rm bootstrap/unix-44/*.sym make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=2 ADRSIZE=4 ALIGNMENT=8 PLATFORM=unix BUILDDIR=bootstrap/unix-48 && rm bootstrap/unix-48/*.sym - make -f src/tools/make/vishap.make -s translate MODEL=-OV INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=unix BUILDDIR=bootstrap/unix-88 && rm bootstrap/unix-88/*.sym + make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=unix BUILDDIR=bootstrap/unix-88 && rm bootstrap/unix-88/*.sym make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=2 ADRSIZE=4 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-48 && rm bootstrap/windows-48/*.sym - make -f src/tools/make/vishap.make -s translate MODEL=-OV INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-88 && rm bootstrap/windows-88/*.sym + make -f src/tools/make/vishap.make -s translate MODEL=-O2 INTSIZE=4 ADRSIZE=8 ALIGNMENT=8 PLATFORM=windows BUILDDIR=bootstrap/windows-88 && rm bootstrap/windows-88/*.sym cp src/system/*.[ch] bootstrap diff --git a/src/compiler/OPB.Mod b/src/compiler/OPB.Mod index 408eeaeb..e1ed3aa0 100644 --- a/src/compiler/OPB.Mod +++ b/src/compiler/OPB.Mod @@ -1098,7 +1098,9 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *) IF (x^.class = OPT.Ntype) OR (x^.class = OPT.Nproc) THEN err(126); p^.typ := OPT.notyp ELSE IF x^.typ # p^.typ THEN - IF (x^.class = OPT.Nconst) & (f = OPT.Int) THEN Convert(x, p^.typ) + IF (f = OPT.Int) + & ( (x^.class = OPT.Nconst) + OR (p.typ.form = OPT.Int) & (x.typ.size <= p.typ.size)) THEN Convert(x, p^.typ) ELSE err(111) END END ; diff --git a/src/compiler/OPM.cmdln.Mod b/src/compiler/OPM.cmdln.Mod index b3298aed..ded87d02 100644 --- a/src/compiler/OPM.cmdln.Mod +++ b/src/compiler/OPM.cmdln.Mod @@ -871,17 +871,9 @@ BEGIN AddressSize := Configuration.addressSize; Alignment := Configuration.alignment; - IF Configuration.intsize = 2 THEN - (* Original Oberon-2 implementation sizes (-O2) *) - ShortintSize := 1; - IntegerSize := 2; - LongintSize := 4; - SetSize := 4; - ELSE - (* Legacy Vishap 64 bit build sizes (-OV) *) - ShortintSize := 1; - IntegerSize := 4; - LongintSize := 8; - SetSize := 8; - END + (* Default type size model is that of the original Oberon-2 implementation (-O2) *) + ShortintSize := 1; + IntegerSize := 2; + LongintSize := 4; + SetSize := 4 END OPM. diff --git a/src/library/s3/ethMD5.Mod b/src/library/s3/ethMD5.Mod index 07a605cb..4d33a026 100644 --- a/src/library/s3/ethMD5.Mod +++ b/src/library/s3/ethMD5.Mod @@ -41,7 +41,8 @@ under a public-key cryptosystem such as RSA. *) PROCEDURE ByteReverse(VAR in: ARRAY OF SYSTEM.BYTE; VAR out: ARRAY OF LONGINT; longs: LONGINT); VAR - adr, t, i: LONGINT; + adr: SYSTEM.ADDRESS; + t, i: LONGINT; bytes: ARRAY 4 OF CHAR; BEGIN adr := SYSTEM.ADR(in[0]); i := 0; diff --git a/src/library/s3/ethZlibBuffers.Mod b/src/library/s3/ethZlibBuffers.Mod index 9db0736c..f484a980 100644 --- a/src/library/s3/ethZlibBuffers.Mod +++ b/src/library/s3/ethZlibBuffers.Mod @@ -3,8 +3,7 @@ Refer to the "General ETH Oberon System Source License" contract available at: h MODULE ethZlibBuffers; (** Stefan Walthert **) -IMPORT - SYSTEM; +IMPORT SYSTEM; (* should be portable even if SYSTEM is imported: - PUT and GET only with byte sized operands @@ -13,13 +12,14 @@ IMPORT TYPE (** input/output buffer **) - Address = LONGINT; + Address = SYSTEM.ADDRESS; Buffer* = RECORD - avail-: LONGINT; (** number of bytes that can be produced/consumed **) - size-: LONGINT; (** total number of bytes in buffer memory **) - totalOut-, totalIn-: LONGINT; (** total number of bytes produced/consumed **) - next: Address; (* address of next byte to produce/consume **) - adr: Address; (* buffer memory *) + avail-: LONGINT; (** number of bytes that can be produced/consumed **) + size-: LONGINT; (** total number of bytes in buffer memory **) + totalOut-: LONGINT; (** total number of bytes produced **) + totalIn-: LONGINT; (** total number of bytes consumed **) + next: Address; (* address of next byte to produce/consume **) + adr: Address; (* buffer memory *) END; @@ -50,9 +50,9 @@ PROCEDURE ReadBytes* (VAR buf: Buffer; VAR dst: ARRAY OF CHAR; offset, len: LONG BEGIN ASSERT((0 <= offset) & (0 < len) & (offset + len <= LEN(dst)) & (len <= buf.avail), 100); SYSTEM.MOVE(buf.next, SYSTEM.ADR(dst[offset]), len); - INC(buf.next, len); DEC(buf.avail, len); INC(buf.totalIn, len) + INC(buf.next, len); DEC(buf.avail, len); INC(buf.totalIn, len) END ReadBytes; - + (** write byte into (output) buffer **) PROCEDURE Write* (VAR buf: Buffer; ch: CHAR); BEGIN @@ -89,7 +89,7 @@ PROCEDURE Rewrite* (VAR buf: Buffer); BEGIN buf.next := buf.adr; buf.avail := buf.size END Rewrite; - + (** fill input buffer with new bytes to consume **) PROCEDURE Fill* (VAR buf: Buffer; VAR src: ARRAY OF CHAR; offset, size: LONGINT); BEGIN diff --git a/src/library/ulm/ulmIO.Mod b/src/library/ulm/ulmIO.Mod index 87ff46fa..04bc3bcb 100644 --- a/src/library/ulm/ulmIO.Mod +++ b/src/library/ulm/ulmIO.Mod @@ -1,6 +1,6 @@ MODULE ulmIO; - IMPORT SYS := ulmSYSTEM, SYSTEM; + IMPORT SYS := ulmSYSTEM, SYSTEM, Platform; CONST nl = 0AX; @@ -118,6 +118,7 @@ MODULE ulmIO; (* ========================= terminal ============================ *) +(* PROCEDURE ReadChar(VAR ch: CHAR) : BOOLEAN; CONST read = 3; (*VAR r0, r1: INTEGER;*) @@ -125,7 +126,17 @@ MODULE ulmIO; BEGIN RETURN SYS.UNIXCALL(read, r0, r1, 0, SYSTEM.ADR(ch), 1) & (r0 > 0) END ReadChar; +*) + PROCEDURE ReadChar(VAR ch: CHAR) : BOOLEAN; + (* Read one byte, returning success flag *) + VAR error: Platform.ErrorCode; readcount: LONGINT; + BEGIN + error := Platform.ReadBuf(Platform.StdIn, ch, readcount); + RETURN readcount > 0 + END ReadChar; + +(* PROCEDURE WriteChar(ch: CHAR) : BOOLEAN; CONST write = 4; (*VAR r0, r1: INTEGER;*) @@ -133,6 +144,13 @@ MODULE ulmIO; BEGIN RETURN SYS.UNIXCALL(write, r0, r1, 1, SYSTEM.ADR(ch), 1) END WriteChar; +*) + + PROCEDURE WriteChar(ch: CHAR) : BOOLEAN; + (* Write one byte, returning success flag *) + BEGIN + RETURN Platform.Write(Platform.StdOut, SYSTEM.ADR(ch), 1) = 0 + END WriteChar; PROCEDURE Read*(VAR ch: CHAR); BEGIN diff --git a/src/library/ulm/ulmSYSTEM.Mod b/src/library/ulm/ulmSYSTEM.Mod index bbd054b8..ece334a7 100644 --- a/src/library/ulm/ulmSYSTEM.Mod +++ b/src/library/ulm/ulmSYSTEM.Mod @@ -49,6 +49,7 @@ TYPE pchar = POINTER TO ARRAY 1 OF CHAR; RETURN oldflag; END TAS; +(* PROCEDURE UNIXCALL*(syscall: LONGINT; VAR d0, d1: LONGINT; (* in ulm version both LONGINT and INTEGER are 4 byte size *) arg1, arg2, arg3: LONGINT) : BOOLEAN; VAR @@ -122,7 +123,7 @@ TYPE pchar = POINTER TO ARRAY 1 OF CHAR; END END UNIXCALL; - +*) PROCEDURE UNIXFORK(VAR pid: LONGINT) : BOOLEAN; BEGIN @@ -135,8 +136,7 @@ TYPE pchar = POINTER TO ARRAY 1 OF CHAR; END UNIXSIGNAL; - PROCEDURE WMOVE*(from, to, n : LONGINT); - VAR l : LONGINT; + PROCEDURE WMOVE*(from, to, n : SYSTEM.ADDRESS); BEGIN SYSTEM.MOVE(from, to, n); END WMOVE; diff --git a/src/library/v4/Args.Mod b/src/library/v4/Args.Mod index 0d4ff925..a196b5c5 100644 --- a/src/library/v4/Args.Mod +++ b/src/library/v4/Args.Mod @@ -3,7 +3,7 @@ MODULE Args; (* jt, 8.12.94 *) (* command line argument handling for voc (jet backend) *) - IMPORT Platform; + IMPORT Platform, SYSTEM; TYPE ArgPtr = POINTER TO ARRAY 1024 OF CHAR; @@ -11,17 +11,17 @@ MODULE Args; (* jt, 8.12.94 *) VAR argc-: LONGINT; - argv-: LONGINT; + argv-: SYSTEM.ADDRESS; PROCEDURE Get* (n: INTEGER; VAR val: ARRAY OF CHAR); BEGIN Platform.GetArg(n, val) END Get; PROCEDURE GetInt*(n: INTEGER; VAR val: LONGINT); BEGIN Platform.GetIntArg(n, val) END GetInt; PROCEDURE Pos* (s: ARRAY OF CHAR): INTEGER; BEGIN RETURN Platform.ArgPos(s) END Pos; -PROCEDURE GetEnv*(var: ARRAY OF CHAR; VAR val: ARRAY OF CHAR); +PROCEDURE GetEnv*(var: ARRAY OF CHAR; VAR val: ARRAY OF CHAR); BEGIN Platform.GetEnv(var, val) END GetEnv; -PROCEDURE getEnv*(var: ARRAY OF CHAR; VAR val: ARRAY OF CHAR): BOOLEAN; +PROCEDURE getEnv*(var: ARRAY OF CHAR; VAR val: ARRAY OF CHAR): BOOLEAN; BEGIN RETURN Platform.getEnv(var, val) END getEnv; diff --git a/src/library/v4/Printer.Mod b/src/library/v4/Printer.Mod index 39b06c0c..803b567f 100644 --- a/src/library/v4/Printer.Mod +++ b/src/library/v4/Printer.Mod @@ -87,7 +87,7 @@ MODULE Printer; (*UNIX version: JT 11.5.90, RC 2.7.93, JS 29.4.94, JT 14.4.95 VAR family: ARRAY 7 OF CHAR; BEGIN COPY(fname, family); - Ch(fontR, "/"); Str(fontR, fname); + Ch(fontR, "/"); Str(fontR, fname); IF family = "Syntax" THEN Str(fontR, " DefineSMapFont") ELSE Str(fontR, " DefineMapFont") END; Ln(fontR); Ln(fontR); END SetMappedFont; @@ -161,7 +161,7 @@ MODULE Printer; (*UNIX version: JT 11.5.90, RC 2.7.93, JS 29.4.94, JT 14.4.95 | 92: Str(fontR, "backslash") | 93: Str(fontR, "bracketright") | 94: Str(fontR, "arrowup") - | 95: Str(fontR, "underscore") + | 95: Str(fontR, "underscore") | 96: Str(fontR, "grave") | 97..122: Ch(fontR, CHR(m)) | 123: Str(fontR, "braceleft") @@ -205,8 +205,8 @@ MODULE Printer; (*UNIX version: JT 11.5.90, RC 2.7.93, JS 29.4.94, JT 14.4.95 Str(fontR, "% Conversion of the Oberon font "); Str(fontR, fd.name); Ln(fontR); Files.Read(R, ch); IF ch = fontFileId THEN - Files.Read(R, ch); Str(fontR, "% abstraction: "); Int(fontR, ORD(ch)); - Files.Read(R, ch); Str(fontR, ", family: "); Ch(fontR, ch); + Files.Read(R, ch); Str(fontR, "% abstraction: "); Int(fontR, ORD(ch)); + Files.Read(R, ch); Str(fontR, ", family: "); Ch(fontR, ch); Files.Read(R, ch); Str(fontR, ", variant: "); Int(fontR, ORD(ch)); Ln(fontR); Files.ReadInt(R, height); Str(fontR, "% height: "); Int(fontR, height); Ln(fontR); Ln(fontR); Files.ReadInt(R, minX); Files.ReadInt(R, maxX); @@ -223,7 +223,7 @@ MODULE Printer; (*UNIX version: JT 11.5.90, RC 2.7.93, JS 29.4.94, JT 14.4.95 Str(fontR, "/FontMatrix [ 72 "); Int(fontR, pRes); Str(fontR, " div "); Str(fontR, " .24 div 0 0 "); Str(fontR, "72 "); Int(fontR, pRes); Str(fontR, " div "); Str(fontR, " .24 div 0 0"); Str(fontR, "] def"); Ln(fontR); - Str(fontR, "/FontBBox ["); + Str(fontR, "/FontBBox ["); Int(fontR, minX); Ch(fontR, " "); Int(fontR, minY); Ch(fontR, " "); Int(fontR, maxX); Ch(fontR, " "); @@ -339,7 +339,7 @@ END; Error("file not found", headerFileName) END END Open; - + PROCEDURE UseListFont*(VAR name: ARRAY OF CHAR); BEGIN COPY(name, listFont); curFont := -1 @@ -368,7 +368,7 @@ END; IF fname = listFont THEN fontname := "Courier8.Scn.Fnt" ELSE COPY(fname, fontname) END ; IF (curFont < 0) OR (fontTable[curFont].name # fontname) THEN COPY(fontname, fontTable[fontIndex+1].name); - i := 0; WHILE i < 8 DO fontTable[fontIndex+1].used[i] := {}; INC(i) END; + i := 0; WHILE i < 8 DO fontTable[fontIndex+1].used[i] := {}; INC(i) END; fNo := 0; WHILE fontTable[fNo].name # fontname DO INC(fNo) END; IF fNo > fontIndex THEN (* DefineFont(fontname); *) fontIndex := fNo END; @@ -394,7 +394,7 @@ END; END; Str(bodyR, ") s"); Ln(bodyR) END ContString; - + PROCEDURE String*(x, y: INTEGER; VAR s, fname: ARRAY OF CHAR); BEGIN Int(bodyR, x); Ch(bodyR, " "); @@ -410,7 +410,7 @@ END; Int(bodyR, col); Str(bodyR, " b"); Ln(bodyR); END ReplPattern; - PROCEDURE Picture*(x, y, w, h, mode: INTEGER; adr: LONGINT); + PROCEDURE Picture*(x, y, w, h, mode: INTEGER; adr: SYSTEM.ADDRESS); VAR n, i, v: INTEGER; ch: CHAR; BEGIN Int(bodyR, x); Ch(bodyR, " "); @@ -517,7 +517,7 @@ END; a[i] := 2.0*b[i-1] + hn; d[i] := d1 + dn; w[i] := 1.0; i := 0; WHILE i < n-2 DO c[i] := c[i]/a[i]; a[i+1] := a[i+1] - c[i]*b[i]; INC(i) END ; - SolveTriDiag(a, b, c, d, n-1); SolveTriDiag(a, b, c, w, n-1); + SolveTriDiag(a, b, c, d, n-1); SolveTriDiag(a, b, c, w, n-1); d1 := (d[0] + d[i])/(w[0] + w[i] + x[i+1] - x[i]); i := 0; WHILE i < n-1 DO d[i] := d[i] - d1*w[i]; INC(i) END ; d[i] := d[0] @@ -582,7 +582,7 @@ END; END Spline; PROCEDURE Page*(nofcopies: INTEGER); - BEGIN + BEGIN curR := 0; curG := 0; curB := 0; curFont := -1; INC(pno); ppos := Files.Pos(bodyR); PrintCopies := nofcopies; IF PrintMode[1] # ":" THEN @@ -639,7 +639,7 @@ END; IF PrinterName # "none" THEN Files.Write(printR, 4X) (*force reset postscript*) END ; Files.Register(printF); IF PrinterName # "none" THEN - cmd := "lp -c -s "; + cmd := "lp -c -s "; IF PrinterName # "Pluto" THEN Append(cmd, "-d "); Append(cmd, PrinterName) END ; Append(cmd, " "); Append(cmd, printFileName); i := Platform.System(cmd); diff --git a/src/system/Platformunix.Mod b/src/system/Platformunix.Mod index f514c9cf..2a908c99 100644 --- a/src/system/Platformunix.Mod +++ b/src/system/Platformunix.Mod @@ -369,7 +369,7 @@ END Size; PROCEDURE -readfile (fd: LONGINT; p: SYSTEM.ADDRESS; l: LONGINT): LONGINT -"read(fd, (void*)(address)(p), l)"; +"(LONGINT)read(fd, (void*)(address)(p), l)"; PROCEDURE Read*(h: FileHandle; p: SYSTEM.ADDRESS; l: LONGINT; VAR n: LONGINT): ErrorCode; BEGIN @@ -388,7 +388,7 @@ END ReadBuf; PROCEDURE -writefile(fd: LONGINT; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS): SYSTEM.ADDRESS "write(fd, (void*)(address)(p), l)"; -PROCEDURE Write*(h: FileHandle; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS): ErrorCode; +PROCEDURE Write*(h: FileHandle; p: SYSTEM.ADDRESS; l: LONGINT): ErrorCode; VAR written: SYSTEM.ADDRESS; BEGIN written := writefile(h, p, l); diff --git a/src/system/Platformwindows.Mod b/src/system/Platformwindows.Mod index a81507d9..f91415c5 100644 --- a/src/system/Platformwindows.Mod +++ b/src/system/Platformwindows.Mod @@ -25,7 +25,7 @@ TYPE EnvPtr = POINTER TO ARRAY 1024 OF CHAR; ArgPtr = POINTER TO ARRAY 1024 OF CHAR; ArgVec = POINTER TO ARRAY 1024 OF ArgPtr; - ArgVecPtr = POINTER TO ARRAY 1 OF LONGINT; + ArgVecPtr = POINTER TO ARRAY 1 OF SYSTEM.ADDRESS; VAR @@ -412,31 +412,29 @@ BEGIN END Size; -PROCEDURE -readfile (fd: LONGINT; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS; VAR n: SYSTEM.ADDRESS): INTEGER +PROCEDURE -readfile (fd: LONGINT; p: SYSTEM.ADDRESS; l: LONGINT; VAR n: SYSTEM.INT32): INTEGER "(INTEGER)ReadFile((HANDLE)fd, (void*)p, (DWORD)l, (DWORD*)n, 0)"; -PROCEDURE Read*(h: FileHandle; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS; VAR n: SYSTEM.ADDRESS): ErrorCode; -VAR result: INTEGER; +PROCEDURE Read*(h: FileHandle; p: SYSTEM.ADDRESS; l: LONGINT; VAR n: LONGINT): ErrorCode; +VAR result: INTEGER; lengthread: SYSTEM.INT32; BEGIN - n := 0; (* Clear n because readfile takes a LONGINT but only updates the bottom 32 bits *) - result := readfile(h, p, l, n); - IF result = 0 THEN n := 0; RETURN err() ELSE RETURN 0 END + result := readfile(h, p, l, lengthread); + IF result = 0 THEN n := 0; RETURN err() ELSE n := lengthread; RETURN 0 END END Read; -PROCEDURE ReadBuf*(h: FileHandle; VAR b: ARRAY OF SYSTEM.BYTE; VAR n: SYSTEM.ADDRESS): ErrorCode; -VAR result: INTEGER; +PROCEDURE ReadBuf*(h: FileHandle; VAR b: ARRAY OF SYSTEM.BYTE; VAR n: LONGINT): ErrorCode; +VAR result: INTEGER; lengthread: SYSTEM.INT32; BEGIN - n := 0; (* Clear n because readfile takes a SYSTEM.ADDRESS but only updates the bottom 32 bits *) - result := readfile(h, SYSTEM.ADR(b), LEN(b), n); - IF result = 0 THEN n := 0; RETURN err() ELSE RETURN 0 END + result := readfile(h, SYSTEM.ADR(b), LEN(b), lengthread); + IF result = 0 THEN n := 0; RETURN err() ELSE n := lengthread; RETURN 0 END END ReadBuf; -PROCEDURE -writefile(fd: LONGINT; p: SYSTEM.ADDRESS; l: SYSTEM.ADDRESS): INTEGER +PROCEDURE -writefile(fd: LONGINT; p: SYSTEM.ADDRESS; l: LONGINT): INTEGER "(INTEGER)WriteFile((HANDLE)fd, (void*)(p), (DWORD)l, 0,0)"; -PROCEDURE Write*(h: FileHandle; p: LONGINT; l: LONGINT): ErrorCode; +PROCEDURE Write*(h: FileHandle; p: SYSTEM.ADDRESS; l: LONGINT): ErrorCode; BEGIN IF writefile(h, p, l) = 0 THEN RETURN err() ELSE RETURN 0 END END Write; diff --git a/src/tools/make/vishap.make b/src/tools/make/vishap.make index 260ca57c..b863944a 100644 --- a/src/tools/make/vishap.make +++ b/src/tools/make/vishap.make @@ -20,7 +20,7 @@ FLAVOUR = $(OS).$(DATAMODEL).$(COMPILER) BUILDDIR = build/$(FLAVOUR) VISHAP = $(ONAME)$(BINEXT) -#MODEL=-O2 # Override model - build everything as S8,I16,L32. +MODEL=-O2 # Override model - build everything as S8,I16,L32.