Site Menu Project Specification Implementation Recommendations Reference Needs Updating Work in Progress Wastebasket Wiki Manual |
Unsigned 60Spec.Unsigned60 HistoryHide minor edits - Show changes to output 2010-05-24 14:58
by -
Changed lines 1-5 from:
[@DEFINITION MODULE (* Unsigned Integer Subrange Type With Values from 0 to to:
[@DEFINITION MODULE Unsigned60 [ZTYPE]; (* Unsigned Integer Subrange Type With Values from 0 to 59 *) Changed lines 9-10 from:
(* to:
(* Unsigned60 type *) Changed line 12 from:
to:
Unsigned60 = OPAQUE RECORD Changed lines 14-16 from:
END; (* to:
END; (* Unsigned60 *) Changed lines 23-30 from:
(* Smallest value of type This value is bound to TMIN for type CONST [TMAX] maxValue = (* Largest value of type This value is bound to TMAX for type to:
(* Smallest value of type Unsigned60. This value is bound to TMIN for type Unsigned60. *) CONST [TMAX] maxValue = 59; (* Largest value of type Unsigned60. This value is bound to TMAX for type Unsigned60. *) Changed lines 33-34 from:
PROCEDURE [:=] assign ( VAR assignTo : (* Converts string literal to a to:
PROCEDURE [:=] assign ( VAR assignTo : Unsigned60; literal : ARRAY OF CHAR ); (* Converts string literal to a Unsigned60 value and assigns it to assignTo. Changed lines 40-42 from:
PROCEDURE [::] toCARD ( n : (* Converts This function is bound to the :: operator for to:
PROCEDURE [::] toCARD ( n : Unsigned60 ) : CARDINAL; (* Converts Unsigned60 value n to a CARDINAL value and returns it. This function is bound to the :: operator for Unsigned60 to CARDINAL Changed lines 45-47 from:
PROCEDURE [::] toINT ( n : (* Converts This function is bound to the :: operator for to:
PROCEDURE [::] toINT ( n : Unsigned60 ) : INTEGER; (* Converts Unsigned60 value n to an INTEGER value and returns it. This function is bound to the :: operator for Unsigned60 to INTEGER Changed lines 50-52 from:
PROCEDURE [::] fromCARD ( n : CARDINAL ) : (* Converts CARDINAL value n to a This function is bound to the :: operator for CARDINAL to to:
PROCEDURE [::] fromCARD ( n : CARDINAL ) : Unsigned60; (* Converts CARDINAL value n to a Unsigned60 value and returns it. This function is bound to the :: operator for CARDINAL to Unsigned60 Changed lines 55-57 from:
PROCEDURE [::] fromINT ( n : INTEGER ) : (* Converts INTEGER value n to a This function is bound to the :: operator for INTEGER to to:
PROCEDURE [::] fromINT ( n : INTEGER ) : Unsigned60; (* Converts INTEGER value n to a Unsigned60 value and returns it. This function is bound to the :: operator for INTEGER to Unsigned60 Changed lines 63-67 from:
PROCEDURE [ODD] odd ( n : (* Returns TRUE if This function is bound to pervasive function ODD for type to:
PROCEDURE [ODD] odd ( n : Unsigned60 ) : BOOLEAN; (* Returns TRUE if Unsigned60 value n is odd, otherwise FALSE. This function is bound to pervasive function ODD for type Unsigned60. *) Changed lines 70-86 from:
PROCEDURE [+] add ( n1, n2 : (* Adds This function is bound to the + operator for type PROCEDURE [-] sub ( n1, n2 : (* Subtracts This function is bound to the - operator for type PROCEDURE [*] multiply ( n1, n2 : (* Multiplies This function it bound to the * operator for type PROCEDURE [/] divide ( n1, n2 : (* Divives This function is bound to the / operator for type to:
PROCEDURE [+] add ( n1, n2 : Unsigned60 ) : Unsigned60; (* Adds Unsigned60 values n1 and n2 and returns the result. This function is bound to the + operator for type Unsigned60. *) PROCEDURE [-] sub ( n1, n2 : Unsigned60 ) : Unsigned60; (* Subtracts Unsigned60 value n2 from n1 and returns the result. This function is bound to the - operator for type Unsigned60. *) PROCEDURE [*] multiply ( n1, n2 : Unsigned60 ) : Unsigned60; (* Multiplies Unsigned60 values n1 and n2 and returns the result. This function it bound to the * operator for type Unsigned60. *) PROCEDURE [/] divide ( n1, n2 : Unsigned60 ) : Unsigned60; (* Divives Unsigned60 value n1 by n2 and returns the result. This function is bound to the / operator for type Unsigned60. *) Changed lines 89-101 from:
PROCEDURE [=] isEqual ( n1, n2 : (* Returns TRUE if This function is bound to operators = and # for type PROCEDURE [<] isLess ( n1, n2 : (* Returns TRUE if This function is bound to operators < and >= for type PROCEDURE [>] isGreater ( n1, n2 : (* Returns TRUE if This function is bound to operators > and <= for type to:
PROCEDURE [=] isEqual ( n1, n2 : Unsigned60 ) : BOOLEAN; (* Returns TRUE if Unsigned60 values n1 and n2 are equal, otherwise FALSE. This function is bound to operators = and # for type Unsigned60. *) PROCEDURE [<] isLess ( n1, n2 : Unsigned60 ) : BOOLEAN; (* Returns TRUE if Unsigned60 value n1 is less than n2, otherwise FASLE. This function is bound to operators < and >= for type Unsigned60. *) PROCEDURE [>] isGreater ( n1, n2 : Unsigned60 ) : BOOLEAN; (* Returns TRUE if Unsigned60 value n1 is greater than n2, otherwise FALSE. This function is bound to operators > and <= for type Unsigned60. *) Changed lines 106-107 from:
PROCEDURE [TO] toSXF ( n : (* Converts to:
PROCEDURE [TO] toSXF ( n : Unsigned60; VAR s : ARRAY OF CHAR ); (* Converts Unsigned60 value n to a string in scalar exchange format. Changed lines 111-112 from:
PROCEDURE [FROM] fromSXF ( VAR n : (* Converts a string in scalar exchange format to a to:
PROCEDURE [FROM] fromSXF ( VAR n : Unsigned60; CONST s : ARRAY OF CHAR ); (* Converts a string in scalar exchange format to a Unsigned60 value. Changed lines 119-120 from:
PROCEDURE Read( infile : File; VAR n : (* Reads the textual representation of a to:
PROCEDURE Read( infile : File; VAR n : Unsigned60 ); (* Reads the textual representation of a Unsigned60 value from stream infile Changed line 128 from:
This procedure is substituted for invocations of READ with a to:
This procedure is substituted for invocations of READ with a Unsigned60 Changed line 131 from:
PROCEDURE Write( outfile : File; n : to:
PROCEDURE Write( outfile : File; n : Unsigned60 ); Changed line 133 from:
This procedure is substituted for invocations of WRITE with a to:
This procedure is substituted for invocations of WRITE with a Unsigned60 Changed lines 138-139 from:
items : VARIADIC OF (* Writes a formatted textual representation of one or more to:
items : VARIADIC OF Unsigned60 ); (* Writes a formatted textual representation of one or more Unsigned60 values Changed lines 142-144 from:
END to:
Unsigned60 arguments. *) END Unsigned60.@] 2010-05-24 13:09
by -
Added lines 1-144:
[@DEFINITION MODULE Unsigned24 [ZTYPE]; (* Unsigned Integer Subrange Type With Values from 0 to 23 *) FROM FileIO IMPORT File; (* required for IO *) (* Unsigned24 type *) TYPE Unsigned24 = OPAQUE RECORD value : OCTET; (* 8 bits *) END; (* Unsigned24 *) (* Z-Type bindings to operators, pervasives and primitives: *) (* Range *) CONST [TMIN] minValue = 0; (* Smallest value of type Unsigned24. This value is bound to TMIN for type Unsigned24. *) CONST [TMAX] maxValue = 23; (* Largest value of type Unsigned24. This value is bound to TMAX for type Unsigned24. *) (* Literal assignment *) PROCEDURE [:=] assign ( VAR assignTo : Unsigned24; literal : ARRAY OF CHAR ); (* Converts string literal to a Unsigned24 value and assigns it to assignTo. This procedure is bound to the := operator for literal assignment. *) (* Type conversions *) PROCEDURE [::] toCARD ( n : Unsigned24 ) : CARDINAL; (* Converts Unsigned24 value n to a CARDINAL value and returns it. This function is bound to the :: operator for Unsigned24 to CARDINAL conversion. *) PROCEDURE [::] toINT ( n : Unsigned24 ) : INTEGER; (* Converts Unsigned24 value n to an INTEGER value and returns it. This function is bound to the :: operator for Unsigned24 to INTEGER conversion. *) PROCEDURE [::] fromCARD ( n : CARDINAL ) : Unsigned24; (* Converts CARDINAL value n to a Unsigned24 value and returns it. This function is bound to the :: operator for CARDINAL to Unsigned24 conversion. *) PROCEDURE [::] fromINT ( n : INTEGER ) : Unsigned24; (* Converts INTEGER value n to a Unsigned24 value and returns it. This function is bound to the :: operator for INTEGER to Unsigned24 conversion. *) (* Monadic arithmetic operations *) PROCEDURE [ODD] odd ( n : Unsigned24 ) : BOOLEAN; (* Returns TRUE if Unsigned24 value n is odd, otherwise FALSE. This function is bound to pervasive function ODD for type Unsigned24. *) (* Dyadic arithmetic operations *) PROCEDURE [+] add ( n1, n2 : Unsigned24 ) : Unsigned24; (* Adds Unsigned24 values n1 and n2 and returns the result. This function is bound to the + operator for type Unsigned24. *) PROCEDURE [-] sub ( n1, n2 : Unsigned24 ) : Unsigned24; (* Subtracts Unsigned24 value n2 from n1 and returns the result. This function is bound to the - operator for type Unsigned24. *) PROCEDURE [*] multiply ( n1, n2 : Unsigned24 ) : Unsigned24; (* Multiplies Unsigned24 values n1 and n2 and returns the result. This function it bound to the * operator for type Unsigned24. *) PROCEDURE [/] divide ( n1, n2 : Unsigned24 ) : Unsigned24; (* Divives Unsigned24 value n1 by n2 and returns the result. This function is bound to the / operator for type Unsigned24. *) (* Relational operations *) PROCEDURE [=] isEqual ( n1, n2 : Unsigned24 ) : BOOLEAN; (* Returns TRUE if Unsigned24 values n1 and n2 are equal, otherwise FALSE. This function is bound to operators = and # for type Unsigned24. *) PROCEDURE [<] isLess ( n1, n2 : Unsigned24 ) : BOOLEAN; (* Returns TRUE if Unsigned24 value n1 is less than n2, otherwise FASLE. This function is bound to operators < and >= for type Unsigned24. *) PROCEDURE [>] isGreater ( n1, n2 : Unsigned24 ) : BOOLEAN; (* Returns TRUE if Unsigned24 value n1 is greater than n2, otherwise FALSE. This function is bound to operators > and <= for type Unsigned24. *) (* Scalar conversion primitives *) CONST digitCapacity = 2; (* maximum digits in native format *) PROCEDURE [TO] toSXF ( n : Unsigned24; VAR s : ARRAY OF CHAR ); (* Converts Unsigned24 value n to a string in scalar exchange format. This procedure is used to synthesise conversions to other scalar types when no direct conversion path exists. *) PROCEDURE [FROM] fromSXF ( VAR n : Unsigned24; CONST s : ARRAY OF CHAR ); (* Converts a string in scalar exchange format to a Unsigned24 value. This procedure is used to synthesise conversions from other scalar types when no direct conversion path exists. *) (* IO operations *) PROCEDURE Read( infile : File; VAR n : Unsigned24 ); (* Reads the textual representation of a Unsigned24 value from stream infile - any leading whitespace is skipped - 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: success, outOfRange, wrongFormat, endOfLine, or endOfInput. This procedure is substituted for invocations of READ with a Unsigned24 argument. *) PROCEDURE Write( outfile : File; n : Unsigned24 ); (* Writes the textual representation of value n to stream outfile. This procedure is substituted for invocations of WRITE with a Unsigned24 argument. *) PROCEDURE WriteF ( outfile : File; CONST fmtStr : ARRAY OF CHAR; items : VARIADIC OF Unsigned24 ); (* Writes a formatted textual representation of one or more Unsigned24 values to output stream outfile. The output format is determined by fmtStr. This procedure is substituted for invocations of WRITEF with one or more Unsigned24 arguments. *) END Unsigned24.@] |