ZEDA  1.6.18
Macros | Functions
zeda_array.h File Reference

array operation. More...

#include <zeda/zeda_misc.h>
#include <zeda/zeda_name.h>
Include dependency graph for zeda_array.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define zArrayClass(array_t, cell_t)
 generate array class. More...
 
#define zArraySize(a)   (a)->size
 
#define zArrayBuf(a)   (a)->buf
 
#define zArrayPosIsValid(a, p)   ( (p) < zArraySize(a) && (p) >= 0 )
 
#define zArrayElemSize(a)   sizeof(*zArrayBuf(a))
 
#define zArrayElemNC(a, i)   ( &zArrayBuf(a)[i] )
 
#define zArrayElem(a, i)   ( zArrayPosIsValid(a,i) ? zArrayElemNC(a,i) : NULL )
 
#define zArraySetElemNC(a, i, d)   memcpy( zArrayElemNC(a,i), (d), zArrayElemSize(a) )
 
#define zArraySetElem(a, i, d)   ( zArrayPosIsValid(a,i) ? zArraySetElemNC(a,i,d) : NULL )
 
#define zArrayHead(a)   zArrayElemNC( a, zArraySize(a)-1 )
 
#define zArrayNeck(a)   zArrayElemNC( a, zArraySize(a)-2 )
 
#define zArrayTail(a)   zArrayElemNC( a, 0 )
 
#define zArrayInit(arr)
 
#define zArrayAlloc(arr, type, n)
 allocate an array. More...
 
#define zArrayFree(arr)
 free an array. More...
 
#define zArrayFindName(arr, name, ptr)   zNameFind( zArrayBuf(arr), zArraySize(arr), name, ptr )
 
#define zArrayAdd(arr, type, dat)
 add a new cell to an array. More...
 
#define zArrayInsert(arr, type, pos, dat)
 insert a new cell into an array. More...
 
#define zArrayDelete(arr, type, pos)
 delete a cell from an array. More...
 
#define zArrayAppend(arr, subarr, type)
 append an array to another. More...
 
#define zArrayQuickSort(arr, cmp, priv)   zQuickSort( (void*)zArrayBuf(arr), zArraySize(arr), zArrayElemSize(arr), cmp, priv )
 quick sort for an array. More...
 
#define zArray2Class(array_t, cell_t)
 generate two-dimensional array class. More...
 
#define zArray2Size(a, i)   (a)->size[i]
 
#define zArray2RowSize(a)   (a)->size[0]
 
#define zArray2ColSize(a)   (a)->size[1]
 
#define zArray2Buf(a)   ( (a)->buf )
 
#define zArray2PosIsValid(a, r, c)   ( (r) < zArray2RowSize(a) && (r) >= 0 && (c) < zArray2ColSize(a) && (c) >= 0 )
 
#define zArray2ElemSize(a)   sizeof(*zArray2Buf(a))
 
#define zArray2ElemNC(a, i, j)   ( &zArray2Buf(a)[(i)*zArray2ColSize(a) + (j)] )
 
#define zArray2Elem(a, i, j)   ( zArray2PosIsValid(a,i,j) ? zArray2ElemNC(a,i,j) : NULL )
 
#define zArray2SetElemNC(a, i, j, d)   memcpy( zArray2ElemNC(a,i,j), (d), zArray2ElemSize(a) )
 
#define zArray2SetElem(a, i, j, d)   ( zArray2PosIsValid(a,i,j) ? zArray2SetElemNC(a,i,j,d) : NULL )
 
#define zArray2Init(arr)
 
#define zArray2Alloc(arr, type, r, c)
 allocate an array. More...
 
#define zArray2Free(arr)
 free an array. More...
 

Functions

void zQuickSort (void *array, size_t nmemb, size_t size, int(*cmp)(void *, void *, void *), void *priv)
 quick sort for a pointer array. More...
 

Detailed Description

array operation.

Author
Zhidao