tesseract  4.00.00dev
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 #ifndef WIN32_LEAN_AND_MEAN
31 #define WIN32_LEAN_AND_MEAN
32 #endif
33 #ifdef __GNUC__
34 #define ultoa _ultoa
35 #endif /* __GNUC__ */
36 #define SIGNED
37 #if defined(_MSC_VER)
38 #if (_MSC_VER < 1900)
39 #define snprintf _snprintf
40 #endif
41 #if (_MSC_VER <= 1400)
42 #define vsnprintf _vsnprintf
43 #endif /* (_MSC_VER <= 1400) */
44 #endif /* defined(_MSC_VER) */
45 #else
46 #define __UNIX__
47 #include <limits.h>
48 #ifndef PATH_MAX
49 #define MAX_PATH 4096
50 #else
51 #define MAX_PATH PATH_MAX
52 #endif
53 #define SIGNED signed
54 #endif
55 
56 // Fix to map between google use of string without std and everywhere else.
57 #ifdef USE_STD_NAMESPACE
58 #include <string>
59 using std::string;
60 #endif
61 
62 #if defined(_WIN32) || defined(__CYGWIN__)
63 #ifndef M_PI
64 #define M_PI 3.14159265358979323846
65 #endif
66 #endif
67 
68 #if defined(_WIN32) || defined(__CYGWIN__)
69  #if defined(TESS_EXPORTS)
70  #define TESS_API __declspec(dllexport)
71  #elif defined(TESS_IMPORTS)
72  #define TESS_API __declspec(dllimport)
73  #else
74  #define TESS_API
75  #endif
76  #define TESS_LOCAL
77 #else
78  #if __GNUC__ >= 4
79  #if defined(TESS_EXPORTS) || defined(TESS_IMPORTS)
80  #define TESS_API __attribute__ ((visibility ("default")))
81  #define TESS_LOCAL __attribute__ ((visibility ("hidden")))
82  #else
83  #define TESS_API
84  #define TESS_LOCAL
85  #endif
86  #else
87  #define TESS_API
88  #define TESS_LOCAL
89  #endif
90 #endif
91 
92 #endif // TESSERACT_CCUTIL_PLATFORM_H_