''Prev:'' [wiki:"Language" Language Manual] | ''Next:'' [wiki:"CLI" Command Line Interface] ---- = CIVL Libraries In progress. == bundle Header: [https://vsl.cis.udel.edu/trac/civl/browser/CIVL/trunk/mods/dev.civl.abc/src/include/headers/bundle.cvh bundle.cvh]. Uses: [#op op]. A bundle is a sequence of objects of the same type, wrapped into an atomic package. A bundle is created using a function that specifies a region of memory. One can create a bundle from an array of integers, and another bundle from an array of reals. Both bundles have the same type, `$bundle`. They can therefore be entered into an array of `$bundle`, for example. Hence bundles are useful for mixing objects of different (even statically unknown) types into a single data structure. Later, the contents of a bundle can be extracted with another function that specifies a region of memory into which to unpack the bundle; if that memory does not have the right type to receive the contents of the bundle, a runtime error occurs. === Types * `$bundle`: the bundle type === Functions * `$system int $bundle_size($bundle b)` * Returns the size of the given bundle, i.e., the number of bytes consumed by all elements of the bundle. This is the product of the number of elements and the size of one element. * `$system $bundle $bundle_pack(void *ptr, int size)` * This function creates a bundle from the memory region specified by `ptr` and `size` (the total number of bytes to copy), copying the data into the new bundle. It returns the new bundle. * `$system void $bundle_unpack($bundle b, void *ptr)` * This function copies the data from the given bundle into the memory region starting at `ptr`. The memory region extends for `$bundle_size(b)` bytes. * `$atomic_f void $bundle_unpack_apply($bundle data, void *buf, $operation op, int count, void *result)` * This function unpacks the bundle while applying the specified numeric operation. Parameter `op` specifies a binary operation. For each ''i'' in 0..''count''-1, the operation is applied to the ''i''-th element of `buf` and the ''i''-th element of the bundle, and the result is stored in the ''i''-th position of `result`. Parameter `count` is the number of elements in the bundle; `buf` and `result` should each point to a region of memory capable of holding at least `count` elements. === Example {{{ #include int main() { int n = 10; int a[n], b[n], c[n]; for (int i=0; i0 and returns some partition of the domain into n sub-domains, according to the decomposition strategy specified. * `$system $range $range_of_rectangular_domain($domain dom, int index)` * Returns the `index`-th range of the given domain `dom`. Requires `index` to be between 1 and the dimension of `dom` minus 1. * `$system int $high_of_regular_range($range range)` * Returns the upper bound of a regular range. * `$system int $low_of_regular_range($range range)` * Returns the lower bound of a regular range. * `$system int $step_of_regular_range($range range)` * Returns the step of a regular range * `$system _Bool $is_rectangular_domain($domain domain)` * Returns true if this `domain` is a rectangular domain. * `$system _Bool $is_regular_range($range range)` * Returns true if this `range` is a regular range, i.e., it is composed of a lower bound, a higher bound and a step. * `$system int $dimension_of($domain domain)` * Returns the dimension of the given domain. == mem #mem Header: [https://vsl.cis.udel.edu/trac/civl/browser/CIVL/trunk/mods/dev.civl.abc/src/include/headers/mem.cvh mem.cvh]. Uses: (nothing). The `mem` library provides functions to manipulate objects of the CIVL-C built-in type---`$mem`. A `$mem` object represents a set of memory locations. === Functions * `$system void $write_set_push()` * Pushes a new entry (i.e. an empty `$mem`) onto the write stack of the calling process. Each process maintains a write stack. A stack entry is a `$mem` object. A write to a memory location will cause the memory location being added to the top entry of the write stack, if the stack is non-empty. * `$system $mem $write_set_pop()` * Pops and returns the top entry of the write stack of the calling process. * `$state_f $system $mem $write_set_peek()` * Returns the top entry of the write stack of the calling process. * `$system void $read_set_push()` * Pushes a new entry (i.e. an empty `$mem`) onto the read stack of the calling process. Each process maintains a read stack. A stack entry is a `$mem` object. Reading a memory location will cause the memory location being added to the top entry of the read stack, if the stack is non-empty. * `$system $mem $read_set_pop()` * Pops and returns the top entry of the read stack of the calling process. * `$state_f $system $mem $read_set_peek()` * Returns the top entry of the read stack of the calling process. * `$atomic_f $system $mem $mem_empty()` * Creates a new empty `$mem` object. * `$atomic_f $system _Bool $mem_equals($mem m0, $mem m1)` * Returns true iff `m0` and `m1` are the identical set of memory locations. * `$atomic_f $system _Bool $mem_contains($mem super, $mem sub)` * Returns true iff `super` is a super-set of `sub`. * `$atomic_f $system _Bool $mem_no_intersect($mem m0, $mem m1, $mem *out0, $mem *out1)` * Returns true iff `m0` and `m1` are two disjoint sets. If `m0` and `m1` overlap, `out0` and `out1` will be assigned two overlapping memory location sets, which are as small as the function can figure out from `m0` and `m1`, respectively. * `$atomic_f $system $mem $mem_union($mem mem0, $mem mem1)` * Returns the union of the two sets of memory locations `mem0` and `mem1`. * `$atomic_f $system $mem $mem_union_widening($mem, $mem)` * Similar to the `$mem_union` function but may return an over-approximated super-set of the union set. The over-approximation is done by the model checker in order to make state space finite. * `$atomic_f $system void $mem_havoc($mem m)` * Assigns arbitrary values to memory locations in `m` * `$atomic_f $system $mem $mem_unary_widening($mem m)` * Returns an over-approximated super-set of `m`. The over-approximation is done by the model checker in order to make state space finite. * `$atomic_f $system void $mem_assign_from($state s, $mem m)` * deprecated == op #op Header: [https://vsl.cis.udel.edu/trac/civl/browser/CIVL/trunk/mods/dev.civl.abc/src/include/headers/op.h op.h]. Uses: (nothing). Defines an enumerated type `$operation` with the following values: ||= Constant =||= Description =|| ||`_NO_OP` ||no operation || ||`_MAX` ||maximum || ||`_MIN` ||minimun || ||`_SUM` ||sum || ||`_PROD` ||product || ||`_LAND` ||logical and || ||`_BAND` ||bit-wise and || ||`_LOR` ||logical or || ||`_BOR` ||bit-wise or || ||`_LXOR` ||logical exclusive or || ||`_BXOR` ||bit-wise exclusive or || ||`_MINLOC` ||min value and location || ||`_MAXLOC` ||max value and location || ||`_EQ` ||equal to || ||`_NEQ` ||not Equal to || == pointer #pointer Header: [https://vsl.cis.udel.edu/trac/civl/browser/CIVL/trunk/mods/dev.civl.abc/src/dev/civl/abc/include/pointer.cvh pointer.cvh]. Uses: [#op op]. * `$system void $set_default(void *obj);` * Updates the leaf nodes of a status variable to the default value 0 * `$system void $apply(void *obj1, $operation op, void *obj2, void *result);` * Applies the operation op on obj1 and obj2 and stores the result * `$system _Bool $equals(void *x, void *y);` * Are the object pointed to equal? * `$system void $assert_equals(void *x, void *y, ...);` * Assert that the two objects pointed are equal * `$system _Bool $contains(void *obj1, void *obj2);` * Semantics: Does the object pointed to by obj1 contain that pointed to by obj1? * `$system void * $translate_ptr(void *ptr, void *obj);` * Translates a pointer into one object to a pointer into a different object with similar structure. * `$system void $copy(void *ptr, void *value);` * Copies the value pointed to by the right operand to the memory location specified by the left operand * `$system void $leaf_node_ptrs(void *array, void *obj);` * copy the references to the leaf nodes of obj to the given array obj: pointer to type T' whose leaf node types are all type T array: pointer to array of pointer to type T * `$system _Bool $is_identity_ref(void *obj);` * returns true if the given pointer is referencing to an object by identity reference * `$system void $set_leaf_nodes(void *obj, int value);` * updates the leaf nodes of the given objects to with the given integer value * `$system _Bool $leaf_nodes_equal_to(void *obj, int value);` * returns true iff all leaf nodes of the given object equal to the given value * `$system _Bool $has_leaf_node_equal_to(void *obj, int value);` * returns true iff at least one leaf nodes of the given object equal to the given value * `$system _Bool $is_derefable_pointer(void *ptr);` * can the given pointer be safely referenced? A derefable pointer is not NULL and is referring to a memory location of some dyscope. * `$system void * $pointer_add(const void *ptr, int offset, int type_size);` * Gives a pointer addition operation. Note that the input pointer will always be casted to the form of a pointer to a primitive data type. == scope #scope Header: [https://vsl.cis.udel.edu/trac/civl/browser/CIVL/trunk/mods/dev.civl.abc/src/include/headers/scope.cvh scope.cvh]. Uses: (nothing). == seq #seq Header: [https://vsl.cis.udel.edu/trac/civl/browser/CIVL/trunk/mods/dev.civl.abc/src/include/headers/seq.cvh seq.cvh]. Uses: (nothing). == C Standard library === stdlib === stdio === string ---- ''Prev:'' [wiki:"Language" Language Manual] | ''Next:'' [wiki:"CLI" Command Line Interface]