--- libaitio/inc/aitio.h 2011/11/03 14:22:03 1.12.2.6 +++ libaitio/inc/aitio.h 2011/12/12 15:31:18 1.12.2.12 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitio.h,v 1.12.2.6 2011/11/03 14:22:03 misho Exp $ +* $Id: aitio.h,v 1.12.2.12 2011/12/12 15:31:18 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -318,12 +318,21 @@ array_t *io_map2vars(u_char *buf, int buflen, int vnum */ inline array_t *io_allocVars(u_int varnum); /* + * io_clrVars() Clear ait_val_t elements from array + * @vars = Variable array + * return: -1 error or size of array + */ +inline int io_clrVars(array_t * __restrict vars); +/* * io_freeVars() Free ait_val_t array * @vars = Variable array * return: none */ inline void io_freeVars(array_t ** __restrict vars); +#define io_elemVars(_vars, _n, _val) ((ait_val_t*) io_arrayElem((_vars), \ + (_n), (void**) (_val))) + /* * ioPromptRead() Read data from input h[0] with prompt to output h[1] * @h = file handles h[0] = input, h[1] = output, if NULL use stdin, stdout @@ -515,6 +524,14 @@ int io_arrayVacuum(array_t * __restrict arr, int fromW *((_arr)->arr_data + _d) = NULL; \ } while (0) +/* + * io_arrayElem() - Always GET/PUT element into dynamic array, if not enough elements grow array + * @arr = Array + * @n = Position + * @data = Element, if set NULL GET element at position or !=NULL PUT element at position + * return: -1 error or !=-1 return element at position + */ +inline void *io_arrayElem(array_t * __restrict arr, int n, void **data); /* * io_arrayPush() - Push element into dynamic array like stack manner, place at first empty position * @arr = Array