27 #ifndef LEPTONICA_ENVIRON_H 28 #define LEPTONICA_ENVIRON_H 53 typedef __int64 intptr_t;
54 typedef unsigned __int64 uintptr_t;
57 typedef unsigned int uintptr_t;
62 #define powf(x, y) (float)pow((double)(x), (double)(y)) 63 #define expf(x) (float)exp((double)(x)) 71 #if defined(LIBLEPT_EXPORTS) 72 #define LEPT_DLL __declspec(dllexport) 73 #elif defined(LIBLEPT_IMPORTS) 74 #define LEPT_DLL __declspec(dllimport) 83 typedef intptr_t l_intptr_t;
84 typedef uintptr_t l_uintptr_t;
99 #if !defined(HAVE_CONFIG_H) && !defined(ANDROID_BUILD) && !defined(OS_IOS) 101 #if !defined(HAVE_LIBJPEG) 102 #define HAVE_LIBJPEG 1 104 #if !defined(HAVE_LIBTIFF) 105 #define HAVE_LIBTIFF 1 107 #if !defined(HAVE_LIBPNG) 108 #define HAVE_LIBPNG 1 110 #if !defined(HAVE_LIBZ) 113 #if !defined(HAVE_LIBGIF) 114 #define HAVE_LIBGIF 0 116 #if !defined(HAVE_LIBUNGIF) 117 #define HAVE_LIBUNGIF 0 119 #if !defined(HAVE_LIBWEBP) 120 #define HAVE_LIBWEBP 0 122 #if !defined(HAVE_LIBJP2K) 123 #define HAVE_LIBJP2K 0 131 #define LIBJP2K_HEADER <openjpeg-2.3/openjpeg.h> 150 #define USE_JP2KHEADER 1 165 #if !defined(HAVE_CONFIG_H) && !defined(ANDROID_BUILD) && !defined(OS_IOS) && \ 167 #define HAVE_FMEMOPEN 1 175 #if !defined(HAVE_CONFIG_H) 176 #define HAVE_FSTATAT 0 193 typedef signed char l_int8;
194 typedef unsigned char l_uint8;
195 typedef short l_int16;
196 typedef unsigned short l_uint16;
198 typedef unsigned int l_uint32;
199 typedef float l_float32;
200 typedef double l_float64;
202 typedef __int64 l_int64;
203 typedef unsigned __int64 l_uint64;
205 typedef long long l_int64;
206 typedef unsigned long long l_uint64;
221 LEPT_DLL
extern l_int32 LeptDebugOK;
229 #define L_MIN(x,y) (((x) < (y)) ? (x) : (y)) 234 #define L_MAX(x,y) (((x) > (y)) ? (x) : (y)) 239 #define L_ABS(x) (((x) < 0) ? (-1 * (x)) : (x)) 244 #define L_SIGN(x) (((x) < 0) ? -1 : 1) 297 UNIX_PATH_SEPCHAR = 0,
305 typedef void *L_TIMER;
324 #define LEPT_MALLOC(blocksize) malloc(blocksize) 325 #define LEPT_CALLOC(numelem, elemsize) calloc(numelem, elemsize) 326 #define LEPT_REALLOC(ptr, blocksize) realloc(ptr, blocksize) 327 #define LEPT_FREE(ptr) free(ptr) 370 L_SEVERITY_EXTERNAL = 0,
372 L_SEVERITY_DEBUG = 2,
374 L_SEVERITY_WARNING = 4,
375 L_SEVERITY_ERROR = 5,
413 #undef MINIMUM_SEVERITY 414 #undef DEFAULT_SEVERITY 416 #define MINIMUM_SEVERITY L_SEVERITY_NONE 417 #define DEFAULT_SEVERITY L_SEVERITY_NONE 420 #ifndef MINIMUM_SEVERITY 421 #define MINIMUM_SEVERITY L_SEVERITY_INFO 424 #ifndef DEFAULT_SEVERITY 425 #define DEFAULT_SEVERITY MINIMUM_SEVERITY 487 #define PROCNAME(name) 488 #define ERROR_INT(a,b,c) ((l_int32)(c)) 489 #define ERROR_FLOAT(a,b,c) ((l_float32)(c)) 490 #define ERROR_PTR(a,b,c) ((void *)(c)) 491 #define L_ERROR(a,...) 492 #define L_WARNING(a,...) 493 #define L_INFO(a,...) 497 #define PROCNAME(name) static const char procName[] = name 498 #define IF_SEV(l,t,f) \ 499 ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f)) 501 #define ERROR_INT(a,b,c) \ 502 IF_SEV(L_SEVERITY_ERROR, returnErrorInt((a),(b),(c)), (l_int32)(c)) 503 #define ERROR_FLOAT(a,b,c) \ 504 IF_SEV(L_SEVERITY_ERROR, returnErrorFloat((a),(b),(c)), (l_float32)(c)) 505 #define ERROR_PTR(a,b,c) \ 506 IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a),(b),(c)), (void *)(c)) 508 #define L_ERROR(a,...) \ 509 IF_SEV(L_SEVERITY_ERROR, \ 510 (void)fprintf(stderr, "Error in %s: " a, __VA_ARGS__), \ 512 #define L_WARNING(a,...) \ 513 IF_SEV(L_SEVERITY_WARNING, \ 514 (void)fprintf(stderr, "Warning in %s: " a, __VA_ARGS__), \ 516 #define L_INFO(a,...) \ 517 IF_SEV(L_SEVERITY_INFO, \ 518 (void)fprintf(stderr, "Info in %s: " a, __VA_ARGS__), \ 522 #define L_ERROR(a,...) \ 523 { if (L_SEVERITY_ERROR >= MINIMUM_SEVERITY && \ 524 L_SEVERITY_ERROR >= LeptMsgSeverity) \ 525 fprintf(stderr, "Error in %s: " a, __VA_ARGS__) \ 527 #define L_WARNING(a,...) \ 528 { if (L_SEVERITY_WARNING >= MINIMUM_SEVERITY && \ 529 L_SEVERITY_WARNING >= LeptMsgSeverity) \ 530 fprintf(stderr, "Warning in %s: " a, __VA_ARGS__) \ 532 #define L_INFO(a,...) \ 533 { if (L_SEVERITY_INFO >= MINIMUM_SEVERITY && \ 534 L_SEVERITY_INFO >= LeptMsgSeverity) \ 535 fprintf(stderr, "Info in %s: " a, __VA_ARGS__) \ 545 #if defined _MSC_VER && _MSC_VER < 1900 546 #define snprintf(buf, size, ...) _snprintf_s(buf, size, _TRUNCATE, __VA_ARGS__) LEPT_DLL l_int32 LeptMsgSeverity