tesseract  3.05.00
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
platform.h
Go to the documentation of this file.
1 // File: platform.h
3 // Description: Place holder
4 // Author:
5 // Created:
6 //
7 // (C) Copyright 2006, Google Inc.
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 //
19 
20 #ifndef TESSERACT_CCUTIL_PLATFORM_H__
21 #define TESSERACT_CCUTIL_PLATFORM_H__
22 
23 #include <string.h>
24 
25 #define DLLSYM
26 #ifdef _WIN32
27 #ifndef NOMINMAX
28 #define NOMINMAX
29 #endif /* NOMINMAX */
30 #define WIN32_LEAN_AND_MEAN
31 #ifdef __GNUC__
32 #define ultoa _ultoa
33 #endif /* __GNUC__ */
34 #define SIGNED
35 #if defined(_MSC_VER)
36 #if (_MSC_VER < 1900)
37 #define snprintf _snprintf
38 #endif
39 #if (_MSC_VER <= 1400)
40 #define vsnprintf _vsnprintf
41 #endif /* (_MSC_VER <= 1400) */
42 #endif /* defined(_MSC_VER) */
43 #else
44 #define __UNIX__
45 #include <limits.h>
46 #ifndef PATH_MAX
47 #define MAX_PATH 4096
48 #else
49 #define MAX_PATH PATH_MAX
50 #endif
51 #define SIGNED signed
52 #endif
53 
54 #if defined(_WIN32) || defined(__CYGWIN__)
55 #ifndef M_PI
56 #define M_PI 3.14159265358979323846
57 #endif
58 #endif
59 
60 #if defined(_WIN32) || defined(__CYGWIN__)
61  #if defined(TESS_EXPORTS)
62  #define TESS_API __declspec(dllexport)
63  #elif defined(TESS_IMPORTS)
64  #define TESS_API __declspec(dllimport)
65  #else
66  #define TESS_API
67  #endif
68  #define TESS_LOCAL
69 #else
70  #if __GNUC__ >= 4
71  #if defined(TESS_EXPORTS) || defined(TESS_IMPORTS)
72  #define TESS_API __attribute__ ((visibility ("default")))
73  #define TESS_LOCAL __attribute__ ((visibility ("hidden")))
74  #else
75  #define TESS_API
76  #define TESS_LOCAL
77  #endif
78  #else
79  #define TESS_API
80  #define TESS_LOCAL
81  #endif
82 #endif
83 
84 #if defined(_WIN32) || defined(__CYGWIN__)
85  #define _TESS_FILE_BASENAME_ \
86  (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
87 #else // Unices
88  #define _TESS_FILE_BASENAME_ \
89  (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
90 #endif
91 
92 #endif // TESSERACT_CCUTIL_PLATFORM_H__