wxldefs.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////////////////////////
00002 // Name:        wxldefs.h
00003 // Purpose:     wxLua common defines
00004 // Author:      John Labenski
00005 // Created:     5/28/2005
00006 // Copyright:   (c) 2012 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 #include "wxlversion.h"
00032 
00033 //-----------------------------------------------------------------------------
00034 // 2.9 uses char* mostly so for compatibility we need wxT() to not append 'L'
00035 // for wide chars for 2.8, but rather do nothing for 2.9.
00036 // Mainly used for wxCmdLineEntryDesc.
00037 
00038 #if wxCHECK_VERSION(2, 9, 0)
00039     #define wxLuaT(x) (x)
00040 #else
00041     #define wxLuaT(x) wxT(x)
00042 #endif
00043 
00044 // ----------------------------------------------------------------------------
00045 // If you're using stdcall in Lua, then override this with
00046 //   "LUACALL = __stdcall" in your makefile or project.
00047 // ----------------------------------------------------------------------------
00048 
00049 #ifndef LUACALL
00050     #define LUACALL
00051 #endif
00052 
00053 // ----------------------------------------------------------------------------
00054 // WXDLLIMPEXP macros for DLL export, import, or neither for static libs.
00055 //   see wxWidgets include/wx/dlimpexp.h
00056 // ----------------------------------------------------------------------------
00057 
00058 #ifdef WXMAKINGDLL_WXLUA
00059     #define WXDLLIMPEXP_WXLUA WXEXPORT
00060     #define WXDLLIMPEXP_DATA_WXLUA(type) WXEXPORT type
00061 #elif defined(WXUSINGDLL)
00062     #define WXDLLIMPEXP_WXLUA WXIMPORT
00063     #define WXDLLIMPEXP_DATA_WXLUA(type) WXIMPORT type
00064 #else // not making nor using DLL
00065     #define WXDLLIMPEXP_WXLUA
00066     #define WXDLLIMPEXP_DATA_WXLUA(type) type
00067 #endif
00068 
00069 // Forward declare all wxLua classes with this macro
00070 #if defined(HAVE_VISIBILITY) || (defined(__WINDOWS__) && defined(__GNUC__))
00071     #define WXDLLIMPEXP_FWD_WXLUA
00072 #else
00073     #define WXDLLIMPEXP_FWD_WXLUA WXDLLIMPEXP_WXLUA
00074 #endif
00075 
00076 // ----------------------------------------------------------------------------
00077 // Blank dummy defines that may be used in the bindings to not import or export
00078 // a class or data in a DLL.
00079 // ----------------------------------------------------------------------------
00080 
00081 #define WXLUA_NO_DLLIMPEXP           // use if you don't want to export class
00082 #define WXLUA_NO_DLLIMPEXP_DATA(x) x // use if you don't want to export data
00083 
00084 // ----------------------------------------------------------------------------
00085 // Useful macros to make coding easier
00086 // ----------------------------------------------------------------------------
00087 
00088 #if wxUSE_UNICODE && !wxCHECK_VERSION(2,9,0)
00089     #define wxLUA_UNICODE_ONLY(x) x
00090 #else /* !Unicode */
00091     #define wxLUA_UNICODE_ONLY(x)
00092 #endif // wxUSE_UNICODE
00093 
00094 
00095 #define WXLUA_HASBIT(value, bit)      (((value) & (bit)) != 0)
00096 #define WXLUA_SETBIT(value, bit, set) ((set) ? (value)|(bit) : (value)&(~(bit)))
00097 
00098 // ----------------------------------------------------------------------------
00099 // Lua defines for making the code more readable
00100 // ----------------------------------------------------------------------------
00101 
00102 // initializes a lua_debug by nulling everything before use since the
00103 //  functions that take it do not initialize it properly
00104 #define INIT_LUA_DEBUG { 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}, 0 }
00105 
00106 // Create a wxString from the lua_Debug struct for debugging
00107 #define lua_Debug_to_wxString(ld) \
00108     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"), \
00109     &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)
00110 
00111 // ----------------------------------------------------------------------------
00112 // wxWidgets compatibility defines
00113 // ----------------------------------------------------------------------------
00114 
00115 #ifndef wxUSE_WAVE
00116     #define wxUSE_WAVE 0
00117 #endif
00118 #ifndef wxUSE_SOUND
00119     #define wxUSE_SOUND 0
00120 #endif
00121 
00122 // ----------------------------------------------------------------------------
00123 // Forward declared classes
00124 // ----------------------------------------------------------------------------
00125 
00126 class WXDLLIMPEXP_FWD_WXLUA wxLuaState;
00127 
00128 
00129 #endif  // __WX_WXLDEFS_H__

Generated on Sat Jul 28 17:23:47 2012 for wxLua by  doxygen 1.4.7