ZEDA
1.6.18
|
Data Structures | |
struct | zIndexStruct |
struct | zIndex |
integer value array class More... | |
Macros | |
#define | zIndexIncSize(i) ( zArraySize(i)++ ) |
increment size of an index vector. More... | |
#define | zIndexDecSize(i) ( zArraySize(i) -= ( zArraySize(i) > 0 ? 1 : 0 ) ) |
decrement size of an index vector. More... | |
#define | zIndexPosIsValid(i, n) zArrayPosIsValid( i, n ) |
check if the specified position is valid for an index vector. More... | |
#define | zIndexElemNC(i, n) zArrayBuf(i)[n] |
#define | zIndexElem(i, n) ( zIndexPosIsValid(i,n) ? zIndexElemNC(i,n) : -1 ) |
#define | zIndexSetElemNC(i, n, e) ( zIndexElemNC(i,n) = (e) ) |
#define | zIndexSetElem(i, n, e) ( zIndexPosIsValid(i,n) ? zIndexSetElemNC(i,n,e) : -1 ) |
#define | zIndexHead(idx) ( *zArrayHead(idx) ) |
#define | zIndexNeck(idx) ( *zArrayNeck(idx) ) |
#define | zIndexTail(idx) ( *zArrayTail(idx) ) |
#define | zIndexScan() zIndexFScan( stdin ) |
#define | zIndexPrint(i) zIndexFPrint( stdout, i ) |
#define | zIndexDataPrint(i) zIndexDataFPrint( stdout, i ) |
Typedefs | |
typedef zIndexStruct * | zIndex |
Functions | |
zIndex | zIndexAlloc (int size) |
allocate an array of integer values. More... | |
zIndex | zIndexCreate (int size) |
create an array of integer values. More... | |
zIndex | zIndexCreateList (int num,...) |
create an array of integer according to a specified list of arguments. More... | |
zIndex | zIndexSetList (zIndex idx,...) |
set elements of an integer vector from argument list. More... | |
void | zIndexFree (zIndex idx) |
free an array of integer values. More... | |
zIndex | zIndexZero (zIndex idx) |
zero an array of integer values. More... | |
zIndex | zIndexOrder (zIndex idx, int s) |
order an array of integer values. More... | |
bool | zIndexIsEqual (zIndex idx1, zIndex idx2) |
check if two arrays of integer values are equal. More... | |
int | zIndexSwap (zIndex idx, int p1, int p2) |
swap two elements of an array of integer values. More... | |
int | zIndexMove (zIndex idx, int from, int to) |
move an element of an array of integer values. More... | |
zIndex | zIndexFScan (FILE *fp) |
scan an array of integer values from a file. More... | |
void | zIndexFPrint (FILE *fp, zIndex idx) |
print an array of integer values to a file. More... | |
void | zIndexDataFPrint (FILE *fp, zIndex idx) |
print an array of integer values out to a file. More... | |
zIndex | zIndexCreateFromList (zIntList *list) |
create an integer vector from a list of integers. More... | |
#define zIndexIncSize | ( | i | ) | ( zArraySize(i)++ ) |
increment size of an index vector.
#define zIndexDecSize | ( | i | ) | ( zArraySize(i) -= ( zArraySize(i) > 0 ? 1 : 0 ) ) |
decrement size of an index vector.
#define zIndexPosIsValid | ( | i, | |
n | |||
) | zArrayPosIsValid( i, n ) |
check if the specified position is valid for an index vector.
#define zIndexElemNC | ( | i, | |
n | |||
) | zArrayBuf(i)[n] |
#define zIndexElem | ( | i, | |
n | |||
) | ( zIndexPosIsValid(i,n) ? zIndexElemNC(i,n) : -1 ) |
#define zIndexSetElemNC | ( | i, | |
n, | |||
e | |||
) | ( zIndexElemNC(i,n) = (e) ) |
#define zIndexSetElem | ( | i, | |
n, | |||
e | |||
) | ( zIndexPosIsValid(i,n) ? zIndexSetElemNC(i,n,e) : -1 ) |
#define zIndexHead | ( | idx | ) | ( *zArrayHead(idx) ) |
#define zIndexNeck | ( | idx | ) | ( *zArrayNeck(idx) ) |
#define zIndexTail | ( | idx | ) | ( *zArrayTail(idx) ) |
#define zIndexScan | ( | ) | zIndexFScan( stdin ) |
#define zIndexPrint | ( | i | ) | zIndexFPrint( stdout, i ) |
#define zIndexDataPrint | ( | i | ) | zIndexDataFPrint( stdout, i ) |
typedef zIndexStruct* zIndex |
zIndex zIndexAlloc | ( | int | size | ) |
allocate an array of integer values.
zIndexAlloc() allocates a vector of integer values with a size size.
zIndex zIndexCreate | ( | int | size | ) |
create an array of integer values.
zIndexCreate() creates an array of integer values with a size size. It initializes all values of the array as { 0, 1, 2, ..., size -1 }.
zIndex zIndexCreateList | ( | int | num, |
... | |||
) |
create an array of integer according to a specified list of arguments.
zIndexCreateList() creates an array of integer values from the specified list of arguments. num is the number of values.
set elements of an integer vector from argument list.
zIndexSetList() sets elements of an array of integer values idx from the specified list of arguments.
void zIndexFree | ( | zIndex | idx | ) |
free an array of integer values.
zIndexFree() frees a zIndex instance idx, freeing the assigned memory space.
zero an array of integer values.
zIndexZero() sets all components of an array of index values idex for zeros.
a | pointer idx. |
order an array of integer values.
zIndexOrder() sets all components of idx in order, beginning from s as { s, s+1, s+2, ... }.
a | pointer idx. |
check if two arrays of integer values are equal.
zIndexIsEqual() checks if two arrays of integer values idx1 and idx2 are equal.
int zIndexSwap | ( | zIndex | idx, |
int | p1, | ||
int | p2 | ||
) |
swap two elements of an array of integer values.
zIndexSwap() swaps two components of a zIndex instance idx at the positions of p1 and p2.
int zIndexMove | ( | zIndex | idx, |
int | from, | ||
int | to | ||
) |
move an element of an array of integer values.
zIndexMove() moves a component at from' of a zIndex instance idx to another position to. The components between from and to are slided to make a space to insert the component.
zIndex zIndexFScan | ( | FILE * | fp | ) |
scan an array of integer values from a file.
zIndexFScan() scans a sequence of integer values from the current position of a file fp, and create a new zIndex instance. The format to be scanned by zIndexFScan() is as follows:
n ( x1 x2 x3 ... xn )
where n is the number of values.
zIndexScan() is also available to scan values from the standard input.
void zIndexFPrint | ( | FILE * | fp, |
zIndex | idx | ||
) |
print an array of integer values to a file.
zIndexFPrint() prints an array of integer values in a zIndex instance idx out to the current position of a file fp in the following format:
n ( x1 x2 x3 ... xn )
where n is the number of values.
zIndexPrint() is also available to print values out to the standard output.
void zIndexDataFPrint | ( | FILE * | fp, |
zIndex | idx | ||
) |
print an array of integer values out to a file.
zIndexDataFPrint() prints an array of integer values in a zIndex instance idx out to the current position of a file fp in the following format:
x1 x2 x3 ... xn
zIndexDataPrint() is also available to print values out to the standard output.