Site Menu Project Specification Implementation Recommendations Reference Needs Updating Work in Progress Wastebasket Wiki Manual |
Type Sample VectorWiP.TypeSampleVector HistoryHide minor edits - Show changes to output 2010-04-14 23:57
by -
Deleted lines 43-47:
(* literal assignment *) CONST [{}] allowValueConstructors = TRUE; (* this seems to be redundant *) 2010-04-13 05:03
by -
Changed line 48 from:
CONST [{}] allowValueConstructors = TRUE; to:
CONST [{}] allowValueConstructors = TRUE; (* this seems to be redundant *) 2010-04-13 04:26
by -
Changed lines 64-66 from:
PROCEDURE PROCEDURE [/] divide ( v1, v2 to:
PROCEDURE dot ( v1, v2 : SampleVector ) : ComponentType; PROCEDURE scalar ( a : ComponentType; v : SampleVector ) : SampleVector; 2010-04-12 09:30
by -
Changed line 11 from:
TYPE ComponentType IS REAL; to:
TYPE ComponentType IS REAL; (* arbitrary numeric type *) 2010-04-12 09:19
by -
Added lines 9-13:
(* component type *) TYPE ComponentType IS REAL; Changed line 19 from:
values : ARRAY capacity OF to:
values : ARRAY capacity OF ComponentType; Changed line 30 from:
PROCEDURE Vector ( items : CARDINAL; VARIADIC v[items] OF to:
PROCEDURE Vector ( items : CARDINAL; VARIADIC v[items] OF c : ComponentType ) : SampleVector; Changed lines 42-43 from:
PROCEDURE [!] setComponent ( n : CARDINAL; VAR v : SampleVector; (* Overwrites the value of the n-th component of vector v with to:
PROCEDURE [!] setComponent ( n : CARDINAL; VAR v : SampleVector; c : ComponentType ); (* Overwrites the value of the n-th component of vector v with c *) 2010-04-08 15:58
by -
Changed lines 32-34 from:
(* Returns the to:
(* Returns the value of the n-th component of vector v *) Changed line 38 from:
(* Overwrites the to:
(* Overwrites the value of the n-th component of vector v with r *) 2010-04-07 08:49
by -
Changed line 12 from:
SampleVector = OPAQUE RECORD (" to:
SampleVector = OPAQUE RECORD ("V-Type") Changed lines 18-19 from:
(* to:
(* cardinality *) PROCEDURE [HIGH] highestComponentIndex ( v : SampleVector ) : CARDINAL; (* constructor *) Changed lines 28-29 from:
(* returns the n-th value of a vector to:
(* accessor *) PROCEDURE [.] component ( n : CARDINAL; v : SampleVector ) : REAL; (* Returns the n-th value of vector v *) (* mutator *) PROCEDURE [!] setComponent ( n : CARDINAL; VAR v : SampleVector; r : REAL ); (* Overwrites the n-th value of vector v with r *) 2010-04-06 17:18
by -
Deleted lines 17-21:
CONST [TYPE] semanticModel = 'C'; (* obsolete *) Changed line 20 from:
PROCEDURE Vector ( items : CARDINAL; VARIADIC v[items] r : REAL ) : SampleVector; to:
PROCEDURE Vector ( items : CARDINAL; VARIADIC v[items] OF r : REAL ) : SampleVector; Changed lines 29-31 from:
CONST [{}] allowValueConstructors = TRUE; CONST [:=] allowValueConstructors = TRUE; (* but this needs more checks *) to:
CONST [{}] allowValueConstructors = TRUE; 2010-04-05 12:22
by -
Changed line 12 from:
SampleVector = OPAQUE to:
SampleVector = OPAQUE RECORD ("C-Type") Changed line 20 from:
CONST [TYPE] semanticModel = 'C'; to:
CONST [TYPE] semanticModel = 'C'; (* obsolete *) 2010-04-04 10:41
by -
Changed lines 3-4 from:
(* Sample definition of a vector type *) to:
(* Sample definition of a vector type *) 2010-04-04 10:37
by -
Added lines 1-78:
[@DEFINITION MODULE SampleVector; (* Sample definition of a vector type *) FROM FileIO IMPORT File; (* required for IO *) (* SampleVector type *) TYPE SampleVector = OPAQUE RECORD capacity : CARDINAL; values : ARRAY capacity OF REAL; END; (* number type *) CONST [TYPE] semanticModel = 'C'; (* constructor and accessors *) PROCEDURE Vector ( items : CARDINAL; VARIADIC v[items] r : REAL ) : SampleVector; (* constructs a vector from a value list *) PROCEDURE Elem ( n : CARDINAL; v : SampleVector ) : REAL; (* returns the n-th value of a vector *) (* literal assignment *) CONST [{}] allowValueConstructors = TRUE; (* either this or ... *) CONST [:=] allowValueConstructors = TRUE; (* but this needs more checks *) (* monadic arithmetic operations *) PROCEDURE [ABS] abs ( v : SampleVector ) : SampleVector; PROCEDURE [NEG] neg ( v : SampleVector ) : SampleVector; (* dyadic arithmetic operations *) PROCEDURE [+] add ( v1, v2 : SampleVector ) : SampleVector; PROCEDURE [-] sub ( v1, v2 : SampleVector ) : SampleVector; PROCEDURE [*] multiply ( v1, v2 : SampleVector ) : SampleVector; PROCEDURE [/] divide ( v1, v2 : SampleVector ) : SampleVector; (* relational operations *) PROCEDURE [=] isEqual ( v1, v2 : SampleVector ) : BOOLEAN; (* IO operations, bound to READ, WRITE and WRITEF *) PROCEDURE Read( infile : File; VAR v : SampleVector ); (* Reads the textual representation of a SampleVector value in simple format from input 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 v - the file status is set to any of success, outOfRange, wrongFormat, endOfLine, or endOfInput *) PROCEDURE Write( outfile : File; v : SampleVector ); (* Writes the textual representation of SampleVector value v in simple format to output stream outfile *) PROCEDURE WriteF( outfile : File; fmtStr : ARRAY OF CHAR; items : CARDINAL; VARIADIC v[items] OF vector : SampleVector ); (* Writes a formatted textual representation of one or more SampleVector values to output stream outfile. The value of parameter items is calculated and inserted automatically. The output format is determined by fmtStr. *) END SampleVector.@] |