Go to the source code of this file.
Data Structures | |
| struct | array_t |
Defines | |
| #define | array_alloc(type, number) array_do_alloc(sizeof(type), number) |
| #define | array_data(type, array) (type *) array_do_data(array) |
| #define | array_fetch(type, a, i) |
| #define | array_fetch_last(type, array) array_fetch(type, array, ((array)->num)-1) |
| #define | array_fetch_last_p(type, array) array_fetch_p(type, array, ((array)->num)-1) |
| #define | array_fetch_p(type, a, i) |
| #define | array_insert(type, a, i, datum) |
| Documentation needed! | |
| #define | array_insert_last(type, array, datum) array_insert(type, array, (array)->num, datum) |
| #define | array_n(array) (array)->num |
| #define | ARRAY_OUT_OF_MEM -10000 |
| The header of the generic array manipulator. | |
| #define | arrayForEachItem(type,array, i,data) |
| #define | arrayForEachItemP(type,array, i,pdata) |
Functions | |
| int | array_abort (const array_t *, int) |
| int | array_append (array_t *, array_t *) |
| array_t * | array_do_alloc (int, int) |
| char * | array_do_data (array_t *) |
| array_t * | array_dup (array_t *) |
| void | array_free (array_t *) |
| array_t * | array_join (array_t *, array_t *) |
| int | array_resize (array_t *, int) |
| void | array_sort (array_t *, int(*)(const void *, const void *)) |
| Sorts the array content according to the given comparison function. | |
| void | array_uniq (array_t *array, int(*compare)(char **, char **), void(*free_func)(char *)) |
| #define array_alloc | ( | type, | |||
| number | ) | array_do_alloc(sizeof(type), number) |
| #define array_data | ( | type, | |||
| array | ) | (type *) array_do_data(array) |
| #define array_fetch | ( | type, | |||
| a, | |||||
| i | ) |
(((array_t*)a)->e_index = (i), \ nusmv_assert((a)->num >= 0), \ (((a)->e_index) >= (a)->num) ? array_abort((a),1) : 0, \ *((type *) ((a)->space + (a)->e_index * (a)->obj_size)))
| #define array_fetch_last | ( | type, | |||
| array | ) | array_fetch(type, array, ((array)->num)-1) |
| #define array_fetch_last_p | ( | type, | |||
| array | ) | array_fetch_p(type, array, ((array)->num)-1) |
| #define array_fetch_p | ( | type, | |||
| a, | |||||
| i | ) |
(((array_t*)a)->e_index = (i), \ ((a)->e_index >= (a)->num) ? array_abort((a),1) : 0, \ ((type *) ((a)->space + (a)->e_index * (a)->obj_size)))
| #define array_insert | ( | type, | |||
| a, | |||||
| i, | |||||
| datum | ) |
( -(a)->index != sizeof(type) ? array_abort((a),4) : 0, \ (a)->index = (i), \ (a)->index < 0 ? array_abort((a),0) : 0, \ (a)->index >= (a)->n_size ? \ ((array_t*)a)->e_insert = array_resize(a, (a)->index + 1) : 0, \ (a)->e_insert != ARRAY_OUT_OF_MEM ? \ *((type *) ((a)->space + (a)->index * (a)->obj_size)) = datum : datum, \ (a)->e_insert != ARRAY_OUT_OF_MEM ? \ ((a)->index >= (a)->num ? (a)->num = (a)->index + 1 : 0) : 0, \ (a)->e_insert != ARRAY_OUT_OF_MEM ? \ ((a)->index = -(int)sizeof(type)) : ARRAY_OUT_OF_MEM )
Documentation needed!
| #define array_insert_last | ( | type, | |||
| array, | |||||
| datum | ) | array_insert(type, array, (array)->num, datum) |
| #define ARRAY_OUT_OF_MEM -10000 |
| #define arrayForEachItem | ( | type, | |||
| array, | |||||
| i, | |||||
| data | ) |
for((i) = 0; \ (((i) < array_n((array))) \ && (((data) = array_fetch(type, (array), (i))), 1)); \ (i)++)
| #define arrayForEachItemP | ( | type, | |||
| array, | |||||
| i, | |||||
| pdata | ) |
for((i) = 0; \ (((i) < array_n((array))) \ && (((pdata) = array_fetch_p(type, (array), (i))), 1)); \ (i)++)
| int array_abort | ( | const array_t * | , | |
| int | ||||
| ) |
| void array_sort | ( | array_t * | , | |
| int(*)(const void *, const void *) | ||||
| ) |
Sorts the array content according to the given comparison function.
IMPORTANT! compare has argument int (void* pa, void* pb) pa and pb must be dereferenced to access the corresponding values into the array
| void array_uniq | ( | array_t * | array, | |
| int(*)(char **, char **) | compare, | |||
| void(*)(char *) | free_func | |||
| ) |
1.6.1