|
version 1.16.2.8, 2012/04/05 11:46:20
|
version 1.16.2.11, 2012/04/10 15:33:41
|
|
Line 74 typedef struct _tagSplitArray {
|
Line 74 typedef struct _tagSplitArray {
|
| } sarr_t; |
} sarr_t; |
| |
|
| typedef struct _tagArray { |
typedef struct _tagArray { |
| |
int arr_last; |
| int arr_num; |
int arr_num; |
| void **arr_data; |
void **arr_data; |
| } array_t; |
} array_t; |
|
Line 121 typedef struct {
|
Line 122 typedef struct {
|
| #define AIT_VOID(_vl) (_vl)->val.ptr |
#define AIT_VOID(_vl) (_vl)->val.ptr |
| #define AIT_BLOB_CHUNKS(_vl, _n) (AIT_LEN((_vl)) / _n + (AIT_LEN((_vl)) % _n) ? 1 : 0) |
#define AIT_BLOB_CHUNKS(_vl, _n) (AIT_LEN((_vl)) / _n + (AIT_LEN((_vl)) % _n) ? 1 : 0) |
| #define AIT_ISEMPTY(_vl) (AIT_TYPE((_vl)) == empty) |
#define AIT_ISEMPTY(_vl) (AIT_TYPE((_vl)) == empty) |
| #define AIT_INIT(_vl) (memset((_vl), 0, sizeof(ait_val_t))) |
|
| |
|
| #define AIT_GET_LIKE(_vl, _type) ((_type) (_vl)->val.ptr) |
#define AIT_GET_LIKE(_vl, _type) ((_type) (_vl)->val.ptr) |
| |
|
|
Line 214 typedef struct {
|
Line 214 typedef struct {
|
| __val->val_type = f64; __val->val.f64 = _n; \ |
__val->val_type = f64; __val->val.f64 = _n; \ |
| AIT_LEN(__val) = sizeof(double); } while (0) |
AIT_LEN(__val) = sizeof(double); } while (0) |
| |
|
| |
#define AIT_INIT_VAL(_vl) (memset((_vl), 0, sizeof(ait_val_t))) |
| /* if attribute zeroCopy is set not execute free() */ |
/* if attribute zeroCopy is set not execute free() */ |
| #define AIT_FREE_VAL(_vl) do { ait_val_t *__val = (_vl); assert(__val); \ |
#define AIT_FREE_VAL(_vl) do { ait_val_t *__val = (_vl); assert(__val); \ |
| switch (AIT_TYPE(__val)) { \ |
switch (AIT_TYPE(__val)) { \ |
|
Line 558 inline char **io_arrayTo(array_t * __restrict arr);
|
Line 559 inline char **io_arrayTo(array_t * __restrict arr);
|
| * io_arrayLen() - Get last used element in dynamic array (array Length) |
* io_arrayLen() - Get last used element in dynamic array (array Length) |
| * |
* |
| * @arr = Array |
* @arr = Array |
| * return: -1 error, 0 empty or >0 position of last used element | * return: -1 empty or >-1 position of last used element |
| */ |
*/ |
| inline int io_arrayLen(array_t * __restrict arr); |
inline int io_arrayLen(array_t * __restrict arr); |
| /* |
/* |
|
Line 596 int io_arrayGrow(array_t * __restrict arr, int newNumI
|
Line 597 int io_arrayGrow(array_t * __restrict arr, int newNumI
|
| int io_arrayVacuum(array_t * __restrict arr, int fromWhere); |
int io_arrayVacuum(array_t * __restrict arr, int fromWhere); |
| |
|
| #define io_arraySize(_arr) ((_arr) ? (_arr)->arr_num : 0) |
#define io_arraySize(_arr) ((_arr) ? (_arr)->arr_num : 0) |
| |
#define io_arrayLast(_arr) ((_arr) ? (_arr)->arr_last : -1) |
| #define io_arrayZero(_arr) (assert((_arr)), memset((_arr)->arr_data, 0, \ |
#define io_arrayZero(_arr) (assert((_arr)), memset((_arr)->arr_data, 0, \ |
| io_arraySize((_arr)) * sizeof(void*))) |
io_arraySize((_arr)) * sizeof(void*))) |
| |
|
|
Line 604 int io_arrayVacuum(array_t * __restrict arr, int fromW
|
Line 606 int io_arrayVacuum(array_t * __restrict arr, int fromW
|
| ((_type) *((_arr)->arr_data + _d))) |
((_type) *((_arr)->arr_data + _d))) |
| #define io_arraySet(_arr, _d, _ptr) do { \ |
#define io_arraySet(_arr, _d, _ptr) do { \ |
| assert((_arr) && (_arr)->arr_num > _d); \ |
assert((_arr) && (_arr)->arr_num > _d); \ |
| |
if ((_arr)->arr_last < _d) \ |
| |
(_arr)->arr_last = _d; \ |
| *((_arr)->arr_data + _d) = (void*) (_ptr); \ |
*((_arr)->arr_data + _d) = (void*) (_ptr); \ |
| } while (0) |
} while (0) |
| #define io_arrayDel(_arr, _d, _fri) do { \ |
#define io_arrayDel(_arr, _d, _fri) do { \ |
|
Line 612 int io_arrayVacuum(array_t * __restrict arr, int fromW
|
Line 616 int io_arrayVacuum(array_t * __restrict arr, int fromW
|
| free(*((_arr)->arr_data + _d)); \ |
free(*((_arr)->arr_data + _d)); \ |
| *((_arr)->arr_data + _d) = NULL; \ |
*((_arr)->arr_data + _d) = NULL; \ |
| } while (0) |
} while (0) |
| |
#define io_arraySyncLast(_arr) do { \ |
| |
assert((_arr)); \ |
| |
(_arr)->arr_last = io_arrayLen((_arr)); \ |
| |
} while (0) |
| |
|
| /* |
/* |
| * io_arrayElem() - Always GET/PUT element into dynamic array, if not enough elements grow array |
* io_arrayElem() - Always GET/PUT element into dynamic array, if not enough elements grow array |
|
Line 627 inline void *io_arrayElem(array_t * __restrict arr, in
|
Line 635 inline void *io_arrayElem(array_t * __restrict arr, in
|
| * |
* |
| * @arr = Array |
* @arr = Array |
| * @data = Element, if set NULL return only first empty position |
* @data = Element, if set NULL return only first empty position |
| |
* @mayGrow = Array may to grow, if not enough room for new element |
| * return: -1 not found empty position, array is full!, >-1 return position of stored element into array |
* return: -1 not found empty position, array is full!, >-1 return position of stored element into array |
| */ |
*/ |
| inline int io_arrayPush(array_t * __restrict arr, void **data); | inline int io_arrayPush(array_t * __restrict arr, void **data, int mayGrow); |
| /* |
/* |
| * io_arrayPop() - Pop element from dynamic array like stack manner, last used position |
* io_arrayPop() - Pop element from dynamic array like stack manner, last used position |
| * |
* |