00001 /////////////////////////////////////////////////////////////////////////////// 00002 // Name: wxldefs.h 00003 // Purpose: wxLua common defines 00004 // Author: John Labenski 00005 // Created: 5/28/2005 00006 // Copyright: (c) John Labenski 00007 // Licence: wxWidgets licence 00008 /////////////////////////////////////////////////////////////////////////////// 00009 00010 #ifndef __WX_WXLDEFS_H__ 00011 #define __WX_WXLDEFS_H__ 00012 00013 //----------------------------------------------------------------------------- 00014 // Include the Lua headers 00015 //----------------------------------------------------------------------------- 00016 00017 extern "C" 00018 { 00019 #include "lua.h" 00020 #include "lualib.h" 00021 #include "lauxlib.h" 00022 00023 // To not include "lua.h" use these 00024 //typedef struct lua_State lua_State; 00025 //typedef struct lua_Debug lua_Debug; 00026 //typedef int (*lua_CFunction)(lua_State *); 00027 } 00028 00029 #include "wx/defs.h" 00030 00031 //----------------------------------------------------------------------------- 00032 // The version of wxLua - for convenience we use the current version of 00033 // wxWidgets which wxLua is most compatible with. 00034 //----------------------------------------------------------------------------- 00035 00036 #define wxLUA_MAJOR_VERSION 2 00037 #define wxLUA_MINOR_VERSION 8 00038 #define wxLUA_RELEASE_NUMBER 10 00039 #define wxLUA_SUBRELEASE_NUMBER 0 00040 #define wxLUA_VERSION_STRING wxT("wxLua 2.8.10.0") 00041 00042 // For non-Unix systems (i.e. when building without a configure script), 00043 // users of this component can use the following macro to check if the 00044 // current version is at least major.minor.release 00045 #define wxLUA_CHECK_VERSION(major,minor,release) \ 00046 (wxLUA_MAJOR_VERSION > (major) || \ 00047 (wxLUA_MAJOR_VERSION == (major) && wxLUA_MINOR_VERSION > (minor)) || \ 00048 (wxLUA_MAJOR_VERSION == (major) && wxLUA_MINOR_VERSION == (minor) && wxLUA_RELEASE_NUMBER >= (release))) 00049 00050 // the same but check the subrelease also 00051 #define wxLUA_CHECK_VERSION_FULL(major,minor,release,subrel) \ 00052 (wxLUA_CHECK_VERSION(major, minor, release) && \ 00053 ((major) != wxLUA_MAJOR_VERSION || \ 00054 (minor) != wxLUA_MINOR_VERSION || \ 00055 (release) != wxLUA_RELEASE_NUMBER || \ 00056 (subrel) <= wxLUA_SUBRELEASE_NUMBER)) 00057 00058 //----------------------------------------------------------------------------- 00059 // This is an internal use binding generator version whos number is 00060 // incremented every time something changes that requires a regeneration 00061 // of the bindings. The check is written into the generated bindings to 00062 // give a compile time error. 00063 // If this number is incremented the variable by the same name must be updated 00064 // in genwxbind.lua must be updated as well. 00065 //----------------------------------------------------------------------------- 00066 00067 #define WXLUA_BINDING_VERSION 27 00068 00069 // ---------------------------------------------------------------------------- 00070 // If you're using stdcall in Lua, then override this with 00071 // "LUACALL = __stdcall" in your makefile or project. 00072 // ---------------------------------------------------------------------------- 00073 00074 #ifndef LUACALL 00075 #define LUACALL 00076 #endif 00077 00078 // ---------------------------------------------------------------------------- 00079 // WXDLLIMPEXP macros 00080 // ---------------------------------------------------------------------------- 00081 00082 // These are our DLL macros (see the contrib libs like wxPlot) 00083 #ifdef WXMAKINGDLL_WXLUA 00084 #define WXDLLIMPEXP_WXLUA WXEXPORT 00085 #define WXDLLIMPEXP_DATA_WXLUA(type) WXEXPORT type 00086 #elif defined(WXUSINGDLL) 00087 #define WXDLLIMPEXP_WXLUA WXIMPORT 00088 #define WXDLLIMPEXP_DATA_WXLUA(type) WXIMPORT type 00089 #else // not making nor using DLL 00090 #define WXDLLIMPEXP_WXLUA 00091 #define WXDLLIMPEXP_DATA_WXLUA(type) type 00092 #endif 00093 00094 // ---------------------------------------------------------------------------- 00095 // Useful macros to make coding easier 00096 // ---------------------------------------------------------------------------- 00097 00098 #if wxUSE_UNICODE 00099 #define wxLUA_UNICODE_ONLY(x) x 00100 #else /* !Unicode */ 00101 #define wxLUA_UNICODE_ONLY(x) 00102 #endif // wxUSE_UNICODE 00103 00104 00105 #define WXLUA_HASBIT(value, bit) (((value) & (bit)) != 0) 00106 #define WXLUA_SETBIT(value, bit, set) ((set) ? (value)|(bit) : (value)&(~(bit))) 00107 00108 // ---------------------------------------------------------------------------- 00109 // Lua defines for making the code more readable 00110 // ---------------------------------------------------------------------------- 00111 00112 // initializes a lua_debug by nulling everything before use since the 00113 // functions that take it do not initialize it properly 00114 #define INIT_LUA_DEBUG { 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}, 0 } 00115 00116 // Create a wxString from the lua_Debug struct for debugging 00117 #define lua_Debug_to_wxString(ld) \ 00118 wxString::Format(wxT("%p event=%d name='%s' namewhat='%s' what='%s' source='%s' currentline=%d nups=%d linedefined=%d lastlinedefined=%d short_src='%s' i_ci=%d"), \ 00119 &ld, ld.event, lua2wx(ld.name).c_str(), lua2wx(ld.namewhat).c_str(), lua2wx(ld.what).c_str(), lua2wx(ld.source).c_str(), ld.currentline, ld.nups, ld.linedefined, ld.lastlinedefined, lua2wx(ld.short_src).c_str(), ld.i_ci) 00120 00121 // ---------------------------------------------------------------------------- 00122 // Convert from wxWidgets wxT('') to wxT(""), a string. Copied from wx/filefn.h 00123 00124 // platform independent versions 00125 #if defined(__UNIX__) && !defined(__OS2__) 00126 // CYGWIN also uses UNIX settings 00127 #define wxLua_FILE_SEP_PATH wxT("/") 00128 #elif defined(__MAC__) 00129 #define wxLua_FILE_SEP_PATH wxT(":") 00130 #else // Windows and OS/2 00131 #define wxLua_FILE_SEP_PATH wxT("\\") 00132 #endif // Unix/Windows 00133 00134 // ---------------------------------------------------------------------------- 00135 // wxWidgets compatibility defines 00136 // ---------------------------------------------------------------------------- 00137 00138 #ifndef wxUSE_WAVE 00139 #define wxUSE_WAVE 0 00140 #endif 00141 #ifndef wxUSE_SOUND 00142 #define wxUSE_SOUND 0 00143 #endif 00144 00145 // ---------------------------------------------------------------------------- 00146 // Forward declared classes 00147 // ---------------------------------------------------------------------------- 00148 00149 class WXDLLIMPEXP_WXLUA wxLuaState; 00150 00151 00152 #endif // __WX_WXLDEFS_H__