Site Menu Project Specification Implementation Recommendations Reference Needs Updating Work in Progress Wastebasket Wiki Manual |
IO FormatWiP.IOFormat HistoryHide minor edits - Show changes to output 2010-01-18 14:55
by -
Changed lines 41-42 from:
(* Returns the value of field width in format string s. Returns zero if no valid width value is contained in s. to:
(* Returns the value of field width in format string s. Returns zero if no valid width value is contained in s. 2010-01-18 14:54
by -
Changed line 30 from:
to:
Returns zero if no valid leading value is contained in s. *) 2010-01-18 14:53
by -
Changed lines 26-27 from:
to:
Returns ASCII.NUL if no valid format char is contained in s. *) Changed line 38 from:
to:
Returns ASCII.NUL if no padding sense is contained in s. *) 2010-01-18 14:53
by -
Changed lines 22-23 from:
An empty string is assigned to s if any to:
An empty string is assigned to s if any argument is out of range or if the size of s is insufficient. *) Changed lines 25-26 from:
(* Returns the format char in format string s. Returns ASCII.NUL if no valid format char is contained in s. *) to:
(* Returns the format char in format string s. Returns ASCII.NUL if no valid format char is contained in s. *) 2010-01-18 14:51
by -
Changed lines 22-23 from:
to:
An empty string is assigned to s if any of the arguments are out of range or if the size of s is insufficient. *) Changed lines 28-29 from:
(* Returns the value of field leading in format string s. Returns zero if no valid leading value is contained in s. *) to:
(* Returns the value of field leading in format string s. Returns zero if no valid leading value is contained in s. *) Changed lines 32-33 from:
(* Returns the value of field trailing in format string s. Returns zero if no valid trailing value is contained in s. *) to:
(* Returns the value of field trailing in format string s. Returns zero if no valid trailing value is contained in s. *) Changed lines 36-37 from:
(* Returns the padding sense field in format string s. Returns ASCII.NUL if no padding sense is contained in s. *) to:
(* Returns the padding sense field in format string s. Returns ASCII.NUL if no padding sense is contained in s. *) 2010-01-18 14:49
by -
Added lines 1-40:
[@DEFINITION MODULE IOFormat; CONST maxFormatStrSize = 12; (* The EBNF of a format string is as follows: formatStr : wholeNumFmtStr | realNumFmtStr ; wholeNumFmtStr : '"' wholeNumFmtChr ( ':' leading ( ':' padding fieldWidth )? )? '"' ; wholeNumFmtChr : 'N' | '*' | 'x' | 'H' ; realNumFmtStr : '"' realNumFmtChr ( ':' leading ( ':' trailing ( ':' padding fieldWidth )? )? )? '"' ; realNumFmtChr : 'N' | '*' | 'E' ; leading : digit digit? ; trailing : digit digit? ; padding : 'L' | 'R' ; fieldWidth : digit digit? digit? ; *) PROCEDURE SetFormatStr( VAR s : ARRAY OF CHAR; fmt : CHAR; leading, trailing : CARDINAL; width : INTEGER ); (* Composes a format string from the specified parameters and assigns it to s. A negative value for width means left padding, a positive value means right padding. fmt must be any of 'N', '*', 'x' or 'H'. leading and trailing must be a value between 0 and 99. width must greater than -999 and less than 999. If any of the arguments are out of range or if the size of s is insufficient, an empty string is assigned to s. *) PROCEDURE FormatChr( s : ARRAY OF CHAR ) : CHAR; (* Returns the format char in format string s. Returns ASCII.NUL if no valid format char is contained in s. *) PROCEDURE LeadingDigits( s : ARRAY OF CHAR ) : CARDINAL; (* Returns the value of field leading in format string s. Returns zero if no valid leading value is contained in s. *) PROCEDURE TrailingDigits( s : ARRAY OF CHAR ) : CARDINAL; (* Returns the value of field trailing in format string s. Returns zero if no valid trailing value is contained in s. *) PROCEDURE Padding( s : ARRAY OF CHAR ) : CHAR; (* Returns the padding sense field in format string s. Returns ASCII.NUL if no padding sense is contained in s. *) PROCEDURE FieldWidth( s : ARRAY OF CHAR ) : INTEGER; (* Returns the value of field width in format string s. Returns zero if no valid width value is contained in s. A negative value for width means left padding, a positive value means right padding. *) END IOFormat.@] |