home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1985-04-25 | 2.2 KB | 59 lines |
- (****************************************
- * *
- * Conversions: *
- * *
- * Number to string conversion *
- * *
- * Version of 03.06.83 *
- * *
- * Institut fuer Informatik *
- * ETH-Zuerich *
- * CH-8092 Zuerich *
- * *
- ****************************************)
-
- DEFINITION MODULE Conversions; (* LG, PF *)
-
- FROM SYSTEM IMPORT ADDRESS;
-
- EXPORT QUALIFIED ConvertOctal, ConvertHex,
- ConvertCardinal, ConvertInteger,
- ConvertAddrOct, ConvertAddrHex, ConvertAddrDec;
-
-
- PROCEDURE ConvertOctal(num, len: CARDINAL; VAR str: ARRAY OF CHAR);
- (* conversion of an octal number to a string *)
-
- PROCEDURE ConvertHex(num, len: CARDINAL; VAR str: ARRAY OF CHAR);
- (* conversion of a hexadecimal number to a string *)
-
- PROCEDURE ConvertCardinal(num, len: CARDINAL; VAR str: ARRAY OF CHAR);
- (* conversion of a cardinal decimal number to a string *)
-
- PROCEDURE ConvertInteger(num: INTEGER; len: CARDINAL;
- VAR str: ARRAY OF CHAR);
- (* conversion of an integer decimal number to a string *)
-
- PROCEDURE ConvertAddrHex (num: ADDRESS; len: CARDINAL;
- VAR str: ARRAY OF CHAR);
- (* conversion of an address into a hexadecimal string *)
-
- PROCEDURE ConvertAddrOct (num: ADDRESS; len: CARDINAL;
- VAR str: ARRAY OF CHAR);
- (* conversion of an address into an octal string*)
-
- PROCEDURE ConvertAddrDec (num: ADDRESS; len: CARDINAL;
- VAR str: ARRAY OF CHAR);
- (* conversion of an address into a decimal string *)
-
-
- (* note: len is the minimum size of the converted number, e.g. 0.
- octal and hexa conversions fill with leading zeroes,
- decimal conversion fills with blanks *)
-
- (* note 2: the routines for address conversion are distinct,
- because, for the MC68000, an ADDRESS is 32 bits, but a CARDINAL
- is normally 16 bits - depending on compilation options *)
-
- END Conversions.
-