DEFINITION MODULE NumberConversion;

(* (C) Copyright 1987 Fitted Software Tools. All rights reserved. *)

(*
    procedures to convert integer/cardinal/longint/longcard numbers
    to string format and back.
*)

CONST
    MaxBase = 16;

TYPE
    BASE    = [2..MaxBase];


PROCEDURE StringToCard( str :ARRAY OF CHAR;
                        VAR num :CARDINAL; VAR done :BOOLEAN );

PROCEDURE StringToInt(  str :ARRAY OF CHAR;
                        VAR num :INTEGER; VAR done :BOOLEAN );

PROCEDURE StringToNum(  str :ARRAY OF CHAR; base :BASE;
                        VAR num :CARDINAL; VAR done :BOOLEAN );

PROCEDURE CardToString( num :CARDINAL;
                        VAR str :ARRAY OF CHAR; width :CARDINAL );

PROCEDURE IntToString(  num :INTEGER;
                        VAR str :ARRAY OF CHAR; width :CARDINAL );

PROCEDURE NumToString( num :CARDINAL; base :BASE;
                       VAR str :ARRAY OF CHAR; width :CARDINAL );

PROCEDURE StringToLongCard( str :ARRAY OF CHAR;
                            VAR num :LONGCARD; VAR done :BOOLEAN );

PROCEDURE StringToLongInt(  str :ARRAY OF CHAR;
                            VAR num :LONGINT; VAR done :BOOLEAN );

PROCEDURE StringToLongNum(  str :ARRAY OF CHAR; base :BASE;
                            VAR num :LONGCARD; VAR done :BOOLEAN );

PROCEDURE LongCardToString( num :LONGCARD;
                            VAR str :ARRAY OF CHAR; width :CARDINAL );

PROCEDURE LongIntToString(  num :LONGINT;
                            VAR str :ARRAY OF CHAR; width :CARDINAL );

PROCEDURE LongNumToString(  num :LONGCARD; base :BASE;
                            VAR str :ARRAY OF CHAR; width :CARDINAL );


END NumberConversion.