dos_compilers/Logitech Modula-2 v1.1/CONVERSI.DEF
2024-06-30 15:43:04 -07:00

57 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(* Version 1.10, Nov 1984 *)
DEFINITION MODULE Conversions;
(*
Convert from INTEGER and CARDINAL to string
Derived from the Lilith Modula-2 system developed by the
group of Prof. N. Wirth at ETH Zurich, Switzerland.
*)
EXPORT QUALIFIED
ConvertOctal, ConvertHex,
ConvertCardinal, ConvertInteger;
PROCEDURE ConvertOctal(num, len: CARDINAL;
VAR str: ARRAY OF CHAR);
(*
- Convert number to right-justified octal representation
in: num value to be represented,
len minimum width of representation,
out: str result string.
If the representation of 'num' uses fewer than 'len'
digits, blanks are added on the left. If the representa-
tion will not fit in 'str', it is truncated on the right.
*)
PROCEDURE ConvertHex(num, len: CARDINAL;
VAR str: ARRAY OF CHAR);
(*
- Convert number to right-justified hexadecimal
representation.
[see ConvertOctal]
*)
PROCEDURE ConvertCardinal(num, len: CARDINAL;
VAR str: ARRAY OF CHAR);
(*
- Convert a CARDINAL to right-justified decimal
representation.
[see ConvertOctal]
*)
PROCEDURE ConvertInteger(num: INTEGER; len: CARDINAL;
VAR str: ARRAY OF CHAR);
(*
- Convert an INTEGER to right-justified decimal
representation.
[see ConvertOctal]
Note that a leading '-' is generated if num < 0, but never
a '+'.
*)
END Conversions.