mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 05:12:26 +00:00
Fix import of SYSTEM.INT64 type on 32 bit platforms.
This commit is contained in:
parent
dc699db9f5
commit
21964471d8
13 changed files with 53 additions and 36 deletions
|
|
@ -17,7 +17,7 @@ typedef
|
|||
export OPS_Name OPS_name;
|
||||
export OPS_String OPS_str;
|
||||
export int16 OPS_numtyp;
|
||||
export int64 OPS_intval;
|
||||
export int32 OPS_intval;
|
||||
export REAL OPS_realval;
|
||||
export LONGREAL OPS_lrlval;
|
||||
static CHAR OPS_ch;
|
||||
|
|
@ -178,7 +178,7 @@ static void OPS_Number (void)
|
|||
OPS_numtyp = 1;
|
||||
if (n <= 2) {
|
||||
while (i < n) {
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1);
|
||||
i += 1;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -192,7 +192,7 @@ static void OPS_Number (void)
|
|||
OPS_intval = -1;
|
||||
}
|
||||
while (i < n) {
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1);
|
||||
i += 1;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -203,8 +203,8 @@ static void OPS_Number (void)
|
|||
while (i < n) {
|
||||
d = Ord__7(dig[i], 0);
|
||||
i += 1;
|
||||
if (OPS_intval <= (int64)__DIV(9223372036854775807 - d, 10)) {
|
||||
OPS_intval = OPS_intval * 10 + (int64)d;
|
||||
if ((int64)OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) {
|
||||
OPS_intval = OPS_intval * 10 + d;
|
||||
} else {
|
||||
OPS_err(203);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ typedef
|
|||
import OPS_Name OPS_name;
|
||||
import OPS_String OPS_str;
|
||||
import int16 OPS_numtyp;
|
||||
import int64 OPS_intval;
|
||||
import int32 OPS_intval;
|
||||
import REAL OPS_realval;
|
||||
import LONGREAL OPS_lrlval;
|
||||
|
||||
|
|
|
|||
|
|
@ -167,11 +167,14 @@ OPT_Struct OPT_IntType (int32 size)
|
|||
OPT_Struct _o_result;
|
||||
int16 i;
|
||||
i = 1;
|
||||
while ((OPT_IntTypes[__X(i, 20)]->size < size && OPT_IntTypes[__X(i + 1, 20)] != NIL)) {
|
||||
while (i < 19) {
|
||||
if ((OPT_IntTypes[__X(i, 20)] != NIL && OPT_IntTypes[__X(i, 20)]->size >= size)) {
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
__RETCHK;
|
||||
}
|
||||
|
||||
OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ typedef
|
|||
export OPS_Name OPS_name;
|
||||
export OPS_String OPS_str;
|
||||
export int16 OPS_numtyp;
|
||||
export int64 OPS_intval;
|
||||
export int32 OPS_intval;
|
||||
export REAL OPS_realval;
|
||||
export LONGREAL OPS_lrlval;
|
||||
static CHAR OPS_ch;
|
||||
|
|
@ -178,7 +178,7 @@ static void OPS_Number (void)
|
|||
OPS_numtyp = 1;
|
||||
if (n <= 2) {
|
||||
while (i < n) {
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1);
|
||||
i += 1;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -192,7 +192,7 @@ static void OPS_Number (void)
|
|||
OPS_intval = -1;
|
||||
}
|
||||
while (i < n) {
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1);
|
||||
i += 1;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -203,8 +203,8 @@ static void OPS_Number (void)
|
|||
while (i < n) {
|
||||
d = Ord__7(dig[i], 0);
|
||||
i += 1;
|
||||
if (OPS_intval <= (int64)__DIV(9223372036854775807 - d, 10)) {
|
||||
OPS_intval = OPS_intval * 10 + (int64)d;
|
||||
if ((int64)OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) {
|
||||
OPS_intval = OPS_intval * 10 + d;
|
||||
} else {
|
||||
OPS_err(203);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ typedef
|
|||
import OPS_Name OPS_name;
|
||||
import OPS_String OPS_str;
|
||||
import int16 OPS_numtyp;
|
||||
import int64 OPS_intval;
|
||||
import int32 OPS_intval;
|
||||
import REAL OPS_realval;
|
||||
import LONGREAL OPS_lrlval;
|
||||
|
||||
|
|
|
|||
|
|
@ -167,11 +167,14 @@ OPT_Struct OPT_IntType (int32 size)
|
|||
OPT_Struct _o_result;
|
||||
int16 i;
|
||||
i = 1;
|
||||
while ((OPT_IntTypes[__X(i, 20)]->size < size && OPT_IntTypes[__X(i + 1, 20)] != NIL)) {
|
||||
while (i < 19) {
|
||||
if ((OPT_IntTypes[__X(i, 20)] != NIL && OPT_IntTypes[__X(i, 20)]->size >= size)) {
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
__RETCHK;
|
||||
}
|
||||
|
||||
OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir)
|
||||
|
|
|
|||
|
|
@ -167,11 +167,14 @@ OPT_Struct OPT_IntType (int64 size)
|
|||
OPT_Struct _o_result;
|
||||
int32 i;
|
||||
i = 1;
|
||||
while ((OPT_IntTypes[__X(i, 20)]->size < size && OPT_IntTypes[__X(i + 1, 20)] != NIL)) {
|
||||
while (i < 19) {
|
||||
if ((OPT_IntTypes[__X(i, 20)] != NIL && OPT_IntTypes[__X(i, 20)]->size >= size)) {
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
__RETCHK;
|
||||
}
|
||||
|
||||
OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int32 dir)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ typedef
|
|||
export OPS_Name OPS_name;
|
||||
export OPS_String OPS_str;
|
||||
export int16 OPS_numtyp;
|
||||
export int64 OPS_intval;
|
||||
export int32 OPS_intval;
|
||||
export REAL OPS_realval;
|
||||
export LONGREAL OPS_lrlval;
|
||||
static CHAR OPS_ch;
|
||||
|
|
@ -178,7 +178,7 @@ static void OPS_Number (void)
|
|||
OPS_numtyp = 1;
|
||||
if (n <= 2) {
|
||||
while (i < n) {
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1);
|
||||
i += 1;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -192,7 +192,7 @@ static void OPS_Number (void)
|
|||
OPS_intval = -1;
|
||||
}
|
||||
while (i < n) {
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + (int64)Ord__7(dig[i], 1);
|
||||
OPS_intval = __ASHL(OPS_intval, 4) + Ord__7(dig[i], 1);
|
||||
i += 1;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -203,8 +203,8 @@ static void OPS_Number (void)
|
|||
while (i < n) {
|
||||
d = Ord__7(dig[i], 0);
|
||||
i += 1;
|
||||
if (OPS_intval <= (int64)__DIV(9223372036854775807 - d, 10)) {
|
||||
OPS_intval = OPS_intval * 10 + (int64)d;
|
||||
if ((int64)OPS_intval <= __DIV(9223372036854775807 - (int64)d, 10)) {
|
||||
OPS_intval = OPS_intval * 10 + d;
|
||||
} else {
|
||||
OPS_err(203);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ typedef
|
|||
import OPS_Name OPS_name;
|
||||
import OPS_String OPS_str;
|
||||
import int16 OPS_numtyp;
|
||||
import int64 OPS_intval;
|
||||
import int32 OPS_intval;
|
||||
import REAL OPS_realval;
|
||||
import LONGREAL OPS_lrlval;
|
||||
|
||||
|
|
|
|||
|
|
@ -167,11 +167,14 @@ OPT_Struct OPT_IntType (int32 size)
|
|||
OPT_Struct _o_result;
|
||||
int16 i;
|
||||
i = 1;
|
||||
while ((OPT_IntTypes[__X(i, 20)]->size < size && OPT_IntTypes[__X(i + 1, 20)] != NIL)) {
|
||||
while (i < 19) {
|
||||
if ((OPT_IntTypes[__X(i, 20)] != NIL && OPT_IntTypes[__X(i, 20)]->size >= size)) {
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
__RETCHK;
|
||||
}
|
||||
|
||||
OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir)
|
||||
|
|
|
|||
|
|
@ -167,11 +167,14 @@ OPT_Struct OPT_IntType (int64 size)
|
|||
OPT_Struct _o_result;
|
||||
int32 i;
|
||||
i = 1;
|
||||
while ((OPT_IntTypes[__X(i, 20)]->size < size && OPT_IntTypes[__X(i + 1, 20)] != NIL)) {
|
||||
while (i < 19) {
|
||||
if ((OPT_IntTypes[__X(i, 20)] != NIL && OPT_IntTypes[__X(i, 20)]->size >= size)) {
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
_o_result = OPT_IntTypes[__X(i, 20)];
|
||||
return _o_result;
|
||||
__RETCHK;
|
||||
}
|
||||
|
||||
OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int32 dir)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ MODULE OPS; (* NW, RC 6.3.89 / 18.10.92 *) (* object model 3.6.92 *)
|
|||
name*: Name;
|
||||
str*: String;
|
||||
numtyp*: INTEGER; (* 1 = char, 2 = integer, 3 = real, 4 = longreal *)
|
||||
intval*: SYSTEM.INT64; (* integer value or string length *)
|
||||
intval*: LONGINT (* todo SYSTEM.INT64 *); (* integer value or string length *)
|
||||
realval*: REAL;
|
||||
lrlval*: LONGREAL;
|
||||
|
||||
|
|
|
|||
|
|
@ -217,8 +217,10 @@ PROCEDURE IntType*(size: LONGINT): Struct;
|
|||
(* Selects smallest standard integer type for given size in bytes *)
|
||||
VAR i: INTEGER;
|
||||
BEGIN
|
||||
i := 1; WHILE (IntTypes[i].size < size) & (IntTypes[i+1] # NIL) DO INC(i) END;
|
||||
RETURN IntTypes[i];
|
||||
i := 1; WHILE i < LEN(IntTypes) - 1 DO (* First and last entries are always NIL *)
|
||||
IF (IntTypes[i] # NIL) & (IntTypes[i].size >= size) THEN RETURN IntTypes[i] END;
|
||||
INC(i)
|
||||
END;
|
||||
END IntType;
|
||||
|
||||
PROCEDURE ShorterOrLongerType*(x: Struct; dir: INTEGER): Struct;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue