Modula-2 Reloaded

A Modern Typesafe & Literate Programming Notation

Site Menu

Project

Specification

Implementation

Recommendations

Reference

Needs Updating

Work in Progress

Wastebasket

Wiki Manual

edit SideBar

IO Module REAL

Spec.IOModuleREAL History

Hide minor edits - Show changes to output

2010-05-24 12:51 by benjk -
Changed lines 3-4 from:
(* File based I/O for type REAL *)
to:
(* I/O Module for Type REAL *)
Changed lines 7-9 from:
(* The EBNF for the textual representation of a value of type REAL is as follows:

    realValue : unpaddedRealValue | leftPaddedRealValue | rightPaddedRealValue ;
to:
(* EBNF of the textual representation of REAL values:

    realValue
:
       unpaddedRealValue | leftPaddedRealValue | rightPaddedRealValue ;
Changed lines 14-15 from:
   otherFormats : sign? fillChar* ( fixedFmtNumeral | engFmtNumeral | expFmtNumeral ) suffix? ;
to:
   otherFormats : sign? fillChar*
     
( fixedFmtNumeral | engFmtNumeral | expFmtNumeral ) suffix? ;
Changed lines 21-27 from:
   sign : ' ' | '+' | '-' ;
    negativeSign : '-' ;
    fillChar : ' ' | '*' | '0' ;
    integralPart : decimalDigit decimalDigit? decimalDigit? ( separator? digitGroup )* ;
 
  engIntegralPart : ( ( ( decimalDigit separator? )? decimalDigit )? decimalDigit )? decimalDigit ;
    fractionalPart : ( decimalDigit ( decimalDigit ( decimalDigit separator )? )? )* decimalDigit ;
    exponent : 'E' ( '+' | '-' ) decimalDigit decimalDigit+ ;
to:
   sign : " " | "+" | "-" ;
    negativeSign : "-" ;
    fillChar : " " | "*" | "0" ;
    integralPart :
        decimalDigit decimalDigit? decimalDigit? ( separator? digitGroup )* ;
    engIntegralPart :
        ( ( ( decimalDigit separator? )? decimalDigit )? decimalDigit )?
      decimalDigit ;
    fractionalPart :
        ( decimalDigit ( decimalDigit ( decimalDigit separator )? )? )*
        decimalDigit ;
    exponent : "E" ( "+" | "-"
) decimalDigit decimalDigit+ ;
Changed lines 34-35 from:
   decimalPoint : '.' | ',' ;
    separator : ' ' | '.' | ',' ;
to:
   decimalPoint : "." | "," ;
    separator : " " | "." | "," ;
Changed lines 37-41 from:
   decimalDigit  : '0' .. '9' ;
    suffix : ''' character* ''' ;

  Static semantics are as follows:
to:
   decimalDigit  : "0" .. "9" ;
    suffix : "'" character* "'" ;

  Static semantics:
Changed lines 43-47 from:
   the numeric value represented by engExponent must always be divisible by three. *)


PROCEDURE Read( infile : File; VAR r : REAL );
(* Reads the textual representation of a REAL value in simple format from input stream infile
to:
   the value represented by engExponent must always be divisible by three. *)

PROCEDURE Read ( infile : File; VAR r : REAL );
(* Reads the textual representation of a REAL value from stream infile
Changed lines 48-57 from:
   - any remaining characters that are part of the numeral being read are removed from infile
   - the numeric value of the numeral string read is assigned to the variable passed in for r
   - the file status is set to any of allRight, outOfRange, wrongFormat, endOfLine, or endOfInput *)

PROCEDURE Write( outfile : File; r : REAL );
(* Writes the textual representation
of value n in simple format to output stream outfile *)

PROCEDURE WriteF( outfile
: File; fmtStr : ARRAY OF CHAR; items : CARDINAL; VARIADIC v[items] OF r : REAL );
(* Writes a formatted textual representation
of one or more REAL values to output stream outfile. The value
 
  of parameter items is calculated and inserted automatically. The output format is determined by fmtStr. *)
to:
   - any remaining characters that are part of the value being read are
     removed from infile
  -
the textual representation of the value read is assigned to r
  - the file status is set to any
of:
    success, outOfRange, wrongFormat, endOfLine, or endOfInput. This
 
  procedure is substituted for invocations of READ with a REAL argument. *)

PROCEDURE Write (
outfile : File; r : REAL );
(* Writes the value of REAL r in simple format to stream outfile. This
   procedure is substituted for invocations of WRITE with a REAL argument.*)

PROCEDURE WriteF ( outfile
     : File;
                  CONST fmtStr : ARRAY OF CHAR;
                  items        : VARIADIC OF REAL );
(* Writes a formatted textual representation of one or more REAL values to
  output stream outfile. The output format is determined by fmtStr. This
  procedure is substituted for invocations of WRITEF with one or more
  REAL arguments
. *)