Go to the source code of this file.
Functions | |
static void | array_initialize (array *_a, int _from, int _to) |
INTERNAL FUNCTION: Initialize an array. | |
void | array_init (array *_a) |
Initialize an array. | |
array * | array_create () |
Create and initialize a new array. | |
void * | array_allocate (array *_a, size_t _sz, int _pos) |
Allocate more space. | |
static void | array_print (array *_a) |
INTERNAL FUNCTION: print an array. | |
void * | array_get (array *_a, size_t _sz, int _pos) |
Get an object from the array. | |
size_t | array_length (array *_a, size_t _sz) |
Computes the size of an array. | |
void | array_truncate (array *_a, size_t _sz, int _len) |
Reduces the number of initialized bytes. | |
void | array_reset (array *_a) |
Reset an array as if it has just been created. | |
void | array_delete (array *_a) |
Deletes an array. | |
int | array_equal (array *_a, array *_b) |
Compare two arrays. | |
void | array_sort (array *_a, size_t _sz, int(*_cmp)(const void *, const void *)) |
Sort an array. | |
static int | cmp (int *_a, int *_b) |
INTERNAL FUNCTION: sample comparison function. | |
int | array_cat (array *_a, array *_b) |
int | array_catb (array *_a, array *_b, size_t _len) |
int | main () |
Definition in file array.c.
static void array_initialize | ( | array * | _a, | |
int | _from, | |||
int | _to | |||
) | [static] |
INTERNAL FUNCTION: Initialize an array.
This function initializes bytes _from
to _to
and sets sz_init
appropriately.
_a | an array | |
_from | position | |
_to | position |
Definition at line 48 of file array.c.
References array::data, and array::sz_init.
Referenced by array_allocate().
static void array_print | ( | array * | _a | ) | [static] |
INTERNAL FUNCTION: print an array.
This function will soon be substituted by array_foreach(), which calls a user-supplied function for each object in the array, so don't use it.
_a | an array |
Definition at line 166 of file array.c.
References array::data, array::sz_alloc, and array::sz_init.
Referenced by main().
static int cmp | ( | int * | _a, | |
int * | _b | |||
) | [static] |
INTERNAL FUNCTION: sample comparison function.
Compares two integer values. See array_sort() for details, but don't use it.
_a | an integer | |
_b | another integer |
Definition at line 341 of file array.c.
References array_catb(), and array::sz_init.
Referenced by main().
Definition at line 349 of file array.c.
References array_allocate(), array::data, and array::sz_init.
Referenced by array_cat().
int main | ( | ) |
Definition at line 366 of file array.c.
References array_allocate(), array_cat(), array_print(), and array_start.