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) 100 #define HAVE_LIBJPEG 1 101 #define HAVE_LIBTIFF 1 102 #define HAVE_LIBPNG 1 104 #define HAVE_LIBGIF 0 105 #define HAVE_LIBUNGIF 0 106 #define HAVE_LIBWEBP 0 107 #define HAVE_LIBJP2K 0 112 #define LIBJP2K_HEADER <openjpeg-2.3/openjpeg.h> 125 #if !defined(HAVE_CONFIG_H) && !defined(ANDROID_BUILD) && !defined(OS_IOS) && \ 127 #define HAVE_FMEMOPEN 1 146 #define USE_JP2KHEADER 1 164 typedef signed char l_int8;
165 typedef unsigned char l_uint8;
166 typedef short l_int16;
167 typedef unsigned short l_uint16;
169 typedef unsigned int l_uint32;
170 typedef float l_float32;
171 typedef double l_float64;
173 typedef __int64 l_int64;
174 typedef unsigned __int64 l_uint64;
176 typedef long long l_int64;
177 typedef unsigned long long l_uint64;
186 #define L_MIN(x,y) (((x) < (y)) ? (x) : (y)) 191 #define L_MAX(x,y) (((x) > (y)) ? (x) : (y)) 196 #define L_ABS(x) (((x) < 0) ? (-1 * (x)) : (x)) 201 #define L_SIGN(x) (((x) < 0) ? -1 : 1) 256 UNIX_PATH_SEPCHAR = 0,
264 typedef void *L_TIMER;
283 #define LEPT_MALLOC(blocksize) malloc(blocksize) 284 #define LEPT_CALLOC(numelem, elemsize) calloc(numelem, elemsize) 285 #define LEPT_REALLOC(ptr, blocksize) realloc(ptr, blocksize) 286 #define LEPT_FREE(ptr) free(ptr) 329 L_SEVERITY_EXTERNAL = 0,
331 L_SEVERITY_DEBUG = 2,
333 L_SEVERITY_WARNING = 4,
334 L_SEVERITY_ERROR = 5,
372 #undef MINIMUM_SEVERITY 373 #undef DEFAULT_SEVERITY 375 #define MINIMUM_SEVERITY L_SEVERITY_NONE 376 #define DEFAULT_SEVERITY L_SEVERITY_NONE 379 #ifndef MINIMUM_SEVERITY 380 #define MINIMUM_SEVERITY L_SEVERITY_INFO 383 #ifndef DEFAULT_SEVERITY 384 #define DEFAULT_SEVERITY MINIMUM_SEVERITY 446 #define PROCNAME(name) 447 #define ERROR_INT(a,b,c) ((l_int32)(c)) 448 #define ERROR_FLOAT(a,b,c) ((l_float32)(c)) 449 #define ERROR_PTR(a,b,c) ((void *)(c)) 450 #define L_ERROR(a,...) 451 #define L_WARNING(a,...) 452 #define L_INFO(a,...) 456 #define PROCNAME(name) static const char procName[] = name 457 #define IF_SEV(l,t,f) \ 458 ((l) >= MINIMUM_SEVERITY && (l) >= LeptMsgSeverity ? (t) : (f)) 460 #define ERROR_INT(a,b,c) \ 461 IF_SEV(L_SEVERITY_ERROR, returnErrorInt((a),(b),(c)), (l_int32)(c)) 462 #define ERROR_FLOAT(a,b,c) \ 463 IF_SEV(L_SEVERITY_ERROR, returnErrorFloat((a),(b),(c)), (l_float32)(c)) 464 #define ERROR_PTR(a,b,c) \ 465 IF_SEV(L_SEVERITY_ERROR, returnErrorPtr((a),(b),(c)), (void *)(c)) 467 #define L_ERROR(a,...) \ 468 IF_SEV(L_SEVERITY_ERROR, \ 469 (void)fprintf(stderr, "Error in %s: " a, __VA_ARGS__), \ 471 #define L_WARNING(a,...) \ 472 IF_SEV(L_SEVERITY_WARNING, \ 473 (void)fprintf(stderr, "Warning in %s: " a, __VA_ARGS__), \ 475 #define L_INFO(a,...) \ 476 IF_SEV(L_SEVERITY_INFO, \ 477 (void)fprintf(stderr, "Info in %s: " a, __VA_ARGS__), \ 481 #define L_ERROR(a,...) \ 482 { if (L_SEVERITY_ERROR >= MINIMUM_SEVERITY && \ 483 L_SEVERITY_ERROR >= LeptMsgSeverity) \ 484 fprintf(stderr, "Error in %s: " a, __VA_ARGS__) \ 486 #define L_WARNING(a,...) \ 487 { if (L_SEVERITY_WARNING >= MINIMUM_SEVERITY && \ 488 L_SEVERITY_WARNING >= LeptMsgSeverity) \ 489 fprintf(stderr, "Warning in %s: " a, __VA_ARGS__) \ 491 #define L_INFO(a,...) \ 492 { if (L_SEVERITY_INFO >= MINIMUM_SEVERITY && \ 493 L_SEVERITY_INFO >= LeptMsgSeverity) \ 494 fprintf(stderr, "Info in %s: " a, __VA_ARGS__) \ 504 #if defined _MSC_VER && _MSC_VER < 1900 505 #define snprintf(buf, size, ...) _snprintf_s(buf, size, _TRUNCATE, __VA_ARGS__) LEPT_DLL l_int32 LeptMsgSeverity