The List object may expand or shrink to contain varying numbers of objects. It also supports several "iterator" functions, which are used to successively visit each object in the list.
*vsy_ListBegin - create an instance of a List object vsy_ListEnd - destroy an instance of a List object vsy_ListError - return List object error flag
vsy_ListDef - define initial length of storage array Inq - inquire current length of storage array vsy_ListCount - get number of contained objects vsy_ListAllIndices - get all indices vsy_ListMaxIndex - get maximum index vsy_ListInsert - place object at specified index location vsy_ListAdd - place object in first empty position vsy_ListAppend - place object at the end of sequence vsy_ListRef - find object at specified location vsy_ListRemove - remove object from a specified location vsy_ListClear - remove all objects from the List object vsy_ListCompact - reduce storage space if possible vsy_ListForEach - call a function one time for each object vsy_ListInitIter - prepare to successively visit each object vsy_ListNextIter - return the next object in the sequence
Each new object is placed in the list by calling vsy_ListInsert, vsy_ListAdd, or vsy_ListAppend. The total number of objects contained in the list may be found by calling vsy_ListCount. The object at a specified index may be found by calling vsy_ListRef. An object may be removed by calling vsy_ListRemove. The method vsy_ListClear removes all objects from the list. Unused storage at the end of the internal array may be released by calling vsy_ListCompact.
Each object in the list may be processed with an "iterator" construct. The single method vsy_ListForEach takes a function as its argument and calls that function repeatedly, each time with one object from the list. The pair of methods vsy_ListInitIter and vsy_ListNextIter are used to visit each element using a loop. Call the first method before the body of the loop to prepare the List object for the iteration. Within the loop body, call vsy_ListNextIter. It will return a pointer to a new object each time it is called. It will return a NULL pointer when all of the objects have been processed.
*vsy_ListBegin - create an instance of an List object
vsy_List *vsy_ListBegin ()
None
Destroy an instance of a List object using
void vsy_ListEnd (vsy_List *list)
Return the current value of a List object error flag using
Vint vsy_ListError (vsy_List *list)
vsy_ListDef - define initial length of storage array
void vsy_ListDef (vsy_List *list, Vint numobj)
list Pointer to List object. numobj Estimated number of objects to be held.
None
Find the current length of the internal storage of a List using
void vsy_ListInq (const vsy_List *list, Vint *numobj)
vsy_ListCount - get number of contained objects
void vsy_ListCount (const vsy_List *list, Vint *num)
list Pointer to List object.
num Number of objects held the in List object.
vsy_ListMaxIndex - get maximum index
void vsy_ListMaxIndex (const vsy_List *list, Vint *maxindex)
list Pointer to List object.
maxindex Maximum index
vsy_ListAllIndices - get all indices
void vsy_ListAllIndices (const vsy_List *list, Vint allindices[])
list Pointer to List object.
allindices Array of all indices
vsy_ListInsert - place an object in the list
void vsy_ListInsert (vsy_List *list, Vint index, Vobject *value)
list Pointer to List object. index Position in list at which object is to be stored. value Pointer to the object.
None
If the index value for an object may be arbitrarily assigned, then insert this object into the list using call
void vsy_ListAdd (vsy_List *list, Vobject *value, Vint *index)The location at which the object was placed will be returned in the output argument index.
An object may be placed at the end of the list using
void vsy_ListAppend (vsy_List *list, Vobject *value)
vsy_ListRef - find the object at a specified location
void vsy_ListRef (const vsy_List *list, Vint index, Vobject **value)
list Pointer to List object. index Location of the desired object.
value Object found at location index.
vsy_ListRemove - remove an object from the list
void vsy_ListRemove (vsy_List *list, Vint index)
list Pointer to List object. index Location to be emptied.
None
Remove all the objects from a List object using
void vsy_ListClear (vsy_List *list)
Release any unused internal storage using
void vsy_ListCompact (vsy_List *list)
vsy_ListForEach - process each item in the list
void vsy_ListForEach (vsy_List *list, void (*func)(Vobject*))
list Pointer to List object. func Pointer to function which is to be applied to each object.
None
Sequential access to each item in the list may also be implemented using
void vsy_ListInitIter (vsy_List *list)
This is followed by repeated calls to the method
void vsy_ListNextIter (vsy_List *list, Vint *index, Vobject **value)Each call of the method vsy_ListNextIter will return a new item from the list together with its associated index. After every object has been visited in this manner, vsy_ListNextIter will return a NULL pointer until the iteration is restarted using vsy_ListInitIter. Objects are visited starting from position zero, and empty positions in the list are skipped over.
*vsy_StackBegin - create an instance of a Stack object vsy_StackEnd - destroy an instance of a Stack object vsy_StackError - return Stack object error flag
vsy_StackDef - define initial length of storage array Inq - inquire current length of storage array vsy_StackCount - get number of contained objects vsy_StackPush - place a new object on the top of the stack vsy_StackRef - get the object at the top of the stack vsy_StackPop - remove an object from the top of the stack vsy_StackClear - remove all objects from the Stack object vsy_StackCompact - reduce storage space if possible vsy_StackForEach - call a function one time for each object
Each new object is placed in the stack by calling vsy_StackPush. The total number of objects contained in the stack may be found by calling vsy_StackCount. The object which was most recently pushed is accessed using vsy_StackRef. The uppermost object is removed and the stack shortened by one position with each call to the vsy_StackPop method. The method vsy_StackClear removes all objects from the stack. Unused storage at the end of the internal array may be released by calling vsy_StackCompact. This is useful when a very large stack has been greatly shortened from its earlier size.
All objects in the stack may be processed with an "iterator" method, vsy_StackForEach, which takes a function pointer as its argument. It calls that function repeatedly, each time with one object from the stack passed as an argument.
*vsy_StackBegin - create an instance of a Stack object
vsy_Stack *vsy_StackBegin ()
None
Destroy an instance of a Stack object using
void vsy_StackEnd (vsy_Stack *stack)
Return the current value of a Stack object error flag using
Vint vsy_StackError (vsy_Stack *stack)
vsy_StackDef - define initial length of storage array
void vsy_StackDef (vsy_Stack *stack, Vint numobj)
stack Pointer to Stack object. numobj Estimated number of objects to be held.
None
Find the current length of the internal storage of a Stack using
void vsy_StackInq (const vsy_Stack *stack, Vint *numobj)
vsy_StackCount - get number of contained objects
void vsy_StackCount (const vsy_Stack *stack, Vint *num)
stack Pointer to Stack object.
num Number of objects held in the Stack object.
vsy_StackPush - place an object on the top of the stack
void vsy_StackPush (vsy_Stack *stack, Vobject *value)
stack Pointer to Stack object. value Pointer to the object.
None
vsy_StackRef - get the object at the top of the stack
void vsy_StackRef (const vsy_Stack *stack, Vobject **value)
stack Pointer to Stack object.
value Object found at the top of the stack.
vsy_StackPop - remove an object from the top of the stack
void vsy_StackPop (vsy_Stack *stack)
stack Pointer to Stack object.
None
Remove all the objects from a Stack object using
void vsy_StackClear (vsy_Stack *stack)
Release any unused internal storage using
void vsy_StackCompact (vsy_Stack *stack)
vsy_StackForEach - process each item in the stack
void vsy_StackForEach (vsy_Stack *stack, void (*func)(Vobject*))
stack Pointer to Stack object. func Pointer to function which is to be applied to each object.
None
*vsy_DictionaryBegin - create an instance of a Dictionary object vsy_DictionaryEnd - destroy an instance of a Dictionary object vsy_DictionaryError - return Dictionary object error flag
vsy_DictionaryDef - suggest number of items Inq - get current storage capacity vsy_DictionaryCount - get number of contained objects vsy_DictionaryInsert - place object in the dictionary vsy_DictionaryLookup - find object with the specified name vsy_DictionaryRemove - remove any object with the specified name vsy_DictionaryClear - remove all objects from a Dictionary vsy_DictionaryForEach - call a function one time for each object vsy_DictionaryInitIter - successively visit each object vsy_DictionaryInitIterOrder - alphabetically visit each object vsy_DictionaryNextIter - return the next object in the sequence
Each new object is placed in the dictionary by calling vsy_DictionaryInsert. The total number of objects contained in the dictionary may be found with vsy_DictionaryCount. The object with a specified name may be found by calling vsy_DictionaryLookup. An object may be removed using vsy_DictionaryRemove. The method vsy_DictionaryClear removes all objects from the dictionary.
Each object in the dictionary may be processed with an "iterator" construct. The single method vsy_DictionaryForEach takes a function as its argument and calls that function repeatedly; each call of the function is supplied one object from the dictionary. The pair of methods vsy_DictionaryInitIter and vsy_DictionaryNextIter are used to visit each name/object pair using a loop. Call the first method before the body of the loop to prepare the Dictionary object for the iteration. Within the loop body, call vsy_DictionaryNextIter. It will return the name of and a pointer to an object each time it is called. It will return two NULL pointers when all of the objects have been visited. Use vsy_DictionaryInitIterOrder to visit the objects in name alphabetical order
Table of Contents
, Dictionary
*vsy_DictionaryBegin - create an instance of an Dictionary object
vsy_Dictionary *vsy_DictionaryBegin ()
None
Destroy an instance of a Dictionary object using
void vsy_DictionaryEnd (vsy_Dictionary *dictionary)
Return the current value of a Dictionary object error flag using
Vint vsy_DictionaryError (vsy_Dictionary *dictionary)
Table of Contents
, Dictionary
vsy_DictionaryDef - define initial size
void vsy_DictionaryDef (vsy_Dictionary *dictionary, Vint numobj)
dictionary Pointer to Dictionary object. numobj Estimated number of objects to be held.
None
Find the number of objects which may be managed by the currently allocated internal storage of a Dictionary using
void vsy_DictionaryInq (const vsy_Dictionary *dictionary, Vint *numobj,
Table of Contents
, Dictionary
vsy_DictionaryCount - get number of contained objects
void vsy_DictionaryCount (const vsy_Dictionary *dictionary, Vint *num)
dictionary Pointer to Dictionary object.
num Number of objects held the in Dictionary object.
Table of Contents
, Dictionary
vsy_DictionaryInsert - place an object in the dictionary
void vsy_DictionaryInsert (vsy_Dictionary *dictionary, const Vchar *name, Vobject *value)
dictionary Pointer to Dictionary object. name String which identifies the object. value Pointer to the object.
None
Table of Contents
, Dictionary
vsy_DictionaryLookup - find the object at a specified location
void vsy_DictionaryLookup (const vsy_Dictionary *dictionary, const Vchar *name, Vobject **value)
dictionary Pointer to Dictionary object. name Name of the desired object.
value Object associated with the specified name.
Table of Contents
, Dictionary
vsy_DictionaryRemove - remove an object from the dictionary
void vsy_DictionaryRemove (vsy_Dictionary *dictionary, const Vchar *name)
dictionary Pointer to Dictionary object. name Name of the object to be removed.
None
Remove all the objects from a Dictionary object using
void vsy_DictionaryClear (vsy_Dictionary *dictionary)
Table of Contents
, Dictionary
vsy_DictionaryForEach - process each item in the dictionary
void vsy_DictionaryForEach (vsy_Dictionary *dictionary, void (*func)(Vobject*))
dictionary Pointer to Dictionary object. func Pointer to function which is to be applied to each object.
None
Sequential access to each item in the dictionary may also be implemented using
void vsy_DictionaryInitIter (vsy_Dictionary *dictionary)
Sequential access to each item in alphabetical order of the dictionary name using.
void vsy_DictionaryInitIterOrder (vsy_Dictionary *dictionary)
This is followed by repeated calls to the method
void vsy_DictionaryNextIter (vsy_Dictionary *dictionary, Vchar **name, Vobject **value)Each call of the method vsy_DictionaryNextIter will return one object from the dictionary. It will also return a pointer to the name used within the dictionary. Do not deallocate this string! It is a pointer to the storage used within the Dictionary object itself. After every object has been visited in this manner, vsy_DictionaryNextIter will return two NULL pointers until the iteration is restarted using vsy_DictionaryInitIter. The objects are visited in an unspecified order.
*vsy_HashTableBegin - create an instance of a HashTable object vsy_HashTableEnd - destroy an instance of a HashTable object vsy_HashTableError - return HashTable object error flag
vsy_HashTableDef - define suggested number of stored items Inq - get current storage capacity vsy_HashTableCount - get number of contained objects vsy_HashTableMaxKey - get maximum key value vsy_HashTableAllKeys - get all key values vsy_HashTableInsert - place object at specified location vsy_HashTableLookup - find object at specified location vsy_HashTableRemove - remove the object from specified location vsy_HashTableClear - remove all objects from the HashTable object vsy_HashTableForEach - call a function one time for each object vsy_HashTableInitIter - prepare to successively visit each object vsy_HashTableInitIterOrder - prepare to visit each object in order vsy_HashTableNextIter - return the next object in the sequence
Each new object is placed in the hashtable using vsy_HashTableInsert. The total number of objects contained in the hashtable may be found by calling vsy_HashTableCount. An object with a specified integer key may be retrieved using vsy_HashTableLookup. An object with a given key value may be removed with vsy_HashTableRemove. The method vsy_HashTableClear removes all objects from the hashtable. The maximum key used to store any object may be queried using vsy_HashTableMaxKey. All keys may be queried using vsy_HashTableAllKeys. In this case the number of keys returned will be equal to the number of keys returned by vsy_HashTableCount.
Each object in the hashtable may be processed with an "iterator" construct. The method vsy_HashTableForEach takes a function as its argument and calls that function repeatedly, each time with an object from the hashtable. The pair of methods vsy_HashTableInitIter and vsy_HashTableNextIter are used to visit each key/object pair using a loop. Call the first method before the body of the loop to prepare the HashTable object for the iteration. Within the loop body, call vsy_HashTableNextIter. It will return an integer key and an object each time it is called. It will return zero and a NULL pointer when all of the objects have been processed.
*vsy_HashTableBegin - create an instance of a HashTable object
vsy_HashTable *vsy_HashTableBegin ()
None
Destroy an instance of a HashTable object using
void vsy_HashTableEnd (vsy_HashTable *hashtable)
Return the current value of a HashTable object error flag using
Vint vsy_HashTableError (vsy_HashTable *hashtable)
vsy_HashTableDef - define initial length of storage array
void vsy_HashTableDef (vsy_HashTable *hashtable, Vint numobj)
hashtable Pointer to HashTable object. numobj Estimated number of objects to be held.
None
Find the number of objects which may be managed with the presently allocated storage using
void vsy_HashTableInq (const vsy_HashTable *hashtable, Vint *num)
vsy_HashTableCount - get number of contained objects
void vsy_HashTableCount (const vsy_HashTable *hashtable, Vint *num)
hashtable Pointer to HashTable object.
num Number of objects held the in HashTable object.
vsy_HashTableMaxKey - get maximum key value
void vsy_HashTableMaxKey (const vsy_HashTable *hashtable, Vint *maxkey)
hashtable Pointer to HashTable object.
maxkey Maximum key value
vsy_HashTableAllKeys - get all key values
void vsy_HashTableAllKeys (const vsy_HashTable *hashtable, Vint allkeys[])
hashtable Pointer to HashTable object.
allkeys Array of all keys
vsy_HashTableInsert - place an object in the hashtable
void vsy_HashTableInsert (vsy_HashTable *hashtable, Vint key, Vobject *value)
hashtable Pointer to HashTable object. key Integer key value. value Pointer to the object.
None
vsy_HashTableLookup - find the object at a specified location
void vsy_HashTableLookup (const vsy_HashTable *hashtable, Vint key, Vobject **value)
hashtable Pointer to HashTable object. key Integer key of the desired object.
value Object associated with key.
vsy_HashTableRemove - remove an object from the hashtable
void vsy_HashTableRemove (vsy_HashTable *hashtable, Vint key)
hashtable Pointer to HashTable object. key Key of object to be removed.
None
Remove all the objects from a HashTable object using
void vsy_HashTableClear (vsy_HashTable *hashtable)
vsy_HashTableForEach - process each item in the hashtable
void vsy_HashTableForEach (vsy_HashTable *hashtable, void (*func)(Vobject*))
hashtable Pointer to HashTable object. func Pointer to function which is to be applied to each object.
None
Sequential access to each item in the hashtable may also be implemented using
void vsy_HashTableInitIter (vsy_HashTable *hashtable)
Sequential access to each item in numerical order of the hashtable key using.
void vsy_HashTableInitIterOrder (vsy_HashTable *hashtable)
This is followed by repeated calls to the method
void vsy_HashTableNextIter (vsy_HashTable *hashtable, Vint *key Vobject **value)Each call of the method vsy_HashTableNextIter will return a new item from the hashtable, together with its associated key. After every object has been visited in this manner, vsy_HashTableNextIter will return a key of zero and a NULL pointer. If the iteration is started using vsy_HashTableInitIter, these key/value pairs are visited in arbitrary order. If the iteration is started using vsy_HashTableInitIterOrder, these key/value pairs are visited in numerical order of the key.
*vsy_VHashTableBegin - create an instance of a VHashTable object vsy_VHashTableEnd - destroy an instance of a VHashTable object vsy_VHashTableError - return VHashTable object error flag
vsy_VHashTableDef - define suggested number of stored items Inq - get current storage capacity vsy_VHashTableCount - get number of contained objects vsy_VHashTableInsert - place object at specified location vsy_VHashTableRemove - remove the object from specified location vsy_VHashTableLookup - find object at specified location vsy_VHashTableClear - remove all objects vsy_VHashTableInitIter - prepare to successively visit each object vsy_VHashTableNextIter - return the next object in the sequence
Each new object is placed in the hashtable using vsy_VHashTableInsert. The total number of objects contained in the hashtable may be found by calling vsy_VHashTableCount. An object with a specified vector of integer keys may be retrieved using vsy_VHashTableLookup. The method vsy_VHashTableClear removes all objects from the hashtable.
Each object in the hashtable may be processed with an "iterator" construct. The pair of methods vsy_VHashTableInitIter and vsy_VHashTableNextIter are used to visit each key-vector/object pair using a loop. Call the first method before the body of the loop to prepare the VHashTable object for the iteration. Within the loop body, call vsy_VHashTableNextIter. It will return an integer key and an object value each time it is called. It will return a zero value when all of the objects have been processed.
Table of Contents
, VHashTable
*vsy_VHashTableBegin - create an instance of a VHashTable object
vsy_VHashTable *vsy_VHashTableBegin ()
None
Destroy an instance of a VHashTable object using
void vsy_VHashTableEnd (vsy_VHashTable *vhashtable)
Return the current value of a VHashTable object error flag using
Vint vsy_VHashTableError (vsy_VHashTable *vhashtable)
Table of Contents
, VHashTable
vsy_VHashTableDef - define initial length of storage array
void vsy_VHashTableDef (vsy_VHashTable *vhashtable, Vint size, Vint numobj)
vhashtable Pointer to VHashTable object. size Number of integers per key-vector numobj Estimated number of objects to be held.
None
Find the number of objects which may be managed with the presently allocated storage using
void vsy_VHashTableInq (const vsy_VHashTable *vhashtable, Vint *size, Vint *numobj)
Table of Contents
, VHashTable
vsy_VHashTableCount - get number of contained objects
void vsy_VHashTableCount (const vsy_VHashTable *vhashtable, Vint *num)
vhashtable Pointer to VHashTable object.
num Number of objects held the in VHashTable object.
Table of Contents
, VHashTable
vsy_VHashTableInsert - place an object in the hashtable
void vsy_VHashTableInsert (vsy_VHashTable *vhashtable, Vint key[], Vobject *value)
vhashtable Pointer to VHashTable object. key Integer key values. value Object value.
None
Table of Contents
, VHashTable
vsy_VHashTableLookup - find the object at a specified location
void vsy_VHashTableLookup (const vsy_VHashTable *vhashtable, Vint key[], Vobject **value)
vhashtable Pointer to VHashTable object. key Integer key values of the desired object.
value object associated with key.
Table of Contents
, VHashTable
vsy_VHashTableRemove - remove an object from the hashtable
void vsy_VHashTableRemove (vsy_VHashTable *vhashtable, Vint key[])
vhashtable Pointer to VHashTable object. key Keys of object to be removed.
None
Remove all the objects from a VHashTable object using
void vsy_VHashTableClear (vsy_VHashTable *vhashtable)
Table of Contents
, VHashTable
vsy_VHashTableInitIter,vsy_VHashTableNextIter - successively visit each object
void vsy_VHashTableInitIter (vsy_VHashTable *vhashtable) void vsy_VHashTableNextIter (vsy_VHashTable *vhashtable, Vint *key) Vobject **value)
vhashtable Pointer to VHashTable object.
key Integer keys. value Object associated with key
*vsy_TreeBegin - create an instance of a Tree object vsy_TreeEnd - destroy an instance of a Tree object vsy_TreeError - return Tree object error flag
vsy_TreeAddNode - add a node to a parent node vsy_TreeDelNode - delete a node and its children vsy_TreeSetValue - place object at specified node vsy_TreeGetValue - retrieves object from specified node vsy_TreeFirstChild - query first child of a node vsy_TreeNextChild - query next sibling of a node
Each parent node the tree may be processed with an "iterator" construct. The method vsy_TreeFirstChild takes a parent node as its argument and returns the node's first child. Subsequent calls to vsy_TreeNextChild returns the next sibling of the given child. A returned value of zero indicates that all children have been visited.
*vsy_TreeBegin - create an instance of a Tree object
vsy_Tree *vsy_TreeBegin ()
None
Destroy an instance of a Tree object using
void vsy_TreeEnd (vsy_Tree *tree)
Return the current value of a Tree object error flag using
Vint vsy_TreeError (vsy_Tree *tree)
vsy_TreeAddNode - add a node to a parent node
void vsy_TreeAddNode (vsy_Tree *tree, Vint pkey, Vint *ckey)
tree Pointer to Tree object. pkey Integer parent node id
ckey Integer child node id
vsy_TreeDelNode - delete a node and its children
void vsy_TreeDelNode (vsy_Tree *tree, Vint key)
tree Pointer to Tree object. key Integer id of the node to be deleted along with its children.
None
vsy_TreeSetValue - place an object in a node
void vsy_TreeSetValue (vsy_Tree *tree, Vint key, Vobject *value)
tree Pointer to Tree object. key Integer id of node that will hold the object value Pointer to the object.
None
vsy_TreeGetValue - retrieves object from specified node
void vsy_TreeGetValue (vsy_Tree *tree, Vint key, Vobject **value)
tree Pointer to Tree object. key Integer id of node holding the object
value Object associated with key.
vsy_TreeForEach - process each item in the tree
void vsy_TreeForEach (vsy_Tree *tree, void (*func)(Vobject*))
tree Pointer to Tree object. func Pointer to function which is to be applied to each object.
None
Sequential access to each item in the tree may also be implemented by retrieving the first child of a node using
Vint vsy_TreeFirstChild (vsy_Tree *tree, Vint key, Vint *child)
This is followed by repeated calls to the method
Vint vsy_TreeNextChild (vsy_Tree *tree, Vint key, Vint *child)Each call of the method vsy_TreeNextChild will return a new item from the tree. After every object has been visited in this manner, vsy_TreeNextChild will return a value of zero. The list of siblings is returned in an arbitrary order.
A typical construct for looping over a node's children is as follows:
Vint parent, child; vsy_TreeFirstChild (tree,parent,&child); while(child != 0) { /* your code here */ ...; vsy_TreeNextChild (tree,child,&child); }