"Fossies" - the Fresh Open Source Software Archive

Member "tesseract-ocr/doc/html/host_8h_source.html" (26 Oct 2012, 36062 Bytes) of package /linux/misc/old/tesseract-ocr-3.02.02-doc-html.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the tesseract-ocr-3.02.02-doc-html.tar.gz project site itself.

Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
host.h
Go to the documentation of this file.
1 /******************************************************************************
2  ** Filename: Host.h
3  ** Purpose: This is the system independent typedefs and defines
4  ** Author: MN, JG, MD
5  ** Version: 5.4.1
6  ** History: 11/7/94 MCD received the modification that Lennart made
7  ** to port to 32 bit world and modify this file so that it
8  ** will be shared between platform.
9  ** 11/9/94 MCD Make MSW32 subset of MSW. Now MSW means
10  ** MicroSoft Window and MSW32 means the 32 bit worlds
11  ** of MicroSoft Window. Therefore you want the environment
12  ** to be MicroSoft Window and in the 32 bit world -
13  ** _WIN32 must be defined by your compiler.
14  ** 11/30/94 MCD Incorporated comments received for more
15  ** readability and the missing typedef for FLOAT.
16  ** 12/1/94 MCD Added PFVOID typedef
17  ** 5/1/95 MCD. Made many changes based on the inputs.
18  ** Changes:
19  ** 1) Rearrange the #ifdef so that there're definitions for
20  ** particular platforms.
21  ** 2) Took out the #define for computer and environment
22  ** that developer can uncomment
23  ** 3) Added __OLDCODE__ where the defines will be
24  ** obsoleted in the next version and advise not to use.
25  ** 4) Added the definitions for the following:
26  ** FILE_HANDLE, MEMORY_HANDLE, BOOL8,
27  ** MAX_INT8, MAX_INT16, MAX_INT32, MAX_UINT8
28  ** MAX_UINT16, MAX_UINT32, MAX_FLOAT32
29  ** 06/19/96 MCD. Took out MAX_FLOAT32
30  ** 07/15/96 MCD. Fixed the comments error
31  ** Add back BOOL8.
32  **
33  ** (c) Copyright Hewlett-Packard Company, 1988-1996.
34  ** Licensed under the Apache License, Version 2.0 (the "License");
35  ** you may not use this file except in compliance with the License.
36  ** You may obtain a copy of the License at
37  ** http://www.apache.org/licenses/LICENSE-2.0
38  ** Unless required by applicable law or agreed to in writing, software
39  ** distributed under the License is distributed on an "AS IS" BASIS,
40  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41  ** See the License for the specific language governing permissions and
42  ** limitations under the License.
43  */
44 
45 #ifndef __HOST__
46 #define __HOST__
47 
48 /******************************************************************************
49  ** IMPORTANT!!! **
50  ** **
51  ** Defines either _WIN32, __MAC__, __UNIX__, __OS2__, __PM__ to
52  ** use the specified definitions indicated below in the preprocessor settings. **
53  ** **
54  ** Also define either __FarProc__ or __FarData__ and __MOTO__ to use the
55  ** specified definitions indicated below in the preprocessor settings. **
56  ** **
57  ** If a preprocessor settings is not allow in the compiler that is being use,
58  ** then it is recommended that a "platform.h" is created with the definition
59  ** of the computer and/or operating system.
60  ******************************************************************************/
61 
62 #include "platform.h"
63 /* _WIN32 */
64 #ifdef _WIN32
65 #include <windows.h>
66 #include <winbase.h> // winbase.h contains windows.h
67 #endif
68 
69 /********************************************************/
70 /* __MAC__ */
71 #ifdef __MAC__
72 #include <Types.h>
73 /*----------------------------*/
74 /*----------------------------*/
75 #endif
76 /********************************************************/
77 #if defined(__UNIX__) || defined( __DOS__ ) || defined(__OS2__) || defined(__PM__)
78 /*----------------------------*/
79 /* FarProc and FarData */
80 /*----------------------------*/
81 /*----------------------------*/
82 #endif
83 /*****************************************************************************
84  **
85  ** Standard GHC Definitions
86  **
87  *****************************************************************************/
88 
89 #ifdef __MOTO__
90 #define __NATIVE__ MOTO
91 #else
92 #define __NATIVE__ INTEL
93 #endif
94 
95 //typedef HANDLE FD* PHANDLE;
96 
97 // definitions of portable data types (numbers and characters)
98 typedef SIGNED char inT8;
99 typedef unsigned char uinT8;
100 typedef short inT16;
101 typedef unsigned short uinT16;
102 typedef int inT32;
103 typedef unsigned int uinT32;
104 #if (_MSC_VER >= 1200) //%%% vkr for VC 6.0
105 typedef INT64 inT64;
106 typedef UINT64 uinT64;
107 #else
108 typedef long long int inT64;
109 typedef unsigned long long int uinT64;
110 #endif //%%% vkr for VC 6.0
111 typedef float FLOAT32;
112 typedef double FLOAT64;
113 typedef unsigned char BOOL8;
114 
115 #define INT32FORMAT "%d"
116 #define INT64FORMAT "%lld"
117 
118 #define MAX_INT8 0x7f
119 #define MAX_INT16 0x7fff
120 #define MAX_INT32 0x7fffffff
121 #define MAX_UINT8 0xff
122 #define MAX_UINT16 0xffff
123 #define MAX_UINT32 0xffffffff
124 #define MAX_FLOAT32 ((float)3.40282347e+38)
125 
126 #define MIN_INT8 0x80
127 #define MIN_INT16 0x8000
128 #define MIN_INT32 0x80000000
129 #define MIN_UINT8 0x00
130 #define MIN_UINT16 0x0000
131 #define MIN_UINT32 0x00000000
132 #define MIN_FLOAT32 ((float)1.17549435e-38)
133 
134 // Defines
135 #ifndef TRUE
136 #define TRUE 1
137 #endif
138 
139 #ifndef FALSE
140 #define FALSE 0
141 #endif
142 
143 #ifndef NULL
144 #define NULL 0L
145 #endif
146 
147 // Return true if x is within tolerance of y
148 template<class T> bool NearlyEqual(T x, T y, T tolerance) {
149  T diff = x - y;
150  return diff <= tolerance && -diff <= tolerance;
151 }
152 
153 #endif