cutil/tessarray.h

Go to the documentation of this file.
00001 
00028 #ifndef ARRAY_H
00029 #define ARRAY_H
00030 
00031 /*
00032 ----------------------------------------------------------------------
00033               I n c l u d e s
00034 ----------------------------------------------------------------------
00035 */
00036 
00037 #include <stdio.h>
00038 
00039 /*
00040 ----------------------------------------------------------------------
00041               T y p e s
00042 ----------------------------------------------------------------------
00043 */
00044 
00053 typedef struct array_record
00054 {
00055   size_t limit;
00056   size_t top;
00057   void *base[2];
00058 } *ARRAY;
00059 
00060 typedef void (*voidProc) ();
00061 
00062 typedef int (*intProc) ();
00063 
00064 /*
00065 ----------------------------------------------------------------------
00066               M a c r o s
00067 ----------------------------------------------------------------------
00068 */
00069 
00071 #define DEFAULT_SIZE 2
00072 
00076 #define array_count(a)  \
00077 ((a)->top)
00078 
00082 #define array_free  \
00083 memfree
00084 
00089 #define array_index(a,i)   \
00090 ((i<array_count(a)) ? (a)->base[i] : 0)
00091 
00096 #define array_limit(a)     \
00097 ((a)->limit)
00098 
00103 #define array_loop(a,x)    \
00104 for (x=0; x < array_count (a); x++)
00105 
00109 #define array_top(a)       \
00110 ((a)->base[array_count (a) - 1])
00111 
00115 #define array_value(a,i)   \
00116 ((a)->base[i])
00117 
00118 /*----------------------------------------------------------------------
00119               F u n c t i o n s
00120 ----------------------------------------------------------------------*/
00121 ARRAY array_insert(ARRAY array, int index, void *value); 
00122 
00123 ARRAY array_new(int num); 
00124 
00125 ARRAY array_push(ARRAY array, void *value); 
00126 
00127 /*
00128 #if defined(__STDC__) || defined(__cplusplus)
00129 # define _ARGS(s) s
00130 #else
00131 # define _ARGS(s) ()
00132 #endif*/
00133 
00134 /* array.c
00135 ARRAY array_insert
00136   _ARGS((ARRAY array,
00137   int index,
00138   char *value));
00139 
00140 ARRAY array_new
00141   _ARGS((int num));
00142 
00143 ARRAY array_push
00144   _ARGS((ARRAY array,
00145   char *value));
00146 
00147 #undef _ARGS
00148 */
00149 #endif

Generated on Wed Feb 28 19:49:10 2007 for Tesseract by  doxygen 1.5.1