Remove SYSTEM.H includes (string.h and stdint.h).

This commit is contained in:
David Brown 2016-08-22 18:24:03 +01:00
parent a39eefaf18
commit f3ecbd5c2b
51 changed files with 424 additions and 377 deletions

View file

@ -858,7 +858,7 @@ void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
{ {
CHAR b[4]; CHAR b[4];
Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4))); Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4)));
*x = ((LONGINT)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((LONGINT)b[2], 16)) + __ASHL((LONGINT)b[3], 24); *x = ((int)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((int)b[2], 16)) + __ASHL((int)b[3], 24);
} }
void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x) void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x)
@ -866,7 +866,7 @@ void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x)
CHAR b[4]; CHAR b[4];
LONGINT l; LONGINT l;
Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4))); Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4)));
l = ((LONGINT)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((LONGINT)b[2], 16)) + __ASHL((LONGINT)b[3], 24); l = ((int)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((int)b[2], 16)) + __ASHL((int)b[3], 24);
*x = (SET)l; *x = (SET)l;
} }
@ -923,11 +923,11 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
n = 0; n = 0;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
while ((int)ch >= 128) { while ((int)ch >= 128) {
n += __ASH((LONGINT)((int)ch - 128), s); n += __ASH((int)((int)ch - 128), s);
s += 7; s += 7;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
} }
n += __ASH((LONGINT)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s); n += __ASH((int)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s);
*x = n; *x = n;
} }

View file

@ -242,7 +242,7 @@ static INTEGER OPB_SignedByteSize (LONGINT n)
static LONGINT OPB_ShorterSize (LONGINT i) static LONGINT OPB_ShorterSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i >= (LONGINT)OPM_LIntSize) { if (i >= (int)OPM_LIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -255,7 +255,7 @@ static LONGINT OPB_ShorterSize (LONGINT i)
static LONGINT OPB_LongerSize (LONGINT i) static LONGINT OPB_LongerSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i <= (LONGINT)OPM_SIntSize) { if (i <= (int)OPM_SIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -520,7 +520,7 @@ void OPB_In (OPT_Node *x, OPT_Node y)
} else if ((__IN(f, 0x70) && y->typ->form == 9)) { } else if ((__IN(f, 0x70) && y->typ->form == 9)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (k < 0 || k > (LONGINT)OPM_MaxSet) { if (k < 0 || k > (int)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} else if (y->class == 7) { } else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval)); (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval));
@ -1201,7 +1201,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
OPB_err(203); OPB_err(203);
r = (LONGREAL)1; r = (LONGREAL)1;
} }
(*x)->conval->intval = (LONGINT)__ENTIER(r); (*x)->conval->intval = (int)__ENTIER(r);
OPB_SetIntType(*x); OPB_SetIntType(*x);
} }
} }
@ -1553,13 +1553,13 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
} else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) { } else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (0 > k || k > (LONGINT)OPM_MaxSet) { if (0 > k || k > (int)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
if (y->class == 7) { if (y->class == 7) {
l = y->conval->intval; l = y->conval->intval;
if (0 > l || l > (LONGINT)OPM_MaxSet) { if (0 > l || l > (int)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
@ -1589,7 +1589,7 @@ void OPB_SetElem (OPT_Node *x)
OPB_err(93); OPB_err(93);
} else if ((*x)->class == 7) { } else if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if ((0 <= k && k <= (LONGINT)OPM_MaxSet)) { if ((0 <= k && k <= (int)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k); (*x)->conval->setval = __SETOF(k);
} else { } else {
OPB_err(202); OPB_err(202);
@ -1894,7 +1894,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 10: case 10:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size > (LONGINT)OPM_SIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size > (int)OPM_SIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size)));
} else if (f == 8) { } else if (f == 8) {
OPB_Convert(&x, OPT_realtyp); OPB_Convert(&x, OPT_realtyp);
@ -1905,7 +1905,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 11: case 11:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size < (LONGINT)OPM_LIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size < (int)OPM_LIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size)));
} else if (f == 7) { } else if (f == 7) {
OPB_Convert(&x, OPT_lrltyp); OPB_Convert(&x, OPT_lrltyp);
@ -1954,7 +1954,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if (x->typ->size != (LONGINT)OPM_LIntSize) { if (x->typ->size != (int)OPM_LIntSize) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -1994,7 +1994,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (int)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }
@ -2092,7 +2092,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int)OPM_MaxSet))) {
OPB_err(202); OPB_err(202);
} }
p = NewOp__57(19, fctno, p, x); p = NewOp__57(19, fctno, p, x);
@ -2263,7 +2263,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (int)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }

View file

@ -318,7 +318,7 @@ void OPC_Andent (OPT_Struct typ)
static BOOLEAN OPC_Undefined (OPT_Object obj) static BOOLEAN OPC_Undefined (OPT_Object obj)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
_o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (LONGINT)(3 + OPM_currFile))) && obj->linkadr != 2); _o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (int)(3 + OPM_currFile))) && obj->linkadr != 2);
return _o_result; return _o_result;
} }
@ -826,7 +826,7 @@ void OPC_TDescDecl (OPT_Struct typ)
OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size); OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size);
nofptrs = 0; nofptrs = 0;
OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs); OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs);
OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (LONGINT)OPM_LIntSize)); OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (int)OPM_LIntSize));
OPC_EndStat(); OPC_EndStat();
} }
@ -872,7 +872,7 @@ LONGINT OPC_SizeAlignment (LONGINT size)
{ {
LONGINT _o_result; LONGINT _o_result;
LONGINT alignment; LONGINT alignment;
if (size < (LONGINT)OPM_Alignment) { if (size < (int)OPM_Alignment) {
alignment = 1; alignment = 1;
while (alignment < size) { while (alignment < size) {
alignment = __ASHL(alignment, 1); alignment = __ASHL(alignment, 1);
@ -909,11 +909,11 @@ static void OPC_FillGap (LONGINT gap, LONGINT off, LONGINT align, LONGINT *n, LO
if ((*curAlign < align && gap - (adr - off) >= align)) { if ((*curAlign < align && gap - (adr - off) >= align)) {
gap -= (adr - off) + align; gap -= (adr - off) + align;
OPC_BegStat(); OPC_BegStat();
if (align == (LONGINT)OPM_IntSize) { if (align == (int)OPM_IntSize) {
OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8); OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8);
} else if (align == (LONGINT)OPM_LIntSize) { } else if (align == (int)OPM_LIntSize) {
OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8); OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8);
} else if (align == (LONGINT)OPM_LRealSize) { } else if (align == (int)OPM_LRealSize) {
OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9); OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9);
} }
OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n); OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n);
@ -978,7 +978,7 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, LONGINT *off, LONGINT *
} }
} }
if (last) { if (last) {
adr = typ->size - (LONGINT)__ASHR(typ->sysflag, 8); adr = typ->size - (int)__ASHR(typ->sysflag, 8);
if (adr == 0) { if (adr == 0) {
gap = 1; gap = 1;
} else { } else {

View file

@ -872,13 +872,13 @@ void OPM_WriteReal (LONGREAL r, CHAR suffx)
CHAR s[32]; CHAR s[32];
CHAR ch; CHAR ch;
INTEGER i; INTEGER i;
if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == ((LONGINT)__ENTIER(r)))) { if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == ((int)__ENTIER(r)))) {
if (suffx == 'f') { if (suffx == 'f') {
OPM_WriteString((CHAR*)"(REAL)", (LONGINT)7); OPM_WriteString((CHAR*)"(REAL)", (LONGINT)7);
} else { } else {
OPM_WriteString((CHAR*)"(LONGREAL)", (LONGINT)11); OPM_WriteString((CHAR*)"(LONGREAL)", (LONGINT)11);
} }
OPM_WriteInt((LONGINT)__ENTIER(r)); OPM_WriteInt((int)__ENTIER(r));
} else { } else {
Texts_OpenWriter(&W, Texts_Writer__typ); Texts_OpenWriter(&W, Texts_Writer__typ);
if (suffx == 'f') { if (suffx == 'f') {

View file

@ -173,7 +173,7 @@ static void OPS_Number (void)
OPS_numtyp = 1; OPS_numtyp = 1;
if (n <= 2) { if (n <= 2) {
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -188,7 +188,7 @@ static void OPS_Number (void)
OPS_intval = -1; OPS_intval = -1;
} }
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -199,8 +199,8 @@ static void OPS_Number (void)
while (i < n) { while (i < n) {
d = Ord__7(dig[i], 0); d = Ord__7(dig[i], 0);
i += 1; i += 1;
if (OPS_intval <= __DIV(2147483647 - (LONGINT)d, 10)) { if (OPS_intval <= __DIV(2147483647 - (int)d, 10)) {
OPS_intval = OPS_intval * 10 + (LONGINT)d; OPS_intval = OPS_intval * 10 + (int)d;
} else { } else {
OPS_err(203); OPS_err(203);
} }

View file

@ -86,7 +86,7 @@ void OPV_TypSize (OPT_Struct typ)
base = OPC_SizeAlignment(OPM_RecSize); base = OPC_SizeAlignment(OPM_RecSize);
} else { } else {
OPV_TypSize(btyp); OPV_TypSize(btyp);
offset = btyp->size - (LONGINT)__ASHR(btyp->sysflag, 8); offset = btyp->size - (int)__ASHR(btyp->sysflag, 8);
base = btyp->align; base = btyp->align;
} }
fld = typ->link; fld = typ->link;
@ -468,12 +468,10 @@ static void OPV_Entier (OPT_Node n, INTEGER prec)
static void OPV_SizeCast (LONGINT size) static void OPV_SizeCast (LONGINT size)
{ {
if (size <= (LONGINT)OPM_SIntSize) { if (size <= 4) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else if (size <= (LONGINT)OPM_IntSize) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6); OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else { } else {
OPM_WriteString((CHAR*)"(LONGINT)", (LONGINT)10); OPM_WriteString((CHAR*)"(SYSTEM_INT64)", (LONGINT)15);
} }
} }
@ -650,7 +648,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
} }
if (n->typ->comp == 3) { if (n->typ->comp == 3) {
OPM_Write(')'); OPM_Write(')');
while ((LONGINT)i < __ASHR(d->typ->size - 4, 2)) { while ((int)i < __ASHR(d->typ->size - 4, 2)) {
OPM_WriteString((CHAR*)" * ", (LONGINT)4); OPM_WriteString((CHAR*)" * ", (LONGINT)4);
OPV_Len(d, i); OPV_Len(d, i);
i += 1; i += 1;

View file

@ -89,8 +89,8 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
} }
k = 0; k = 0;
if (n > 9) { if (n > 9) {
i = (LONGINT)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000); i = (int)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000);
j = (LONGINT)__ENTIER(x - i * (LONGREAL)1000000000); j = (int)__ENTIER(x - i * (LONGREAL)1000000000);
if (j < 0) { if (j < 0) {
j = 0; j = 0;
} }
@ -100,9 +100,9 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
k += 1; k += 1;
} }
} else { } else {
i = (LONGINT)__ENTIER(x); i = (int)__ENTIER(x);
} }
while (k < (LONGINT)n) { while (k < (int)n) {
d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48); d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48);
i = __DIV(i, 10); i = __DIV(i, 10);
k += 1; k += 1;
@ -134,7 +134,7 @@ static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LO
CHAR by; CHAR by;
i = 0; i = 0;
l = b__len; l = b__len;
while ((LONGINT)i < l) { while ((int)i < l) {
by = __VAL(CHAR, b[__X(i, b__len)]); by = __VAL(CHAR, b[__X(i, b__len)]);
d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4)); d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4));
d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16)); d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16));

View file

@ -1,30 +1,40 @@
#ifndef SYSTEM__h #ifndef SYSTEM__h
#define SYSTEM__h #define SYSTEM__h
#ifndef _WIN32 #if defined(_WIN64)
typedef long long SYSTEM_INT64;
// Building for a Unix/Linux based system typedef unsigned long long SYSTEM_CARD64;
// TODO: Remove these includes
#include <string.h> // For memcpy ...
#include <stdint.h> // For uintptr_t ...
#else #else
typedef long SYSTEM_INT64;
// Building for Windows platform with either mingw under cygwin, or the MS C compiler typedef unsigned long SYSTEM_CARD64;
#ifdef _WIN64
typedef unsigned long long size_t;
typedef unsigned long long uintptr_t;
#else
typedef unsigned int size_t;
typedef unsigned int uintptr_t;
#endif /* _WIN64 */
typedef unsigned int uint32_t;
void * __cdecl memcpy(void * dest, const void * source, size_t size);
#endif #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;
#if (__SIZEOF_POINTER__ == 8)
#if defined(_WIN64)
typedef unsigned long long SYSTEM_PTRINT;
typedef unsigned long long uintptr_t;
typedef unsigned long long size_t;
#else
typedef unsigned long SYSTEM_PTRINT;
typedef unsigned long uintptr_t;
typedef unsigned long size_t;
#endif
#else
typedef unsigned int SYSTEM_PTRINT;
typedef unsigned int uintptr_t;
typedef unsigned int size_t;
#endif
void * __cdecl memcpy(void *dest, const void *source, size_t size);
// The compiler uses 'import' and 'export' which translate to 'extern' and // The compiler uses 'import' and 'export' which translate to 'extern' and
// nothing respectively. // nothing respectively.

View file

@ -21,7 +21,7 @@ INTEGER Strings_Length (CHAR *s, LONGINT s__len)
INTEGER i; INTEGER i;
__DUP(s, s__len, CHAR); __DUP(s, s__len, CHAR);
i = 0; i = 0;
while (((LONGINT)i < s__len && s[__X(i, s__len)] != 0x00)) { while (((int)i < s__len && s[__X(i, s__len)] != 0x00)) {
i += 1; i += 1;
} }
_o_result = i; _o_result = i;
@ -36,11 +36,11 @@ void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__
n1 = Strings_Length(dest, dest__len); n1 = Strings_Length(dest, dest__len);
n2 = Strings_Length(extra, extra__len); n2 = Strings_Length(extra, extra__len);
i = 0; i = 0;
while ((i < n2 && (LONGINT)(i + n1) < dest__len)) { while ((i < n2 && (int)(i + n1) < dest__len)) {
dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)]; dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i + n1) < dest__len) { if ((int)(i + n1) < dest__len) {
dest[__X(i + n1, dest__len)] = 0x00; dest[__X(i + n1, dest__len)] = 0x00;
} }
__DEL(extra); __DEL(extra);
@ -59,10 +59,10 @@ void Strings_Insert (CHAR *source, LONGINT source__len, INTEGER pos, CHAR *dest,
Strings_Append(dest, dest__len, (void*)source, source__len); Strings_Append(dest, dest__len, (void*)source, source__len);
return; return;
} }
if ((LONGINT)(pos + n2) < dest__len) { if ((int)(pos + n2) < dest__len) {
i = n1; i = n1;
while (i >= pos) { while (i >= pos) {
if ((LONGINT)(i + n2) < dest__len) { if ((int)(i + n2) < dest__len) {
dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)]; dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)];
} }
i -= 1; i -= 1;
@ -91,7 +91,7 @@ void Strings_Delete (CHAR *s, LONGINT s__len, INTEGER pos, INTEGER n)
s[__X(i - n, s__len)] = s[__X(i, s__len)]; s[__X(i - n, s__len)] = s[__X(i, s__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i - n) < s__len) { if ((int)(i - n) < s__len) {
s[__X(i - n, s__len)] = 0x00; s[__X(i - n, s__len)] = 0x00;
} }
} else { } else {
@ -121,7 +121,7 @@ void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n,
return; return;
} }
i = 0; i = 0;
while (((((LONGINT)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) { while (((((int)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) {
if (i < destLen) { if (i < destLen) {
dest[__X(i, dest__len)] = source[__X(pos + i, source__len)]; dest[__X(i, dest__len)] = source[__X(pos + i, source__len)];
} }

View file

@ -839,7 +839,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
k -= 16; k -= 16;
} }
while (j < i) { while (j < i) {
k = __ASHL(k, 4) + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = __ASHL(k, 4) + (int)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} }
if (neg) { if (neg) {
@ -929,7 +929,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
(*S).class = 3; (*S).class = 3;
k = 0; k = 0;
do { do {
k = k * 10 + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = k * 10 + (int)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} while (!(j == i)); } while (!(j == i));
if (neg) { if (neg) {
@ -1067,7 +1067,7 @@ void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n)
x0 = __DIV(x0, 10); x0 = __DIV(x0, 10);
i += 1; i += 1;
} while (!(x0 == 0)); } while (!(x0 == 0));
while (n > (LONGINT)i) { while (n > (int)i) {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
n -= 1; n -= 1;
} }
@ -1319,7 +1319,7 @@ void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER
} else { } else {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
} }
e = (int)__ASHR((LONGINT)(e - 1023) * 77, 8); e = (int)__ASHR((int)(e - 1023) * 77, 8);
if (e >= 0) { if (e >= 0) {
x = x / (LONGREAL)Reals_TenL(e); x = x / (LONGREAL)Reals_TenL(e);
} else { } else {

View file

@ -858,7 +858,7 @@ void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
{ {
CHAR b[4]; CHAR b[4];
Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4))); Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4)));
*x = ((LONGINT)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((LONGINT)b[2], 16)) + __ASHL((LONGINT)b[3], 24); *x = ((int)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((int)b[2], 16)) + __ASHL((int)b[3], 24);
} }
void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x) void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x)
@ -866,7 +866,7 @@ void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x)
CHAR b[4]; CHAR b[4];
LONGINT l; LONGINT l;
Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4))); Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4)));
l = ((LONGINT)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((LONGINT)b[2], 16)) + __ASHL((LONGINT)b[3], 24); l = ((int)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((int)b[2], 16)) + __ASHL((int)b[3], 24);
*x = (SET)l; *x = (SET)l;
} }
@ -923,11 +923,11 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
n = 0; n = 0;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
while ((int)ch >= 128) { while ((int)ch >= 128) {
n += __ASH((LONGINT)((int)ch - 128), s); n += __ASH((int)((int)ch - 128), s);
s += 7; s += 7;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
} }
n += __ASH((LONGINT)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s); n += __ASH((int)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s);
*x = n; *x = n;
} }

View file

@ -242,7 +242,7 @@ static INTEGER OPB_SignedByteSize (LONGINT n)
static LONGINT OPB_ShorterSize (LONGINT i) static LONGINT OPB_ShorterSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i >= (LONGINT)OPM_LIntSize) { if (i >= (int)OPM_LIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -255,7 +255,7 @@ static LONGINT OPB_ShorterSize (LONGINT i)
static LONGINT OPB_LongerSize (LONGINT i) static LONGINT OPB_LongerSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i <= (LONGINT)OPM_SIntSize) { if (i <= (int)OPM_SIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -520,7 +520,7 @@ void OPB_In (OPT_Node *x, OPT_Node y)
} else if ((__IN(f, 0x70) && y->typ->form == 9)) { } else if ((__IN(f, 0x70) && y->typ->form == 9)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (k < 0 || k > (LONGINT)OPM_MaxSet) { if (k < 0 || k > (int)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} else if (y->class == 7) { } else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval)); (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval));
@ -1201,7 +1201,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
OPB_err(203); OPB_err(203);
r = (LONGREAL)1; r = (LONGREAL)1;
} }
(*x)->conval->intval = (LONGINT)__ENTIER(r); (*x)->conval->intval = (int)__ENTIER(r);
OPB_SetIntType(*x); OPB_SetIntType(*x);
} }
} }
@ -1553,13 +1553,13 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
} else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) { } else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (0 > k || k > (LONGINT)OPM_MaxSet) { if (0 > k || k > (int)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
if (y->class == 7) { if (y->class == 7) {
l = y->conval->intval; l = y->conval->intval;
if (0 > l || l > (LONGINT)OPM_MaxSet) { if (0 > l || l > (int)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
@ -1589,7 +1589,7 @@ void OPB_SetElem (OPT_Node *x)
OPB_err(93); OPB_err(93);
} else if ((*x)->class == 7) { } else if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if ((0 <= k && k <= (LONGINT)OPM_MaxSet)) { if ((0 <= k && k <= (int)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k); (*x)->conval->setval = __SETOF(k);
} else { } else {
OPB_err(202); OPB_err(202);
@ -1894,7 +1894,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 10: case 10:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size > (LONGINT)OPM_SIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size > (int)OPM_SIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size)));
} else if (f == 8) { } else if (f == 8) {
OPB_Convert(&x, OPT_realtyp); OPB_Convert(&x, OPT_realtyp);
@ -1905,7 +1905,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 11: case 11:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size < (LONGINT)OPM_LIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size < (int)OPM_LIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size)));
} else if (f == 7) { } else if (f == 7) {
OPB_Convert(&x, OPT_lrltyp); OPB_Convert(&x, OPT_lrltyp);
@ -1954,7 +1954,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if (x->typ->size != (LONGINT)OPM_LIntSize) { if (x->typ->size != (int)OPM_LIntSize) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -1994,7 +1994,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (int)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }
@ -2092,7 +2092,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int)OPM_MaxSet))) {
OPB_err(202); OPB_err(202);
} }
p = NewOp__57(19, fctno, p, x); p = NewOp__57(19, fctno, p, x);
@ -2263,7 +2263,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (int)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }

View file

@ -318,7 +318,7 @@ void OPC_Andent (OPT_Struct typ)
static BOOLEAN OPC_Undefined (OPT_Object obj) static BOOLEAN OPC_Undefined (OPT_Object obj)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
_o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (LONGINT)(3 + OPM_currFile))) && obj->linkadr != 2); _o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (int)(3 + OPM_currFile))) && obj->linkadr != 2);
return _o_result; return _o_result;
} }
@ -826,7 +826,7 @@ void OPC_TDescDecl (OPT_Struct typ)
OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size); OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size);
nofptrs = 0; nofptrs = 0;
OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs); OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs);
OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (LONGINT)OPM_LIntSize)); OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (int)OPM_LIntSize));
OPC_EndStat(); OPC_EndStat();
} }
@ -872,7 +872,7 @@ LONGINT OPC_SizeAlignment (LONGINT size)
{ {
LONGINT _o_result; LONGINT _o_result;
LONGINT alignment; LONGINT alignment;
if (size < (LONGINT)OPM_Alignment) { if (size < (int)OPM_Alignment) {
alignment = 1; alignment = 1;
while (alignment < size) { while (alignment < size) {
alignment = __ASHL(alignment, 1); alignment = __ASHL(alignment, 1);
@ -909,11 +909,11 @@ static void OPC_FillGap (LONGINT gap, LONGINT off, LONGINT align, LONGINT *n, LO
if ((*curAlign < align && gap - (adr - off) >= align)) { if ((*curAlign < align && gap - (adr - off) >= align)) {
gap -= (adr - off) + align; gap -= (adr - off) + align;
OPC_BegStat(); OPC_BegStat();
if (align == (LONGINT)OPM_IntSize) { if (align == (int)OPM_IntSize) {
OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8); OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8);
} else if (align == (LONGINT)OPM_LIntSize) { } else if (align == (int)OPM_LIntSize) {
OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8); OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8);
} else if (align == (LONGINT)OPM_LRealSize) { } else if (align == (int)OPM_LRealSize) {
OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9); OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9);
} }
OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n); OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n);
@ -978,7 +978,7 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, LONGINT *off, LONGINT *
} }
} }
if (last) { if (last) {
adr = typ->size - (LONGINT)__ASHR(typ->sysflag, 8); adr = typ->size - (int)__ASHR(typ->sysflag, 8);
if (adr == 0) { if (adr == 0) {
gap = 1; gap = 1;
} else { } else {

View file

@ -872,13 +872,13 @@ void OPM_WriteReal (LONGREAL r, CHAR suffx)
CHAR s[32]; CHAR s[32];
CHAR ch; CHAR ch;
INTEGER i; INTEGER i;
if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == ((LONGINT)__ENTIER(r)))) { if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == ((int)__ENTIER(r)))) {
if (suffx == 'f') { if (suffx == 'f') {
OPM_WriteString((CHAR*)"(REAL)", (LONGINT)7); OPM_WriteString((CHAR*)"(REAL)", (LONGINT)7);
} else { } else {
OPM_WriteString((CHAR*)"(LONGREAL)", (LONGINT)11); OPM_WriteString((CHAR*)"(LONGREAL)", (LONGINT)11);
} }
OPM_WriteInt((LONGINT)__ENTIER(r)); OPM_WriteInt((int)__ENTIER(r));
} else { } else {
Texts_OpenWriter(&W, Texts_Writer__typ); Texts_OpenWriter(&W, Texts_Writer__typ);
if (suffx == 'f') { if (suffx == 'f') {

View file

@ -173,7 +173,7 @@ static void OPS_Number (void)
OPS_numtyp = 1; OPS_numtyp = 1;
if (n <= 2) { if (n <= 2) {
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -188,7 +188,7 @@ static void OPS_Number (void)
OPS_intval = -1; OPS_intval = -1;
} }
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -199,8 +199,8 @@ static void OPS_Number (void)
while (i < n) { while (i < n) {
d = Ord__7(dig[i], 0); d = Ord__7(dig[i], 0);
i += 1; i += 1;
if (OPS_intval <= __DIV(2147483647 - (LONGINT)d, 10)) { if (OPS_intval <= __DIV(2147483647 - (int)d, 10)) {
OPS_intval = OPS_intval * 10 + (LONGINT)d; OPS_intval = OPS_intval * 10 + (int)d;
} else { } else {
OPS_err(203); OPS_err(203);
} }

View file

@ -86,7 +86,7 @@ void OPV_TypSize (OPT_Struct typ)
base = OPC_SizeAlignment(OPM_RecSize); base = OPC_SizeAlignment(OPM_RecSize);
} else { } else {
OPV_TypSize(btyp); OPV_TypSize(btyp);
offset = btyp->size - (LONGINT)__ASHR(btyp->sysflag, 8); offset = btyp->size - (int)__ASHR(btyp->sysflag, 8);
base = btyp->align; base = btyp->align;
} }
fld = typ->link; fld = typ->link;
@ -468,12 +468,10 @@ static void OPV_Entier (OPT_Node n, INTEGER prec)
static void OPV_SizeCast (LONGINT size) static void OPV_SizeCast (LONGINT size)
{ {
if (size <= (LONGINT)OPM_SIntSize) { if (size <= 4) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else if (size <= (LONGINT)OPM_IntSize) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6); OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else { } else {
OPM_WriteString((CHAR*)"(LONGINT)", (LONGINT)10); OPM_WriteString((CHAR*)"(SYSTEM_INT64)", (LONGINT)15);
} }
} }
@ -650,7 +648,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
} }
if (n->typ->comp == 3) { if (n->typ->comp == 3) {
OPM_Write(')'); OPM_Write(')');
while ((LONGINT)i < __ASHR(d->typ->size - 4, 2)) { while ((int)i < __ASHR(d->typ->size - 4, 2)) {
OPM_WriteString((CHAR*)" * ", (LONGINT)4); OPM_WriteString((CHAR*)" * ", (LONGINT)4);
OPV_Len(d, i); OPV_Len(d, i);
i += 1; i += 1;

View file

@ -89,8 +89,8 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
} }
k = 0; k = 0;
if (n > 9) { if (n > 9) {
i = (LONGINT)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000); i = (int)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000);
j = (LONGINT)__ENTIER(x - i * (LONGREAL)1000000000); j = (int)__ENTIER(x - i * (LONGREAL)1000000000);
if (j < 0) { if (j < 0) {
j = 0; j = 0;
} }
@ -100,9 +100,9 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
k += 1; k += 1;
} }
} else { } else {
i = (LONGINT)__ENTIER(x); i = (int)__ENTIER(x);
} }
while (k < (LONGINT)n) { while (k < (int)n) {
d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48); d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48);
i = __DIV(i, 10); i = __DIV(i, 10);
k += 1; k += 1;
@ -134,7 +134,7 @@ static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LO
CHAR by; CHAR by;
i = 0; i = 0;
l = b__len; l = b__len;
while ((LONGINT)i < l) { while ((int)i < l) {
by = __VAL(CHAR, b[__X(i, b__len)]); by = __VAL(CHAR, b[__X(i, b__len)]);
d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4)); d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4));
d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16)); d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16));

View file

@ -1,30 +1,40 @@
#ifndef SYSTEM__h #ifndef SYSTEM__h
#define SYSTEM__h #define SYSTEM__h
#ifndef _WIN32 #if defined(_WIN64)
typedef long long SYSTEM_INT64;
// Building for a Unix/Linux based system typedef unsigned long long SYSTEM_CARD64;
// TODO: Remove these includes
#include <string.h> // For memcpy ...
#include <stdint.h> // For uintptr_t ...
#else #else
typedef long SYSTEM_INT64;
// Building for Windows platform with either mingw under cygwin, or the MS C compiler typedef unsigned long SYSTEM_CARD64;
#ifdef _WIN64
typedef unsigned long long size_t;
typedef unsigned long long uintptr_t;
#else
typedef unsigned int size_t;
typedef unsigned int uintptr_t;
#endif /* _WIN64 */
typedef unsigned int uint32_t;
void * __cdecl memcpy(void * dest, const void * source, size_t size);
#endif #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;
#if (__SIZEOF_POINTER__ == 8)
#if defined(_WIN64)
typedef unsigned long long SYSTEM_PTRINT;
typedef unsigned long long uintptr_t;
typedef unsigned long long size_t;
#else
typedef unsigned long SYSTEM_PTRINT;
typedef unsigned long uintptr_t;
typedef unsigned long size_t;
#endif
#else
typedef unsigned int SYSTEM_PTRINT;
typedef unsigned int uintptr_t;
typedef unsigned int size_t;
#endif
void * __cdecl memcpy(void *dest, const void *source, size_t size);
// The compiler uses 'import' and 'export' which translate to 'extern' and // The compiler uses 'import' and 'export' which translate to 'extern' and
// nothing respectively. // nothing respectively.

View file

@ -21,7 +21,7 @@ INTEGER Strings_Length (CHAR *s, LONGINT s__len)
INTEGER i; INTEGER i;
__DUP(s, s__len, CHAR); __DUP(s, s__len, CHAR);
i = 0; i = 0;
while (((LONGINT)i < s__len && s[__X(i, s__len)] != 0x00)) { while (((int)i < s__len && s[__X(i, s__len)] != 0x00)) {
i += 1; i += 1;
} }
_o_result = i; _o_result = i;
@ -36,11 +36,11 @@ void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__
n1 = Strings_Length(dest, dest__len); n1 = Strings_Length(dest, dest__len);
n2 = Strings_Length(extra, extra__len); n2 = Strings_Length(extra, extra__len);
i = 0; i = 0;
while ((i < n2 && (LONGINT)(i + n1) < dest__len)) { while ((i < n2 && (int)(i + n1) < dest__len)) {
dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)]; dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i + n1) < dest__len) { if ((int)(i + n1) < dest__len) {
dest[__X(i + n1, dest__len)] = 0x00; dest[__X(i + n1, dest__len)] = 0x00;
} }
__DEL(extra); __DEL(extra);
@ -59,10 +59,10 @@ void Strings_Insert (CHAR *source, LONGINT source__len, INTEGER pos, CHAR *dest,
Strings_Append(dest, dest__len, (void*)source, source__len); Strings_Append(dest, dest__len, (void*)source, source__len);
return; return;
} }
if ((LONGINT)(pos + n2) < dest__len) { if ((int)(pos + n2) < dest__len) {
i = n1; i = n1;
while (i >= pos) { while (i >= pos) {
if ((LONGINT)(i + n2) < dest__len) { if ((int)(i + n2) < dest__len) {
dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)]; dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)];
} }
i -= 1; i -= 1;
@ -91,7 +91,7 @@ void Strings_Delete (CHAR *s, LONGINT s__len, INTEGER pos, INTEGER n)
s[__X(i - n, s__len)] = s[__X(i, s__len)]; s[__X(i - n, s__len)] = s[__X(i, s__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i - n) < s__len) { if ((int)(i - n) < s__len) {
s[__X(i - n, s__len)] = 0x00; s[__X(i - n, s__len)] = 0x00;
} }
} else { } else {
@ -121,7 +121,7 @@ void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n,
return; return;
} }
i = 0; i = 0;
while (((((LONGINT)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) { while (((((int)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) {
if (i < destLen) { if (i < destLen) {
dest[__X(i, dest__len)] = source[__X(pos + i, source__len)]; dest[__X(i, dest__len)] = source[__X(pos + i, source__len)];
} }

View file

@ -839,7 +839,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
k -= 16; k -= 16;
} }
while (j < i) { while (j < i) {
k = __ASHL(k, 4) + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = __ASHL(k, 4) + (int)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} }
if (neg) { if (neg) {
@ -929,7 +929,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
(*S).class = 3; (*S).class = 3;
k = 0; k = 0;
do { do {
k = k * 10 + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = k * 10 + (int)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} while (!(j == i)); } while (!(j == i));
if (neg) { if (neg) {
@ -1067,7 +1067,7 @@ void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n)
x0 = __DIV(x0, 10); x0 = __DIV(x0, 10);
i += 1; i += 1;
} while (!(x0 == 0)); } while (!(x0 == 0));
while (n > (LONGINT)i) { while (n > (int)i) {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
n -= 1; n -= 1;
} }
@ -1319,7 +1319,7 @@ void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER
} else { } else {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
} }
e = (int)__ASHR((LONGINT)(e - 1023) * 77, 8); e = (int)__ASHR((int)(e - 1023) * 77, 8);
if (e >= 0) { if (e >= 0) {
x = x / (LONGREAL)Reals_TenL(e); x = x / (LONGREAL)Reals_TenL(e);
} else { } else {

View file

@ -924,11 +924,11 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
n = 0; n = 0;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
while ((int)ch >= 128) { while ((int)ch >= 128) {
n += __ASH((LONGINT)((int)ch - 128), s); n += __ASH((SYSTEM_INT64)((int)ch - 128), s);
s += 7; s += 7;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
} }
n += __ASH((LONGINT)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s); n += __ASH((SYSTEM_INT64)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s);
*x = n; *x = n;
} }

View file

@ -243,7 +243,7 @@ static INTEGER OPB_SignedByteSize (LONGINT n)
static LONGINT OPB_ShorterSize (LONGINT i) static LONGINT OPB_ShorterSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i >= (LONGINT)OPM_LIntSize) { if (i >= (SYSTEM_INT64)OPM_LIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -256,7 +256,7 @@ static LONGINT OPB_ShorterSize (LONGINT i)
static LONGINT OPB_LongerSize (LONGINT i) static LONGINT OPB_LongerSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i <= (LONGINT)OPM_SIntSize) { if (i <= (SYSTEM_INT64)OPM_SIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -521,7 +521,7 @@ void OPB_In (OPT_Node *x, OPT_Node y)
} else if ((__IN(f, 0x70) && y->typ->form == 9)) { } else if ((__IN(f, 0x70) && y->typ->form == 9)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (k < 0 || k > (LONGINT)OPM_MaxSet) { if (k < 0 || k > (SYSTEM_INT64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} else if (y->class == 7) { } else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval)); (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval));
@ -1554,13 +1554,13 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
} else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) { } else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (0 > k || k > (LONGINT)OPM_MaxSet) { if (0 > k || k > (SYSTEM_INT64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
if (y->class == 7) { if (y->class == 7) {
l = y->conval->intval; l = y->conval->intval;
if (0 > l || l > (LONGINT)OPM_MaxSet) { if (0 > l || l > (SYSTEM_INT64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
@ -1590,7 +1590,7 @@ void OPB_SetElem (OPT_Node *x)
OPB_err(93); OPB_err(93);
} else if ((*x)->class == 7) { } else if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if ((0 <= k && k <= (LONGINT)OPM_MaxSet)) { if ((0 <= k && k <= (SYSTEM_INT64)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k); (*x)->conval->setval = __SETOF(k);
} else { } else {
OPB_err(202); OPB_err(202);
@ -1895,7 +1895,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 10: case 10:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size > (LONGINT)OPM_SIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size > (SYSTEM_INT64)OPM_SIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size)));
} else if (f == 8) { } else if (f == 8) {
OPB_Convert(&x, OPT_realtyp); OPB_Convert(&x, OPT_realtyp);
@ -1906,7 +1906,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 11: case 11:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size < (LONGINT)OPM_LIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size < (SYSTEM_INT64)OPM_LIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size)));
} else if (f == 7) { } else if (f == 7) {
OPB_Convert(&x, OPT_lrltyp); OPB_Convert(&x, OPT_lrltyp);
@ -1955,7 +1955,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if (x->typ->size != (LONGINT)OPM_LIntSize) { if (x->typ->size != (SYSTEM_INT64)OPM_LIntSize) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -1995,7 +1995,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (SYSTEM_INT64)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }
@ -2093,7 +2093,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (SYSTEM_INT64)OPM_MaxSet))) {
OPB_err(202); OPB_err(202);
} }
p = NewOp__57(19, fctno, p, x); p = NewOp__57(19, fctno, p, x);
@ -2264,7 +2264,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (SYSTEM_INT64)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }

View file

@ -319,7 +319,7 @@ void OPC_Andent (OPT_Struct typ)
static BOOLEAN OPC_Undefined (OPT_Object obj) static BOOLEAN OPC_Undefined (OPT_Object obj)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
_o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (LONGINT)(3 + OPM_currFile))) && obj->linkadr != 2); _o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (SYSTEM_INT64)(3 + OPM_currFile))) && obj->linkadr != 2);
return _o_result; return _o_result;
} }
@ -827,7 +827,7 @@ void OPC_TDescDecl (OPT_Struct typ)
OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size); OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size);
nofptrs = 0; nofptrs = 0;
OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs); OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs);
OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (LONGINT)OPM_LIntSize)); OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (SYSTEM_INT64)OPM_LIntSize));
OPC_EndStat(); OPC_EndStat();
} }
@ -873,7 +873,7 @@ LONGINT OPC_SizeAlignment (LONGINT size)
{ {
LONGINT _o_result; LONGINT _o_result;
LONGINT alignment; LONGINT alignment;
if (size < (LONGINT)OPM_Alignment) { if (size < (SYSTEM_INT64)OPM_Alignment) {
alignment = 1; alignment = 1;
while (alignment < size) { while (alignment < size) {
alignment = __ASHL(alignment, 1); alignment = __ASHL(alignment, 1);
@ -910,11 +910,11 @@ static void OPC_FillGap (LONGINT gap, LONGINT off, LONGINT align, LONGINT *n, LO
if ((*curAlign < align && gap - (adr - off) >= align)) { if ((*curAlign < align && gap - (adr - off) >= align)) {
gap -= (adr - off) + align; gap -= (adr - off) + align;
OPC_BegStat(); OPC_BegStat();
if (align == (LONGINT)OPM_IntSize) { if (align == (SYSTEM_INT64)OPM_IntSize) {
OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8); OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8);
} else if (align == (LONGINT)OPM_LIntSize) { } else if (align == (SYSTEM_INT64)OPM_LIntSize) {
OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8); OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8);
} else if (align == (LONGINT)OPM_LRealSize) { } else if (align == (SYSTEM_INT64)OPM_LRealSize) {
OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9); OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9);
} }
OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n); OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n);
@ -979,7 +979,7 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, LONGINT *off, LONGINT *
} }
} }
if (last) { if (last) {
adr = typ->size - (LONGINT)__ASHR(typ->sysflag, 8); adr = typ->size - (SYSTEM_INT64)__ASHR(typ->sysflag, 8);
if (adr == 0) { if (adr == 0) {
gap = 1; gap = 1;
} else { } else {

View file

@ -174,7 +174,7 @@ static void OPS_Number (void)
OPS_numtyp = 1; OPS_numtyp = 1;
if (n <= 2) { if (n <= 2) {
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (SYSTEM_INT64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -189,7 +189,7 @@ static void OPS_Number (void)
OPS_intval = -1; OPS_intval = -1;
} }
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (SYSTEM_INT64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -200,8 +200,8 @@ static void OPS_Number (void)
while (i < n) { while (i < n) {
d = Ord__7(dig[i], 0); d = Ord__7(dig[i], 0);
i += 1; i += 1;
if (OPS_intval <= __DIV(9223372036854775807 - (LONGINT)d, 10)) { if (OPS_intval <= __DIV(9223372036854775807 - (SYSTEM_INT64)d, 10)) {
OPS_intval = OPS_intval * 10 + (LONGINT)d; OPS_intval = OPS_intval * 10 + (SYSTEM_INT64)d;
} else { } else {
OPS_err(203); OPS_err(203);
} }

View file

@ -87,7 +87,7 @@ void OPV_TypSize (OPT_Struct typ)
base = OPC_SizeAlignment(OPM_RecSize); base = OPC_SizeAlignment(OPM_RecSize);
} else { } else {
OPV_TypSize(btyp); OPV_TypSize(btyp);
offset = btyp->size - (LONGINT)__ASHR(btyp->sysflag, 8); offset = btyp->size - (SYSTEM_INT64)__ASHR(btyp->sysflag, 8);
base = btyp->align; base = btyp->align;
} }
fld = typ->link; fld = typ->link;
@ -469,12 +469,10 @@ static void OPV_Entier (OPT_Node n, INTEGER prec)
static void OPV_SizeCast (LONGINT size) static void OPV_SizeCast (LONGINT size)
{ {
if (size <= (LONGINT)OPM_SIntSize) { if (size <= 4) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else if (size <= (LONGINT)OPM_IntSize) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6); OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else { } else {
OPM_WriteString((CHAR*)"(LONGINT)", (LONGINT)10); OPM_WriteString((CHAR*)"(SYSTEM_INT64)", (LONGINT)15);
} }
} }
@ -651,7 +649,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
} }
if (n->typ->comp == 3) { if (n->typ->comp == 3) {
OPM_Write(')'); OPM_Write(')');
while ((LONGINT)i < __ASHR(d->typ->size - 4, 2)) { while ((SYSTEM_INT64)i < __ASHR(d->typ->size - 4, 2)) {
OPM_WriteString((CHAR*)" * ", (LONGINT)4); OPM_WriteString((CHAR*)" * ", (LONGINT)4);
OPV_Len(d, i); OPV_Len(d, i);
i += 1; i += 1;

View file

@ -90,7 +90,7 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
} }
k = 0; k = 0;
i = __ENTIER(x); i = __ENTIER(x);
while (k < (LONGINT)n) { while (k < (SYSTEM_INT64)n) {
d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48); d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48);
i = __DIV(i, 10); i = __DIV(i, 10);
k += 1; k += 1;
@ -122,7 +122,7 @@ static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LO
CHAR by; CHAR by;
i = 0; i = 0;
l = b__len; l = b__len;
while ((LONGINT)i < l) { while ((SYSTEM_INT64)i < l) {
by = __VAL(CHAR, b[__X(i, b__len)]); by = __VAL(CHAR, b[__X(i, b__len)]);
d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4)); d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4));
d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16)); d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16));

View file

@ -1,30 +1,40 @@
#ifndef SYSTEM__h #ifndef SYSTEM__h
#define SYSTEM__h #define SYSTEM__h
#ifndef _WIN32 #if defined(_WIN64)
typedef long long SYSTEM_INT64;
// Building for a Unix/Linux based system typedef unsigned long long SYSTEM_CARD64;
// TODO: Remove these includes
#include <string.h> // For memcpy ...
#include <stdint.h> // For uintptr_t ...
#else #else
typedef long SYSTEM_INT64;
// Building for Windows platform with either mingw under cygwin, or the MS C compiler typedef unsigned long SYSTEM_CARD64;
#ifdef _WIN64
typedef unsigned long long size_t;
typedef unsigned long long uintptr_t;
#else
typedef unsigned int size_t;
typedef unsigned int uintptr_t;
#endif /* _WIN64 */
typedef unsigned int uint32_t;
void * __cdecl memcpy(void * dest, const void * source, size_t size);
#endif #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;
#if (__SIZEOF_POINTER__ == 8)
#if defined(_WIN64)
typedef unsigned long long SYSTEM_PTRINT;
typedef unsigned long long uintptr_t;
typedef unsigned long long size_t;
#else
typedef unsigned long SYSTEM_PTRINT;
typedef unsigned long uintptr_t;
typedef unsigned long size_t;
#endif
#else
typedef unsigned int SYSTEM_PTRINT;
typedef unsigned int uintptr_t;
typedef unsigned int size_t;
#endif
void * __cdecl memcpy(void *dest, const void *source, size_t size);
// The compiler uses 'import' and 'export' which translate to 'extern' and // The compiler uses 'import' and 'export' which translate to 'extern' and
// nothing respectively. // nothing respectively.

View file

@ -22,7 +22,7 @@ INTEGER Strings_Length (CHAR *s, LONGINT s__len)
INTEGER i; INTEGER i;
__DUP(s, s__len, CHAR); __DUP(s, s__len, CHAR);
i = 0; i = 0;
while (((LONGINT)i < s__len && s[__X(i, s__len)] != 0x00)) { while (((SYSTEM_INT64)i < s__len && s[__X(i, s__len)] != 0x00)) {
i += 1; i += 1;
} }
_o_result = i; _o_result = i;
@ -37,11 +37,11 @@ void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__
n1 = Strings_Length(dest, dest__len); n1 = Strings_Length(dest, dest__len);
n2 = Strings_Length(extra, extra__len); n2 = Strings_Length(extra, extra__len);
i = 0; i = 0;
while ((i < n2 && (LONGINT)(i + n1) < dest__len)) { while ((i < n2 && (SYSTEM_INT64)(i + n1) < dest__len)) {
dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)]; dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i + n1) < dest__len) { if ((SYSTEM_INT64)(i + n1) < dest__len) {
dest[__X(i + n1, dest__len)] = 0x00; dest[__X(i + n1, dest__len)] = 0x00;
} }
__DEL(extra); __DEL(extra);
@ -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); Strings_Append(dest, dest__len, (void*)source, source__len);
return; return;
} }
if ((LONGINT)(pos + n2) < dest__len) { if ((SYSTEM_INT64)(pos + n2) < dest__len) {
i = n1; i = n1;
while (i >= pos) { while (i >= pos) {
if ((LONGINT)(i + n2) < dest__len) { if ((SYSTEM_INT64)(i + n2) < dest__len) {
dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)]; dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)];
} }
i -= 1; i -= 1;
@ -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)]; s[__X(i - n, s__len)] = s[__X(i, s__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i - n) < s__len) { if ((SYSTEM_INT64)(i - n) < s__len) {
s[__X(i - n, s__len)] = 0x00; s[__X(i - n, s__len)] = 0x00;
} }
} else { } else {
@ -122,7 +122,7 @@ void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n,
return; return;
} }
i = 0; i = 0;
while (((((LONGINT)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) { while (((((SYSTEM_INT64)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) {
if (i < destLen) { if (i < destLen) {
dest[__X(i, dest__len)] = source[__X(pos + i, source__len)]; dest[__X(i, dest__len)] = source[__X(pos + i, source__len)];
} }

View file

@ -840,7 +840,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
k -= 16; k -= 16;
} }
while (j < i) { while (j < i) {
k = __ASHL(k, 4) + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = __ASHL(k, 4) + (SYSTEM_INT64)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} }
if (neg) { if (neg) {
@ -930,7 +930,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
(*S).class = 3; (*S).class = 3;
k = 0; k = 0;
do { do {
k = k * 10 + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = k * 10 + (SYSTEM_INT64)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} while (!(j == i)); } while (!(j == i));
if (neg) { if (neg) {
@ -1068,7 +1068,7 @@ void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n)
x0 = __DIV(x0, 10); x0 = __DIV(x0, 10);
i += 1; i += 1;
} while (!(x0 == 0)); } while (!(x0 == 0));
while (n > (LONGINT)i) { while (n > (SYSTEM_INT64)i) {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
n -= 1; n -= 1;
} }
@ -1320,7 +1320,7 @@ void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER
} else { } else {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
} }
e = (int)__ASHR((LONGINT)(e - 1023) * 77, 8); e = (int)__ASHR((SYSTEM_INT64)(e - 1023) * 77, 8);
if (e >= 0) { if (e >= 0) {
x = x / (LONGREAL)Reals_TenL(e); x = x / (LONGREAL)Reals_TenL(e);
} else { } else {

View file

@ -858,7 +858,7 @@ void Files_ReadLInt (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
{ {
CHAR b[4]; CHAR b[4];
Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4))); Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4)));
*x = ((LONGINT)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((LONGINT)b[2], 16)) + __ASHL((LONGINT)b[3], 24); *x = ((int)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((int)b[2], 16)) + __ASHL((int)b[3], 24);
} }
void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x) void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x)
@ -866,7 +866,7 @@ void Files_ReadSet (Files_Rider *R, LONGINT *R__typ, SET *x)
CHAR b[4]; CHAR b[4];
LONGINT l; LONGINT l;
Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4))); Files_ReadBytes(&*R, R__typ, (void*)b, ((LONGINT)(4)), ((LONGINT)(4)));
l = ((LONGINT)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((LONGINT)b[2], 16)) + __ASHL((LONGINT)b[3], 24); l = ((int)((int)b[0] + __ASHL((int)b[1], 8)) + __ASHL((int)b[2], 16)) + __ASHL((int)b[3], 24);
*x = (SET)l; *x = (SET)l;
} }
@ -923,11 +923,11 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
n = 0; n = 0;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
while ((int)ch >= 128) { while ((int)ch >= 128) {
n += __ASH((LONGINT)((int)ch - 128), s); n += __ASH((int)((int)ch - 128), s);
s += 7; s += 7;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
} }
n += __ASH((LONGINT)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s); n += __ASH((int)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s);
*x = n; *x = n;
} }

View file

@ -242,7 +242,7 @@ static INTEGER OPB_SignedByteSize (LONGINT n)
static LONGINT OPB_ShorterSize (LONGINT i) static LONGINT OPB_ShorterSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i >= (LONGINT)OPM_LIntSize) { if (i >= (int)OPM_LIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -255,7 +255,7 @@ static LONGINT OPB_ShorterSize (LONGINT i)
static LONGINT OPB_LongerSize (LONGINT i) static LONGINT OPB_LongerSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i <= (LONGINT)OPM_SIntSize) { if (i <= (int)OPM_SIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -520,7 +520,7 @@ void OPB_In (OPT_Node *x, OPT_Node y)
} else if ((__IN(f, 0x70) && y->typ->form == 9)) { } else if ((__IN(f, 0x70) && y->typ->form == 9)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (k < 0 || k > (LONGINT)OPM_MaxSet) { if (k < 0 || k > (int)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} else if (y->class == 7) { } else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval)); (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval));
@ -1201,7 +1201,7 @@ static void OPB_Convert (OPT_Node *x, OPT_Struct typ)
OPB_err(203); OPB_err(203);
r = (LONGREAL)1; r = (LONGREAL)1;
} }
(*x)->conval->intval = (LONGINT)__ENTIER(r); (*x)->conval->intval = (int)__ENTIER(r);
OPB_SetIntType(*x); OPB_SetIntType(*x);
} }
} }
@ -1553,13 +1553,13 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
} else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) { } else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (0 > k || k > (LONGINT)OPM_MaxSet) { if (0 > k || k > (int)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
if (y->class == 7) { if (y->class == 7) {
l = y->conval->intval; l = y->conval->intval;
if (0 > l || l > (LONGINT)OPM_MaxSet) { if (0 > l || l > (int)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
@ -1589,7 +1589,7 @@ void OPB_SetElem (OPT_Node *x)
OPB_err(93); OPB_err(93);
} else if ((*x)->class == 7) { } else if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if ((0 <= k && k <= (LONGINT)OPM_MaxSet)) { if ((0 <= k && k <= (int)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k); (*x)->conval->setval = __SETOF(k);
} else { } else {
OPB_err(202); OPB_err(202);
@ -1894,7 +1894,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 10: case 10:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size > (LONGINT)OPM_SIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size > (int)OPM_SIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size)));
} else if (f == 8) { } else if (f == 8) {
OPB_Convert(&x, OPT_realtyp); OPB_Convert(&x, OPT_realtyp);
@ -1905,7 +1905,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 11: case 11:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size < (LONGINT)OPM_LIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size < (int)OPM_LIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size)));
} else if (f == 7) { } else if (f == 7) {
OPB_Convert(&x, OPT_lrltyp); OPB_Convert(&x, OPT_lrltyp);
@ -1954,7 +1954,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if (x->typ->size != (LONGINT)OPM_LIntSize) { if (x->typ->size != (int)OPM_LIntSize) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -1994,7 +1994,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (int)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }
@ -2092,7 +2092,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (int)OPM_MaxSet))) {
OPB_err(202); OPB_err(202);
} }
p = NewOp__57(19, fctno, p, x); p = NewOp__57(19, fctno, p, x);
@ -2263,7 +2263,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (int)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }

View file

@ -318,7 +318,7 @@ void OPC_Andent (OPT_Struct typ)
static BOOLEAN OPC_Undefined (OPT_Object obj) static BOOLEAN OPC_Undefined (OPT_Object obj)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
_o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (LONGINT)(3 + OPM_currFile))) && obj->linkadr != 2); _o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (int)(3 + OPM_currFile))) && obj->linkadr != 2);
return _o_result; return _o_result;
} }
@ -826,7 +826,7 @@ void OPC_TDescDecl (OPT_Struct typ)
OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size); OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size);
nofptrs = 0; nofptrs = 0;
OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs); OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs);
OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (LONGINT)OPM_LIntSize)); OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (int)OPM_LIntSize));
OPC_EndStat(); OPC_EndStat();
} }
@ -872,7 +872,7 @@ LONGINT OPC_SizeAlignment (LONGINT size)
{ {
LONGINT _o_result; LONGINT _o_result;
LONGINT alignment; LONGINT alignment;
if (size < (LONGINT)OPM_Alignment) { if (size < (int)OPM_Alignment) {
alignment = 1; alignment = 1;
while (alignment < size) { while (alignment < size) {
alignment = __ASHL(alignment, 1); alignment = __ASHL(alignment, 1);
@ -909,11 +909,11 @@ static void OPC_FillGap (LONGINT gap, LONGINT off, LONGINT align, LONGINT *n, LO
if ((*curAlign < align && gap - (adr - off) >= align)) { if ((*curAlign < align && gap - (adr - off) >= align)) {
gap -= (adr - off) + align; gap -= (adr - off) + align;
OPC_BegStat(); OPC_BegStat();
if (align == (LONGINT)OPM_IntSize) { if (align == (int)OPM_IntSize) {
OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8); OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8);
} else if (align == (LONGINT)OPM_LIntSize) { } else if (align == (int)OPM_LIntSize) {
OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8); OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8);
} else if (align == (LONGINT)OPM_LRealSize) { } else if (align == (int)OPM_LRealSize) {
OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9); OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9);
} }
OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n); OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n);
@ -978,7 +978,7 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, LONGINT *off, LONGINT *
} }
} }
if (last) { if (last) {
adr = typ->size - (LONGINT)__ASHR(typ->sysflag, 8); adr = typ->size - (int)__ASHR(typ->sysflag, 8);
if (adr == 0) { if (adr == 0) {
gap = 1; gap = 1;
} else { } else {

View file

@ -872,13 +872,13 @@ void OPM_WriteReal (LONGREAL r, CHAR suffx)
CHAR s[32]; CHAR s[32];
CHAR ch; CHAR ch;
INTEGER i; INTEGER i;
if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == ((LONGINT)__ENTIER(r)))) { if ((((r < OPM_SignedMaximum(OPM_LIntSize) && r > OPM_SignedMinimum(OPM_LIntSize))) && r == ((int)__ENTIER(r)))) {
if (suffx == 'f') { if (suffx == 'f') {
OPM_WriteString((CHAR*)"(REAL)", (LONGINT)7); OPM_WriteString((CHAR*)"(REAL)", (LONGINT)7);
} else { } else {
OPM_WriteString((CHAR*)"(LONGREAL)", (LONGINT)11); OPM_WriteString((CHAR*)"(LONGREAL)", (LONGINT)11);
} }
OPM_WriteInt((LONGINT)__ENTIER(r)); OPM_WriteInt((int)__ENTIER(r));
} else { } else {
Texts_OpenWriter(&W, Texts_Writer__typ); Texts_OpenWriter(&W, Texts_Writer__typ);
if (suffx == 'f') { if (suffx == 'f') {

View file

@ -173,7 +173,7 @@ static void OPS_Number (void)
OPS_numtyp = 1; OPS_numtyp = 1;
if (n <= 2) { if (n <= 2) {
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -188,7 +188,7 @@ static void OPS_Number (void)
OPS_intval = -1; OPS_intval = -1;
} }
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (int)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -199,8 +199,8 @@ static void OPS_Number (void)
while (i < n) { while (i < n) {
d = Ord__7(dig[i], 0); d = Ord__7(dig[i], 0);
i += 1; i += 1;
if (OPS_intval <= __DIV(2147483647 - (LONGINT)d, 10)) { if (OPS_intval <= __DIV(2147483647 - (int)d, 10)) {
OPS_intval = OPS_intval * 10 + (LONGINT)d; OPS_intval = OPS_intval * 10 + (int)d;
} else { } else {
OPS_err(203); OPS_err(203);
} }

View file

@ -86,7 +86,7 @@ void OPV_TypSize (OPT_Struct typ)
base = OPC_SizeAlignment(OPM_RecSize); base = OPC_SizeAlignment(OPM_RecSize);
} else { } else {
OPV_TypSize(btyp); OPV_TypSize(btyp);
offset = btyp->size - (LONGINT)__ASHR(btyp->sysflag, 8); offset = btyp->size - (int)__ASHR(btyp->sysflag, 8);
base = btyp->align; base = btyp->align;
} }
fld = typ->link; fld = typ->link;
@ -468,12 +468,10 @@ static void OPV_Entier (OPT_Node n, INTEGER prec)
static void OPV_SizeCast (LONGINT size) static void OPV_SizeCast (LONGINT size)
{ {
if (size <= (LONGINT)OPM_SIntSize) { if (size <= 4) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else if (size <= (LONGINT)OPM_IntSize) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6); OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else { } else {
OPM_WriteString((CHAR*)"(LONGINT)", (LONGINT)10); OPM_WriteString((CHAR*)"(SYSTEM_INT64)", (LONGINT)15);
} }
} }
@ -650,7 +648,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
} }
if (n->typ->comp == 3) { if (n->typ->comp == 3) {
OPM_Write(')'); OPM_Write(')');
while ((LONGINT)i < __ASHR(d->typ->size - 4, 2)) { while ((int)i < __ASHR(d->typ->size - 4, 2)) {
OPM_WriteString((CHAR*)" * ", (LONGINT)4); OPM_WriteString((CHAR*)" * ", (LONGINT)4);
OPV_Len(d, i); OPV_Len(d, i);
i += 1; i += 1;

View file

@ -334,8 +334,8 @@ void Platform_SetBadInstructionHandler (Platform_SignalHandler handler)
static void Platform_YMDHMStoClock (INTEGER ye, INTEGER mo, INTEGER da, INTEGER ho, INTEGER mi, INTEGER se, LONGINT *t, LONGINT *d) static void Platform_YMDHMStoClock (INTEGER ye, INTEGER mo, INTEGER da, INTEGER ho, INTEGER mi, INTEGER se, LONGINT *t, LONGINT *d)
{ {
*d = (__ASHL((LONGINT)(int)__MOD(ye, 100), 9) + __ASHL((LONGINT)(mo + 1), 5)) + (LONGINT)da; *d = (__ASHL((int)(int)__MOD(ye, 100), 9) + __ASHL((int)(mo + 1), 5)) + (int)da;
*t = (__ASHL((LONGINT)ho, 12) + __ASHL((LONGINT)mi, 6)) + (LONGINT)se; *t = (__ASHL((int)ho, 12) + __ASHL((int)mi, 6)) + (int)se;
} }
void Platform_GetClock (LONGINT *t, LONGINT *d) void Platform_GetClock (LONGINT *t, LONGINT *d)

View file

@ -89,8 +89,8 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
} }
k = 0; k = 0;
if (n > 9) { if (n > 9) {
i = (LONGINT)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000); i = (int)__ENTIER(x / (LONGREAL)(LONGREAL)1000000000);
j = (LONGINT)__ENTIER(x - i * (LONGREAL)1000000000); j = (int)__ENTIER(x - i * (LONGREAL)1000000000);
if (j < 0) { if (j < 0) {
j = 0; j = 0;
} }
@ -100,9 +100,9 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
k += 1; k += 1;
} }
} else { } else {
i = (LONGINT)__ENTIER(x); i = (int)__ENTIER(x);
} }
while (k < (LONGINT)n) { while (k < (int)n) {
d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48); d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48);
i = __DIV(i, 10); i = __DIV(i, 10);
k += 1; k += 1;
@ -134,7 +134,7 @@ static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LO
CHAR by; CHAR by;
i = 0; i = 0;
l = b__len; l = b__len;
while ((LONGINT)i < l) { while ((int)i < l) {
by = __VAL(CHAR, b[__X(i, b__len)]); by = __VAL(CHAR, b[__X(i, b__len)]);
d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4)); d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4));
d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16)); d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16));

View file

@ -1,30 +1,40 @@
#ifndef SYSTEM__h #ifndef SYSTEM__h
#define SYSTEM__h #define SYSTEM__h
#ifndef _WIN32 #if defined(_WIN64)
typedef long long SYSTEM_INT64;
// Building for a Unix/Linux based system typedef unsigned long long SYSTEM_CARD64;
// TODO: Remove these includes
#include <string.h> // For memcpy ...
#include <stdint.h> // For uintptr_t ...
#else #else
typedef long SYSTEM_INT64;
// Building for Windows platform with either mingw under cygwin, or the MS C compiler typedef unsigned long SYSTEM_CARD64;
#ifdef _WIN64
typedef unsigned long long size_t;
typedef unsigned long long uintptr_t;
#else
typedef unsigned int size_t;
typedef unsigned int uintptr_t;
#endif /* _WIN64 */
typedef unsigned int uint32_t;
void * __cdecl memcpy(void * dest, const void * source, size_t size);
#endif #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;
#if (__SIZEOF_POINTER__ == 8)
#if defined(_WIN64)
typedef unsigned long long SYSTEM_PTRINT;
typedef unsigned long long uintptr_t;
typedef unsigned long long size_t;
#else
typedef unsigned long SYSTEM_PTRINT;
typedef unsigned long uintptr_t;
typedef unsigned long size_t;
#endif
#else
typedef unsigned int SYSTEM_PTRINT;
typedef unsigned int uintptr_t;
typedef unsigned int size_t;
#endif
void * __cdecl memcpy(void *dest, const void *source, size_t size);
// The compiler uses 'import' and 'export' which translate to 'extern' and // The compiler uses 'import' and 'export' which translate to 'extern' and
// nothing respectively. // nothing respectively.

View file

@ -21,7 +21,7 @@ INTEGER Strings_Length (CHAR *s, LONGINT s__len)
INTEGER i; INTEGER i;
__DUP(s, s__len, CHAR); __DUP(s, s__len, CHAR);
i = 0; i = 0;
while (((LONGINT)i < s__len && s[__X(i, s__len)] != 0x00)) { while (((int)i < s__len && s[__X(i, s__len)] != 0x00)) {
i += 1; i += 1;
} }
_o_result = i; _o_result = i;
@ -36,11 +36,11 @@ void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__
n1 = Strings_Length(dest, dest__len); n1 = Strings_Length(dest, dest__len);
n2 = Strings_Length(extra, extra__len); n2 = Strings_Length(extra, extra__len);
i = 0; i = 0;
while ((i < n2 && (LONGINT)(i + n1) < dest__len)) { while ((i < n2 && (int)(i + n1) < dest__len)) {
dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)]; dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i + n1) < dest__len) { if ((int)(i + n1) < dest__len) {
dest[__X(i + n1, dest__len)] = 0x00; dest[__X(i + n1, dest__len)] = 0x00;
} }
__DEL(extra); __DEL(extra);
@ -59,10 +59,10 @@ void Strings_Insert (CHAR *source, LONGINT source__len, INTEGER pos, CHAR *dest,
Strings_Append(dest, dest__len, (void*)source, source__len); Strings_Append(dest, dest__len, (void*)source, source__len);
return; return;
} }
if ((LONGINT)(pos + n2) < dest__len) { if ((int)(pos + n2) < dest__len) {
i = n1; i = n1;
while (i >= pos) { while (i >= pos) {
if ((LONGINT)(i + n2) < dest__len) { if ((int)(i + n2) < dest__len) {
dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)]; dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)];
} }
i -= 1; i -= 1;
@ -91,7 +91,7 @@ void Strings_Delete (CHAR *s, LONGINT s__len, INTEGER pos, INTEGER n)
s[__X(i - n, s__len)] = s[__X(i, s__len)]; s[__X(i - n, s__len)] = s[__X(i, s__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i - n) < s__len) { if ((int)(i - n) < s__len) {
s[__X(i - n, s__len)] = 0x00; s[__X(i - n, s__len)] = 0x00;
} }
} else { } else {
@ -121,7 +121,7 @@ void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n,
return; return;
} }
i = 0; i = 0;
while (((((LONGINT)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) { while (((((int)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) {
if (i < destLen) { if (i < destLen) {
dest[__X(i, dest__len)] = source[__X(pos + i, source__len)]; dest[__X(i, dest__len)] = source[__X(pos + i, source__len)];
} }

View file

@ -839,7 +839,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
k -= 16; k -= 16;
} }
while (j < i) { while (j < i) {
k = __ASHL(k, 4) + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = __ASHL(k, 4) + (int)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} }
if (neg) { if (neg) {
@ -929,7 +929,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
(*S).class = 3; (*S).class = 3;
k = 0; k = 0;
do { do {
k = k * 10 + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = k * 10 + (int)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} while (!(j == i)); } while (!(j == i));
if (neg) { if (neg) {
@ -1067,7 +1067,7 @@ void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n)
x0 = __DIV(x0, 10); x0 = __DIV(x0, 10);
i += 1; i += 1;
} while (!(x0 == 0)); } while (!(x0 == 0));
while (n > (LONGINT)i) { while (n > (int)i) {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
n -= 1; n -= 1;
} }
@ -1319,7 +1319,7 @@ void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER
} else { } else {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
} }
e = (int)__ASHR((LONGINT)(e - 1023) * 77, 8); e = (int)__ASHR((int)(e - 1023) * 77, 8);
if (e >= 0) { if (e >= 0) {
x = x / (LONGREAL)Reals_TenL(e); x = x / (LONGREAL)Reals_TenL(e);
} else { } else {

View file

@ -924,11 +924,11 @@ void Files_ReadNum (Files_Rider *R, LONGINT *R__typ, LONGINT *x)
n = 0; n = 0;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
while ((int)ch >= 128) { while ((int)ch >= 128) {
n += __ASH((LONGINT)((int)ch - 128), s); n += __ASH((SYSTEM_INT64)((int)ch - 128), s);
s += 7; s += 7;
Files_Read(&*R, R__typ, (void*)&ch); Files_Read(&*R, R__typ, (void*)&ch);
} }
n += __ASH((LONGINT)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s); n += __ASH((SYSTEM_INT64)(__MASK((int)ch, -64) - __ASHL(__ASHR((int)ch, 6), 6)), s);
*x = n; *x = n;
} }

View file

@ -243,7 +243,7 @@ static INTEGER OPB_SignedByteSize (LONGINT n)
static LONGINT OPB_ShorterSize (LONGINT i) static LONGINT OPB_ShorterSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i >= (LONGINT)OPM_LIntSize) { if (i >= (SYSTEM_INT64)OPM_LIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -256,7 +256,7 @@ static LONGINT OPB_ShorterSize (LONGINT i)
static LONGINT OPB_LongerSize (LONGINT i) static LONGINT OPB_LongerSize (LONGINT i)
{ {
LONGINT _o_result; LONGINT _o_result;
if (i <= (LONGINT)OPM_SIntSize) { if (i <= (SYSTEM_INT64)OPM_SIntSize) {
_o_result = OPM_IntSize; _o_result = OPM_IntSize;
return _o_result; return _o_result;
} else { } else {
@ -521,7 +521,7 @@ void OPB_In (OPT_Node *x, OPT_Node y)
} else if ((__IN(f, 0x70) && y->typ->form == 9)) { } else if ((__IN(f, 0x70) && y->typ->form == 9)) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (k < 0 || k > (LONGINT)OPM_MaxSet) { if (k < 0 || k > (SYSTEM_INT64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} else if (y->class == 7) { } else if (y->class == 7) {
(*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval)); (*x)->conval->intval = OPB_BoolToInt(__IN(k, y->conval->setval));
@ -1554,13 +1554,13 @@ void OPB_SetRange (OPT_Node *x, OPT_Node y)
} else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) { } else if ((__IN((*x)->typ->form, 0x70) && __IN(y->typ->form, 0x70))) {
if ((*x)->class == 7) { if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if (0 > k || k > (LONGINT)OPM_MaxSet) { if (0 > k || k > (SYSTEM_INT64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
if (y->class == 7) { if (y->class == 7) {
l = y->conval->intval; l = y->conval->intval;
if (0 > l || l > (LONGINT)OPM_MaxSet) { if (0 > l || l > (SYSTEM_INT64)OPM_MaxSet) {
OPB_err(202); OPB_err(202);
} }
} }
@ -1590,7 +1590,7 @@ void OPB_SetElem (OPT_Node *x)
OPB_err(93); OPB_err(93);
} else if ((*x)->class == 7) { } else if ((*x)->class == 7) {
k = (*x)->conval->intval; k = (*x)->conval->intval;
if ((0 <= k && k <= (LONGINT)OPM_MaxSet)) { if ((0 <= k && k <= (SYSTEM_INT64)OPM_MaxSet)) {
(*x)->conval->setval = __SETOF(k); (*x)->conval->setval = __SETOF(k);
} else { } else {
OPB_err(202); OPB_err(202);
@ -1895,7 +1895,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 10: case 10:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size > (LONGINT)OPM_SIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size > (SYSTEM_INT64)OPM_SIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_ShorterSize(x->typ->size)));
} else if (f == 8) { } else if (f == 8) {
OPB_Convert(&x, OPT_realtyp); OPB_Convert(&x, OPT_realtyp);
@ -1906,7 +1906,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
case 11: case 11:
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if ((__IN(f, 0x70) && x->typ->size < (LONGINT)OPM_LIntSize)) { } else if ((__IN(f, 0x70) && x->typ->size < (SYSTEM_INT64)OPM_LIntSize)) {
OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size))); OPB_Convert(&x, OPB_IntType(OPB_LongerSize(x->typ->size)));
} else if (f == 7) { } else if (f == 7) {
OPB_Convert(&x, OPT_lrltyp); OPB_Convert(&x, OPT_lrltyp);
@ -1955,7 +1955,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if (x->typ->size != (LONGINT)OPM_LIntSize) { if (x->typ->size != (SYSTEM_INT64)OPM_LIntSize) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} }
} else { } else {
@ -1995,7 +1995,7 @@ void OPB_StPar0 (OPT_Node *par0, INTEGER fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (SYSTEM_INT64)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }
@ -2093,7 +2093,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
if (x->class == 8 || x->class == 9) { if (x->class == 8 || x->class == 9) {
OPB_err(126); OPB_err(126);
} else if (__IN(f, 0x70)) { } else if (__IN(f, 0x70)) {
if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (LONGINT)OPM_MaxSet))) { if ((x->class == 7 && (0 > x->conval->intval || x->conval->intval > (SYSTEM_INT64)OPM_MaxSet))) {
OPB_err(202); OPB_err(202);
} }
p = NewOp__57(19, fctno, p, x); p = NewOp__57(19, fctno, p, x);
@ -2264,7 +2264,7 @@ void OPB_StPar1 (OPT_Node *par0, OPT_Node x, SHORTINT fctno)
OPB_err(126); OPB_err(126);
} else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) { } else if ((((x->class == 7 && __IN(f, 0x70))) && x->typ->size < OPT_linttyp->size)) {
OPB_Convert(&x, OPT_linttyp); OPB_Convert(&x, OPT_linttyp);
} else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (LONGINT)OPM_PointerSize))) { } else if (!((__IN(x->typ->form, 0x2070) && x->typ->size == (SYSTEM_INT64)OPM_PointerSize))) {
OPB_err(111); OPB_err(111);
x->typ = OPT_linttyp; x->typ = OPT_linttyp;
} }

View file

@ -319,7 +319,7 @@ void OPC_Andent (OPT_Struct typ)
static BOOLEAN OPC_Undefined (OPT_Object obj) static BOOLEAN OPC_Undefined (OPT_Object obj)
{ {
BOOLEAN _o_result; BOOLEAN _o_result;
_o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (LONGINT)(3 + OPM_currFile))) && obj->linkadr != 2); _o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (SYSTEM_INT64)(3 + OPM_currFile))) && obj->linkadr != 2);
return _o_result; return _o_result;
} }
@ -827,7 +827,7 @@ void OPC_TDescDecl (OPT_Struct typ)
OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size); OPC_Str1((CHAR*)", #), {", (LONGINT)8, typ->size);
nofptrs = 0; nofptrs = 0;
OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs); OPC_PutPtrOffsets(typ, ((LONGINT)(0)), &nofptrs);
OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (LONGINT)OPM_LIntSize)); OPC_Str1((CHAR*)"#}}", (LONGINT)4, -((nofptrs + 1) * (SYSTEM_INT64)OPM_LIntSize));
OPC_EndStat(); OPC_EndStat();
} }
@ -873,7 +873,7 @@ LONGINT OPC_SizeAlignment (LONGINT size)
{ {
LONGINT _o_result; LONGINT _o_result;
LONGINT alignment; LONGINT alignment;
if (size < (LONGINT)OPM_Alignment) { if (size < (SYSTEM_INT64)OPM_Alignment) {
alignment = 1; alignment = 1;
while (alignment < size) { while (alignment < size) {
alignment = __ASHL(alignment, 1); alignment = __ASHL(alignment, 1);
@ -910,11 +910,11 @@ static void OPC_FillGap (LONGINT gap, LONGINT off, LONGINT align, LONGINT *n, LO
if ((*curAlign < align && gap - (adr - off) >= align)) { if ((*curAlign < align && gap - (adr - off) >= align)) {
gap -= (adr - off) + align; gap -= (adr - off) + align;
OPC_BegStat(); OPC_BegStat();
if (align == (LONGINT)OPM_IntSize) { if (align == (SYSTEM_INT64)OPM_IntSize) {
OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8); OPM_WriteString((CHAR*)"INTEGER", (LONGINT)8);
} else if (align == (LONGINT)OPM_LIntSize) { } else if (align == (SYSTEM_INT64)OPM_LIntSize) {
OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8); OPM_WriteString((CHAR*)"LONGINT", (LONGINT)8);
} else if (align == (LONGINT)OPM_LRealSize) { } else if (align == (SYSTEM_INT64)OPM_LRealSize) {
OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9); OPM_WriteString((CHAR*)"LONGREAL", (LONGINT)9);
} }
OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n); OPC_Str1((CHAR*)" _prvt#", (LONGINT)8, *n);
@ -979,7 +979,7 @@ static void OPC_FieldList (OPT_Struct typ, BOOLEAN last, LONGINT *off, LONGINT *
} }
} }
if (last) { if (last) {
adr = typ->size - (LONGINT)__ASHR(typ->sysflag, 8); adr = typ->size - (SYSTEM_INT64)__ASHR(typ->sysflag, 8);
if (adr == 0) { if (adr == 0) {
gap = 1; gap = 1;
} else { } else {

View file

@ -174,7 +174,7 @@ static void OPS_Number (void)
OPS_numtyp = 1; OPS_numtyp = 1;
if (n <= 2) { if (n <= 2) {
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (SYSTEM_INT64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -189,7 +189,7 @@ static void OPS_Number (void)
OPS_intval = -1; OPS_intval = -1;
} }
while (i < n) { while (i < n) {
OPS_intval = __ASHL(OPS_intval, 4) + (LONGINT)Ord__7(dig[i], 1); OPS_intval = __ASHL(OPS_intval, 4) + (SYSTEM_INT64)Ord__7(dig[i], 1);
i += 1; i += 1;
} }
} else { } else {
@ -200,8 +200,8 @@ static void OPS_Number (void)
while (i < n) { while (i < n) {
d = Ord__7(dig[i], 0); d = Ord__7(dig[i], 0);
i += 1; i += 1;
if (OPS_intval <= __DIV(9223372036854775807 - (LONGINT)d, 10)) { if (OPS_intval <= __DIV(9223372036854775807 - (SYSTEM_INT64)d, 10)) {
OPS_intval = OPS_intval * 10 + (LONGINT)d; OPS_intval = OPS_intval * 10 + (SYSTEM_INT64)d;
} else { } else {
OPS_err(203); OPS_err(203);
} }

View file

@ -87,7 +87,7 @@ void OPV_TypSize (OPT_Struct typ)
base = OPC_SizeAlignment(OPM_RecSize); base = OPC_SizeAlignment(OPM_RecSize);
} else { } else {
OPV_TypSize(btyp); OPV_TypSize(btyp);
offset = btyp->size - (LONGINT)__ASHR(btyp->sysflag, 8); offset = btyp->size - (SYSTEM_INT64)__ASHR(btyp->sysflag, 8);
base = btyp->align; base = btyp->align;
} }
fld = typ->link; fld = typ->link;
@ -469,12 +469,10 @@ static void OPV_Entier (OPT_Node n, INTEGER prec)
static void OPV_SizeCast (LONGINT size) static void OPV_SizeCast (LONGINT size)
{ {
if (size <= (LONGINT)OPM_SIntSize) { if (size <= 4) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else if (size <= (LONGINT)OPM_IntSize) {
OPM_WriteString((CHAR*)"(int)", (LONGINT)6); OPM_WriteString((CHAR*)"(int)", (LONGINT)6);
} else { } else {
OPM_WriteString((CHAR*)"(LONGINT)", (LONGINT)10); OPM_WriteString((CHAR*)"(SYSTEM_INT64)", (LONGINT)15);
} }
} }
@ -651,7 +649,7 @@ static void OPV_design (OPT_Node n, INTEGER prec)
} }
if (n->typ->comp == 3) { if (n->typ->comp == 3) {
OPM_Write(')'); OPM_Write(')');
while ((LONGINT)i < __ASHR(d->typ->size - 4, 2)) { while ((SYSTEM_INT64)i < __ASHR(d->typ->size - 4, 2)) {
OPM_WriteString((CHAR*)" * ", (LONGINT)4); OPM_WriteString((CHAR*)" * ", (LONGINT)4);
OPV_Len(d, i); OPV_Len(d, i);
i += 1; i += 1;

View file

@ -335,8 +335,8 @@ void Platform_SetBadInstructionHandler (Platform_SignalHandler handler)
static void Platform_YMDHMStoClock (INTEGER ye, INTEGER mo, INTEGER da, INTEGER ho, INTEGER mi, INTEGER se, LONGINT *t, LONGINT *d) static void Platform_YMDHMStoClock (INTEGER ye, INTEGER mo, INTEGER da, INTEGER ho, INTEGER mi, INTEGER se, LONGINT *t, LONGINT *d)
{ {
*d = (__ASHL((LONGINT)(int)__MOD(ye, 100), 9) + __ASHL((LONGINT)(mo + 1), 5)) + (LONGINT)da; *d = (__ASHL((SYSTEM_INT64)(int)__MOD(ye, 100), 9) + __ASHL((SYSTEM_INT64)(mo + 1), 5)) + (SYSTEM_INT64)da;
*t = (__ASHL((LONGINT)ho, 12) + __ASHL((LONGINT)mi, 6)) + (LONGINT)se; *t = (__ASHL((SYSTEM_INT64)ho, 12) + __ASHL((SYSTEM_INT64)mi, 6)) + (SYSTEM_INT64)se;
} }
void Platform_GetClock (LONGINT *t, LONGINT *d) void Platform_GetClock (LONGINT *t, LONGINT *d)

View file

@ -90,7 +90,7 @@ void Reals_ConvertL (LONGREAL x, INTEGER n, CHAR *d, LONGINT d__len)
} }
k = 0; k = 0;
i = __ENTIER(x); i = __ENTIER(x);
while (k < (LONGINT)n) { while (k < (SYSTEM_INT64)n) {
d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48); d[__X(k, d__len)] = (CHAR)(__MOD(i, 10) + 48);
i = __DIV(i, 10); i = __DIV(i, 10);
k += 1; k += 1;
@ -122,7 +122,7 @@ static void Reals_BytesToHex (SYSTEM_BYTE *b, LONGINT b__len, SYSTEM_BYTE *d, LO
CHAR by; CHAR by;
i = 0; i = 0;
l = b__len; l = b__len;
while ((LONGINT)i < l) { while ((SYSTEM_INT64)i < l) {
by = __VAL(CHAR, b[__X(i, b__len)]); by = __VAL(CHAR, b[__X(i, b__len)]);
d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4)); d[__X(__ASHL(i, 1), d__len)] = Reals_ToHex(__ASHR((int)by, 4));
d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16)); d[__X(__ASHL(i, 1) + 1, d__len)] = Reals_ToHex(__MASK((int)by, -16));

View file

@ -1,30 +1,40 @@
#ifndef SYSTEM__h #ifndef SYSTEM__h
#define SYSTEM__h #define SYSTEM__h
#ifndef _WIN32 #if defined(_WIN64)
typedef long long SYSTEM_INT64;
// Building for a Unix/Linux based system typedef unsigned long long SYSTEM_CARD64;
// TODO: Remove these includes
#include <string.h> // For memcpy ...
#include <stdint.h> // For uintptr_t ...
#else #else
typedef long SYSTEM_INT64;
// Building for Windows platform with either mingw under cygwin, or the MS C compiler typedef unsigned long SYSTEM_CARD64;
#ifdef _WIN64
typedef unsigned long long size_t;
typedef unsigned long long uintptr_t;
#else
typedef unsigned int size_t;
typedef unsigned int uintptr_t;
#endif /* _WIN64 */
typedef unsigned int uint32_t;
void * __cdecl memcpy(void * dest, const void * source, size_t size);
#endif #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;
#if (__SIZEOF_POINTER__ == 8)
#if defined(_WIN64)
typedef unsigned long long SYSTEM_PTRINT;
typedef unsigned long long uintptr_t;
typedef unsigned long long size_t;
#else
typedef unsigned long SYSTEM_PTRINT;
typedef unsigned long uintptr_t;
typedef unsigned long size_t;
#endif
#else
typedef unsigned int SYSTEM_PTRINT;
typedef unsigned int uintptr_t;
typedef unsigned int size_t;
#endif
void * __cdecl memcpy(void *dest, const void *source, size_t size);
// The compiler uses 'import' and 'export' which translate to 'extern' and // The compiler uses 'import' and 'export' which translate to 'extern' and
// nothing respectively. // nothing respectively.

View file

@ -22,7 +22,7 @@ INTEGER Strings_Length (CHAR *s, LONGINT s__len)
INTEGER i; INTEGER i;
__DUP(s, s__len, CHAR); __DUP(s, s__len, CHAR);
i = 0; i = 0;
while (((LONGINT)i < s__len && s[__X(i, s__len)] != 0x00)) { while (((SYSTEM_INT64)i < s__len && s[__X(i, s__len)] != 0x00)) {
i += 1; i += 1;
} }
_o_result = i; _o_result = i;
@ -37,11 +37,11 @@ void Strings_Append (CHAR *extra, LONGINT extra__len, CHAR *dest, LONGINT dest__
n1 = Strings_Length(dest, dest__len); n1 = Strings_Length(dest, dest__len);
n2 = Strings_Length(extra, extra__len); n2 = Strings_Length(extra, extra__len);
i = 0; i = 0;
while ((i < n2 && (LONGINT)(i + n1) < dest__len)) { while ((i < n2 && (SYSTEM_INT64)(i + n1) < dest__len)) {
dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)]; dest[__X(i + n1, dest__len)] = extra[__X(i, extra__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i + n1) < dest__len) { if ((SYSTEM_INT64)(i + n1) < dest__len) {
dest[__X(i + n1, dest__len)] = 0x00; dest[__X(i + n1, dest__len)] = 0x00;
} }
__DEL(extra); __DEL(extra);
@ -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); Strings_Append(dest, dest__len, (void*)source, source__len);
return; return;
} }
if ((LONGINT)(pos + n2) < dest__len) { if ((SYSTEM_INT64)(pos + n2) < dest__len) {
i = n1; i = n1;
while (i >= pos) { while (i >= pos) {
if ((LONGINT)(i + n2) < dest__len) { if ((SYSTEM_INT64)(i + n2) < dest__len) {
dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)]; dest[__X(i + n2, dest__len)] = dest[__X(i, dest__len)];
} }
i -= 1; i -= 1;
@ -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)]; s[__X(i - n, s__len)] = s[__X(i, s__len)];
i += 1; i += 1;
} }
if ((LONGINT)(i - n) < s__len) { if ((SYSTEM_INT64)(i - n) < s__len) {
s[__X(i - n, s__len)] = 0x00; s[__X(i - n, s__len)] = 0x00;
} }
} else { } else {
@ -122,7 +122,7 @@ void Strings_Extract (CHAR *source, LONGINT source__len, INTEGER pos, INTEGER n,
return; return;
} }
i = 0; i = 0;
while (((((LONGINT)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) { while (((((SYSTEM_INT64)(pos + i) <= source__len && source[__X(pos + i, source__len)] != 0x00)) && i < n)) {
if (i < destLen) { if (i < destLen) {
dest[__X(i, dest__len)] = source[__X(pos + i, source__len)]; dest[__X(i, dest__len)] = source[__X(pos + i, source__len)];
} }

View file

@ -840,7 +840,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
k -= 16; k -= 16;
} }
while (j < i) { while (j < i) {
k = __ASHL(k, 4) + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = __ASHL(k, 4) + (SYSTEM_INT64)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} }
if (neg) { if (neg) {
@ -930,7 +930,7 @@ void Texts_Scan (Texts_Scanner *S, LONGINT *S__typ)
(*S).class = 3; (*S).class = 3;
k = 0; k = 0;
do { do {
k = k * 10 + (LONGINT)((int)d[__X(j, ((LONGINT)(32)))] - 48); k = k * 10 + (SYSTEM_INT64)((int)d[__X(j, ((LONGINT)(32)))] - 48);
j += 1; j += 1;
} while (!(j == i)); } while (!(j == i));
if (neg) { if (neg) {
@ -1068,7 +1068,7 @@ void Texts_WriteInt (Texts_Writer *W, LONGINT *W__typ, LONGINT x, LONGINT n)
x0 = __DIV(x0, 10); x0 = __DIV(x0, 10);
i += 1; i += 1;
} while (!(x0 == 0)); } while (!(x0 == 0));
while (n > (LONGINT)i) { while (n > (SYSTEM_INT64)i) {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
n -= 1; n -= 1;
} }
@ -1320,7 +1320,7 @@ void Texts_WriteLongReal (Texts_Writer *W, LONGINT *W__typ, LONGREAL x, INTEGER
} else { } else {
Texts_Write(&*W, W__typ, ' '); Texts_Write(&*W, W__typ, ' ');
} }
e = (int)__ASHR((LONGINT)(e - 1023) * 77, 8); e = (int)__ASHR((SYSTEM_INT64)(e - 1023) * 77, 8);
if (e >= 0) { if (e >= 0) {
x = x / (LONGREAL)Reals_TenL(e); x = x / (LONGREAL)Reals_TenL(e);
} else { } else {

View file

@ -1,33 +1,40 @@
#ifndef SYSTEM__h #ifndef SYSTEM__h
#define SYSTEM__h #define SYSTEM__h
#ifndef _WIN32 #if defined(_WIN64)
typedef long long SYSTEM_INT64;
// Building for a Unix/Linux based system typedef unsigned long long SYSTEM_CARD64;
// TODO: Remove these includes
#include <string.h> // For memcpy ...
#include <stdint.h> // For uintptr_t ...
typedef long SYSTEM_INT64;
#else #else
typedef long SYSTEM_INT64;
// Building for Windows platform with either mingw under cygwin, or the MS C compiler typedef unsigned long SYSTEM_CARD64;
#ifdef _WIN64
typedef unsigned long long size_t;
typedef unsigned long long uintptr_t;
#else
typedef unsigned int size_t;
typedef unsigned int uintptr_t;
#endif /* _WIN64 */
typedef long long SYSTEM_INT64
typedef unsigned int uint32_t;
void * __cdecl memcpy(void *dest, const void *source, size_t size);
#endif #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;
#if (__SIZEOF_POINTER__ == 8)
#if defined(_WIN64)
typedef unsigned long long SYSTEM_PTRINT;
typedef unsigned long long uintptr_t;
typedef unsigned long long size_t;
#else
typedef unsigned long SYSTEM_PTRINT;
typedef unsigned long uintptr_t;
typedef unsigned long size_t;
#endif
#else
typedef unsigned int SYSTEM_PTRINT;
typedef unsigned int uintptr_t;
typedef unsigned int size_t;
#endif
void * __cdecl memcpy(void *dest, const void *source, size_t size);
// The compiler uses 'import' and 'export' which translate to 'extern' and // The compiler uses 'import' and 'export' which translate to 'extern' and
// nothing respectively. // nothing respectively.