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 LONGREAL

Spec.IOModuleLONGREAL 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 LONGREAL *)
to:
(* I/O Module for Type LONGREAL *)
Changed lines 7-13 from:
(* The EBNF for the textual representation of a value of type LONGREAL is as follows:

    longRealValue : unpaddedLongRealValue | leftPaddedLongRealValue | rightPaddedLongRealValue ;
 
  leftPaddedLongRealValue : padding+ unPaddedLongRealValue ;
 
  rightPaddedLongRealValue : unPaddedLongRealValue padding+ ;
    unPaddedLongRealValue : simpleFormat | otherFormats ;
    otherFormats : sign? fillChar* ( fixedFmtNumeral | engFmtNumeral | expFmtNumeral ) suffix? ;
to:
(* EBNF of the textual representation of LONGREAL values:

    realValue
:
        unpaddedRealValue | leftPaddedRealValue | rightPaddedRealValue ;
    leftPaddedRealValue : padding+ unPaddedRealValue ;
    rightPaddedRealValue : unPaddedRealValue padding+ ;
    unPaddedRealValue : simpleFormat | otherFormats ;
    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 : LONGREAL );
(* Reads the textual representation of a LONGREAL 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 : LONGREAL );
(* Reads the textual representation of a LONGREAL 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 : LONGREAL );
(* 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 : LONGREAL );
(* Writes a formatted textual representation of one or more LONGREAL 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 LONGREAL argument.*)

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

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