tesseract 3.04.01

ccutil/platform.h

Go to the documentation of this file.
00001 
00002 // File:        platform.h
00003 // Description: Place holder
00004 // Author:
00005 // Created:
00006 //
00007 // (C) Copyright 2006, Google Inc.
00008 // Licensed under the Apache License, Version 2.0 (the "License");
00009 // you may not use this file except in compliance with the License.
00010 // You may obtain a copy of the License at
00011 // http://www.apache.org/licenses/LICENSE-2.0
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 //
00019 
00020 #ifndef TESSERACT_CCUTIL_PLATFORM_H__
00021 #define TESSERACT_CCUTIL_PLATFORM_H__
00022 
00023 #include <string.h>
00024 
00025 #define DLLSYM
00026 #ifdef _WIN32
00027 #ifdef __GNUC__
00028 #define ultoa _ultoa
00029 #endif  /* __GNUC__ */
00030 #define SIGNED
00031 #if defined(_MSC_VER)
00032 #if (_MSC_VER < 1900)
00033 #define snprintf _snprintf
00034 #endif
00035 #if (_MSC_VER <= 1400)
00036 #define vsnprintf _vsnprintf
00037 #endif /* (_MSC_VER <= 1400) */
00038 #endif /* defined(_MSC_VER) */
00039 #else
00040 #define __UNIX__
00041 #include <limits.h>
00042 #ifndef PATH_MAX
00043 #define MAX_PATH 4096
00044 #else
00045 #define MAX_PATH PATH_MAX
00046 #endif
00047 #define SIGNED signed
00048 #endif
00049 
00050 #if defined(_WIN32) || defined(__CYGWIN__)
00051 #ifndef M_PI
00052 #define M_PI 3.14159265358979323846
00053 #endif
00054 #endif
00055 
00056 #if defined(_WIN32) || defined(__CYGWIN__)
00057     #if defined(TESS_EXPORTS)
00058        #define TESS_API __declspec(dllexport)
00059     #elif defined(TESS_IMPORTS)
00060        #define TESS_API __declspec(dllimport)
00061     #else
00062        #define TESS_API
00063     #endif
00064     #define TESS_LOCAL
00065 #else
00066     #if __GNUC__ >= 4
00067       #if defined(TESS_EXPORTS) || defined(TESS_IMPORTS)
00068           #define TESS_API  __attribute__ ((visibility ("default")))
00069           #define TESS_LOCAL  __attribute__ ((visibility ("hidden")))
00070       #else
00071           #define TESS_API
00072           #define TESS_LOCAL
00073       #endif
00074     #else
00075       #define TESS_API
00076       #define TESS_LOCAL
00077     #endif
00078 #endif
00079 
00080 #if defined(_WIN32) || defined(__CYGWIN__)
00081     #define _TESS_FILE_BASENAME_                                            \
00082       (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
00083 #else   // Unices
00084     #define _TESS_FILE_BASENAME_                                            \
00085       (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
00086 #endif
00087 
00088 #endif  // TESSERACT_CCUTIL_PLATFORM_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines