#ifndef __IUP_ARRAY_BI__ 
#define __IUP_ARRAY_BI__

#include once "iup.bi"


' Simple Array
' Expandable array using a simple pointer.
type _Iarray
  as any ptr data
  as integer count
  as integer max_count
  as integer elem_size
  as integer start_count
end type

type Iarray as _Iarray

extern "C"

' 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 iupArrayInc to proper allocates memory.
_DF_ iupArrayCreate(start_count as integer, elem_size as integer) as Iarray ptr 

' Destroys the array.
_DS_ iupArrayDestroy(array as Iarray ptr)

' Returns the pointer that contains the array.
_DF_ iupArrayGetData(array as Iarray ptr) as any ptr

' 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.
_DF_ iupArrayInc(array as Iarray ptr) as any ptr

' 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.
_DF_ iupArrayAdd(array as Iarray ptr, new_count as integer) as any ptr

' Returns the actual number of elements in the array.
_DF_ iupArrayCount(array as Iarray ptr) as integer


end extern


#endif
