tesseract  4.00.00dev
cutil.h
Go to the documentation of this file.
1 /* -*-C-*-
2  ********************************************************************************
3  *
4  * File: cutil.h
5  * Description: General utility functions
6  * Author: Mark Seaman, SW Productivity
7  * Created: Fri Oct 16 14:37:00 1987
8  * Modified: Wed Dec 5 15:40:26 1990 (Mark Seaman) marks@hpgrlt
9  * Language: C
10  * Package: N/A
11  * Status: Reusable Software Component
12  *
13  * (c) Copyright 1987, Hewlett-Packard Company.
14  ** Licensed under the Apache License, Version 2.0 (the "License");
15  ** you may not use this file except in compliance with the License.
16  ** You may obtain a copy of the License at
17  ** http://www.apache.org/licenses/LICENSE-2.0
18  ** Unless required by applicable law or agreed to in writing, software
19  ** distributed under the License is distributed on an "AS IS" BASIS,
20  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  ** See the License for the specific language governing permissions and
22  ** limitations under the License.
23  *
24  ********************************************************************************
25 Revision 1.1 2007/02/02 23:39:07 theraysmith
26 Fixed portability issues
27 
28 Revision 1.1.1.1 2004/02/20 19:39:06 slumos
29 Import original HP distribution
30 
31 */
32 
33 #ifndef CUTILH
34 #define CUTILH
35 
36 /*----------------------------------------------------------------------
37  I n c l u d e s
38 ----------------------------------------------------------------------*/
39 #include <stdio.h>
40 #include <string.h>
41 #include <stdlib.h>
42 
43 #include "host.h"
44 #include "tprintf.h"
45 
46 /*----------------------------------------------------------------------
47  T y p e s
48 ----------------------------------------------------------------------*/
49 #ifndef TRUE
50 #define TRUE 1
51 #endif
52 
53 #ifndef FALSE
54 #define FALSE 0
55 #endif
56 
57 #define CHARS_PER_LINE 500
58 
59 #if defined(__STDC__) || defined(__cplusplus)
60 # define _ARGS(s) s
61 #else
62 # define _ARGS(s) ()
63 #endif
64 
65 //typedef int (*int_proc) (void);
66 typedef void (*void_proc) (...);
67 typedef void *(*void_star_proc) _ARGS ((...));
68 
69 typedef int (*int_void) (void);
70 typedef void (*void_void) (void);
71 typedef int (*int_compare) (void *, void *);
72 typedef void (*void_dest) (void *);
73 
74 /*----------------------------------------------------------------------
75  M a c r o s
76 ----------------------------------------------------------------------*/
77 /**********************************************************************
78  * new_line
79  *
80  * Print a new line character on stdout.
81  **********************************************************************/
82 
83 #define new_line() \
84  tprintf("\n")
85 
86 /**********************************************************************
87  * print_string
88  *
89  * Print a string on stdout.
90  **********************************************************************/
91 
92 #define print_string(str) \
93  printf ("%s\n", str)
94 
95 /*----------------------------------------------------------------------
96  F u n c t i o n s
97 ----------------------------------------------------------------------*/
98 long long_rand(long limit);
99 
100 FILE *open_file(const char *filename, const char *mode);
101 
102 bool exists_file(const char *filename);
103 
104 /* util.c
105 long long_rand
106  _ARGS ((long limit));
107 
108 FILE *open_file
109  _ARGS((char *filename,
110  char *mode));
111 
112 #undef _ARGS
113 */
114 #include "cutil_class.h"
115 #endif
int(* int_void)(void)
Definition: cutil.h:69
bool exists_file(const char *filename)
Check whether the file exists.
Definition: cutil.cpp:92
void(* void_dest)(void *)
Definition: cutil.h:72
void(* void_void)(void)
Definition: cutil.h:70
const char int mode
Definition: ioapi.h:38
const char * filename
Definition: ioapi.h:38
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
long long_rand(long limit)
Definition: cutil.cpp:56
FILE * open_file(const char *filename, const char *mode)
Definition: cutil.cpp:82
void(* void_proc)(...)
Definition: cutil.h:66
#define _ARGS(s)
Definition: cutil.h:62
int(* int_compare)(void *, void *)
Definition: cutil.h:71