From 3233d36c65606df0336f45ff6d832d842798d349 Mon Sep 17 00:00:00 2001 From: danglassey Date: Fri, 18 Oct 2002 13:01:37 +0000 Subject: sync with crosswire 20021018-1300 --- bindings/clx/Sword.pas | 40 +++++++++++++------------- bindings/flatapi.cpp | 10 ++++++- include/defs.h | 32 ++++++++++++--------- include/flatapi.h | 77 ++++++++++++++++++++++++-------------------------- 4 files changed, 86 insertions(+), 73 deletions(-) diff --git a/bindings/clx/Sword.pas b/bindings/clx/Sword.pas index 239f932..9fecc17 100644 --- a/bindings/clx/Sword.pas +++ b/bindings/clx/Sword.pas @@ -1,25 +1,27 @@ unit Sword; + interface - function SWMgr_getPrefixPath(h: integer): PChar; cdecl; external 'libsword.so'; - function SWMgr_new: integer; cdecl; external 'libsword.so'; - procedure SWMgr_delete(h: integer); cdecl; external 'libsword.so'; - function SWMgr_getModulesIterator(h: integer) : integer; cdecl; external 'libsword.so'; - function SWMgr_getModuleByName(h: integer; name: PChar) : integer; cdecl; external 'libsword.so'; - - procedure ModList_iterator_next(h: integer); cdecl; external 'libsword.so'; - function ModList_iterator_val(h: integer) : integer; cdecl; external 'libsword.so'; - - function SWModule_getType(h: integer) : PChar; cdecl; external 'libsword.so'; - function SWModule_getName(h: integer) : PChar; cdecl; external 'libsword.so'; - function SWModule_getDescription(h: integer) : PChar; cdecl; external 'libsword.so'; - function SWModule_getStripText(h: integer) : PChar; cdecl; external 'libsword.so'; - function SWModule_getRenderText(h: integer) : PChar; cdecl; external 'libsword.so'; - function SWModule_getKeyText(h: integer) : PChar; cdecl; external 'libsword.so'; - procedure SWModule_setKeyText(h: integer; key: PChar); cdecl; external 'libsword.so'; - procedure SWModule_begin(h: integer); cdecl; external 'libsword.so'; - procedure SWModule_next(h: integer); cdecl; external 'libsword.so'; - procedure SWModule_previous(h: integer); cdecl; external 'libsword.so'; + const LIBNAME = 'sword.dll'; + function SWMgr_getPrefixPath(h: integer): PChar; cdecl; external libname; + function SWMgr_new: integer; cdecl; external LIBNAME; + procedure SWMgr_delete(h: integer); cdecl; external LIBNAME; + function SWMgr_getModulesIterator(h: integer) : integer; cdecl; external LIBNAME; + function SWMgr_getModuleByName(h: integer; name: PChar) : integer; cdecl; external LIBNAME; + + procedure ModList_iterator_next(h: integer); cdecl; external LIBNAME; + function ModList_iterator_val(h: integer) : integer; cdecl; external LIBNAME; + + function SWModule_getType(h: integer) : PChar; cdecl; external LIBNAME; + function SWModule_getName(h: integer) : PChar; cdecl; external LIBNAME; + function SWModule_getDescription(h: integer) : PChar; cdecl; external LIBNAME; + function SWModule_getStripText(h: integer) : PChar; cdecl; external LIBNAME; + function SWModule_getRenderText(h: integer) : PChar; cdecl; external LIBNAME; + function SWModule_getKeyText(h: integer) : PChar; cdecl; external LIBNAME; + procedure SWModule_setKeyText(h: integer; key: PChar); cdecl; external LIBNAME; + procedure SWModule_begin(h: integer); cdecl; external LIBNAME; + procedure SWModule_next(h: integer); cdecl; external LIBNAME; + procedure SWModule_previous(h: integer); cdecl; external LIBNAME; type SWModule = class(TObject) diff --git a/bindings/flatapi.cpp b/bindings/flatapi.cpp index a2c2696..20069bb 100644 --- a/bindings/flatapi.cpp +++ b/bindings/flatapi.cpp @@ -17,8 +17,16 @@ #ifndef NO_SWORD_NAMESPACE using namespace sword; #endif - +extern "C" { #include "flatapi.h" +} + +typedef struct { + ModMap::iterator it; +// void *it; + ModMap::iterator end; +// void *end; +} ModItType; //----------------------------------------------------------------- diff --git a/include/defs.h b/include/defs.h index 2ceb73f..66fedc5 100644 --- a/include/defs.h +++ b/include/defs.h @@ -5,11 +5,11 @@ #define SWORDDEFS_H #ifdef NO_SWORD_NAMESPACE -#define SWORD_NAMESPACE_START -#define SWORD_NAMESPACE_END + #define SWORD_NAMESPACE_START + #define SWORD_NAMESPACE_END #else -#define SWORD_NAMESPACE_START namespace sword { -#define SWORD_NAMESPACE_END } + #define SWORD_NAMESPACE_START namespace sword { + #define SWORD_NAMESPACE_END } #endif @@ -17,8 +17,6 @@ SWORD_NAMESPACE_START #define FILTERPAD 16 -#if defined(__SWMSW__) - // _declspec works in BC++ 5 and later, as well as VC++ #if defined(_MSC_VER) @@ -52,7 +50,7 @@ SWORD_NAMESPACE_START # define SWDLLEXPORT_CTORFN # endif -#elif defined(__GNUWIN32__) || defined(__BORLANDC__) +#elif defined(__GNUWIN32__) # ifdef SWMAKINGDLL # define SWDLLEXPORT __declspec( dllexport ) @@ -68,6 +66,20 @@ SWORD_NAMESPACE_START # define SWDLLEXPORT_CTORFN # endif +#elif defined(__BORLANDC__) +# ifdef SWMAKINGDLL +# define SWDLLEXPORT _export +# define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type +# define SWDLLEXPORT_CTORFN +# elif defined(SWUSINGDLL) +# define SWDLLEXPORT __declspec( dllimport ) +# define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type +# define SWDLLEXPORT_CTORFN +# else +# define SWDLLEXPORT +# define SWDLLEXPORT_DATA(type) type +# define SWDLLEXPORT_CTORFN +# endif #else # define SWDLLEXPORT @@ -75,12 +87,6 @@ SWORD_NAMESPACE_START # define SWDLLEXPORT_CTORFN #endif -#else // !Windows -# define SWDLLEXPORT -# define SWDLLEXPORT_DATA(type) type -# define SWDLLEXPORT_CTORFN -#endif // Win/!Win - // For ostream, istream ofstream #if defined(__BORLANDC__) && defined( _RTLDLL ) # define SWDLLIMPORT __import diff --git a/include/flatapi.h b/include/flatapi.h index 029d851..c110c5b 100644 --- a/include/flatapi.h +++ b/include/flatapi.h @@ -1,11 +1,11 @@ #ifndef SWORDAPI_H #define SWORDAPI_H -#include -#include -#include -#include - +//#include +//#include +//#include +//#include +#include #ifdef __cplusplus #endif @@ -13,63 +13,60 @@ extern "C" { #define SWHANDLE int -typedef struct { - ModMap::iterator it; - ModMap::iterator end; -} ModItType; +//using namespace sword; //----------------------------------------------------------------- // stringlist_iterator methods -void stringlist_iterator_next(SWHANDLE hsli); -const char *stringlist_iterator_val(SWHANDLE hsli); +void SWDLLEXPORT stringlist_iterator_next(SWHANDLE hsli); +const char * SWDLLEXPORT stringlist_iterator_val(SWHANDLE hsli); //----------------------------------------------------------------- // modmap methods // -void ModList_iterator_next(SWHANDLE hmmi); -SWHANDLE ModList_iterator_val(SWHANDLE hmmi); +void SWDLLEXPORT ModList_iterator_next(SWHANDLE hmmi); +SWHANDLE SWDLLEXPORT ModList_iterator_val(SWHANDLE hmmi); //----------------------------------------------------------------- // SWMgr methods // -SWHANDLE SWMgr_new(); +SWHANDLE SWDLLEXPORT SWMgr_new(); // SWConfig *, SWConfig *, bool, SWFilterMgr * -SWHANDLE SWMgr_newEx(SWHANDLE hiconfig, SWHANDLE hisysconfig, char autoload, SWHANDLE hfilterMgr); -void SWMgr_delete(SWHANDLE hmgr); -SWHANDLE SWMgr_getConfig(SWHANDLE hmgr); -SWHANDLE SWMgr_getModulesIterator(SWHANDLE hmgr); -SWHANDLE SWMgr_getModuleByName(SWHANDLE hmgr, const char *name); -const char * SWMgr_getPrefixPath(SWHANDLE hmgr); -const char * SWMgr_getConfigPath(SWHANDLE hmgr); -void SWMgr_setGlobalOption(SWHANDLE hmgr, const char *option, const char *value); -const char * SWMgr_getGlobalOption(SWHANDLE hmgr, const char *option); -const char * SWMgr_getGlobalOptionTip(SWHANDLE hmgr, const char *option); +SWHANDLE SWDLLEXPORT SWMgr_newEx(SWHANDLE hiconfig, SWHANDLE hisysconfig, char autoload, SWHANDLE hfilterMgr); +void SWDLLEXPORT SWMgr_delete(SWHANDLE hmgr); +SWHANDLE SWDLLEXPORT SWMgr_getConfig(SWHANDLE hmgr); +SWHANDLE SWDLLEXPORT SWMgr_getModulesIterator(SWHANDLE hmgr); +SWHANDLE SWDLLEXPORT SWMgr_getModuleByName(SWHANDLE hmgr, const char *name); +const char * SWDLLEXPORT SWMgr_getPrefixPath(SWHANDLE hmgr); +const char * SWDLLEXPORT SWMgr_getConfigPath(SWHANDLE hmgr); +void SWDLLEXPORT SWMgr_setGlobalOption(SWHANDLE hmgr, const char *option, const char *value); +const char * SWDLLEXPORT SWMgr_getGlobalOption(SWHANDLE hmgr, const char *option); +const char * SWDLLEXPORT SWMgr_getGlobalOptionTip(SWHANDLE hmgr, const char *option); // ret: forward_iterator -SWHANDLE SWMgr_getGlobalOptionsIterator(SWHANDLE hmgr); +SWHANDLE SWDLLEXPORT SWMgr_getGlobalOptionsIterator(SWHANDLE hmgr); // ret: forward_iterator -SWHANDLE SWMgr_getGlobalOptionValuesIterator(SWHANDLE hmgr, const char *option); -void SWMgr_setCipherKey(SWHANDLE hmgr, const char *modName, const char *key); +SWHANDLE SWDLLEXPORT SWMgr_getGlobalOptionValuesIterator(SWHANDLE hmgr, const char *option); +void SWDLLEXPORT SWMgr_setCipherKey(SWHANDLE hmgr, const char *modName, const char *key); //----------------------------------------------------------------- // SWModule methods -void SWModule_terminateSearch(SWHANDLE hmodule); -char SWModule_error(SWHANDLE hmodule); -int SWModule_getEntrySize(SWHANDLE hmodule); -void SWModule_setKeyText(SWHANDLE hmodule, const char *key); -const char *SWModule_getKeyText(SWHANDLE hmodule); -const char *SWModule_getName(SWHANDLE hmodule); -const char *SWModule_getDescription(SWHANDLE hmodule); -const char *SWModule_getType(SWHANDLE hmodule); -void SWModule_previous(SWHANDLE hmodule); -void SWModule_next(SWHANDLE hmodule); -void SWModule_begin(SWHANDLE hmodule); -const char *SWModule_getStripText(SWHANDLE hmodule); -const char *SWModule_getRenderText(SWHANDLE hmodule); +void SWDLLEXPORT SWModule_terminateSearch(SWHANDLE hmodule); +char SWDLLEXPORT SWModule_error(SWHANDLE hmodule); +int SWDLLEXPORT SWModule_getEntrySize(SWHANDLE hmodule); +void SWDLLEXPORT SWModule_setKeyText(SWHANDLE hmodule, const char *key); +const char * SWDLLEXPORT SWModule_getKeyText(SWHANDLE hmodule); +const char * SWDLLEXPORT SWModule_getName(SWHANDLE hmodule); +const char * SWDLLEXPORT SWModule_getDescription(SWHANDLE hmodule); +const char * SWDLLEXPORT SWModule_getType(SWHANDLE hmodule); +void SWDLLEXPORT SWModule_previous(SWHANDLE hmodule); +void SWDLLEXPORT SWModule_next(SWHANDLE hmodule); +void SWDLLEXPORT SWModule_begin(SWHANDLE hmodule); +const char * SWDLLEXPORT SWModule_getStripText(SWHANDLE hmodule); +const char * SWDLLEXPORT SWModule_getRenderText(SWHANDLE hmodule); } #ifdef __cplusplus -- cgit