Tesseract
3.02
|
#include "tessarray.h"
#include "callcpp.h"
#include "freelist.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
Go to the source code of this file.
Functions | |
ARRAY | array_insert (ARRAY array, int index, void *value) |
ARRAY | array_new (int num) |
ARRAY | array_push (ARRAY array, void *value) |
Definition at line 53 of file tessarray.cpp.
{ int x; array = array_push (array, NULL); for (x = array_count (array) - 1; x > index; x--) array_value (array, x) = array_value (array, x - 1); array_value (array, index) = value; return (array); }
ARRAY array_new | ( | int | num | ) |
Definition at line 70 of file tessarray.cpp.
{ ARRAY temp; int x; if (num == 0) num = DEFAULT_SIZE; temp = (ARRAY) memalloc ((num - 2) * sizeof (char *) + sizeof (struct array_record)); if (!temp) { cprintf ("error: Out of memory in array_new\n"); exit (1); //?err_exit (); } array_count (temp) = 0; array_limit (temp) = num; for (x = 0; x < num; x++) array_value (temp, x) = (char *) 0; return (temp); }
Definition at line 98 of file tessarray.cpp.
{ if (array_count (array) == array_limit (array)) { array = (ARRAY) memrealloc (array, (array_limit (array) * 2 - 2) * sizeof (char *) + sizeof (struct array_record), (array_limit (array) - 2) * sizeof (char *) + sizeof (struct array_record)); if (!array) { cprintf ("error: Out of memory in array_push\n"); exit (1); //?err_exit (); } array_limit (array) *= 2; } array_count (array)++; array_top (array) = value; return (array); }