The xtype C Library, Version 1.00

The XARRAY Type

Contents:

  1. xaappend
  2. xacast
  3. xachar
  4. xacvt
  5. xafree
  6. xaget
  7. xainsert
  8. xaint
  9. xalen
  10. xalong
  11. xanew
  12. xapchar
  13. xapint
  14. xaplong
  15. xaput
  16. xashrink
  17. xaxarray
  18. xaxlist
  19. xaxstr

XARRAY *xaappend(XARRAY *xa, void *p)

Function

Append the element pointed to by p to the end of the array pointed to by xa.

Returns


void *xacast(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of voids (whatever that means).


char *xachar(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of characters.


void *xacvt(XARRAY *xa)

Function

Convert the array pointed to by xa into a normal array. This array should be de-allocated with free(). Do not use xa after calling this function.

Returns


void xafree(XARRAY *xa)

Function

De-allocate the array pointed to by xa. If the elements of xa are pointers to dynamically-allocated strucutres, these must be freed separately. Do not use xa after calling this function.


void *xaget(XARRAY *xa, int n, void *p)

Function

Copy the element in position n of the array pointed to by xa into the buffer pointed to p.

Returns


XARRAY *xainsert(XARRAY *xa, int n, void *p)

Function

Insert an element at position n in the array pointed to by xa. The new element will contain the data in the buffer pointed to by p.

Returns


int *xaint(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of integers.


int xalen(XARRAY *xa)

Function

Compute the length of the array pointed by xa.

Returns


long *xalong(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of long integers.


XARRAY *xanew(int n, int b, int e)

Function

Create a new array with elements of size e. The new array will initially set aside space for n elements (but it will not actually contain any), and this space grow by b elements whenever required. The array can be freed using xafree() or by xacvt() then free().

Returns


char **xapchar(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of pointers to characters.


int **xapint(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of pointers to integers.


long **xaplong(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of pointers to long integers.


XARRAY *xaput(XARRAY *xa, int n, void *p)

Function

Copy the buffer pointed to by p into the element at position n in the array pointed to by xa.

Returns


XARRAY *xashrink(XARRAY *xa, int n1, int n2)

Function

Shrink the array pointed to by xa by removing the elements between positions n1 and n2, inclusive.

Returns


XARRAY **xaxarray(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of pointers to XARRAYs.


XLIST **xaxlist(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of pointers to XLISTs.


XSTR **xaxstr(XARRAY *xa)

Function

Typecast the array pointed to by xa as an array of pointers to XSTRs.