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 ADDRESS

Spec.IOModuleADDRESS History

Hide minor edits - Show changes to output

2010-05-24 12:41 by benjk -
Changed lines 3-5 from:
(* File based I/O for type WORD *)

FROM SYSTEM IMPORT WORD;
to:
(* I/O Module for Type ADDRESS *)

FROM SYSTEM IMPORT ADDRESS;
Changed lines 8-17 from:
(* If the address size is divisible by eight, the EBNF for the textual representation of ADDRESS values is:
 
  addressValue : digitGroup digitGroup ( groupSeparator? digitGroup digitGroup )* ;
    digitGroup : sedecimalDigit sedecimalDigit ;
    sedecimalDigit  : '0' .. '9' | 'A' .. 'F' ;
    groupSeparator : ' ' | '.' | ':' ;
  If the address size is not divisible by eight, the textual representation is implementation defined.
  Address values are always left padded with zeroes
to the length required to represent MAX(ADDRESS). *)

PROCEDURE Read( infile : File; VAR a : ADDRESS );
(* Reads the textual representation of an WORD value in simple format from input stream infile
to:
(* EBNF of the textual representation of ADDRESS values:

    addressValue :
      digitGroup digitGroup ( groupSeparator?
digitGroup digitGroup )* ;
 
  digitGroup : base16Digit base16Digit ;
    base16Digit : "0" .. "9" | "A" .. "F" ;
    groupSeparator : " " | "." | ":" ;
   
   static semantics:
   
    ADDRESS values are always left padded with zeroes to the length
    required
to represent the maximum value of type ADDRESS. *)

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

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

PROCEDURE Write (
outfile : File; adr : ADDRESS );
(* Writes the value of ADDRESS adr in standard format to stream outfile. This
   procedure is substituted for invocations of WRITE with an ADDRESS argument.*)

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