mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 08:42:24 +00:00
Support 64 bit integer literals on all builds, and fix 64 bit Console.hex display.
This commit is contained in:
parent
7fad168e40
commit
dc699db9f5
199 changed files with 478 additions and 477 deletions
|
|
@ -1,6 +1,6 @@
|
|||
MODULE OPS; (* NW, RC 6.3.89 / 18.10.92 *) (* object model 3.6.92 *)
|
||||
|
||||
IMPORT OPM;
|
||||
IMPORT OPM, SYSTEM;
|
||||
|
||||
CONST
|
||||
MaxStrLen* = 256;
|
||||
|
|
@ -51,8 +51,8 @@ MODULE OPS; (* NW, RC 6.3.89 / 18.10.92 *) (* object model 3.6.92 *)
|
|||
(* name, str, numtyp, intval, realval, lrlval are implicit results of Get *)
|
||||
name*: Name;
|
||||
str*: String;
|
||||
numtyp*: INTEGER; (* 1 = char, 2 = integer, 3 = real, 4 = longreal *)
|
||||
intval*: LONGINT; (* integer value or string length *)
|
||||
numtyp*: INTEGER; (* 1 = char, 2 = integer, 3 = real, 4 = longreal *)
|
||||
intval*: SYSTEM.INT64; (* integer value or string length *)
|
||||
realval*: REAL;
|
||||
lrlval*: LONGREAL;
|
||||
|
||||
|
|
@ -89,7 +89,8 @@ MODULE OPS; (* NW, RC 6.3.89 / 18.10.92 *) (* object model 3.6.92 *)
|
|||
END Identifier;
|
||||
|
||||
PROCEDURE Number;
|
||||
VAR i, m, n, d, e, maxHdig: INTEGER; dig: ARRAY 24 OF CHAR; f: LONGREAL; expCh: CHAR; neg: BOOLEAN;
|
||||
CONST maxhexdigits = 16;
|
||||
VAR i, m, n, d, e: INTEGER; dig: ARRAY 24 OF CHAR; f: LONGREAL; expCh: CHAR; neg: BOOLEAN;
|
||||
|
||||
PROCEDURE Ten(e: INTEGER): LONGREAL;
|
||||
VAR x, p: LONGREAL;
|
||||
|
|
@ -135,15 +136,14 @@ MODULE OPS; (* NW, RC 6.3.89 / 18.10.92 *) (* object model 3.6.92 *)
|
|||
ELSE err(203)
|
||||
END
|
||||
ELSIF ch = "H" THEN (* hexadecimal *) OPM.Get(ch); numtyp := integer;
|
||||
IF MAX(LONGINT) > 2147483647 THEN maxHdig := 16 ELSE maxHdig := 8 END;
|
||||
IF n <= maxHdig THEN
|
||||
IF (n = maxHdig) & (dig[0] > "7") THEN (* prevent overflow *) intval := -1 END;
|
||||
IF n <= maxhexdigits THEN
|
||||
IF (n = maxhexdigits) & (dig[0] > "7") THEN (* prevent overflow *) intval := -1 END;
|
||||
WHILE i < n DO intval := intval*10H + Ord(dig[i], TRUE); INC(i) END
|
||||
ELSE err(203)
|
||||
END
|
||||
ELSE (* decimal *) numtyp := integer;
|
||||
WHILE i < n DO d := Ord(dig[i], FALSE); INC(i);
|
||||
IF intval <= (MAX(LONGINT) - d) DIV 10 THEN intval := intval*10 + d
|
||||
IF intval <= (MAX(SYSTEM.INT64) - d) DIV 10 THEN intval := intval*10 + d
|
||||
ELSE err(203)
|
||||
END
|
||||
END
|
||||
|
|
|
|||
|
|
@ -1,244 +1,243 @@
|
|||
MODULE ulmIO;
|
||||
|
||||
IMPORT SYS := ulmSYSTEM, SYSTEM;
|
||||
IMPORT SYS := ulmSYSTEM, SYSTEM;
|
||||
|
||||
CONST nl = 0AX;
|
||||
CONST nl = 0AX;
|
||||
|
||||
(* conversions *)
|
||||
(* conversions *)
|
||||
|
||||
CONST
|
||||
oct = 0;
|
||||
dec = 1;
|
||||
hex = 2;
|
||||
TYPE
|
||||
Basetype = SHORTINT; (* oct..hex *)
|
||||
CONST
|
||||
oct = 0;
|
||||
dec = 1;
|
||||
hex = 2;
|
||||
TYPE
|
||||
Basetype = SHORTINT; (* oct..hex *)
|
||||
|
||||
(* basic IO *)
|
||||
(* basic IO *)
|
||||
|
||||
VAR
|
||||
Done*: BOOLEAN;
|
||||
oldch: CHAR;
|
||||
readAgain: BOOLEAN;
|
||||
VAR
|
||||
Done*: BOOLEAN;
|
||||
oldch: CHAR;
|
||||
readAgain: BOOLEAN;
|
||||
|
||||
(* ==================== conversions ================================= *)
|
||||
(* ==================== conversions ================================= *)
|
||||
|
||||
PROCEDURE ConvertNumber(num, len: LONGINT; btyp: Basetype; neg: BOOLEAN;
|
||||
VAR str: ARRAY OF CHAR);
|
||||
PROCEDURE ConvertNumber(num, len: LONGINT; btyp: Basetype; neg: BOOLEAN;
|
||||
VAR str: ARRAY OF CHAR);
|
||||
|
||||
(* conversion of a number into a string of characters *)
|
||||
(* num must get the absolute value of the number *)
|
||||
(* len is the minimal length of the generated string *)
|
||||
(* neg means: "the number is negative" for btyp = dec *)
|
||||
(* conversion of a number into a string of characters *)
|
||||
(* num must get the absolute value of the number *)
|
||||
(* len is the minimal length of the generated string *)
|
||||
(* neg means: "the number is negative" for btyp = dec *)
|
||||
|
||||
(*CONST
|
||||
NumberLen = 11;*)
|
||||
(* we need it as variable to change the value depending on architecture; -- noch *)
|
||||
VAR
|
||||
(*digits : ARRAY NumberLen+1 OF CHAR;*)
|
||||
digits : POINTER TO ARRAY OF CHAR;
|
||||
base : INTEGER;
|
||||
cnt, ix : INTEGER;
|
||||
maxlen : LONGINT;
|
||||
dig : LONGINT;
|
||||
NumberLen : SHORTINT;
|
||||
BEGIN
|
||||
|
||||
IF SIZE(LONGINT) = 4 THEN
|
||||
NumberLen := 11
|
||||
ELSIF SIZE(LONGINT) = 8 THEN
|
||||
NumberLen := 21
|
||||
(*CONST
|
||||
NumberLen = 11;*)
|
||||
(* we need it as variable to change the value depending on architecture; -- noch *)
|
||||
VAR
|
||||
(*digits : ARRAY NumberLen+1 OF CHAR;*)
|
||||
digits : POINTER TO ARRAY OF CHAR;
|
||||
base : INTEGER;
|
||||
cnt, ix : INTEGER;
|
||||
maxlen : LONGINT;
|
||||
dig : LONGINT;
|
||||
NumberLen : SHORTINT;
|
||||
BEGIN
|
||||
IF SIZE(LONGINT) = 4 THEN
|
||||
NumberLen := 11
|
||||
ELSIF SIZE(LONGINT) = 8 THEN
|
||||
NumberLen := 21
|
||||
ELSE
|
||||
NumberLen := 11 (* default value, corresponds to 32 bit *)
|
||||
END;
|
||||
NEW(digits, NumberLen + 1 );
|
||||
ASSERT(num >= 0);
|
||||
ix := 1;
|
||||
WHILE ix <= NumberLen DO
|
||||
digits[ix] := "0";
|
||||
INC(ix);
|
||||
END; (* initialisation *)
|
||||
IF btyp = oct THEN
|
||||
base := 8;
|
||||
ELSIF btyp = dec THEN
|
||||
base := 10;
|
||||
ELSIF btyp = hex THEN
|
||||
base := 10H;
|
||||
END;
|
||||
cnt := 0;
|
||||
REPEAT
|
||||
INC(cnt);
|
||||
dig := num MOD base;
|
||||
num := num DIV base;
|
||||
IF dig < 10 THEN
|
||||
dig := dig + ORD("0");
|
||||
ELSE
|
||||
NumberLen := 11 (* default value, corresponds to 32 bit *)
|
||||
dig := dig - 10 + ORD("A");
|
||||
END;
|
||||
NEW(digits, NumberLen + 1 );
|
||||
ASSERT(num >= 0);
|
||||
ix := 1;
|
||||
WHILE ix <= NumberLen DO
|
||||
digits[ix] := "0";
|
||||
INC(ix);
|
||||
END; (* initialisation *)
|
||||
IF btyp = oct THEN
|
||||
base := 8;
|
||||
ELSIF btyp = dec THEN
|
||||
base := 10;
|
||||
ELSIF btyp = hex THEN
|
||||
base := 10H;
|
||||
END;
|
||||
cnt := 0;
|
||||
REPEAT
|
||||
INC(cnt);
|
||||
dig := num MOD base;
|
||||
num := num DIV base;
|
||||
IF dig < 10 THEN
|
||||
dig := dig + ORD("0");
|
||||
ELSE
|
||||
dig := dig - 10 + ORD("A");
|
||||
END;
|
||||
digits[cnt] := CHR(dig);
|
||||
UNTIL num = 0;
|
||||
(* (* i don't like this *)
|
||||
IF btyp = oct THEN
|
||||
cnt := 11;
|
||||
ELSIF btyp = hex THEN
|
||||
cnt := 8;
|
||||
ELSIF neg THEN
|
||||
*)
|
||||
IF neg THEN
|
||||
INC(cnt);
|
||||
digits[cnt] := "-";
|
||||
END;
|
||||
maxlen := LEN(str); (* get maximal length *)
|
||||
IF len > maxlen THEN
|
||||
len := SHORT(maxlen);
|
||||
END;
|
||||
IF cnt > maxlen THEN
|
||||
cnt := SHORT(maxlen);
|
||||
END;
|
||||
ix := 0;
|
||||
WHILE len > cnt DO
|
||||
str[ix] := " ";
|
||||
INC(ix);
|
||||
DEC(len);
|
||||
END;
|
||||
WHILE cnt > 0 DO
|
||||
str[ix] := digits[cnt];
|
||||
INC(ix);
|
||||
DEC(cnt);
|
||||
END;
|
||||
IF ix < maxlen THEN
|
||||
str[ix] := 0X;
|
||||
END;
|
||||
END ConvertNumber;
|
||||
digits[cnt] := CHR(dig);
|
||||
UNTIL num = 0;
|
||||
(* (* i don't like this *)
|
||||
IF btyp = oct THEN
|
||||
cnt := 11;
|
||||
ELSIF btyp = hex THEN
|
||||
cnt := 8;
|
||||
ELSIF neg THEN
|
||||
*)
|
||||
IF neg THEN
|
||||
INC(cnt);
|
||||
digits[cnt] := "-";
|
||||
END;
|
||||
maxlen := LEN(str); (* get maximal length *)
|
||||
IF len > maxlen THEN
|
||||
len := SHORT(maxlen);
|
||||
END;
|
||||
IF cnt > maxlen THEN
|
||||
cnt := SHORT(maxlen);
|
||||
END;
|
||||
ix := 0;
|
||||
WHILE len > cnt DO
|
||||
str[ix] := " ";
|
||||
INC(ix);
|
||||
DEC(len);
|
||||
END;
|
||||
WHILE cnt > 0 DO
|
||||
str[ix] := digits[cnt];
|
||||
INC(ix);
|
||||
DEC(cnt);
|
||||
END;
|
||||
IF ix < maxlen THEN
|
||||
str[ix] := 0X;
|
||||
END;
|
||||
END ConvertNumber;
|
||||
|
||||
PROCEDURE ConvertInteger(num: LONGINT; len: INTEGER; VAR str: ARRAY OF
|
||||
CHAR);
|
||||
(* conversion of an integer decimal number to a string *)
|
||||
BEGIN
|
||||
ConvertNumber(ABS(num),len,dec,num < 0,str);
|
||||
END ConvertInteger;
|
||||
PROCEDURE ConvertInteger(num: LONGINT; len: INTEGER; VAR str: ARRAY OF
|
||||
CHAR);
|
||||
(* conversion of an integer decimal number to a string *)
|
||||
BEGIN
|
||||
ConvertNumber(ABS(num),len,dec,num < 0,str);
|
||||
END ConvertInteger;
|
||||
|
||||
(* ========================= terminal ============================ *)
|
||||
(* ========================= terminal ============================ *)
|
||||
|
||||
PROCEDURE ReadChar(VAR ch: CHAR) : BOOLEAN;
|
||||
CONST read = 3;
|
||||
(*VAR r0, r1: INTEGER;*)
|
||||
VAR r0, r1: LONGINT; (* in ulm system INTEGER and LONGINT have the same 4 byte size; -- noch *)
|
||||
BEGIN
|
||||
RETURN SYS.UNIXCALL(read, r0, r1, 0, SYSTEM.ADR(ch), 1) & (r0 > 0)
|
||||
END ReadChar;
|
||||
PROCEDURE ReadChar(VAR ch: CHAR) : BOOLEAN;
|
||||
CONST read = 3;
|
||||
(*VAR r0, r1: INTEGER;*)
|
||||
VAR r0, r1: LONGINT; (* in ulm system INTEGER and LONGINT have the same 4 byte size; -- noch *)
|
||||
BEGIN
|
||||
RETURN SYS.UNIXCALL(read, r0, r1, 0, SYSTEM.ADR(ch), 1) & (r0 > 0)
|
||||
END ReadChar;
|
||||
|
||||
PROCEDURE WriteChar(ch: CHAR) : BOOLEAN;
|
||||
CONST write = 4;
|
||||
(*VAR r0, r1: INTEGER;*)
|
||||
VAR r0, r1: LONGINT; (* same here *)
|
||||
BEGIN
|
||||
RETURN SYS.UNIXCALL(write, r0, r1, 1, SYSTEM.ADR(ch), 1)
|
||||
END WriteChar;
|
||||
PROCEDURE WriteChar(ch: CHAR) : BOOLEAN;
|
||||
CONST write = 4;
|
||||
(*VAR r0, r1: INTEGER;*)
|
||||
VAR r0, r1: LONGINT; (* same here *)
|
||||
BEGIN
|
||||
RETURN SYS.UNIXCALL(write, r0, r1, 1, SYSTEM.ADR(ch), 1)
|
||||
END WriteChar;
|
||||
|
||||
PROCEDURE Read*(VAR ch: CHAR);
|
||||
BEGIN
|
||||
Done := TRUE;
|
||||
IF readAgain THEN
|
||||
ch := oldch;
|
||||
readAgain := FALSE;
|
||||
ELSIF ~ReadChar(ch) THEN
|
||||
Done := FALSE;
|
||||
ch := 0X;
|
||||
ELSE
|
||||
oldch := ch;
|
||||
END;
|
||||
END Read;
|
||||
|
||||
PROCEDURE ReadAgain*;
|
||||
BEGIN
|
||||
IF readAgain THEN
|
||||
Done := FALSE;
|
||||
ELSE
|
||||
Done := TRUE;
|
||||
readAgain := TRUE;
|
||||
END;
|
||||
END ReadAgain;
|
||||
|
||||
PROCEDURE Write*(ch: CHAR);
|
||||
BEGIN
|
||||
Done := WriteChar(ch);
|
||||
END Write;
|
||||
|
||||
PROCEDURE WriteLn*;
|
||||
CONST nl = 0AX;
|
||||
BEGIN
|
||||
Write(nl);
|
||||
END WriteLn;
|
||||
|
||||
PROCEDURE WriteString*(s: ARRAY OF CHAR);
|
||||
VAR i: INTEGER;
|
||||
BEGIN
|
||||
i := 0;
|
||||
WHILE (i < LEN(s)) & (s[i] # 0X) DO
|
||||
Write(s[i]);
|
||||
INC(i);
|
||||
END;
|
||||
END WriteString;
|
||||
|
||||
PROCEDURE InitIO;
|
||||
BEGIN
|
||||
PROCEDURE Read*(VAR ch: CHAR);
|
||||
BEGIN
|
||||
Done := TRUE;
|
||||
IF readAgain THEN
|
||||
ch := oldch;
|
||||
readAgain := FALSE;
|
||||
ELSIF ~ReadChar(ch) THEN
|
||||
Done := FALSE;
|
||||
ch := 0X;
|
||||
ELSE
|
||||
oldch := ch;
|
||||
END;
|
||||
END Read;
|
||||
|
||||
PROCEDURE ReadAgain*;
|
||||
BEGIN
|
||||
IF readAgain THEN
|
||||
Done := FALSE;
|
||||
ELSE
|
||||
Done := TRUE;
|
||||
END InitIO;
|
||||
readAgain := TRUE;
|
||||
END;
|
||||
END ReadAgain;
|
||||
|
||||
PROCEDURE WriteInt*(arg: LONGINT);
|
||||
VAR field: ARRAY 23 OF CHAR;
|
||||
BEGIN (* the field size should be big enough to hold the long number. it was 12 to hold just 32 bit numbers, now it can hold 64 bit numbers; need to be more for 128bit numbers; -- noch *)
|
||||
ConvertInteger(arg, 1, field);
|
||||
WriteString(field);
|
||||
END WriteInt;
|
||||
PROCEDURE Write*(ch: CHAR);
|
||||
BEGIN
|
||||
Done := WriteChar(ch);
|
||||
END Write;
|
||||
|
||||
PROCEDURE ReadInt*(VAR arg: LONGINT);
|
||||
VAR ch: CHAR;
|
||||
minus: BOOLEAN;
|
||||
BEGIN
|
||||
minus := FALSE;
|
||||
REPEAT
|
||||
Read(ch);
|
||||
IF ~Done THEN RETURN END;
|
||||
IF ch = "-" THEN
|
||||
minus := TRUE;
|
||||
ELSIF (ch # " ") & (ch # nl) & ((ch < "0") OR (ch > "9")) THEN
|
||||
WriteString("--- Integer expected on input"); WriteLn;
|
||||
END;
|
||||
UNTIL (ch >= "0") & (ch <= "9");
|
||||
arg := ORD(ch) - ORD("0");
|
||||
REPEAT
|
||||
Read(ch);
|
||||
IF ~Done THEN RETURN END;
|
||||
IF (ch >= "0") & (ch <= "9") THEN
|
||||
arg := arg*10 + (ORD(ch) - ORD("0"));
|
||||
END;
|
||||
UNTIL (ch < "0") OR (ch > "9");
|
||||
ReadAgain;
|
||||
IF minus THEN arg := -arg; END;
|
||||
END ReadInt;
|
||||
PROCEDURE WriteLn*;
|
||||
CONST nl = 0AX;
|
||||
BEGIN
|
||||
Write(nl);
|
||||
END WriteLn;
|
||||
|
||||
PROCEDURE ReadLine*(VAR string: ARRAY OF CHAR);
|
||||
VAR
|
||||
index: INTEGER;
|
||||
ch: CHAR;
|
||||
ok: BOOLEAN;
|
||||
BEGIN
|
||||
index := 0; ok := TRUE;
|
||||
LOOP
|
||||
IF ~ReadChar(ch) THEN ok := FALSE; EXIT END;
|
||||
IF ch = nl THEN EXIT END;
|
||||
IF index < LEN(string) THEN
|
||||
string[index] := ch; INC(index);
|
||||
END;
|
||||
PROCEDURE WriteString*(s: ARRAY OF CHAR);
|
||||
VAR i: INTEGER;
|
||||
BEGIN
|
||||
i := 0;
|
||||
WHILE (i < LEN(s)) & (s[i] # 0X) DO
|
||||
Write(s[i]);
|
||||
INC(i);
|
||||
END;
|
||||
END WriteString;
|
||||
|
||||
PROCEDURE InitIO;
|
||||
BEGIN
|
||||
readAgain := FALSE;
|
||||
Done := TRUE;
|
||||
END InitIO;
|
||||
|
||||
PROCEDURE WriteInt*(arg: LONGINT);
|
||||
VAR field: ARRAY 23 OF CHAR;
|
||||
BEGIN (* the field size should be big enough to hold the long number. it was 12 to hold just 32 bit numbers, now it can hold 64 bit numbers; need to be more for 128bit numbers; -- noch *)
|
||||
ConvertInteger(arg, 1, field);
|
||||
WriteString(field);
|
||||
END WriteInt;
|
||||
|
||||
PROCEDURE ReadInt*(VAR arg: LONGINT);
|
||||
VAR ch: CHAR;
|
||||
minus: BOOLEAN;
|
||||
BEGIN
|
||||
minus := FALSE;
|
||||
REPEAT
|
||||
Read(ch);
|
||||
IF ~Done THEN RETURN END;
|
||||
IF ch = "-" THEN
|
||||
minus := TRUE;
|
||||
ELSIF (ch # " ") & (ch # nl) & ((ch < "0") OR (ch > "9")) THEN
|
||||
WriteString("--- Integer expected on input"); WriteLn;
|
||||
END;
|
||||
UNTIL (ch >= "0") & (ch <= "9");
|
||||
arg := ORD(ch) - ORD("0");
|
||||
REPEAT
|
||||
Read(ch);
|
||||
IF ~Done THEN RETURN END;
|
||||
IF (ch >= "0") & (ch <= "9") THEN
|
||||
arg := arg*10 + (ORD(ch) - ORD("0"));
|
||||
END;
|
||||
UNTIL (ch < "0") OR (ch > "9");
|
||||
ReadAgain;
|
||||
IF minus THEN arg := -arg; END;
|
||||
END ReadInt;
|
||||
|
||||
PROCEDURE ReadLine*(VAR string: ARRAY OF CHAR);
|
||||
VAR
|
||||
index: INTEGER;
|
||||
ch: CHAR;
|
||||
ok: BOOLEAN;
|
||||
BEGIN
|
||||
index := 0; ok := TRUE;
|
||||
LOOP
|
||||
IF ~ReadChar(ch) THEN ok := FALSE; EXIT END;
|
||||
IF ch = nl THEN EXIT END;
|
||||
IF index < LEN(string) THEN
|
||||
string[index] := 0X;
|
||||
string[index] := ch; INC(index);
|
||||
END;
|
||||
Done := ok OR (index > 0);
|
||||
END ReadLine;
|
||||
END;
|
||||
IF index < LEN(string) THEN
|
||||
string[index] := 0X;
|
||||
END;
|
||||
Done := ok OR (index > 0);
|
||||
END ReadLine;
|
||||
|
||||
BEGIN
|
||||
InitIO;
|
||||
InitIO;
|
||||
END ulmIO.
|
||||
|
|
|
|||
|
|
@ -50,23 +50,25 @@ TYPE pchar = POINTER TO ARRAY 1 OF CHAR;
|
|||
END TAS;
|
||||
|
||||
PROCEDURE UNIXCALL*(syscall: LONGINT; VAR d0, d1: LONGINT; (* in ulm version both LONGINT and INTEGER are 4 byte size *)
|
||||
arg1, arg2, arg3: LONGINT) : BOOLEAN;
|
||||
arg1, arg2, arg3: LONGINT) : BOOLEAN;
|
||||
VAR
|
||||
n: LONGINT;
|
||||
ch: CHAR;
|
||||
pch: pchar;
|
||||
pstr: pstring;
|
||||
pstr: pstring;
|
||||
h: Platform.FileHandle;
|
||||
(* pst : pstatus; *)
|
||||
BEGIN
|
||||
|
||||
|
||||
IF syscall = Sys.read THEN
|
||||
RETURN Platform.Read(arg1, arg2, arg3, n) = 0;
|
||||
d0 := Platform.Read(arg1, arg2, arg3, n);
|
||||
IF d0 >= 0 THEN d0 := n END;
|
||||
RETURN d0 >= 0;
|
||||
(*NEW(pch);
|
||||
pch := SYSTEM.VAL(pchar, arg2);
|
||||
ch := pch^[0];
|
||||
n := read(ch);
|
||||
IF n # 1 THEN
|
||||
IF n # 1 THEN
|
||||
ch := 0X;
|
||||
RETURN FALSE
|
||||
ELSE
|
||||
|
|
@ -81,7 +83,7 @@ TYPE pchar = POINTER TO ARRAY 1 OF CHAR;
|
|||
n := Write(SYSTEM.VAL(LONGINT, pch), 1);
|
||||
IF n # 1 THEN RETURN FALSE ELSE RETURN TRUE END
|
||||
*)
|
||||
ELSIF syscall = Sys.open THEN
|
||||
ELSIF syscall = Sys.open THEN
|
||||
pstr := SYSTEM.VAL(pstring, arg1);
|
||||
IF SYSTEM.VAL(SET, arg3) * {0,1} # {} THEN
|
||||
RETURN Platform.OldRW(pstr^, d0) = 0
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ MODULE Console; (* J. Templ, 29-June-96 *)
|
|||
PROCEDURE Flush*;
|
||||
VAR error: Platform.ErrorCode;
|
||||
BEGIN
|
||||
error := Platform.Write(Platform.StdOut, SYSTEM.ADR(line), pos);
|
||||
error := Platform.Write(Platform.StdOut, SYSTEM.ADR(line), pos);
|
||||
pos := 0;
|
||||
END Flush;
|
||||
|
||||
|
|
@ -53,9 +53,9 @@ MODULE Console; (* J. Templ, 29-June-96 *)
|
|||
END Bool;
|
||||
|
||||
PROCEDURE Hex*(i: LONGINT);
|
||||
VAR k, n: LONGINT;
|
||||
VAR k: INTEGER; n: SYSTEM.INT64;
|
||||
BEGIN
|
||||
k := -28;
|
||||
k := 4 - 8 * SIZE(LONGINT);
|
||||
WHILE k <= 0 DO
|
||||
n := ASH(i, k) MOD 16;
|
||||
IF n <= 9 THEN Char(CHR(ORD("0") + n)) ELSE Char(CHR(ORD("A") - 10 + n)) END ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue