/usr/include/tesseract/oldlist.h is in libtesseract-dev 3.02.01-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | /* -*-C-*-
********************************************************************************
*
* File: list.h (Formerly list.h)
* Description: List processing procedures declarations.
* Author: Mark Seaman, SW Productivity
* Created: Fri Oct 16 14:37:00 1987
* Modified: Wed Dec 5 15:43:17 1990 (Mark Seaman) marks@hpgrlt
* Language: C
* Package: N/A
* Status: Reusable Software Component
*
* (c) Copyright 1987, Hewlett-Packard Company.
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
** http://www.apache.org/licenses/LICENSE-2.0
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*
********************************************************************************
*
* This file contains the interface for a set of general purpose list
* manipulation routines. For the implementation of these routines see
* the file "list.c".
*
********************************************************************************
*
* INDEX
* =======
*
* BASICS:
* -------
* first_node - Macro to return the first list node (not the cell).
* list_rest - Macro the return the second list cell
* pop - Destroy one list cell
* push - Create one list cell and set the node and next fields
*
* ITERATION:
* -----------------
* iterate - Macro to create a for loop to visit each cell.
* iterate_list - Macro to visit each cell using a local variable.
* for_each - Applies a function to each node.
*
* LIST CELL COUNTS:
* -----------------
* count - Returns the number of list cells in the list.
* second_node - Returns the second node.
* third - Returns the third node.
* fourth - Returns the fourth node.
* fifth - Returns the fifth node.
* last - Returns the last list cell.
* pair - Creates a list of two elements.
*
* COPYING:
* -----------------
* copy_first - Pushes the first element from list 1 onto list 2.
* copy - Create a copy of a list.
* concat - Creates a new list that is a copy of both input lists.
* delete_n - Creates a new list without the chosen elements.
* reverse - Creates a backwards copy of the input list.
* sort - Use quick sort to construct a new list.
* transform - Creates a new list by transforming each of the nodes.
*
* TRANFORMS: (Note: These functions all modify the input list.)
* ----------
* join - Concatenates list 1 and list 2.
* delete_d - Removes the requested elements from the list.
* transform_d - Modifies the list by applying a function to each node.
* insert - Add a new element into this spot in a list. (not NIL_LIST)
* push_last - Add a new element onto the end of a list.
* reverse_d - Reverse a list and destroy the old one.
*
* ASSOCIATED LISTS:
* -----------------
* adelete - Remove a particular entry from an associated list.
* assoc - Find an entry in an associated list that matches a key.
* match - Return the data element of an a-list entry.
*
* DISPLAY:
* -----------------
* print_cell - Print a hex dump of a list cell.
* show - Displays a string and a list (using lprint).
*
* SETS:
* -----
* adjoin - Add a new element to list if it does not exist already.
* intersection - Create a new list that is the set intersection.
* set_union - Create a new list that is the set intersection.
* set_difference - Create a new list that is the set difference.
* s_adjoin - Add an element to a sort list if it is not there.
* s_intersection - Set intersection on a sorted list. Modifies old list.
* s_union - Set intersection on a sorted list. Modifies old list.
* search - Return the pointer to the list cell whose node matches.
*
* COMPARISONS:
* -----------------
* is_same - Compares each node to the key.
* is_not_same - Compares each node to the key.
* is_key - Compares first of each node to the key.
* is_not_key - Compares first of each node to the key.
*
* CELL OPERATIONS:
* -----------------
* new_cell - Obtain a new list cell from the free list. Allocate.
* free_cell - Return a list cell to the free list.
* destroy - Return all list cells in a list.
* destroy_nodes - Apply a function to each list cell and destroy the list.
* set_node - Assign the node field in a list cell.
* set_rest - Assign the next field in a list cell.
*
***********************************************************************/
#ifndef LIST_H
#define LIST_H
#include "cutil.h"
#include "tesscallback.h"
/*----------------------------------------------------------------------
T y p e s
----------------------------------------------------------------------*/
#define NIL_LIST (LIST) 0
struct list_rec
{
struct list_rec *node;
struct list_rec *next;
};
typedef list_rec *LIST;
/*----------------------------------------------------------------------
M a c r o s
----------------------------------------------------------------------*/
/* Predefinitions */
#define list_rest(l) ((l) ? (l)->next : NIL_LIST)
#define first_node(l) ((l) ? (l)->node : NIL_LIST)
/**********************************************************************
* c o p y f i r s t
*
* Do the appropriate kind a push operation to copy the first node from
* one list to another.
*
**********************************************************************/
#define copy_first(l1,l2) \
(l2=push(l2, first_node(l1)))
/**********************************************************************
* i t e r a t e
*
* Visit each node in the list. Replace the old list with the list
* minus the head. Continue until the list is NIL_LIST.
**********************************************************************/
#define iterate(l) \
for (; (l) != NIL_LIST; (l) = list_rest (l))
/**********************************************************************
* i t e r a t e l i s t
*
* Visit each node in the list (l). Use a local variable (x) to iterate
* through all of the list cells. This macro is identical to iterate
* except that it does not lose the original list.
**********************************************************************/
#define iterate_list(x,l) \
for ((x)=(l); (x)!=0; (x)=list_rest(x))
/**********************************************************************
* j o i n o n
*
* Add another list onto the tail of this one. The list given as an input
* parameter is modified.
**********************************************************************/
#define JOIN_ON(list1,list2) \
((list1) = join ((list1), (list2)))
/**********************************************************************
* p o p o f f
*
* Add a cell onto the front of a list. The list given as an input
* parameter is modified.
**********************************************************************/
#define pop_off(list) \
((list) = pop (list))
/**********************************************************************
* p u s h o n
*
* Add a cell onto the front of a list. The list given as an input
* parameter is modified.
**********************************************************************/
#define push_on(list,thing) \
((list) = push (list, (LIST) (thing)))
/**********************************************************************
* s e c o n d
*
* Return the contents of the second list element.
*
* #define second_node(l) first_node (list_rest (l))
**********************************************************************/
#define second_node(l) \
first_node (list_rest (l))
/**********************************************************************
* s e t r e s t
*
* Change the "next" field of a list element to point to a desired place.
*
* #define set_rest(l,node) l->next = node;
**********************************************************************/
#define set_rest(l,cell)\
((l)->next = (cell))
/**********************************************************************
* t h i r d
*
* Return the contents of the third list element.
*
* #define third(l) first_node (list_rest (list_rest (l)))
**********************************************************************/
#define third(l) \
first_node (list_rest (list_rest (l)))
/*----------------------------------------------------------------------
Public Funtion Prototypes
----------------------------------------------------------------------*/
int count(LIST var_list);
LIST delete_d(LIST list, void *key, int_compare is_equal);
LIST delete_d(LIST list, void *key,
TessResultCallback2<int, void*, void*>* is_equal);
LIST destroy(LIST list);
void destroy_nodes(LIST list, void_dest destructor);
void insert(LIST list, void *node);
int is_same_node(void *item1, void *item2);
int is_same(void *item1, void *item2);
LIST join(LIST list1, LIST list2);
LIST last(LIST var_list);
void *nth_cell(LIST var_list, int item_num);
LIST pop(LIST list);
LIST push(LIST list, void *element);
LIST push_last(LIST list, void *item);
LIST reverse(LIST list);
LIST reverse_d(LIST list);
LIST s_adjoin(LIST var_list, void *variable, int_compare compare);
LIST search(LIST list, void *key, int_compare is_equal);
LIST search(LIST list, void *key, TessResultCallback2<int, void*, void*>*);
/*
#if defined(__STDC__) || defined(__cplusplus)
# define _ARGS(s) s
#else
# define _ARGS(s) ()
#endif
typedef void (*destructor) _ARGS((LIST l));
typedef LIST (*list_proc) _ARGS((LIST a));
int count
_ARGS((LIST var_list));
LIST delete_d
_ARGS((LIST list,
LIST key,
int_compare is_equal));
LIST destroy
_ARGS((LIST list));
LIST destroy_nodes
_ARGS((LIST list,
void_dest destructor));
void insert
_ARGS((LIST list,
LIST node));
int is_same_node
_ARGS((LIST s1,
LIST s2));
int is_same
_ARGS((LIST s1,
LIST s2));
LIST join
_ARGS((LIST list1,
LIST list2));
LIST last
_ARGS((LIST var_list));
LIST nth_cell
_ARGS((LIST var_list,
int item_num));
LIST pop
_ARGS((LIST list));
LIST push
_ARGS((LIST list,
LIST element));
LIST push_last
_ARGS((LIST list,
LIST item));
LIST reverse
_ARGS((LIST list));
LIST reverse_d
_ARGS((LIST list));
LIST s_adjoin
_ARGS((LIST var_list,
LIST variable,
int_compare compare));
LIST search
_ARGS((LIST list,
LIST key,
int_compare is_equal));
#undef _ARGS
*/
#endif
|