From d577d991b97ae2b5ee1af23641bcffc3f83af5b2 Mon Sep 17 00:00:00 2001 From: Pixel Date: Wed, 4 Nov 2009 11:56:41 -0800 Subject: Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux. --- iup/src/iup_array.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 iup/src/iup_array.h (limited to 'iup/src/iup_array.h') diff --git a/iup/src/iup_array.h b/iup/src/iup_array.h new file mode 100755 index 0000000..b44e862 --- /dev/null +++ b/iup/src/iup_array.h @@ -0,0 +1,63 @@ +/** \file + * \brief Simple expandable array + * + * See Copyright Notice in "iup.h" + */ + +#ifndef __IUP_ARRAY_H +#define __IUP_ARRAY_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** \defgroup iarray Simple Array + * \par + * Expandable array using a simple pointer. + * \par + * See \ref iup_array.h + * \ingroup util */ + +typedef struct _Iarray Iarray; + +/** Creates an array with an initial room for elements, and the element size. + * The array count starts at 0. And the maximum number of elements starts at the given count. + * The maximum number of elements is increased by the start count, every time it needs more memory. + * Must call \ref iupArrayInc to proper allocates memory. + * \ingroup iarray */ +Iarray* iupArrayCreate(int start_count, int elem_size); + +/** Destroys the array. + * \ingroup iarray */ +void iupArrayDestroy(Iarray* iarray); + +/** Returns the pointer that contains the array. + * \ingroup iarray */ +void* iupArrayGetData(Iarray* iarray); + +/** Increments the number of elements in the array. + * The array count starts at 0. + * If the maximum number of elements is reached, the memory allocated is increased by the initial start count. + * Returns the pointer that contains the array. + * \ingroup iarray */ +void* iupArrayInc(Iarray* iarray); + +/** Increments the number of elements in the array by a given count. + * The array count starts at 0. + * If the maximum number of elements is reached, the memory allocated is increased by the given count. + * Returns the pointer that contains the array. + * \ingroup iarray */ +void* iupArrayAdd(Iarray* iarray, int new_count); + +/** Returns the actual number of elements in the array. + * \ingroup iarray */ +int iupArrayCount(Iarray* iarray); + + + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3