Diff for /libelwix/inc/elwix/aarray.h between versions 1.1 and 1.5

version 1.1, 2013/01/17 10:05:35 version 1.5, 2014/01/29 14:16:53
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013Copyright 2004 - 2014
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 58  typedef struct _tagArray { Line 58  typedef struct _tagArray {
 #define array_Zero(_arr)                (assert((_arr)), memset((_arr)->arr_data, 0, \  #define array_Zero(_arr)                (assert((_arr)), memset((_arr)->arr_data, 0, \
                                                 array_Size((_arr)) * sizeof(intptr_t)))                                                  array_Size((_arr)) * sizeof(intptr_t)))
   
   #define array_Ptr(_arr, _d)             ((_arr) ? (_arr)->arr_data[_d] : NULL)
 #define array_Get2(_arr, _d)            (assert((_arr) && (_arr)->arr_num > _d), ((_arr)->arr_data + _d))  #define array_Get2(_arr, _d)            (assert((_arr) && (_arr)->arr_num > _d), ((_arr)->arr_data + _d))
 #define array_Get(_arr, _d)             (assert((_arr) && (_arr)->arr_num > _d), (_arr)->arr_data[_d])  #define array_Get(_arr, _d)             (assert((_arr) && (_arr)->arr_num > _d), (_arr)->arr_data[_d])
 #define array(_arr, _d, _type)          (assert((_arr) && (_arr)->arr_num > _d), \  #define array(_arr, _d, _type)          (assert((_arr) && (_arr)->arr_num > _d), \
Line 79  typedef struct _tagArray { Line 80  typedef struct _tagArray {
  * @numItems = Number of Items   * @numItems = Number of Items
  * return: NULL error, != NULL allocated memory for array   * return: NULL error, != NULL allocated memory for array
  */   */
inline array_t *array_Init(int numItems);array_t *array_Init(int numItems);
 /*  /*
  * array_Destroy() - Free and destroy dynamic array   * array_Destroy() - Free and destroy dynamic array
  *   *
  * @parr = Array   * @parr = Array
  * return: none   * return: none
  */   */
inline void array_Destroy(array_t ** __restrict parr);void array_Destroy(array_t ** __restrict parr);
 /*  /*
  * array_Free() - Free all data in dynamic array items   * array_Free() - Free all data in dynamic array items
  *      (WARNING! If assign static array dont use this!!!)   *      (WARNING! If assign static array dont use this!!!)
Line 94  inline void array_Destroy(array_t ** __restrict parr); Line 95  inline void array_Destroy(array_t ** __restrict parr);
  * @arr = Array   * @arr = Array
  * return: none   * return: none
  */   */
inline void array_Free(array_t * __restrict arr);void array_Free(array_t * __restrict arr);
   
 /*  /*
  * array_From() - Create and fill array from array with pointers   * array_From() - Create and fill array from array with pointers
Line 106  inline void array_Free(array_t * __restrict arr); Line 107  inline void array_Free(array_t * __restrict arr);
 array_t *array_From(const char *** __restrict pargv, int argc);  array_t *array_From(const char *** __restrict pargv, int argc);
 /*  /*
  * array_Args() Parse and make array from arguments ... (input string will be modified!!!    * array_Args() Parse and make array from arguments ... (input string will be modified!!! 
 *      and output array must be free with io_arrayDestroy() after use!) *      and output array must be free with array_Destroy() after use!)
  *   *
  * @psArgs = Input arguments line, after execute string is modified!!!   * @psArgs = Input arguments line, after execute string is modified!!!
  * @nargs = Maximum requested count of arguments from input string psArgs, if 0 all psArgs   * @nargs = Maximum requested count of arguments from input string psArgs, if 0 all psArgs
Line 130  char **array_To(array_t * __restrict arr); Line 131  char **array_To(array_t * __restrict arr);
  * @arr = Array   * @arr = Array
  * return: -1 empty or >-1 position of last used element   * return: -1 empty or >-1 position of last used element
  */   */
inline int array_Len(array_t * __restrict arr);int array_Len(array_t * __restrict arr);
   
 /*  /*
  * array_Grow() - Grow/Shrink dynamic array, Use with care when it shrink!!!   * array_Grow() - Grow/Shrink dynamic array, Use with care when it shrink!!!
Line 160  int array_Concat(array_t * __restrict dest, array_t *  Line 161  int array_Concat(array_t * __restrict dest, array_t * 
 /*  /*
  * array_Copy() Copy source array to destination array   * array_Copy() Copy source array to destination array
  *   *
 * @dest = Destination array, after use free with io_arrayDestroy() * @dest = Destination array, after use free with array_Destroy()
  * @src = Source array   * @src = Source array
  * return: -1 error; >0 count of destination array   * return: -1 error; >0 count of destination array
  */   */
Line 174  int array_Copy(array_t ** __restrict dest, array_t * _ Line 175  int array_Copy(array_t ** __restrict dest, array_t * _
  * @data = Element, if set NULL GET element at position or !=NULL PUT element at 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   * return: -1 error or !=-1 return element at position
  */   */
inline void *array_Elem(array_t * __restrict arr, int n, void *data);void *array_Elem(array_t * __restrict arr, int n, void *data);
 /*  /*
  * array_Push() - Push element into dynamic array like stack manner, place at first empty position   * array_Push() - Push element into dynamic array like stack manner, place at first empty position
  *   *
Line 183  inline void *array_Elem(array_t * __restrict arr, int  Line 184  inline void *array_Elem(array_t * __restrict arr, int 
  * @nogrow = Don't grow array if not enough space   * @nogrow = Don't grow array if not enough space
  * 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 array_Push(array_t * __restrict arr, void **data, int nogrow);int array_Push(array_t * __restrict arr, void *data, int nogrow);
 /*  /*
  * array_Pop() - Pop element from dynamic array like stack manner, last used position   * array_Pop() - Pop element from dynamic array like stack manner, last used position
  *   *
Line 192  inline int array_Push(array_t * __restrict arr, void * Line 193  inline int array_Push(array_t * __restrict arr, void *
  * @nodel = Don't delete after Pop element   * @nodel = Don't delete after Pop element
  * return: -1 not found used position, array is empty!, >-1 return element position   * return: -1 not found used position, array is empty!, >-1 return element position
  */   */
inline int array_Pop(array_t * __restrict arr, void ** __restrict data, int nodel);int array_Pop(array_t * __restrict arr, void ** __restrict data, int nodel);
   
   
 #endif  #endif

Removed from v.1.1  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>