Tools Library Functions

 

VxListCnvrtArr VxListDel VxListGet VxListGetPtr
VxListMk VxListSet VxMemFree VxSymLog
VxSymSort

 

 

 


 VxListCnvrtArr

int VxListCnvrtArr(int size_elem, VsListObj *obj, int *num_elem, void **array)
int size_elem i
if (size_elem > 0) then it is assumed that
we are inserting array into list and this is the
size of elements in the array.
if (size_elem <= 0)
				we
				are
				converting
				list
				to
				array.
				</pre>
VsListObj *obj i/o
pointer to list object 
int *num_elem i/o
number of elements in array. 
void **array i/o
pointer to array. 

Description


   Convert between a VsListObj and a buck naked array.

Memory-Management


   Makes array on heap.  Free old list structure's "list" but
   not the structure itself.  That's up to the caller.

Caveats


   For size_elem > 0 it makes a flat array.  Most of the other
   places the array is hierarchical when it gets too big.
   So DON'T USE THAT!  Or even better, DON'T USE THIS FUNCTION
   at ALL!  We only rewrote it for historical reasons.  Big
   arrays are dang bad for the heap!

 Top


 VxListDel

int VxListDel(VsListObj **list)
VsListObj **list i
address of pointer to list object 

Description

   Delete (i.e. free) a list object.

Memory-Management

   All memory associated with list is deallocated.

Caveats

 

 Top


 VxListGet

int VxListGet(VsListObj *obj, long indx, void *data)
VsListObj *obj i
pointer to list object 
long indx i
index of list element to be modified 
void *data o
pointer to sufficient storage for element data,
copy of element data 

Description

   Get a copy of a list element. That is the data element stored at
   the specified index in the list is copied into output area (data).

Memory-Management

 

Caveats

 

 Top


 VxListGetPtr

int VxListGetPtr(const VsListObj *obj, const long indx, void **ptr)
const VsListObj *obj i
pointer to list object 
const long indx i
index of list element to be modified 
void **in_ptr o
address of pointer to be returned  

Description

   This function returns the pointer to the element of the list at the
   specified index. No copy of data is done. Modifying  data pointed to
   by the returned pointer, directly modifies the data in the list.

Memory-Management

 

Caveats

 

 Top


 VxListMk

int VxListMk(VeListType type, int elemSize, int initLen, int numIncr, void *pool, VsListObj **newList)
VeListType type i
type of list to create. 
int elemSize i
element size 
int initLen i
initial list length (no. of elements),
not used if type == LINKLIST 
int numIncr i
no. of new elements to add at each resize,
not used if type == LINKLIST 
void *pool i
pointer to memory data pool,  may be NULL
if pool is not used. 
VsListObj **newList o
pointer to new list object 

Description

   Create and initialize a list. Different types of list are supported.


    type                    description   -------------------------------------------------------------   V_LIST_KEY          Data is maintained as a linked list and an                       index is store with the node for reference.   V_LINKLIST_LOC      Data is maintained as a linked list and                       elements are indexed by their physical location                       within the linked list.   V_ARRAY_DAT         Data is store in a single array of fixed sized                       structures, elements are indexed by their location                       within the array.   V_ARRAY_PTR         An array of pointers to data is maintained.  Elements                       are indexed by the index of their pointer.   V_LIST_TREE         Data is maintained as an ordered binary tree.   Each method has its advantages and disadvantages so it is up   to the application to decide which method to use.   Note that for LINKLIST methods the arguments initLen and numIncr   are ignored.   Currently data pools are not supported.

Memory-Management

   A list may be completely deallocated using VxListDel().

Caveats

 

 Top


 VxListSet

int VxListSet(VsListObj *obj, const long indx, const void *data)
VsListObj *obj i
pointer to list object 
const long indx i
index of list element to be modified 
const void *data i
pointer to new element data 

Description

   Set the value of a list element.  If the list is not long enough
   then the list is resized and the element is set.  If an element
   is found which matches the indicated index then its contents are
   replaced by the new data pointed to by data.
   Return 1 if error (list cannot be resized), else 0.

Memory-Management

   If the indx exceeds the length of the list, the list is resized.


     type                Domain for indx    ---------------------------------------------------      V_LIST_KEY         Any long integer      V_LINKLIST_LOC     0 <= indx <=obj->num      V_LIST_TREE        0 <= indx <=obj->num      V_ARRAY_DAT        0 <= indx < obj->max + V_MAX_INCR * obj->increment      V_ARRAY_PTR        0 <= indx < obj->max + V_MAX_INCR * obj->increment

Caveats

 

 Top


 VxSymLog

void VxSymLog(char *, void *, double)
char *name i
symbol name (max length = 32 char) 
void *ptr i
symbol pointer 
double prod i
symbol product code 

Description

Append the specified symbol to the symbol list.  If the list is
not long enough, an error message is printed to the tty and the
symbol is ignored. If the symbol name is too long (> 32 chars),
and error message is printed to the tty and the symbol is ignored.
No return value.

Memory-Management

 

Caveats

 

 Top


 VxSymSort

void VxSymSort(void)

 

Description

Sort the symbol list.
No return value.

Memory-Management

 

Caveats

 

 Top

Return to VX CAD/CAM Index