@database Conversions
@node Main "Conversions"

Prozeduren

   @{" StrToVal " link Modul 3}                    @{" ValToStr " link Modul 19}                 

@endnode
@node Modul "TMP:Modula-2/Conversions.def"
DEFINITION MODULE Conversions; (* jr/17mai87 *)
(*$ NameChk:=FALSE *)

PROCEDURE StrToVal(
             VAR s: ARRAY OF CHAR;
             VAR l: LONGINT;
             VAR signed: BOOLEAN;
             base: INTEGER;
             VAR err: BOOLEAN);

(* Converts a string 's' with base 'base' to value 'l'.

   Possible error conditions:
   - illegal 'base'
   - some characters in 's' are illegal digits to 'base'
   - the resulting value is too large for a LONGINT
*)


PROCEDURE ValToStr(
             l: LONGINT;
             signed: BOOLEAN;
             VAR s: ARRAY OF CHAR;
             base,
             width: INTEGER;
             fillC: CHAR;
             VAR err: BOOLEAN);

(* Converts value 'l' with base 'base' to output string
   's'. The value will be positioned within a field of
    size 'width'.  If 'width' is larger than the needed
    amount of characters to represent 'l', the field is
    filled up with 'fillC'.
    'width'>0: number is right adjusted
    'width'<0: number is left adjusted

    Possible error conditions:
    - illegal 'base'
    - 's' is to small
*)

END Conversions.def

@endnode
