2019-03-11 09:59:55 +01:00
|
|
|
(*
|
|
|
|
BSD 2-Clause License
|
|
|
|
|
2019-09-26 22:23:06 +02:00
|
|
|
Copyright (c) 2018, 2019, Anton Krotov
|
2019-03-11 09:59:55 +01:00
|
|
|
All rights reserved.
|
|
|
|
*)
|
|
|
|
|
|
|
|
MODULE CONSOLE;
|
|
|
|
|
|
|
|
IMPORT UTILS, STRINGS;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE String* (s: ARRAY OF CHAR);
|
|
|
|
VAR
|
|
|
|
i: INTEGER;
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
i := 0;
|
|
|
|
WHILE (i < LEN(s)) & (s[i] # 0X) DO
|
|
|
|
UTILS.OutChar(s[i]);
|
|
|
|
INC(i)
|
|
|
|
END
|
|
|
|
END String;
|
|
|
|
|
|
|
|
|
2019-09-26 22:23:06 +02:00
|
|
|
PROCEDURE Int* (x: INTEGER);
|
2019-03-11 09:59:55 +01:00
|
|
|
VAR
|
2019-09-26 22:23:06 +02:00
|
|
|
s: ARRAY 24 OF CHAR;
|
2019-03-11 09:59:55 +01:00
|
|
|
|
|
|
|
BEGIN
|
2019-09-26 22:23:06 +02:00
|
|
|
STRINGS.IntToStr(x, s);
|
2019-03-11 09:59:55 +01:00
|
|
|
String(s)
|
|
|
|
END Int;
|
|
|
|
|
|
|
|
|
2019-09-26 22:23:06 +02:00
|
|
|
PROCEDURE Hex* (x, n: INTEGER);
|
|
|
|
VAR
|
|
|
|
s: ARRAY 24 OF CHAR;
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
STRINGS.IntToHex(x, s, n);
|
|
|
|
String(s)
|
|
|
|
END Hex;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE Int2* (x: INTEGER);
|
2019-03-11 09:59:55 +01:00
|
|
|
BEGIN
|
2019-09-26 22:23:06 +02:00
|
|
|
IF x < 10 THEN
|
2019-03-11 09:59:55 +01:00
|
|
|
String("0")
|
|
|
|
END;
|
2019-09-26 22:23:06 +02:00
|
|
|
Int(x)
|
2019-03-11 09:59:55 +01:00
|
|
|
END Int2;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE Ln*;
|
|
|
|
BEGIN
|
|
|
|
String(UTILS.eol)
|
2019-09-26 22:23:06 +02:00
|
|
|
END Ln;
|
2019-03-11 09:59:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE StringLn* (s: ARRAY OF CHAR);
|
|
|
|
BEGIN
|
|
|
|
String(s);
|
|
|
|
Ln
|
|
|
|
END StringLn;
|
|
|
|
|
|
|
|
|
2019-09-26 22:23:06 +02:00
|
|
|
PROCEDURE IntLn* (x: INTEGER);
|
|
|
|
BEGIN
|
|
|
|
Int(x);
|
2019-03-11 09:59:55 +01:00
|
|
|
Ln
|
|
|
|
END IntLn;
|
|
|
|
|
|
|
|
|
2019-09-26 22:23:06 +02:00
|
|
|
PROCEDURE Int2Ln* (x: INTEGER);
|
|
|
|
BEGIN
|
|
|
|
Int2(x);
|
2019-03-11 09:59:55 +01:00
|
|
|
Ln
|
|
|
|
END Int2Ln;
|
|
|
|
|
|
|
|
|
|
|
|
END CONSOLE.
|