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(1, (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(0, (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[216];
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, index, mtime;
int32 volume, index, mtime;
} 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[256];
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;
static int32 Platform_TimeStart;
export int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
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 offset, INTEGER whence);
export int16 Platform_Seek (int32 h, int32 offset, int16 whence);
export void Platform_SetBadInstructionHandler (Platform_SignalHandler handler);
export void Platform_SetHalt (Platform_HaltProcedure p);
export void Platform_SetInterruptHandler (Platform_SignalHandler handler);
export void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Platform_FileIdentity source);
export void Platform_SetQuitHandler (Platform_SignalHandler handler);
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 l);
export INTEGER Platform_Unlink (CHAR *n, LONGINT n__len);
export INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l);
static void Platform_YMDHMStoClock (LONGINT ye, LONGINT mo, LONGINT da, LONGINT ho, LONGINT mi, LONGINT 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 l);
export int16 Platform_Unlink (CHAR *n, LONGINT n__len);
export int16 Platform_Write (int32 h, int32 p, int32 l);
static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 se, int32 *t, int32 *d);
static void Platform_errch (CHAR c);
static void Platform_errint (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 <errno.h>
@ -163,68 +163,68 @@ extern void Heap_InitHeap();
#define Platform_unlink(n, n__len) unlink((char*)n)
#define Platform_writefile(fd, p, l) write(fd, (void*)(SYSTEM_ADRINT)(p), l)
BOOLEAN Platform_TooManyFiles (INTEGER e)
BOOLEAN Platform_TooManyFiles (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_EMFILE() || e == Platform_ENFILE();
return _o_result;
}
BOOLEAN Platform_NoSuchDirectory (INTEGER e)
BOOLEAN Platform_NoSuchDirectory (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ENOENT();
return _o_result;
}
BOOLEAN Platform_DifferentFilesystems (INTEGER e)
BOOLEAN Platform_DifferentFilesystems (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_EXDEV();
return _o_result;
}
BOOLEAN Platform_Inaccessible (INTEGER e)
BOOLEAN Platform_Inaccessible (int16 e)
{
BOOLEAN _o_result;
_o_result = (e == Platform_EACCES() || e == Platform_EROFS()) || e == Platform_EAGAIN();
return _o_result;
}
BOOLEAN Platform_Absent (INTEGER e)
BOOLEAN Platform_Absent (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ENOENT();
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;
@ -258,7 +258,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) {
@ -267,10 +267,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;
@ -278,11 +278,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;
@ -293,10 +293,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;
@ -325,64 +325,64 @@ void Platform_SetBadInstructionHandler (Platform_SignalHandler handler)
Platform_sethandler(4, handler);
}
static void Platform_YMDHMStoClock (LONGINT ye, LONGINT mo, LONGINT da, LONGINT ho, LONGINT mi, LONGINT se, LONGINT *t, LONGINT *d)
static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 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_gettimeval();
Platform_sectotm(Platform_tvsec());
Platform_YMDHMStoClock(Platform_tmyear(), Platform_tmmon(), Platform_tmmday(), Platform_tmhour(), Platform_tmmin(), Platform_tmsec(), &*t, &*d);
}
void Platform_GetTimeOfDay (LONGINT *sec, LONGINT *usec)
void Platform_GetTimeOfDay (int32 *sec, int32 *usec)
{
Platform_gettimeval();
*sec = Platform_tvsec();
*usec = Platform_tvusec();
}
LONGINT Platform_Time (void)
int32 Platform_Time (void)
{
LONGINT _o_result;
LONGINT ms;
int32 _o_result;
int32 ms;
Platform_gettimeval();
ms = (int)__DIVF(Platform_tvusec(), 1000) + Platform_tvsec() * 1000;
_o_result = (int)__MOD(ms - Platform_TimeStart, 2147483647);
return _o_result;
}
void Platform_Delay (LONGINT ms)
void Platform_Delay (int32 ms)
{
LONGINT s, ns;
int32 s, ns;
s = __DIV(ms, 1000);
ns = (int)__MOD(ms, 1000) * 1000000;
Platform_nanosleep(s, ns);
}
INTEGER Platform_System (CHAR *cmd, LONGINT cmd__len)
int16 Platform_System (CHAR *cmd, LONGINT cmd__len)
{
INTEGER _o_result;
int16 _o_result;
__DUP(cmd, cmd__len, CHAR);
_o_result = Platform_system(cmd, cmd__len);
__DEL(cmd);
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;
INTEGER fd;
int16 _o_result;
int16 fd;
fd = Platform_openro(n, n__len);
if (fd < 0) {
_o_result = Platform_err();
@ -395,10 +395,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;
INTEGER fd;
int16 _o_result;
int16 fd;
fd = Platform_openrw(n, n__len);
if (fd < 0) {
_o_result = Platform_err();
@ -411,10 +411,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;
INTEGER fd;
int16 _o_result;
int16 fd;
fd = Platform_opennew(n, n__len);
if (fd < 0) {
_o_result = Platform_err();
@ -427,9 +427,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_closefile(h) < 0) {
_o_result = Platform_err();
return _o_result;
@ -440,9 +440,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_structstats();
if (Platform_fstat(h) < 0) {
_o_result = Platform_err();
@ -455,9 +455,9 @@ 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;
int16 _o_result;
__DUP(n, n__len, CHAR);
Platform_structstats();
if (Platform_stat(n, n__len) < 0) {
@ -492,15 +492,15 @@ void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Pla
(*target).mtime = source.mtime;
}
void Platform_MTimeAsClock (Platform_FileIdentity i, LONGINT *t, LONGINT *d)
void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d)
{
Platform_sectotm(i.mtime);
Platform_YMDHMStoClock(Platform_tmyear(), Platform_tmmon(), Platform_tmmday(), Platform_tmhour(), Platform_tmmin(), Platform_tmsec(), &*t, &*d);
}
INTEGER Platform_Size (LONGINT h, LONGINT *l)
int16 Platform_Size (int32 h, int32 *l)
{
INTEGER _o_result;
int16 _o_result;
Platform_structstats();
if (Platform_fstat(h) < 0) {
_o_result = Platform_err();
@ -511,9 +511,9 @@ 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;
int16 _o_result;
*n = Platform_readfile(h, p, l);
if (*n < 0) {
*n = 0;
@ -526,9 +526,9 @@ 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;
int16 _o_result;
*n = Platform_readfile(h, (SYSTEM_ADRINT)b, b__len);
if (*n < 0) {
*n = 0;
@ -541,10 +541,10 @@ 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;
LONGINT written;
int16 _o_result;
int32 written;
written = Platform_writefile(h, p, l);
if (written < 0) {
_o_result = Platform_err();
@ -556,9 +556,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_fsync(h) < 0) {
_o_result = Platform_err();
return _o_result;
@ -569,9 +569,9 @@ INTEGER Platform_Sync (LONGINT h)
__RETCHK;
}
INTEGER Platform_Seek (LONGINT h, LONGINT offset, INTEGER whence)
int16 Platform_Seek (int32 h, int32 offset, int16 whence)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_lseek(h, offset, whence) < 0) {
_o_result = Platform_err();
return _o_result;
@ -582,9 +582,9 @@ INTEGER Platform_Seek (LONGINT h, LONGINT offset, INTEGER whence)
__RETCHK;
}
INTEGER Platform_Truncate (LONGINT h, LONGINT l)
int16 Platform_Truncate (int32 h, int32 l)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_ftruncate(h, l) < 0) {
_o_result = Platform_err();
return _o_result;
@ -595,9 +595,9 @@ INTEGER Platform_Truncate (LONGINT h, LONGINT l)
__RETCHK;
}
INTEGER Platform_Unlink (CHAR *n, LONGINT n__len)
int16 Platform_Unlink (CHAR *n, LONGINT n__len)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_unlink(n, n__len) < 0) {
_o_result = Platform_err();
return _o_result;
@ -608,10 +608,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_chdir(n, n__len);
Platform_getcwd((void*)Platform_CWD, 256);
if (r < 0) {
@ -624,9 +624,9 @@ INTEGER Platform_Chdir (CHAR *n, LONGINT n__len)
__RETCHK;
}
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_rename(o, o__len, n, n__len) < 0) {
_o_result = Platform_err();
return _o_result;
@ -637,7 +637,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);
}
@ -653,7 +653,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));
@ -661,7 +661,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('-');
@ -670,7 +670,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:
@ -726,9 +726,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);
@ -740,12 +740,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);
@ -753,7 +753,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)
@ -763,7 +763,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

@ -7,74 +7,74 @@
typedef
struct Platform_FileIdentity {
LONGINT volume, index, mtime;
int32 volume, index, mtime;
} 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[256];
import INTEGER Platform_ArgCount;
import LONGINT Platform_ArgVector;
import INTEGER Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
import int16 Platform_ArgCount;
import int32 Platform_ArgVector;
import int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
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 offset, INTEGER whence);
import int16 Platform_Seek (int32 h, int32 offset, int16 whence);
import void Platform_SetBadInstructionHandler (Platform_SignalHandler handler);
import void Platform_SetHalt (Platform_HaltProcedure p);
import void Platform_SetInterruptHandler (Platform_SignalHandler handler);
import void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Platform_FileIdentity source);
import void Platform_SetQuitHandler (Platform_SignalHandler handler);
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 l);
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 l);
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 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,22 +84,22 @@ typedef
struct Texts_Scanner { /* Texts_Reader */
BOOLEAN eot;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
Texts_Elem elem;
char _prvt0[32];
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;
@ -108,7 +108,7 @@ typedef
struct Texts_Writer {
Texts_Buffer buf;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
char _prvt0[26];
} Texts_Writer;
@ -129,41 +129,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);

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(1, (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(0, (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[216];
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, index, mtime;
int32 volume, index, mtime;
} 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[256];
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;
static int32 Platform_TimeStart;
export int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
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 offset, INTEGER whence);
export int16 Platform_Seek (int32 h, int32 offset, int16 whence);
export void Platform_SetBadInstructionHandler (Platform_SignalHandler handler);
export void Platform_SetHalt (Platform_HaltProcedure p);
export void Platform_SetInterruptHandler (Platform_SignalHandler handler);
export void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Platform_FileIdentity source);
export void Platform_SetQuitHandler (Platform_SignalHandler handler);
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 l);
export INTEGER Platform_Unlink (CHAR *n, LONGINT n__len);
export INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l);
static void Platform_YMDHMStoClock (LONGINT ye, LONGINT mo, LONGINT da, LONGINT ho, LONGINT mi, LONGINT 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 l);
export int16 Platform_Unlink (CHAR *n, LONGINT n__len);
export int16 Platform_Write (int32 h, int32 p, int32 l);
static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 se, int32 *t, int32 *d);
static void Platform_errch (CHAR c);
static void Platform_errint (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 <errno.h>
@ -163,68 +163,68 @@ extern void Heap_InitHeap();
#define Platform_unlink(n, n__len) unlink((char*)n)
#define Platform_writefile(fd, p, l) write(fd, (void*)(SYSTEM_ADRINT)(p), l)
BOOLEAN Platform_TooManyFiles (INTEGER e)
BOOLEAN Platform_TooManyFiles (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_EMFILE() || e == Platform_ENFILE();
return _o_result;
}
BOOLEAN Platform_NoSuchDirectory (INTEGER e)
BOOLEAN Platform_NoSuchDirectory (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ENOENT();
return _o_result;
}
BOOLEAN Platform_DifferentFilesystems (INTEGER e)
BOOLEAN Platform_DifferentFilesystems (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_EXDEV();
return _o_result;
}
BOOLEAN Platform_Inaccessible (INTEGER e)
BOOLEAN Platform_Inaccessible (int16 e)
{
BOOLEAN _o_result;
_o_result = (e == Platform_EACCES() || e == Platform_EROFS()) || e == Platform_EAGAIN();
return _o_result;
}
BOOLEAN Platform_Absent (INTEGER e)
BOOLEAN Platform_Absent (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ENOENT();
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;
@ -258,7 +258,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) {
@ -267,10 +267,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;
@ -278,11 +278,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;
@ -293,10 +293,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;
@ -325,64 +325,64 @@ void Platform_SetBadInstructionHandler (Platform_SignalHandler handler)
Platform_sethandler(4, handler);
}
static void Platform_YMDHMStoClock (LONGINT ye, LONGINT mo, LONGINT da, LONGINT ho, LONGINT mi, LONGINT se, LONGINT *t, LONGINT *d)
static void Platform_YMDHMStoClock (int32 ye, int32 mo, int32 da, int32 ho, int32 mi, int32 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_gettimeval();
Platform_sectotm(Platform_tvsec());
Platform_YMDHMStoClock(Platform_tmyear(), Platform_tmmon(), Platform_tmmday(), Platform_tmhour(), Platform_tmmin(), Platform_tmsec(), &*t, &*d);
}
void Platform_GetTimeOfDay (LONGINT *sec, LONGINT *usec)
void Platform_GetTimeOfDay (int32 *sec, int32 *usec)
{
Platform_gettimeval();
*sec = Platform_tvsec();
*usec = Platform_tvusec();
}
LONGINT Platform_Time (void)
int32 Platform_Time (void)
{
LONGINT _o_result;
LONGINT ms;
int32 _o_result;
int32 ms;
Platform_gettimeval();
ms = (int)__DIVF(Platform_tvusec(), 1000) + Platform_tvsec() * 1000;
_o_result = (int)__MOD(ms - Platform_TimeStart, 2147483647);
return _o_result;
}
void Platform_Delay (LONGINT ms)
void Platform_Delay (int32 ms)
{
LONGINT s, ns;
int32 s, ns;
s = __DIV(ms, 1000);
ns = (int)__MOD(ms, 1000) * 1000000;
Platform_nanosleep(s, ns);
}
INTEGER Platform_System (CHAR *cmd, LONGINT cmd__len)
int16 Platform_System (CHAR *cmd, LONGINT cmd__len)
{
INTEGER _o_result;
int16 _o_result;
__DUP(cmd, cmd__len, CHAR);
_o_result = Platform_system(cmd, cmd__len);
__DEL(cmd);
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;
INTEGER fd;
int16 _o_result;
int16 fd;
fd = Platform_openro(n, n__len);
if (fd < 0) {
_o_result = Platform_err();
@ -395,10 +395,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;
INTEGER fd;
int16 _o_result;
int16 fd;
fd = Platform_openrw(n, n__len);
if (fd < 0) {
_o_result = Platform_err();
@ -411,10 +411,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;
INTEGER fd;
int16 _o_result;
int16 fd;
fd = Platform_opennew(n, n__len);
if (fd < 0) {
_o_result = Platform_err();
@ -427,9 +427,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_closefile(h) < 0) {
_o_result = Platform_err();
return _o_result;
@ -440,9 +440,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_structstats();
if (Platform_fstat(h) < 0) {
_o_result = Platform_err();
@ -455,9 +455,9 @@ 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;
int16 _o_result;
__DUP(n, n__len, CHAR);
Platform_structstats();
if (Platform_stat(n, n__len) < 0) {
@ -492,15 +492,15 @@ void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Pla
(*target).mtime = source.mtime;
}
void Platform_MTimeAsClock (Platform_FileIdentity i, LONGINT *t, LONGINT *d)
void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d)
{
Platform_sectotm(i.mtime);
Platform_YMDHMStoClock(Platform_tmyear(), Platform_tmmon(), Platform_tmmday(), Platform_tmhour(), Platform_tmmin(), Platform_tmsec(), &*t, &*d);
}
INTEGER Platform_Size (LONGINT h, LONGINT *l)
int16 Platform_Size (int32 h, int32 *l)
{
INTEGER _o_result;
int16 _o_result;
Platform_structstats();
if (Platform_fstat(h) < 0) {
_o_result = Platform_err();
@ -511,9 +511,9 @@ 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;
int16 _o_result;
*n = Platform_readfile(h, p, l);
if (*n < 0) {
*n = 0;
@ -526,9 +526,9 @@ 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;
int16 _o_result;
*n = Platform_readfile(h, (SYSTEM_ADRINT)b, b__len);
if (*n < 0) {
*n = 0;
@ -541,10 +541,10 @@ 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;
LONGINT written;
int16 _o_result;
int32 written;
written = Platform_writefile(h, p, l);
if (written < 0) {
_o_result = Platform_err();
@ -556,9 +556,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_fsync(h) < 0) {
_o_result = Platform_err();
return _o_result;
@ -569,9 +569,9 @@ INTEGER Platform_Sync (LONGINT h)
__RETCHK;
}
INTEGER Platform_Seek (LONGINT h, LONGINT offset, INTEGER whence)
int16 Platform_Seek (int32 h, int32 offset, int16 whence)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_lseek(h, offset, whence) < 0) {
_o_result = Platform_err();
return _o_result;
@ -582,9 +582,9 @@ INTEGER Platform_Seek (LONGINT h, LONGINT offset, INTEGER whence)
__RETCHK;
}
INTEGER Platform_Truncate (LONGINT h, LONGINT l)
int16 Platform_Truncate (int32 h, int32 l)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_ftruncate(h, l) < 0) {
_o_result = Platform_err();
return _o_result;
@ -595,9 +595,9 @@ INTEGER Platform_Truncate (LONGINT h, LONGINT l)
__RETCHK;
}
INTEGER Platform_Unlink (CHAR *n, LONGINT n__len)
int16 Platform_Unlink (CHAR *n, LONGINT n__len)
{
INTEGER _o_result;
int16 _o_result;
if (Platform_unlink(n, n__len) < 0) {
_o_result = Platform_err();
return _o_result;
@ -608,10 +608,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_chdir(n, n__len);
Platform_getcwd((void*)Platform_CWD, 256);
if (r < 0) {
@ -624,9 +624,9 @@ INTEGER Platform_Chdir (CHAR *n, LONGINT n__len)
__RETCHK;
}
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_rename(o, o__len, n, n__len) < 0) {
_o_result = Platform_err();
return _o_result;
@ -637,7 +637,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);
}
@ -653,7 +653,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));
@ -661,7 +661,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('-');
@ -670,7 +670,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:
@ -726,9 +726,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);
@ -740,12 +740,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);
@ -753,7 +753,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)
@ -763,7 +763,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

@ -7,74 +7,74 @@
typedef
struct Platform_FileIdentity {
LONGINT volume, index, mtime;
int32 volume, index, mtime;
} 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[256];
import INTEGER Platform_ArgCount;
import LONGINT Platform_ArgVector;
import INTEGER Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
import int16 Platform_ArgCount;
import int32 Platform_ArgVector;
import int16 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
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 offset, INTEGER whence);
import int16 Platform_Seek (int32 h, int32 offset, int16 whence);
import void Platform_SetBadInstructionHandler (Platform_SignalHandler handler);
import void Platform_SetHalt (Platform_HaltProcedure p);
import void Platform_SetInterruptHandler (Platform_SignalHandler handler);
import void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Platform_FileIdentity source);
import void Platform_SetQuitHandler (Platform_SignalHandler handler);
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 l);
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 l);
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 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);

View file

@ -5,14 +5,14 @@
static CHAR Console_line[128];
static INTEGER Console_pos;
static int32 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 (int64 i);
export void Console_Int (int64 i, int64 n);
export void Console_Ln (void);
export void Console_Read (CHAR *ch);
export void Console_ReadLine (CHAR *line, LONGINT line__len);
@ -21,7 +21,7 @@ export void Console_String (CHAR *s, LONGINT s__len);
void Console_Flush (void)
{
INTEGER error;
int32 error;
error = Platform_Write(1, (SYSTEM_ADRINT)Console_line, Console_pos);
Console_pos = 0;
}
@ -40,7 +40,7 @@ void Console_Char (CHAR ch)
void Console_String (CHAR *s, LONGINT s__len)
{
INTEGER i;
int32 i;
__DUP(s, s__len, CHAR);
i = 0;
while (s[__X(i, s__len)] != 0x00) {
@ -50,11 +50,11 @@ void Console_String (CHAR *s, LONGINT s__len)
__DEL(s);
}
void Console_Int (LONGINT i, LONGINT n)
void Console_Int (int64 i, int64 n)
{
CHAR s[32];
LONGINT i1, k;
if (i == __LSHL(1, 63, LONGINT)) {
int64 i1, k;
if (i == __LSHL(1, 63, int64)) {
__MOVE("8085774586302733229", s, 20);
k = 19;
} else {
@ -96,9 +96,9 @@ void Console_Bool (BOOLEAN b)
}
}
void Console_Hex (LONGINT i)
void Console_Hex (int64 i)
{
LONGINT k, n;
int64 k, n;
k = -28;
while (k <= 0) {
n = __MASK(__ASH(i, k), -16);
@ -113,8 +113,8 @@ void Console_Hex (LONGINT i)
void Console_Read (CHAR *ch)
{
LONGINT n;
INTEGER error;
int64 n;
int32 error;
Console_Flush();
error = Platform_ReadBuf(0, (void*)&*ch, 1, &n);
if (n != 1) {
@ -124,7 +124,7 @@ void Console_Read (CHAR *ch)
void Console_ReadLine (CHAR *line, LONGINT line__len)
{
LONGINT i;
int64 i;
CHAR ch;
Console_Flush();
i = 0;

View file

@ -12,8 +12,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 (int64 i);
import void Console_Int (int64 i, int64 n);
import void Console_Ln (void);
import void Console_Read (CHAR *ch);
import void Console_ReadLine (CHAR *line, LONGINT line__len);

View file

@ -14,7 +14,7 @@ typedef
struct Files_BufDesc {
Files_File f;
BOOLEAN chg;
LONGINT org, size;
int64 org, size;
SYSTEM_BYTE data[4096];
} Files_BufDesc;
@ -29,23 +29,23 @@ typedef
Files_FileName workName, registerName;
BOOLEAN tempFile;
Platform_FileIdentity identity;
LONGINT fd, len, pos;
int64 fd, len, pos;
Files_Buffer bufs[4];
INTEGER swapper, state;
int32 swapper, state;
Files_File next;
} Files_FileDesc;
typedef
struct Files_Rider {
LONGINT res;
int64 res;
BOOLEAN eof;
Files_Buffer buf;
LONGINT org, offset;
int64 org, offset;
} Files_Rider;
static Files_File Files_files;
static INTEGER Files_tempno;
static int32 Files_tempno;
static CHAR Files_HOME[1024];
static struct {
LONGINT len[1];
@ -58,56 +58,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, int32 *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, int32 *res);
static void Files_Err (CHAR *s, LONGINT s__len, Files_File f, int32 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, int64 *t, int64 *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 int64 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 int64 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, int64 n);
export void Files_ReadInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
export void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int64 *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, int64 *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, int32 *res);
static void Files_ScanPath (int32 *pos, CHAR *dir, LONGINT dir__len);
export void Files_Set (Files_Rider *r, LONGINT *r__typ, Files_File f, int64 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, int64 n);
export void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int32 x);
export void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 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, int64 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, int32 errcode)
{
__DUP(s, s__len, CHAR);
Console_Ln();
@ -136,7 +136,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;
int32 i, j;
__DUP(dir, dir__len, CHAR);
__DUP(name, name__len, CHAR);
i = 0;
@ -161,7 +161,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;
int64 n, i, j;
__DUP(finalName, finalName__len, CHAR);
Files_tempno += 1;
n = Files_tempno;
@ -213,7 +213,7 @@ static void Files_Create (Files_File f)
{
Platform_FileIdentity identity;
BOOLEAN done;
INTEGER error;
int32 error;
CHAR err[32];
if (f->fd == -1) {
if (f->state == 1) {
@ -250,7 +250,7 @@ static void Files_Create (Files_File f)
static void Files_Flush (Files_Buffer buf)
{
INTEGER error;
int32 error;
Files_File f = NIL;
if (buf->chg) {
f = buf->f;
@ -274,7 +274,7 @@ static void Files_Flush (Files_Buffer buf)
static void Files_CloseOSFile (Files_File f)
{
Files_File prev = NIL;
INTEGER error;
int32 error;
if (Files_files == f) {
Files_files = f->next;
} else {
@ -294,8 +294,8 @@ static void Files_CloseOSFile (Files_File f)
void Files_Close (Files_File f)
{
LONGINT i;
INTEGER error;
int64 i;
int32 error;
if (f->state != 1 || f->registerName[0] != 0x00) {
Files_Create(f);
i = 0;
@ -311,9 +311,9 @@ void Files_Close (Files_File f)
}
}
LONGINT Files_Length (Files_File f)
int64 Files_Length (Files_File f)
{
LONGINT _o_result;
int64 _o_result;
_o_result = f->len;
return _o_result;
}
@ -336,9 +336,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 (int32 *pos, CHAR *dir, LONGINT dir__len)
{
INTEGER i;
int32 i;
CHAR ch;
i = 0;
if (Files_SearchPath == NIL) {
@ -382,7 +382,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;
int32 i;
CHAR ch;
i = 0;
ch = name[0];
@ -398,7 +398,7 @@ static Files_File Files_CacheEntry (Platform_FileIdentity identity)
{
Files_File _o_result;
Files_File f = NIL;
INTEGER i, error;
int32 i, error;
f = Files_files;
while (f != NIL) {
if (Platform_SameFile(identity, f->identity)) {
@ -428,11 +428,11 @@ Files_File Files_Old (CHAR *name, LONGINT name__len)
{
Files_File _o_result;
Files_File f = NIL;
LONGINT fd;
INTEGER pos;
int64 fd;
int32 pos;
BOOLEAN done;
CHAR dir[256], path[256];
INTEGER error;
int32 error;
Platform_FileIdentity identity;
__DUP(name, name__len, CHAR);
if (name[0] != 0x00) {
@ -507,9 +507,9 @@ Files_File Files_Old (CHAR *name, LONGINT name__len)
void Files_Purge (Files_File f)
{
INTEGER i;
int32 i;
Platform_FileIdentity identity;
INTEGER error;
int32 error;
i = 0;
while (i < 4) {
if (f->bufs[i] != NIL) {
@ -529,27 +529,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, int64 *t, int64 *d)
{
Platform_FileIdentity identity;
INTEGER error;
int32 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)
int64 Files_Pos (Files_Rider *r, LONGINT *r__typ)
{
LONGINT _o_result;
int64 _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, int64 pos)
{
LONGINT org, offset, i, n;
int64 org, offset, i, n;
Files_Buffer buf = NIL;
INTEGER error;
int32 error;
if (f != NIL) {
if (pos > f->len) {
pos = f->len;
@ -609,7 +609,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;
int64 offset;
Files_Buffer buf = NIL;
buf = (*r).buf;
offset = (*r).offset;
@ -631,9 +631,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, int64 n)
{
LONGINT xpos, min, restInBuf, offset;
int64 xpos, min, restInBuf, offset;
Files_Buffer buf = NIL;
if (n > x__len) {
Files_IdxTrap();
@ -682,7 +682,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;
int64 offset;
buf = (*r).buf;
offset = (*r).offset;
if ((*r).org != buf->org || offset >= 4096) {
@ -700,9 +700,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, int64 n)
{
LONGINT xpos, min, restInBuf, offset;
int64 xpos, min, restInBuf, offset;
Files_Buffer buf = NIL;
if (n > x__len) {
Files_IdxTrap();
@ -736,17 +736,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, int32 *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, int32 *res)
{
LONGINT fdold, fdnew, n;
INTEGER error, ignore;
int64 fdold, fdnew, n;
int32 error, ignore;
Platform_FileIdentity oldidentity, newidentity;
CHAR buf[4096];
__DUP(old, old__len, CHAR);
@ -801,7 +801,7 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, INT
void Files_Register (Files_File f)
{
INTEGER idx, errcode;
int32 idx, errcode;
Files_File f1 = NIL;
CHAR file[104];
if ((f->state == 1 && f->registerName[0] != 0x00)) {
@ -820,7 +820,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, int32 *res)
{
__DUP(path, path__len, CHAR);
*res = Platform_Chdir((void*)path, path__len);
@ -829,7 +829,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;
int64 i, j;
if (!Platform_LittleEndian) {
i = src__len;
j = 0;
@ -848,14 +848,14 @@ 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, int32 *x)
{
CHAR b[2];
Files_ReadBytes(&*R, R__typ, (void*)b, 2, 2);
*x = b[0] + __ASHL(b[1], 8);
}
void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int64 *x)
{
CHAR b[4];
Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4);
@ -865,7 +865,7 @@ void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x)
{
CHAR b[4];
LONGINT l;
int64 l;
Files_ReadBytes(&*R, R__typ, (void*)b, 4, 4);
l = ((b[0] + __ASHL(b[1], 8)) + __ASHL(b[2], 16)) + __ASHL(b[3], 24);
*x = (SET)l;
@ -887,7 +887,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;
int32 i;
CHAR ch;
i = 0;
do {
@ -899,7 +899,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;
int32 i;
CHAR ch;
BOOLEAN b;
i = 0;
@ -915,20 +915,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, int64 *x)
{
SHORTINT s;
int8 s;
CHAR ch;
LONGINT n;
int64 n;
s = 0;
n = 0;
Files_Read(&*R, R__typ, (void*)&ch);
while (ch >= 128) {
n += __ASH((SYSTEM_INT64)(ch - 128), s);
n += __ASH((int64)(ch - 128), s);
s += 7;
Files_Read(&*R, R__typ, (void*)&ch);
}
n += __ASH((SYSTEM_INT64)(__MASK(ch, -64) - __ASHL(__ASHR(ch, 6), 6)), s);
n += __ASH((int64)(__MASK(ch, -64) - __ASHL(__ASHR(ch, 6), 6)), s);
*x = n;
}
@ -937,7 +937,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, int32 x)
{
CHAR b[2];
b[0] = (CHAR)x;
@ -945,7 +945,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, int64 x)
{
CHAR b[4];
b[0] = (CHAR)x;
@ -958,8 +958,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;
int64 i;
i = (int64)x;
b[0] = (CHAR)i;
b[1] = (CHAR)__ASHR(i, 8);
b[2] = (CHAR)__ASHR(i, 16);
@ -983,7 +983,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;
int32 i;
i = 0;
while (x[i] != 0x00) {
i += 1;
@ -991,7 +991,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, int64 x)
{
while (x < -64 || x > 63) {
Files_Write(&*R, R__typ, (CHAR)(__MASK(x, -128) + 128));
@ -1008,7 +1008,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;
int64 res;
f = (Files_File)(SYSTEM_ADRINT)o;
if (f->fd >= 0) {
Files_CloseOSFile(f);

View file

@ -12,13 +12,13 @@ typedef
typedef
struct Files_FileDesc {
char _prvt0[232];
LONGINT fd;
int64 fd;
char _prvt1[64];
} Files_FileDesc;
typedef
struct Files_Rider {
LONGINT res;
int64 res;
BOOLEAN eof;
char _prvt0[31];
} Files_Rider;
@ -29,39 +29,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, int32 *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, int32 *res);
import void Files_GetDate (Files_File f, int64 *t, int64 *d);
import void Files_GetName (Files_File f, CHAR *name, LONGINT name__len);
import LONGINT Files_Length (Files_File f);
import int64 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 int64 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, int64 n);
import void Files_ReadInt (Files_Rider *R, LONGINT *R__typ, int32 *x);
import void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, int64 *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, int64 *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, int32 *res);
import void Files_Set (Files_Rider *r, LONGINT *r__typ, Files_File f, int64 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, int64 n);
import void Files_WriteInt (Files_Rider *R, LONGINT *R__typ, int32 x);
import void Files_WriteLInt (Files_Rider *R, LONGINT *R__typ, int64 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, int64 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

@ -35,7 +35,7 @@ typedef
typedef
struct Heap_FinDesc {
Heap_FinNode next;
LONGINT obj;
int64 obj;
BOOLEAN marked;
Heap_Finalizer finalize;
} Heap_FinDesc;
@ -50,25 +50,25 @@ typedef
struct Heap_ModuleDesc {
Heap_Module next;
Heap_ModuleName name;
LONGINT refcnt;
int64 refcnt;
Heap_Cmd cmds;
LONGINT types;
int64 types;
Heap_EnumProc enumPtrs;
LONGINT reserved1, reserved2;
int64 reserved1, reserved2;
} Heap_ModuleDesc;
export SYSTEM_PTR Heap_modules;
static LONGINT Heap_freeList[10];
static LONGINT Heap_bigBlocks;
export LONGINT Heap_allocated;
static int64 Heap_freeList[10];
static int64 Heap_bigBlocks;
export int64 Heap_allocated;
static BOOLEAN Heap_firstTry;
static LONGINT Heap_heap, Heap_heapend;
export LONGINT Heap_heapsize;
static int64 Heap_heap, Heap_heapend;
export int64 Heap_heapsize;
static Heap_FinNode Heap_fin;
static INTEGER Heap_lockdepth;
static int32 Heap_lockdepth;
static BOOLEAN Heap_interrupted;
export INTEGER Heap_FileCount;
export int32 Heap_FileCount;
export LONGINT *Heap_ModuleDesc__typ;
export LONGINT *Heap_CmdDesc__typ;
@ -76,27 +76,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 (int64 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 (int64 n, int64 *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 (int64 q);
static void Heap_MarkCandidates (int64 n, int64 *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 (int64 n, int64 *cand, LONGINT cand__len);
export SYSTEM_PTR Heap_NEWBLK (int64 size);
export SYSTEM_PTR Heap_NEWREC (int64 tag);
static int64 Heap_NewChunk (int64 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, int64 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 (int64 l, int64 r, int64 *a, LONGINT a__len);
export void Heap_Unlock (void);
extern void *Heap__init();
@ -155,9 +155,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, int64 typ)
{
__PUT(typ, m->types, LONGINT);
__PUT(typ, m->types, int64);
m->types = typ;
}
@ -166,17 +166,17 @@ void Heap_INCREF (Heap_Module m)
m->refcnt += 1;
}
static LONGINT Heap_NewChunk (LONGINT blksz)
static int64 Heap_NewChunk (int64 blksz)
{
LONGINT _o_result;
LONGINT chnk;
int64 _o_result;
int64 chnk;
chnk = Heap_OSAllocate(blksz + 24);
if (chnk != 0) {
__PUT(chnk + 8, chnk + (24 + blksz), LONGINT);
__PUT(chnk + 24, chnk + 32, LONGINT);
__PUT(chnk + 32, blksz, LONGINT);
__PUT(chnk + 40, -8, LONGINT);
__PUT(chnk + 48, Heap_bigBlocks, LONGINT);
__PUT(chnk + 8, chnk + (24 + blksz), int64);
__PUT(chnk + 24, chnk + 32, int64);
__PUT(chnk + 32, blksz, int64);
__PUT(chnk + 40, -8, int64);
__PUT(chnk + 48, Heap_bigBlocks, int64);
Heap_bigBlocks = chnk + 24;
Heap_heapsize += blksz;
}
@ -184,9 +184,9 @@ static LONGINT Heap_NewChunk (LONGINT blksz)
return _o_result;
}
static void Heap_ExtendHeap (LONGINT blksz)
static void Heap_ExtendHeap (int64 blksz)
{
LONGINT size, chnk, j, next;
int64 size, chnk, j, next;
if (blksz > 320000) {
size = blksz;
} else {
@ -195,7 +195,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, int64);
Heap_heap = chnk;
} else {
j = Heap_heap;
@ -204,8 +204,8 @@ static void Heap_ExtendHeap (LONGINT blksz)
j = next;
next = Heap_FetchAddress(j);
}
__PUT(chnk, next, LONGINT);
__PUT(j, chnk, LONGINT);
__PUT(chnk, next, int64);
__PUT(j, chnk, int64);
}
if (next == 0) {
Heap_heapend = Heap_FetchAddress(chnk + 8);
@ -213,10 +213,10 @@ static void Heap_ExtendHeap (LONGINT blksz)
}
}
SYSTEM_PTR Heap_NEWREC (LONGINT tag)
SYSTEM_PTR Heap_NEWREC (int64 tag)
{
SYSTEM_PTR _o_result;
LONGINT i, i0, di, blksz, restsize, t, adr, end, next, prev;
int64 i, i0, di, blksz, restsize, t, adr, end, next, prev;
SYSTEM_PTR new;
Heap_Lock();
blksz = Heap_FetchAddress(tag);
@ -236,11 +236,11 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag)
di = i - i0;
restsize = __ASHL(di, 5);
end = adr + restsize;
__PUT(end + 8, blksz, LONGINT);
__PUT(end + 16, -8, LONGINT);
__PUT(end, end + 8, LONGINT);
__PUT(adr + 8, restsize, LONGINT);
__PUT(adr + 24, Heap_freeList[di], LONGINT);
__PUT(end + 8, blksz, int64);
__PUT(end + 16, -8, int64);
__PUT(end, end + 8, int64);
__PUT(adr + 8, restsize, int64);
__PUT(adr + 24, Heap_freeList[di], int64);
Heap_freeList[di] = adr;
adr += restsize;
}
@ -280,22 +280,22 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag)
}
restsize = t - blksz;
end = adr + restsize;
__PUT(end + 8, blksz, LONGINT);
__PUT(end + 16, -8, LONGINT);
__PUT(end, end + 8, LONGINT);
__PUT(end + 8, blksz, int64);
__PUT(end + 16, -8, int64);
__PUT(end, end + 8, int64);
if (restsize > 288) {
__PUT(adr + 8, restsize, LONGINT);
__PUT(adr + 8, restsize, int64);
} else {
next = Heap_FetchAddress(adr + 24);
if (prev == 0) {
Heap_bigBlocks = next;
} else {
__PUT(prev + 24, next, LONGINT);
__PUT(prev + 24, next, int64);
}
if (restsize > 0) {
di = __ASHR(restsize, 5);
__PUT(adr + 8, restsize, LONGINT);
__PUT(adr + 24, Heap_freeList[di], LONGINT);
__PUT(adr + 8, restsize, int64);
__PUT(adr + 24, Heap_freeList[di], int64);
Heap_freeList[di] = adr;
}
}
@ -304,53 +304,53 @@ SYSTEM_PTR Heap_NEWREC (LONGINT tag)
i = adr + 32;
end = adr + blksz;
while (i < end) {
__PUT(i, 0, LONGINT);
__PUT(i + 8, 0, LONGINT);
__PUT(i + 16, 0, LONGINT);
__PUT(i + 24, 0, LONGINT);
__PUT(i, 0, int64);
__PUT(i + 8, 0, int64);
__PUT(i + 16, 0, int64);
__PUT(i + 24, 0, int64);
i += 32;
}
__PUT(adr + 24, 0, LONGINT);
__PUT(adr, tag, LONGINT);
__PUT(adr + 8, 0, LONGINT);
__PUT(adr + 16, 0, LONGINT);
__PUT(adr + 24, 0, int64);
__PUT(adr, tag, int64);
__PUT(adr + 8, 0, int64);
__PUT(adr + 16, 0, int64);
Heap_allocated += blksz;
Heap_Unlock();
_o_result = (SYSTEM_PTR)(SYSTEM_ADRINT)(adr + 8);
return _o_result;
}
SYSTEM_PTR Heap_NEWBLK (LONGINT size)
SYSTEM_PTR Heap_NEWBLK (int64 size)
{
SYSTEM_PTR _o_result;
LONGINT blksz, tag;
int64 blksz, tag;
SYSTEM_PTR new;
Heap_Lock();
blksz = __ASHL(__ASHR(size + 63, 5), 5);
new = Heap_NEWREC((SYSTEM_ADRINT)&blksz);
tag = ((LONGINT)(SYSTEM_ADRINT)new + blksz) - 24;
__PUT(tag - 8, 0, LONGINT);
__PUT(tag, blksz, LONGINT);
__PUT(tag + 8, -8, LONGINT);
__PUT((LONGINT)(SYSTEM_ADRINT)new - 8, tag, LONGINT);
tag = ((int64)(SYSTEM_ADRINT)new + blksz) - 24;
__PUT(tag - 8, 0, int64);
__PUT(tag, blksz, int64);
__PUT(tag + 8, -8, int64);
__PUT((int64)(SYSTEM_ADRINT)new - 8, tag, int64);
Heap_Unlock();
_o_result = new;
return _o_result;
}
static void Heap_Mark (LONGINT q)
static void Heap_Mark (int64 q)
{
LONGINT p, tag, fld, n, offset, tagbits;
int64 p, tag, fld, n, offset, tagbits;
if (q != 0) {
tagbits = Heap_FetchAddress(q - 8);
if (!__ODD(tagbits)) {
__PUT(q - 8, tagbits + 1, LONGINT);
__PUT(q - 8, tagbits + 1, int64);
p = 0;
tag = tagbits + 8;
for (;;) {
__GET(tag, offset, LONGINT);
__GET(tag, offset, int64);
if (offset < 0) {
__PUT(q - 8, (tag + offset) + 1, LONGINT);
__PUT(q - 8, (tag + offset) + 1, int64);
if (p == 0) {
break;
}
@ -358,7 +358,7 @@ static void Heap_Mark (LONGINT q)
q = p;
tag = Heap_FetchAddress(q - 8);
tag -= 1;
__GET(tag, offset, LONGINT);
__GET(tag, offset, int64);
fld = q + offset;
p = Heap_FetchAddress(fld);
__PUT(fld, (SYSTEM_PTR)(SYSTEM_ADRINT)n, SYSTEM_PTR);
@ -368,8 +368,8 @@ static void Heap_Mark (LONGINT q)
if (n != 0) {
tagbits = Heap_FetchAddress(n - 8);
if (!__ODD(tagbits)) {
__PUT(n - 8, tagbits + 1, LONGINT);
__PUT(q - 8, tag + 1, LONGINT);
__PUT(n - 8, tagbits + 1, int64);
__PUT(q - 8, tag + 1, int64);
__PUT(fld, (SYSTEM_PTR)(SYSTEM_ADRINT)p, SYSTEM_PTR);
p = q;
q = n;
@ -385,12 +385,12 @@ static void Heap_Mark (LONGINT q)
static void Heap_MarkP (SYSTEM_PTR p)
{
Heap_Mark((LONGINT)(SYSTEM_ADRINT)p);
Heap_Mark((int64)(SYSTEM_ADRINT)p);
}
static void Heap_Scan (void)
{
LONGINT chnk, adr, end, start, tag, i, size, freesize;
int64 chnk, adr, end, start, tag, i, size, freesize;
Heap_bigBlocks = 0;
i = 1;
while (i < 9) {
@ -408,21 +408,21 @@ static void Heap_Scan (void)
if (__ODD(tag)) {
if (freesize > 0) {
start = adr - freesize;
__PUT(start, start + 8, LONGINT);
__PUT(start + 8, freesize, LONGINT);
__PUT(start + 16, -8, LONGINT);
__PUT(start, start + 8, int64);
__PUT(start + 8, freesize, int64);
__PUT(start + 16, -8, int64);
i = __ASHR(freesize, 5);
freesize = 0;
if (i < 9) {
__PUT(start + 24, Heap_freeList[i], LONGINT);
__PUT(start + 24, Heap_freeList[i], int64);
Heap_freeList[i] = start;
} else {
__PUT(start + 24, Heap_bigBlocks, LONGINT);
__PUT(start + 24, Heap_bigBlocks, int64);
Heap_bigBlocks = start;
}
}
tag -= 1;
__PUT(adr, tag, LONGINT);
__PUT(adr, tag, int64);
size = Heap_FetchAddress(tag);
Heap_allocated += size;
adr += size;
@ -434,16 +434,16 @@ static void Heap_Scan (void)
}
if (freesize > 0) {
start = adr - freesize;
__PUT(start, start + 8, LONGINT);
__PUT(start + 8, freesize, LONGINT);
__PUT(start + 16, -8, LONGINT);
__PUT(start, start + 8, int64);
__PUT(start + 8, freesize, int64);
__PUT(start + 16, -8, int64);
i = __ASHR(freesize, 5);
freesize = 0;
if (i < 9) {
__PUT(start + 24, Heap_freeList[i], LONGINT);
__PUT(start + 24, Heap_freeList[i], int64);
Heap_freeList[i] = start;
} else {
__PUT(start + 24, Heap_bigBlocks, LONGINT);
__PUT(start + 24, Heap_bigBlocks, int64);
Heap_bigBlocks = start;
}
}
@ -451,9 +451,9 @@ static void Heap_Scan (void)
}
}
static void Heap_Sift (LONGINT l, LONGINT r, LONGINT *a, LONGINT a__len)
static void Heap_Sift (int64 l, int64 r, int64 *a, LONGINT a__len)
{
LONGINT i, j, x;
int64 i, j, x;
j = l;
x = a[j];
for (;;) {
@ -470,9 +470,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 (int64 n, int64 *a, LONGINT a__len)
{
LONGINT l, r, x;
int64 l, r, x;
l = __ASHR(n, 1);
r = n - 1;
while (l > 0) {
@ -488,9 +488,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 (int64 n, int64 *cand, LONGINT cand__len)
{
LONGINT chnk, adr, tag, next, lim, lim1, i, ptr, size;
int64 chnk, adr, tag, next, lim, lim1, i, ptr, size;
chnk = Heap_heap;
i = 0;
lim = cand[n - 1];
@ -528,7 +528,7 @@ static void Heap_MarkCandidates (LONGINT n, LONGINT *cand, LONGINT cand__len)
static void Heap_CheckFin (void)
{
Heap_FinNode n;
LONGINT tag;
int64 tag;
n = Heap_fin;
while (n != NIL) {
tag = Heap_FetchAddress(n->obj - 8);
@ -577,10 +577,10 @@ void Heap_FINALL (void)
}
}
static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len)
static void Heap_MarkStack (int64 n, int64 *cand, LONGINT cand__len)
{
SYSTEM_PTR frame;
LONGINT inc, nofcand, sp, p, stack0;
int64 inc, nofcand, sp, p, stack0;
struct Heap__1 align;
if (n > 0) {
Heap_MarkStack(n - 1, cand, cand__len);
@ -597,7 +597,7 @@ static void Heap_MarkStack (LONGINT n, LONGINT *cand, LONGINT cand__len)
inc = -inc;
}
while (sp != stack0) {
__GET(sp, p, LONGINT);
__GET(sp, p, int64);
if ((p > Heap_heap && p < Heap_heapend)) {
if (nofcand == cand__len) {
Heap_HeapSort(nofcand, (void*)cand, cand__len);
@ -619,8 +619,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];
int64 i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23;
int64 cand[10000];
if (Heap_lockdepth == 0 || (Heap_lockdepth == 1 && !markStack)) {
Heap_Lock();
m = (Heap_Module)(SYSTEM_ADRINT)Heap_modules;
@ -700,7 +700,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 = (int64)(SYSTEM_ADRINT)obj;
f->finalize = finalize;
f->marked = 1;
f->next = Heap_fin;
@ -711,7 +711,7 @@ void Heap_InitHeap (void)
{
Heap_heap = Heap_NewChunk(256000);
Heap_heapend = Heap_FetchAddress(Heap_heap + 8);
__PUT(Heap_heap, 0, LONGINT);
__PUT(Heap_heap, 0, int64);
Heap_allocated = 0;
Heap_firstTry = 1;
Heap_freeList[9] = 1;

View file

@ -32,8 +32,8 @@ typedef
import SYSTEM_PTR Heap_modules;
import LONGINT Heap_allocated, Heap_heapsize;
import INTEGER Heap_FileCount;
import int64 Heap_allocated, Heap_heapsize;
import int32 Heap_FileCount;
import LONGINT *Heap_ModuleDesc__typ;
@ -42,11 +42,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 (int64 size);
import SYSTEM_PTR Heap_NEWREC (int64 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, int64 typ);
import void Heap_RegisterFinalizer (SYSTEM_PTR obj, Heap_Finalizer finalize);
import void Heap_Unlock (void);
import void *Heap__init(void);

View file

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

View file

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

View file

@ -7,13 +7,13 @@
export void (*OPB_typSize)(OPT_Struct);
static INTEGER OPB_exp;
static LONGINT OPB_maxExp;
static int32 OPB_exp;
static int64 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 int64 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);
@ -21,10 +21,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 (int32 f, int32 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 (int32 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);
@ -34,17 +34,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 (int64 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 (int64 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, int64 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);
@ -52,17 +52,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, int32 parno);
export void OPB_StPar0 (OPT_Node *par0, int32 fctno);
export void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno);
export void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n);
export void OPB_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 (int32 n);
static int64 OPB_log (int64 x);
static void OPB_err (INTEGER n)
static void OPB_err (int32 n)
{
OPM_err(n);
}
@ -101,7 +101,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);
@ -124,9 +124,9 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y)
*last = y;
}
static LONGINT OPB_BoolToInt (BOOLEAN b)
static int64 OPB_BoolToInt (BOOLEAN b)
{
LONGINT _o_result;
int64 _o_result;
if (b) {
_o_result = 1;
return _o_result;
@ -137,7 +137,7 @@ static LONGINT OPB_BoolToInt (BOOLEAN b)
__RETCHK;
}
static BOOLEAN OPB_IntToBool (LONGINT i)
static BOOLEAN OPB_IntToBool (int64 i)
{
BOOLEAN _o_result;
if (i == 0) {
@ -223,8 +223,8 @@ OPT_Node OPB_EmptySet (void)
static void OPB_SetIntType (OPT_Node node)
{
INTEGER b;
LONGINT n;
int32 b;
int64 n;
if (node->conval->intval >= 0) {
n = node->conval->intval;
} else {
@ -237,7 +237,7 @@ static void OPB_SetIntType (OPT_Node node)
node->typ = OPT_IntType(b);
}
OPT_Node OPB_NewIntConst (LONGINT intval)
OPT_Node OPB_NewIntConst (int64 intval)
{
OPT_Node _o_result;
OPT_Node x = NIL;
@ -262,7 +262,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, int64 len)
{
OPT_Node _o_result;
OPT_Node x = NIL;
@ -294,7 +294,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);
@ -336,7 +336,7 @@ void OPB_DeRef (OPT_Node *x)
void OPB_Index (OPT_Node *x, OPT_Node y)
{
INTEGER f;
int32 f;
OPT_Struct typ = NIL;
f = y->typ->form;
if ((*x)->class >= 7) {
@ -461,15 +461,15 @@ void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard)
void OPB_In (OPT_Node *x, OPT_Node y)
{
INTEGER f;
LONGINT k;
int32 f;
int64 k;
f = (*x)->typ->form;
if ((((*x)->class == 8 || (*x)->class == 9) || y->class == 8) || y->class == 9) {
OPB_err(126);
} else if ((f == 4 && y->typ->form == 7)) {
if ((*x)->class == 7) {
k = (*x)->conval->intval;
if (k < 0 || k > (SYSTEM_INT64)OPM_MaxSet) {
if (k < 0 || k > (int64)OPM_MaxSet) {
OPB_err(202);
} else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval));
@ -488,9 +488,9 @@ void OPB_In (OPT_Node *x, OPT_Node y)
(*x)->typ = OPT_booltyp;
}
static LONGINT OPB_log (LONGINT x)
static int64 OPB_log (int64 x)
{
LONGINT _o_result;
int64 _o_result;
OPB_exp = 0;
if (x > 0) {
while (!__ODD(x)) {
@ -502,7 +502,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 (int32 f, int32 nr, OPT_Const x)
{
LONGREAL min, max, r;
if (f == 5) {
@ -526,9 +526,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;
@ -540,9 +540,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;
int32 f;
OPT_Struct typ = NIL;
OPT_Node z = NIL;
struct MOp__28 _s;
@ -679,7 +679,7 @@ void OPB_MOp (SHORTINT op, OPT_Node *x)
static void OPB_CheckPtr (OPT_Node x, OPT_Node y)
{
INTEGER g;
int32 g;
OPT_Struct p = NIL, q = NIL, t = NIL;
g = y->typ->form;
if (g == 11) {
@ -763,17 +763,17 @@ static void OPB_CheckProc (OPT_Struct x, OPT_Object y)
static struct ConstOp__13 {
OPT_Node *x;
INTEGER *f;
int32 *f;
OPT_Const *xval, *yval;
struct ConstOp__13 *lnk;
} *ConstOp__13_s;
static INTEGER ConstCmp__14 (void);
static int32 ConstCmp__14 (void);
static INTEGER ConstCmp__14 (void)
static int32 ConstCmp__14 (void)
{
INTEGER _o_result;
INTEGER res;
int32 _o_result;
int32 res;
switch (*ConstOp__13_s->f) {
case 0:
res = 9;
@ -837,11 +837,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 (int32 op, OPT_Node x, OPT_Node y)
{
INTEGER f, g;
int32 f, g;
OPT_Const xval = NIL, yval = NIL;
LONGINT xv, yv;
int64 xv, yv;
BOOLEAN temp;
struct ConstOp__13 _s;
_s.x = &x;
@ -1117,8 +1117,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;
int32 f, g;
int64 k;
LONGREAL r;
f = (*x)->typ->form;
g = typ->form;
@ -1169,14 +1169,14 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
}
static struct Op__38 {
INTEGER *f, *g;
int32 *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);
@ -1219,13 +1219,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;
int32 f, g;
OPT_Node t = NIL, z = NIL;
OPT_Struct typ = NIL;
BOOLEAN do_;
LONGINT val;
int64 val;
struct Op__38 _s;
_s.f = &f;
_s.g = &g;
@ -1496,19 +1496,19 @@ void OPB_Op (SHORTINT op, OPT_Node *x, OPT_Node y)
void OPB_SetRange (OPT_Node *x, OPT_Node y)
{
LONGINT k, l;
int64 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)) {
if ((*x)->class == 7) {
k = (*x)->conval->intval;
if (0 > k || k > (SYSTEM_INT64)OPM_MaxSet) {
if (0 > k || k > (int64)OPM_MaxSet) {
OPB_err(202);
}
}
if (y->class == 7) {
l = y->conval->intval;
if (0 > l || l > (SYSTEM_INT64)OPM_MaxSet) {
if (0 > l || l > (int64)OPM_MaxSet) {
OPB_err(202);
}
}
@ -1531,14 +1531,14 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
void OPB_SetElem (OPT_Node *x)
{
LONGINT k;
int64 k;
if ((*x)->class == 8 || (*x)->class == 9) {
OPB_err(126);
} else if ((*x)->typ->form != 4) {
OPB_err(93);
} else if ((*x)->class == 7) {
k = (*x)->conval->intval;
if ((0 <= k && k <= (SYSTEM_INT64)OPM_MaxSet)) {
if ((0 <= k && k <= (int64)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k);
} else {
OPB_err(202);
@ -1553,7 +1553,7 @@ void OPB_SetElem (OPT_Node *x)
static void OPB_CheckAssign (OPT_Struct x, OPT_Node ynode)
{
OPT_Struct y = NIL;
INTEGER f, g;
int32 f, g;
OPT_Struct p = NIL, q = NIL;
if (OPM_Verbose) {
OPM_LogWLn();
@ -1696,9 +1696,9 @@ static void OPB_CheckLeaf (OPT_Node x, BOOLEAN dynArrToo)
{
}
void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
void OPB_StPar0 (OPT_Node *par0, int32 fctno)
{
INTEGER f;
int32 f;
OPT_Struct typ = NIL;
OPT_Node x = NIL;
x = *par0;
@ -1913,7 +1913,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
if (x->class == 8 || x->class == 9) {
OPB_err(126);
} else if (f == 4) {
if (x->typ->size != (SYSTEM_INT64)OPM_LIntSize) {
if (x->typ->size != (int64)OPM_LIntSize) {
OPB_Convert(&x, OPT_linttyp);
}
} else {
@ -1953,7 +1953,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
OPB_err(126);
} else if ((((x->class == 7 && f == 4)) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x0810) && x->typ->size == (SYSTEM_INT64)OPM_PointerSize))) {
} else if (!((__IN(x->typ->form, 0x0810) && x->typ->size == (int64)OPM_PointerSize))) {
OPB_err(111);
x->typ = OPT_linttyp;
}
@ -2006,9 +2006,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;
@ -2020,9 +2020,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;
int32 f, L;
OPT_Struct typ = NIL;
OPT_Node p = NIL, t = NIL;
struct StPar1__52 _s;
@ -2051,7 +2051,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
if (x->class == 8 || x->class == 9) {
OPB_err(126);
} else if (f == 4) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (SYSTEM_INT64)OPM_MaxSet))) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int64)OPM_MaxSet))) {
OPB_err(202);
}
p = NewOp__53(19, fctno, p, x);
@ -2064,7 +2064,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_INT32)x->conval->intval;
L = (int32)x->conval->intval;
typ = p->typ;
while ((L > 0 && __IN(typ->comp, 0x0c))) {
typ = typ->BaseTyp;
@ -2222,7 +2222,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
OPB_err(126);
} else if ((((x->class == 7 && f == 4)) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x0810) && x->typ->size == (SYSTEM_INT64)OPM_PointerSize))) {
} else if (!((__IN(x->typ->form, 0x0810) && x->typ->size == (int64)OPM_PointerSize))) {
OPB_err(111);
x->typ = OPT_linttyp;
}
@ -2260,10 +2260,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, int32 fctno, int32 n)
{
OPT_Node node = NIL;
INTEGER f;
int32 f;
OPT_Node p = NIL;
p = *par0;
f = x->typ->form;
@ -2305,9 +2305,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, int32 parno)
{
INTEGER dim;
int32 dim;
OPT_Node x = NIL, p = NIL;
p = *par0;
if (fctno <= 19) {
@ -2371,7 +2371,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;
int32 f;
f = atyp->comp;
ftyp = ftyp->BaseTyp;
atyp = atyp->BaseTyp;
@ -2480,7 +2480,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;
@ -2495,7 +2495,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;
@ -2555,7 +2555,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

@ -15,7 +15,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);
@ -24,25 +24,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 (int64 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, int64 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, int32 parno);
import void OPB_StPar0 (OPT_Node *par0, int32 fctno);
import void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno);
import void OPB_StParN (OPT_Node *par0, OPT_Node x, int32 fctno, int32 n);
import void OPB_StaticLink (int8 dlev);
import void OPB_TypTest (OPT_Node *x, OPT_Object obj, BOOLEAN guard);
import void *OPB__init(void);

View file

@ -6,27 +6,27 @@
#include "OPT.h"
static INTEGER OPC_indentLevel;
static int32 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 (int64 *adr, int64 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 int64 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, int32 vis);
export void OPC_Case (int64 caseVal, int32 form);
static void OPC_CharacterLiteral (int64 c);
export void OPC_Cmp (int32 rel);
export void OPC_CompleteIdent (OPT_Object obj);
export void OPC_Constant (OPT_Const con, INTEGER form);
export void OPC_Constant (OPT_Const con, int32 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);
@ -43,45 +43,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, int64 *off, int64 *n, int64 *curAlign);
static void OPC_FillGap (int64 gap, int64 off, int64 align, int64 *n, int64 *curAlign);
export void OPC_GenBdy (OPT_Node n);
static void OPC_GenDynTypes (OPT_Node n, INTEGER vis);
static void OPC_GenDynTypes (OPT_Node n, int32 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 (int64 n);
export void OPC_Ident (OPT_Object obj);
static void OPC_IdentList (OPT_Object obj, INTEGER vis);
static void OPC_IdentList (OPT_Object obj, int32 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, int32 vis);
export void OPC_Increment (BOOLEAN decrement);
export void OPC_Indent (INTEGER count);
export void OPC_Indent (int32 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 (int64 n, int64 size);
export void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName);
static 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 int32 OPC_Length (CHAR *s, LONGINT s__len);
export int64 OPC_NofPtrs (OPT_Struct typ);
static int32 OPC_PerfectHash (CHAR *s, LONGINT s__len);
static 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, int64 adr, int64 *cnt);
static void OPC_RegCmds (OPT_Object obj);
export void OPC_SetInclude (BOOLEAN exclude);
export LONGINT OPC_SizeAlignment (LONGINT size);
export int64 OPC_SizeAlignment (int64 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, int64 x);
static void OPC_StringLiteral (CHAR *s, LONGINT s__len, int64 l);
export void OPC_TDescDecl (OPT_Struct typ);
export void OPC_TypeDefs (OPT_Object obj, INTEGER vis);
export void OPC_TypeDefs (OPT_Object obj, int32 vis);
export void OPC_TypeOf (OPT_Object ap);
static BOOLEAN OPC_Undefined (OPT_Object obj);
@ -99,14 +99,14 @@ void OPC_Init (void)
}
}
void OPC_Indent (INTEGER count)
void OPC_Indent (int32 count)
{
OPC_indentLevel += count;
}
void OPC_BegStat (void)
{
INTEGER i;
int32 i;
i = OPC_indentLevel;
while (i > 0) {
OPM_Write(0x09);
@ -142,10 +142,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, int64 x)
{
CHAR ch;
INTEGER i;
int32 i;
__DUP(s, s__len, CHAR);
ch = s[0];
i = 0;
@ -161,10 +161,10 @@ static void OPC_Str1 (CHAR *s, LONGINT s__len, LONGINT x)
__DEL(s);
}
static INTEGER OPC_Length (CHAR *s, LONGINT s__len)
static int32 OPC_Length (CHAR *s, LONGINT s__len)
{
INTEGER _o_result;
INTEGER i;
int32 _o_result;
int32 i;
i = 0;
while (s[__X(i, s__len)] != 0x00) {
i += 1;
@ -173,10 +173,10 @@ static INTEGER OPC_Length (CHAR *s, LONGINT s__len)
return _o_result;
}
static INTEGER OPC_PerfectHash (CHAR *s, LONGINT s__len)
static int32 OPC_PerfectHash (CHAR *s, LONGINT s__len)
{
INTEGER _o_result;
INTEGER i, h;
int32 _o_result;
int32 i, h;
i = 0;
h = 0;
while ((s[__X(i, s__len)] != 0x00 && i < 5)) {
@ -189,17 +189,20 @@ static INTEGER OPC_PerfectHash (CHAR *s, LONGINT s__len)
void OPC_Ident (OPT_Object obj)
{
INTEGER mode, level, h;
int32 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) {
@ -213,7 +216,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);
@ -222,7 +225,7 @@ void OPC_Ident (OPT_Object obj)
static void OPC_Stars (OPT_Struct typ, BOOLEAN *openClause)
{
INTEGER pointers;
int32 pointers;
*openClause = 0;
if (((typ->strobj == NIL || typ->strobj->name[0] == 0x00) && typ->comp != 4)) {
if (__IN(typ->comp, 0x0c)) {
@ -258,7 +261,7 @@ static void OPC_DeclareObj (OPT_Object dcl, BOOLEAN scopeDef)
{
OPT_Struct typ = NIL;
BOOLEAN varPar, openClause;
INTEGER form, comp;
int32 form, comp;
typ = dcl->typ;
varPar = ((dcl->mode == 2 && typ->comp != 2) || typ->comp == 3) || scopeDef;
OPC_Stars(typ, &openClause);
@ -320,7 +323,7 @@ void OPC_Andent (OPT_Struct typ)
static BOOLEAN OPC_Undefined (OPT_Object obj)
{
BOOLEAN _o_result;
_o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (SYSTEM_INT64)(3 + OPM_currFile))) && obj->linkadr != 2);
_o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (int64)(3 + OPM_currFile))) && obj->linkadr != 2);
return _o_result;
}
@ -328,8 +331,8 @@ static void OPC_DeclareBase (OPT_Object dcl)
{
OPT_Struct typ = NIL, prev = NIL;
OPT_Object obj = NIL;
INTEGER nofdims;
LONGINT off, n, dummy;
int32 nofdims;
int64 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)))) {
@ -388,12 +391,12 @@ static void OPC_DeclareBase (OPT_Object dcl)
}
}
LONGINT OPC_NofPtrs (OPT_Struct typ)
int64 OPC_NofPtrs (OPT_Struct typ)
{
LONGINT _o_result;
int64 _o_result;
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
LONGINT n;
int64 n;
if ((typ->form == 11 && typ->sysflag == 0)) {
_o_result = 1;
return _o_result;
@ -431,11 +434,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, int64 adr, int64 *cnt)
{
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
LONGINT n, i;
int64 n, i;
if ((typ->form == 11 && typ->sysflag == 0)) {
OPM_WriteInt(adr);
OPM_WriteString((CHAR*)", ", 3);
@ -511,7 +514,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;
int32 dim;
if (showParamName) {
OPC_Ident(par);
OPM_WriteString((CHAR*)"__len", 6);
@ -611,7 +614,7 @@ OPT_Object OPC_BaseTProc (OPT_Object obj)
{
OPT_Object _o_result;
OPT_Struct typ = NIL, base = NIL;
LONGINT mno;
int64 mno;
typ = obj->link->typ;
if (typ->form == 11) {
typ = typ->BaseTyp;
@ -740,7 +743,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;
int32 i;
BOOLEAN r;
__DUP(y, y__len, CHAR);
i = 0;
@ -753,11 +756,11 @@ 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, int32 vis)
{
INTEGER i;
int32 i;
OPT_ConstExt ext = NIL;
INTEGER _for__9;
int32 _for__9;
if (obj != NIL) {
OPC_CProcDefs(obj->left, vis);
if ((((obj->mode == 9 && obj->vis >= vis)) && obj->adr == 1)) {
@ -781,7 +784,7 @@ static void OPC_CProcDefs (OPT_Object obj, INTEGER vis)
}
}
void OPC_TypeDefs (OPT_Object obj, INTEGER vis)
void OPC_TypeDefs (OPT_Object obj, int32 vis)
{
if (obj != NIL) {
OPC_TypeDefs(obj->left, vis);
@ -813,7 +816,7 @@ static void OPC_DefAnonRecs (OPT_Node n)
void OPC_TDescDecl (OPT_Struct typ)
{
LONGINT nofptrs;
int64 nofptrs;
OPT_Object o = NIL;
OPC_BegStat();
OPM_WriteString((CHAR*)"__TDESC(", 9);
@ -828,7 +831,7 @@ void OPC_TDescDecl (OPT_Struct typ)
OPC_Str1((CHAR*)", #), {", 8, typ->size);
nofptrs = 0;
OPC_PutPtrOffsets(typ, 0, &nofptrs);
OPC_Str1((CHAR*)"#}}", 4, -((nofptrs + 1) * (SYSTEM_INT64)OPM_LIntSize));
OPC_Str1((CHAR*)"#}}", 4, -((nofptrs + 1) * (int64)OPM_LIntSize));
OPC_EndStat();
}
@ -850,7 +853,7 @@ void OPC_InitTDesc (OPT_Struct typ)
}
}
void OPC_Align (LONGINT *adr, LONGINT base)
void OPC_Align (int64 *adr, int64 base)
{
switch (base) {
case 2:
@ -870,11 +873,11 @@ void OPC_Align (LONGINT *adr, LONGINT base)
}
}
LONGINT OPC_SizeAlignment (LONGINT size)
int64 OPC_SizeAlignment (int64 size)
{
LONGINT _o_result;
LONGINT alignment;
if (size < (SYSTEM_INT64)OPM_Alignment) {
int64 _o_result;
int64 alignment;
if (size < (int64)OPM_Alignment) {
alignment = 1;
while (alignment < size) {
alignment = __ASHL(alignment, 1);
@ -886,10 +889,10 @@ LONGINT OPC_SizeAlignment (LONGINT size)
return _o_result;
}
LONGINT OPC_BaseAlignment (OPT_Struct typ)
int64 OPC_BaseAlignment (OPT_Struct typ)
{
LONGINT _o_result;
LONGINT alignment;
int64 _o_result;
int64 alignment;
if (typ->form == 13) {
if (typ->comp == 4) {
alignment = __MASK(typ->align, -65536);
@ -903,19 +906,19 @@ 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 (int64 gap, int64 off, int64 align, int64 *n, int64 *curAlign)
{
LONGINT adr;
int64 adr;
adr = off;
OPC_Align(&adr, align);
if ((*curAlign < align && gap - (adr - off) >= align)) {
gap -= (adr - off) + align;
OPC_BegStat();
if (align == (SYSTEM_INT64)OPM_IntSize) {
if (align == (int64)OPM_IntSize) {
OPM_WriteString((CHAR*)"INTEGER", 8);
} else if (align == (SYSTEM_INT64)OPM_LIntSize) {
} else if (align == (int64)OPM_LIntSize) {
OPM_WriteString((CHAR*)"LONGINT", 8);
} else if (align == (SYSTEM_INT64)OPM_LRealSize) {
} else if (align == (int64)OPM_LRealSize) {
OPM_WriteString((CHAR*)"LONGREAL", 9);
}
OPC_Str1((CHAR*)" _prvt#", 8, *n);
@ -932,11 +935,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, int64 *off, int64 *n, int64 *curAlign)
{
OPT_Object fld = NIL;
OPT_Struct base = NIL;
LONGINT gap, adr, align, fldAlign;
int64 gap, adr, align, fldAlign;
fld = typ->link;
align = __MASK(typ->align, -65536);
if (typ->BaseTyp != NIL) {
@ -980,7 +983,7 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, LONGINT *off, LONGINT *
}
}
if (last) {
adr = typ->size - (SYSTEM_INT64)__ASHR(typ->sysflag, 8);
adr = typ->size - (int64)__ASHR(typ->sysflag, 8);
if (adr == 0) {
gap = 1;
} else {
@ -992,11 +995,11 @@ 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, int32 vis)
{
OPT_Struct base = NIL;
BOOLEAN first;
INTEGER lastvis;
int32 lastvis;
base = NIL;
first = 1;
while ((obj != NIL && obj->mode != 13)) {
@ -1121,7 +1124,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);
@ -1151,7 +1154,7 @@ 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, int32 vis)
{
if (obj != NIL) {
OPC_IncludeImports(obj->left, vis);
@ -1162,7 +1165,7 @@ static void OPC_IncludeImports (OPT_Object obj, INTEGER vis)
}
}
static void OPC_GenDynTypes (OPT_Node n, INTEGER vis)
static void OPC_GenDynTypes (OPT_Node n, int32 vis)
{
OPT_Struct typ = NIL;
while ((n != NIL && n->class == 14)) {
@ -1210,7 +1213,7 @@ void OPC_GenHdr (OPT_Node n)
static void OPC_GenHeaderMsg (void)
{
INTEGER i;
int32 i;
OPM_WriteString((CHAR*)"/* ", 4);
OPM_WriteString((CHAR*)"voc", 4);
OPM_Write(' ');
@ -1361,7 +1364,7 @@ static void OPC_InitImports (OPT_Object obj)
void OPC_GenEnumPtrs (OPT_Object var)
{
OPT_Struct typ = NIL;
LONGINT n;
int64 n;
OPC_GlbPtrs = 0;
while (var != NIL) {
typ = var->typ;
@ -1522,7 +1525,7 @@ void OPC_EnterProc (OPT_Object proc)
{
OPT_Object var = NIL, scope = NIL;
OPT_Struct typ = NIL;
INTEGER dim;
int32 dim;
if (proc->vis != 1) {
OPM_WriteString((CHAR*)"static ", 8);
}
@ -1751,7 +1754,7 @@ void OPC_ExitProc (OPT_Object proc, BOOLEAN eoBlock, BOOLEAN implicitRet)
void OPC_CompleteIdent (OPT_Object obj)
{
INTEGER comp, level;
int32 comp, level;
level = obj->mnolev;
if (obj->adr == 1) {
if (obj->typ->comp == 4) {
@ -1780,7 +1783,7 @@ void OPC_CompleteIdent (OPT_Object obj)
void OPC_TypeOf (OPT_Object ap)
{
INTEGER i;
int32 i;
__ASSERT(ap->typ->comp == 4, 0);
if (ap->mode == 2) {
if (ap->mnolev != OPM_level) {
@ -1799,7 +1802,7 @@ void OPC_TypeOf (OPT_Object ap)
}
}
void OPC_Cmp (INTEGER rel)
void OPC_Cmp (int32 rel)
{
switch (rel) {
case 9:
@ -1828,7 +1831,7 @@ void OPC_Cmp (INTEGER rel)
}
}
static void OPC_CharacterLiteral (LONGINT c)
static void OPC_CharacterLiteral (int64 c)
{
if (c < 32 || c > 126) {
OPM_WriteString((CHAR*)"0x", 3);
@ -1843,10 +1846,10 @@ 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, int64 l)
{
LONGINT i;
INTEGER c;
int64 i;
int32 c;
__DUP(s, s__len, CHAR);
OPM_Write('"');
i = 0;
@ -1871,7 +1874,7 @@ static void OPC_StringLiteral (CHAR *s, LONGINT s__len, LONGINT l)
__DEL(s);
}
void OPC_Case (LONGINT caseVal, INTEGER form)
void OPC_Case (int64 caseVal, int32 form)
{
CHAR ch;
OPM_WriteString((CHAR*)"case ", 6);
@ -1909,30 +1912,17 @@ void OPC_Increment (BOOLEAN decrement)
}
}
void OPC_Halt (LONGINT n)
void OPC_Halt (int64 n)
{
OPC_Str1((CHAR*)"__HALT(#)", 10, n);
}
void OPC_IntLiteral (LONGINT n, LONGINT size)
void OPC_IntLiteral (int64 n, int64 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 {
@ -1940,7 +1930,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, int64 dim)
{
if (array->comp == 3) {
OPC_CompleteIdent(obj);
@ -1961,11 +1951,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, int32 form)
{
INTEGER i;
int32 i;
SET s;
LONGINT hex;
int64 hex;
BOOLEAN skipLeading;
switch (form) {
case 1:
@ -2024,7 +2014,7 @@ void OPC_Constant (OPT_Const con, INTEGER form)
}
static struct InitKeywords__48 {
SHORTINT *n;
int8 *n;
struct InitKeywords__48 *lnk;
} *InitKeywords__48_s;
@ -2032,18 +2022,18 @@ static void Enter__49 (CHAR *s, LONGINT s__len);
static void Enter__49 (CHAR *s, LONGINT s__len)
{
INTEGER h;
int32 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;
@ -2054,6 +2044,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);
@ -2075,16 +2066,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

@ -10,16 +10,16 @@
import void OPC_Align (LONGINT *adr, LONGINT base);
import void OPC_Align (int64 *adr, int64 base);
import void OPC_Andent (OPT_Struct typ);
import LONGINT OPC_BaseAlignment (OPT_Struct typ);
import int64 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 (int64 caseVal, int32 form);
import void OPC_Cmp (int32 rel);
import void OPC_CompleteIdent (OPT_Object obj);
import void OPC_Constant (OPT_Const con, INTEGER form);
import void OPC_Constant (OPT_Const con, int32 form);
import void OPC_DefineInter (OPT_Object proc);
import void OPC_EndBlk (void);
import void OPC_EndBlk0 (void);
@ -32,19 +32,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 (int64 n);
import void OPC_Ident (OPT_Object obj);
import void OPC_Increment (BOOLEAN decrement);
import void OPC_Indent (INTEGER count);
import void OPC_Indent (int32 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 (int64 n, int64 size);
import void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
import int64 OPC_NofPtrs (OPT_Struct typ);
import void OPC_SetInclude (BOOLEAN exclude);
import LONGINT OPC_SizeAlignment (LONGINT size);
import int64 OPC_SizeAlignment (int64 size);
import void OPC_TDescDecl (OPT_Struct typ);
import void OPC_TypeDefs (OPT_Object obj, INTEGER vis);
import void OPC_TypeDefs (OPT_Object obj, int32 vis);
import void OPC_TypeOf (OPT_Object ap);
import void *OPC__init(void);

View file

@ -15,23 +15,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 int32 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 int64 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 int64 OPM_curpos, OPM_errpos, OPM_breakpc;
export int32 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 int64 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 int32 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];
@ -41,54 +41,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 (int64 *fp, int64 val);
export void OPM_FPrintLReal (int64 *fp, LONGREAL lr);
export void OPM_FPrintReal (int64 *fp, REAL real);
export void OPM_FPrintSet (int64 *fp, SET set);
static void OPM_FindLine (Files_File f, Files_Rider *r, LONGINT *r__typ, int64 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, int32 *size, int32 *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 (int32 n);
export void OPM_LogW (CHAR ch);
export void OPM_LogWLn (void);
export void OPM_LogWNum (LONGINT i, LONGINT len);
export void OPM_LogWNum (int64 i, int64 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 (int32 n, int64 pos);
export void OPM_NewSym (CHAR *modName, LONGINT modName__len);
export void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done);
export void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len);
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 (int64 pos);
export int64 OPM_SignedMaximum (int64 bytecount);
export int64 OPM_SignedMinimum (int64 bytecount);
export void OPM_SymRCh (CHAR *ch);
export LONGINT OPM_SymRInt (void);
export int64 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 (int64 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 (int64 i);
export void OPM_WriteInt (int64 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 (int32 n);
static int64 OPM_minusop (int64 i);
static int64 OPM_power0 (int64 i, int64 j);
void OPM_LogW (CHAR ch)
@ -103,7 +103,7 @@ void OPM_LogWStr (CHAR *s, LONGINT s__len)
__DEL(s);
}
void OPM_LogWNum (LONGINT i, LONGINT len)
void OPM_LogWNum (int64 i, int64 len)
{
Console_Int(i, len);
}
@ -115,7 +115,7 @@ void OPM_LogWLn (void)
static void OPM_ScanOptions (CHAR *s, LONGINT s__len, SET *opt)
{
INTEGER i;
int32 i;
i = 1;
while (s[__X(i, s__len)] != 0x00) {
switch (s[__X(i, s__len)]) {
@ -300,7 +300,7 @@ void OPM_InitOptions (void)
void OPM_Init (BOOLEAN *done, CHAR *mname, LONGINT mname__len)
{
Texts_Text T = NIL;
LONGINT beg, end, time;
int64 beg, end, time;
CHAR s[256];
*done = 0;
OPM_curpos = 0;
@ -348,7 +348,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;
int32 i, j;
CHAR ch;
__DUP(ext, ext__len, CHAR);
i = 0;
@ -370,12 +370,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 (int32 n)
{
Texts_Scanner S;
Texts_Text T = NIL;
CHAR ch;
INTEGER i;
int32 i;
CHAR buf[1024];
if (n >= 0) {
if (!OPM_notColorOutput) {
@ -400,7 +400,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, int64 pos)
{
CHAR ch, cheol;
if (pos < OPM_ErrorLineStartPos) {
@ -432,12 +432,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 (int64 pos)
{
Files_File f = NIL;
Files_Rider r;
CHAR line[1023];
INTEGER i;
int32 i;
CHAR ch;
f = Files_Old(OPM_SourceFileName, 256);
OPM_FindLine(f, &r, Files_Rider__typ, pos);
@ -459,7 +459,7 @@ static void OPM_ShowLine (LONGINT pos)
if (pos >= OPM_ErrorLineLimitPos) {
pos = OPM_ErrorLineLimitPos - 1;
}
i = (SYSTEM_INT32)(pos - OPM_ErrorLineStartPos);
i = (int32)(pos - OPM_ErrorLineStartPos);
while (i > 0) {
OPM_LogW(' ');
i -= 1;
@ -474,7 +474,7 @@ static void OPM_ShowLine (LONGINT pos)
Files_Close(f);
}
void OPM_Mark (INTEGER n, LONGINT pos)
void OPM_Mark (int32 n, int64 pos)
{
if (pos == -1) {
pos = 0;
@ -526,49 +526,49 @@ void OPM_Mark (INTEGER n, LONGINT pos)
}
}
void OPM_err (INTEGER n)
void OPM_err (int32 n)
{
OPM_Mark(n, OPM_errpos);
}
void OPM_FPrint (LONGINT *fp, LONGINT val)
void OPM_FPrint (int64 *fp, int64 val)
{
*fp = __ROTL((LONGINT)((SET)*fp ^ (SET)val), 1, LONGINT);
*fp = __ROTL((int64)((SET)*fp ^ (SET)val), 1, int64);
}
void OPM_FPrintSet (LONGINT *fp, SET set)
void OPM_FPrintSet (int64 *fp, SET set)
{
OPM_FPrint(&*fp, (LONGINT)set);
OPM_FPrint(&*fp, (int64)set);
}
void OPM_FPrintReal (LONGINT *fp, REAL real)
void OPM_FPrintReal (int64 *fp, REAL real)
{
INTEGER i;
LONGINT l;
__GET((SYSTEM_ADRINT)&real, i, INTEGER);
int32 i;
int64 l;
__GET((SYSTEM_ADRINT)&real, i, int32);
l = i;
OPM_FPrint(&*fp, l);
}
void OPM_FPrintLReal (LONGINT *fp, LONGREAL lr)
void OPM_FPrintLReal (int64 *fp, LONGREAL lr)
{
LONGINT l, h;
OPM_FPrint(&*fp, __VAL(LONGINT, lr));
int64 l, h;
OPM_FPrint(&*fp, __VAL(int64, lr));
}
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, int32 *size, int32 *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_INT32)(*S).i;
*size = (int32)(*S).i;
Texts_Scan(&*S, S__typ);
} else {
OPM_Mark(-157, -1);
}
if ((*S).class == 3) {
*align = (SYSTEM_INT32)(*S).i;
*align = (int32)(*S).i;
Texts_Scan(&*S, S__typ);
} else {
OPM_Mark(-157, -1);
@ -579,17 +579,17 @@ static void OPM_GetProperty (Texts_Scanner *S, LONGINT *S__typ, CHAR *name, LONG
__DEL(name);
}
static LONGINT OPM_minusop (LONGINT i)
static int64 OPM_minusop (int64 i)
{
LONGINT _o_result;
int64 _o_result;
_o_result = -i;
return _o_result;
}
static LONGINT OPM_power0 (LONGINT i, LONGINT j)
static int64 OPM_power0 (int64 i, int64 j)
{
LONGINT _o_result;
LONGINT k, p;
int64 _o_result;
int64 k, p;
k = 1;
p = i;
do {
@ -641,19 +641,19 @@ static void OPM_VerboseListSizes (void)
OPM_LogWLn();
}
LONGINT OPM_SignedMaximum (LONGINT bytecount)
int64 OPM_SignedMaximum (int64 bytecount)
{
LONGINT _o_result;
LONGINT result;
int64 _o_result;
int64 result;
result = 1;
result = __LSH(result, __ASHL(bytecount, 3) - 1, LONGINT);
result = __LSH(result, __ASHL(bytecount, 3) - 1, int64);
_o_result = result - 1;
return _o_result;
}
LONGINT OPM_SignedMinimum (LONGINT bytecount)
int64 OPM_SignedMinimum (int64 bytecount)
{
LONGINT _o_result;
int64 _o_result;
_o_result = -OPM_SignedMaximum(bytecount) - 1;
return _o_result;
}
@ -687,10 +687,10 @@ void OPM_SymRCh (CHAR *ch)
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&*ch);
}
LONGINT OPM_SymRInt (void)
int64 OPM_SymRInt (void)
{
LONGINT _o_result;
LONGINT k;
int64 _o_result;
int64 k;
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, &k);
_o_result = k;
return _o_result;
@ -698,7 +698,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, (int64*)&*s);
}
void OPM_SymRReal (REAL *r)
@ -745,14 +745,14 @@ void OPM_SymWCh (CHAR ch)
Files_Write(&OPM_newSF, Files_Rider__typ, ch);
}
void OPM_SymWInt (LONGINT i)
void OPM_SymWInt (int64 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, (int64)s);
}
void OPM_SymWReal (REAL r)
@ -796,7 +796,7 @@ void OPM_Write (CHAR ch)
void OPM_WriteString (CHAR *s, LONGINT s__len)
{
INTEGER i;
int32 i;
i = 0;
while (s[__X(i, s__len)] != 0x00) {
i += 1;
@ -806,7 +806,7 @@ void OPM_WriteString (CHAR *s, LONGINT s__len)
void OPM_WriteStringVar (CHAR *s, LONGINT s__len)
{
INTEGER i;
int32 i;
i = 0;
while (s[__X(i, s__len)] != 0x00) {
i += 1;
@ -814,17 +814,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 (int64 i)
{
CHAR s[3];
INTEGER digit;
digit = __ASHR((SYSTEM_INT32)i, 4);
int32 digit;
digit = __ASHR((int32)i, 4);
if (digit < 10) {
s[0] = (CHAR)(48 + digit);
} else {
s[0] = (CHAR)(87 + digit);
}
digit = __MASK((SYSTEM_INT32)i, -16);
digit = __MASK((int32)i, -16);
if (digit < 10) {
s[1] = (CHAR)(48 + digit);
} else {
@ -834,10 +834,10 @@ void OPM_WriteHex (LONGINT i)
OPM_WriteString(s, 3);
}
void OPM_WriteInt (LONGINT i)
void OPM_WriteInt (int64 i)
{
CHAR s[20];
LONGINT i1, k;
int64 i1, k;
if (i == OPM_SignedMinimum(OPM_IntSize) || i == OPM_SignedMinimum(OPM_LIntSize)) {
OPM_Write('(');
OPM_WriteInt(i + 1);
@ -870,7 +870,7 @@ void OPM_WriteReal (LONGREAL r, CHAR suffx)
Texts_Reader R;
CHAR s[32];
CHAR ch;
INTEGER i;
int32 i;
if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == (__ENTIER(r)))) {
if (suffx == 'f') {
OPM_WriteString((CHAR*)"(REAL)", 7);
@ -958,7 +958,7 @@ void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len)
void OPM_CloseFiles (void)
{
CHAR FName[32];
INTEGER res;
int32 res;
if (OPM_noerr) {
OPM_LogWStr((CHAR*)" ", 3);
OPM_LogWNum(Files_Pos(&OPM_R[1], Files_Rider__typ), 0);

View file

@ -7,12 +7,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 int32 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 int64 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 int64 OPM_curpos, OPM_errpos, OPM_breakpc;
import int32 OPM_currFile, OPM_level, OPM_pc, OPM_entno;
import CHAR OPM_modName[32];
import CHAR OPM_objname[64];
import SET OPM_opt, OPM_glbopt;
@ -22,44 +22,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 (int64 *fp, int64 val);
import void OPM_FPrintLReal (int64 *fp, LONGREAL lr);
import void OPM_FPrintReal (int64 *fp, REAL real);
import void OPM_FPrintSet (int64 *fp, SET set);
import void OPM_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 (int64 i, int64 len);
import void OPM_LogWStr (CHAR *s, LONGINT s__len);
import void OPM_Mark (INTEGER n, LONGINT pos);
import void OPM_Mark (int32 n, int64 pos);
import void OPM_NewSym (CHAR *modName, LONGINT modName__len);
import void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done);
import void OPM_OpenFiles (CHAR *moduleName, LONGINT moduleName__len);
import BOOLEAN OPM_OpenPar (void);
import void OPM_RegisterNewSym (void);
import LONGINT OPM_SignedMaximum (LONGINT bytecount);
import LONGINT OPM_SignedMinimum (LONGINT bytecount);
import int64 OPM_SignedMaximum (int64 bytecount);
import int64 OPM_SignedMinimum (int64 bytecount);
import void OPM_SymRCh (CHAR *ch);
import LONGINT OPM_SymRInt (void);
import int64 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 (int64 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 (int64 i);
import void OPM_WriteInt (int64 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 (int32 n);
import void *OPM__init(void);

View file

@ -7,17 +7,17 @@
#include "OPT.h"
struct OPP__1 {
LONGINT low, high;
int64 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 int32 OPP_LoopLevel;
static OPT_Node OPP_TDinit, OPP_lastTDinit;
static INTEGER OPP_nofFwdPtr;
static int32 OPP_nofFwdPtr;
static OPT_Struct OPP_FwdPtr[64];
export LONGINT *OPP__1__typ;
@ -25,10 +25,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, int32 *n, OPP_CaseTable tab);
static void OPP_CheckMark (int8 *vis);
static void OPP_CheckSym (int32 s);
static void OPP_CheckSysFlag (int32 *sysflag, int32 default_);
static void OPP_ConstExpression (OPT_Node *x);
static void OPP_Element (OPT_Node *x);
static void OPP_Expression (OPT_Node *x);
@ -38,7 +38,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);
@ -47,17 +47,17 @@ 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 (int32 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 (int32 n)
{
OPM_err(n);
}
static void OPP_CheckSym (INTEGER s)
static void OPP_CheckSym (int32 s)
{
if (OPP_sym == s) {
OPS_Get(&OPP_sym);
@ -69,7 +69,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)) {
@ -109,7 +109,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) {
@ -127,10 +127,10 @@ static void OPP_CheckMark (SHORTINT *vis)
}
}
static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_)
static void OPP_CheckSysFlag (int32 *sysflag, int32 default_)
{
OPT_Node x = NIL;
LONGINT sf;
int64 sf;
if (OPP_sym == 31) {
OPS_Get(&OPP_sym);
if (!OPT_SYSimported) {
@ -147,7 +147,7 @@ static void OPP_CheckSysFlag (INTEGER *sysflag, INTEGER default_)
OPP_err(51);
sf = 0;
}
*sysflag = (SYSTEM_INT32)sf;
*sysflag = (int32)sf;
OPP_CheckSym(23);
} else {
*sysflag = default_;
@ -158,7 +158,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;
int32 sysflag;
*typ = OPT_NewStr(13, 4);
(*typ)->BaseTyp = NIL;
OPP_CheckSysFlag(&sysflag, -1);
@ -250,8 +250,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;
int64 n;
int32 sysflag;
OPP_CheckSysFlag(&sysflag, 0);
if (OPP_sym == 25) {
*typ = OPT_NewStr(13, 3);
@ -343,7 +343,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;
@ -624,9 +624,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_INT32)(*x)->obj->adr);
int8 m;
int32 n;
m = (int8)((int32)(*x)->obj->adr);
n = 0;
if (OPP_sym == 30) {
OPS_Get(&OPP_sym);
@ -785,7 +785,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;
@ -798,7 +798,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);
@ -822,7 +822,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;
@ -848,7 +848,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;
@ -914,7 +914,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;
@ -927,8 +927,8 @@ static void TProcDecl__23 (void);
static void GetCode__19 (void)
{
OPT_ConstExt ext = NIL;
INTEGER n;
LONGINT c;
int32 n;
int64 c;
ext = OPT_NewExt();
(*ProcedureDeclaration__16_s->proc)->conval->ext = ext;
n = 0;
@ -992,7 +992,7 @@ static void GetParams__21 (void)
static void Body__17 (void)
{
OPT_Node procdec = NIL, statseq = NIL;
LONGINT c;
int64 c;
c = OPM_errpos;
(*ProcedureDeclaration__16_s->proc)->conval->setval |= __SETOF(1);
OPP_CheckSym(39);
@ -1015,7 +1015,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;
@ -1087,7 +1087,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;
@ -1164,11 +1164,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, int32 *n, OPP_CaseTable tab)
{
OPT_Node x = NIL, y = NIL, lastlab = NIL;
INTEGER i, f;
LONGINT xval, yval;
int32 i, f;
int64 xval, yval;
*lab = NIL;
lastlab = NIL;
for (;;) {
@ -1235,7 +1235,7 @@ static void OPP_CaseLabelList (OPT_Node *lab, OPT_Struct LabelTyp, INTEGER *n, O
}
static struct StatSeq__30 {
LONGINT *pos;
int64 *pos;
struct StatSeq__30 *lnk;
} *StatSeq__30_s;
@ -1245,8 +1245,8 @@ static void SetPos__35 (OPT_Node x);
static void CasePart__31 (OPT_Node *x)
{
INTEGER n;
LONGINT low, high;
int32 n;
int64 low, high;
BOOLEAN e;
OPP_CaseTable tab;
OPT_Node cases = NIL, lab = NIL, y = NIL, lastcase = NIL;
@ -1329,7 +1329,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;
int64 pos;
OPS_Name name;
struct StatSeq__30 _s;
_s.pos = &pos;
@ -1622,7 +1622,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;
int32 i;
first = NIL;
last = NIL;
OPP_nofFwdPtr = 0;
@ -1775,7 +1775,7 @@ void OPP_Module (OPT_Node *prog, SET opt)
{
OPS_Name impName, aliasName;
OPT_Node procdec = NIL, statseq = NIL;
LONGINT c;
int64 c;
BOOLEAN done;
OPS_Init();
OPP_LoopLevel = 0;

View file

@ -12,29 +12,29 @@ typedef
export OPS_Name OPS_name;
export OPS_String OPS_str;
export INTEGER OPS_numtyp;
export LONGINT OPS_intval;
export int32 OPS_numtyp;
export int64 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 (int32 n);
static void OPS_err (INTEGER n)
static void OPS_err (int32 n)
{
OPM_err(n);
}
static void OPS_Str (SHORTINT *sym)
static void OPS_Str (int8 *sym)
{
INTEGER i;
int32 i;
CHAR och;
i = 0;
och = OPS_ch;
@ -66,9 +66,9 @@ static void OPS_Str (SHORTINT *sym)
}
}
static void OPS_Identifier (SHORTINT *sym)
static void OPS_Identifier (int8 *sym)
{
INTEGER i;
int32 i;
i = 0;
do {
OPS_name[i] = OPS_ch;
@ -87,10 +87,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 int32 Ord__7 (CHAR ch, BOOLEAN hex);
static LONGREAL Ten__9 (int32 e);
static LONGREAL Ten__9 (INTEGER e)
static LONGREAL Ten__9 (int32 e)
{
LONGREAL _o_result;
LONGREAL x, p;
@ -109,9 +109,9 @@ static LONGREAL Ten__9 (INTEGER e)
return _o_result;
}
static INTEGER Ord__7 (CHAR ch, BOOLEAN hex)
static int32 Ord__7 (CHAR ch, BOOLEAN hex)
{
INTEGER _o_result;
int32 _o_result;
if (ch <= '9') {
_o_result = ch - 48;
return _o_result;
@ -128,7 +128,7 @@ static INTEGER Ord__7 (CHAR ch, BOOLEAN hex)
static void OPS_Number (void)
{
INTEGER i, m, n, d, e, maxHdig;
int32 i, m, n, d, e, maxHdig;
CHAR dig[24];
LONGREAL f;
CHAR expCh;
@ -174,7 +174,7 @@ static void OPS_Number (void)
OPS_numtyp = 1;
if (n <= 2) {
while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (SYSTEM_INT64)Ord__7(dig[i], 1);
OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
i += 1;
}
} else {
@ -189,7 +189,7 @@ static void OPS_Number (void)
OPS_intval = -1;
}
while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (SYSTEM_INT64)Ord__7(dig[i], 1);
OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
i += 1;
}
} else {
@ -200,8 +200,8 @@ static void OPS_Number (void)
while (i < n) {
d = Ord__7(dig[i], 0);
i += 1;
if (OPS_intval <= __DIV(9223372036854775807 - (SYSTEM_INT64)d, 10)) {
OPS_intval = OPS_intval * 10 + (SYSTEM_INT64)d;
if (OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) {
OPS_intval = OPS_intval * 10 + (int64)d;
} else {
OPS_err(203);
}
@ -310,9 +310,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

@ -15,13 +15,13 @@ typedef
import OPS_Name OPS_name;
import OPS_String OPS_str;
import INTEGER OPS_numtyp;
import LONGINT OPS_intval;
import int32 OPS_numtyp;
import int64 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

@ -13,17 +13,17 @@ typedef
typedef
struct OPT_ConstDesc {
OPT_ConstExt ext;
LONGINT intval, intval2;
int64 intval, intval2;
SET setval;
LONGREAL realval;
} OPT_ConstDesc;
typedef
struct OPT_ExpCtxt {
LONGINT reffp;
INTEGER ref;
SHORTINT nofm;
SHORTINT locmno[64];
int64 reffp;
int32 ref;
int8 nofm;
int8 locmno[64];
} OPT_ExpCtxt;
typedef
@ -34,13 +34,13 @@ typedef
typedef
struct OPT_ImpCtxt {
LONGINT nextTag, reffp;
INTEGER nofr, minr, nofm;
int64 nextTag, reffp;
int32 nofr, minr, nofm;
BOOLEAN self;
OPT_Struct ref[255];
OPT_Object old[255];
LONGINT pvfp[255];
SHORTINT glbmno[64];
int64 pvfp[255];
int8 glbmno[64];
} OPT_ImpCtxt;
typedef
@ -49,7 +49,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;
@ -61,22 +61,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;
int64 fprint;
OPT_Struct typ;
OPT_Const conval;
LONGINT adr, linkadr;
INTEGER x;
int64 adr, linkadr;
int32 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;
int32 ref, sysflag;
int64 n, size, align, txtpos;
BOOLEAN allocated, pbused, pvused, fpdone, idfpdone;
LONGINT idfp, pbfp, pvfp;
int64 idfp, pbfp, pvfp;
OPT_Struct BaseTyp;
OPT_Object link, strobj;
} OPT_StrDesc;
@ -85,7 +85,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;
@ -93,7 +93,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 int64 OPT_nofhdfld;
static BOOLEAN OPT_newsf, OPT_findpc, OPT_extsf, OPT_sfpresent, OPT_symExtended, OPT_symNew;
export LONGINT *OPT_ConstDesc__typ;
@ -106,62 +106,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, int64 value);
static void OPT_EnterProc (OPS_Name name, int32 num);
static void OPT_EnterTyp (OPS_Name name, int8 form, int32 size, OPT_Struct *res);
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, int32 errcode);
static void OPT_FPrintName (int64 *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 (int64 *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 (int64 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 (int64 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 (int64 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, int64 adr, BOOLEAN visible);
static void OPT_OutHdFld (OPT_Struct typ, OPT_Object fld, int64 adr);
static void OPT_OutMod (int32 mno);
static void OPT_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, int32 dir);
static void OPT_err (int32 n);
static void OPT_err (INTEGER n)
static void OPT_err (int32 n)
{
OPM_err(n);
}
OPT_Struct OPT_IntType (LONGINT size)
OPT_Struct OPT_IntType (int64 size)
{
OPT_Struct _o_result;
INTEGER i;
int32 i;
i = 1;
while ((OPT_IntTypes[__X(i, 20)]->size < size && OPT_IntTypes[__X(i + 1, 20)] != NIL)) {
i += 1;
@ -170,10 +170,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, int32 dir)
{
OPT_Struct _o_result;
INTEGER i;
int32 i;
__ASSERT(x->form == 4, 0);
__ASSERT(dir == 1 || dir == -1, 0);
__ASSERT(x->BaseTyp == OPT_undftyp, 0);
@ -204,7 +204,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;
@ -221,7 +221,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;
@ -235,12 +235,12 @@ OPT_ConstExt OPT_NewExt (void)
{
OPT_ConstExt _o_result;
OPT_ConstExt ext = NIL;
ext = __NEWARR(NIL, 1, 1, 1, 0, ((SYSTEM_INT64)(256)));
ext = __NEWARR(NIL, 1, 1, 1, 0, ((int64)(256)));
_o_result = ext;
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();
@ -278,7 +278,7 @@ void OPT_Init (OPS_Name name, SET opt)
void OPT_Close (void)
{
INTEGER i;
int32 i;
OPT_CloseScope();
i = 0;
while (i < 64) {
@ -370,7 +370,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;
@ -408,9 +408,9 @@ 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 (int64 *fp, CHAR *name, LONGINT name__len)
{
INTEGER i;
int32 i;
CHAR ch;
i = 0;
do {
@ -453,7 +453,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 (int64 *fp, OPT_Struct result, OPT_Object par)
{
OPT_IdFPrint(result);
OPM_FPrint(&*fp, result->idfp);
@ -469,8 +469,8 @@ void OPT_IdFPrint (OPT_Struct typ)
{
OPT_Struct btyp = NIL;
OPT_Object strobj = NIL;
LONGINT idfp;
INTEGER f, c;
int64 idfp;
int32 f, c;
if (!typ->idfpdone) {
typ->idfpdone = 1;
idfp = 0;
@ -499,17 +499,17 @@ void OPT_IdFPrint (OPT_Struct typ)
}
static struct FPrintStr__12 {
LONGINT *pbfp, *pvfp;
int64 *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, int64 adr, BOOLEAN visible);
static void FPrintHdFld__15 (OPT_Struct typ, OPT_Object fld, int64 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, int64 adr)
{
LONGINT i, j, n;
int64 i, j, n;
OPT_Struct btyp = NIL;
if (typ->comp == 4) {
FPrintFlds__13(typ->link, adr, 0);
@ -539,7 +539,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, int64 adr, BOOLEAN visible)
{
while ((fld != NIL && fld->mode == 4)) {
if ((fld->vis != 0 && visible)) {
@ -574,10 +574,10 @@ static void FPrintTProcs__17 (OPT_Object obj)
void OPT_FPrintStr (OPT_Struct typ)
{
INTEGER f, c;
int32 f, c;
OPT_Struct btyp = NIL;
OPT_Object strobj = NIL, bstrobj = NIL;
LONGINT pbfp, pvfp;
int64 pbfp, pvfp;
struct FPrintStr__12 _s;
_s.pbfp = &pbfp;
_s.pvfp = &pvfp;
@ -638,8 +638,8 @@ void OPT_FPrintStr (OPT_Struct typ)
void OPT_FPrintObj (OPT_Object obj)
{
LONGINT fprint;
INTEGER f, m;
int64 fprint;
int32 f, m;
REAL rval;
OPT_ConstExt ext = NIL;
if (!obj->fpdone) {
@ -696,9 +696,9 @@ void OPT_FPrintObj (OPT_Object obj)
}
}
void OPT_FPrintErr (OPT_Object obj, INTEGER errcode)
void OPT_FPrintErr (OPT_Object obj, int32 errcode)
{
INTEGER i, j;
int32 i, j;
CHAR ch;
if (obj->mnolev != 0) {
__COPY(OPT_GlbMod[__X(-obj->mnolev, 64)]->name, OPM_objname, 64);
@ -788,7 +788,7 @@ void OPT_InsertImport (OPT_Object obj, OPT_Object *root, OPT_Object *old)
static void OPT_InName (CHAR *name, LONGINT name__len)
{
INTEGER i;
int32 i;
CHAR ch;
i = 0;
do {
@ -798,12 +798,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;
int64 mn;
int8 i;
mn = OPM_SymRInt();
if (mn == 0) {
*mno = OPT_impCtxt.glbmno[0];
@ -840,10 +840,10 @@ static void OPT_InMod (SHORTINT *mno)
}
}
static void OPT_InConstant (LONGINT f, OPT_Const conval)
static void OPT_InConstant (int64 f, OPT_Const conval)
{
CHAR ch;
INTEGER i;
int32 i;
OPT_ConstExt ext = NIL;
REAL rval;
switch (f) {
@ -889,10 +889,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;
int64 tag;
OPT_InStruct(&*res);
tag = OPM_SymRInt();
last = NIL;
@ -920,7 +920,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;
int64 tag;
OPT_Object obj = NIL;
tag = OPT_impCtxt.nextTag;
obj = OPT_NewObj();
@ -949,10 +949,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;
int64 tag;
OPT_Object obj = NIL;
tag = OPT_impCtxt.nextTag;
obj = OPT_NewObj();
@ -977,7 +977,7 @@ static OPT_Object OPT_InTProc (SHORTINT mno)
return _o_result;
}
static OPT_Struct OPT_InTyp (LONGINT tag)
static OPT_Struct OPT_InTyp (int64 tag)
{
OPT_Struct _o_result;
if (tag == 4) {
@ -992,9 +992,9 @@ static OPT_Struct OPT_InTyp (LONGINT tag)
static void OPT_InStruct (OPT_Struct *typ)
{
SHORTINT mno;
INTEGER ref;
LONGINT tag;
int8 mno;
int32 ref;
int64 tag;
OPS_Name name;
OPT_Struct t = NIL;
OPT_Object obj = NIL, last = NIL, fld = NIL, old = NIL, dummy = NIL;
@ -1050,7 +1050,7 @@ static void OPT_InStruct (OPT_Struct *typ)
obj->vis = 0;
tag = OPM_SymRInt();
if (tag == 35) {
(*typ)->sysflag = (SYSTEM_INT32)OPM_SymRInt();
(*typ)->sysflag = (int32)OPM_SymRInt();
tag = OPM_SymRInt();
}
switch (tag) {
@ -1172,14 +1172,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;
int32 i, s;
CHAR ch;
OPT_Object obj = NIL, old = NIL;
OPT_Struct typ = NIL;
LONGINT tag;
int64 tag;
OPT_ConstExt ext = NIL;
tag = OPT_impCtxt.nextTag;
if (tag == 19) {
@ -1212,7 +1212,7 @@ static OPT_Object OPT_InObj (SHORTINT mno)
obj->mode = 9;
ext = OPT_NewExt();
obj->conval->ext = ext;
s = (SYSTEM_INT32)OPM_SymRInt();
s = (int32)OPM_SymRInt();
(*ext)[0] = (CHAR)s;
i = 1;
while (i <= s) {
@ -1278,7 +1278,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) {
@ -1321,7 +1321,7 @@ void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done)
static void OPT_OutName (CHAR *name, LONGINT name__len)
{
INTEGER i;
int32 i;
CHAR ch;
i = 0;
do {
@ -1331,7 +1331,7 @@ static void OPT_OutName (CHAR *name, LONGINT name__len)
} while (!(ch == 0x00));
}
static void OPT_OutMod (INTEGER mno)
static void OPT_OutMod (int32 mno)
{
if (OPT_expCtxt.locmno[__X(mno, 64)] < 0) {
OPM_SymWInt(16);
@ -1343,9 +1343,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, int64 adr)
{
LONGINT i, j, n;
int64 i, j, n;
OPT_Struct btyp = NIL;
if (typ->comp == 4) {
OPT_OutFlds(typ->link, adr, 0);
@ -1375,7 +1375,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, int64 adr, BOOLEAN visible)
{
while ((fld != NIL && fld->mode == 4)) {
if ((fld->vis != 0 && visible)) {
@ -1530,7 +1530,7 @@ static void OPT_OutStr (OPT_Struct typ)
static void OPT_OutConstant (OPT_Object obj)
{
INTEGER f;
int32 f;
REAL rval;
f = obj->typ->form;
OPM_SymWInt(f);
@ -1565,7 +1565,7 @@ static void OPT_OutConstant (OPT_Object obj)
static void OPT_OutObj (OPT_Object obj)
{
INTEGER i, j;
int32 i, j;
OPT_ConstExt ext = NIL;
if (obj != NIL) {
OPT_OutObj(obj->left);
@ -1655,8 +1655,8 @@ static void OPT_OutObj (OPT_Object obj)
void OPT_Export (BOOLEAN *ext, BOOLEAN *new)
{
INTEGER i;
SHORTINT nofmod;
int32 i;
int8 nofmod;
BOOLEAN done;
OPT_symExtended = 0;
OPT_symNew = 0;
@ -1698,7 +1698,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;
@ -1712,7 +1712,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, int64 value)
{
OPT_Object obj = NIL;
OPS_Name name__copy;
@ -1724,7 +1724,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, int32 size, OPT_Struct *res)
{
OPT_Object obj = NIL;
OPT_Struct typ = NIL;
@ -1747,7 +1747,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, int32 num)
{
OPT_Object obj = NIL;
OPS_Name name__copy;

View file

@ -16,7 +16,7 @@ typedef
typedef
struct OPT_ConstDesc {
OPT_ConstExt ext;
LONGINT intval, intval2;
int64 intval, intval2;
SET setval;
LONGREAL realval;
} OPT_ConstDesc;
@ -33,7 +33,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;
@ -45,20 +45,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;
int64 fprint;
OPT_Struct typ;
OPT_Const conval;
LONGINT adr, linkadr;
INTEGER x;
int64 adr, linkadr;
int32 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;
int32 ref, sysflag;
int64 n, size, align, txtpos;
BOOLEAN allocated, pbused, pvused;
char _prvt0[24];
OPT_Struct BaseTyp;
@ -69,7 +69,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;
@ -82,7 +82,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, int32 errcode);
import void OPT_FPrintObj (OPT_Object obj);
import void OPT_FPrintStr (OPT_Struct typ);
import void OPT_Find (OPT_Object *res);
@ -93,14 +93,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 (int64 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, int32 dir);
import void *OPT__init(void);

View file

@ -8,15 +8,15 @@
typedef
struct OPV_ExitInfo {
INTEGER level, label;
int32 level, label;
} OPV_ExitInfo;
static BOOLEAN OPV_assert, OPV_inxchk, OPV_mainprog, OPV_ansi;
static INTEGER OPV_stamp;
static LONGINT OPV_recno;
static int32 OPV_stamp;
static int64 OPV_recno;
static OPV_ExitInfo OPV_exit;
static INTEGER OPV_nofExitLabels;
static int32 OPV_nofExitLabels;
static BOOLEAN OPV_naturalAlignment;
export LONGINT *OPV_ExitInfo__typ;
@ -24,38 +24,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, int32 prec);
static void OPV_DefineTDescs (OPT_Node n);
static void OPV_Entier (OPT_Node n, INTEGER prec);
static void OPV_Entier (OPT_Node n, int32 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, int32 prec, int32 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, int64 dim);
export void OPV_Module (OPT_Node prog);
static LONGINT OPV_NaturalAlignment (LONGINT size, LONGINT max);
static int64 OPV_NaturalAlignment (int64 size, int64 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 (int64 n, int64 size);
static int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp);
static BOOLEAN OPV_SideEffects (OPT_Node n);
static void OPV_SizeCast (LONGINT from, LONGINT to);
static void OPV_SizeCast (int64 from, int64 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, int32 prec);
static void OPV_expr (OPT_Node n, int32 prec);
static void OPV_stat (OPT_Node n, OPT_Object outerProc);
static LONGINT OPV_NaturalAlignment (LONGINT size, LONGINT max)
static int64 OPV_NaturalAlignment (int64 size, int64 max)
{
LONGINT _o_result;
LONGINT i;
int64 _o_result;
int64 i;
if (size >= max) {
_o_result = max;
return _o_result;
@ -72,8 +72,8 @@ static LONGINT OPV_NaturalAlignment (LONGINT size, LONGINT max)
void OPV_TypSize (OPT_Struct typ)
{
INTEGER f, c;
LONGINT offset, size, base, fbase, off0;
int32 f, c;
int64 offset, size, base, fbase, off0;
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
if (typ == OPT_undftyp) {
@ -88,7 +88,7 @@ void OPV_TypSize (OPT_Struct typ)
base = OPC_SizeAlignment(OPM_RecSize);
} else {
OPV_TypSize(btyp);
offset = btyp->size - (SYSTEM_INT64)__ASHR(btyp->sysflag, 8);
offset = btyp->size - (int64)__ASHR(btyp->sysflag, 8);
base = btyp->align;
}
fld = typ->link;
@ -119,7 +119,7 @@ void OPV_TypSize (OPT_Struct typ)
}
typ->size = offset;
typ->align = base;
typ->sysflag = __MASK(typ->sysflag, -256) + (SYSTEM_INT32)__ASHL(offset - off0, 8);
typ->sysflag = __MASK(typ->sysflag, -256) + (int32)__ASHL(offset - off0, 8);
} else if (c == 2) {
OPV_TypSize(typ->BaseTyp);
typ->size = typ->n * typ->BaseTyp->size;
@ -157,7 +157,7 @@ void OPV_Init (void)
static void OPV_GetTProcNum (OPT_Object obj)
{
LONGINT oldPos;
int64 oldPos;
OPT_Struct typ = NIL;
OPT_Object redef = NIL;
oldPos = OPM_errpos;
@ -193,7 +193,7 @@ static void OPV_TraverseRecord (OPT_Struct typ)
static void OPV_Stamp (OPS_Name s)
{
INTEGER i, j, k;
int32 i, j, k;
CHAR n[10];
OPV_stamp += 1;
i = 0;
@ -223,7 +223,7 @@ static void OPV_Stamp (OPS_Name s)
static void OPV_Traverse (OPT_Object obj, OPT_Object outerScope, BOOLEAN exported)
{
INTEGER mode;
int32 mode;
OPT_Object scope = NIL;
OPT_Struct typ = NIL;
if (obj != NIL) {
@ -298,9 +298,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 int32 OPV_Precedence (int32 class, int32 subclass, int32 form, int32 comp)
{
INTEGER _o_result;
int32 _o_result;
switch (class) {
case 7: case 0: case 2: case 4: case 9:
case 13:
@ -433,7 +433,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, int64 dim)
{
while ((n->class == 4 && n->typ->comp == 3)) {
dim += 1;
@ -462,7 +462,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, int32 prec)
{
if (__IN(n->typ->form, 0x60)) {
OPM_WriteString((CHAR*)"__ENTIER(", 10);
@ -473,34 +473,18 @@ static void OPV_Entier (OPT_Node n, INTEGER prec)
}
}
static void OPV_SizeCast (LONGINT from, LONGINT to)
static void OPV_SizeCast (int64 from, int64 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, int32 prec)
{
INTEGER from, to;
int32 from, to;
from = n->typ->form;
to = newtype->form;
if (to == 7) {
@ -562,7 +546,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, int32 prec, int32 dim)
{
if (!OPV_inxchk || (n->right->class == 7 && (n->right->conval->intval == 0 || n->left->typ->comp != 3))) {
OPV_expr(n->right, prec);
@ -579,13 +563,13 @@ 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, int32 prec)
{
OPT_Object obj = NIL;
OPT_Struct typ = NIL;
INTEGER class, designPrec, comp;
int32 class, designPrec, comp;
OPT_Node d = NIL, x = NIL;
INTEGER dims, i, _for__28;
int32 dims, i, _for__28;
comp = n->typ->comp;
obj = n->obj;
class = n->class;
@ -669,7 +653,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
}
if (n->typ->comp == 3) {
OPM_Write(')');
while ((SYSTEM_INT64)i < __ASHR(d->typ->size - 4, 2)) {
while ((int64)i < __ASHR(d->typ->size - 4, 2)) {
OPM_WriteString((CHAR*)" * ", 4);
OPV_Len(d, i);
i += 1;
@ -758,7 +742,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
}
}
static void OPV_ParIntLiteral (LONGINT n, LONGINT size)
static void OPV_ParIntLiteral (int64 n, int64 size)
{
if (OPV_ansi) {
OPM_WriteInt(n);
@ -770,7 +754,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;
int32 comp, form, mode, prec, dim;
OPM_Write('(');
while (n != NIL) {
typ = fp->typ;
@ -869,9 +853,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, int32 prec)
{
INTEGER class, subclass, form, exprPrec;
int32 class, subclass, form, exprPrec;
OPT_Struct typ = NIL;
OPT_Node l = NIL, r = NIL;
OPT_Object proc = NIL;
@ -1187,7 +1171,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;
int64 adr;
if_ = n->left;
while (if_ != NIL) {
OPM_WriteString((CHAR*)"if ", 4);
@ -1237,8 +1221,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;
int64 low, high;
int32 form, i;
OPM_WriteString((CHAR*)"switch ", 8);
OPV_expr(n->left, 12);
OPM_Write(' ');
@ -1305,7 +1289,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;
int32 nofdim, nofdyn;
typ = d->typ->BaseTyp;
base = typ;
nofdim = 0;

View file

@ -9,90 +9,90 @@ typedef
Platform_ArgPtr (*Platform_ArgVec)[1024];
typedef
LONGINT (*Platform_ArgVecPtr)[1];
int64 (*Platform_ArgVecPtr)[1];
typedef
CHAR (*Platform_EnvPtr)[1024];
typedef
struct Platform_FileIdentity {
LONGINT volume, index, mtime;
int64 volume, index, mtime;
} Platform_FileIdentity;
typedef
void (*Platform_HaltProcedure)(LONGINT);
void (*Platform_HaltProcedure)(int64);
typedef
void (*Platform_SignalHandler)(INTEGER);
void (*Platform_SignalHandler)(int32);
export BOOLEAN Platform_LittleEndian;
export LONGINT Platform_MainStackFrame, Platform_HaltCode;
export INTEGER Platform_PID;
export int64 Platform_MainStackFrame, Platform_HaltCode;
export int32 Platform_PID;
export CHAR Platform_CWD[256];
export INTEGER Platform_ArgCount;
export LONGINT Platform_ArgVector;
export int32 Platform_ArgCount;
export int64 Platform_ArgVector;
static Platform_HaltProcedure Platform_HaltHandler;
static LONGINT Platform_TimeStart;
export INTEGER Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
static int64 Platform_TimeStart;
export int32 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
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 (int32 e);
export int32 Platform_ArgPos (CHAR *s, LONGINT s__len);
export void Platform_AssertFail (int64 code);
export int32 Platform_Chdir (CHAR *n, LONGINT n__len);
export int32 Platform_Close (int64 h);
export BOOLEAN Platform_ConnectionFailed (int32 e);
export void Platform_Delay (int64 ms);
export BOOLEAN Platform_DifferentFilesystems (int32 e);
static void Platform_DisplayHaltCode (int64 code);
export int32 Platform_Error (void);
export void Platform_Exit (int32 code);
export void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len);
export void Platform_GetClock (int64 *t, int64 *d);
export 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 (int32 n, int64 *val);
export void Platform_GetTimeOfDay (int64 *sec, int64 *usec);
export void Platform_Halt (int64 code);
export int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, LONGINT *identity__typ);
export int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ);
export BOOLEAN Platform_Inaccessible (int32 e);
export void Platform_Init (int32 argc, int64 argvadr);
export void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d);
export int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h);
export BOOLEAN Platform_NoSuchDirectory (int32 e);
export int64 Platform_OSAllocate (int64 size);
export void Platform_OSFree (int64 address);
export int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h);
export int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h);
export int32 Platform_Read (int64 h, int64 p, int64 l, int64 *n);
export int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n);
export int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len);
export 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 offset, INTEGER whence);
export int32 Platform_Seek (int64 h, int64 offset, int32 whence);
export void Platform_SetBadInstructionHandler (Platform_SignalHandler handler);
export void Platform_SetHalt (Platform_HaltProcedure p);
export void Platform_SetInterruptHandler (Platform_SignalHandler handler);
export void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Platform_FileIdentity source);
export void Platform_SetQuitHandler (Platform_SignalHandler handler);
export INTEGER Platform_Size (LONGINT h, LONGINT *l);
export INTEGER Platform_Sync (LONGINT h);
export INTEGER Platform_System (CHAR *cmd, LONGINT cmd__len);
export int32 Platform_Size (int64 h, int64 *l);
export int32 Platform_Sync (int64 h);
export int32 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 l);
export INTEGER Platform_Unlink (CHAR *n, LONGINT n__len);
export INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l);
static void Platform_YMDHMStoClock (LONGINT ye, LONGINT mo, LONGINT da, LONGINT ho, LONGINT mi, LONGINT se, LONGINT *t, LONGINT *d);
export int64 Platform_Time (void);
export BOOLEAN Platform_TimedOut (int32 e);
export BOOLEAN Platform_TooManyFiles (int32 e);
export int32 Platform_Truncate (int64 h, int64 l);
export int32 Platform_Unlink (CHAR *n, LONGINT n__len);
export int32 Platform_Write (int64 h, int64 p, int64 l);
static void Platform_YMDHMStoClock (int64 ye, int64 mo, int64 da, int64 ho, int64 mi, int64 se, int64 *t, int64 *d);
static void Platform_errch (CHAR c);
static void Platform_errint (LONGINT l);
static void Platform_errint (int64 l);
static void Platform_errln (void);
static void Platform_errposint (LONGINT l);
static void Platform_errposint (int64 l);
export BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len);
#include <errno.h>
@ -164,68 +164,68 @@ extern void Heap_InitHeap();
#define Platform_unlink(n, n__len) unlink((char*)n)
#define Platform_writefile(fd, p, l) write(fd, (void*)(SYSTEM_ADRINT)(p), l)
BOOLEAN Platform_TooManyFiles (INTEGER e)
BOOLEAN Platform_TooManyFiles (int32 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_EMFILE() || e == Platform_ENFILE();
return _o_result;
}
BOOLEAN Platform_NoSuchDirectory (INTEGER e)
BOOLEAN Platform_NoSuchDirectory (int32 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ENOENT();
return _o_result;
}
BOOLEAN Platform_DifferentFilesystems (INTEGER e)
BOOLEAN Platform_DifferentFilesystems (int32 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_EXDEV();
return _o_result;
}
BOOLEAN Platform_Inaccessible (INTEGER e)
BOOLEAN Platform_Inaccessible (int32 e)
{
BOOLEAN _o_result;
_o_result = (e == Platform_EACCES() || e == Platform_EROFS()) || e == Platform_EAGAIN();
return _o_result;
}
BOOLEAN Platform_Absent (INTEGER e)
BOOLEAN Platform_Absent (int32 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ENOENT();
return _o_result;
}
BOOLEAN Platform_TimedOut (INTEGER e)
BOOLEAN Platform_TimedOut (int32 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ETIMEDOUT();
return _o_result;
}
BOOLEAN Platform_ConnectionFailed (INTEGER e)
BOOLEAN Platform_ConnectionFailed (int32 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)
int64 Platform_OSAllocate (int64 size)
{
LONGINT _o_result;
int64 _o_result;
_o_result = Platform_allocate(size);
return _o_result;
}
void Platform_OSFree (LONGINT address)
void Platform_OSFree (int64 address)
{
Platform_free(address);
}
void Platform_Init (INTEGER argc, LONGINT argvadr)
void Platform_Init (int32 argc, int64 argvadr)
{
Platform_ArgVecPtr av = NIL;
Platform_MainStackFrame = argvadr;
@ -259,7 +259,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 (int32 n, CHAR *val, LONGINT val__len)
{
Platform_ArgVec av = NIL;
if (n < Platform_ArgCount) {
@ -268,10 +268,10 @@ void Platform_GetArg (INTEGER n, CHAR *val, LONGINT val__len)
}
}
void Platform_GetIntArg (INTEGER n, LONGINT *val)
void Platform_GetIntArg (int32 n, int64 *val)
{
CHAR s[64];
LONGINT k, d, i;
int64 k, d, i;
s[0] = 0x00;
Platform_GetArg(n, (void*)s, 64);
i = 0;
@ -294,10 +294,10 @@ void Platform_GetIntArg (INTEGER n, LONGINT *val)
}
}
INTEGER Platform_ArgPos (CHAR *s, LONGINT s__len)
int32 Platform_ArgPos (CHAR *s, LONGINT s__len)
{
INTEGER _o_result;
INTEGER i;
int32 _o_result;
int32 i;
CHAR arg[256];
__DUP(s, s__len, CHAR);
i = 0;
@ -326,64 +326,64 @@ void Platform_SetBadInstructionHandler (Platform_SignalHandler handler)
Platform_sethandler(4, handler);
}
static void Platform_YMDHMStoClock (LONGINT ye, LONGINT mo, LONGINT da, LONGINT ho, LONGINT mi, LONGINT se, LONGINT *t, LONGINT *d)
static void Platform_YMDHMStoClock (int64 ye, int64 mo, int64 da, int64 ho, int64 mi, int64 se, int64 *t, int64 *d)
{
*d = (__ASHL(__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 (int64 *t, int64 *d)
{
Platform_gettimeval();
Platform_sectotm(Platform_tvsec());
Platform_YMDHMStoClock(Platform_tmyear(), Platform_tmmon(), Platform_tmmday(), Platform_tmhour(), Platform_tmmin(), Platform_tmsec(), &*t, &*d);
}
void Platform_GetTimeOfDay (LONGINT *sec, LONGINT *usec)
void Platform_GetTimeOfDay (int64 *sec, int64 *usec)
{
Platform_gettimeval();
*sec = Platform_tvsec();
*usec = Platform_tvusec();
}
LONGINT Platform_Time (void)
int64 Platform_Time (void)
{
LONGINT _o_result;
LONGINT ms;
int64 _o_result;
int64 ms;
Platform_gettimeval();
ms = __DIVF(Platform_tvusec(), 1000) + Platform_tvsec() * 1000;
_o_result = __MOD(ms - Platform_TimeStart, 2147483647);
return _o_result;
}
void Platform_Delay (LONGINT ms)
void Platform_Delay (int64 ms)
{
LONGINT s, ns;
int64 s, ns;
s = __DIV(ms, 1000);
ns = __MOD(ms, 1000) * 1000000;
Platform_nanosleep(s, ns);
}
INTEGER Platform_System (CHAR *cmd, LONGINT cmd__len)
int32 Platform_System (CHAR *cmd, LONGINT cmd__len)
{
INTEGER _o_result;
int32 _o_result;
__DUP(cmd, cmd__len, CHAR);
_o_result = Platform_system(cmd, cmd__len);
__DEL(cmd);
return _o_result;
}
INTEGER Platform_Error (void)
int32 Platform_Error (void)
{
INTEGER _o_result;
int32 _o_result;
_o_result = Platform_err();
return _o_result;
}
INTEGER Platform_OldRO (CHAR *n, LONGINT n__len, LONGINT *h)
int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h)
{
INTEGER _o_result;
INTEGER fd;
int32 _o_result;
int32 fd;
fd = Platform_openro(n, n__len);
if (fd < 0) {
_o_result = Platform_err();
@ -396,10 +396,10 @@ INTEGER Platform_OldRO (CHAR *n, LONGINT n__len, LONGINT *h)
__RETCHK;
}
INTEGER Platform_OldRW (CHAR *n, LONGINT n__len, LONGINT *h)
int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h)
{
INTEGER _o_result;
INTEGER fd;
int32 _o_result;
int32 fd;
fd = Platform_openrw(n, n__len);
if (fd < 0) {
_o_result = Platform_err();
@ -412,10 +412,10 @@ INTEGER Platform_OldRW (CHAR *n, LONGINT n__len, LONGINT *h)
__RETCHK;
}
INTEGER Platform_New (CHAR *n, LONGINT n__len, LONGINT *h)
int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h)
{
INTEGER _o_result;
INTEGER fd;
int32 _o_result;
int32 fd;
fd = Platform_opennew(n, n__len);
if (fd < 0) {
_o_result = Platform_err();
@ -428,9 +428,9 @@ INTEGER Platform_New (CHAR *n, LONGINT n__len, LONGINT *h)
__RETCHK;
}
INTEGER Platform_Close (LONGINT h)
int32 Platform_Close (int64 h)
{
INTEGER _o_result;
int32 _o_result;
if (Platform_closefile(h) < 0) {
_o_result = Platform_err();
return _o_result;
@ -441,9 +441,9 @@ INTEGER Platform_Close (LONGINT h)
__RETCHK;
}
INTEGER Platform_Identify (LONGINT h, Platform_FileIdentity *identity, LONGINT *identity__typ)
int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, LONGINT *identity__typ)
{
INTEGER _o_result;
int32 _o_result;
Platform_structstats();
if (Platform_fstat(h) < 0) {
_o_result = Platform_err();
@ -456,9 +456,9 @@ 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)
int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ)
{
INTEGER _o_result;
int32 _o_result;
__DUP(n, n__len, CHAR);
Platform_structstats();
if (Platform_stat(n, n__len) < 0) {
@ -493,15 +493,15 @@ void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Pla
(*target).mtime = source.mtime;
}
void Platform_MTimeAsClock (Platform_FileIdentity i, LONGINT *t, LONGINT *d)
void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d)
{
Platform_sectotm(i.mtime);
Platform_YMDHMStoClock(Platform_tmyear(), Platform_tmmon(), Platform_tmmday(), Platform_tmhour(), Platform_tmmin(), Platform_tmsec(), &*t, &*d);
}
INTEGER Platform_Size (LONGINT h, LONGINT *l)
int32 Platform_Size (int64 h, int64 *l)
{
INTEGER _o_result;
int32 _o_result;
Platform_structstats();
if (Platform_fstat(h) < 0) {
_o_result = Platform_err();
@ -512,9 +512,9 @@ INTEGER Platform_Size (LONGINT h, LONGINT *l)
return _o_result;
}
INTEGER Platform_Read (LONGINT h, LONGINT p, LONGINT l, LONGINT *n)
int32 Platform_Read (int64 h, int64 p, int64 l, int64 *n)
{
INTEGER _o_result;
int32 _o_result;
*n = Platform_readfile(h, p, l);
if (*n < 0) {
*n = 0;
@ -527,9 +527,9 @@ 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)
int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n)
{
INTEGER _o_result;
int32 _o_result;
*n = Platform_readfile(h, (SYSTEM_ADRINT)b, b__len);
if (*n < 0) {
*n = 0;
@ -542,10 +542,10 @@ INTEGER Platform_ReadBuf (LONGINT h, SYSTEM_BYTE *b, LONGINT b__len, LONGINT *n)
__RETCHK;
}
INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l)
int32 Platform_Write (int64 h, int64 p, int64 l)
{
INTEGER _o_result;
LONGINT written;
int32 _o_result;
int64 written;
written = Platform_writefile(h, p, l);
if (written < 0) {
_o_result = Platform_err();
@ -557,9 +557,9 @@ INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l)
__RETCHK;
}
INTEGER Platform_Sync (LONGINT h)
int32 Platform_Sync (int64 h)
{
INTEGER _o_result;
int32 _o_result;
if (Platform_fsync(h) < 0) {
_o_result = Platform_err();
return _o_result;
@ -570,9 +570,9 @@ INTEGER Platform_Sync (LONGINT h)
__RETCHK;
}
INTEGER Platform_Seek (LONGINT h, LONGINT offset, INTEGER whence)
int32 Platform_Seek (int64 h, int64 offset, int32 whence)
{
INTEGER _o_result;
int32 _o_result;
if (Platform_lseek(h, offset, whence) < 0) {
_o_result = Platform_err();
return _o_result;
@ -583,9 +583,9 @@ INTEGER Platform_Seek (LONGINT h, LONGINT offset, INTEGER whence)
__RETCHK;
}
INTEGER Platform_Truncate (LONGINT h, LONGINT l)
int32 Platform_Truncate (int64 h, int64 l)
{
INTEGER _o_result;
int32 _o_result;
if (Platform_ftruncate(h, l) < 0) {
_o_result = Platform_err();
return _o_result;
@ -596,9 +596,9 @@ INTEGER Platform_Truncate (LONGINT h, LONGINT l)
__RETCHK;
}
INTEGER Platform_Unlink (CHAR *n, LONGINT n__len)
int32 Platform_Unlink (CHAR *n, LONGINT n__len)
{
INTEGER _o_result;
int32 _o_result;
if (Platform_unlink(n, n__len) < 0) {
_o_result = Platform_err();
return _o_result;
@ -609,10 +609,10 @@ INTEGER Platform_Unlink (CHAR *n, LONGINT n__len)
__RETCHK;
}
INTEGER Platform_Chdir (CHAR *n, LONGINT n__len)
int32 Platform_Chdir (CHAR *n, LONGINT n__len)
{
INTEGER _o_result;
INTEGER r;
int32 _o_result;
int32 r;
r = Platform_chdir(n, n__len);
Platform_getcwd((void*)Platform_CWD, 256);
if (r < 0) {
@ -625,9 +625,9 @@ INTEGER Platform_Chdir (CHAR *n, LONGINT n__len)
__RETCHK;
}
INTEGER Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len)
int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len)
{
INTEGER _o_result;
int32 _o_result;
if (Platform_rename(o, o__len, n, n__len) < 0) {
_o_result = Platform_err();
return _o_result;
@ -638,7 +638,7 @@ INTEGER Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len)
__RETCHK;
}
void Platform_Exit (INTEGER code)
void Platform_Exit (int32 code)
{
Platform_exit(code);
}
@ -654,7 +654,7 @@ static void Platform_errln (void)
Platform_errch(0x0a);
}
static void Platform_errposint (LONGINT l)
static void Platform_errposint (int64 l)
{
if (l > 10) {
Platform_errposint(__DIV(l, 10));
@ -662,7 +662,7 @@ static void Platform_errposint (LONGINT l)
Platform_errch((CHAR)(48 + __MOD(l, 10)));
}
static void Platform_errint (LONGINT l)
static void Platform_errint (int64 l)
{
if (l < 0) {
Platform_errch('-');
@ -671,7 +671,7 @@ static void Platform_errint (LONGINT l)
Platform_errposint(l);
}
static void Platform_DisplayHaltCode (LONGINT code)
static void Platform_DisplayHaltCode (int64 code)
{
switch (code) {
case -1:
@ -727,9 +727,9 @@ static void Platform_DisplayHaltCode (LONGINT code)
}
}
void Platform_Halt (LONGINT code)
void Platform_Halt (int64 code)
{
INTEGER e;
int32 e;
Platform_HaltCode = code;
if (Platform_HaltHandler != NIL) {
(*Platform_HaltHandler)(code);
@ -741,12 +741,12 @@ void Platform_Halt (LONGINT code)
Platform_DisplayHaltCode(code);
}
Platform_errln();
Platform_exit(__VAL(INTEGER, code));
Platform_exit(__VAL(int32, code));
}
void Platform_AssertFail (LONGINT code)
void Platform_AssertFail (int64 code)
{
INTEGER e;
int32 e;
Platform_errstring((CHAR*)"Assertion failure.", 19);
if (code != 0) {
Platform_errstring((CHAR*)" ASSERT code ", 14);
@ -754,7 +754,7 @@ void Platform_AssertFail (LONGINT code)
Platform_errstring((CHAR*)".", 2);
}
Platform_errln();
Platform_exit(__VAL(INTEGER, code));
Platform_exit(__VAL(int32, code));
}
void Platform_SetHalt (Platform_HaltProcedure p)
@ -764,7 +764,7 @@ void Platform_SetHalt (Platform_HaltProcedure p)
static void Platform_TestLittleEndian (void)
{
INTEGER i;
int32 i;
i = 1;
__GET((SYSTEM_ADRINT)&i, Platform_LittleEndian, BOOLEAN);
}

View file

@ -8,74 +8,74 @@
typedef
struct Platform_FileIdentity {
LONGINT volume, index, mtime;
int64 volume, index, mtime;
} Platform_FileIdentity;
typedef
void (*Platform_HaltProcedure)(LONGINT);
void (*Platform_HaltProcedure)(int64);
typedef
void (*Platform_SignalHandler)(INTEGER);
void (*Platform_SignalHandler)(int32);
import BOOLEAN Platform_LittleEndian;
import LONGINT Platform_MainStackFrame, Platform_HaltCode;
import INTEGER Platform_PID;
import int64 Platform_MainStackFrame, Platform_HaltCode;
import int32 Platform_PID;
import CHAR Platform_CWD[256];
import INTEGER Platform_ArgCount;
import LONGINT Platform_ArgVector;
import INTEGER Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
import int32 Platform_ArgCount;
import int64 Platform_ArgVector;
import int32 Platform_SeekSet, Platform_SeekCur, Platform_SeekEnd;
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 (int32 e);
import int32 Platform_ArgPos (CHAR *s, LONGINT s__len);
import void Platform_AssertFail (int64 code);
import int32 Platform_Chdir (CHAR *n, LONGINT n__len);
import int32 Platform_Close (int64 h);
import BOOLEAN Platform_ConnectionFailed (int32 e);
import void Platform_Delay (int64 ms);
import BOOLEAN Platform_DifferentFilesystems (int32 e);
import int32 Platform_Error (void);
import void Platform_Exit (int32 code);
import void Platform_GetArg (int32 n, CHAR *val, LONGINT val__len);
import void Platform_GetClock (int64 *t, int64 *d);
import 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 (int32 n, int64 *val);
import void Platform_GetTimeOfDay (int64 *sec, int64 *usec);
import void Platform_Halt (int64 code);
import int32 Platform_Identify (int64 h, Platform_FileIdentity *identity, LONGINT *identity__typ);
import int32 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, LONGINT *identity__typ);
import BOOLEAN Platform_Inaccessible (int32 e);
import void Platform_Init (int32 argc, int64 argvadr);
import void Platform_MTimeAsClock (Platform_FileIdentity i, int64 *t, int64 *d);
import int32 Platform_New (CHAR *n, LONGINT n__len, int64 *h);
import BOOLEAN Platform_NoSuchDirectory (int32 e);
import int64 Platform_OSAllocate (int64 size);
import void Platform_OSFree (int64 address);
import int32 Platform_OldRO (CHAR *n, LONGINT n__len, int64 *h);
import int32 Platform_OldRW (CHAR *n, LONGINT n__len, int64 *h);
import int32 Platform_Read (int64 h, int64 p, int64 l, int64 *n);
import int32 Platform_ReadBuf (int64 h, SYSTEM_BYTE *b, LONGINT b__len, int64 *n);
import int32 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len);
import 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 offset, INTEGER whence);
import int32 Platform_Seek (int64 h, int64 offset, int32 whence);
import void Platform_SetBadInstructionHandler (Platform_SignalHandler handler);
import void Platform_SetHalt (Platform_HaltProcedure p);
import void Platform_SetInterruptHandler (Platform_SignalHandler handler);
import void Platform_SetMTime (Platform_FileIdentity *target, LONGINT *target__typ, Platform_FileIdentity source);
import void Platform_SetQuitHandler (Platform_SignalHandler handler);
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 l);
import INTEGER Platform_Unlink (CHAR *n, LONGINT n__len);
import INTEGER Platform_Write (LONGINT h, LONGINT p, LONGINT l);
import int32 Platform_Size (int64 h, int64 *l);
import int32 Platform_Sync (int64 h);
import int32 Platform_System (CHAR *cmd, LONGINT cmd__len);
import int64 Platform_Time (void);
import BOOLEAN Platform_TimedOut (int32 e);
import BOOLEAN Platform_TooManyFiles (int32 e);
import int32 Platform_Truncate (int64 h, int64 l);
import int32 Platform_Unlink (CHAR *n, LONGINT n__len);
import int32 Platform_Write (int64 h, int64 p, int64 l);
import BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len);
import void *Platform__init(void);

View file

@ -6,19 +6,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, int32 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, int32 n, CHAR *d, LONGINT d__len);
export int32 Reals_Expo (REAL x);
export int32 Reals_ExpoL (LONGREAL x);
export void Reals_SetExpo (REAL *x, int32 ex);
export REAL Reals_Ten (int32 e);
export LONGREAL Reals_TenL (int32 e);
static CHAR Reals_ToHex (int32 i);
REAL Reals_Ten (INTEGER e)
REAL Reals_Ten (int32 e)
{
REAL _o_result;
LONGREAL r, power;
@ -35,7 +35,7 @@ REAL Reals_Ten (INTEGER e)
return _o_result;
}
LONGREAL Reals_TenL (INTEGER e)
LONGREAL Reals_TenL (int32 e)
{
LONGREAL _o_result;
LONGREAL r, power;
@ -55,16 +55,16 @@ LONGREAL Reals_TenL (INTEGER e)
__RETCHK;
}
INTEGER Reals_Expo (REAL x)
int32 Reals_Expo (REAL x)
{
INTEGER _o_result;
INTEGER i;
__GET((SYSTEM_ADRINT)&x + 2, i, INTEGER);
int32 _o_result;
int32 i;
__GET((SYSTEM_ADRINT)&x + 2, i, int32);
_o_result = __MASK(__ASHR(i, 7), -256);
return _o_result;
}
void Reals_SetExpo (REAL *x, INTEGER ex)
void Reals_SetExpo (REAL *x, int32 ex)
{
CHAR c;
__GET((SYSTEM_ADRINT)x + 3, c, CHAR);
@ -73,36 +73,36 @@ void Reals_SetExpo (REAL *x, INTEGER ex)
__PUT((SYSTEM_ADRINT)x + 2, (CHAR)(__MASK(c, -128) + __ASHL(__MASK(ex, -2), 7)), CHAR);
}
INTEGER Reals_ExpoL (LONGREAL x)
int32 Reals_ExpoL (LONGREAL x)
{
INTEGER _o_result;
INTEGER i;
__GET((SYSTEM_ADRINT)&x + 6, i, INTEGER);
int32 _o_result;
int32 i;
__GET((SYSTEM_ADRINT)&x + 6, i, int32);
_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, int32 n, CHAR *d, LONGINT d__len)
{
LONGINT i, j, k;
int64 i, j, k;
if (x < (LONGREAL)0) {
x = -x;
}
k = 0;
i = __ENTIER(x);
while (k < (SYSTEM_INT64)n) {
while (k < (int64)n) {
d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48);
i = __DIV(i, 10);
k += 1;
}
}
void Reals_Convert (REAL x, INTEGER n, CHAR *d, LONGINT d__len)
void Reals_Convert (REAL x, int32 n, CHAR *d, LONGINT d__len)
{
Reals_ConvertL(x, n, (void*)d, d__len);
}
static CHAR Reals_ToHex (INTEGER i)
static CHAR Reals_ToHex (int32 i)
{
CHAR _o_result;
if (i < 10) {
@ -117,12 +117,12 @@ 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;
int32 i;
int64 l;
CHAR by;
i = 0;
l = b__len;
while ((SYSTEM_INT64)i < l) {
while ((int64)i < l) {
by = __VAL(CHAR, b[__X(i, b__len)]);
d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR(by, 4));
d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK(by, -16));

View file

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

@ -7,22 +7,22 @@
export void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__len);
export void Strings_Cap (CHAR *s, LONGINT s__len);
export void Strings_Delete (CHAR *s, LONGINT s__len, 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, int32 pos, int32 n);
export void Strings_Extract (CHAR *source, LONGINT source__len, int32 pos, int32 n, CHAR *dest, LONGINT dest__len);
export void Strings_Insert (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len);
export int32 Strings_Length (CHAR *s, LONGINT s__len);
export 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 int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int32 pos);
export void Strings_Replace (CHAR *source, LONGINT source__len, int32 pos, CHAR *dest, LONGINT dest__len);
INTEGER Strings_Length (CHAR *s, LONGINT s__len)
int32 Strings_Length (CHAR *s, LONGINT s__len)
{
INTEGER _o_result;
INTEGER i;
int32 _o_result;
int32 i;
__DUP(s, s__len, CHAR);
i = 0;
while (((SYSTEM_INT64)i < s__len && s[__X(i, s__len)] != 0x00)) {
while (((int64)i < s__len && s[__X(i, s__len)] != 0x00)) {
i += 1;
}
_o_result = i;
@ -32,24 +32,24 @@ 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;
int32 n1, n2, i;
__DUP(extra, extra__len, CHAR);
n1 = Strings_Length(dest, dest__len);
n2 = Strings_Length(extra, extra__len);
i = 0;
while ((i < n2 && (SYSTEM_INT64)(i + n1) < dest__len)) {
while ((i < n2 && (int64)(i + n1) < dest__len)) {
dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)];
i += 1;
}
if ((SYSTEM_INT64)(i + n1) < dest__len) {
if ((int64)(i + n1) < dest__len) {
dest[__X(i + n1, dest__len)] = 0x00;
}
__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, int32 pos, CHAR *dest, LONGINT dest__len)
{
INTEGER n1, n2, i;
int32 n1, n2, i;
__DUP(source, source__len, CHAR);
n1 = Strings_Length(dest, dest__len);
n2 = Strings_Length(source, source__len);
@ -60,10 +60,10 @@ void Strings_Insert (CHAR *source, LONGINT source__len, INTEGER pos, CHAR *dest,
Strings_Append(dest, dest__len, (void*)source, source__len);
return;
}
if ((SYSTEM_INT64)(pos + n2) < dest__len) {
if ((int64)(pos + n2) < dest__len) {
i = n1;
while (i >= pos) {
if ((SYSTEM_INT64)(i + n2) < dest__len) {
if ((int64)(i + n2) < dest__len) {
dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)];
}
i -= 1;
@ -77,9 +77,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, int32 pos, int32 n)
{
INTEGER len, i;
int32 len, i;
len = Strings_Length(s, s__len);
if (pos < 0) {
pos = 0;
@ -92,7 +92,7 @@ void Strings_Delete (CHAR *s, LONGINT s__len, INTEGER pos, INTEGER n)
s[__X(i - n, s__len)] = s[__X(i, s__len)];
i += 1;
}
if ((SYSTEM_INT64)(i - n) < s__len) {
if ((int64)(i - n) < s__len) {
s[__X(i - n, s__len)] = 0x00;
}
} else {
@ -100,7 +100,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, int32 pos, CHAR *dest, LONGINT dest__len)
{
__DUP(source, source__len, CHAR);
Strings_Delete((void*)dest, dest__len, pos, pos + Strings_Length(source, source__len));
@ -108,12 +108,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, int32 pos, int32 n, CHAR *dest, LONGINT dest__len)
{
INTEGER len, destLen, i;
int32 len, destLen, i;
__DUP(source, source__len, CHAR);
len = Strings_Length(source, source__len);
destLen = (SYSTEM_INT32)dest__len - 1;
destLen = (int32)dest__len - 1;
if (pos < 0) {
pos = 0;
}
@ -122,7 +122,7 @@ void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n,
return;
}
i = 0;
while (((((SYSTEM_INT64)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) {
while (((((int64)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) {
if (i < destLen) {
dest[__X(i, dest__len)] = source[__X(pos + i, source__len)];
}
@ -132,10 +132,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)
int32 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int32 pos)
{
INTEGER _o_result;
INTEGER n1, n2, i, j;
int32 _o_result;
int32 n1, n2, i, j;
__DUP(pattern, pattern__len, CHAR);
__DUP(s, s__len, CHAR);
n1 = Strings_Length(s, s__len);
@ -170,7 +170,7 @@ INTEGER Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__le
void Strings_Cap (CHAR *s, LONGINT s__len)
{
INTEGER i;
int32 i;
i = 0;
while (s[__X(i, s__len)] != 0x00) {
if (('a' <= s[__X(i, s__len)] && s[__X(i, s__len)] <= 'z')) {
@ -184,9 +184,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, int32 n, int32 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, int32 n, int32 m)
{
BOOLEAN _o_result;
while ((((n >= 0 && m >= 0)) && mask[__X(m, mask__len)] != '*')) {

View file

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

View file

@ -14,9 +14,9 @@ typedef
typedef
struct Texts_RunDesc {
Texts_Run prev, next;
LONGINT len;
int64 len;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
BOOLEAN ascii;
} Texts_RunDesc;
@ -37,26 +37,26 @@ typedef
typedef
struct Texts_ElemDesc {
Texts_Run prev, next;
LONGINT len;
int64 len;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
BOOLEAN ascii;
LONGINT W, H;
int64 W, H;
Texts_Handler handle;
Texts_Text base;
} Texts_ElemDesc;
struct Texts__1 { /* Texts_ElemDesc */
Texts_Run prev, next;
LONGINT len;
int64 len;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
BOOLEAN ascii;
LONGINT W, H;
int64 W, H;
Texts_Handler handle;
Texts_Text base;
Files_File file;
LONGINT org, span;
int64 org, span;
CHAR mod[32], proc[32];
};
@ -65,7 +65,7 @@ typedef
typedef
struct Texts_BufDesc {
LONGINT len;
int64 len;
Texts_Run head;
} Texts_BufDesc;
@ -79,8 +79,8 @@ typedef
typedef
struct Texts_FileMsg { /* Texts_ElemMsg */
INTEGER id;
LONGINT pos;
int32 id;
int64 pos;
Files_Rider r;
} Texts_FileMsg;
@ -95,7 +95,7 @@ typedef
} Texts_IdentifyMsg;
typedef
void (*Texts_Notifier)(Texts_Text, INTEGER, LONGINT, LONGINT);
void (*Texts_Notifier)(Texts_Text, int32, int64, int64);
typedef
struct Texts_PieceDesc *Texts_Piece;
@ -103,57 +103,57 @@ typedef
typedef
struct Texts_PieceDesc {
Texts_Run prev, next;
LONGINT len;
int64 len;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
BOOLEAN ascii;
Files_File file;
LONGINT org;
int64 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;
int64 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;
int64 org, off;
CHAR nextCh;
INTEGER line, class;
LONGINT i;
int32 line, class;
int64 i;
REAL x;
LONGREAL y;
CHAR c;
SHORTINT len;
int8 len;
CHAR s[64];
} Texts_Scanner;
typedef
struct Texts_TextDesc {
LONGINT len;
int64 len;
Texts_Notifier notify;
Texts_Run head, cache;
LONGINT corg;
int64 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;
@ -179,50 +179,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, int64 beg, int64 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, int64 beg, int64 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 int64 Texts_ElemPos (Texts_Elem E);
static void Texts_Find (Texts_Text T, int64 *pos, Texts_Run *u, int64 *org, int64 *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, int64 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, int64 pos);
export void Texts_OpenScanner (Texts_Scanner *S, LONGINT *S__typ, Texts_Text T, int64 pos);
export void Texts_OpenWriter (Texts_Writer *W, LONGINT *W__typ);
export LONGINT Texts_Pos (Texts_Reader *R, LONGINT *R__typ);
export int64 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, int64 beg, int64 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 (int64 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, int64 t, int64 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, int64 x);
export void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, int64 x, int64 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, int32 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, int32 n);
export void Texts_WriteRealFix (Texts_Writer *W, LONGINT *W__typ, REAL x, int32 n, int32 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);
@ -237,10 +237,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, int64 *pos, Texts_Run *u, int64 *org, int64 *off)
{
Texts_Run v = NIL;
LONGINT m;
int64 m;
if (*pos >= T->len) {
*pos = T->len;
*u = T->head;
@ -270,7 +270,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 (int64 off, Texts_Run *u, Texts_Run *un)
{
Texts_Piece p = NIL, U = NIL;
if (off == 0) {
@ -369,11 +369,11 @@ Texts_Text Texts_ElemBase (Texts_Elem E)
return _o_result;
}
LONGINT Texts_ElemPos (Texts_Elem E)
int64 Texts_ElemPos (Texts_Elem E)
{
LONGINT _o_result;
int64 _o_result;
Texts_Run u = NIL;
LONGINT pos;
int64 pos;
u = E->base->head->next;
pos = 0;
while (u != (void *) E) {
@ -388,7 +388,7 @@ static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, LONGINT *msg__t
{
Texts_Alien e = NIL;
Files_Rider r;
LONGINT i;
int64 i;
CHAR ch;
if (__ISP(E, Texts__1, 2)) {
if (__IS(msg__typ, Texts_CopyMsg, 1)) {
@ -464,10 +464,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, int64 beg, int64 end, Texts_Buffer B)
{
Texts_Run u = NIL, v = NIL, w = NIL, wn = NIL;
LONGINT uo, ud, vo, vd;
int64 uo, ud, vo, vd;
Texts_Find(T, &beg, &u, &uo, &ud);
Texts_Find(T, &end, &v, &vo, &vd);
w = B->head->prev;
@ -498,11 +498,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, int64 pos, Texts_Buffer B)
{
Texts_Run u = NIL, un = NIL, v = NIL;
Texts_Piece p = NIL, q = NIL;
LONGINT uo, ud, len;
int64 uo, ud, len;
Texts_Find(T, &pos, &u, &uo, &ud);
Texts_Split(ud, &u, &un);
len = B->len;
@ -521,7 +521,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;
int64 pos, len;
pos = T->len;
len = B->len;
v = B->head->next;
@ -536,10 +536,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, int64 beg, int64 end)
{
Texts_Run c = NIL, u = NIL, un = NIL, v = NIL, vn = NIL;
LONGINT co, uo, ud, vo, vd;
int64 co, uo, ud, vo, vd;
Texts_Find(T, &beg, &u, &uo, &ud);
Texts_Split(ud, &u, &un);
c = T->cache;
@ -561,10 +561,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, int64 beg, int64 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;
int64 co, uo, ud, vo, vd;
Texts_Find(T, &beg, &u, &uo, &ud);
Texts_Split(ud, &u, &un);
c = T->cache;
@ -600,7 +600,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, int64 pos)
{
Texts_Run u = NIL;
if (pos >= T->len) {
@ -617,7 +617,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;
int64 pos;
CHAR nextch;
u = (*R).run;
(*R).fnt = u->fnt;
@ -709,14 +709,14 @@ void Texts_ReadPrevElem (Texts_Reader *R, LONGINT *R__typ)
}
}
LONGINT Texts_Pos (Texts_Reader *R, LONGINT *R__typ)
int64 Texts_Pos (Texts_Reader *R, LONGINT *R__typ)
{
LONGINT _o_result;
int64 _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, int64 pos)
{
Texts_OpenReader((void*)&*S, S__typ, T, pos);
(*S).line = 0;
@ -728,7 +728,7 @@ static struct Scan__31 {
LONGINT *S__typ;
CHAR *ch;
BOOLEAN *negE;
INTEGER *e;
int32 *e;
struct Scan__31 *lnk;
} *Scan__31_s;
@ -756,9 +756,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;
int32 e;
int64 k;
REAL x, f;
LONGREAL y, g;
CHAR d[32];
@ -840,7 +840,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
k -= 16;
}
while (j < i) {
k = __ASHL(k, 4) + (SYSTEM_INT64)(d[__X(j, 32)] - 48);
k = __ASHL(k, 4) + (int64)(d[__X(j, 32)] - 48);
j += 1;
}
if (neg) {
@ -930,7 +930,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
(*S).class = 3;
k = 0;
do {
k = k * 10 + (SYSTEM_INT64)(d[__X(j, 32)] - 48);
k = k * 10 + (int64)(d[__X(j, 32)] - 48);
j += 1;
} while (!(j == i));
if (neg) {
@ -974,12 +974,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;
}
@ -1036,7 +1036,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;
int32 i;
__DUP(s, s__len, CHAR);
i = 0;
while (s[__X(i, s__len)] >= ' ') {
@ -1046,10 +1046,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, int64 x, int64 n)
{
INTEGER i;
LONGINT x0;
int32 i;
int64 x0;
CHAR a[22];
i = 0;
if (x < 0) {
@ -1068,7 +1068,7 @@ void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n)
x0 = __DIV(x0, 10);
i += 1;
} while (!(x0 == 0));
while (n > (SYSTEM_INT64)i) {
while (n > (int64)i) {
Texts_Write(&*W, W__typ, ' ');
n -= 1;
}
@ -1081,10 +1081,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, int64 x)
{
INTEGER i;
LONGINT y;
int32 i;
int64 y;
CHAR a[20];
i = 0;
Texts_Write(&*W, W__typ, ' ');
@ -1104,9 +1104,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, int32 n)
{
INTEGER e;
int32 e;
REAL x0;
CHAR d[9];
e = Reals_Expo(x);
@ -1177,15 +1177,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;
int32 *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 (int32 n);
static void seq__56 (CHAR ch, int32 n);
static void seq__56 (CHAR ch, INTEGER n)
static void seq__56 (CHAR ch, int32 n)
{
while (n > 0) {
Texts_Write(&*WriteRealFix__53_s->W, WriteRealFix__53_s->W__typ, ch);
@ -1193,7 +1193,7 @@ static void seq__56 (CHAR ch, INTEGER n)
}
}
static void dig__54 (INTEGER n)
static void dig__54 (int32 n)
{
while (n > 0) {
*WriteRealFix__53_s->i -= 1;
@ -1202,9 +1202,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, int32 n, int32 k)
{
INTEGER e, i;
int32 e, i;
CHAR sign;
REAL x0;
CHAR d[9];
@ -1276,7 +1276,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;
int32 i;
CHAR d[8];
Reals_ConvertH(x, (void*)d, 8);
i = 0;
@ -1286,9 +1286,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, int32 n)
{
INTEGER e;
int32 e;
LONGREAL x0;
CHAR d[16];
e = Reals_ExpoL(x);
@ -1320,7 +1320,7 @@ void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER
} else {
Texts_Write(&*W, W__typ, ' ');
}
e = (SYSTEM_INT32)__ASHR((SYSTEM_INT64)(e - 1023) * 77, 8);
e = (int32)__ASHR((int64)(e - 1023) * 77, 8);
if (e >= 0) {
x = x / (LONGREAL)Reals_TenL(e);
} else {
@ -1360,7 +1360,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;
int32 i;
CHAR d[16];
Reals_ConvertHL(x, (void*)d, 16);
i = 0;
@ -1376,16 +1376,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, int64 x);
static void WritePair__44 (CHAR ch, LONGINT x)
static void WritePair__44 (CHAR ch, int64 x)
{
Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, ch);
Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, (CHAR)(__DIV(x, 10) + 48));
Texts_Write(&*WriteDate__43_s->W, WriteDate__43_s->W__typ, (CHAR)(__MOD(x, 10) + 48));
}
void Texts_WriteDate (Texts_Writer *W, LONGINT *W__typ, LONGINT t, LONGINT d)
void Texts_WriteDate (Texts_Writer *W, LONGINT *W__typ, int64 t, int64 d)
{
struct WriteDate__43 _s;
_s.W = W; _s.W__typ = W__typ;
@ -1402,22 +1402,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, int64 pos, int64 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, int64 pos, int64 span, Texts_Elem *e)
{
Modules_Module M = NIL;
Modules_Command Cmd;
Texts_Alien a = NIL;
LONGINT org, ew, eh;
SHORTINT eno;
int64 org, ew, eh;
int8 eno;
Texts_new = NIL;
Files_ReadLInt(&*r, r__typ, &ew);
Files_ReadLInt(&*r, r__typ, &eh);
@ -1467,8 +1467,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;
int64 org, pos, hlen, plen;
int8 ecnt, fno, fcnt, col, voff;
Files_File f = NIL;
Texts_FileMsg msg;
CHAR mods[64][32], procs[64][32];
@ -1538,7 +1538,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;
int32 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);
@ -1553,7 +1553,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;
int64 hlen;
__DUP(name, name__len, CHAR);
f = Files_Old(name, name__len);
if (f == NIL) {
@ -1603,20 +1603,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, int64 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, int64 pos, Texts_Elem e)
{
Files_Rider r1;
LONGINT org, span;
SHORTINT eno;
int64 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;
@ -1647,8 +1647,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;
int64 org, pos, delta, hlen, rlen;
int8 ecnt, fno, fcnt;
CHAR ch;
Texts_FileMsg msg;
Texts_IdentifyMsg iden;
@ -1765,7 +1765,7 @@ void Texts_Close (Texts_Text T, CHAR *name, LONGINT name__len)
{
Files_File f = NIL;
Files_Rider r;
INTEGER i, res;
int32 i, res;
CHAR bak[64];
__DUP(name, name__len, CHAR);
f = Files_New(name, name__len);

View file

@ -9,7 +9,7 @@
typedef
struct Texts_BufDesc {
LONGINT len;
int64 len;
char _prvt0[8];
} Texts_BufDesc;
@ -41,15 +41,15 @@ typedef
typedef
struct Texts_ElemDesc {
char _prvt0[40];
LONGINT W, H;
int64 W, H;
Texts_Handler handle;
char _prvt1[8];
} Texts_ElemDesc;
typedef
struct Texts_FileMsg { /* Texts_ElemMsg */
INTEGER id;
LONGINT pos;
int32 id;
int64 pos;
Files_Rider r;
} Texts_FileMsg;
@ -70,13 +70,13 @@ typedef
struct Texts_TextDesc *Texts_Text;
typedef
void (*Texts_Notifier)(Texts_Text, INTEGER, LONGINT, LONGINT);
void (*Texts_Notifier)(Texts_Text, int32, int64, int64);
typedef
struct Texts_Reader {
BOOLEAN eot;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
Texts_Elem elem;
char _prvt0[64];
} Texts_Reader;
@ -85,22 +85,22 @@ typedef
struct Texts_Scanner { /* Texts_Reader */
BOOLEAN eot;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
Texts_Elem elem;
char _prvt0[64];
CHAR nextCh;
INTEGER line, class;
LONGINT i;
int32 line, class;
int64 i;
REAL x;
LONGREAL y;
CHAR c;
SHORTINT len;
int8 len;
CHAR s[64];
} Texts_Scanner;
typedef
struct Texts_TextDesc {
LONGINT len;
int64 len;
Texts_Notifier notify;
char _prvt0[24];
} Texts_TextDesc;
@ -109,7 +109,7 @@ typedef
struct Texts_Writer {
Texts_Buffer buf;
Texts_FontsFont fnt;
SHORTINT col, voff;
int8 col, voff;
char _prvt0[54];
} 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, int64 beg, int64 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, int64 beg, int64 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 int64 Texts_ElemPos (Texts_Elem E);
import void Texts_Insert (Texts_Text T, int64 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, int64 pos);
import void Texts_OpenScanner (Texts_Scanner *S, LONGINT *S__typ, Texts_Text T, int64 pos);
import void Texts_OpenWriter (Texts_Writer *W, LONGINT *W__typ);
import LONGINT Texts_Pos (Texts_Reader *R, LONGINT *R__typ);
import int64 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, int64 beg, int64 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, int64 t, int64 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, int64 x);
import void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, int64 x, int64 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, int32 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, int32 n);
import void Texts_WriteRealFix (Texts_Writer *W, LONGINT *W__typ, REAL x, int32 n, int32 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

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

View file

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

View file

@ -9,36 +9,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 (int32 n);
export void vt100_CNL (int32 n);
export void vt100_CPL (int32 n);
export void vt100_CUB (int32 n);
export void vt100_CUD (int32 n);
export void vt100_CUF (int32 n);
export void vt100_CUP (int32 n, int32 m);
export void vt100_CUU (int32 n);
export void vt100_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 (int32 n);
export void vt100_ED (int32 n);
export void vt100_EL (int32 n);
static void vt100_EscSeq (int32 n, CHAR *letter, LONGINT letter__len);
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 (int32 n, int32 m, CHAR *letter, LONGINT letter__len);
static void vt100_EscSeqSwapped (int32 n, CHAR *letter, LONGINT letter__len);
export void vt100_HVP (int32 n, int32 m);
export void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len);
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, int32 start, int32 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 (int32 n);
export void vt100_SGR (int32 n);
export void vt100_SGR2 (int32 n, int32 m);
export void vt100_SU (int32 n);
export void vt100_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, int32 start, int32 end)
{
CHAR h;
while (start < end) {
@ -50,11 +50,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 (int64 int_, CHAR *str, LONGINT str__len)
{
CHAR b[21];
INTEGER s, e;
SHORTINT maxLength;
int32 s, e;
int8 maxLength;
maxLength = 20;
if (int_ == (-9223372036854775807-1)) {
__MOVE("-9223372036854775808", b, 21);
@ -89,7 +89,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 (int32 n, CHAR *letter, LONGINT letter__len)
{
CHAR nstr[2];
CHAR cmd[7];
@ -102,7 +102,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 (int32 n, CHAR *letter, LONGINT letter__len)
{
CHAR nstr[2];
CHAR cmd[7];
@ -115,7 +115,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 (int32 n, int32 m, CHAR *letter, LONGINT letter__len)
{
CHAR nstr[5], mstr[5];
CHAR cmd[12];
@ -131,82 +131,82 @@ static void vt100_EscSeq2 (INTEGER n, INTEGER m, CHAR *letter, LONGINT letter__l
__DEL(letter);
}
void vt100_CUU (INTEGER n)
void vt100_CUU (int32 n)
{
vt100_EscSeq(n, (CHAR*)"A", 2);
}
void vt100_CUD (INTEGER n)
void vt100_CUD (int32 n)
{
vt100_EscSeq(n, (CHAR*)"B", 2);
}
void vt100_CUF (INTEGER n)
void vt100_CUF (int32 n)
{
vt100_EscSeq(n, (CHAR*)"C", 2);
}
void vt100_CUB (INTEGER n)
void vt100_CUB (int32 n)
{
vt100_EscSeq(n, (CHAR*)"D", 2);
}
void vt100_CNL (INTEGER n)
void vt100_CNL (int32 n)
{
vt100_EscSeq(n, (CHAR*)"E", 2);
}
void vt100_CPL (INTEGER n)
void vt100_CPL (int32 n)
{
vt100_EscSeq(n, (CHAR*)"F", 2);
}
void vt100_CHA (INTEGER n)
void vt100_CHA (int32 n)
{
vt100_EscSeq(n, (CHAR*)"G", 2);
}
void vt100_CUP (INTEGER n, INTEGER m)
void vt100_CUP (int32 n, int32 m)
{
vt100_EscSeq2(n, m, (CHAR*)"H", 2);
}
void vt100_ED (INTEGER n)
void vt100_ED (int32 n)
{
vt100_EscSeq(n, (CHAR*)"J", 2);
}
void vt100_EL (INTEGER n)
void vt100_EL (int32 n)
{
vt100_EscSeq(n, (CHAR*)"K", 2);
}
void vt100_SU (INTEGER n)
void vt100_SU (int32 n)
{
vt100_EscSeq(n, (CHAR*)"S", 2);
}
void vt100_SD (INTEGER n)
void vt100_SD (int32 n)
{
vt100_EscSeq(n, (CHAR*)"T", 2);
}
void vt100_HVP (INTEGER n, INTEGER m)
void vt100_HVP (int32 n, int32 m)
{
vt100_EscSeq2(n, m, (CHAR*)"f", 2);
}
void vt100_SGR (INTEGER n)
void vt100_SGR (int32 n)
{
vt100_EscSeq(n, (CHAR*)"m", 2);
}
void vt100_SGR2 (INTEGER n, INTEGER m)
void vt100_SGR2 (int32 n, int32 m)
{
vt100_EscSeq2(n, m, (CHAR*)"m", 2);
}
void vt100_DSR (INTEGER n)
void vt100_DSR (int32 n)
{
vt100_EscSeq(6, (CHAR*)"n", 2);
}

View file

@ -10,27 +10,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 (int32 n);
import void vt100_CNL (int32 n);
import void vt100_CPL (int32 n);
import void vt100_CUB (int32 n);
import void vt100_CUD (int32 n);
import void vt100_CUF (int32 n);
import void vt100_CUP (int32 n, int32 m);
import void vt100_CUU (int32 n);
import void vt100_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 (int32 n);
import void vt100_ED (int32 n);
import void vt100_EL (int32 n);
import void vt100_HVP (int32 n, int32 m);
import void vt100_IntToStr (int64 int_, CHAR *str, LONGINT str__len);
import void vt100_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 (int32 n);
import void vt100_SGR (int32 n);
import void vt100_SGR2 (int32 n, int32 m);
import void vt100_SU (int32 n);
import void vt100_SetAttr (CHAR *attr, LONGINT attr__len);
import void *vt100__init(void);

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;

Some files were not shown because too many files have changed in this diff Show more