Moving to config independent types stage 1 - generate intxx types.

This commit is contained in:
David Brown 2016-09-01 14:14:06 +01:00
parent 159f5a3d80
commit ee8342ef0d
168 changed files with 6673 additions and 6565 deletions

View file

@ -4,14 +4,14 @@
static CHAR Console_line[128];
static INTEGER 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 (LONGINT i);
export void Console_Int (LONGINT i, LONGINT n);
export void Console_Hex (int32 i);
export void Console_Int (int32 i, int32 n);
export void Console_Ln (void);
export void Console_Read (CHAR *ch);
export void Console_ReadLine (CHAR *line, LONGINT line__len);
@ -20,7 +20,7 @@ export void Console_String (CHAR *s, LONGINT s__len);
void Console_Flush (void)
{
INTEGER error;
int16 error;
error = Platform_Write(Platform_StdOut, (SYSTEM_ADRINT)Console_line, Console_pos);
Console_pos = 0;
}
@ -39,7 +39,7 @@ void Console_Char (CHAR ch)
void Console_String (CHAR *s, LONGINT s__len)
{
INTEGER i;
int16 i;
__DUP(s, s__len, CHAR);
i = 0;
while (s[__X(i, s__len)] != 0x00) {
@ -49,11 +49,11 @@ void Console_String (CHAR *s, LONGINT s__len)
__DEL(s);
}
void Console_Int (LONGINT i, LONGINT n)
void Console_Int (int32 i, int32 n)
{
CHAR s[32];
LONGINT i1, k;
if (i == __LSHL(1, 31, LONGINT)) {
int32 i1, k;
if (i == __LSHL(1, 31, int32)) {
__MOVE("8463847412", s, 11);
k = 10;
} else {
@ -95,9 +95,9 @@ void Console_Bool (BOOLEAN b)
}
}
void Console_Hex (LONGINT i)
void Console_Hex (int32 i)
{
LONGINT k, n;
int32 k, n;
k = -28;
while (k <= 0) {
n = __MASK(__ASH(i, k), -16);
@ -112,8 +112,8 @@ void Console_Hex (LONGINT i)
void Console_Read (CHAR *ch)
{
LONGINT n;
INTEGER error;
int32 n;
int16 error;
Console_Flush();
error = Platform_ReadBuf(Platform_StdIn, (void*)&*ch, 1, &n);
if (n != 1) {
@ -123,7 +123,7 @@ void Console_Read (CHAR *ch)
void Console_ReadLine (CHAR *line, LONGINT line__len)
{
LONGINT i;
int32 i;
CHAR ch;
Console_Flush();
i = 0;

View file

@ -11,8 +11,8 @@
import void Console_Bool (BOOLEAN b);
import void Console_Char (CHAR ch);
import void Console_Flush (void);
import void Console_Hex (LONGINT i);
import void Console_Int (LONGINT i, LONGINT n);
import void Console_Hex (int32 i);
import void Console_Int (int32 i, int32 n);
import void Console_Ln (void);
import void Console_Read (CHAR *ch);
import void Console_ReadLine (CHAR *line, LONGINT line__len);

View file

@ -13,7 +13,7 @@ typedef
struct Files_BufDesc {
Files_File f;
BOOLEAN chg;
LONGINT org, size;
int32 org, size;
SYSTEM_BYTE data[4096];
} Files_BufDesc;
@ -28,23 +28,23 @@ typedef
Files_FileName workName, registerName;
BOOLEAN tempFile;
Platform_FileIdentity identity;
LONGINT fd, len, pos;
int32 fd, len, pos;
Files_Buffer bufs[4];
INTEGER swapper, state;
int16 swapper, state;
Files_File next;
} Files_FileDesc;
typedef
struct Files_Rider {
LONGINT res;
int32 res;
BOOLEAN eof;
Files_Buffer buf;
LONGINT org, offset;
int32 org, offset;
} Files_Rider;
static Files_File Files_files;
static INTEGER Files_tempno;
static int16 Files_tempno;
static CHAR Files_HOME[1024];
static struct {
LONGINT len[1];
@ -57,56 +57,56 @@ export LONGINT *Files_Rider__typ;
export Files_File Files_Base (Files_Rider *r, LONGINT *r__typ);
static Files_File Files_CacheEntry (Platform_FileIdentity identity);
export void Files_ChangeDirectory (CHAR *path, LONGINT path__len, INTEGER *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, INTEGER *res);
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, INTEGER 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, LONGINT *t, LONGINT *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 LONGINT 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 LONGINT Files_Pos (Files_Rider *r, LONGINT *r__typ);
export int32 Files_Pos (Files_Rider *r, LONGINT *r__typ);
export void Files_Purge (Files_File f);
export void Files_Read (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x);
export void Files_ReadBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN *x);
export void Files_ReadByte (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len);
export void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, LONGINT n);
export void Files_ReadInt (Files_Rider *R, LONGINT *R__typ, INTEGER *x);
export void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, LONGINT *x);
export void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n);
export void Files_ReadInt (Files_Rider *R, LONGINT *R__typ, int16 *x);
export void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
export void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
export void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, LONGINT *x);
export void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x);
export void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
export void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
export void Files_ReadString (Files_Rider *R, LONGINT *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, INTEGER *res);
static void Files_ScanPath (INTEGER *pos, CHAR *dir, LONGINT dir__len);
export void Files_Set (Files_Rider *r, LONGINT *r__typ, Files_File f, LONGINT 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, LONGINT *r__typ, Files_File f, int32 pos);
export void Files_SetSearchPath (CHAR *path, LONGINT path__len);
export void Files_Write (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE x);
export void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x);
export void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, LONGINT n);
export void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, INTEGER x);
export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, LONGINT x);
export void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n);
export void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int16 x);
export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, LONGINT x);
export void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
export void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
export void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
#define Files_IdxTrap() __HALT(-1)
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, INTEGER errcode)
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int16 errcode)
{
__DUP(s, s__len, CHAR);
Console_Ln();
@ -135,7 +135,7 @@ static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, INTEGER errcode)
static void Files_MakeFileName (CHAR *dir, LONGINT dir__len, CHAR *name, LONGINT name__len, CHAR *dest, LONGINT dest__len)
{
INTEGER i, j;
int16 i, j;
__DUP(dir, dir__len, CHAR);
__DUP(name, name__len, CHAR);
i = 0;
@ -160,7 +160,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)
{
LONGINT n, i, j;
int32 n, i, j;
__DUP(finalName, finalName__len, CHAR);
Files_tempno += 1;
n = Files_tempno;
@ -212,7 +212,7 @@ static void Files_Create (Files_File f)
{
Platform_FileIdentity identity;
BOOLEAN done;
INTEGER error;
int16 error;
CHAR err[32];
if (f->fd == -1) {
if (f->state == 1) {
@ -249,7 +249,7 @@ static void Files_Create (Files_File f)
static void Files_Flush (Files_Buffer buf)
{
INTEGER error;
int16 error;
Files_File f = NIL;
if (buf->chg) {
f = buf->f;
@ -273,7 +273,7 @@ static void Files_Flush (Files_Buffer buf)
static void Files_CloseOSFile (Files_File f)
{
Files_File prev = NIL;
INTEGER error;
int16 error;
if (Files_files == f) {
Files_files = f->next;
} else {
@ -293,8 +293,8 @@ static void Files_CloseOSFile (Files_File f)
void Files_Close (Files_File f)
{
LONGINT i;
INTEGER error;
int32 i;
int16 error;
if (f->state != 1 || f->registerName[0] != 0x00) {
Files_Create(f);
i = 0;
@ -310,9 +310,9 @@ void Files_Close (Files_File f)
}
}
LONGINT Files_Length (Files_File f)
int32 Files_Length (Files_File f)
{
LONGINT _o_result;
int32 _o_result;
_o_result = f->len;
return _o_result;
}
@ -335,9 +335,9 @@ Files_File Files_New (CHAR *name, LONGINT name__len)
return _o_result;
}
static void Files_ScanPath (INTEGER *pos, CHAR *dir, LONGINT dir__len)
static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len)
{
INTEGER i;
int16 i;
CHAR ch;
i = 0;
if (Files_SearchPath == NIL) {
@ -381,7 +381,7 @@ static void Files_ScanPath (INTEGER *pos, CHAR *dir, LONGINT dir__len)
static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len)
{
BOOLEAN _o_result;
INTEGER i;
int16 i;
CHAR ch;
i = 0;
ch = name[0];
@ -397,7 +397,7 @@ static Files_File Files_CacheEntry (Platform_FileIdentity identity)
{
Files_File _o_result;
Files_File f = NIL;
INTEGER i, error;
int16 i, error;
f = Files_files;
while (f != NIL) {
if (Platform_SameFile(identity, f->identity)) {
@ -427,11 +427,11 @@ Files_File Files_Old (CHAR *name, LONGINT name__len)
{
Files_File _o_result;
Files_File f = NIL;
LONGINT fd;
INTEGER pos;
int32 fd;
int16 pos;
BOOLEAN done;
CHAR dir[256], path[256];
INTEGER error;
int16 error;
Platform_FileIdentity identity;
__DUP(name, name__len, CHAR);
if (name[0] != 0x00) {
@ -506,9 +506,9 @@ Files_File Files_Old (CHAR *name, LONGINT name__len)
void Files_Purge (Files_File f)
{
INTEGER i;
int16 i;
Platform_FileIdentity identity;
INTEGER error;
int16 error;
i = 0;
while (i < 4) {
if (f->bufs[i] != NIL) {
@ -528,27 +528,27 @@ void Files_Purge (Files_File f)
Platform_SetMTime(&f->identity, Platform_FileIdentity__typ, identity);
}
void Files_GetDate (Files_File f, LONGINT *t, LONGINT *d)
void Files_GetDate (Files_File f, int32 *t, int32 *d)
{
Platform_FileIdentity identity;
INTEGER error;
int16 error;
Files_Create(f);
error = Platform_Identify(f->fd, &identity, Platform_FileIdentity__typ);
Platform_MTimeAsClock(identity, &*t, &*d);
}
LONGINT Files_Pos (Files_Rider *r, LONGINT *r__typ)
int32 Files_Pos (Files_Rider *r, LONGINT *r__typ)
{
LONGINT _o_result;
int32 _o_result;
_o_result = (*r).org + (*r).offset;
return _o_result;
}
void Files_Set (Files_Rider *r, LONGINT *r__typ, Files_File f, LONGINT pos)
void Files_Set (Files_Rider *r, LONGINT *r__typ, Files_File f, int32 pos)
{
LONGINT org, offset, i, n;
int32 org, offset, i, n;
Files_Buffer buf = NIL;
INTEGER error;
int16 error;
if (f != NIL) {
if (pos > f->len) {
pos = f->len;
@ -608,7 +608,7 @@ void Files_Set (Files_Rider *r, LONGINT *r__typ, Files_File f, LONGINT pos)
void Files_Read (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x)
{
LONGINT offset;
int32 offset;
Files_Buffer buf = NIL;
buf = (*r).buf;
offset = (*r).offset;
@ -630,9 +630,9 @@ void Files_Read (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x)
}
}
void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, LONGINT n)
void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n)
{
LONGINT xpos, min, restInBuf, offset;
int32 xpos, min, restInBuf, offset;
Files_Buffer buf = NIL;
if (n > x__len) {
Files_IdxTrap();
@ -681,7 +681,7 @@ Files_File Files_Base (Files_Rider *r, LONGINT *r__typ)
void Files_Write (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE x)
{
Files_Buffer buf = NIL;
LONGINT offset;
int32 offset;
buf = (*r).buf;
offset = (*r).offset;
if ((*r).org != buf->org || offset >= 4096) {
@ -699,9 +699,9 @@ void Files_Write (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE x)
(*r).res = 0;
}
void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, LONGINT n)
void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n)
{
LONGINT xpos, min, restInBuf, offset;
int32 xpos, min, restInBuf, offset;
Files_Buffer buf = NIL;
if (n > x__len) {
Files_IdxTrap();
@ -735,17 +735,17 @@ void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT
(*r).res = 0;
}
void Files_Delete (CHAR *name, LONGINT name__len, INTEGER *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, INTEGER *res)
void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res)
{
LONGINT fdold, fdnew, n;
INTEGER error, ignore;
int32 fdold, fdnew, n;
int16 error, ignore;
Platform_FileIdentity oldidentity, newidentity;
CHAR buf[4096];
__DUP(old, old__len, CHAR);
@ -800,7 +800,7 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT
void Files_Register (Files_File f)
{
INTEGER idx, errcode;
int16 idx, errcode;
Files_File f1 = NIL;
CHAR file[104];
if ((f->state == 1 && f->registerName[0] != 0x00)) {
@ -819,7 +819,7 @@ void Files_Register (Files_File f)
}
}
void Files_ChangeDirectory (CHAR *path, LONGINT path__len, INTEGER *res)
void Files_ChangeDirectory (CHAR *path, LONGINT path__len, int16 *res)
{
__DUP(path, path__len, CHAR);
*res = Platform_Chdir((void*)path, path__len);
@ -828,7 +828,7 @@ void Files_ChangeDirectory (CHAR *path, LONGINT path__len, INTEGER *res)
static void Files_FlipBytes (SYSTEM_BYTE *src, LONGINT src__len, SYSTEM_BYTE *dest, LONGINT dest__len)
{
LONGINT i, j;
int32 i, j;
if (!Platform_LittleEndian) {
i = src__len;
j = 0;
@ -847,26 +847,26 @@ void Files_ReadBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN *x)
Files_Read(&*R, R__typ, (CHAR*)(void*)&*x);
}
void Files_ReadInt (Files_Rider *R, LONGINT *R__typ, INTEGER *x)
void Files_ReadInt (Files_Rider *R, LONGINT *R__typ, int16 *x)
{
CHAR b[2];
Files_ReadBytes(&*R, R__typ, (void*)b, 2, 2);
*x = (SYSTEM_INT16)b[0] + __ASHL((SYSTEM_INT16)b[1], 8);
*x = (int16)b[0] + __ASHL((int16)b[1], 8);
}
void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int32 *x)
{
CHAR b[4];
Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4);
*x = (((SYSTEM_INT16)b[0] + __ASHL((SYSTEM_INT16)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, LONGINT *R__typ, SET *x)
{
CHAR b[4];
LONGINT l;
int32 l;
Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4);
l = (((SYSTEM_INT16)b[0] + __ASHL((SYSTEM_INT16)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;
}
@ -886,7 +886,7 @@ void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x)
void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len)
{
INTEGER i;
int16 i;
CHAR ch;
i = 0;
do {
@ -898,7 +898,7 @@ void Files_ReadString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len)
void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len)
{
INTEGER i;
int16 i;
CHAR ch;
BOOLEAN b;
i = 0;
@ -914,20 +914,20 @@ void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len)
} while (!b);
}
void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x)
{
SHORTINT s;
int8 s;
CHAR ch;
LONGINT n;
int32 n;
s = 0;
n = 0;
Files_Read(&*R, R__typ, (void*)&ch);
while ((SYSTEM_INT16)ch >= 128) {
n += __ASH(((SYSTEM_INT16)ch - 128), s);
while ((int16)ch >= 128) {
n += __ASH(((int16)ch - 128), s);
s += 7;
Files_Read(&*R, R__typ, (void*)&ch);
}
n += __ASH((__MASK((SYSTEM_INT16)ch, -64) - __ASHL(__ASHR((SYSTEM_INT16)ch, 6), 6)), s);
n += __ASH((__MASK((int16)ch, -64) - __ASHL(__ASHR((int16)ch, 6), 6)), s);
*x = n;
}
@ -936,7 +936,7 @@ void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x)
Files_Write(&*R, R__typ, __VAL(CHAR, x));
}
void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, INTEGER x)
void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int16 x)
{
CHAR b[2];
b[0] = (CHAR)x;
@ -944,7 +944,7 @@ void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, INTEGER x)
Files_WriteBytes(&*R, R__typ, (void*)b, 2, 2);
}
void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, LONGINT x)
void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x)
{
CHAR b[4];
b[0] = (CHAR)x;
@ -957,8 +957,8 @@ void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, LONGINT x)
void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x)
{
CHAR b[4];
LONGINT i;
i = (LONGINT)x;
int32 i;
i = (int32)x;
b[0] = (CHAR)i;
b[1] = (CHAR)__ASHR(i, 8);
b[2] = (CHAR)__ASHR(i, 16);
@ -982,7 +982,7 @@ void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x)
void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len)
{
INTEGER i;
int16 i;
i = 0;
while (x[i] != 0x00) {
i += 1;
@ -990,7 +990,7 @@ void Files_WriteString (Files_Rider *R, LONGINT *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, LONGINT *R__typ, LONGINT x)
void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x)
{
while (x < -64 || x > 63) {
Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128));
@ -1007,7 +1007,7 @@ void Files_GetName (Files_File f, CHAR *name, LONGINT name__len)
static void Files_Finalize (SYSTEM_PTR o)
{
Files_File f = NIL;
LONGINT res;
int32 res;
f = (Files_File)(SYSTEM_ADRINT)o;
if (f->fd >= 0) {
Files_CloseOSFile(f);

View file

@ -11,13 +11,13 @@ typedef
typedef
struct Files_FileDesc {
char _prvt0[224];
LONGINT fd;
int32 fd;
char _prvt1[32];
} Files_FileDesc;
typedef
struct Files_Rider {
LONGINT res;
int32 res;
BOOLEAN eof;
char _prvt0[15];
} Files_Rider;
@ -28,39 +28,39 @@ import LONGINT *Files_FileDesc__typ;
import LONGINT *Files_Rider__typ;
import Files_File Files_Base (Files_Rider *r, LONGINT *r__typ);
import void Files_ChangeDirectory (CHAR *path, LONGINT path__len, INTEGER *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, INTEGER *res);
import void Files_GetDate (Files_File f, LONGINT *t, LONGINT *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 LONGINT 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 LONGINT Files_Pos (Files_Rider *r, LONGINT *r__typ);
import int32 Files_Pos (Files_Rider *r, LONGINT *r__typ);
import void Files_Purge (Files_File f);
import void Files_Read (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x);
import void Files_ReadBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN *x);
import void Files_ReadByte (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len);
import void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, LONGINT n);
import void Files_ReadInt (Files_Rider *R, LONGINT *R__typ, INTEGER *x);
import void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, LONGINT *x);
import void Files_ReadBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n);
import void Files_ReadInt (Files_Rider *R, LONGINT *R__typ, int16 *x);
import void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
import void Files_ReadLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL *x);
import void Files_ReadLine (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);
import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, LONGINT *x);
import void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, int32 *x);
import void Files_ReadReal (Files_Rider *R, LONGINT *R__typ, REAL *x);
import void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x);
import void Files_ReadString (Files_Rider *R, LONGINT *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, INTEGER *res);
import void Files_Set (Files_Rider *r, LONGINT *r__typ, Files_File f, LONGINT pos);
import void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int16 *res);
import void Files_Set (Files_Rider *r, LONGINT *r__typ, Files_File f, int32 pos);
import void Files_SetSearchPath (CHAR *path, LONGINT path__len);
import void Files_Write (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE x);
import void Files_WriteBool (Files_Rider *R, LONGINT *R__typ, BOOLEAN x);
import void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, LONGINT n);
import void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, INTEGER x);
import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, LONGINT x);
import void Files_WriteBytes (Files_Rider *r, LONGINT *r__typ, SYSTEM_BYTE *x, LONGINT x__len, int32 n);
import void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int16 x);
import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteLReal (Files_Rider *R, LONGINT *R__typ, LONGREAL x);
import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, LONGINT x);
import void Files_WriteNum (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteReal (Files_Rider *R, LONGINT *R__typ, REAL x);
import void Files_WriteSet (Files_Rider *R, LONGINT *R__typ, SET x);
import void Files_WriteString (Files_Rider *R, LONGINT *R__typ, CHAR *x, LONGINT x__len);

View file

@ -34,7 +34,7 @@ typedef
typedef
struct Heap_FinDesc {
Heap_FinNode next;
LONGINT obj;
int32 obj;
BOOLEAN marked;
Heap_Finalizer finalize;
} Heap_FinDesc;
@ -49,25 +49,25 @@ typedef
struct Heap_ModuleDesc {
Heap_Module next;
Heap_ModuleName name;
LONGINT refcnt;
int32 refcnt;
Heap_Cmd cmds;
LONGINT types;
int32 types;
Heap_EnumProc enumPtrs;
LONGINT reserved1, reserved2;
int32 reserved1, reserved2;
} Heap_ModuleDesc;
export SYSTEM_PTR Heap_modules;
static LONGINT Heap_freeList[10];
static LONGINT Heap_bigBlocks;
export LONGINT Heap_allocated;
static int32 Heap_freeList[10];
static int32 Heap_bigBlocks;
export int32 Heap_allocated;
static BOOLEAN Heap_firstTry;
static LONGINT Heap_heap, Heap_heapend;
export LONGINT Heap_heapsize;
static int32 Heap_heap, Heap_heapend;
export int32 Heap_heapsize;
static Heap_FinNode Heap_fin;
static INTEGER Heap_lockdepth;
static int16 Heap_lockdepth;
static BOOLEAN Heap_interrupted;
export INTEGER Heap_FileCount;
export int16 Heap_FileCount;
export LONGINT *Heap_ModuleDesc__typ;
export LONGINT *Heap_CmdDesc__typ;
@ -75,27 +75,27 @@ export LONGINT *Heap_FinDesc__typ;
export LONGINT *Heap__1__typ;
static void Heap_CheckFin (void);
static void Heap_ExtendHeap (LONGINT blksz);
static void Heap_ExtendHeap (int32 blksz);
export void Heap_FINALL (void);
static void Heap_Finalize (void);
export void Heap_GC (BOOLEAN markStack);
static void Heap_HeapSort (LONGINT n, LONGINT *a, LONGINT a__len);
static void Heap_HeapSort (int32 n, int32 *a, LONGINT a__len);
export void Heap_INCREF (Heap_Module m);
export void Heap_InitHeap (void);
export void Heap_Lock (void);
static void Heap_Mark (LONGINT q);
static void Heap_MarkCandidates (LONGINT n, LONGINT *cand, LONGINT cand__len);
static void Heap_Mark (int32 q);
static void Heap_MarkCandidates (int32 n, int32 *cand, LONGINT cand__len);
static void Heap_MarkP (SYSTEM_PTR p);
static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len);
export SYSTEM_PTR Heap_NEWBLK (LONGINT size);
export SYSTEM_PTR Heap_NEWREC (LONGINT tag);
static LONGINT Heap_NewChunk (LONGINT blksz);
static void Heap_MarkStack (int32 n, int32 *cand, LONGINT cand__len);
export SYSTEM_PTR Heap_NEWBLK (int32 size);
export SYSTEM_PTR Heap_NEWREC (int32 tag);
static int32 Heap_NewChunk (int32 blksz);
export void Heap_REGCMD (Heap_Module m, Heap_CmdName name, Heap_Command cmd);
export SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs);
export void Heap_REGTYP (Heap_Module m, LONGINT typ);
export void Heap_REGTYP (Heap_Module m, int32 typ);
export void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize);
static void Heap_Scan (void);
static void Heap_Sift (LONGINT l, LONGINT r, LONGINT *a, LONGINT a__len);
static void Heap_Sift (int32 l, int32 r, int32 *a, LONGINT a__len);
export void Heap_Unlock (void);
extern void *Heap__init();
@ -154,9 +154,9 @@ void Heap_REGCMD (Heap_Module m, Heap_CmdName name, Heap_Command cmd)
m->cmds = c;
}
void Heap_REGTYP (Heap_Module m, LONGINT typ)
void Heap_REGTYP (Heap_Module m, int32 typ)
{
__PUT(typ, m->types, LONGINT);
__PUT(typ, m->types, int32);
m->types = typ;
}
@ -165,17 +165,17 @@ void Heap_INCREF (Heap_Module m)
m->refcnt += 1;
}
static LONGINT Heap_NewChunk (LONGINT blksz)
static int32 Heap_NewChunk (int32 blksz)
{
LONGINT _o_result;
LONGINT chnk;
int32 _o_result;
int32 chnk;
chnk = Heap_OSAllocate(blksz + 12);
if (chnk != 0) {
__PUT(chnk + 4, chnk + (12 + blksz), LONGINT);
__PUT(chnk + 12, chnk + 16, LONGINT);
__PUT(chnk + 16, blksz, LONGINT);
__PUT(chnk + 20, -4, LONGINT);
__PUT(chnk + 24, Heap_bigBlocks, LONGINT);
__PUT(chnk + 4, chnk + (12 + blksz), int32);
__PUT(chnk + 12, chnk + 16, int32);
__PUT(chnk + 16, blksz, int32);
__PUT(chnk + 20, -4, int32);
__PUT(chnk + 24, Heap_bigBlocks, int32);
Heap_bigBlocks = chnk + 12;
Heap_heapsize += blksz;
}
@ -183,9 +183,9 @@ static LONGINT Heap_NewChunk (LONGINT blksz)
return _o_result;
}
static void Heap_ExtendHeap (LONGINT blksz)
static void Heap_ExtendHeap (int32 blksz)
{
LONGINT size, chnk, j, next;
int32 size, chnk, j, next;
if (blksz > 160000) {
size = blksz;
} else {
@ -194,7 +194,7 @@ static void Heap_ExtendHeap (LONGINT blksz)
chnk = Heap_NewChunk(size);
if (chnk != 0) {
if (chnk < Heap_heap) {
__PUT(chnk, Heap_heap, LONGINT);
__PUT(chnk, Heap_heap, int32);
Heap_heap = chnk;
} else {
j = Heap_heap;
@ -203,8 +203,8 @@ static void Heap_ExtendHeap (LONGINT blksz)
j = next;
next = Heap_FetchAddress(j);
}
__PUT(chnk, next, LONGINT);
__PUT(j, chnk, LONGINT);
__PUT(chnk, next, int32);
__PUT(j, chnk, int32);
}
if (next == 0) {
Heap_heapend = Heap_FetchAddress(chnk + 4);
@ -212,10 +212,10 @@ static void Heap_ExtendHeap (LONGINT blksz)
}
}
SYSTEM_PTR Heap_NEWREC (LONGINT tag)
SYSTEM_PTR Heap_NEWREC (int32 tag)
{
SYSTEM_PTR _o_result;
LONGINT i, i0, di, blksz, restsize, t, adr, end, next, prev;
int32 i, i0, di, blksz, restsize, t, adr, end, next, prev;
SYSTEM_PTR new;
Heap_Lock();
blksz = Heap_FetchAddress(tag);
@ -235,11 +235,11 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag)
di = i - i0;
restsize = __ASHL(di, 4);
end = adr + restsize;
__PUT(end + 4, blksz, LONGINT);
__PUT(end + 8, -4, LONGINT);
__PUT(end, end + 4, LONGINT);
__PUT(adr + 4, restsize, LONGINT);
__PUT(adr + 12, Heap_freeList[di], LONGINT);
__PUT(end + 4, blksz, int32);
__PUT(end + 8, -4, int32);
__PUT(end, end + 4, int32);
__PUT(adr + 4, restsize, int32);
__PUT(adr + 12, Heap_freeList[di], int32);
Heap_freeList[di] = adr;
adr += restsize;
}
@ -279,22 +279,22 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag)
}
restsize = t - blksz;
end = adr + restsize;
__PUT(end + 4, blksz, LONGINT);
__PUT(end + 8, -4, LONGINT);
__PUT(end, end + 4, LONGINT);
__PUT(end + 4, blksz, int32);
__PUT(end + 8, -4, int32);
__PUT(end, end + 4, int32);
if (restsize > 144) {
__PUT(adr + 4, restsize, LONGINT);
__PUT(adr + 4, restsize, int32);
} else {
next = Heap_FetchAddress(adr + 12);
if (prev == 0) {
Heap_bigBlocks = next;
} else {
__PUT(prev + 12, next, LONGINT);
__PUT(prev + 12, next, int32);
}
if (restsize > 0) {
di = __ASHR(restsize, 4);
__PUT(adr + 4, restsize, LONGINT);
__PUT(adr + 12, Heap_freeList[di], LONGINT);
__PUT(adr + 4, restsize, int32);
__PUT(adr + 12, Heap_freeList[di], int32);
Heap_freeList[di] = adr;
}
}
@ -303,53 +303,53 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag)
i = adr + 16;
end = adr + blksz;
while (i < end) {
__PUT(i, 0, LONGINT);
__PUT(i + 4, 0, LONGINT);
__PUT(i + 8, 0, LONGINT);
__PUT(i + 12, 0, LONGINT);
__PUT(i, 0, int32);
__PUT(i + 4, 0, int32);
__PUT(i + 8, 0, int32);
__PUT(i + 12, 0, int32);
i += 16;
}
__PUT(adr + 12, 0, LONGINT);
__PUT(adr, tag, LONGINT);
__PUT(adr + 4, 0, LONGINT);
__PUT(adr + 8, 0, LONGINT);
__PUT(adr + 12, 0, int32);
__PUT(adr, tag, int32);
__PUT(adr + 4, 0, int32);
__PUT(adr + 8, 0, int32);
Heap_allocated += blksz;
Heap_Unlock();
_o_result = (SYSTEM_PTR)(SYSTEM_ADRINT)(adr + 4);
return _o_result;
}
SYSTEM_PTR Heap_NEWBLK (LONGINT size)
SYSTEM_PTR Heap_NEWBLK (int32 size)
{
SYSTEM_PTR _o_result;
LONGINT blksz, tag;
int32 blksz, tag;
SYSTEM_PTR new;
Heap_Lock();
blksz = __ASHL(__ASHR(size + 31, 4), 4);
new = Heap_NEWREC((SYSTEM_ADRINT)&blksz);
tag = ((LONGINT)(SYSTEM_ADRINT)new + blksz) - 12;
__PUT(tag - 4, 0, LONGINT);
__PUT(tag, blksz, LONGINT);
__PUT(tag + 4, -4, LONGINT);
__PUT((LONGINT)(SYSTEM_ADRINT)new - 4, tag, LONGINT);
tag = ((int32)(SYSTEM_ADRINT)new + blksz) - 12;
__PUT(tag - 4, 0, int32);
__PUT(tag, blksz, int32);
__PUT(tag + 4, -4, int32);
__PUT((int32)(SYSTEM_ADRINT)new - 4, tag, int32);
Heap_Unlock();
_o_result = new;
return _o_result;
}
static void Heap_Mark (LONGINT q)
static void Heap_Mark (int32 q)
{
LONGINT p, tag, fld, n, offset, tagbits;
int32 p, tag, fld, n, offset, tagbits;
if (q != 0) {
tagbits = Heap_FetchAddress(q - 4);
if (!__ODD(tagbits)) {
__PUT(q - 4, tagbits + 1, LONGINT);
__PUT(q - 4, tagbits + 1, int32);
p = 0;
tag = tagbits + 4;
for (;;) {
__GET(tag, offset, LONGINT);
__GET(tag, offset, int32);
if (offset < 0) {
__PUT(q - 4, (tag + offset) + 1, LONGINT);
__PUT(q - 4, (tag + offset) + 1, int32);
if (p == 0) {
break;
}
@ -357,7 +357,7 @@ static void Heap_Mark (LONGINT q)
q = p;
tag = Heap_FetchAddress(q - 4);
tag -= 1;
__GET(tag, offset, LONGINT);
__GET(tag, offset, int32);
fld = q + offset;
p = Heap_FetchAddress(fld);
__PUT(fld, (SYSTEM_PTR)(SYSTEM_ADRINT)n, SYSTEM_PTR);
@ -367,8 +367,8 @@ static void Heap_Mark (LONGINT q)
if (n != 0) {
tagbits = Heap_FetchAddress(n - 4);
if (!__ODD(tagbits)) {
__PUT(n - 4, tagbits + 1, LONGINT);
__PUT(q - 4, tag + 1, LONGINT);
__PUT(n - 4, tagbits + 1, int32);
__PUT(q - 4, tag + 1, int32);
__PUT(fld, (SYSTEM_PTR)(SYSTEM_ADRINT)p, SYSTEM_PTR);
p = q;
q = n;
@ -384,12 +384,12 @@ static void Heap_Mark (LONGINT q)
static void Heap_MarkP (SYSTEM_PTR p)
{
Heap_Mark((LONGINT)(SYSTEM_ADRINT)p);
Heap_Mark((int32)(SYSTEM_ADRINT)p);
}
static void Heap_Scan (void)
{
LONGINT chnk, adr, end, start, tag, i, size, freesize;
int32 chnk, adr, end, start, tag, i, size, freesize;
Heap_bigBlocks = 0;
i = 1;
while (i < 9) {
@ -407,21 +407,21 @@ static void Heap_Scan (void)
if (__ODD(tag)) {
if (freesize > 0) {
start = adr - freesize;
__PUT(start, start + 4, LONGINT);
__PUT(start + 4, freesize, LONGINT);
__PUT(start + 8, -4, LONGINT);
__PUT(start, start + 4, int32);
__PUT(start + 4, freesize, int32);
__PUT(start + 8, -4, int32);
i = __ASHR(freesize, 4);
freesize = 0;
if (i < 9) {
__PUT(start + 12, Heap_freeList[i], LONGINT);
__PUT(start + 12, Heap_freeList[i], int32);
Heap_freeList[i] = start;
} else {
__PUT(start + 12, Heap_bigBlocks, LONGINT);
__PUT(start + 12, Heap_bigBlocks, int32);
Heap_bigBlocks = start;
}
}
tag -= 1;
__PUT(adr, tag, LONGINT);
__PUT(adr, tag, int32);
size = Heap_FetchAddress(tag);
Heap_allocated += size;
adr += size;
@ -433,16 +433,16 @@ static void Heap_Scan (void)
}
if (freesize > 0) {
start = adr - freesize;
__PUT(start, start + 4, LONGINT);
__PUT(start + 4, freesize, LONGINT);
__PUT(start + 8, -4, LONGINT);
__PUT(start, start + 4, int32);
__PUT(start + 4, freesize, int32);
__PUT(start + 8, -4, int32);
i = __ASHR(freesize, 4);
freesize = 0;
if (i < 9) {
__PUT(start + 12, Heap_freeList[i], LONGINT);
__PUT(start + 12, Heap_freeList[i], int32);
Heap_freeList[i] = start;
} else {
__PUT(start + 12, Heap_bigBlocks, LONGINT);
__PUT(start + 12, Heap_bigBlocks, int32);
Heap_bigBlocks = start;
}
}
@ -450,9 +450,9 @@ static void Heap_Scan (void)
}
}
static void Heap_Sift (LONGINT l, LONGINT r, LONGINT *a, LONGINT a__len)
static void Heap_Sift (int32 l, int32 r, int32 *a, LONGINT a__len)
{
LONGINT i, j, x;
int32 i, j, x;
j = l;
x = a[j];
for (;;) {
@ -469,9 +469,9 @@ static void Heap_Sift (LONGINT l, LONGINT r, LONGINT *a, LONGINT a__len)
a[i] = x;
}
static void Heap_HeapSort (LONGINT n, LONGINT *a, LONGINT a__len)
static void Heap_HeapSort (int32 n, int32 *a, LONGINT a__len)
{
LONGINT l, r, x;
int32 l, r, x;
l = __ASHR(n, 1);
r = n - 1;
while (l > 0) {
@ -487,9 +487,9 @@ static void Heap_HeapSort (LONGINT n, LONGINT *a, LONGINT a__len)
}
}
static void Heap_MarkCandidates (LONGINT n, LONGINT *cand, LONGINT cand__len)
static void Heap_MarkCandidates (int32 n, int32 *cand, LONGINT cand__len)
{
LONGINT chnk, adr, tag, next, lim, lim1, i, ptr, size;
int32 chnk, adr, tag, next, lim, lim1, i, ptr, size;
chnk = Heap_heap;
i = 0;
lim = cand[n - 1];
@ -527,7 +527,7 @@ static void Heap_MarkCandidates (LONGINT n, LONGINT *cand, LONGINT cand__len)
static void Heap_CheckFin (void)
{
Heap_FinNode n;
LONGINT tag;
int32 tag;
n = Heap_fin;
while (n != NIL) {
tag = Heap_FetchAddress(n->obj - 4);
@ -576,10 +576,10 @@ void Heap_FINALL (void)
}
}
static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len)
static void Heap_MarkStack (int32 n, int32 *cand, LONGINT cand__len)
{
SYSTEM_PTR frame;
LONGINT inc, nofcand, sp, p, stack0;
int32 inc, nofcand, sp, p, stack0;
struct Heap__1 align;
if (n > 0) {
Heap_MarkStack(n - 1, cand, cand__len);
@ -596,7 +596,7 @@ static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len)
inc = -inc;
}
while (sp != stack0) {
__GET(sp, p, LONGINT);
__GET(sp, p, int32);
if ((p > Heap_heap && p < Heap_heapend)) {
if (nofcand == cand__len) {
Heap_HeapSort(nofcand, (void*)cand, cand__len);
@ -618,8 +618,8 @@ static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len)
void Heap_GC (BOOLEAN markStack)
{
Heap_Module m;
LONGINT i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23;
LONGINT cand[10000];
int32 i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23;
int32 cand[10000];
if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) {
Heap_Lock();
m = (Heap_Module)(SYSTEM_ADRINT)Heap_modules;
@ -699,7 +699,7 @@ void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize)
{
Heap_FinNode f;
__NEW(f, Heap_FinDesc);
f->obj = (LONGINT)(SYSTEM_ADRINT)obj;
f->obj = (int32)(SYSTEM_ADRINT)obj;
f->finalize = finalize;
f->marked = 1;
f->next = Heap_fin;
@ -710,7 +710,7 @@ void Heap_InitHeap (void)
{
Heap_heap = Heap_NewChunk(128000);
Heap_heapend = Heap_FetchAddress(Heap_heap + 4);
__PUT(Heap_heap, 0, LONGINT);
__PUT(Heap_heap, 0, int32);
Heap_allocated = 0;
Heap_firstTry = 1;
Heap_freeList[9] = 1;

View file

@ -31,8 +31,8 @@ typedef
import SYSTEM_PTR Heap_modules;
import LONGINT Heap_allocated, Heap_heapsize;
import INTEGER Heap_FileCount;
import int32 Heap_allocated, Heap_heapsize;
import int16 Heap_FileCount;
import LONGINT *Heap_ModuleDesc__typ;
@ -41,11 +41,11 @@ import void Heap_GC (BOOLEAN markStack);
import void Heap_INCREF (Heap_Module m);
import void Heap_InitHeap (void);
import void Heap_Lock (void);
import SYSTEM_PTR Heap_NEWBLK (LONGINT size);
import SYSTEM_PTR Heap_NEWREC (LONGINT tag);
import SYSTEM_PTR Heap_NEWBLK (int32 size);
import SYSTEM_PTR Heap_NEWREC (int32 tag);
import void Heap_REGCMD (Heap_Module m, Heap_CmdName name, Heap_Command cmd);
import SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs);
import void Heap_REGTYP (Heap_Module m, LONGINT typ);
import void Heap_REGTYP (Heap_Module m, int32 typ);
import void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize);
import void Heap_Unlock (void);
import void *Heap__init(void);

View file

@ -26,15 +26,15 @@ typedef
struct Modules_ModuleDesc {
Modules_Module next;
Modules_ModuleName name;
LONGINT refcnt;
int32 refcnt;
Modules_Cmd cmds;
LONGINT types;
void (*enumPtrs)(void(*)(LONGINT));
LONGINT reserved1, reserved2;
int32 types;
void (*enumPtrs)(void(*)(int32));
int32 reserved1, reserved2;
} Modules_ModuleDesc;
export INTEGER Modules_res;
export int16 Modules_res;
export CHAR Modules_resMsg[256];
export Modules_ModuleName Modules_imported, Modules_importing;
@ -51,7 +51,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)
{
INTEGER i, j;
int16 i, j;
__DUP(b, b__len, CHAR);
i = 0;
while (a[__X(i, a__len)] != 0x00) {

View file

@ -28,15 +28,15 @@ typedef
struct Modules_ModuleDesc {
Modules_Module next;
Modules_ModuleName name;
LONGINT refcnt;
int32 refcnt;
Modules_Cmd cmds;
LONGINT types;
void (*enumPtrs)(void(*)(LONGINT));
int32 types;
void (*enumPtrs)(void(*)(int32));
char _prvt0[8];
} Modules_ModuleDesc;
import INTEGER Modules_res;
import int16 Modules_res;
import CHAR Modules_resMsg[256];
import Modules_ModuleName Modules_imported, Modules_importing;

View file

@ -6,13 +6,13 @@
export void (*OPB_typSize)(OPT_Struct);
static INTEGER OPB_exp;
static LONGINT OPB_maxExp;
static int16 OPB_exp;
static int32 OPB_maxExp;
export void OPB_Assign (OPT_Node *x, OPT_Node y);
static void OPB_BindNodes (SHORTINT class, OPT_Struct typ, OPT_Node *x, OPT_Node y);
static LONGINT OPB_BoolToInt (BOOLEAN b);
static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y);
static int32 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);
@ -20,10 +20,10 @@ 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 (INTEGER f, INTEGER 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 (INTEGER op, OPT_Node x, OPT_Node y);
export void OPB_Construct (SHORTINT class, 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);
static void OPB_DynArrParCheck (OPT_Struct ftyp, OPT_Struct atyp, BOOLEAN fvarpar);
@ -33,17 +33,17 @@ export void OPB_Field (OPT_Node *x, OPT_Object y);
export void OPB_In (OPT_Node *x, OPT_Node y);
export void OPB_Index (OPT_Node *x, OPT_Node y);
export void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ);
static BOOLEAN OPB_IntToBool (LONGINT i);
static BOOLEAN OPB_IntToBool (int32 i);
export void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y);
export void OPB_MOp (SHORTINT op, OPT_Node *x);
export void OPB_MOp (int8 op, OPT_Node *x);
export OPT_Node OPB_NewBoolConst (BOOLEAN boolval);
export OPT_Node OPB_NewIntConst (LONGINT intval);
export OPT_Node OPB_NewIntConst (int32 intval);
export OPT_Node OPB_NewLeaf (OPT_Object obj);
export OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ);
export OPT_Node OPB_NewString (OPS_String str, LONGINT len);
export OPT_Node OPB_NewString (OPS_String str, int32 len);
export OPT_Node OPB_Nil (void);
static BOOLEAN OPB_NotVar (OPT_Node x);
export void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y);
export void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
export void OPB_OptIf (OPT_Node *x);
export void OPB_Param (OPT_Node ap, OPT_Object fp);
export void OPB_PrepCall (OPT_Node *x, OPT_Object *fpar);
@ -51,17 +51,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, SHORTINT fctno, INTEGER parno);
export void OPB_StPar0 (OPT_Node *par0, INTEGER fctno);
export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno);
export void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n);
export void OPB_StaticLink (SHORTINT dlev);
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, 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 (INTEGER n);
static LONGINT OPB_log (LONGINT x);
static void OPB_err (int16 n);
static int32 OPB_log (int32 x);
static void OPB_err (INTEGER n)
static void OPB_err (int16 n)
{
OPM_err(n);
}
@ -100,7 +100,7 @@ OPT_Node OPB_NewLeaf (OPT_Object obj)
return _o_result;
}
void OPB_Construct (SHORTINT class, OPT_Node *x, OPT_Node y)
void OPB_Construct (int8 class, OPT_Node *x, OPT_Node y)
{
OPT_Node node = NIL;
node = OPT_NewNode(class);
@ -123,9 +123,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y)
*last = y;
}
static LONGINT OPB_BoolToInt (BOOLEAN b)
static int32 OPB_BoolToInt (BOOLEAN b)
{
LONGINT _o_result;
int32 _o_result;
if (b) {
_o_result = 1;
return _o_result;
@ -136,7 +136,7 @@ static LONGINT OPB_BoolToInt (BOOLEAN b)
__RETCHK;
}
static BOOLEAN OPB_IntToBool (LONGINT i)
static BOOLEAN OPB_IntToBool (int32 i)
{
BOOLEAN _o_result;
if (i == 0) {
@ -222,8 +222,8 @@ OPT_Node OPB_EmptySet (void)
static void OPB_SetIntType (OPT_Node node)
{
INTEGER b;
LONGINT n;
int16 b;
int32 n;
if (node->conval->intval >= 0) {
n = node->conval->intval;
} else {
@ -236,7 +236,7 @@ static void OPB_SetIntType (OPT_Node node)
node->typ = OPT_IntType(b);
}
OPT_Node OPB_NewIntConst (LONGINT intval)
OPT_Node OPB_NewIntConst (int32 intval)
{
OPT_Node _o_result;
OPT_Node x = NIL;
@ -261,7 +261,7 @@ OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ)
return _o_result;
}
OPT_Node OPB_NewString (OPS_String str, LONGINT len)
OPT_Node OPB_NewString (OPS_String str, int32 len)
{
OPT_Node _o_result;
OPT_Node x = NIL;
@ -293,7 +293,7 @@ static void OPB_CharToString (OPT_Node n)
n->obj = NIL;
}
static void OPB_BindNodes (SHORTINT class, OPT_Struct typ, OPT_Node *x, OPT_Node y)
static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y)
{
OPT_Node node = NIL;
node = OPT_NewNode(class);
@ -335,7 +335,7 @@ void OPB_DeRef (OPT_Node *x)
void OPB_Index (OPT_Node *x, OPT_Node y)
{
INTEGER f;
int16 f;
OPT_Struct typ = NIL;
f = y->typ->form;
if ((*x)->class >= 7) {
@ -460,8 +460,8 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard)
void OPB_In (OPT_Node *x, OPT_Node y)
{
INTEGER f;
LONGINT k;
int16 f;
int32 k;
f = (*x)->typ->form;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126);
@ -487,9 +487,9 @@ void OPB_In (OPT_Node *x, OPT_Node y)
(*x)->typ = OPT_booltyp;
}
static LONGINT OPB_log (LONGINT x)
static int32 OPB_log (int32 x)
{
LONGINT _o_result;
int32 _o_result;
OPB_exp = 0;
if (x > 0) {
while (!__ODD(x)) {
@ -501,7 +501,7 @@ static LONGINT OPB_log (LONGINT x)
return _o_result;
}
static void OPB_CheckRealType (INTEGER f, INTEGER nr, OPT_Const x)
static void OPB_CheckRealType (int16 f, int16 nr, OPT_Const x)
{
LONGREAL min, max, r;
if (f == 5) {
@ -525,9 +525,9 @@ static struct MOp__28 {
struct MOp__28 *lnk;
} *MOp__28_s;
static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z);
static OPT_Node NewOp__29 (int8 op, OPT_Struct typ, OPT_Node z);
static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z)
static OPT_Node NewOp__29 (int8 op, OPT_Struct typ, OPT_Node z)
{
OPT_Node _o_result;
OPT_Node node = NIL;
@ -539,9 +539,9 @@ static OPT_Node NewOp__29 (SHORTINT op, OPT_Struct typ, OPT_Node z)
return _o_result;
}
void OPB_MOp (SHORTINT op, OPT_Node *x)
void OPB_MOp (int8 op, OPT_Node *x)
{
INTEGER f;
int16 f;
OPT_Struct typ = NIL;
OPT_Node z = NIL;
struct MOp__28 _s;
@ -618,7 +618,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x)
case 22:
if (f == 3) {
if (z->class == 7) {
z->conval->intval = (SYSTEM_INT16)__CAP((CHAR)z->conval->intval);
z->conval->intval = (int16)__CAP((CHAR)z->conval->intval);
z->obj = NIL;
} else {
z = NewOp__29(op, typ, z);
@ -678,7 +678,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x)
static void OPB_CheckPtr (OPT_Node x, OPT_Node y)
{
INTEGER g;
int16 g;
OPT_Struct p = NIL, q = NIL, t = NIL;
g = y->typ->form;
if (g == 11) {
@ -762,17 +762,17 @@ static void OPB_CheckProc (OPT_Struct x, OPT_Object y)
static struct ConstOp__13 {
OPT_Node *x;
INTEGER *f;
int16 *f;
OPT_Const *xval, *yval;
struct ConstOp__13 *lnk;
} *ConstOp__13_s;
static INTEGER ConstCmp__14 (void);
static int16 ConstCmp__14 (void);
static INTEGER ConstCmp__14 (void)
static int16 ConstCmp__14 (void)
{
INTEGER _o_result;
INTEGER res;
int16 _o_result;
int16 res;
switch (*ConstOp__13_s->f) {
case 0:
res = 9;
@ -836,11 +836,11 @@ static INTEGER ConstCmp__14 (void)
return _o_result;
}
static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y)
static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
{
INTEGER f, g;
int16 f, g;
OPT_Const xval = NIL, yval = NIL;
LONGINT xv, yv;
int32 xv, yv;
BOOLEAN temp;
struct ConstOp__13 _s;
_s.x = &x;
@ -1116,8 +1116,8 @@ static void OPB_ConstOp (INTEGER op, OPT_Node x, OPT_Node y)
static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
{
OPT_Node node = NIL;
INTEGER f, g;
LONGINT k;
int16 f, g;
int32 k;
LONGREAL r;
f = (*x)->typ->form;
g = typ->form;
@ -1149,12 +1149,12 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
OPB_err(203);
r = (LONGREAL)1;
}
(*x)->conval->intval = (SYSTEM_INT32)__ENTIER(r);
(*x)->conval->intval = (int32)__ENTIER(r);
OPB_SetIntType(*x);
}
}
(*x)->obj = NIL;
} else if (((((*x)->class == 11 && (*x)->subcl == 20)) && ((SYSTEM_INT16)(*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;
}
@ -1168,14 +1168,14 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
}
static struct Op__38 {
INTEGER *f, *g;
int16 *f, *g;
struct Op__38 *lnk;
} *Op__38_s;
static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y);
static void NewOp__39 (int8 op, OPT_Struct typ, OPT_Node *x, OPT_Node y);
static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y);
static void NewOp__39 (SHORTINT op, OPT_Struct typ, OPT_Node *x, OPT_Node y)
static void NewOp__39 (int8 op, OPT_Struct typ, OPT_Node *x, OPT_Node y)
{
OPT_Node node = NIL;
node = OPT_NewNode(12);
@ -1218,13 +1218,13 @@ static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y)
return _o_result;
}
void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y)
void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
{
INTEGER f, g;
int16 f, g;
OPT_Node t = NIL, z = NIL;
OPT_Struct typ = NIL;
BOOLEAN do_;
LONGINT val;
int32 val;
struct Op__38 _s;
_s.f = &f;
_s.g = &g;
@ -1495,7 +1495,7 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y)
void OPB_SetRange (OPT_Node *x, OPT_Node y)
{
LONGINT k, l;
int32 k, l;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126);
} else if (((*x)->typ->form == 4 && y->typ->form == 4)) {
@ -1530,7 +1530,7 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
void OPB_SetElem (OPT_Node *x)
{
LONGINT k;
int32 k;
if ((*x)->class == 8 || (*x)->class == 9) {
OPB_err(126);
} else if ((*x)->typ->form != 4) {
@ -1552,7 +1552,7 @@ void OPB_SetElem (OPT_Node *x)
static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode)
{
OPT_Struct y = NIL;
INTEGER f, g;
int16 f, g;
OPT_Struct p = NIL, q = NIL;
if (OPM_Verbose) {
OPM_LogWLn();
@ -1695,9 +1695,9 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo)
{
}
void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
void OPB_StPar0 (OPT_Node *par0, int16 fctno)
{
INTEGER f;
int16 f;
OPT_Struct typ = NIL;
OPT_Node x = NIL;
x = *par0;
@ -2005,9 +2005,9 @@ static struct StPar1__52 {
struct StPar1__52 *lnk;
} *StPar1__52_s;
static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right);
static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right);
static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_Node right)
static OPT_Node NewOp__53 (int8 class, int8 subcl, OPT_Node left, OPT_Node right)
{
OPT_Node _o_result;
OPT_Node node = NIL;
@ -2019,9 +2019,9 @@ static OPT_Node NewOp__53 (SHORTINT class, SHORTINT subcl, OPT_Node left, OPT_No
return _o_result;
}
void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)
{
INTEGER f, L;
int16 f, L;
OPT_Struct typ = NIL;
OPT_Node p = NIL, t = NIL;
struct StPar1__52 _s;
@ -2063,7 +2063,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
if (!(f == 4) || x->class != 7) {
OPB_err(69);
} else if (x->typ->size == 1) {
L = (SYSTEM_INT16)x->conval->intval;
L = (int16)x->conval->intval;
typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c))) {
typ = typ->BaseTyp;
@ -2259,10 +2259,10 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
StPar1__52_s = _s.lnk;
}
void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n)
void OPB_StParN (OPT_Node *par0, OPT_Node x, int16 fctno, int16 n)
{
OPT_Node node = NIL;
INTEGER f;
int16 f;
OPT_Node p = NIL;
p = *par0;
f = x->typ->form;
@ -2304,9 +2304,9 @@ void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n)
*par0 = p;
}
void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno)
void OPB_StFct (OPT_Node *par0, int8 fctno, int16 parno)
{
INTEGER dim;
int16 dim;
OPT_Node x = NIL, p = NIL;
p = *par0;
if (fctno <= 19) {
@ -2370,7 +2370,7 @@ void OPB_StFct (OPT_Node *par0, SHORTINT fctno, INTEGER parno)
static void OPB_DynArrParCheck (OPT_Struct ftyp, OPT_Struct atyp, BOOLEAN fvarpar)
{
INTEGER f;
int16 f;
f = atyp->comp;
ftyp = ftyp->BaseTyp;
atyp = atyp->BaseTyp;
@ -2479,7 +2479,7 @@ void OPB_Param (OPT_Node ap, OPT_Object fp)
}
}
void OPB_StaticLink (SHORTINT dlev)
void OPB_StaticLink (int8 dlev)
{
OPT_Object scope = NIL;
scope = OPT_topScope;
@ -2494,7 +2494,7 @@ void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp)
{
OPT_Struct typ = NIL;
OPT_Node p = NIL;
SHORTINT lev;
int8 lev;
if ((*x)->class == 9) {
typ = (*x)->typ;
lev = (*x)->obj->mnolev;
@ -2554,7 +2554,7 @@ void OPB_Return (OPT_Node *x, OPT_Object proc)
void OPB_Assign (OPT_Node *x, OPT_Node y)
{
OPT_Node z = NIL;
SHORTINT subcl;
int8 subcl;
if ((*x)->class >= 7) {
OPB_err(56);
}

View file

@ -14,7 +14,7 @@ import void (*OPB_typSize)(OPT_Struct);
import void OPB_Assign (OPT_Node *x, OPT_Node y);
import void OPB_Call (OPT_Node *x, OPT_Node apar, OPT_Object fp);
import void OPB_CheckParameters (OPT_Object fp, OPT_Object ap, BOOLEAN checkNames);
import void OPB_Construct (SHORTINT class, OPT_Node *x, OPT_Node y);
import void OPB_Construct (int8 class, OPT_Node *x, OPT_Node y);
import void OPB_DeRef (OPT_Node *x);
import OPT_Node OPB_EmptySet (void);
import void OPB_Enter (OPT_Node *procdec, OPT_Node stat, OPT_Object proc);
@ -23,25 +23,25 @@ import void OPB_In (OPT_Node *x, OPT_Node y);
import void OPB_Index (OPT_Node *x, OPT_Node y);
import void OPB_Inittd (OPT_Node *inittd, OPT_Node *last, OPT_Struct typ);
import void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y);
import void OPB_MOp (SHORTINT op, OPT_Node *x);
import void OPB_MOp (int8 op, OPT_Node *x);
import OPT_Node OPB_NewBoolConst (BOOLEAN boolval);
import OPT_Node OPB_NewIntConst (LONGINT intval);
import OPT_Node OPB_NewIntConst (int32 intval);
import OPT_Node OPB_NewLeaf (OPT_Object obj);
import OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ);
import OPT_Node OPB_NewString (OPS_String str, LONGINT len);
import OPT_Node OPB_NewString (OPS_String str, int32 len);
import OPT_Node OPB_Nil (void);
import void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y);
import void OPB_Op (int8 op, OPT_Node *x, OPT_Node y);
import void OPB_OptIf (OPT_Node *x);
import void OPB_Param (OPT_Node ap, OPT_Object fp);
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, SHORTINT fctno, INTEGER parno);
import void OPB_StPar0 (OPT_Node *par0, INTEGER fctno);
import void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno);
import void OPB_StParN (OPT_Node *par0, OPT_Node x, INTEGER fctno, INTEGER n);
import void OPB_StaticLink (SHORTINT dlev);
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, 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);

View file

@ -5,27 +5,27 @@
#include "OPT.h"
static INTEGER OPC_indentLevel;
static int16 OPC_indentLevel;
static BOOLEAN OPC_ptrinit, OPC_mainprog, OPC_ansi;
static SHORTINT OPC_hashtab[105];
static CHAR OPC_keytab[36][9];
static int8 OPC_hashtab[105];
static CHAR OPC_keytab[50][9];
static BOOLEAN OPC_GlbPtrs;
static CHAR OPC_BodyNameExt[13];
export void OPC_Align (LONGINT *adr, LONGINT 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 LONGINT 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, INTEGER vis);
export void OPC_Case (LONGINT caseVal, INTEGER form);
static void OPC_CharacterLiteral (LONGINT c);
export void OPC_Cmp (INTEGER rel);
static void OPC_CProcDefs (OPT_Object obj, int16 vis);
export void OPC_Case (int32 caseVal, int16 form);
static void OPC_CharacterLiteral (int32 c);
export void OPC_Cmp (int16 rel);
export void OPC_CompleteIdent (OPT_Object obj);
export void OPC_Constant (OPT_Const con, INTEGER 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);
@ -42,45 +42,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, LONGINT *off, LONGINT *n, LONGINT *curAlign);
static void OPC_FillGap (LONGINT gap, LONGINT off, LONGINT align, LONGINT *n, LONGINT *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, INTEGER 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 (LONGINT n);
export void OPC_Halt (int32 n);
export void OPC_Ident (OPT_Object obj);
static void OPC_IdentList (OPT_Object obj, INTEGER 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, INTEGER vis);
static void OPC_IncludeImports (OPT_Object obj, int16 vis);
export void OPC_Increment (BOOLEAN decrement);
export void OPC_Indent (INTEGER 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 (LONGINT n, LONGINT size);
export void OPC_Len (OPT_Object obj, OPT_Struct array, LONGINT dim);
export void OPC_IntLiteral (int32 n, int32 size);
export void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim);
static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName);
static INTEGER OPC_Length (CHAR *s, LONGINT s__len);
export LONGINT OPC_NofPtrs (OPT_Struct typ);
static INTEGER 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, SHORTINT vis);
static void OPC_ProcPredefs (OPT_Object obj, int8 vis);
static void OPC_PutBase (OPT_Struct typ);
static void OPC_PutPtrOffsets (OPT_Struct typ, LONGINT adr, LONGINT *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 LONGINT OPC_SizeAlignment (LONGINT 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, LONGINT x);
static void OPC_StringLiteral (CHAR *s, LONGINT s__len, LONGINT 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, INTEGER vis);
export void OPC_TypeDefs (OPT_Object obj, int16 vis);
export void OPC_TypeOf (OPT_Object ap);
static BOOLEAN OPC_Undefined (OPT_Object obj);
@ -98,14 +98,14 @@ void OPC_Init (void)
}
}
void OPC_Indent (INTEGER count)
void OPC_Indent (int16 count)
{
OPC_indentLevel += count;
}
void OPC_BegStat (void)
{
INTEGER i;
int16 i;
i = OPC_indentLevel;
while (i > 0) {
OPM_Write(0x09);
@ -141,10 +141,10 @@ void OPC_EndBlk0 (void)
OPM_Write('}');
}
static void OPC_Str1 (CHAR *s, LONGINT s__len, LONGINT x)
static void OPC_Str1 (CHAR *s, LONGINT s__len, int32 x)
{
CHAR ch;
INTEGER i;
int16 i;
__DUP(s, s__len, CHAR);
ch = s[0];
i = 0;
@ -160,10 +160,10 @@ static void OPC_Str1 (CHAR *s, LONGINT s__len, LONGINT x)
__DEL(s);
}
static INTEGER OPC_Length (CHAR *s, LONGINT s__len)
static int16 OPC_Length (CHAR *s, LONGINT s__len)
{
INTEGER _o_result;
INTEGER i;
int16 _o_result;
int16 i;
i = 0;
while (s[__X(i, s__len)] != 0x00) {
i += 1;
@ -172,14 +172,14 @@ static INTEGER OPC_Length (CHAR *s, LONGINT s__len)
return _o_result;
}
static INTEGER OPC_PerfectHash (CHAR *s, LONGINT s__len)
static int16 OPC_PerfectHash (CHAR *s, LONGINT s__len)
{
INTEGER _o_result;
INTEGER i, h;
int16 _o_result;
int16 i, h;
i = 0;
h = 0;
while ((s[__X(i, s__len)] != 0x00 && i < 5)) {
h = 3 * h + (SYSTEM_INT16)s[__X(i, s__len)];
h = 3 * h + (int16)s[__X(i, s__len)];
i += 1;
}
_o_result = (int)__MOD(h, 105);
@ -188,17 +188,20 @@ static INTEGER OPC_PerfectHash (CHAR *s, LONGINT s__len)
void OPC_Ident (OPT_Object obj)
{
INTEGER mode, level, h;
int16 mode, level, h;
mode = obj->mode;
level = obj->mnolev;
if ((__IN(mode, 0x62) && level > 0) || __IN(mode, 0x14)) {
OPM_WriteStringVar((void*)obj->name, 256);
h = OPC_PerfectHash((void*)obj->name, 256);
if (OPC_hashtab[__X(h, 105)] >= 0) {
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 36)], obj->name) == 0) {
if (__STRCMP(OPC_keytab[__X(OPC_hashtab[__X(h, 105)], 50)], obj->name) == 0) {
OPM_Write('_');
}
}
} else if ((mode == 5 && obj->typ->form == 4)) {
OPM_WriteString((CHAR*)"int", 4);
OPM_WriteInt(__ASHL(obj->typ->size, 3));
} else {
if (mode != 5 || obj->linkadr != 2) {
if (mode == 13) {
@ -212,7 +215,7 @@ void OPC_Ident (OPT_Object obj)
OPM_WriteStringVar((void*)OPM_modName, 32);
}
OPM_Write('_');
} else if ((((((obj == OPT_sysptrtyp->strobj || obj == OPT_ainttyp->strobj) || obj == OPT_int8typ->strobj) || obj == OPT_int16typ->strobj) || obj == OPT_int32typ->strobj) || obj == OPT_int64typ->strobj) || obj == OPT_bytetyp->strobj) {
} else if ((obj == OPT_sysptrtyp->strobj || obj == OPT_ainttyp->strobj) || obj == OPT_bytetyp->strobj) {
OPM_WriteString((CHAR*)"SYSTEM_", 8);
}
OPM_WriteStringVar((void*)obj->name, 256);
@ -221,7 +224,7 @@ void OPC_Ident (OPT_Object obj)
static void OPC_Stars (OPT_Struct typ, BOOLEAN *openClause)
{
INTEGER pointers;
int16 pointers;
*openClause = 0;
if (((typ->strobj == NIL || typ->strobj->name[0] == 0x00) && typ->comp != 4)) {
if (__IN(typ->comp, 0x0c)) {
@ -257,7 +260,7 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef)
{
OPT_Struct typ = NIL;
BOOLEAN varPar, openClause;
INTEGER form, comp;
int16 form, comp;
typ = dcl->typ;
varPar = ((dcl->mode == 2 && typ->comp != 2) || typ->comp == 3) || scopeDef;
OPC_Stars(typ, &openClause);
@ -327,8 +330,8 @@ static void OPC_DeclareBase (OPT_Object dcl)
{
OPT_Struct typ = NIL, prev = NIL;
OPT_Object obj = NIL;
INTEGER nofdims;
LONGINT 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 +390,12 @@ static void OPC_DeclareBase (OPT_Object dcl)
}
}
LONGINT OPC_NofPtrs (OPT_Struct typ)
int32 OPC_NofPtrs (OPT_Struct typ)
{
LONGINT _o_result;
int32 _o_result;
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
LONGINT n;
int32 n;
if ((typ->form == 11 && typ->sysflag == 0)) {
_o_result = 1;
return _o_result;
@ -430,11 +433,11 @@ LONGINT OPC_NofPtrs (OPT_Struct typ)
__RETCHK;
}
static void OPC_PutPtrOffsets (OPT_Struct typ, LONGINT adr, LONGINT *cnt)
static void OPC_PutPtrOffsets (OPT_Struct typ, int32 adr, int32 *cnt)
{
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
LONGINT n, i;
int32 n, i;
if ((typ->form == 11 && typ->sysflag == 0)) {
OPM_WriteInt(adr);
OPM_WriteString((CHAR*)", ", 3);
@ -510,7 +513,7 @@ static void OPC_PutBase (OPT_Struct typ)
static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName)
{
OPT_Struct typ = NIL;
INTEGER dim;
int16 dim;
if (showParamName) {
OPC_Ident(par);
OPM_WriteString((CHAR*)"__len", 6);
@ -610,7 +613,7 @@ OPT_Object OPC_BaseTProc (OPT_Object obj)
{
OPT_Object _o_result;
OPT_Struct typ = NIL, base = NIL;
LONGINT mno;
int32 mno;
typ = obj->link->typ;
if (typ->form == 11) {
typ = typ->BaseTyp;
@ -739,7 +742,7 @@ static void OPC_DefineType (OPT_Struct str)
static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len)
{
BOOLEAN _o_result;
INTEGER i;
int16 i;
BOOLEAN r;
__DUP(y, y__len, CHAR);
i = 0;
@ -752,14 +755,14 @@ static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len)
return _o_result;
}
static void OPC_CProcDefs (OPT_Object obj, INTEGER vis)
static void OPC_CProcDefs (OPT_Object obj, int16 vis)
{
INTEGER i;
int16 i;
OPT_ConstExt ext = NIL;
INTEGER _for__9;
int16 _for__9;
if (obj != NIL) {
OPC_CProcDefs(obj->left, vis);
if ((((obj->mode == 9 && (SYSTEM_INT16)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)))) {
@ -768,7 +771,7 @@ static void OPC_CProcDefs (OPT_Object obj, INTEGER vis)
OPC_DeclareParams(obj->link, 1);
OPM_Write(0x09);
}
_for__9 = (SYSTEM_INT16)(*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)]);
@ -780,7 +783,7 @@ static void OPC_CProcDefs (OPT_Object obj, INTEGER vis)
}
}
void OPC_TypeDefs (OPT_Object obj, INTEGER vis)
void OPC_TypeDefs (OPT_Object obj, int16 vis)
{
if (obj != NIL) {
OPC_TypeDefs(obj->left, vis);
@ -812,7 +815,7 @@ static void OPC_DefAnonRecs (OPT_Node n)
void OPC_TDescDecl (OPT_Struct typ)
{
LONGINT nofptrs;
int32 nofptrs;
OPT_Object o = NIL;
OPC_BegStat();
OPM_WriteString((CHAR*)"__TDESC(", 9);
@ -849,7 +852,7 @@ void OPC_InitTDesc (OPT_Struct typ)
}
}
void OPC_Align (LONGINT *adr, LONGINT base)
void OPC_Align (int32 *adr, int32 base)
{
switch (base) {
case 2:
@ -869,10 +872,10 @@ void OPC_Align (LONGINT *adr, LONGINT base)
}
}
LONGINT OPC_SizeAlignment (LONGINT size)
int32 OPC_SizeAlignment (int32 size)
{
LONGINT _o_result;
LONGINT alignment;
int32 _o_result;
int32 alignment;
if (size < OPM_Alignment) {
alignment = 1;
while (alignment < size) {
@ -885,10 +888,10 @@ LONGINT OPC_SizeAlignment (LONGINT size)
return _o_result;
}
LONGINT OPC_BaseAlignment (OPT_Struct typ)
int32 OPC_BaseAlignment (OPT_Struct typ)
{
LONGINT _o_result;
LONGINT alignment;
int32 _o_result;
int32 alignment;
if (typ->form == 13) {
if (typ->comp == 4) {
alignment = __MASK(typ->align, -65536);
@ -902,9 +905,9 @@ LONGINT OPC_BaseAlignment (OPT_Struct typ)
return _o_result;
}
static void OPC_FillGap (LONGINT gap, LONGINT off, LONGINT align, LONGINT *n, LONGINT *curAlign)
static void OPC_FillGap (int32 gap, int32 off, int32 align, int32 *n, int32 *curAlign)
{
LONGINT adr;
int32 adr;
adr = off;
OPC_Align(&adr, align);
if ((*curAlign < align && gap - (adr - off) >= align)) {
@ -931,11 +934,11 @@ static void OPC_FillGap (LONGINT gap, LONGINT off, LONGINT align, LONGINT *n, LO
}
}
static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, LONGINT *off, LONGINT *n, LONGINT *curAlign)
static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, int32 *off, int32 *n, int32 *curAlign)
{
OPT_Object fld = NIL;
OPT_Struct base = NIL;
LONGINT gap, adr, align, fldAlign;
int32 gap, adr, align, fldAlign;
fld = typ->link;
align = __MASK(typ->align, -65536);
if (typ->BaseTyp != NIL) {
@ -991,16 +994,16 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, LONGINT *off, LONGINT *
}
}
static void OPC_IdentList (OPT_Object obj, INTEGER vis)
static void OPC_IdentList (OPT_Object obj, int16 vis)
{
OPT_Struct base = NIL;
BOOLEAN first;
INTEGER lastvis;
int16 lastvis;
base = NIL;
first = 1;
while ((obj != NIL && obj->mode != 13)) {
if ((__IN(vis, 0x05) || (vis == 1 && obj->vis != 0)) || (vis == 3 && !obj->leaf)) {
if (obj->typ != base || (SYSTEM_INT16)obj->vis != lastvis) {
if (obj->typ != base || (int16)obj->vis != lastvis) {
if (!first) {
OPC_EndStat();
}
@ -1120,7 +1123,7 @@ static void OPC_ProcHeader (OPT_Object proc, BOOLEAN define)
}
}
static void OPC_ProcPredefs (OPT_Object obj, SHORTINT vis)
static void OPC_ProcPredefs (OPT_Object obj, int8 vis)
{
if (obj != NIL) {
OPC_ProcPredefs(obj->left, vis);
@ -1150,18 +1153,18 @@ static void OPC_Include (CHAR *name, LONGINT name__len)
__DEL(name);
}
static void OPC_IncludeImports (OPT_Object obj, INTEGER 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)) && (SYSTEM_INT16)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, INTEGER vis)
static void OPC_GenDynTypes (OPT_Node n, int16 vis)
{
OPT_Struct typ = NIL;
while ((n != NIL && n->class == 14)) {
@ -1209,7 +1212,7 @@ void OPC_GenHdr (OPT_Node n)
static void OPC_GenHeaderMsg (void)
{
INTEGER i;
int16 i;
OPM_WriteString((CHAR*)"/* ", 4);
OPM_WriteString((CHAR*)"voc", 4);
OPM_Write(' ');
@ -1360,7 +1363,7 @@ static void OPC_InitImports (OPT_Object obj)
void OPC_GenEnumPtrs (OPT_Object var)
{
OPT_Struct typ = NIL;
LONGINT n;
int32 n;
OPC_GlbPtrs = 0;
while (var != NIL) {
typ = var->typ;
@ -1521,7 +1524,7 @@ void OPC_EnterProc (OPT_Object proc)
{
OPT_Object var = NIL, scope = NIL;
OPT_Struct typ = NIL;
INTEGER dim;
int16 dim;
if (proc->vis != 1) {
OPM_WriteString((CHAR*)"static ", 8);
}
@ -1750,7 +1753,7 @@ void OPC_ExitProc (OPT_Object proc, BOOLEAN eoBlock, BOOLEAN implicitRet)
void OPC_CompleteIdent (OPT_Object obj)
{
INTEGER comp, level;
int16 comp, level;
level = obj->mnolev;
if (obj->adr == 1) {
if (obj->typ->comp == 4) {
@ -1779,10 +1782,10 @@ void OPC_CompleteIdent (OPT_Object obj)
void OPC_TypeOf (OPT_Object ap)
{
INTEGER i;
int16 i;
__ASSERT(ap->typ->comp == 4, 0);
if (ap->mode == 2) {
if ((SYSTEM_INT16)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);
@ -1798,7 +1801,7 @@ void OPC_TypeOf (OPT_Object ap)
}
}
void OPC_Cmp (INTEGER rel)
void OPC_Cmp (int16 rel)
{
switch (rel) {
case 9:
@ -1827,7 +1830,7 @@ void OPC_Cmp (INTEGER rel)
}
}
static void OPC_CharacterLiteral (LONGINT c)
static void OPC_CharacterLiteral (int32 c)
{
if (c < 32 || c > 126) {
OPM_WriteString((CHAR*)"0x", 3);
@ -1842,15 +1845,15 @@ static void OPC_CharacterLiteral (LONGINT c)
}
}
static void OPC_StringLiteral (CHAR *s, LONGINT s__len, LONGINT l)
static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int32 l)
{
LONGINT i;
INTEGER c;
int32 i;
int16 c;
__DUP(s, s__len, CHAR);
OPM_Write('"');
i = 0;
while (i < l) {
c = (SYSTEM_INT16)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)));
@ -1870,7 +1873,7 @@ static void OPC_StringLiteral (CHAR *s, LONGINT s__len, LONGINT l)
__DEL(s);
}
void OPC_Case (LONGINT caseVal, INTEGER form)
void OPC_Case (int32 caseVal, int16 form)
{
CHAR ch;
OPM_WriteString((CHAR*)"case ", 6);
@ -1908,30 +1911,17 @@ void OPC_Increment (BOOLEAN decrement)
}
}
void OPC_Halt (LONGINT n)
void OPC_Halt (int32 n)
{
OPC_Str1((CHAR*)"__HALT(#)", 10, n);
}
void OPC_IntLiteral (LONGINT n, LONGINT size)
void OPC_IntLiteral (int32 n, int32 size)
{
if ((((size > 4 && n <= 2147483647)) && n > (-2147483647-1))) {
switch (size) {
case 2:
OPM_WriteString((CHAR*)"((SYSTEM_INT16)(", 17);
break;
case 4:
OPM_WriteString((CHAR*)"((SYSTEM_INT32)(", 17);
break;
case 8:
OPM_WriteString((CHAR*)"((SYSTEM_INT64)(", 17);
break;
default:
OPM_LogWStr((CHAR*)"Unhandled case in OPC.IntLiteral, size = ", 42);
OPM_LogWNum(size, 1);
OPM_LogWLn();
break;
}
OPM_WriteString((CHAR*)"((int", 6);
OPM_WriteInt(__ASHL(size, 3));
OPM_WriteString((CHAR*)")(", 3);
OPM_WriteInt(n);
OPM_WriteString((CHAR*)"))", 3);
} else {
@ -1939,7 +1929,7 @@ void OPC_IntLiteral (LONGINT n, LONGINT size)
}
}
void OPC_Len (OPT_Object obj, OPT_Struct array, LONGINT dim)
void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim)
{
if (array->comp == 3) {
OPC_CompleteIdent(obj);
@ -1960,11 +1950,11 @@ void OPC_Len (OPT_Object obj, OPT_Struct array, LONGINT dim)
}
}
void OPC_Constant (OPT_Const con, INTEGER form)
void OPC_Constant (OPT_Const con, int16 form)
{
INTEGER i;
int16 i;
SET s;
LONGINT hex;
int32 hex;
BOOLEAN skipLeading;
switch (form) {
case 1:
@ -2023,7 +2013,7 @@ void OPC_Constant (OPT_Const con, INTEGER form)
}
static struct InitKeywords__48 {
SHORTINT *n;
int8 *n;
struct InitKeywords__48 *lnk;
} *InitKeywords__48_s;
@ -2031,18 +2021,18 @@ static void Enter__49 (CHAR *s, LONGINT s__len);
static void Enter__49 (CHAR *s, LONGINT s__len)
{
INTEGER h;
int16 h;
__DUP(s, s__len, CHAR);
h = OPC_PerfectHash((void*)s, s__len);
OPC_hashtab[__X(h, 105)] = *InitKeywords__48_s->n;
__COPY(s, OPC_keytab[__X(*InitKeywords__48_s->n, 36)], 9);
__COPY(s, OPC_keytab[__X(*InitKeywords__48_s->n, 50)], 9);
*InitKeywords__48_s->n += 1;
__DEL(s);
}
static void OPC_InitKeywords (void)
{
SHORTINT n, i;
int8 n, i;
struct InitKeywords__48 _s;
_s.n = &n;
_s.lnk = InitKeywords__48_s;
@ -2053,6 +2043,7 @@ static void OPC_InitKeywords (void)
OPC_hashtab[__X(i, 105)] = -1;
i += 1;
}
Enter__49((CHAR*)"adrint", 7);
Enter__49((CHAR*)"asm", 4);
Enter__49((CHAR*)"auto", 5);
Enter__49((CHAR*)"break", 6);
@ -2074,16 +2065,25 @@ static void OPC_InitKeywords (void)
Enter__49((CHAR*)"if", 3);
Enter__49((CHAR*)"import", 7);
Enter__49((CHAR*)"int", 4);
Enter__49((CHAR*)"int16", 6);
Enter__49((CHAR*)"int32", 6);
Enter__49((CHAR*)"int64", 6);
Enter__49((CHAR*)"int8", 5);
Enter__49((CHAR*)"long", 5);
Enter__49((CHAR*)"register", 9);
Enter__49((CHAR*)"return", 7);
Enter__49((CHAR*)"short", 6);
Enter__49((CHAR*)"signed", 7);
Enter__49((CHAR*)"sizeof", 7);
Enter__49((CHAR*)"size_t", 7);
Enter__49((CHAR*)"static", 7);
Enter__49((CHAR*)"struct", 7);
Enter__49((CHAR*)"switch", 7);
Enter__49((CHAR*)"typedef", 8);
Enter__49((CHAR*)"uint16", 7);
Enter__49((CHAR*)"uint32", 7);
Enter__49((CHAR*)"uint64", 7);
Enter__49((CHAR*)"uint8", 6);
Enter__49((CHAR*)"union", 6);
Enter__49((CHAR*)"unsigned", 9);
Enter__49((CHAR*)"void", 5);

View file

@ -9,16 +9,16 @@
import void OPC_Align (LONGINT *adr, LONGINT base);
import void OPC_Align (int32 *adr, int32 base);
import void OPC_Andent (OPT_Struct typ);
import LONGINT 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 (LONGINT caseVal, INTEGER form);
import void OPC_Cmp (INTEGER rel);
import void OPC_Case (int32 caseVal, int16 form);
import void OPC_Cmp (int16 rel);
import void OPC_CompleteIdent (OPT_Object obj);
import void OPC_Constant (OPT_Const con, INTEGER 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 (LONGINT n);
import void OPC_Halt (int32 n);
import void OPC_Ident (OPT_Object obj);
import void OPC_Increment (BOOLEAN decrement);
import void OPC_Indent (INTEGER count);
import void OPC_Indent (int16 count);
import void OPC_Init (void);
import void OPC_InitTDesc (OPT_Struct typ);
import void OPC_IntLiteral (LONGINT n, LONGINT size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, LONGINT dim);
import LONGINT OPC_NofPtrs (OPT_Struct typ);
import void OPC_IntLiteral (int32 n, int32 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int32 dim);
import int32 OPC_NofPtrs (OPT_Struct typ);
import void OPC_SetInclude (BOOLEAN exclude);
import LONGINT OPC_SizeAlignment (LONGINT size);
import int32 OPC_SizeAlignment (int32 size);
import void OPC_TDescDecl (OPT_Struct typ);
import void OPC_TypeDefs (OPT_Object obj, INTEGER vis);
import void OPC_TypeDefs (OPT_Object obj, int16 vis);
import void OPC_TypeOf (OPT_Object ap);
import void *OPC__init(void);

View file

@ -14,23 +14,23 @@ typedef
static CHAR OPM_SourceFileName[256];
export INTEGER OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet;
export LONGINT OPM_MaxIndex;
export int16 OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet;
export int32 OPM_MaxIndex;
export LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
export BOOLEAN OPM_noerr;
export LONGINT OPM_curpos, OPM_errpos, OPM_breakpc;
export INTEGER 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 LONGINT OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber, OPM_lasterrpos;
static int32 OPM_ErrorLineStartPos, OPM_ErrorLineLimitPos, OPM_ErrorLineNumber, 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 INTEGER OPM_S;
static int16 OPM_S;
export BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_notColorOutput, OPM_forceNewSym, OPM_Verbose;
static CHAR OPM_OBERON[1024];
static CHAR OPM_MODULES[1024];
@ -40,54 +40,54 @@ static void OPM_Append (Files_Rider *R, LONGINT *R__typ, Files_File F);
export void OPM_CloseFiles (void);
export void OPM_CloseOldSym (void);
export void OPM_DeleteNewSym (void);
export void OPM_FPrint (LONGINT *fp, LONGINT val);
export void OPM_FPrintLReal (LONGINT *fp, LONGREAL lr);
export void OPM_FPrintReal (LONGINT *fp, REAL real);
export void OPM_FPrintSet (LONGINT *fp, SET set);
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, LONGINT pos);
export void OPM_FPrint (int32 *fp, int32 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, LONGINT *r__typ, int32 pos);
export void OPM_Get (CHAR *ch);
static void OPM_GetProperties (void);
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, INTEGER *size, INTEGER *align);
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *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);
static void OPM_LogErrMsg (INTEGER n);
static void OPM_LogErrMsg (int16 n);
export void OPM_LogW (CHAR ch);
export void OPM_LogWLn (void);
export void OPM_LogWNum (LONGINT i, LONGINT len);
export void OPM_LogWNum (int32 i, int32 len);
export void OPM_LogWStr (CHAR *s, LONGINT s__len);
static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGINT FName__len, CHAR *ext, LONGINT ext__len);
export void OPM_Mark (INTEGER n, LONGINT pos);
export void OPM_Mark (int16 n, int32 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);
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 (LONGINT pos);
export LONGINT OPM_SignedMaximum (LONGINT bytecount);
export LONGINT OPM_SignedMinimum (LONGINT bytecount);
static void OPM_ShowLine (int32 pos);
export int32 OPM_SignedMaximum (int32 bytecount);
export int32 OPM_SignedMinimum (int32 bytecount);
export void OPM_SymRCh (CHAR *ch);
export LONGINT OPM_SymRInt (void);
export int32 OPM_SymRInt (void);
export void OPM_SymRLReal (LONGREAL *lr);
export void OPM_SymRReal (REAL *r);
export void OPM_SymRSet (SET *s);
export void OPM_SymWCh (CHAR ch);
export void OPM_SymWInt (LONGINT i);
export void OPM_SymWInt (int32 i);
export void OPM_SymWLReal (LONGREAL lr);
export void OPM_SymWReal (REAL r);
export void OPM_SymWSet (SET s);
static void OPM_VerboseListSizes (void);
export void OPM_Write (CHAR ch);
export void OPM_WriteHex (LONGINT i);
export void OPM_WriteInt (LONGINT i);
export void OPM_WriteHex (int32 i);
export void OPM_WriteInt (int32 i);
export void OPM_WriteLn (void);
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 (INTEGER n);
static LONGINT OPM_minusop (LONGINT i);
static LONGINT OPM_power0 (LONGINT i, LONGINT 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)
@ -102,7 +102,7 @@ void OPM_LogWStr (CHAR *s, LONGINT s__len)
__DEL(s);
}
void OPM_LogWNum (LONGINT i, LONGINT len)
void OPM_LogWNum (int32 i, int32 len)
{
Console_Int(i, len);
}
@ -114,7 +114,7 @@ void OPM_LogWLn (void)
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
{
INTEGER i;
int16 i;
i = 1;
while (s[__X(i, s__len)] != 0x00) {
switch (s[__X(i, s__len)]) {
@ -154,15 +154,15 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
case 'B':
if (s[__X(i + 1, s__len)] != 0x00) {
i += 1;
OPM_IntSize = (SYSTEM_INT16)s[__X(i, s__len)] - 48;
OPM_IntSize = (int16)s[__X(i, s__len)] - 48;
}
if (s[__X(i + 1, s__len)] != 0x00) {
i += 1;
OPM_PointerSize = (SYSTEM_INT16)s[__X(i, s__len)] - 48;
OPM_PointerSize = (int16)s[__X(i, s__len)] - 48;
}
if (s[__X(i + 1, s__len)] != 0x00) {
i += 1;
OPM_Alignment = (SYSTEM_INT16)s[__X(i, s__len)] - 48;
OPM_Alignment = (int16)s[__X(i, s__len)] - 48;
}
__ASSERT(OPM_IntSize == 2 || OPM_IntSize == 4, 0);
__ASSERT(OPM_PointerSize == 4 || OPM_PointerSize == 8, 0);
@ -299,7 +299,7 @@ void OPM_InitOptions (void)
void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len)
{
Texts_Text T = NIL;
LONGINT beg, end, time;
int32 beg, end, time;
CHAR s[256];
*done = 0;
OPM_curpos = 0;
@ -347,7 +347,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)
{
INTEGER i, j;
int16 i, j;
CHAR ch;
__DUP(ext, ext__len, CHAR);
i = 0;
@ -369,12 +369,12 @@ static void OPM_MakeFileName (CHAR *name, LONGINT name__len, CHAR *FName, LONGIN
__DEL(ext);
}
static void OPM_LogErrMsg (INTEGER n)
static void OPM_LogErrMsg (int16 n)
{
Texts_Scanner S;
Texts_Text T = NIL;
CHAR ch;
INTEGER i;
int16 i;
CHAR buf[1024];
if (n >= 0) {
if (!OPM_notColorOutput) {
@ -399,7 +399,7 @@ static void OPM_LogErrMsg (INTEGER n)
OPM_LogWStr(errors_errors[__X(n, 350)], 128);
}
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, LONGINT pos)
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int32 pos)
{
CHAR ch, cheol;
if (pos < OPM_ErrorLineStartPos) {
@ -431,12 +431,12 @@ static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, LONGINT
Files_Set(&*r, r__typ, f, OPM_ErrorLineStartPos);
}
static void OPM_ShowLine (LONGINT pos)
static void OPM_ShowLine (int32 pos)
{
Files_File f = NIL;
Files_Rider r;
CHAR line[1023];
INTEGER i;
int16 i;
CHAR ch;
f = Files_Old(OPM_SourceFileName, 256);
OPM_FindLine(f, &r, Files_Rider__typ, pos);
@ -458,7 +458,7 @@ static void OPM_ShowLine (LONGINT pos)
if (pos >= OPM_ErrorLineLimitPos) {
pos = OPM_ErrorLineLimitPos - 1;
}
i = (SYSTEM_INT16)(pos - OPM_ErrorLineStartPos);
i = (int16)(pos - OPM_ErrorLineStartPos);
while (i > 0) {
OPM_LogW(' ');
i -= 1;
@ -473,7 +473,7 @@ static void OPM_ShowLine (LONGINT pos)
Files_Close(f);
}
void OPM_Mark (INTEGER n, LONGINT pos)
void OPM_Mark (int16 n, int32 pos)
{
if (pos == -1) {
pos = 0;
@ -525,51 +525,51 @@ void OPM_Mark (INTEGER n, LONGINT pos)
}
}
void OPM_err (INTEGER n)
void OPM_err (int16 n)
{
OPM_Mark(n, OPM_errpos);
}
void OPM_FPrint (LONGINT *fp, LONGINT val)
void OPM_FPrint (int32 *fp, int32 val)
{
*fp = __ROTL((LONGINT)((SET)*fp ^ (SET)val), 1, LONGINT);
*fp = __ROTL((int32)((SET)*fp ^ (SET)val), 1, int32);
}
void OPM_FPrintSet (LONGINT *fp, SET set)
void OPM_FPrintSet (int32 *fp, SET set)
{
OPM_FPrint(&*fp, (LONGINT)set);
OPM_FPrint(&*fp, (int32)set);
}
void OPM_FPrintReal (LONGINT *fp, REAL real)
void OPM_FPrintReal (int32 *fp, REAL real)
{
INTEGER i;
LONGINT l;
__GET((SYSTEM_ADRINT)&real, l, LONGINT);
int16 i;
int32 l;
__GET((SYSTEM_ADRINT)&real, l, int32);
OPM_FPrint(&*fp, l);
}
void OPM_FPrintLReal (LONGINT *fp, LONGREAL lr)
void OPM_FPrintLReal (int32 *fp, LONGREAL lr)
{
LONGINT l, h;
__GET((SYSTEM_ADRINT)&lr, l, LONGINT);
__GET((SYSTEM_ADRINT)&lr + 4, h, LONGINT);
int32 l, h;
__GET((SYSTEM_ADRINT)&lr, l, int32);
__GET((SYSTEM_ADRINT)&lr + 4, h, int32);
OPM_FPrint(&*fp, l);
OPM_FPrint(&*fp, h);
}
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONGINT name__len, INTEGER *size, INTEGER *align)
static void OPM_GetProperty (Texts_Scanner *S, LONGINT *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 = (SYSTEM_INT16)(*S).i;
*size = (int16)(*S).i;
Texts_Scan(&*S, S__typ);
} else {
OPM_Mark(-157, -1);
}
if ((*S).class == 3) {
*align = (SYSTEM_INT16)(*S).i;
*align = (int16)(*S).i;
Texts_Scan(&*S, S__typ);
} else {
OPM_Mark(-157, -1);
@ -580,17 +580,17 @@ static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONG
__DEL(name);
}
static LONGINT OPM_minusop (LONGINT i)
static int32 OPM_minusop (int32 i)
{
LONGINT _o_result;
int32 _o_result;
_o_result = -i;
return _o_result;
}
static LONGINT OPM_power0 (LONGINT i, LONGINT j)
static int32 OPM_power0 (int32 i, int32 j)
{
LONGINT _o_result;
LONGINT k, p;
int32 _o_result;
int32 k, p;
k = 1;
p = i;
do {
@ -642,19 +642,19 @@ static void OPM_VerboseListSizes (void)
OPM_LogWLn();
}
LONGINT OPM_SignedMaximum (LONGINT bytecount)
int32 OPM_SignedMaximum (int32 bytecount)
{
LONGINT _o_result;
LONGINT result;
int32 _o_result;
int32 result;
result = 1;
result = __LSH(result, __ASHL(bytecount, 3) - 1, LONGINT);
result = __LSH(result, __ASHL(bytecount, 3) - 1, int32);
_o_result = result - 1;
return _o_result;
}
LONGINT OPM_SignedMinimum (LONGINT bytecount)
int32 OPM_SignedMinimum (int32 bytecount)
{
LONGINT _o_result;
int32 _o_result;
_o_result = -OPM_SignedMaximum(bytecount) - 1;
return _o_result;
}
@ -688,10 +688,10 @@ void OPM_SymRCh (CHAR *ch)
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&*ch);
}
LONGINT OPM_SymRInt (void)
int32 OPM_SymRInt (void)
{
LONGINT _o_result;
LONGINT k;
int32 _o_result;
int32 k;
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, &k);
_o_result = k;
return _o_result;
@ -699,7 +699,7 @@ LONGINT OPM_SymRInt (void)
void OPM_SymRSet (SET *s)
{
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (LONGINT*)&*s);
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (int32*)&*s);
}
void OPM_SymRReal (REAL *r)
@ -746,14 +746,14 @@ void OPM_SymWCh (CHAR ch)
Files_Write(&OPM_newSF, Files_Rider__typ, ch);
}
void OPM_SymWInt (LONGINT i)
void OPM_SymWInt (int32 i)
{
Files_WriteNum(&OPM_newSF, Files_Rider__typ, i);
}
void OPM_SymWSet (SET s)
{
Files_WriteNum(&OPM_newSF, Files_Rider__typ, (LONGINT)s);
Files_WriteNum(&OPM_newSF, Files_Rider__typ, (int32)s);
}
void OPM_SymWReal (REAL r)
@ -797,7 +797,7 @@ void OPM_Write (CHAR ch)
void OPM_WriteString (CHAR *s, LONGINT s__len)
{
INTEGER i;
int16 i;
i = 0;
while (s[__X(i, s__len)] != 0x00) {
i += 1;
@ -807,7 +807,7 @@ void OPM_WriteString (CHAR *s, LONGINT s__len)
void OPM_WriteStringVar (CHAR *s, LONGINT s__len)
{
INTEGER i;
int16 i;
i = 0;
while (s[__X(i, s__len)] != 0x00) {
i += 1;
@ -815,17 +815,17 @@ void OPM_WriteStringVar (CHAR *s, LONGINT s__len)
Files_WriteBytes(&OPM_R[__X(OPM_currFile, 3)], Files_Rider__typ, (void*)s, s__len * 1, i);
}
void OPM_WriteHex (LONGINT i)
void OPM_WriteHex (int32 i)
{
CHAR s[3];
INTEGER digit;
digit = __ASHR((SYSTEM_INT16)i, 4);
int16 digit;
digit = __ASHR((int16)i, 4);
if (digit < 10) {
s[0] = (CHAR)(48 + digit);
} else {
s[0] = (CHAR)(87 + digit);
}
digit = __MASK((SYSTEM_INT16)i, -16);
digit = __MASK((int16)i, -16);
if (digit < 10) {
s[1] = (CHAR)(48 + digit);
} else {
@ -835,10 +835,10 @@ void OPM_WriteHex (LONGINT i)
OPM_WriteString(s, 3);
}
void OPM_WriteInt (LONGINT i)
void OPM_WriteInt (int32 i)
{
CHAR s[20];
LONGINT i1, k;
int32 i1, k;
if (i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) {
OPM_Write('(');
OPM_WriteInt(i + 1);
@ -871,14 +871,14 @@ void OPM_WriteReal (LONGREAL r, CHAR suffx)
Texts_Reader R;
CHAR s[32];
CHAR ch;
INTEGER i;
if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == ((SYSTEM_INT32)__ENTIER(r)))) {
int16 i;
if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == ((int32)__ENTIER(r)))) {
if (suffx == 'f') {
OPM_WriteString((CHAR*)"(REAL)", 7);
} else {
OPM_WriteString((CHAR*)"(LONGREAL)", 11);
}
OPM_WriteInt((SYSTEM_INT32)__ENTIER(r));
OPM_WriteInt((int32)__ENTIER(r));
} else {
Texts_OpenWriter(&W, Texts_Writer__typ);
if (suffx == 'f') {
@ -959,7 +959,7 @@ void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len)
void OPM_CloseFiles (void)
{
CHAR FName[32];
INTEGER res;
int16 res;
if (OPM_noerr) {
OPM_LogWStr((CHAR*)" ", 3);
OPM_LogWNum(Files_Pos(&OPM_R[1], Files_Rider__typ), 0);

View file

@ -6,12 +6,12 @@
#include "SYSTEM.h"
import INTEGER OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet;
import LONGINT OPM_MaxIndex;
import int16 OPM_Alignment, OPM_ByteSize, OPM_CharSize, OPM_BoolSize, OPM_SIntSize, OPM_IntSize, OPM_LIntSize, OPM_SetSize, OPM_RealSize, OPM_LRealSize, OPM_PointerSize, OPM_ProcSize, OPM_RecSize, OPM_MaxSet;
import int32 OPM_MaxIndex;
import LONGREAL OPM_MinReal, OPM_MaxReal, OPM_MinLReal, OPM_MaxLReal;
import BOOLEAN OPM_noerr;
import LONGINT OPM_curpos, OPM_errpos, OPM_breakpc;
import INTEGER 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;
@ -21,44 +21,44 @@ import BOOLEAN OPM_dontAsm, OPM_dontLink, OPM_mainProg, OPM_mainLinkStat, OPM_no
import void OPM_CloseFiles (void);
import void OPM_CloseOldSym (void);
import void OPM_DeleteNewSym (void);
import void OPM_FPrint (LONGINT *fp, LONGINT val);
import void OPM_FPrintLReal (LONGINT *fp, LONGREAL lr);
import void OPM_FPrintReal (LONGINT *fp, REAL real);
import void OPM_FPrintSet (LONGINT *fp, SET set);
import void OPM_FPrint (int32 *fp, int32 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 void OPM_LogW (CHAR ch);
import void OPM_LogWLn (void);
import void OPM_LogWNum (LONGINT i, LONGINT len);
import void OPM_LogWNum (int32 i, int32 len);
import void OPM_LogWStr (CHAR *s, LONGINT s__len);
import void OPM_Mark (INTEGER n, LONGINT pos);
import void OPM_Mark (int16 n, int32 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 LONGINT OPM_SignedMaximum (LONGINT bytecount);
import LONGINT OPM_SignedMinimum (LONGINT bytecount);
import int32 OPM_SignedMaximum (int32 bytecount);
import int32 OPM_SignedMinimum (int32 bytecount);
import void OPM_SymRCh (CHAR *ch);
import LONGINT OPM_SymRInt (void);
import int32 OPM_SymRInt (void);
import void OPM_SymRLReal (LONGREAL *lr);
import void OPM_SymRReal (REAL *r);
import void OPM_SymRSet (SET *s);
import void OPM_SymWCh (CHAR ch);
import void OPM_SymWInt (LONGINT i);
import void OPM_SymWInt (int32 i);
import void OPM_SymWLReal (LONGREAL lr);
import void OPM_SymWReal (REAL r);
import void OPM_SymWSet (SET s);
import void OPM_Write (CHAR ch);
import void OPM_WriteHex (LONGINT i);
import void OPM_WriteInt (LONGINT i);
import void OPM_WriteHex (int32 i);
import void OPM_WriteInt (int32 i);
import void OPM_WriteLn (void);
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 (INTEGER n);
import void OPM_err (int16 n);
import void *OPM__init(void);

View file

@ -6,17 +6,17 @@
#include "OPT.h"
struct OPP__1 {
LONGINT low, high;
int32 low, high;
};
typedef
struct OPP__1 OPP_CaseTable[128];
static SHORTINT OPP_sym, OPP_level;
static INTEGER OPP_LoopLevel;
static int8 OPP_sym, OPP_level;
static int16 OPP_LoopLevel;
static OPT_Node OPP_TDinit, OPP_lastTDinit;
static INTEGER OPP_nofFwdPtr;
static int16 OPP_nofFwdPtr;
static OPT_Struct OPP_FwdPtr[64];
export LONGINT *OPP__1__typ;
@ -24,10 +24,10 @@ export LONGINT *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, INTEGER *n, OPP_CaseTable tab);
static void OPP_CheckMark (SHORTINT *vis);
static void OPP_CheckSym (INTEGER s);
static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_);
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 (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);
@ -37,7 +37,7 @@ static void OPP_FormalParameters (OPT_Object *firstPar, OPT_Struct *resTyp);
export void OPP_Module (OPT_Node *prog, SET opt);
static void OPP_PointerType (OPT_Struct *typ);
static void OPP_ProcedureDeclaration (OPT_Node *x);
static void OPP_Receiver (SHORTINT *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct *rec);
static void OPP_Receiver (int8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct *rec);
static void OPP_RecordType (OPT_Struct *typ, OPT_Struct *banned);
static void OPP_Sets (OPT_Node *x);
static void OPP_SimpleExpression (OPT_Node *x);
@ -46,19 +46,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 (INTEGER 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 (INTEGER n)
static void OPP_err (int16 n)
{
OPM_err(n);
}
static void OPP_CheckSym (INTEGER s)
static void OPP_CheckSym (int16 s)
{
if ((SYSTEM_INT16)OPP_sym == s) {
if ((int16)OPP_sym == s) {
OPS_Get(&OPP_sym);
} else {
OPM_err(s);
@ -68,7 +68,7 @@ static void OPP_CheckSym (INTEGER s)
static void OPP_qualident (OPT_Object *id)
{
OPT_Object obj = NIL;
SHORTINT lev;
int8 lev;
OPT_Find(&obj);
OPS_Get(&OPP_sym);
if ((((OPP_sym == 18 && obj != NIL)) && obj->mode == 11)) {
@ -108,7 +108,7 @@ static void OPP_ConstExpression (OPT_Node *x)
}
}
static void OPP_CheckMark (SHORTINT *vis)
static void OPP_CheckMark (int8 *vis)
{
OPS_Get(&OPP_sym);
if (OPP_sym == 1 || OPP_sym == 7) {
@ -126,10 +126,10 @@ static void OPP_CheckMark (SHORTINT *vis)
}
}
static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_)
static void OPP_CheckSysFlag (int16 *sysflag, int16 default_)
{
OPT_Node x = NIL;
LONGINT sf;
int32 sf;
if (OPP_sym == 31) {
OPS_Get(&OPP_sym);
if (!OPT_SYSimported) {
@ -146,7 +146,7 @@ static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_)
OPP_err(51);
sf = 0;
}
*sysflag = (SYSTEM_INT16)sf;
*sysflag = (int16)sf;
OPP_CheckSym(23);
} else {
*sysflag = default_;
@ -157,7 +157,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;
INTEGER sysflag;
int16 sysflag;
*typ = OPT_NewStr(13, 4);
(*typ)->BaseTyp = NIL;
OPP_CheckSysFlag(&sysflag, -1);
@ -249,8 +249,8 @@ static void OPP_RecordType (OPT_Struct *typ, OPT_Struct *banned)
static void OPP_ArrayType (OPT_Struct *typ, OPT_Struct *banned)
{
OPT_Node x = NIL;
LONGINT n;
INTEGER sysflag;
int32 n;
int16 sysflag;
OPP_CheckSysFlag(&sysflag, 0);
if (OPP_sym == 25) {
*typ = OPT_NewStr(13, 3);
@ -342,7 +342,7 @@ static void OPP_PointerType (OPT_Struct *typ)
static void OPP_FormalParameters (OPT_Object *firstPar, OPT_Struct *resTyp)
{
SHORTINT mode;
int8 mode;
OPT_Object par = NIL, first = NIL, last = NIL, res = NIL;
OPT_Struct typ = NIL;
first = NIL;
@ -623,9 +623,9 @@ static void OPP_ActualParameters (OPT_Node *aparlist, OPT_Object fpar)
static void OPP_StandProcCall (OPT_Node *x)
{
OPT_Node y = NIL;
SHORTINT m;
INTEGER n;
m = (SYSTEM_INT8)((SYSTEM_INT16)(*x)->obj->adr);
int8 m;
int16 n;
m = (int8)((int16)(*x)->obj->adr);
n = 0;
if (OPP_sym == 30) {
OPS_Get(&OPP_sym);
@ -784,7 +784,7 @@ static void OPP_Factor (OPT_Node *x)
static void OPP_Term (OPT_Node *x)
{
OPT_Node y = NIL;
SHORTINT mulop;
int8 mulop;
OPP_Factor(&*x);
while ((1 <= OPP_sym && OPP_sym <= 5)) {
mulop = OPP_sym;
@ -797,7 +797,7 @@ static void OPP_Term (OPT_Node *x)
static void OPP_SimpleExpression (OPT_Node *x)
{
OPT_Node y = NIL;
SHORTINT addop;
int8 addop;
if (OPP_sym == 7) {
OPS_Get(&OPP_sym);
OPP_Term(&*x);
@ -821,7 +821,7 @@ static void OPP_Expression (OPT_Node *x)
{
OPT_Node y = NIL;
OPT_Object obj = NIL;
SHORTINT relation;
int8 relation;
OPP_SimpleExpression(&*x);
if ((9 <= OPP_sym && OPP_sym <= 14)) {
relation = OPP_sym;
@ -847,7 +847,7 @@ static void OPP_Expression (OPT_Node *x)
}
}
static void OPP_Receiver (SHORTINT *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct *rec)
static void OPP_Receiver (int8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct *rec)
{
OPT_Object obj = NIL;
*typ = OPT_undftyp;
@ -913,7 +913,7 @@ static struct ProcedureDeclaration__16 {
OPT_Node *x;
OPT_Object *proc, *fwd;
OPS_Name *name;
SHORTINT *mode, *vis;
int8 *mode, *vis;
BOOLEAN *forward;
struct ProcedureDeclaration__16 *lnk;
} *ProcedureDeclaration__16_s;
@ -926,8 +926,8 @@ static void TProcDecl__23 (void);
static void GetCode__19 (void)
{
OPT_ConstExt ext = NIL;
INTEGER n;
LONGINT c;
int16 n;
int32 c;
ext = OPT_NewExt();
(*ProcedureDeclaration__16_s->proc)->conval->ext = ext;
n = 0;
@ -991,7 +991,7 @@ static void GetParams__21 (void)
static void Body__17 (void)
{
OPT_Node procdec = NIL, statseq = NIL;
LONGINT c;
int32 c;
c = OPM_errpos;
(*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1);
OPP_CheckSym(39);
@ -1014,7 +1014,7 @@ static void TProcDecl__23 (void)
{
OPT_Object baseProc = NIL;
OPT_Struct objTyp = NIL, recTyp = NIL;
SHORTINT objMode;
int8 objMode;
OPS_Name objName;
OPS_Get(&OPP_sym);
*ProcedureDeclaration__16_s->mode = 13;
@ -1086,7 +1086,7 @@ static void OPP_ProcedureDeclaration (OPT_Node *x)
{
OPT_Object proc = NIL, fwd = NIL;
OPS_Name name;
SHORTINT mode, vis;
int8 mode, vis;
BOOLEAN forward;
struct ProcedureDeclaration__16 _s;
_s.x = x;
@ -1163,11 +1163,11 @@ static void OPP_ProcedureDeclaration (OPT_Node *x)
ProcedureDeclaration__16_s = _s.lnk;
}
static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *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;
INTEGER i, f;
LONGINT xval, yval;
int16 i, f;
int32 xval, yval;
*lab = NIL;
lastlab = NIL;
for (;;) {
@ -1183,14 +1183,14 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, O
if (!(LabelTyp->form == 4) || LabelTyp->size < x->typ->size) {
OPP_err(60);
}
} else if ((SYSTEM_INT16)LabelTyp->form != f) {
} else if ((int16)LabelTyp->form != f) {
OPP_err(60);
}
if (OPP_sym == 21) {
OPS_Get(&OPP_sym);
OPP_ConstExpression(&y);
yval = y->conval->intval;
if (((SYSTEM_INT16)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) {
@ -1234,7 +1234,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, O
}
static struct StatSeq__30 {
LONGINT *pos;
int32 *pos;
struct StatSeq__30 *lnk;
} *StatSeq__30_s;
@ -1244,8 +1244,8 @@ static void SetPos__35 (OPT_Node x);
static void CasePart__31 (OPT_Node *x)
{
INTEGER n;
LONGINT low, high;
int16 n;
int32 low, high;
BOOLEAN e;
OPP_CaseTable tab;
OPT_Node cases = NIL, lab = NIL, y = NIL, lastcase = NIL;
@ -1328,7 +1328,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;
LONGINT pos;
int32 pos;
OPS_Name name;
struct StatSeq__30 _s;
_s.pos = &pos;
@ -1621,7 +1621,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;
INTEGER i;
int16 i;
first = NIL;
last = NIL;
OPP_nofFwdPtr = 0;
@ -1774,7 +1774,7 @@ void OPP_Module (OPT_Node *prog, SET opt)
{
OPS_Name impName, aliasName;
OPT_Node procdec = NIL, statseq = NIL;
LONGINT c;
int32 c;
BOOLEAN done;
OPS_Init();
OPP_LoopLevel = 0;

View file

@ -11,29 +11,29 @@ typedef
export OPS_Name OPS_name;
export OPS_String OPS_str;
export INTEGER OPS_numtyp;
export LONGINT OPS_intval;
export int16 OPS_numtyp;
export int32 OPS_intval;
export REAL OPS_realval;
export LONGREAL OPS_lrlval;
static CHAR OPS_ch;
export void OPS_Get (SHORTINT *sym);
static void OPS_Identifier (SHORTINT *sym);
export void OPS_Get (int8 *sym);
static void OPS_Identifier (int8 *sym);
export void OPS_Init (void);
static void OPS_Number (void);
static void OPS_Str (SHORTINT *sym);
static void OPS_err (INTEGER n);
static void OPS_Str (int8 *sym);
static void OPS_err (int16 n);
static void OPS_err (INTEGER n)
static void OPS_err (int16 n)
{
OPM_err(n);
}
static void OPS_Str (SHORTINT *sym)
static void OPS_Str (int8 *sym)
{
INTEGER i;
int16 i;
CHAR och;
i = 0;
och = OPS_ch;
@ -59,15 +59,15 @@ static void OPS_Str (SHORTINT *sym)
if (OPS_intval == 2) {
*sym = 35;
OPS_numtyp = 1;
OPS_intval = (SYSTEM_INT16)OPS_str[0];
OPS_intval = (int16)OPS_str[0];
} else {
*sym = 37;
}
}
static void OPS_Identifier (SHORTINT *sym)
static void OPS_Identifier (int8 *sym)
{
INTEGER i;
int16 i;
i = 0;
do {
OPS_name[i] = OPS_ch;
@ -86,10 +86,10 @@ static struct Number__6 {
struct Number__6 *lnk;
} *Number__6_s;
static INTEGER Ord__7 (CHAR ch, BOOLEAN hex);
static LONGREAL Ten__9 (INTEGER e);
static int16 Ord__7 (CHAR ch, BOOLEAN hex);
static LONGREAL Ten__9 (int16 e);
static LONGREAL Ten__9 (INTEGER e)
static LONGREAL Ten__9 (int16 e)
{
LONGREAL _o_result;
LONGREAL x, p;
@ -108,14 +108,14 @@ static LONGREAL Ten__9 (INTEGER e)
return _o_result;
}
static INTEGER Ord__7 (CHAR ch, BOOLEAN hex)
static int16 Ord__7 (CHAR ch, BOOLEAN hex)
{
INTEGER _o_result;
int16 _o_result;
if (ch <= '9') {
_o_result = (SYSTEM_INT16)ch - 48;
_o_result = (int16)ch - 48;
return _o_result;
} else if (hex) {
_o_result = ((SYSTEM_INT16)ch - 65) + 10;
_o_result = ((int16)ch - 65) + 10;
return _o_result;
} else {
OPS_err(2);
@ -127,7 +127,7 @@ static INTEGER Ord__7 (CHAR ch, BOOLEAN hex)
static void OPS_Number (void)
{
INTEGER i, m, n, d, e, maxHdig;
int16 i, m, n, d, e, maxHdig;
CHAR dig[24];
LONGREAL f;
CHAR expCh;
@ -309,9 +309,9 @@ static void Comment__2 (void)
}
}
void OPS_Get (SHORTINT *sym)
void OPS_Get (int8 *sym)
{
SHORTINT s;
int8 s;
struct Get__1 _s;
_s.lnk = Get__1_s;
Get__1_s = &_s;

View file

@ -14,13 +14,13 @@ typedef
import OPS_Name OPS_name;
import OPS_String OPS_str;
import INTEGER OPS_numtyp;
import LONGINT OPS_intval;
import int16 OPS_numtyp;
import int32 OPS_intval;
import REAL OPS_realval;
import LONGREAL OPS_lrlval;
import void OPS_Get (SHORTINT *sym);
import void OPS_Get (int8 *sym);
import void OPS_Init (void);
import void *OPS__init(void);

View file

@ -12,17 +12,17 @@ typedef
typedef
struct OPT_ConstDesc {
OPT_ConstExt ext;
LONGINT intval, intval2;
int32 intval, intval2;
SET setval;
LONGREAL realval;
} OPT_ConstDesc;
typedef
struct OPT_ExpCtxt {
LONGINT reffp;
INTEGER ref;
SHORTINT nofm;
SHORTINT locmno[64];
int32 reffp;
int16 ref;
int8 nofm;
int8 locmno[64];
} OPT_ExpCtxt;
typedef
@ -33,13 +33,13 @@ typedef
typedef
struct OPT_ImpCtxt {
LONGINT nextTag, reffp;
INTEGER nofr, minr, nofm;
int32 nextTag, reffp;
int16 nofr, minr, nofm;
BOOLEAN self;
OPT_Struct ref[255];
OPT_Object old[255];
LONGINT pvfp[255];
SHORTINT glbmno[64];
int32 pvfp[255];
int8 glbmno[64];
} OPT_ImpCtxt;
typedef
@ -48,7 +48,7 @@ typedef
typedef
struct OPT_NodeDesc {
OPT_Node left, right, link;
SHORTINT class, subcl;
int8 class, subcl;
BOOLEAN readonly;
OPT_Struct typ;
OPT_Object obj;
@ -60,22 +60,22 @@ typedef
OPT_Object left, right, link, scope;
OPS_Name name;
BOOLEAN leaf;
SHORTINT mode, mnolev, vis, history;
int8 mode, mnolev, vis, history;
BOOLEAN used, fpdone;
LONGINT fprint;
int32 fprint;
OPT_Struct typ;
OPT_Const conval;
LONGINT adr, linkadr;
INTEGER x;
int32 adr, linkadr;
int16 x;
} OPT_ObjDesc;
typedef
struct OPT_StrDesc {
SHORTINT form, comp, mno, extlev;
INTEGER ref, sysflag;
LONGINT n, size, align, txtpos;
int8 form, comp, mno, extlev;
int16 ref, sysflag;
int32 n, size, align, txtpos;
BOOLEAN allocated, pbused, pvused, fpdone, idfpdone;
LONGINT idfp, pbfp, pvfp;
int32 idfp, pbfp, pvfp;
OPT_Struct BaseTyp;
OPT_Object link, strobj;
} OPT_StrDesc;
@ -84,7 +84,7 @@ typedef
export void (*OPT_typSize)(OPT_Struct);
export OPT_Object OPT_topScope;
export OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
export SHORTINT OPT_nofGmod;
export int8 OPT_nofGmod;
export OPT_Object OPT_GlbMod[64];
export OPS_Name OPT_SelfName;
export BOOLEAN OPT_SYSimported;
@ -92,7 +92,7 @@ static OPT_Struct OPT_IntTypes[20];
static OPT_Object OPT_universe, OPT_syslink;
static OPT_ImpCtxt OPT_impCtxt;
static OPT_ExpCtxt OPT_expCtxt;
static LONGINT OPT_nofhdfld;
static int32 OPT_nofhdfld;
static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew;
export LONGINT *OPT_ConstDesc__typ;
@ -105,62 +105,62 @@ export LONGINT *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, LONGINT value);
static void OPT_EnterProc (OPS_Name name, INTEGER num);
static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER 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);
export void OPT_Export (BOOLEAN *ext, BOOLEAN *new);
export void OPT_FPrintErr (OPT_Object obj, INTEGER errcode);
static void OPT_FPrintName (LONGINT *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 (LONGINT *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 (LONGINT f, OPT_Const conval);
static void OPT_InConstant (int32 f, OPT_Const conval);
static OPT_Object OPT_InFld (void);
static void OPT_InMod (SHORTINT *mno);
static void OPT_InMod (int8 *mno);
static void OPT_InName (CHAR *name, LONGINT name__len);
static OPT_Object OPT_InObj (SHORTINT mno);
static void OPT_InSign (SHORTINT mno, OPT_Struct *res, OPT_Object *par);
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 (SHORTINT mno);
static OPT_Struct OPT_InTyp (LONGINT tag);
static OPT_Object OPT_InTProc (int8 mno);
static OPT_Struct OPT_InTyp (int32 tag);
export void OPT_Init (OPS_Name name, SET opt);
static void OPT_InitStruct (OPT_Struct *typ, SHORTINT form);
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 OPT_Struct OPT_IntType (LONGINT size);
export OPT_Struct OPT_IntType (int32 size);
export OPT_Const OPT_NewConst (void);
export OPT_ConstExt OPT_NewExt (void);
export OPT_Node OPT_NewNode (SHORTINT class);
export OPT_Node OPT_NewNode (int8 class);
export OPT_Object OPT_NewObj (void);
export OPT_Struct OPT_NewStr (SHORTINT form, SHORTINT comp);
export void OPT_OpenScope (SHORTINT level, OPT_Object owner);
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, LONGINT adr, BOOLEAN visible);
static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, LONGINT adr);
static void OPT_OutMod (INTEGER 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, INTEGER dir);
static void OPT_err (INTEGER n);
export OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir);
static void OPT_err (int16 n);
static void OPT_err (INTEGER n)
static void OPT_err (int16 n)
{
OPM_err(n);
}
OPT_Struct OPT_IntType (LONGINT size)
OPT_Struct OPT_IntType (int32 size)
{
OPT_Struct _o_result;
INTEGER i;
int16 i;
i = 1;
while ((OPT_IntTypes[__X(i, 20)]->size < size && OPT_IntTypes[__X(i + 1, 20)] != NIL)) {
i += 1;
@ -169,10 +169,10 @@ OPT_Struct OPT_IntType (LONGINT size)
return _o_result;
}
OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir)
OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir)
{
OPT_Struct _o_result;
INTEGER i;
int16 i;
__ASSERT(x->form == 4, 0);
__ASSERT(dir == 1 || dir == -1, 0);
__ASSERT(x->BaseTyp == OPT_undftyp, 0);
@ -203,7 +203,7 @@ OPT_Object OPT_NewObj (void)
return _o_result;
}
OPT_Struct OPT_NewStr (SHORTINT form, SHORTINT comp)
OPT_Struct OPT_NewStr (int8 form, int8 comp)
{
OPT_Struct _o_result;
OPT_Struct typ = NIL;
@ -220,7 +220,7 @@ OPT_Struct OPT_NewStr (SHORTINT form, SHORTINT comp)
return _o_result;
}
OPT_Node OPT_NewNode (SHORTINT class)
OPT_Node OPT_NewNode (int8 class)
{
OPT_Node _o_result;
OPT_Node node = NIL;
@ -239,7 +239,7 @@ OPT_ConstExt OPT_NewExt (void)
return _o_result;
}
void OPT_OpenScope (SHORTINT level, OPT_Object owner)
void OPT_OpenScope (int8 level, OPT_Object owner)
{
OPT_Object head = NIL;
head = OPT_NewObj();
@ -277,7 +277,7 @@ void OPT_Init (OPS_Name name, SET opt)
void OPT_Close (void)
{
INTEGER i;
int16 i;
OPT_CloseScope();
i = 0;
while (i < 64) {
@ -369,7 +369,7 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj)
{
OPT_Object ob0 = NIL, ob1 = NIL;
BOOLEAN left;
SHORTINT mnolev;
int8 mnolev;
ob0 = OPT_topScope;
ob1 = ob0->right;
left = 0;
@ -407,14 +407,14 @@ void OPT_Insert (OPS_Name name, OPT_Object *obj)
*obj = ob1;
}
static void OPT_FPrintName (LONGINT *fp, CHAR *name, LONGINT name__len)
static void OPT_FPrintName (int32 *fp, CHAR *name, LONGINT name__len)
{
INTEGER i;
int16 i;
CHAR ch;
i = 0;
do {
ch = name[__X(i, name__len)];
OPM_FPrint(&*fp, (SYSTEM_INT16)ch);
OPM_FPrint(&*fp, (int16)ch);
i += 1;
} while (!(ch == 0x00));
}
@ -452,7 +452,7 @@ static void OPT_DebugStruct (OPT_Struct btyp)
OPM_LogWLn();
}
static void OPT_FPrintSign (LONGINT *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);
@ -468,8 +468,8 @@ void OPT_IdFPrint (OPT_Struct typ)
{
OPT_Struct btyp = NIL;
OPT_Object strobj = NIL;
LONGINT idfp;
INTEGER f, c;
int32 idfp;
int16 f, c;
if (!typ->idfpdone) {
typ->idfpdone = 1;
idfp = 0;
@ -498,17 +498,17 @@ void OPT_IdFPrint (OPT_Struct typ)
}
static struct FPrintStr__12 {
LONGINT *pbfp, *pvfp;
int32 *pbfp, *pvfp;
struct FPrintStr__12 *lnk;
} *FPrintStr__12_s;
static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible);
static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr);
static void FPrintFlds__13 (OPT_Object fld, int32 adr, BOOLEAN visible);
static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, int32 adr);
static void FPrintTProcs__17 (OPT_Object obj);
static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr)
static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, int32 adr)
{
LONGINT i, j, n;
int32 i, j, n;
OPT_Struct btyp = NIL;
if (typ->comp == 4) {
FPrintFlds__13(typ->link, adr, 0);
@ -538,7 +538,7 @@ static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, LONGINT adr)
}
}
static void FPrintFlds__13 (OPT_Object fld, LONGINT adr, BOOLEAN visible)
static void FPrintFlds__13 (OPT_Object fld, int32 adr, BOOLEAN visible)
{
while ((fld != NIL && fld->mode == 4)) {
if ((fld->vis != 0 && visible)) {
@ -573,10 +573,10 @@ static void FPrintTProcs__17 (OPT_Object obj)
void OPT_FPrintStr (OPT_Struct typ)
{
INTEGER f, c;
int16 f, c;
OPT_Struct btyp = NIL;
OPT_Object strobj = NIL, bstrobj = NIL;
LONGINT pbfp, pvfp;
int32 pbfp, pvfp;
struct FPrintStr__12 _s;
_s.pbfp = &pbfp;
_s.pvfp = &pvfp;
@ -637,8 +637,8 @@ void OPT_FPrintStr (OPT_Struct typ)
void OPT_FPrintObj (OPT_Object obj)
{
LONGINT fprint;
INTEGER f, m;
int32 fprint;
int16 f, m;
REAL rval;
OPT_ConstExt ext = NIL;
if (!obj->fpdone) {
@ -680,11 +680,11 @@ void OPT_FPrintObj (OPT_Object obj)
} else if (obj->mode == 9) {
OPT_FPrintSign(&fprint, obj->typ, obj->link);
ext = obj->conval->ext;
m = (SYSTEM_INT16)(*ext)[0];
m = (int16)(*ext)[0];
f = 1;
OPM_FPrint(&fprint, m);
while (f <= m) {
OPM_FPrint(&fprint, (SYSTEM_INT16)(*ext)[__X(f, 256)]);
OPM_FPrint(&fprint, (int16)(*ext)[__X(f, 256)]);
f += 1;
}
} else if (obj->mode == 5) {
@ -695,9 +695,9 @@ void OPT_FPrintObj (OPT_Object obj)
}
}
void OPT_FPrintErr (OPT_Object obj, INTEGER errcode)
void OPT_FPrintErr (OPT_Object obj, int16 errcode)
{
INTEGER i, j;
int16 i, j;
CHAR ch;
if (obj->mnolev != 0) {
__COPY(OPT_GlbMod[__X(-obj->mnolev, 64)]->name, OPM_objname, 64);
@ -787,7 +787,7 @@ void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old)
static void OPT_InName (CHAR *name, LONGINT name__len)
{
INTEGER i;
int16 i;
CHAR ch;
i = 0;
do {
@ -797,12 +797,12 @@ static void OPT_InName (CHAR *name, LONGINT name__len)
} while (!(ch == 0x00));
}
static void OPT_InMod (SHORTINT *mno)
static void OPT_InMod (int8 *mno)
{
OPT_Object head = NIL;
OPS_Name name;
LONGINT mn;
SHORTINT i;
int32 mn;
int8 i;
mn = OPM_SymRInt();
if (mn == 0) {
*mno = OPT_impCtxt.glbmno[0];
@ -839,16 +839,16 @@ static void OPT_InMod (SHORTINT *mno)
}
}
static void OPT_InConstant (LONGINT f, OPT_Const conval)
static void OPT_InConstant (int32 f, OPT_Const conval)
{
CHAR ch;
INTEGER i;
int16 i;
OPT_ConstExt ext = NIL;
REAL rval;
switch (f) {
case 1: case 3: case 2:
OPM_SymRCh(&ch);
conval->intval = (SYSTEM_INT16)ch;
conval->intval = (int16)ch;
break;
case 4:
conval->intval = OPM_SymRInt();
@ -888,10 +888,10 @@ static void OPT_InConstant (LONGINT f, OPT_Const conval)
}
}
static void OPT_InSign (SHORTINT mno, OPT_Struct *res, OPT_Object *par)
static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par)
{
OPT_Object last = NIL, new = NIL;
LONGINT tag;
int32 tag;
OPT_InStruct(&*res);
tag = OPM_SymRInt();
last = NIL;
@ -919,7 +919,7 @@ static void OPT_InSign (SHORTINT mno, OPT_Struct *res, OPT_Object *par)
static OPT_Object OPT_InFld (void)
{
OPT_Object _o_result;
LONGINT tag;
int32 tag;
OPT_Object obj = NIL;
tag = OPT_impCtxt.nextTag;
obj = OPT_NewObj();
@ -948,10 +948,10 @@ static OPT_Object OPT_InFld (void)
return _o_result;
}
static OPT_Object OPT_InTProc (SHORTINT mno)
static OPT_Object OPT_InTProc (int8 mno)
{
OPT_Object _o_result;
LONGINT tag;
int32 tag;
OPT_Object obj = NIL;
tag = OPT_impCtxt.nextTag;
obj = OPT_NewObj();
@ -976,7 +976,7 @@ static OPT_Object OPT_InTProc (SHORTINT mno)
return _o_result;
}
static OPT_Struct OPT_InTyp (LONGINT tag)
static OPT_Struct OPT_InTyp (int32 tag)
{
OPT_Struct _o_result;
if (tag == 4) {
@ -991,9 +991,9 @@ static OPT_Struct OPT_InTyp (LONGINT tag)
static void OPT_InStruct (OPT_Struct *typ)
{
SHORTINT mno;
INTEGER ref;
LONGINT tag;
int8 mno;
int16 ref;
int32 tag;
OPS_Name name;
OPT_Struct t = NIL;
OPT_Object obj = NIL, last = NIL, fld = NIL, old = NIL, dummy = NIL;
@ -1049,7 +1049,7 @@ static void OPT_InStruct (OPT_Struct *typ)
obj->vis = 0;
tag = OPM_SymRInt();
if (tag == 35) {
(*typ)->sysflag = (SYSTEM_INT16)OPM_SymRInt();
(*typ)->sysflag = (int16)OPM_SymRInt();
tag = OPM_SymRInt();
}
switch (tag) {
@ -1171,14 +1171,14 @@ static void OPT_InStruct (OPT_Struct *typ)
}
}
static OPT_Object OPT_InObj (SHORTINT mno)
static OPT_Object OPT_InObj (int8 mno)
{
OPT_Object _o_result;
INTEGER i, s;
int16 i, s;
CHAR ch;
OPT_Object obj = NIL, old = NIL;
OPT_Struct typ = NIL;
LONGINT tag;
int32 tag;
OPT_ConstExt ext = NIL;
tag = OPT_impCtxt.nextTag;
if (tag == 19) {
@ -1211,7 +1211,7 @@ static OPT_Object OPT_InObj (SHORTINT mno)
obj->mode = 9;
ext = OPT_NewExt();
obj->conval->ext = ext;
s = (SYSTEM_INT16)OPM_SymRInt();
s = (int16)OPM_SymRInt();
(*ext)[0] = (CHAR)s;
i = 1;
while (i <= s) {
@ -1277,7 +1277,7 @@ static OPT_Object OPT_InObj (SHORTINT mno)
void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done)
{
OPT_Object obj = NIL;
SHORTINT mno;
int8 mno;
OPS_Name aliasName__copy;
__DUPARR(aliasName, OPS_Name);
if (__STRCMP(name, "SYSTEM") == 0) {
@ -1320,7 +1320,7 @@ void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done)
static void OPT_OutName (CHAR *name, LONGINT name__len)
{
INTEGER i;
int16 i;
CHAR ch;
i = 0;
do {
@ -1330,7 +1330,7 @@ static void OPT_OutName (CHAR *name, LONGINT name__len)
} while (!(ch == 0x00));
}
static void OPT_OutMod (INTEGER mno)
static void OPT_OutMod (int16 mno)
{
if (OPT_expCtxt.locmno[__X(mno, 64)] < 0) {
OPM_SymWInt(16);
@ -1342,9 +1342,9 @@ static void OPT_OutMod (INTEGER mno)
}
}
static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, LONGINT adr)
static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int32 adr)
{
LONGINT i, j, n;
int32 i, j, n;
OPT_Struct btyp = NIL;
if (typ->comp == 4) {
OPT_OutFlds(typ->link, adr, 0);
@ -1374,7 +1374,7 @@ static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, LONGINT adr)
}
}
static void OPT_OutFlds (OPT_Object fld, LONGINT 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)) {
@ -1529,7 +1529,7 @@ static void OPT_OutStr (OPT_Struct typ)
static void OPT_OutConstant (OPT_Object obj)
{
INTEGER f;
int16 f;
REAL rval;
f = obj->typ->form;
OPM_SymWInt(f);
@ -1564,7 +1564,7 @@ static void OPT_OutConstant (OPT_Object obj)
static void OPT_OutObj (OPT_Object obj)
{
INTEGER i, j;
int16 i, j;
OPT_ConstExt ext = NIL;
if (obj != NIL) {
OPT_OutObj(obj->left);
@ -1631,7 +1631,7 @@ static void OPT_OutObj (OPT_Object obj)
OPM_SymWInt(33);
OPT_OutSign(obj->typ, obj->link);
ext = obj->conval->ext;
j = (SYSTEM_INT16)(*ext)[0];
j = (int16)(*ext)[0];
i = 1;
OPM_SymWInt(j);
while (i <= j) {
@ -1654,8 +1654,8 @@ static void OPT_OutObj (OPT_Object obj)
void OPT_Export (BOOLEAN *ext, BOOLEAN *new)
{
INTEGER i;
SHORTINT nofmod;
int16 i;
int8 nofmod;
BOOLEAN done;
OPT_symExtended = 0;
OPT_symNew = 0;
@ -1697,7 +1697,7 @@ void OPT_Export (BOOLEAN *ext, BOOLEAN *new)
}
}
static void OPT_InitStruct (OPT_Struct *typ, SHORTINT form)
static void OPT_InitStruct (OPT_Struct *typ, int8 form)
{
*typ = OPT_NewStr(form, 1);
(*typ)->ref = form;
@ -1711,7 +1711,7 @@ static void OPT_InitStruct (OPT_Struct *typ, SHORTINT form)
(*typ)->idfpdone = 1;
}
static void OPT_EnterBoolConst (OPS_Name name, LONGINT value)
static void OPT_EnterBoolConst (OPS_Name name, int32 value)
{
OPT_Object obj = NIL;
OPS_Name name__copy;
@ -1723,7 +1723,7 @@ static void OPT_EnterBoolConst (OPS_Name name, LONGINT value)
obj->conval->intval = value;
}
static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER 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;
@ -1746,7 +1746,7 @@ static void OPT_EnterTyp (OPS_Name name, SHORTINT form, INTEGER size, OPT_Struct
*res = typ;
}
static void OPT_EnterProc (OPS_Name name, INTEGER num)
static void OPT_EnterProc (OPS_Name name, int16 num)
{
OPT_Object obj = NIL;
OPS_Name name__copy;

View file

@ -15,7 +15,7 @@ typedef
typedef
struct OPT_ConstDesc {
OPT_ConstExt ext;
LONGINT intval, intval2;
int32 intval, intval2;
SET setval;
LONGREAL realval;
} OPT_ConstDesc;
@ -32,7 +32,7 @@ typedef
typedef
struct OPT_NodeDesc {
OPT_Node left, right, link;
SHORTINT class, subcl;
int8 class, subcl;
BOOLEAN readonly;
OPT_Struct typ;
OPT_Object obj;
@ -44,20 +44,20 @@ typedef
OPT_Object left, right, link, scope;
OPS_Name name;
BOOLEAN leaf;
SHORTINT mode, mnolev, vis, history;
int8 mode, mnolev, vis, history;
BOOLEAN used, fpdone;
LONGINT fprint;
int32 fprint;
OPT_Struct typ;
OPT_Const conval;
LONGINT adr, linkadr;
INTEGER x;
int32 adr, linkadr;
int16 x;
} OPT_ObjDesc;
typedef
struct OPT_StrDesc {
SHORTINT form, comp, mno, extlev;
INTEGER ref, sysflag;
LONGINT n, size, align, txtpos;
int8 form, comp, mno, extlev;
int16 ref, sysflag;
int32 n, size, align, txtpos;
BOOLEAN allocated, pbused, pvused;
char _prvt0[16];
OPT_Struct BaseTyp;
@ -68,7 +68,7 @@ typedef
import void (*OPT_typSize)(OPT_Struct);
import OPT_Object OPT_topScope;
import OPT_Struct OPT_undftyp, OPT_bytetyp, OPT_booltyp, OPT_chartyp, OPT_sinttyp, OPT_inttyp, OPT_linttyp, OPT_ainttyp, OPT_int8typ, OPT_int16typ, OPT_int32typ, OPT_int64typ, OPT_realtyp, OPT_lrltyp, OPT_settyp, OPT_stringtyp, OPT_niltyp, OPT_notyp, OPT_sysptrtyp;
import SHORTINT OPT_nofGmod;
import int8 OPT_nofGmod;
import OPT_Object OPT_GlbMod[64];
import OPS_Name OPT_SelfName;
import BOOLEAN OPT_SYSimported;
@ -81,7 +81,7 @@ import LONGINT *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, INTEGER 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);
@ -92,14 +92,14 @@ 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 OPT_Struct OPT_IntType (LONGINT size);
import OPT_Struct OPT_IntType (int32 size);
import OPT_Const OPT_NewConst (void);
import OPT_ConstExt OPT_NewExt (void);
import OPT_Node OPT_NewNode (SHORTINT class);
import OPT_Node OPT_NewNode (int8 class);
import OPT_Object OPT_NewObj (void);
import OPT_Struct OPT_NewStr (SHORTINT form, SHORTINT comp);
import void OPT_OpenScope (SHORTINT level, OPT_Object owner);
import OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, INTEGER dir);
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, int16 dir);
import void *OPT__init(void);

View file

@ -7,15 +7,15 @@
typedef
struct OPV_ExitInfo {
INTEGER level, label;
int16 level, label;
} OPV_ExitInfo;
static BOOLEAN OPV_assert, OPV_inxchk, OPV_mainprog, OPV_ansi;
static INTEGER OPV_stamp;
static LONGINT OPV_recno;
static int16 OPV_stamp;
static int32 OPV_recno;
static OPV_ExitInfo OPV_exit;
static INTEGER OPV_nofExitLabels;
static int16 OPV_nofExitLabels;
static BOOLEAN OPV_naturalAlignment;
export LONGINT *OPV_ExitInfo__typ;
@ -23,38 +23,38 @@ export LONGINT *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, INTEGER 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, INTEGER 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, INTEGER prec, INTEGER 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, LONGINT dim);
static void OPV_Len (OPT_Node n, int32 dim);
export void OPV_Module (OPT_Node prog);
static LONGINT OPV_NaturalAlignment (LONGINT size, LONGINT max);
static int32 OPV_NaturalAlignment (int32 size, int32 max);
static void OPV_NewArr (OPT_Node d, OPT_Node x);
static void OPV_ParIntLiteral (LONGINT n, LONGINT size);
static INTEGER OPV_Precedence (INTEGER class, INTEGER subclass, INTEGER form, INTEGER comp);
static void OPV_ParIntLiteral (int32 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 (LONGINT from, LONGINT 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, INTEGER prec);
static void OPV_expr (OPT_Node n, INTEGER 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);
static LONGINT OPV_NaturalAlignment (LONGINT size, LONGINT max)
static int32 OPV_NaturalAlignment (int32 size, int32 max)
{
LONGINT _o_result;
LONGINT i;
int32 _o_result;
int32 i;
if (size >= max) {
_o_result = max;
return _o_result;
@ -71,8 +71,8 @@ static LONGINT OPV_NaturalAlignment (LONGINT size, LONGINT max)
void OPV_TypSize (OPT_Struct typ)
{
INTEGER f, c;
LONGINT 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) {
@ -118,7 +118,7 @@ void OPV_TypSize (OPT_Struct typ)
}
typ->size = offset;
typ->align = base;
typ->sysflag = __MASK(typ->sysflag, -256) + (SYSTEM_INT16)__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;
@ -156,7 +156,7 @@ void OPV_Init (void)
static void OPV_GetTProcNum (OPT_Object obj)
{
LONGINT oldPos;
int32 oldPos;
OPT_Struct typ = NIL;
OPT_Object redef = NIL;
oldPos = OPM_errpos;
@ -192,7 +192,7 @@ static void OPV_TraverseRecord (OPT_Struct typ)
static void OPV_Stamp (OPS_Name s)
{
INTEGER i, j, k;
int16 i, j, k;
CHAR n[10];
OPV_stamp += 1;
i = 0;
@ -222,7 +222,7 @@ static void OPV_Stamp (OPS_Name s)
static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported)
{
INTEGER mode;
int16 mode;
OPT_Object scope = NIL;
OPT_Struct typ = NIL;
if (obj != NIL) {
@ -297,9 +297,9 @@ void OPV_AdrAndSize (OPT_Object topScope)
OPT_sysptrtyp->strobj->linkadr = 2;
}
static INTEGER OPV_Precedence (INTEGER class, INTEGER subclass, INTEGER form, INTEGER comp)
static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp)
{
INTEGER _o_result;
int16 _o_result;
switch (class) {
case 7: case 0: case 2: case 4: case 9:
case 13:
@ -432,7 +432,7 @@ static INTEGER OPV_Precedence (INTEGER class, INTEGER subclass, INTEGER form, IN
__RETCHK;
}
static void OPV_Len (OPT_Node n, LONGINT dim)
static void OPV_Len (OPT_Node n, int32 dim)
{
while ((n->class == 4 && n->typ->comp == 3)) {
dim += 1;
@ -461,7 +461,7 @@ static BOOLEAN OPV_SideEffects (OPT_Node n)
__RETCHK;
}
static void OPV_Entier (OPT_Node n, INTEGER prec)
static void OPV_Entier (OPT_Node n, int16 prec)
{
if (__IN(n->typ->form, 0x60)) {
OPM_WriteString((CHAR*)"__ENTIER(", 10);
@ -472,34 +472,18 @@ static void OPV_Entier (OPT_Node n, INTEGER prec)
}
}
static void OPV_SizeCast (LONGINT from, LONGINT to)
static void OPV_SizeCast (int32 from, int32 to)
{
if ((from != to && (from > 4 || to != 4))) {
switch (to) {
case 1:
OPM_WriteString((CHAR*)"(SYSTEM_INT8)", 14);
break;
case 2:
OPM_WriteString((CHAR*)"(SYSTEM_INT16)", 15);
break;
case 4:
OPM_WriteString((CHAR*)"(SYSTEM_INT32)", 15);
break;
case 8:
OPM_WriteString((CHAR*)"(SYSTEM_INT64)", 15);
break;
default:
OPM_LogWStr((CHAR*)"Unhandled case in OPC.SizeCast, to = ", 38);
OPM_LogWNum(to, 1);
OPM_LogWLn();
break;
}
OPM_WriteString((CHAR*)"(int", 5);
OPM_WriteInt(__ASHL(to, 3));
OPM_WriteString((CHAR*)")", 2);
}
}
static void OPV_Convert (OPT_Node n, OPT_Struct newtype, INTEGER prec)
static void OPV_Convert (OPT_Node n, OPT_Struct newtype, int16 prec)
{
INTEGER from, to;
int16 from, to;
from = n->typ->form;
to = newtype->form;
if (to == 7) {
@ -561,7 +545,7 @@ static void OPV_TypeOf (OPT_Node n)
}
}
static void OPV_Index (OPT_Node n, OPT_Node d, INTEGER prec, INTEGER dim)
static void OPV_Index (OPT_Node n, OPT_Node d, int16 prec, int16 dim)
{
if (!OPV_inxchk || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) {
OPV_expr(n->right, prec);
@ -578,18 +562,18 @@ static void OPV_Index (OPT_Node n, OPT_Node d, INTEGER prec, INTEGER dim)
}
}
static void OPV_design (OPT_Node n, INTEGER prec)
static void OPV_design (OPT_Node n, int16 prec)
{
OPT_Object obj = NIL;
OPT_Struct typ = NIL;
INTEGER class, designPrec, comp;
int16 class, designPrec, comp;
OPT_Node d = NIL, x = NIL;
INTEGER dims, i, _for__28;
int16 dims, i, _for__28;
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)) && (SYSTEM_INT16)obj->mnolev != OPM_level)) && prec == 10)) {
if ((((((class == 0 && obj->mnolev > 0)) && (int16)obj->mnolev != OPM_level)) && prec == 10)) {
designPrec = 9;
}
if (prec > designPrec) {
@ -688,7 +672,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
if (__IN(3, OPM_opt)) {
if (typ->comp == 4) {
OPM_WriteString((CHAR*)"__GUARDR(", 10);
if ((SYSTEM_INT16)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);
@ -757,7 +741,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
}
}
static void OPV_ParIntLiteral (LONGINT n, LONGINT size)
static void OPV_ParIntLiteral (int32 n, int32 size)
{
if (OPV_ansi) {
OPM_WriteInt(n);
@ -769,7 +753,7 @@ static void OPV_ParIntLiteral (LONGINT n, LONGINT size)
static void OPV_ActualPar (OPT_Node n, OPT_Object fp)
{
OPT_Struct typ = NIL, aptyp = NIL;
INTEGER comp, form, mode, prec, dim;
int16 comp, form, mode, prec, dim;
OPM_Write('(');
while (n != NIL) {
typ = fp->typ;
@ -868,9 +852,9 @@ static OPT_Object OPV_SuperProc (OPT_Node n)
return _o_result;
}
static void OPV_expr (OPT_Node n, INTEGER prec)
static void OPV_expr (OPT_Node n, int16 prec)
{
INTEGER class, subclass, form, exprPrec;
int16 class, subclass, form, exprPrec;
OPT_Struct typ = NIL;
OPT_Node l = NIL, r = NIL;
OPT_Object proc = NIL;
@ -1186,7 +1170,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;
LONGINT adr;
int32 adr;
if_ = n->left;
while (if_ != NIL) {
OPM_WriteString((CHAR*)"if ", 4);
@ -1236,8 +1220,8 @@ static void OPV_IfStat (OPT_Node n, BOOLEAN withtrap, OPT_Object outerProc)
static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc)
{
OPT_Node switchCase = NIL, label = NIL;
LONGINT low, high;
INTEGER form, i;
int32 low, high;
int16 form, i;
OPM_WriteString((CHAR*)"switch ", 8);
OPV_expr(n->left, 12);
OPM_Write(' ');
@ -1304,7 +1288,7 @@ static BOOLEAN OPV_ImplicitReturn (OPT_Node n)
static void OPV_NewArr (OPT_Node d, OPT_Node x)
{
OPT_Struct typ = NIL, base = NIL;
INTEGER nofdim, nofdyn;
int16 nofdim, nofdyn;
typ = d->typ->BaseTyp;
base = typ;
nofdim = 0;

View file

@ -8,90 +8,90 @@ typedef
Platform_ArgPtr (*Platform_ArgVec)[1024];
typedef
LONGINT (*Platform_ArgVecPtr)[1];
int32 (*Platform_ArgVecPtr)[1];
typedef
CHAR (*Platform_EnvPtr)[1024];
typedef
struct Platform_FileIdentity {
LONGINT volume, indexhigh, indexlow, mtimehigh, mtimelow;
int32 volume, indexhigh, indexlow, mtimehigh, mtimelow;
} Platform_FileIdentity;
typedef
void (*Platform_HaltProcedure)(LONGINT);
void (*Platform_HaltProcedure)(int32);
typedef
void (*Platform_SignalHandler)(INTEGER);
void (*Platform_SignalHandler)(int16);
export BOOLEAN Platform_LittleEndian;
export LONGINT Platform_MainStackFrame, Platform_HaltCode;
export INTEGER Platform_PID;
export int32 Platform_MainStackFrame, Platform_HaltCode;
export int16 Platform_PID;
export CHAR Platform_CWD[4096];
export INTEGER Platform_ArgCount;
export LONGINT Platform_ArgVector;
export int16 Platform_ArgCount;
export int32 Platform_ArgVector;
static Platform_HaltProcedure Platform_HaltHandler;
static LONGINT Platform_TimeStart;
export INTEGER Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
export LONGINT 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 LONGINT *Platform_FileIdentity__typ;
export BOOLEAN Platform_Absent (INTEGER e);
export INTEGER Platform_ArgPos (CHAR *s, LONGINT s__len);
export void Platform_AssertFail (LONGINT code);
export INTEGER Platform_Chdir (CHAR *n, LONGINT n__len);
export INTEGER Platform_Close (LONGINT h);
export BOOLEAN Platform_ConnectionFailed (INTEGER e);
export void Platform_Delay (LONGINT ms);
export BOOLEAN Platform_DifferentFilesystems (INTEGER e);
static void Platform_DisplayHaltCode (LONGINT code);
export INTEGER Platform_Error (void);
export void Platform_Exit (INTEGER code);
export void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len);
export void Platform_GetClock (LONGINT *t, LONGINT *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 (INTEGER n, LONGINT *val);
export void Platform_GetTimeOfDay (LONGINT *sec, LONGINT *usec);
export void Platform_Halt (LONGINT code);
export INTEGER Platform_Identify (LONGINT h, Platform_FileIdentity *identity, LONGINT *identity__typ);
export INTEGER Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ);
export BOOLEAN Platform_Inaccessible (INTEGER e);
export void Platform_Init (INTEGER argc, LONGINT argvadr);
export void Platform_MTimeAsClock (Platform_FileIdentity i, LONGINT *t, LONGINT *d);
export INTEGER Platform_New (CHAR *n, LONGINT n__len, LONGINT *h);
export BOOLEAN Platform_NoSuchDirectory (INTEGER e);
export LONGINT Platform_OSAllocate (LONGINT size);
export void Platform_OSFree (LONGINT address);
export INTEGER Platform_OldRO (CHAR *n, LONGINT n__len, LONGINT *h);
export INTEGER Platform_OldRW (CHAR *n, LONGINT n__len, LONGINT *h);
export INTEGER Platform_Read (LONGINT h, LONGINT p, LONGINT l, LONGINT *n);
export INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n);
export INTEGER Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len);
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, LONGINT *identity__typ);
export int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ);
export BOOLEAN Platform_Inaccessible (int16 e);
export void Platform_Init (int16 argc, int32 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 int32 Platform_OSAllocate (int32 size);
export void Platform_OSFree (int32 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, int32 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 INTEGER Platform_Seek (LONGINT h, LONGINT o, INTEGER 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, LONGINT *target__typ, Platform_FileIdentity source);
export INTEGER Platform_Size (LONGINT h, LONGINT *l);
export INTEGER Platform_Sync (LONGINT h);
export INTEGER 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 LONGINT Platform_Time (void);
export BOOLEAN Platform_TimedOut (INTEGER e);
export BOOLEAN Platform_TooManyFiles (INTEGER e);
export INTEGER Platform_Truncate (LONGINT h, LONGINT limit);
export INTEGER Platform_Unlink (CHAR *n, LONGINT n__len);
export INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l);
static void Platform_YMDHMStoClock (INTEGER ye, INTEGER mo, INTEGER da, INTEGER ho, INTEGER mi, INTEGER se, LONGINT *t, LONGINT *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, int32 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 (LONGINT l);
static void Platform_errint (int32 l);
static void Platform_errln (void);
static void Platform_errposint (LONGINT l);
static void Platform_errposint (int32 l);
export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len);
#include "WindowsWrapper.h"
@ -175,68 +175,68 @@ extern void Heap_InitHeap();
#define Platform_waitForProcess() (INTEGER)WaitForSingleObject(pi.hProcess, INFINITE)
#define Platform_writefile(fd, p, l) (INTEGER)WriteFile((HANDLE)(SYSTEM_ADRINT)fd, (void*)(SYSTEM_ADRINT)(p), (DWORD)l, 0,0)
BOOLEAN Platform_TooManyFiles (INTEGER e)
BOOLEAN Platform_TooManyFiles (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ERRORTOOMANYOPENFILES();
return _o_result;
}
BOOLEAN Platform_NoSuchDirectory (INTEGER e)
BOOLEAN Platform_NoSuchDirectory (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ERRORPATHNOTFOUND();
return _o_result;
}
BOOLEAN Platform_DifferentFilesystems (INTEGER e)
BOOLEAN Platform_DifferentFilesystems (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ERRORNOTSAMEDEVICE();
return _o_result;
}
BOOLEAN Platform_Inaccessible (INTEGER 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 (INTEGER e)
BOOLEAN Platform_Absent (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ERRORFILENOTFOUND() || e == Platform_ERRORPATHNOTFOUND();
return _o_result;
}
BOOLEAN Platform_TimedOut (INTEGER e)
BOOLEAN Platform_TimedOut (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ETIMEDOUT();
return _o_result;
}
BOOLEAN Platform_ConnectionFailed (INTEGER e)
BOOLEAN Platform_ConnectionFailed (int16 e)
{
BOOLEAN _o_result;
_o_result = ((e == Platform_ECONNREFUSED() || e == Platform_ECONNABORTED()) || e == Platform_ENETUNREACH()) || e == Platform_EHOSTUNREACH();
return _o_result;
}
LONGINT Platform_OSAllocate (LONGINT size)
int32 Platform_OSAllocate (int32 size)
{
LONGINT _o_result;
int32 _o_result;
_o_result = Platform_allocate(size);
return _o_result;
}
void Platform_OSFree (LONGINT address)
void Platform_OSFree (int32 address)
{
Platform_free(address);
}
void Platform_Init (INTEGER argc, LONGINT argvadr)
void Platform_Init (int16 argc, int32 argvadr)
{
Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr;
@ -251,7 +251,7 @@ BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__le
{
BOOLEAN _o_result;
CHAR buf[4096];
INTEGER res;
int16 res;
__DUP(var, var__len, CHAR);
res = Platform_getenv(var, var__len, (void*)buf, 4096);
if ((res > 0 && res < 4096)) {
@ -276,7 +276,7 @@ void Platform_GetEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len)
__DEL(var);
}
void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len)
void Platform_GetArg (int16 n, CHAR *val, LONGINT val__len)
{
Platform_ArgVec av = NIL;
if (n < Platform_ArgCount) {
@ -285,10 +285,10 @@ void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len)
}
}
void Platform_GetIntArg (INTEGER n, LONGINT *val)
void Platform_GetIntArg (int16 n, int32 *val)
{
CHAR s[64];
LONGINT k, d, i;
int32 k, d, i;
s[0] = 0x00;
Platform_GetArg(n, (void*)s, 64);
i = 0;
@ -296,11 +296,11 @@ void Platform_GetIntArg (INTEGER n, LONGINT *val)
i = 1;
}
k = 0;
d = (SYSTEM_INT16)s[__X(i, 64)] - 48;
d = (int16)s[__X(i, 64)] - 48;
while ((d >= 0 && d <= 9)) {
k = k * 10 + d;
i += 1;
d = (SYSTEM_INT16)s[__X(i, 64)] - 48;
d = (int16)s[__X(i, 64)] - 48;
}
if (s[0] == '-') {
k = -k;
@ -311,10 +311,10 @@ void Platform_GetIntArg (INTEGER n, LONGINT *val)
}
}
INTEGER Platform_ArgPos (CHAR *s, LONGINT s__len)
int16 Platform_ArgPos (CHAR *s, LONGINT s__len)
{
INTEGER _o_result;
INTEGER i;
int16 _o_result;
int16 i;
CHAR arg[256];
__DUP(s, s__len, CHAR);
i = 0;
@ -332,28 +332,28 @@ void Platform_SetBadInstructionHandler (Platform_SignalHandler handler)
{
}
static void Platform_YMDHMStoClock (INTEGER ye, INTEGER mo, INTEGER da, INTEGER ho, INTEGER mi, INTEGER se, LONGINT *t, LONGINT *d)
static void Platform_YMDHMStoClock (int16 ye, int16 mo, int16 da, int16 ho, int16 mi, int16 se, int32 *t, int32 *d)
{
*d = (__ASHL((int)__MOD(ye, 100), 9) + __ASHL((mo + 1), 5)) + da;
*t = (__ASHL(ho, 12) + __ASHL(mi, 6)) + se;
}
void Platform_GetClock (LONGINT *t, LONGINT *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);
}
LONGINT Platform_Time (void)
int32 Platform_Time (void)
{
LONGINT _o_result;
LONGINT ms;
int32 _o_result;
int32 ms;
ms = Platform_GetTickCount();
_o_result = (int)__MOD(ms - Platform_TimeStart, 2147483647);
return _o_result;
}
void Platform_Delay (LONGINT ms)
void Platform_Delay (int32 ms)
{
while (ms > 30000) {
Platform_sleep(30000);
@ -364,7 +364,7 @@ void Platform_Delay (LONGINT ms)
}
}
void Platform_GetTimeOfDay (LONGINT *sec, LONGINT *usec)
void Platform_GetTimeOfDay (int32 *sec, int32 *usec)
{
Platform_getLocalTime();
Platform_stToFt();
@ -374,10 +374,10 @@ void Platform_GetTimeOfDay (LONGINT *sec, LONGINT *usec)
*usec = Platform_uluSec();
}
INTEGER Platform_System (CHAR *cmd, LONGINT cmd__len)
int16 Platform_System (CHAR *cmd, LONGINT cmd__len)
{
INTEGER _o_result;
INTEGER result;
int16 _o_result;
int16 result;
__DUP(cmd, cmd__len, CHAR);
result = 127;
Platform_startupInfo();
@ -393,17 +393,17 @@ INTEGER Platform_System (CHAR *cmd, LONGINT cmd__len)
return _o_result;
}
INTEGER Platform_Error (void)
int16 Platform_Error (void)
{
INTEGER _o_result;
int16 _o_result;
_o_result = Platform_err();
return _o_result;
}
INTEGER Platform_OldRO (CHAR *n, LONGINT n__len, LONGINT *h)
int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h)
{
INTEGER _o_result;
LONGINT fd;
int16 _o_result;
int32 fd;
fd = Platform_openro(n, n__len);
if (fd == Platform_invalidHandleValue()) {
_o_result = Platform_err();
@ -416,10 +416,10 @@ INTEGER Platform_OldRO (CHAR *n, LONGINT n__len, LONGINT *h)
__RETCHK;
}
INTEGER Platform_OldRW (CHAR *n, LONGINT n__len, LONGINT *h)
int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h)
{
INTEGER _o_result;
LONGINT fd;
int16 _o_result;
int32 fd;
fd = Platform_openrw(n, n__len);
if (fd == Platform_invalidHandleValue()) {
_o_result = Platform_err();
@ -432,10 +432,10 @@ INTEGER Platform_OldRW (CHAR *n, LONGINT n__len, LONGINT *h)
__RETCHK;
}
INTEGER Platform_New (CHAR *n, LONGINT n__len, LONGINT *h)
int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h)
{
INTEGER _o_result;
LONGINT fd;
int16 _o_result;
int32 fd;
fd = Platform_opennew(n, n__len);
if (fd == Platform_invalidHandleValue()) {
_o_result = Platform_err();
@ -448,9 +448,9 @@ INTEGER Platform_New (CHAR *n, LONGINT n__len, LONGINT *h)
__RETCHK;
}
INTEGER Platform_Close (LONGINT h)
int16 Platform_Close (int32 h)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_closeHandle(h) == 0) {
_o_result = Platform_err();
return _o_result;
@ -461,9 +461,9 @@ INTEGER Platform_Close (LONGINT h)
__RETCHK;
}
INTEGER Platform_Identify (LONGINT h, Platform_FileIdentity *identity, LONGINT *identity__typ)
int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, LONGINT *identity__typ)
{
INTEGER _o_result;
int16 _o_result;
Platform_byHandleFileInformation();
if (Platform_getFileInformationByHandle(h) == 0) {
_o_result = Platform_err();
@ -478,11 +478,11 @@ INTEGER Platform_Identify (LONGINT h, Platform_FileIdentity *identity, LONGINT *
return _o_result;
}
INTEGER Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ)
int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ)
{
INTEGER _o_result;
LONGINT h;
INTEGER 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) {
@ -517,16 +517,16 @@ void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Pla
(*target).mtimelow = source.mtimelow;
}
void Platform_MTimeAsClock (Platform_FileIdentity i, LONGINT *t, LONGINT *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);
}
INTEGER Platform_Size (LONGINT h, LONGINT *l)
int16 Platform_Size (int32 h, int32 *l)
{
INTEGER _o_result;
int16 _o_result;
Platform_largeInteger();
if (Platform_getFileSize(h) == 0) {
_o_result = Platform_err();
@ -537,10 +537,10 @@ INTEGER Platform_Size (LONGINT h, LONGINT *l)
return _o_result;
}
INTEGER Platform_Read (LONGINT h, LONGINT p, LONGINT l, LONGINT *n)
int16 Platform_Read (int32 h, int32 p, int32 l, int32 *n)
{
INTEGER _o_result;
INTEGER result;
int16 _o_result;
int16 result;
*n = 0;
result = Platform_readfile(h, p, l, &*n);
if (result == 0) {
@ -554,10 +554,10 @@ INTEGER Platform_Read (LONGINT h, LONGINT p, LONGINT l, LONGINT *n)
__RETCHK;
}
INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n)
int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n)
{
INTEGER _o_result;
INTEGER result;
int16 _o_result;
int16 result;
*n = 0;
result = Platform_readfile(h, (SYSTEM_ADRINT)b, b__len, &*n);
if (result == 0) {
@ -571,9 +571,9 @@ INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n)
__RETCHK;
}
INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l)
int16 Platform_Write (int32 h, int32 p, int32 l)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_writefile(h, p, l) == 0) {
_o_result = Platform_err();
return _o_result;
@ -584,9 +584,9 @@ INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l)
__RETCHK;
}
INTEGER Platform_Sync (LONGINT h)
int16 Platform_Sync (int32 h)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_flushFileBuffers(h) == 0) {
_o_result = Platform_err();
return _o_result;
@ -597,10 +597,10 @@ INTEGER Platform_Sync (LONGINT h)
__RETCHK;
}
INTEGER Platform_Seek (LONGINT h, LONGINT o, INTEGER r)
int16 Platform_Seek (int32 h, int32 o, int16 r)
{
INTEGER _o_result;
INTEGER rc;
int16 _o_result;
int16 rc;
Platform_largeInteger();
Platform_setFilePointerEx(h, o, r, &rc);
if (rc == 0) {
@ -613,11 +613,11 @@ INTEGER Platform_Seek (LONGINT h, LONGINT o, INTEGER r)
__RETCHK;
}
INTEGER Platform_Truncate (LONGINT h, LONGINT limit)
int16 Platform_Truncate (int32 h, int32 limit)
{
INTEGER _o_result;
INTEGER rc;
LONGINT oldpos;
int16 _o_result;
int16 rc;
int32 oldpos;
Platform_largeInteger();
Platform_getFilePos(h, &oldpos, &rc);
if (rc == 0) {
@ -642,9 +642,9 @@ INTEGER Platform_Truncate (LONGINT h, LONGINT limit)
return _o_result;
}
INTEGER Platform_Unlink (CHAR *n, LONGINT n__len)
int16 Platform_Unlink (CHAR *n, LONGINT n__len)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_deleteFile(n, n__len) == 0) {
_o_result = Platform_err();
return _o_result;
@ -655,10 +655,10 @@ INTEGER Platform_Unlink (CHAR *n, LONGINT n__len)
__RETCHK;
}
INTEGER Platform_Chdir (CHAR *n, LONGINT n__len)
int16 Platform_Chdir (CHAR *n, LONGINT n__len)
{
INTEGER _o_result;
INTEGER r;
int16 _o_result;
int16 r;
r = Platform_setCurrentDirectory(n, n__len);
if (r == 0) {
_o_result = Platform_err();
@ -669,9 +669,9 @@ INTEGER Platform_Chdir (CHAR *n, LONGINT n__len)
return _o_result;
}
INTEGER 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)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_moveFile(o, o__len, n, n__len) == 0) {
_o_result = Platform_err();
return _o_result;
@ -682,7 +682,7 @@ INTEGER Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len)
__RETCHK;
}
void Platform_Exit (INTEGER code)
void Platform_Exit (int16 code)
{
Platform_exit(code);
}
@ -698,7 +698,7 @@ static void Platform_errln (void)
Platform_errch(0x0a);
}
static void Platform_errposint (LONGINT l)
static void Platform_errposint (int32 l)
{
if (l > 10) {
Platform_errposint(__DIV(l, 10));
@ -706,7 +706,7 @@ static void Platform_errposint (LONGINT l)
Platform_errch((CHAR)(48 + (int)__MOD(l, 10)));
}
static void Platform_errint (LONGINT l)
static void Platform_errint (int32 l)
{
if (l < 0) {
Platform_errch('-');
@ -715,7 +715,7 @@ static void Platform_errint (LONGINT l)
Platform_errposint(l);
}
static void Platform_DisplayHaltCode (LONGINT code)
static void Platform_DisplayHaltCode (int32 code)
{
switch (code) {
case -1:
@ -756,9 +756,9 @@ static void Platform_DisplayHaltCode (LONGINT code)
}
}
void Platform_Halt (LONGINT code)
void Platform_Halt (int32 code)
{
INTEGER e;
int16 e;
Platform_HaltCode = code;
if (Platform_HaltHandler != NIL) {
(*Platform_HaltHandler)(code);
@ -770,12 +770,12 @@ void Platform_Halt (LONGINT code)
Platform_DisplayHaltCode(code);
}
Platform_errln();
Platform_exit(__VAL(INTEGER, code));
Platform_exit(__VAL(int16, code));
}
void Platform_AssertFail (LONGINT code)
void Platform_AssertFail (int32 code)
{
INTEGER e;
int16 e;
Platform_errstring((CHAR*)"Assertion failure.", 19);
if (code != 0) {
Platform_errstring((CHAR*)" ASSERT code ", 14);
@ -783,7 +783,7 @@ void Platform_AssertFail (LONGINT code)
Platform_errstring((CHAR*)".", 2);
}
Platform_errln();
Platform_exit(__VAL(INTEGER, code));
Platform_exit(__VAL(int16, code));
}
void Platform_SetHalt (Platform_HaltProcedure p)
@ -793,7 +793,7 @@ void Platform_SetHalt (Platform_HaltProcedure p)
static void Platform_TestLittleEndian (void)
{
INTEGER i;
int16 i;
i = 1;
__GET((SYSTEM_ADRINT)&i, Platform_LittleEndian, BOOLEAN);
}

View file

@ -12,69 +12,69 @@ typedef
} Platform_FileIdentity;
typedef
void (*Platform_HaltProcedure)(LONGINT);
void (*Platform_HaltProcedure)(int32);
typedef
void (*Platform_SignalHandler)(INTEGER);
void (*Platform_SignalHandler)(int16);
import BOOLEAN Platform_LittleEndian;
import LONGINT Platform_MainStackFrame, Platform_HaltCode;
import INTEGER Platform_PID;
import int32 Platform_MainStackFrame, Platform_HaltCode;
import int16 Platform_PID;
import CHAR Platform_CWD[4096];
import INTEGER Platform_ArgCount;
import LONGINT Platform_ArgVector;
import INTEGER Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
import LONGINT Platform_StdIn, Platform_StdOut, Platform_StdErr;
import int16 Platform_ArgCount;
import int32 Platform_ArgVector;
import int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
import int32 Platform_StdIn, Platform_StdOut, Platform_StdErr;
import CHAR Platform_nl[3];
import LONGINT *Platform_FileIdentity__typ;
import BOOLEAN Platform_Absent (INTEGER e);
import INTEGER Platform_ArgPos (CHAR *s, LONGINT s__len);
import void Platform_AssertFail (LONGINT code);
import INTEGER Platform_Chdir (CHAR *n, LONGINT n__len);
import INTEGER Platform_Close (LONGINT h);
import BOOLEAN Platform_ConnectionFailed (INTEGER e);
import void Platform_Delay (LONGINT ms);
import BOOLEAN Platform_DifferentFilesystems (INTEGER e);
import INTEGER Platform_Error (void);
import void Platform_Exit (INTEGER code);
import void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len);
import void Platform_GetClock (LONGINT *t, LONGINT *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 (INTEGER n, LONGINT *val);
import void Platform_GetTimeOfDay (LONGINT *sec, LONGINT *usec);
import void Platform_Halt (LONGINT code);
import INTEGER Platform_Identify (LONGINT h, Platform_FileIdentity *identity, LONGINT *identity__typ);
import INTEGER Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ);
import BOOLEAN Platform_Inaccessible (INTEGER e);
import void Platform_Init (INTEGER argc, LONGINT argvadr);
import void Platform_MTimeAsClock (Platform_FileIdentity i, LONGINT *t, LONGINT *d);
import INTEGER Platform_New (CHAR *n, LONGINT n__len, LONGINT *h);
import BOOLEAN Platform_NoSuchDirectory (INTEGER e);
import LONGINT Platform_OSAllocate (LONGINT size);
import void Platform_OSFree (LONGINT address);
import INTEGER Platform_OldRO (CHAR *n, LONGINT n__len, LONGINT *h);
import INTEGER Platform_OldRW (CHAR *n, LONGINT n__len, LONGINT *h);
import INTEGER Platform_Read (LONGINT h, LONGINT p, LONGINT l, LONGINT *n);
import INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n);
import INTEGER Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len);
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, LONGINT *identity__typ);
import int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ);
import BOOLEAN Platform_Inaccessible (int16 e);
import void Platform_Init (int16 argc, int32 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 int32 Platform_OSAllocate (int32 size);
import void Platform_OSFree (int32 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, int32 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 INTEGER Platform_Seek (LONGINT h, LONGINT o, INTEGER 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, LONGINT *target__typ, Platform_FileIdentity source);
import INTEGER Platform_Size (LONGINT h, LONGINT *l);
import INTEGER Platform_Sync (LONGINT h);
import INTEGER Platform_System (CHAR *cmd, LONGINT cmd__len);
import LONGINT Platform_Time (void);
import BOOLEAN Platform_TimedOut (INTEGER e);
import BOOLEAN Platform_TooManyFiles (INTEGER e);
import INTEGER Platform_Truncate (LONGINT h, LONGINT limit);
import INTEGER Platform_Unlink (CHAR *n, LONGINT n__len);
import INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT 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, int32 p, int32 l);
import BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len);
import void *Platform__init(void);

View file

@ -5,19 +5,19 @@
static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LONGINT d__len);
export void Reals_Convert (REAL x, INTEGER 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, INTEGER n, CHAR *d, LONGINT d__len);
export INTEGER Reals_Expo (REAL x);
export INTEGER Reals_ExpoL (LONGREAL x);
export void Reals_SetExpo (REAL *x, INTEGER ex);
export REAL Reals_Ten (INTEGER e);
export LONGREAL Reals_TenL (INTEGER e);
static CHAR Reals_ToHex (INTEGER 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 (INTEGER e)
REAL Reals_Ten (int16 e)
{
REAL _o_result;
LONGREAL r, power;
@ -34,7 +34,7 @@ REAL Reals_Ten (INTEGER e)
return _o_result;
}
LONGREAL Reals_TenL (INTEGER e)
LONGREAL Reals_TenL (int16 e)
{
LONGREAL _o_result;
LONGREAL r, power;
@ -54,43 +54,43 @@ LONGREAL Reals_TenL (INTEGER e)
__RETCHK;
}
INTEGER Reals_Expo (REAL x)
int16 Reals_Expo (REAL x)
{
INTEGER _o_result;
INTEGER i;
__GET((SYSTEM_ADRINT)&x + 2, i, INTEGER);
int16 _o_result;
int16 i;
__GET((SYSTEM_ADRINT)&x + 2, i, int16);
_o_result = __MASK(__ASHR(i, 7), -256);
return _o_result;
}
void Reals_SetExpo (REAL *x, INTEGER ex)
void Reals_SetExpo (REAL *x, int16 ex)
{
CHAR c;
__GET((SYSTEM_ADRINT)x + 3, c, CHAR);
__PUT((SYSTEM_ADRINT)x + 3, (CHAR)(__ASHL(__ASHR((SYSTEM_INT16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
__PUT((SYSTEM_ADRINT)x + 3, (CHAR)(__ASHL(__ASHR((int16)c, 7), 7) + __MASK(__ASHR(ex, 1), -128)), CHAR);
__GET((SYSTEM_ADRINT)x + 2, c, CHAR);
__PUT((SYSTEM_ADRINT)x + 2, (CHAR)(__MASK((SYSTEM_INT16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
__PUT((SYSTEM_ADRINT)x + 2, (CHAR)(__MASK((int16)c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
}
INTEGER Reals_ExpoL (LONGREAL x)
int16 Reals_ExpoL (LONGREAL x)
{
INTEGER _o_result;
INTEGER i;
__GET((SYSTEM_ADRINT)&x + 6, i, INTEGER);
int16 _o_result;
int16 i;
__GET((SYSTEM_ADRINT)&x + 6, i, int16);
_o_result = __MASK(__ASHR(i, 4), -2048);
return _o_result;
}
void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
void Reals_ConvertL (LONGREAL x, int16 n, CHAR *d, LONGINT d__len)
{
LONGINT i, j, k;
int32 i, j, k;
if (x < (LONGREAL)0) {
x = -x;
}
k = 0;
if (n > 9) {
i = (SYSTEM_INT32)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000);
j = (SYSTEM_INT32)__ENTIER(x - i * (LONGREAL)1000000000);
i = (int32)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000);
j = (int32)__ENTIER(x - i * (LONGREAL)1000000000);
if (j < 0) {
j = 0;
}
@ -100,7 +100,7 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
k += 1;
}
} else {
i = (SYSTEM_INT32)__ENTIER(x);
i = (int32)__ENTIER(x);
}
while (k < n) {
d[__X(k, d__len)] = (CHAR)((int)__MOD(i, 10) + 48);
@ -109,12 +109,12 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
}
}
void Reals_Convert (REAL x, INTEGER 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 (INTEGER i)
static CHAR Reals_ToHex (int16 i)
{
CHAR _o_result;
if (i < 10) {
@ -129,15 +129,15 @@ static CHAR Reals_ToHex (INTEGER i)
static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LONGINT d__len)
{
INTEGER i;
LONGINT l;
int16 i;
int32 l;
CHAR by;
i = 0;
l = b__len;
while (i < l) {
by = __VAL(CHAR, b[__X(i, b__len)]);
d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((SYSTEM_INT16)by, 4));
d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((SYSTEM_INT16)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;
}
}

View file

@ -8,15 +8,15 @@
import void Reals_Convert (REAL x, INTEGER 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, INTEGER n, CHAR *d, LONGINT d__len);
import INTEGER Reals_Expo (REAL x);
import INTEGER Reals_ExpoL (LONGREAL x);
import void Reals_SetExpo (REAL *x, INTEGER ex);
import REAL Reals_Ten (INTEGER e);
import LONGREAL Reals_TenL (INTEGER 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);

View file

@ -2,19 +2,21 @@
#define SYSTEM__h
#if defined(_WIN64)
typedef long long SYSTEM_INT64;
typedef unsigned long long SYSTEM_CARD64;
typedef long long int64;
typedef unsigned long long uint64;
#else
typedef long SYSTEM_INT64;
typedef unsigned long SYSTEM_CARD64;
typedef long int64;
typedef unsigned long uint64;
#endif
typedef int SYSTEM_INT32;
typedef unsigned int SYSTEM_CARD32;
typedef short int SYSTEM_INT16;
typedef unsigned short int SYSTEM_CARD16;
typedef signed char SYSTEM_INT8;
typedef unsigned char SYSTEM_CARD8;
typedef int int32;
typedef unsigned int uint32;
typedef short int int16;
typedef unsigned short int uint16;
typedef signed char int8;
typedef unsigned char uint8;
#if (__SIZEOF_POINTER__ == 8) || defined(_WIN64) || defined(__LP64__)
#if defined(_WIN64)
@ -26,12 +28,30 @@ typedef unsigned char SYSTEM_CARD8;
typedef unsigned int size_t;
#endif
#define SYSTEM_ADRINT size_t
#define SYSTEM_ADDRESS size_t // Temporarily for bootstrap
#define _SIZE_T_DECLARED // For FreeBSD
#define _SIZE_T_DEFINED_ // For OpenBSD
void *memcpy(void *dest, const void *source, SYSTEM_ADRINT size);
void *memcpy(void *dest, const void *source, size_t size);
// Temporary while bootstrapping:
#define SYSTEM_INT8 int8
#define SYSTEM_INT16 int16
#define SYSTEM_INT32 int32
#define SYSTEM_INT64 int64
#define SYSTEM_ADDRESS size_t
#define U_SYSTEM_INT8 uint8
#define U_SYSTEM_INT16 uint16
#define U_SYSTEM_INT32 uint32
#define U_SYSTEM_INT64 uint64
#define U_int8 uint8
#define U_int16 uint16
#define U_int32 uint32
#define U_int64 uint64
@ -52,41 +72,53 @@ void *memcpy(void *dest, const void *source, SYSTEM_ADRINT size);
// Oberon types
typedef char BOOLEAN;
typedef unsigned char SYSTEM_BYTE;
typedef unsigned char CHAR;
typedef signed char SHORTINT;
typedef float REAL;
typedef double LONGREAL;
typedef void* SYSTEM_PTR;
// typedef char BOOLEAN;
// typedef unsigned char SYSTEM_BYTE;
// typedef unsigned char CHAR;
// typedef signed char SHORTINT;
// typedef float REAL;
// typedef double LONGREAL;
// typedef void* SYSTEM_PTR;
typedef int8 BOOLEAN;
typedef int8 SYSTEM_BYTE;
typedef uint8 U_SYSTEM_BYTE;
typedef uint8 CHAR;
typedef uint8 U_CHAR;
typedef int8 SHORTINT;
typedef uint8 U_SHORTINT;
typedef float REAL;
typedef double LONGREAL;
typedef void* SYSTEM_PTR;
typedef size_t SYSTEM_ADRINT;
// For 32 bit builds, the size of LONGINT depends on a make option:
#if (__SIZEOF_POINTER__ == 8) || defined(LARGE) || defined(_WIN64)
typedef int INTEGER; // INTEGER is 32 bit.
typedef long long LONGINT; // LONGINT is 64 bit. (long long is always 64 bits, while long can be 32 bits e.g. under MSC/MingW)
typedef unsigned int U_INTEGER;
typedef unsigned long long U_LONGINT;
typedef int32 INTEGER;
typedef int64 LONGINT;
typedef uint32 U_INTEGER;
typedef uint64 U_LONGINT;
#else
typedef short int INTEGER; // INTEGER is 16 bit.
typedef long LONGINT; // LONGINT is 32 bit.
typedef unsigned short int U_INTEGER;
typedef unsigned long U_LONGINT;
typedef int16 INTEGER;
typedef int32 LONGINT;
typedef uint16 U_INTEGER;
typedef uint32 U_LONGINT;
#endif
// Unsigned variants are for use by shift and rotate macros.
typedef unsigned char U_SYSTEM_BYTE;
typedef unsigned char U_CHAR;
typedef unsigned char U_SHORTINT;
typedef U_LONGINT SET;
typedef U_LONGINT U_SET;
typedef SYSTEM_CARD8 U_SYSTEM_INT8;
typedef SYSTEM_CARD16 U_SYSTEM_INT16;
typedef SYSTEM_CARD32 U_SYSTEM_INT32;
typedef SYSTEM_CARD64 U_SYSTEM_INT64;
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// OS Memory allocation interfaces are in PlatformXXX.Mod

View file

@ -6,19 +6,19 @@
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, INTEGER pos, INTEGER n);
export void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n, CHAR *dest, LONGINT dest__len);
export void Strings_Insert (CHAR *source, LONGINT source__len, INTEGER pos, CHAR *dest, LONGINT dest__len);
export INTEGER 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 INTEGER Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, INTEGER pos);
export void Strings_Replace (CHAR *source, LONGINT source__len, INTEGER 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);
INTEGER Strings_Length (CHAR *s, LONGINT s__len)
int16 Strings_Length (CHAR *s, LONGINT s__len)
{
INTEGER _o_result;
INTEGER i;
int16 _o_result;
int16 i;
__DUP(s, s__len, CHAR);
i = 0;
while ((i < s__len && s[__X(i, s__len)] != 0x00)) {
@ -31,7 +31,7 @@ INTEGER Strings_Length (CHAR *s, LONGINT s__len)
void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__len)
{
INTEGER n1, n2, i;
int16 n1, n2, i;
__DUP(extra, extra__len, CHAR);
n1 = Strings_Length(dest, dest__len);
n2 = Strings_Length(extra, extra__len);
@ -46,9 +46,9 @@ void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__
__DEL(extra);
}
void Strings_Insert (CHAR *source, LONGINT source__len, INTEGER pos, CHAR *dest, LONGINT dest__len)
void Strings_Insert (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, LONGINT dest__len)
{
INTEGER n1, n2, i;
int16 n1, n2, i;
__DUP(source, source__len, CHAR);
n1 = Strings_Length(dest, dest__len);
n2 = Strings_Length(source, source__len);
@ -76,9 +76,9 @@ void Strings_Insert (CHAR *source, LONGINT source__len, INTEGER pos, CHAR *dest,
__DEL(source);
}
void Strings_Delete (CHAR *s, LONGINT s__len, INTEGER pos, INTEGER n)
void Strings_Delete (CHAR *s, LONGINT s__len, int16 pos, int16 n)
{
INTEGER len, i;
int16 len, i;
len = Strings_Length(s, s__len);
if (pos < 0) {
pos = 0;
@ -99,7 +99,7 @@ void Strings_Delete (CHAR *s, LONGINT s__len, INTEGER pos, INTEGER n)
}
}
void Strings_Replace (CHAR *source, LONGINT source__len, INTEGER 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));
@ -107,12 +107,12 @@ void Strings_Replace (CHAR *source, LONGINT source__len, INTEGER pos, CHAR *dest
__DEL(source);
}
void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n, CHAR *dest, LONGINT dest__len)
void Strings_Extract (CHAR *source, LONGINT source__len, int16 pos, int16 n, CHAR *dest, LONGINT dest__len)
{
INTEGER len, destLen, i;
int16 len, destLen, i;
__DUP(source, source__len, CHAR);
len = Strings_Length(source, source__len);
destLen = (SYSTEM_INT16)dest__len - 1;
destLen = (int16)dest__len - 1;
if (pos < 0) {
pos = 0;
}
@ -131,10 +131,10 @@ void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n,
__DEL(source);
}
INTEGER Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, INTEGER pos)
int16 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int16 pos)
{
INTEGER _o_result;
INTEGER 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);
@ -169,7 +169,7 @@ INTEGER Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__le
void Strings_Cap (CHAR *s, LONGINT s__len)
{
INTEGER 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')) {
@ -183,9 +183,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, INTEGER n, INTEGER 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, INTEGER n, INTEGER 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)] != '*')) {

View file

@ -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, INTEGER pos, INTEGER n);
import void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n, CHAR *dest, LONGINT dest__len);
import void Strings_Insert (CHAR *source, LONGINT source__len, INTEGER pos, CHAR *dest, LONGINT dest__len);
import INTEGER 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 INTEGER Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, INTEGER pos);
import void Strings_Replace (CHAR *source, LONGINT source__len, INTEGER 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);

View file

@ -13,9 +13,9 @@ typedef
typedef
struct Texts_RunDesc {
Texts_Run prev, next;
LONGINT len;
int32 len;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
BOOLEAN ascii;
} Texts_RunDesc;
@ -36,26 +36,26 @@ typedef
typedef
struct Texts_ElemDesc {
Texts_Run prev, next;
LONGINT len;
int32 len;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
BOOLEAN ascii;
LONGINT W, H;
int32 W, H;
Texts_Handler handle;
Texts_Text base;
} Texts_ElemDesc;
struct Texts__1 { /* Texts_ElemDesc */
Texts_Run prev, next;
LONGINT len;
int32 len;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
BOOLEAN ascii;
LONGINT W, H;
int32 W, H;
Texts_Handler handle;
Texts_Text base;
Files_File file;
LONGINT org, span;
int32 org, span;
CHAR mod[32], proc[32];
};
@ -64,7 +64,7 @@ typedef
typedef
struct Texts_BufDesc {
LONGINT len;
int32 len;
Texts_Run head;
} Texts_BufDesc;
@ -78,8 +78,8 @@ typedef
typedef
struct Texts_FileMsg { /* Texts_ElemMsg */
INTEGER id;
LONGINT pos;
int16 id;
int32 pos;
Files_Rider r;
} Texts_FileMsg;
@ -94,7 +94,7 @@ typedef
} Texts_IdentifyMsg;
typedef
void (*Texts_Notifier)(Texts_Text, INTEGER, LONGINT, LONGINT);
void (*Texts_Notifier)(Texts_Text, int16, int32, int32);
typedef
struct Texts_PieceDesc *Texts_Piece;
@ -102,57 +102,57 @@ typedef
typedef
struct Texts_PieceDesc {
Texts_Run prev, next;
LONGINT len;
int32 len;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
BOOLEAN ascii;
Files_File file;
LONGINT org;
int32 org;
} Texts_PieceDesc;
typedef
struct Texts_Reader {
BOOLEAN eot;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
Texts_Elem elem;
Files_Rider rider;
Texts_Run run;
LONGINT org, off;
int32 org, off;
} Texts_Reader;
typedef
struct Texts_Scanner { /* Texts_Reader */
BOOLEAN eot;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
Texts_Elem elem;
Files_Rider rider;
Texts_Run run;
LONGINT org, off;
int32 org, off;
CHAR nextCh;
INTEGER line, class;
LONGINT i;
int16 line, class;
int32 i;
REAL x;
LONGREAL y;
CHAR c;
SHORTINT len;
int8 len;
CHAR s[64];
} Texts_Scanner;
typedef
struct Texts_TextDesc {
LONGINT len;
int32 len;
Texts_Notifier notify;
Texts_Run head, cache;
LONGINT corg;
int32 corg;
} Texts_TextDesc;
typedef
struct Texts_Writer {
Texts_Buffer buf;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
Files_Rider rider;
Files_File file;
} Texts_Writer;
@ -178,50 +178,50 @@ export LONGINT *Texts_Writer__typ;
export LONGINT *Texts__1__typ;
export void Texts_Append (Texts_Text T, Texts_Buffer B);
export void Texts_ChangeLooks (Texts_Text T, LONGINT beg, LONGINT end, SET sel, Texts_FontsFont fnt, SHORTINT col, SHORTINT 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, LONGINT beg, LONGINT end);
export void Texts_Delete (Texts_Text T, int32 beg, int32 end);
export Texts_Text Texts_ElemBase (Texts_Elem E);
export LONGINT Texts_ElemPos (Texts_Elem E);
static void Texts_Find (Texts_Text T, LONGINT *pos, Texts_Run *u, LONGINT *org, LONGINT *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, LONGINT *msg__typ);
export void Texts_Insert (Texts_Text T, LONGINT pos, Texts_Buffer B);
export void Texts_Insert (Texts_Text T, int32 pos, Texts_Buffer B);
export void Texts_Load (Files_Rider *r, LONGINT *r__typ, Texts_Text T);
static void Texts_Load0 (Files_Rider *r, LONGINT *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, LONGINT *R__typ, Texts_Text T, LONGINT pos);
export void Texts_OpenScanner (Texts_Scanner *S, LONGINT *S__typ, Texts_Text T, LONGINT pos);
export void Texts_OpenReader (Texts_Reader *R, LONGINT *R__typ, Texts_Text T, int32 pos);
export void Texts_OpenScanner (Texts_Scanner *S, LONGINT *S__typ, Texts_Text T, int32 pos);
export void Texts_OpenWriter (Texts_Writer *W, LONGINT *W__typ);
export LONGINT Texts_Pos (Texts_Reader *R, LONGINT *R__typ);
export int32 Texts_Pos (Texts_Reader *R, LONGINT *R__typ);
export void Texts_Read (Texts_Reader *R, LONGINT *R__typ, CHAR *ch);
export void Texts_ReadElem (Texts_Reader *R, LONGINT *R__typ);
export void Texts_ReadPrevElem (Texts_Reader *R, LONGINT *R__typ);
export void Texts_Recall (Texts_Buffer *B);
export void Texts_Save (Texts_Text T, LONGINT beg, LONGINT 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, LONGINT *S__typ);
export void Texts_SetColor (Texts_Writer *W, LONGINT *W__typ, SHORTINT col);
export void Texts_SetColor (Texts_Writer *W, LONGINT *W__typ, int8 col);
export void Texts_SetFont (Texts_Writer *W, LONGINT *W__typ, Texts_FontsFont fnt);
export void Texts_SetOffset (Texts_Writer *W, LONGINT *W__typ, SHORTINT voff);
export void Texts_SetOffset (Texts_Writer *W, LONGINT *W__typ, int8 voff);
static void Texts_Splice (Texts_Run un, Texts_Run v, Texts_Run w, Texts_Text base);
static void Texts_Split (LONGINT 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, LONGINT *r__typ, Texts_Text T);
export void Texts_Write (Texts_Writer *W, LONGINT *W__typ, CHAR ch);
export void Texts_WriteDate (Texts_Writer *W, LONGINT *W__typ, LONGINT t, LONGINT d);
export void Texts_WriteDate (Texts_Writer *W, LONGINT *W__typ, int32 t, int32 d);
export void Texts_WriteElem (Texts_Writer *W, LONGINT *W__typ, Texts_Elem e);
export void Texts_WriteHex (Texts_Writer *W, LONGINT *W__typ, LONGINT x);
export void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n);
export void Texts_WriteHex (Texts_Writer *W, LONGINT *W__typ, int32 x);
export void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, int32 x, int32 n);
export void Texts_WriteLn (Texts_Writer *W, LONGINT *W__typ);
export void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER n);
export void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, int16 n);
export void Texts_WriteLongRealHex (Texts_Writer *W, LONGINT *W__typ, LONGREAL x);
export void Texts_WriteReal (Texts_Writer *W, LONGINT *W__typ, REAL x, INTEGER n);
export void Texts_WriteRealFix (Texts_Writer *W, LONGINT *W__typ, REAL x, INTEGER n, INTEGER k);
export void Texts_WriteReal (Texts_Writer *W, LONGINT *W__typ, REAL x, int16 n);
export void Texts_WriteRealFix (Texts_Writer *W, LONGINT *W__typ, REAL x, int16 n, int16 k);
export void Texts_WriteRealHex (Texts_Writer *W, LONGINT *W__typ, REAL x);
export void Texts_WriteString (Texts_Writer *W, LONGINT *W__typ, CHAR *s, LONGINT s__len);
@ -236,10 +236,10 @@ static Texts_FontsFont Texts_FontsThis (CHAR *name, LONGINT name__len)
return _o_result;
}
static void Texts_Find (Texts_Text T, LONGINT *pos, Texts_Run *u, LONGINT *org, LONGINT *off)
static void Texts_Find (Texts_Text T, int32 *pos, Texts_Run *u, int32 *org, int32 *off)
{
Texts_Run v = NIL;
LONGINT m;
int32 m;
if (*pos >= T->len) {
*pos = T->len;
*u = T->head;
@ -269,7 +269,7 @@ static void Texts_Find (Texts_Text T, LONGINT *pos, Texts_Run *u, LONGINT *org,
}
}
static void Texts_Split (LONGINT 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) {
@ -368,11 +368,11 @@ Texts_Text Texts_ElemBase (Texts_Elem E)
return _o_result;
}
LONGINT Texts_ElemPos (Texts_Elem E)
int32 Texts_ElemPos (Texts_Elem E)
{
LONGINT _o_result;
int32 _o_result;
Texts_Run u = NIL;
LONGINT pos;
int32 pos;
u = E->base->head->next;
pos = 0;
while (u != (void *) E) {
@ -387,7 +387,7 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, LONGINT *msg__t
{
Texts_Alien e = NIL;
Files_Rider r;
LONGINT i;
int32 i;
CHAR ch;
if (__ISP(E, Texts__1, 2)) {
if (__IS(msg__typ, Texts_CopyMsg, 1)) {
@ -463,10 +463,10 @@ void Texts_Recall (Texts_Buffer *B)
Texts_del = NIL;
}
void Texts_Save (Texts_Text T, LONGINT beg, LONGINT 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;
LONGINT 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;
@ -497,11 +497,11 @@ void Texts_Save (Texts_Text T, LONGINT beg, LONGINT end, Texts_Buffer B)
B->len += end - beg;
}
void Texts_Insert (Texts_Text T, LONGINT 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;
LONGINT uo, ud, len;
int32 uo, ud, len;
Texts_Find(T, &pos, &u, &uo, &ud);
Texts_Split(ud, &u, &un);
len = B->len;
@ -520,7 +520,7 @@ void Texts_Insert (Texts_Text T, LONGINT pos, Texts_Buffer B)
void Texts_Append (Texts_Text T, Texts_Buffer B)
{
Texts_Run v = NIL;
LONGINT pos, len;
int32 pos, len;
pos = T->len;
len = B->len;
v = B->head->next;
@ -535,10 +535,10 @@ void Texts_Append (Texts_Text T, Texts_Buffer B)
}
}
void Texts_Delete (Texts_Text T, LONGINT beg, LONGINT end)
void Texts_Delete (Texts_Text T, int32 beg, int32 end)
{
Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL;
LONGINT 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;
@ -560,10 +560,10 @@ void Texts_Delete (Texts_Text T, LONGINT beg, LONGINT end)
}
}
void Texts_ChangeLooks (Texts_Text T, LONGINT beg, LONGINT end, SET sel, Texts_FontsFont fnt, SHORTINT col, SHORTINT 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;
LONGINT 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;
@ -599,7 +599,7 @@ void Texts_ChangeLooks (Texts_Text T, LONGINT beg, LONGINT end, SET sel, Texts_F
}
}
void Texts_OpenReader (Texts_Reader *R, LONGINT *R__typ, Texts_Text T, LONGINT pos)
void Texts_OpenReader (Texts_Reader *R, LONGINT *R__typ, Texts_Text T, int32 pos)
{
Texts_Run u = NIL;
if (pos >= T->len) {
@ -616,7 +616,7 @@ void Texts_OpenReader (Texts_Reader *R, LONGINT *R__typ, Texts_Text T, LONGINT p
void Texts_Read (Texts_Reader *R, LONGINT *R__typ, CHAR *ch)
{
Texts_Run u = NIL;
LONGINT pos;
int32 pos;
CHAR nextch;
u = (*R).run;
(*R).fnt = u->fnt;
@ -708,14 +708,14 @@ void Texts_ReadPrevElem (Texts_Reader *R, LONGINT *R__typ)
}
}
LONGINT Texts_Pos (Texts_Reader *R, LONGINT *R__typ)
int32 Texts_Pos (Texts_Reader *R, LONGINT *R__typ)
{
LONGINT _o_result;
int32 _o_result;
_o_result = (*R).org + (*R).off;
return _o_result;
}
void Texts_OpenScanner (Texts_Scanner *S, LONGINT *S__typ, Texts_Text T, LONGINT pos)
void Texts_OpenScanner (Texts_Scanner *S, LONGINT *S__typ, Texts_Text T, int32 pos)
{
Texts_OpenReader((void*)&*S, S__typ, T, pos);
(*S).line = 0;
@ -727,7 +727,7 @@ static struct Scan__31 {
LONGINT *S__typ;
CHAR *ch;
BOOLEAN *negE;
INTEGER *e;
int16 *e;
struct Scan__31 *lnk;
} *Scan__31_s;
@ -746,7 +746,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 + (SYSTEM_INT16)*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);
}
}
@ -755,9 +755,9 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
{
CHAR ch, term;
BOOLEAN neg, negE, hex;
SHORTINT i, j, h;
INTEGER e;
LONGINT k;
int8 i, j, h;
int16 e;
int32 k;
REAL x, f;
LONGREAL y, g;
CHAR d[32];
@ -818,10 +818,10 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
if ('9' < ch) {
if (('A' <= ch && ch <= 'F')) {
hex = 1;
ch = (CHAR)((SYSTEM_INT16)ch - 7);
ch = (CHAR)((int16)ch - 7);
} else if (('a' <= ch && ch <= 'f')) {
hex = 1;
ch = (CHAR)((SYSTEM_INT16)ch - 39);
ch = (CHAR)((int16)ch - 39);
} else {
break;
}
@ -833,13 +833,13 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
if (i - j > 8) {
j = i - 8;
}
k = (SYSTEM_INT16)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) + ((SYSTEM_INT16)d[__X(j, 32)] - 48);
k = __ASHL(k, 4) + ((int16)d[__X(j, 32)] - 48);
j += 1;
}
if (neg) {
@ -860,12 +860,12 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
y = (LONGREAL)0;
g = (LONGREAL)1;
do {
y = y * (LONGREAL)10 + ((SYSTEM_INT16)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 = ((SYSTEM_INT16)d[__X(j, 32)] - 48) * g + y;
y = ((int16)d[__X(j, 32)] - 48) * g + y;
j += 1;
}
ReadScaleFactor__32();
@ -892,12 +892,12 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
x = (REAL)0;
f = (REAL)1;
do {
x = x * (REAL)10 + ((SYSTEM_INT16)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 = ((SYSTEM_INT16)d[__X(j, 32)] - 48) * f + x;
x = ((int16)d[__X(j, 32)] - 48) * f + x;
j += 1;
}
if (ch == 'E') {
@ -929,7 +929,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
(*S).class = 3;
k = 0;
do {
k = k * 10 + ((SYSTEM_INT16)d[__X(j, 32)] - 48);
k = k * 10 + ((int16)d[__X(j, 32)] - 48);
j += 1;
} while (!(j == i));
if (neg) {
@ -973,12 +973,12 @@ void Texts_SetFont (Texts_Writer *W, LONGINT *W__typ, Texts_FontsFont fnt)
(*W).fnt = fnt;
}
void Texts_SetColor (Texts_Writer *W, LONGINT *W__typ, SHORTINT col)
void Texts_SetColor (Texts_Writer *W, LONGINT *W__typ, int8 col)
{
(*W).col = col;
}
void Texts_SetOffset (Texts_Writer *W, LONGINT *W__typ, SHORTINT voff)
void Texts_SetOffset (Texts_Writer *W, LONGINT *W__typ, int8 voff)
{
(*W).voff = voff;
}
@ -1035,7 +1035,7 @@ void Texts_WriteLn (Texts_Writer *W, LONGINT *W__typ)
void Texts_WriteString (Texts_Writer *W, LONGINT *W__typ, CHAR *s, LONGINT s__len)
{
INTEGER i;
int16 i;
__DUP(s, s__len, CHAR);
i = 0;
while (s[__X(i, s__len)] >= ' ') {
@ -1045,10 +1045,10 @@ void Texts_WriteString (Texts_Writer *W, LONGINT *W__typ, CHAR *s, LONGINT s__le
__DEL(s);
}
void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n)
void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, int32 x, int32 n)
{
INTEGER i;
LONGINT x0;
int16 i;
int32 x0;
CHAR a[22];
i = 0;
if (x < 0) {
@ -1080,10 +1080,10 @@ void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n)
} while (!(i == 0));
}
void Texts_WriteHex (Texts_Writer *W, LONGINT *W__typ, LONGINT x)
void Texts_WriteHex (Texts_Writer *W, LONGINT *W__typ, int32 x)
{
INTEGER i;
LONGINT y;
int16 i;
int32 y;
CHAR a[20];
i = 0;
Texts_Write(&*W, W__typ, ' ');
@ -1103,9 +1103,9 @@ void Texts_WriteHex (Texts_Writer *W, LONGINT *W__typ, LONGINT x)
} while (!(i == 0));
}
void Texts_WriteReal (Texts_Writer *W, LONGINT *W__typ, REAL x, INTEGER n)
void Texts_WriteReal (Texts_Writer *W, LONGINT *W__typ, REAL x, int16 n)
{
INTEGER e;
int16 e;
REAL x0;
CHAR d[9];
e = Reals_Expo(x);
@ -1176,15 +1176,15 @@ void Texts_WriteReal (Texts_Writer *W, LONGINT *W__typ, REAL x, INTEGER n)
static struct WriteRealFix__53 {
Texts_Writer *W;
LONGINT *W__typ;
INTEGER *i;
int16 *i;
CHAR (*d)[9];
struct WriteRealFix__53 *lnk;
} *WriteRealFix__53_s;
static void dig__54 (INTEGER n);
static void seq__56 (CHAR ch, INTEGER n);
static void dig__54 (int16 n);
static void seq__56 (CHAR ch, int16 n);
static void seq__56 (CHAR ch, INTEGER n)
static void seq__56 (CHAR ch, int16 n)
{
while (n > 0) {
Texts_Write(&*WriteRealFix__53_s->W, WriteRealFix__53_s->W__typ, ch);
@ -1192,7 +1192,7 @@ static void seq__56 (CHAR ch, INTEGER n)
}
}
static void dig__54 (INTEGER n)
static void dig__54 (int16 n)
{
while (n > 0) {
*WriteRealFix__53_s->i -= 1;
@ -1201,9 +1201,9 @@ static void dig__54 (INTEGER n)
}
}
void Texts_WriteRealFix (Texts_Writer *W, LONGINT *W__typ, REAL x, INTEGER n, INTEGER k)
void Texts_WriteRealFix (Texts_Writer *W, LONGINT *W__typ, REAL x, int16 n, int16 k)
{
INTEGER e, i;
int16 e, i;
CHAR sign;
REAL x0;
CHAR d[9];
@ -1275,7 +1275,7 @@ void Texts_WriteRealFix (Texts_Writer *W, LONGINT *W__typ, REAL x, INTEGER n, IN
void Texts_WriteRealHex (Texts_Writer *W, LONGINT *W__typ, REAL x)
{
INTEGER i;
int16 i;
CHAR d[8];
Reals_ConvertH(x, (void*)d, 8);
i = 0;
@ -1285,9 +1285,9 @@ void Texts_WriteRealHex (Texts_Writer *W, LONGINT *W__typ, REAL x)
} while (!(i == 8));
}
void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER n)
void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, int16 n)
{
INTEGER e;
int16 e;
LONGREAL x0;
CHAR d[16];
e = Reals_ExpoL(x);
@ -1319,7 +1319,7 @@ void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER
} else {
Texts_Write(&*W, W__typ, ' ');
}
e = (SYSTEM_INT16)__ASHR((e - 1023) * 77, 8);
e = (int16)__ASHR((e - 1023) * 77, 8);
if (e >= 0) {
x = x / (LONGREAL)Reals_TenL(e);
} else {
@ -1359,7 +1359,7 @@ void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER
void Texts_WriteLongRealHex (Texts_Writer *W, LONGINT *W__typ, LONGREAL x)
{
INTEGER i;
int16 i;
CHAR d[16];
Reals_ConvertHL(x, (void*)d, 16);
i = 0;
@ -1375,16 +1375,16 @@ static struct WriteDate__43 {
struct WriteDate__43 *lnk;
} *WriteDate__43_s;
static void WritePair__44 (CHAR ch, LONGINT x);
static void WritePair__44 (CHAR ch, int32 x);
static void WritePair__44 (CHAR ch, LONGINT 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)((int)__MOD(x, 10) + 48));
}
void Texts_WriteDate (Texts_Writer *W, LONGINT *W__typ, LONGINT t, LONGINT d)
void Texts_WriteDate (Texts_Writer *W, LONGINT *W__typ, int32 t, int32 d)
{
struct WriteDate__43 _s;
_s.W = W; _s.W__typ = W__typ;
@ -1401,22 +1401,22 @@ void Texts_WriteDate (Texts_Writer *W, LONGINT *W__typ, LONGINT t, LONGINT d)
static struct Load0__16 {
Texts_Text *T;
SHORTINT *ecnt;
int8 *ecnt;
Files_File *f;
Texts_FileMsg *msg;
CHAR (*mods)[64][32], (*procs)[64][32];
struct Load0__16 *lnk;
} *Load0__16_s;
static void LoadElem__17 (Files_Rider *r, LONGINT *r__typ, LONGINT pos, LONGINT span, Texts_Elem *e);
static void LoadElem__17 (Files_Rider *r, LONGINT *r__typ, int32 pos, int32 span, Texts_Elem *e);
static void LoadElem__17 (Files_Rider *r, LONGINT *r__typ, LONGINT pos, LONGINT span, Texts_Elem *e)
static void LoadElem__17 (Files_Rider *r, LONGINT *r__typ, int32 pos, int32 span, Texts_Elem *e)
{
Modules_Module M = NIL;
Modules_Command Cmd;
Texts_Alien a = NIL;
LONGINT org, ew, eh;
SHORTINT eno;
int32 org, ew, eh;
int8 eno;
Texts_new = NIL;
Files_ReadLInt(&*r, r__typ, &ew);
Files_ReadLInt(&*r, r__typ, &eh);
@ -1466,8 +1466,8 @@ static void Texts_Load0 (Files_Rider *r, LONGINT *r__typ, Texts_Text T)
Texts_Run u = NIL, un = NIL;
Texts_Piece p = NIL;
Texts_Elem e = NIL;
LONGINT org, pos, hlen, plen;
SHORTINT ecnt, fno, fcnt, col, voff;
int32 org, pos, hlen, plen;
int8 ecnt, fno, fcnt, col, voff;
Files_File f = NIL;
Texts_FileMsg msg;
CHAR mods[64][32], procs[64][32];
@ -1537,7 +1537,7 @@ static void Texts_Load0 (Files_Rider *r, LONGINT *r__typ, Texts_Text T)
void Texts_Load (Files_Rider *r, LONGINT *r__typ, Texts_Text T)
{
INTEGER 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);
@ -1552,7 +1552,7 @@ void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len)
Texts_Run u = NIL;
Texts_Piece p = NIL;
CHAR tag, version;
LONGINT hlen;
int32 hlen;
__DUP(name, name__len, CHAR);
f = Files_Old(name, name__len);
if (f == NIL) {
@ -1602,20 +1602,20 @@ void Texts_Open (Texts_Text T, CHAR *name, LONGINT name__len)
}
static struct Store__39 {
SHORTINT *ecnt;
int8 *ecnt;
Texts_FileMsg *msg;
Texts_IdentifyMsg *iden;
CHAR (*mods)[64][32], (*procs)[64][32];
struct Store__39 *lnk;
} *Store__39_s;
static void StoreElem__40 (Files_Rider *r, LONGINT *r__typ, LONGINT pos, Texts_Elem e);
static void StoreElem__40 (Files_Rider *r, LONGINT *r__typ, int32 pos, Texts_Elem e);
static void StoreElem__40 (Files_Rider *r, LONGINT *r__typ, LONGINT pos, Texts_Elem e)
static void StoreElem__40 (Files_Rider *r, LONGINT *r__typ, int32 pos, Texts_Elem e)
{
Files_Rider r1;
LONGINT org, span;
SHORTINT eno;
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);
eno = 1;
@ -1646,8 +1646,8 @@ void Texts_Store (Files_Rider *r, LONGINT *r__typ, Texts_Text T)
Files_Rider r1;
Texts_Run u = NIL, un = NIL;
Texts_Elem e = NIL;
LONGINT org, pos, delta, hlen, rlen;
SHORTINT ecnt, fno, fcnt;
int32 org, pos, delta, hlen, rlen;
int8 ecnt, fno, fcnt;
CHAR ch;
Texts_FileMsg msg;
Texts_IdentifyMsg iden;
@ -1764,7 +1764,7 @@ void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len)
{
Files_File f = NIL;
Files_Rider r;
INTEGER i, res;
int16 i, res;
CHAR bak[64];
__DUP(name, name__len, CHAR);
f = Files_New(name, name__len);

View file

@ -8,7 +8,7 @@
typedef
struct Texts_BufDesc {
LONGINT len;
int32 len;
char _prvt0[4];
} Texts_BufDesc;
@ -40,15 +40,15 @@ typedef
typedef
struct Texts_ElemDesc {
char _prvt0[20];
LONGINT W, H;
int32 W, H;
Texts_Handler handle;
char _prvt1[4];
} Texts_ElemDesc;
typedef
struct Texts_FileMsg { /* Texts_ElemMsg */
INTEGER id;
LONGINT pos;
int16 id;
int32 pos;
Files_Rider r;
} Texts_FileMsg;
@ -69,13 +69,13 @@ typedef
struct Texts_TextDesc *Texts_Text;
typedef
void (*Texts_Notifier)(Texts_Text, INTEGER, LONGINT, LONGINT);
void (*Texts_Notifier)(Texts_Text, int16, int32, int32);
typedef
struct Texts_Reader {
BOOLEAN eot;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
Texts_Elem elem;
char _prvt0[32];
} Texts_Reader;
@ -84,23 +84,23 @@ typedef
struct Texts_Scanner { /* Texts_Reader */
BOOLEAN eot;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
Texts_Elem elem;
LONGREAL _prvt0;
char _prvt1[24];
CHAR nextCh;
INTEGER line, class;
LONGINT i;
int16 line, class;
int32 i;
REAL x;
LONGREAL y;
CHAR c;
SHORTINT len;
int8 len;
CHAR s[64];
} Texts_Scanner;
typedef
struct Texts_TextDesc {
LONGINT len;
int32 len;
Texts_Notifier notify;
char _prvt0[12];
} Texts_TextDesc;
@ -109,7 +109,7 @@ typedef
struct Texts_Writer {
Texts_Buffer buf;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
char _prvt0[26];
} Texts_Writer;
@ -130,41 +130,41 @@ import LONGINT *Texts_Scanner__typ;
import LONGINT *Texts_Writer__typ;
import void Texts_Append (Texts_Text T, Texts_Buffer B);
import void Texts_ChangeLooks (Texts_Text T, LONGINT beg, LONGINT end, SET sel, Texts_FontsFont fnt, SHORTINT col, SHORTINT 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, LONGINT beg, LONGINT end);
import void Texts_Delete (Texts_Text T, int32 beg, int32 end);
import Texts_Text Texts_ElemBase (Texts_Elem E);
import LONGINT Texts_ElemPos (Texts_Elem E);
import void Texts_Insert (Texts_Text T, LONGINT 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, LONGINT *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, LONGINT *R__typ, Texts_Text T, LONGINT pos);
import void Texts_OpenScanner (Texts_Scanner *S, LONGINT *S__typ, Texts_Text T, LONGINT pos);
import void Texts_OpenReader (Texts_Reader *R, LONGINT *R__typ, Texts_Text T, int32 pos);
import void Texts_OpenScanner (Texts_Scanner *S, LONGINT *S__typ, Texts_Text T, int32 pos);
import void Texts_OpenWriter (Texts_Writer *W, LONGINT *W__typ);
import LONGINT Texts_Pos (Texts_Reader *R, LONGINT *R__typ);
import int32 Texts_Pos (Texts_Reader *R, LONGINT *R__typ);
import void Texts_Read (Texts_Reader *R, LONGINT *R__typ, CHAR *ch);
import void Texts_ReadElem (Texts_Reader *R, LONGINT *R__typ);
import void Texts_ReadPrevElem (Texts_Reader *R, LONGINT *R__typ);
import void Texts_Recall (Texts_Buffer *B);
import void Texts_Save (Texts_Text T, LONGINT beg, LONGINT 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, LONGINT *S__typ);
import void Texts_SetColor (Texts_Writer *W, LONGINT *W__typ, SHORTINT col);
import void Texts_SetColor (Texts_Writer *W, LONGINT *W__typ, int8 col);
import void Texts_SetFont (Texts_Writer *W, LONGINT *W__typ, Texts_FontsFont fnt);
import void Texts_SetOffset (Texts_Writer *W, LONGINT *W__typ, SHORTINT voff);
import void Texts_SetOffset (Texts_Writer *W, LONGINT *W__typ, int8 voff);
import void Texts_Store (Files_Rider *r, LONGINT *r__typ, Texts_Text T);
import void Texts_Write (Texts_Writer *W, LONGINT *W__typ, CHAR ch);
import void Texts_WriteDate (Texts_Writer *W, LONGINT *W__typ, LONGINT t, LONGINT d);
import void Texts_WriteDate (Texts_Writer *W, LONGINT *W__typ, int32 t, int32 d);
import void Texts_WriteElem (Texts_Writer *W, LONGINT *W__typ, Texts_Elem e);
import void Texts_WriteHex (Texts_Writer *W, LONGINT *W__typ, LONGINT x);
import void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n);
import void Texts_WriteHex (Texts_Writer *W, LONGINT *W__typ, int32 x);
import void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, int32 x, int32 n);
import void Texts_WriteLn (Texts_Writer *W, LONGINT *W__typ);
import void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER n);
import void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, int16 n);
import void Texts_WriteLongRealHex (Texts_Writer *W, LONGINT *W__typ, LONGREAL x);
import void Texts_WriteReal (Texts_Writer *W, LONGINT *W__typ, REAL x, INTEGER n);
import void Texts_WriteRealFix (Texts_Writer *W, LONGINT *W__typ, REAL x, INTEGER n, INTEGER k);
import void Texts_WriteReal (Texts_Writer *W, LONGINT *W__typ, REAL x, int16 n);
import void Texts_WriteRealFix (Texts_Writer *W, LONGINT *W__typ, REAL x, int16 n, int16 k);
import void Texts_WriteRealHex (Texts_Writer *W, LONGINT *W__typ, REAL x);
import void Texts_WriteString (Texts_Writer *W, LONGINT *W__typ, CHAR *s, LONGINT s__len);
import void *Texts__init(void);

View file

@ -20,7 +20,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 (INTEGER sig);
static void Vishap_Trap (int16 sig);
void Vishap_Module (BOOLEAN *done)
@ -126,7 +126,7 @@ void Vishap_Translate (void)
}
}
static void Vishap_Trap (INTEGER sig)
static void Vishap_Trap (int16 sig)
{
Heap_FINALL();
if (sig == 3) {

View file

@ -17,7 +17,7 @@ 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)
{
INTEGER r, status, exitcode;
int16 r, status, exitcode;
__DUP(title, title__len, CHAR);
__DUP(cmd, cmd__len, CHAR);
if (OPM_Verbose) {

View file

@ -8,36 +8,36 @@ export CHAR vt100_CSI[5];
static CHAR vt100_tmpstr[32];
export void vt100_CHA (INTEGER n);
export void vt100_CNL (INTEGER n);
export void vt100_CPL (INTEGER n);
export void vt100_CUB (INTEGER n);
export void vt100_CUD (INTEGER n);
export void vt100_CUF (INTEGER n);
export void vt100_CUP (INTEGER n, INTEGER m);
export void vt100_CUU (INTEGER 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 (INTEGER n);
export void vt100_ED (INTEGER n);
export void vt100_EL (INTEGER n);
static void vt100_EscSeq (INTEGER 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 (INTEGER n, INTEGER m, CHAR *letter, LONGINT letter__len);
static void vt100_EscSeqSwapped (INTEGER n, CHAR *letter, LONGINT letter__len);
export void vt100_HVP (INTEGER n, INTEGER m);
export void vt100_IntToStr (LONGINT 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, INTEGER start, INTEGER end);
static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int16 start, int16 end);
export void vt100_SCP (void);
export void vt100_SD (INTEGER n);
export void vt100_SGR (INTEGER n);
export void vt100_SGR2 (INTEGER n, INTEGER m);
export void vt100_SU (INTEGER 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, INTEGER start, INTEGER end)
static void vt100_Reverse0 (CHAR *str, LONGINT str__len, int16 start, int16 end)
{
CHAR h;
while (start < end) {
@ -49,11 +49,11 @@ static void vt100_Reverse0 (CHAR *str, LONGINT str__len, INTEGER start, INTEGER
}
}
void vt100_IntToStr (LONGINT int_, CHAR *str, LONGINT str__len)
void vt100_IntToStr (int32 int_, CHAR *str, LONGINT str__len)
{
CHAR b[21];
INTEGER s, e;
SHORTINT maxLength;
int16 s, e;
int8 maxLength;
maxLength = 11;
if (int_ == (-2147483647-1)) {
__MOVE("-2147483648", b, 12);
@ -88,7 +88,7 @@ static void vt100_EscSeq0 (CHAR *letter, LONGINT letter__len)
__DEL(letter);
}
static void vt100_EscSeq (INTEGER n, CHAR *letter, LONGINT letter__len)
static void vt100_EscSeq (int16 n, CHAR *letter, LONGINT letter__len)
{
CHAR nstr[2];
CHAR cmd[7];
@ -101,7 +101,7 @@ static void vt100_EscSeq (INTEGER n, CHAR *letter, LONGINT letter__len)
__DEL(letter);
}
static void vt100_EscSeqSwapped (INTEGER n, CHAR *letter, LONGINT letter__len)
static void vt100_EscSeqSwapped (int16 n, CHAR *letter, LONGINT letter__len)
{
CHAR nstr[2];
CHAR cmd[7];
@ -114,7 +114,7 @@ static void vt100_EscSeqSwapped (INTEGER n, CHAR *letter, LONGINT letter__len)
__DEL(letter);
}
static void vt100_EscSeq2 (INTEGER n, INTEGER 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];
@ -130,82 +130,82 @@ static void vt100_EscSeq2 (INTEGER n, INTEGER m, CHAR *letter, LONGINT letter__l
__DEL(letter);
}
void vt100_CUU (INTEGER n)
void vt100_CUU (int16 n)
{
vt100_EscSeq(n, (CHAR*)"A", 2);
}
void vt100_CUD (INTEGER n)
void vt100_CUD (int16 n)
{
vt100_EscSeq(n, (CHAR*)"B", 2);
}
void vt100_CUF (INTEGER n)
void vt100_CUF (int16 n)
{
vt100_EscSeq(n, (CHAR*)"C", 2);
}
void vt100_CUB (INTEGER n)
void vt100_CUB (int16 n)
{
vt100_EscSeq(n, (CHAR*)"D", 2);
}
void vt100_CNL (INTEGER n)
void vt100_CNL (int16 n)
{
vt100_EscSeq(n, (CHAR*)"E", 2);
}
void vt100_CPL (INTEGER n)
void vt100_CPL (int16 n)
{
vt100_EscSeq(n, (CHAR*)"F", 2);
}
void vt100_CHA (INTEGER n)
void vt100_CHA (int16 n)
{
vt100_EscSeq(n, (CHAR*)"G", 2);
}
void vt100_CUP (INTEGER n, INTEGER m)
void vt100_CUP (int16 n, int16 m)
{
vt100_EscSeq2(n, m, (CHAR*)"H", 2);
}
void vt100_ED (INTEGER n)
void vt100_ED (int16 n)
{
vt100_EscSeq(n, (CHAR*)"J", 2);
}
void vt100_EL (INTEGER n)
void vt100_EL (int16 n)
{
vt100_EscSeq(n, (CHAR*)"K", 2);
}
void vt100_SU (INTEGER n)
void vt100_SU (int16 n)
{
vt100_EscSeq(n, (CHAR*)"S", 2);
}
void vt100_SD (INTEGER n)
void vt100_SD (int16 n)
{
vt100_EscSeq(n, (CHAR*)"T", 2);
}
void vt100_HVP (INTEGER n, INTEGER m)
void vt100_HVP (int16 n, int16 m)
{
vt100_EscSeq2(n, m, (CHAR*)"f", 2);
}
void vt100_SGR (INTEGER n)
void vt100_SGR (int16 n)
{
vt100_EscSeq(n, (CHAR*)"m", 2);
}
void vt100_SGR2 (INTEGER n, INTEGER m)
void vt100_SGR2 (int16 n, int16 m)
{
vt100_EscSeq2(n, m, (CHAR*)"m", 2);
}
void vt100_DSR (INTEGER n)
void vt100_DSR (int16 n)
{
vt100_EscSeq(6, (CHAR*)"n", 2);
}

View file

@ -9,27 +9,27 @@
import CHAR vt100_CSI[5];
import void vt100_CHA (INTEGER n);
import void vt100_CNL (INTEGER n);
import void vt100_CPL (INTEGER n);
import void vt100_CUB (INTEGER n);
import void vt100_CUD (INTEGER n);
import void vt100_CUF (INTEGER n);
import void vt100_CUP (INTEGER n, INTEGER m);
import void vt100_CUU (INTEGER 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 (INTEGER n);
import void vt100_ED (INTEGER n);
import void vt100_EL (INTEGER n);
import void vt100_HVP (INTEGER n, INTEGER m);
import void vt100_IntToStr (LONGINT 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 (INTEGER n);
import void vt100_SGR (INTEGER n);
import void vt100_SGR2 (INTEGER n, INTEGER m);
import void vt100_SU (INTEGER 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);