defs.h

00001 // ----------------------------------------------------------------------------
00002 // Making or using sword as a Windows DLL
00003 // ----------------------------------------------------------------------------
00004 #ifndef SWORDDEFS_H
00005 #define SWORDDEFS_H
00006 
00007 #ifdef NO_SWORD_NAMESPACE
00008  #define SWORD_NAMESPACE_START namespace sword {
00009  #define SWORD_NAMESPACE_END }; using namespace sword;
00010 #else
00011  #define SWORD_NAMESPACE_START namespace sword {
00012  #define SWORD_NAMESPACE_END }
00013 #endif
00014 
00015 
00016 SWORD_NAMESPACE_START
00017 
00018 #ifdef _WIN32_WCE
00019 #define SWTRY
00020 #define SWCATCH(x) if (0)
00021 #define GLOBCONFPATH "/Program Files/sword/sword.conf"
00022 #else
00023 #define SWTRY try
00024 #define SWCATCH(x) catch (x)
00025 #endif
00026 
00027 // _declspec works in BC++ 5 and later, as well as VC++
00028 #if defined(_MSC_VER)
00029 
00030 #  ifdef SWMAKINGDLL
00031 #    define SWDLLEXPORT _declspec( dllexport )
00032 #    define SWDLLEXPORT_DATA(type) _declspec( dllexport ) type
00033 #    define SWDLLEXPORT_CTORFN
00034 #  elif defined(SWUSINGDLL)
00035 #    define SWDLLEXPORT _declspec( dllimport )
00036 #    define SWDLLEXPORT_DATA(type) _declspec( dllimport ) type
00037 #    define SWDLLEXPORT_CTORFN
00038 #  else
00039 #    define SWDLLEXPORT
00040 #    define SWDLLEXPORT_DATA(type) type
00041 #    define SWDLLEXPORT_CTORFN
00042 #  endif
00043 
00044 #elif defined(__SWPM__)
00045 
00046 #  ifdef SWMAKINGDLL
00047 #    define SWDLLEXPORT _Export
00048 #    define SWDLLEXPORT_DATA(type) _Export type
00049 #    define SWDLLEXPORT_CTORFN
00050 #  elif defined(SWUSINGDLL)
00051 #    define SWDLLEXPORT _Export
00052 #    define SWDLLEXPORT_DATA(type) _Export type
00053 #    define SWDLLEXPORT_CTORFN
00054 #  else
00055 #    define SWDLLEXPORT
00056 #    define SWDLLEXPORT_DATA(type) type
00057 #    define SWDLLEXPORT_CTORFN
00058 #  endif
00059 
00060 #elif defined(__GNUWIN32__)
00061 
00062 #  ifdef SWMAKINGDLL
00063 #    define SWDLLEXPORT __declspec( dllexport )
00064 #    define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type
00065 #    define SWDLLEXPORT_CTORFN
00066 #  elif defined(SWUSINGDLL)
00067 #    define SWDLLEXPORT __declspec( dllimport )
00068 #    define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type
00069 #    define SWDLLEXPORT_CTORFN
00070 #  else
00071 #    define SWDLLEXPORT
00072 #    define SWDLLEXPORT_DATA(type) type
00073 #    define SWDLLEXPORT_CTORFN
00074 #  endif
00075 
00076 #elif defined(__BORLANDC__)
00077 #  ifdef SWMAKINGDLL
00078 #    define SWDLLEXPORT _export
00079 #    define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type
00080 #    define SWDLLEXPORT_CTORFN
00081 #  elif defined(SWUSINGDLL)
00082 #    define SWDLLEXPORT __declspec( dllimport )
00083 #    define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type
00084 #    define SWDLLEXPORT_CTORFN
00085 #  else
00086 #    define SWDLLEXPORT
00087 #    define SWDLLEXPORT_DATA(type) type
00088 #    define SWDLLEXPORT_CTORFN
00089 #  endif
00090 
00091 #else
00092 #  define SWDLLEXPORT
00093 #  define SWDLLEXPORT_DATA(type) type
00094 #  define SWDLLEXPORT_CTORFN
00095 #endif
00096 
00097 // For ostream, istream ofstream
00098 #if defined(__BORLANDC__) && defined( _RTLDLL )
00099 #  define SWDLLIMPORT __import
00100 #else
00101 #  define SWDLLIMPORT
00102 #endif
00103 
00104 enum {DIRECTION_LTR = 0, DIRECTION_RTL, DIRECTION_BIDI};
00105 enum {FMT_UNKNOWN = 0, FMT_PLAIN, FMT_THML, FMT_GBF, FMT_HTML, FMT_HTMLHREF, FMT_RTF, FMT_OSIS, FMT_WEBIF, FMT_TEI};
00106 enum {ENC_UNKNOWN = 0, ENC_LATIN1, ENC_UTF8, ENC_SCSU, ENC_UTF16, ENC_RTF, ENC_HTML};
00107 
00108 SWORD_NAMESPACE_END
00109 #endif //SWORDDEFS_H