Pervasives
Spec.Pervasives History
Show minor edits - Show changes to markup
Changed line 33 from:
where TypeOf(x) means the identifier of type x and ElemType means the identifier of the element type of the indeterminate field of a record of indeterminate type.
to:
where TypeOf(x) means the identifier of type x.
Changed line 31 from:
TODO (str) prints str to console, causes warning in DEBUG mode, or error otherwise
to:
TODO (str) prints str to console, causes warning in DEBUG mode, or error otherwise
Deleted line 26:
TODO causes compile time warning when in DEBUG mode, otherwise compile time error
Added line 31:
TODO (str) prints str to console, causes warning in DEBUG mode, or error otherwise
Added line 27:
TODO causes compile time warning when in DEBUG mode, otherwise compile time error
Changed lines 45-46 from:
FIRST (c) returns first value of collection c
LAST (c) returns last value of collection c
to:
FIRST (c) returns first value of ordered collection c
LAST (c) returns last value of ordered collection c
Changed lines 22-24 from:
INSERT (c, ...) inserts values in set or list, or values at index, or key/value pairs in collection c
APPEND (c, v1, v2, v3) appends values to list or array collection c
REMOVE (c, ...) removes elements from set or list, or values in index range, or key/value pairs from collection c
to:
INSERT (c, ...) inserts values or accessor/value pairs into collection c
APPEND (c, v1, v2, v3) appends values to the end of list or array collection c
REMOVE (c, ...) removes values or key/value pairs from collection c
Changed line 42 from:
COUNT (c) returns the item count of collection c
to:
COUNT (c) returns the number of values stored in collection c
Changed lines 47-48 from:
MIN (v1, v2, v3 ...) returns smallest value from argument list
MAX (v1, v2, v3 ...) returns largest value from argument list
to:
MIN (v1, v2, v3 ...) returns smallest value of a list of ordinal or scalar values
MAX (v1, v2, v3 ...) returns largest value of a list of ordinal or scalar values
Changed line 26 from:
SORTNEW (t, s, order) creates new target collection t with sorted values from source collection s
to:
SORTNEW (t, s, order) sorts values of source collection s into newly allocated target collection t
Changed line 78 from:
The constant NIL represents an invalid pointer. It is compatible with any pointer type. Its value is defined as:
to:
The constant NIL represents an invalid pointer. It is compatible with any pointer type. Its value is defined as:
Changed line 81 from:
CONST NIL = 0 :: POINTER TO IMMUTABLE OCTET;
to:
CONST NIL = 0 :: POINTER TO CONST OCTET;
Changed line 68 from:
to do: add primitive SEEK
to:
to do: add SEEK to pseudo-module for primitives
Added lines 56-59:
Deleted lines 69-70:
Changed line 72 from:
Detailed Descriptions
to:
Detailed Descriptions
Changed line 25 from:
SORT (t, s, order) sorts values of source collection s into target collectiont
to:
SORT (t, s, order) sorts values of source collection s into target collection t
Changed line 35 from:
ABS (x) returns the absolute (sign removed) value of x
to:
ABS (x) returns the absolute value of x
Changed line 48 from:
MAX (v1, v2, v3 ...) returns largest value from argument list
to:
MAX (v1, v2, v3 ...) returns largest value from argument list
Deleted lines 33-34:
Changed line 56 from:
moved to pseudo-module RUNTIME :
to:
moved to pseudo-module RUNTIME :
Changed line 59 from:
to be moved to pseudo-module for primitives
to:
to be moved to pseudo-module for primitives:
Added line 63:
Changed line 778 from:
to:
Deleted line 21:
STORE (c, ...) stores values in set or list, or value at index, or key for value in collection c
Changed line 37 from:
ABS (x) returns the absolute value of x
to:
ABS (x) returns the absolute (sign removed) value of x
Added line 43:
EXISTS (c, a, v) returns TRUE if value v exists for accessor a in collection c
Changed lines 46-53 from:
TMIN (T) returns smallest legal value of type T
TMAX (T) returns largest legal value of type T
TLIMIT (T) returns the capacity of collection type T
TSIZE (T) returns allocation size required for type T
moved to pseudo-module RUNTIME :
SIZE (v) returns the allocated size of variable v
to:
PTR (v, T) returns typed pointer to variable v if its type is compatible with T
FIRST (c) returns first value of collection c
LAST (c) returns last value of collection c
MIN (v1, v2, v3 ...) returns smallest value from argument list
MAX (v1, v2, v3 ...) returns largest value from argument list
Changed lines 53-54 from:
MIN (c1, c2, c3 ...) inserts smallest constant
MAX (c1, c2, c3 ...) inserts largest constant
to:
TMIN (T) replaced by smallest legal value of type T
TMAX (T) replaced by largest legal value of type T
TLIMIT (T) replaced by the capacity of collection type T
TSIZE (T) replaced by allocation size required for type T
moved to pseudo-module RUNTIME :
SIZE (v) returns the allocated size of variable v
to be moved to pseudo-module for primitives
STORE (c, ...) stores values in set or list, or value at index, or key for value in collection c
VALUE (c, a) returns value for accessor from collection c
SUBSET (s1, s2) returns TRUE if s2 is a subset of s1
to do: add primitive SEEK
Added line 11:
Empty collection value: EMPTY
Added lines 22-27:
STORE (c, ...) stores values in set or list, or value at index, or key for value in collection c
INSERT (c, ...) inserts values in set or list, or values at index, or key/value pairs in collection c
APPEND (c, v1, v2, v3) appends values to list or array collection c
REMOVE (c, ...) removes elements from set or list, or values in index range, or key/value pairs from collection c
SORT (t, s, order) sorts values of source collection s into target collectiont
SORTNEW (t, s, order) creates new target collection t with sorted values from source collection s
Added line 29:
READNEW (f, x) invokes TypeOf(x).Read(f, x)
Deleted line 30:
NEG (x) returns the sign reversed value of x
Deleted lines 36-37:
SIZE (v) returns the allocated size of variable v
HIGH (a) returns highest subscript for array a
Deleted line 37:
NEXTV (v) returns pointer to next variadic tuple of v
Added line 40:
TLIMIT (T) returns the capacity of collection type T
Changed lines 42-44 from:
VAL (T, x) equivalent to type conversion expression x :: T
to:
moved to pseudo-module RUNTIME :
SIZE (v) returns the allocated size of variable v
Changed lines 16-17 from:
to:
Deleted lines 20-22:
NEW (p) invokes ALLOCATE(p, TSIZE(TypeOf(p^)))
NEW (p, n) invokes ALLOCATE(p, TSIZE(TypeOf(p^)) + n * TSIZE(ElemType))
DISPOSE (p) invokes DEALLOCATE(p, SIZE(p^))
Added lines 27-28:
Deleted lines 200-261:
Procedure NEW
Procedure NEW is used to dynamically allocate storage at runtime. The procedure is defined as:
<*INLINE*> PROCEDURE NEW ( VAR p : <PointerType>; (* OPTIONAL *) n : <unsignedTypes> );
(* calculates the required storage size for the base type of p, allocates a block of
storage of the determined size and passes its address back in p, if p points to
an indeterminate type, then the determinant value must be passed in n *)
Static Semantics:
A call of NEW must have one or two actual parameters. The first parameter may be a variable of any pointer type. If the first parameter is a pointer to an indeterminate type, then a second parameter must be passed in. The second parameter may be a value of type OCTET , CARDINAL or LONGCARD . A library procedure named ALLOCATE must be visible in the lexical scope where NEW is called. The library procedure must conform to the following signature:
PROCEDURE ALLOCATE ( VAR p : ADDRESS; size : LONGCARD );
Dynamic Semantics:
Procedure NEW allocates storage at runtime and passes a pointer to the allocated storage back in its first parameter. It calls function TSIZE to calculate the required storage size and it calls library procedure ALLOCATE to allocate storage. The semantics are defined as:
macro NEW ( byref p : pointer; optional n : anyCardinalType )
targetType := baseTypeOf(p)
baseSize := evaluate TSIZE(targetType)
if isDeterminateType(targetType) then
insert ALLOCATE(p, baseSize)
elsif isIndeterminateType(targetType) and isPresent(n) then
indeterminateComponent := symTabLookup(targetType, indeterminateField, name)
componentType := baseTypeOf(p^.indeterminateComponent)
insert ALLOCATE(p, baseSize + n * TSIZE(componentType))
determinant := symTabLookup(targetType, determinantField, name)
insert p^.determinant := n
else
raiseCompileTimeError
endif
endm
Procedure DISPOSE
Procedure DISPOSE is used to release dynamically allocated storage that was reserved by a call to procedure NEW . The procedure is defined as:
<*INLINE*> PROCEDURE DISPOSE ( VAR p : <AnyPointerType> );
(* release the storage previously allocated by a call to NEW and pointed to by p *)
Static Semantics:
A call of DISPOSE must have one actual parameter. The parameter may be a variable of any pointer type. A library procedure named DEALLOCATE must be visible in the lexical scope where DISPOSE is called. The library procedure must conform to the following signature:
PROCEDURE DEALLOCATE ( VAR p : ADDRESS; size : LONGCARD );
Dynamic Semantics:
Procedure DISPOSE first calls function SIZE to determine the allocation size of the storage block pointed to by its first argument and then it deallocates the storage block by calling library procedure DEALLOCATE passing the pointer and allocated size. The semantics are defined as:
macro DISPOSE ( byref p : pointer )
insert DEALLOCATE(p, SIZE (p^))
endm
Changed line 1 from:
Predefined identifiers are language defined identifiers that are visible in any lexical scope without import. They fall into five categories:
to:
Predefined identifiers (formerly called pervasives) are language defined identifiers that are visible in any lexical scope without import. They fall into five categories:
Changed lines 1-6 from:
Pervasives are predefined identifiers that are visible in any lexical scope without import. Unlike reserved words, pervasives may be redefined. Pervasives fall into five categories: constants, types, procedures, functions and compile-time macros:
to:
Predefined identifiers are language defined identifiers that are visible in any lexical scope without import. They fall into five categories:
- constants
- types
- procedures
- functions
- compile-time macros
|