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 BITSET

Spec.IOModuleBITSET History

Hide minor edits - Show changes to output

2010-05-24 12:43 by benjk -
Changed lines 3-4 from:
(* File based I/O for type BITSET *)
to:
(* I/O Module for Type BITSET *)
Changed line 8 from:
   bitsetValue : simpleFormat | bitGroupFormat ;
to:
   bitsetValue : simpleFormat | compactFormat | bitGroupFormat ;
Changed lines 10-12 from:
   bitGroupFormat : '{' bit+ ( groupSeparator? bit+ )* '}' ;
    groupSeparator : ' ' | '.' ;
    bit  : '0' | '1' ;
to:
   compactFormat : base16Digit+ ;
 
  bitGroupFormat : "{" bit+ ( groupSeparator? bit+ )* "}" ;
    groupSeparator : " " | "." ;
    bit  : "0" | "1" ;
    base16Digit : "0" .. "9" | "A" .. "F"
;
Changed lines 17-18 from:
PROCEDURE Read( infile : File; VAR set : BITSET );
(* Reads the textual representation of a BITSET value in simple format from input stream infile
to:
PROCEDURE Read ( infile : File; VAR set : BITSET );
(* Reads the textual representation of a BITSET value from stream infile
Changed lines 20-29 from:
   - any remaining characters that are part of the numeral being read are removed from infile
   - the value of the bitset string read is assigned to the variable passed in for set
   - the file status is set to any of allRight, outOfRange, wrongFormat, endOfLine, or endOfInput *)

PROCEDURE Write( outfile : File; set : BITSET );
(* Writes the textual representation
of value set in simple format to output stream outfile. *)

PROCEDURE WriteF( outfile : File; fmtStr : ARRAY OF CHAR
; items : CARDINAL; VARIADIC v[items] OF set : BITSET );
(* Writes a formatted textual representation of one or more BITSET 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 set
  - the file status is set to any
of:
    success, outOfRange, wrongFormat, endOfLine, or endOfInput. This
 
  procedure is substituted for invocations of READ with a BITSET argument. *)

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

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