00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef LEPTONICA_ENVIRON_H
00017 #define LEPTONICA_ENVIRON_H
00018
00019 #if defined(WIN32) || defined(WIN64)
00020
00021
00022 #if defined(WIN32)
00023 typedef int intptr_t;
00024 typedef unsigned int uintptr_t;
00025 #else
00026 typedef long int intptr_t;
00027 typedef unsigned long int uintptr_t;
00028 #endif
00029
00030
00031 #if (_MSC_VER <= 1400)
00032 #define powf(x, y) (float)pow((double)(x), (double)(y))
00033 #define expf(x) (float)exp((double)(x))
00034 #endif
00035
00036
00037 #ifdef LEPTONLIB_EXPORTS
00038 #define LEPT_DLL __declspec(dllexport)
00039 #elif defined(LEPTONLIB_IMPORTS)
00040 #define LEPT_DLL __declspec(dllimport)
00041 #else
00042 #define LEPT_DLL
00043 #endif
00044 #else
00045 #include <stdint.h>
00046 #define LEPT_DLL
00047 #endif
00048
00049 typedef intptr_t l_intptr_t;
00050 typedef uintptr_t l_uintptr_t;
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 #ifndef HAVE_CONFIG_H
00066 #define HAVE_LIBJPEG 1
00067 #define HAVE_LIBTIFF 1
00068 #define HAVE_LIBPNG 1
00069 #define HAVE_LIBZ 1
00070 #define HAVE_LIBGIF 0
00071 #define HAVE_LIBUNGIF 0
00072 #endif
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 #ifndef HAVE_CONFIG_H
00084 #define HAVE_FMEMOPEN 0
00085 #endif
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 #define USE_BMPIO 1
00099 #define USE_PNMIO 1
00100 #define USE_PSIO 1
00101
00102
00103
00104
00105
00106 typedef signed char l_int8;
00107 typedef unsigned char l_uint8;
00108 typedef short l_int16;
00109 typedef unsigned short l_uint16;
00110 typedef int l_int32;
00111 typedef unsigned int l_uint32;
00112 typedef float l_float32;
00113 typedef double l_float64;
00114
00115
00116
00117
00118
00119 #ifndef L_MIN
00120 #define L_MIN(x,y) (((x) < (y)) ? (x) : (y))
00121 #endif
00122
00123 #ifndef L_MAX
00124 #define L_MAX(x,y) (((x) > (y)) ? (x) : (y))
00125 #endif
00126
00127 #ifndef L_ABS
00128 #define L_ABS(x) (((x) < 0) ? (-1 * (x)) : (x))
00129 #endif
00130
00131 #ifndef L_SIGN
00132 #define L_SIGN(x) (((x) < 0) ? -1 : 1)
00133 #endif
00134
00135 #ifndef UNDEF
00136 #define UNDEF -1
00137 #endif
00138
00139 #ifndef NULL
00140 #define NULL 0
00141 #endif
00142
00143 #ifndef TRUE
00144 #define TRUE 1
00145 #endif
00146
00147 #ifndef FALSE
00148 #define FALSE 0
00149 #endif
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 enum {
00170 L_NOT_FOUND = 0,
00171 L_FOUND = 1
00172 };
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 #define MALLOC(blocksize) malloc(blocksize)
00183 #define CALLOC(numelem, elemsize) calloc(numelem, elemsize)
00184 #define REALLOC(ptr, blocksize) realloc(ptr, blocksize)
00185 #define FREE(ptr) free(ptr)
00186
00187
00188
00189
00190
00191
00192
00193 #ifdef NO_CONSOLE_IO
00194
00195 #define PROCNAME(name)
00196 #define ERROR_PTR(a,b,c) ((void *)(c))
00197 #define ERROR_INT(a,b,c) ((l_int32)(c))
00198 #define ERROR_FLOAT(a,b,c) ((l_float32)(c))
00199 #define ERROR_VOID(a,b)
00200 #define L_ERROR(a,b)
00201 #define L_ERROR_STRING(a,b,c)
00202 #define L_ERROR_INT(a,b,c)
00203 #define L_ERROR_FLOAT(a,b,c)
00204 #define L_WARNING(a,b)
00205 #define L_WARNING_STRING(a,b,c)
00206 #define L_WARNING_INT(a,b,c)
00207 #define L_WARNING_FLOAT(a,b,c)
00208 #define L_INFO(a,b)
00209 #define L_INFO_STRING(a,b,c)
00210 #define L_INFO_INT(a,b,c)
00211 #define L_INFO_INT2(a,b,c,d)
00212 #define L_INFO_FLOAT(a,b,c)
00213 #define L_INFO_FLOAT2(a,b,c,d)
00214
00215 #else
00216
00217 #define PROCNAME(name) static const char procName[] = name
00218 #define ERROR_PTR(a,b,c) returnErrorPtr((a),(b),(c))
00219 #define ERROR_INT(a,b,c) returnErrorInt((a),(b),(c))
00220 #define ERROR_FLOAT(a,b,c) returnErrorFloat((a),(b),(c))
00221 #define ERROR_VOID(a,b) returnErrorVoid((a),(b))
00222 #define L_ERROR(a,b) l_error((a),(b))
00223 #define L_ERROR_STRING(a,b,c) l_errorString((a),(b),(c))
00224 #define L_ERROR_INT(a,b,c) l_errorInt((a),(b),(c))
00225 #define L_ERROR_FLOAT(a,b,c) l_errorFloat((a),(b),(c))
00226 #define L_WARNING(a,b) l_warning((a),(b))
00227 #define L_WARNING_STRING(a,b,c) l_warningString((a),(b),(c))
00228 #define L_WARNING_INT(a,b,c) l_warningInt((a),(b),(c))
00229 #define L_WARNING_FLOAT(a,b,c) l_warningFloat((a),(b),(c))
00230 #define L_INFO(a,b) l_info((a),(b))
00231 #define L_INFO_STRING(a,b,c) l_infoString((a),(b),(c))
00232 #define L_INFO_INT(a,b,c) l_infoInt((a),(b),(c))
00233 #define L_INFO_INT2(a,b,c,d) l_infoInt2((a),(b),(c),(d))
00234 #define L_INFO_FLOAT(a,b,c) l_infoFloat((a),(b),(c))
00235 #define L_INFO_FLOAT2(a,b,c,d) l_infoFloat2((a),(b),(c),(d))
00236
00237 #endif
00238
00239
00240
00241
00242
00243 #if defined(__MINGW32__) || defined(WIN32)
00244 #define snprintf _snprintf
00245 #endif
00246
00247
00248 #endif
00249