cutil/oldlist.h

Go to the documentation of this file.
00001 
00114 #ifndef LIST_H
00115 #define LIST_H
00116 
00117 #include "cutil.h"
00118 
00119 /*----------------------------------------------------------------------
00120                   T y p e s
00121 ----------------------------------------------------------------------*/
00122 #define NIL  (LIST) 0
00123 
00132 typedef struct list_rec
00133 {
00134   struct list_rec *node;
00135   struct list_rec *next;
00136 } _LIST_;
00137 
00142 typedef _LIST_ *LIST;
00143 
00144 /*----------------------------------------------------------------------
00145                   M a c r o s
00146 ----------------------------------------------------------------------*/
00147 /* Predefinitions */
00148 #define rest(l)  ((l) ? (l)->next : NIL)
00149 #define first(l) ((l) ? (l)->node : NIL)
00150 
00155 #define copy_first(l1,l2)  \
00156    (l2=push(l2, first(l1)))
00157 
00164 #define iterate(l)             \
00165    for (; (l) != NIL; (l) = rest (l))
00166 
00174 #define iterate_list(x,l)  \
00175    for ((x)=(l); (x)!=0; (x)=rest(x))
00176 
00182 #define JOIN_ON(list1,list2)    \
00183    ((list1) = join ((list1), (list2)))
00184 
00190 #define pop_off(list)    \
00191    ((list) = pop (list))
00192 
00198 #define push_on(list,thing)    \
00199    ((list) = push (list, (LIST) (thing)))
00200 
00206 #define second(l)              \
00207    first (rest (l))
00208 
00214 #define set_rest(l,cell)\
00215    ((l)->next = (cell))
00216 
00222 #define third(l)               \
00223    first (rest (rest (l)))
00224 
00225 /*----------------------------------------------------------------------
00226           Public Funtion Prototypes
00227 ----------------------------------------------------------------------*/
00228 int count(LIST var_list);
00229 
00230 LIST delete_d(LIST list, void *key, int_compare is_equal);
00231 
00232 LIST destroy(LIST list);
00233 
00234 void destroy_nodes(LIST list, void_dest destructor);
00235 
00236 void insert(LIST list, void *node);
00237 
00238 int is_same_node(void *item1, void *item2);
00239 
00240 int is_same(void *item1, void *item2);
00241 
00242 LIST join(LIST list1, LIST list2);
00243 
00244 LIST last(LIST var_list);
00245 
00246 void *nth_cell(LIST var_list, int item_num);
00247 
00248 LIST pop(LIST list);
00249 
00250 LIST push(LIST list, void *element);
00251 
00252 LIST push_last(LIST list, void *item);
00253 
00254 LIST reverse(LIST list);
00255 
00256 LIST reverse_d(LIST list);
00257 
00258 LIST s_adjoin(LIST var_list, void *variable, int_compare compare);
00259 
00260 LIST search(LIST list, void *key, int_compare is_equal);
00261 
00262 /*
00263 #if defined(__STDC__) || defined(__cplusplus)
00264 # define _ARGS(s) s
00265 #else
00266 # define _ARGS(s) ()
00267 #endif
00268 
00269 typedef void  (*destructor)   _ARGS((LIST l));
00270 
00271 typedef LIST  (*list_proc)    _ARGS((LIST a));
00272 
00273 int count
00274 _ARGS((LIST var_list));
00275 
00276 LIST delete_d
00277 _ARGS((LIST list,
00278     LIST key,
00279     int_compare is_equal));
00280 
00281 LIST destroy
00282 _ARGS((LIST list));
00283 
00284 LIST destroy_nodes
00285 _ARGS((LIST list,
00286     void_dest destructor));
00287 
00288 void insert
00289 _ARGS((LIST list,
00290     LIST node));
00291 
00292 int is_same_node
00293 _ARGS((LIST s1,
00294     LIST s2));
00295 
00296 int is_same
00297 _ARGS((LIST s1,
00298     LIST s2));
00299 
00300 LIST join
00301 _ARGS((LIST list1,
00302     LIST list2));
00303 
00304 LIST last
00305 _ARGS((LIST var_list));
00306 
00307 LIST nth_cell
00308 _ARGS((LIST var_list,
00309     int item_num));
00310 
00311 LIST pop
00312 _ARGS((LIST list));
00313 
00314 LIST push
00315 _ARGS((LIST list,
00316     LIST element));
00317 
00318 LIST push_last
00319 _ARGS((LIST list,
00320     LIST item));
00321 
00322 LIST reverse
00323 _ARGS((LIST list));
00324 
00325 LIST reverse_d
00326 _ARGS((LIST list));
00327 
00328 LIST s_adjoin
00329 _ARGS((LIST var_list,
00330     LIST variable,
00331     int_compare compare));
00332 
00333 LIST search
00334 _ARGS((LIST list,
00335     LIST key,
00336     int_compare is_equal));
00337 
00338 #undef _ARGS
00339 */
00340 #endif

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