1 (* Library module defined by the International Standard
2 Information technology - programming languages
3 BS ISO/IEC 10514-1:1996E Part 1: Modula-2, Base Language.
5 Copyright ISO/IEC (International Organization for Standardization
6 and International Electrotechnical Commission) 1996-2021.
8 It may be freely copied for the purpose of implementation (see page
9 707 of the Information technology - Programming languages Part 1:
10 Modula-2, Base Language. BS ISO/IEC 10514-1:1996). *)
12 DEFINITION MODULE LongConv
;
14 (* Low-level LONGREAL/string conversions *)
20 ConvResults
= ConvTypes.ConvResults
; (* strAllRight, strOutOfRange,
21 strWrongFormat, strEmpty *)
23 PROCEDURE ScanReal (inputCh
: CHAR; VAR chClass
: ConvTypes.ScanClass
;
24 VAR nextState
: ConvTypes.ScanState
);
25 (* Represents the start state of a finite state scanner for real
26 numbers - assigns class of inputCh to chClass and a procedure
27 representing the next state to nextState.
30 PROCEDURE FormatReal (str
: ARRAY OF CHAR): ConvResults
;
31 (* Returns the format of the string value for conversion to LONGREAL. *)
33 PROCEDURE ValueReal (str
: ARRAY OF CHAR): LONGREAL;
34 (* Returns the value corresponding to the real number string value
35 str if str is well-formed; otherwise raises the LongConv exception.
38 PROCEDURE LengthFloatReal (real
: LONGREAL; sigFigs
: CARDINAL): CARDINAL;
39 (* Returns the number of characters in the floating-point string
40 representation of real with sigFigs significant figures.
43 PROCEDURE LengthEngReal (real
: LONGREAL; sigFigs
: CARDINAL): CARDINAL;
44 (* Returns the number of characters in the floating-point engineering
45 string representation of real with sigFigs significant figures.
48 PROCEDURE LengthFixedReal (real
: LONGREAL; place
: INTEGER): CARDINAL;
49 (* Returns the number of characters in the fixed-point string
50 representation of real rounded to the given place relative to the
54 PROCEDURE IsRConvException (): BOOLEAN;
55 (* Returns TRUE if the current coroutine is in the exceptional
56 execution state because of the raising of an exception in a
57 routine from this module; otherwise returns FALSE.