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 INTEGER

Spec.IOModuleINTEGER History

Hide minor edits - Show changes to output

2010-05-24 12:50 by benjk -
Changed lines 3-4 from:
(* File based I/O for type INTEGER *)
to:
(* I/O Module for Type INTEGER *)
Changed lines 7-8 from:
(* The EBNF for the textual representation of a value of type INTEGER is as follows:
   cardinalValue : simpleFormat | cLiteralFormat | m2LiteralFormat | universalFormat ;
to:
(* EBNF of the textual representation of INTEGER values:
    cardinalValue
: simpleFormat |
        cBase16Format | m2Base16Format | universalFormat ;
Changed lines 11-12 from:
   cLiteralFormat : '0x' simpleFormat ;
    m2LiteralFormat : '0' simpleFormat 'H' ;
to:
   cBase16Format : "0x" base16Digit+ ;
    m2Base16Format : "0" base16Digit+ "H" ;
Changed lines 14-15 from:
   sign : ' ' | '+' | '-' ;
    fillChar : ' ' | '*' | '0' ;
to:
   sign : "+" | "-" ;
    fillChar : " " | "*" | "0" ;
Changed line 17 from:
   separator : ' ' | '.' | ',' ;
to:
   separator : " " | "." | "," ;
Changed lines 20-23 from:
   decimalDigit  : '0' .. '9'*)

PROCEDURE Read( infile
: File; VAR n : INTEGER );
(* Reads the textual representation of a INTEGER value in simple format from input stream infile
to:
   decimalDigit  : "0" .. "9" ;
   base16Digit : decimalDigit | "A" .. "F" ; *)

PROCEDURE Read ( infile : File; VAR n : INTEGER );
(* Reads the textual representation of an INTEGER value from
stream infile
Changed lines 26-35 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 n
   - the file status is set to any of allRight, outOfRange, wrongFormat, endOfLine, or endOfInput *)

PROCEDURE Write( outfile : File; n : INTEGER );
(* 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 n : INTEGER );
(* Writes a formatted textual representation of one or more INTEGER 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 n
  - the file status is set to any
of:
    success, outOfRange, wrongFormat, endOfLine, or endOfInput. This
 
  procedure is substituted for invocations of READ with an INTEGER argument.*)

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

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