FDOSTUI
FreeDOS Text User Interface
array.h
Go to the documentation of this file.
1 /*
2  ARRAY.H
3 
4  License CC0 PUBLIC DOMAIN
5 
6  To the extent possible under law, Mark J. Olesen has waived all copyright
7  and related or neighboring rights to FDOSTUI Library. This work is published
8  from: United States.
9 */
10 #ifndef __array_h__
11 
12 #include <stddef.h>
13 
14 struct array
15 {
16  size_t m_slots;
17  size_t m_taken;
18  size_t m_growby;
19  void ** m_base;
20 };
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 extern void
28  struct array *const o_arr,
29  size_t const i_growby);
30 
31 extern void
33  struct array *const io_arr);
34 
35 extern void *
36 array_pop(
37  struct array *const io_arr);
38 
39 extern int
41  struct array *const io_arr,
42  void * io_object);
43 
44 extern void *
46  struct array *const io_arr,
47  size_t const i_index);
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 
53 #define __array_h__
54 #endif
void array_assign(struct array *const o_arr, size_t const i_growby)
initialize arrary object
Definition: array.c:18
int array_push(struct array *const io_arr, void *io_object)
adds an element to the end of the array
Definition: array.c:41
void * array_remove(struct array *const io_arr, size_t const i_index)
removes an element from the array Ownership of the object is transferred to the caller.
Definition: array.c:101
void * array_pop(struct array *const io_arr)
remove an element from the end of the array. Ownership of the object is transferred to the caller...
Definition: array.c:84
container to hold objects
Definition: array.h:14
size_t m_slots
Definition: array.h:16
void array_discharge(struct array *const io_arr)
release resources held by object. The routine will not release resources held by the object itself...
Definition: array.c:30
void ** m_base
Definition: array.h:19
size_t m_growby
Definition: array.h:18
size_t m_taken
Definition: array.h:17