From: John L. <jr...@us...> - 2005-06-18 20:46:11
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2914/wxLua/modules/wxlua/include Modified Files: internal.h interp.h library.h wxlua.h Log Message: Updated to wxIDE's wrapper files Index: interp.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/interp.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** interp.h 7 Jun 2005 04:17:39 -0000 1.2 --- interp.h 18 Jun 2005 20:45:59 -0000 1.3 *************** *** 30,36 **** class WXDLLEXPORT wxEvtHandler; ! class wxLuaEvent; ! class wxLuaStateVariables; ! class wxLuaInterpreter; #include "wx/hashmap.h" --- 30,36 ---- class WXDLLEXPORT wxEvtHandler; ! class WXDLLIMPEXP_WXLUA wxLuaEvent; ! class WXDLLIMPEXP_WXLUA wxLuaStateVariables; ! class WXDLLIMPEXP_WXLUA wxLuaInterpreter; #include "wx/hashmap.h" *************** *** 52,56 **** //----------------------------------------------------------------------------- ! class wxLuaInterpreter : public wxObject { public: --- 52,56 ---- //----------------------------------------------------------------------------- ! class WXDLLIMPEXP_WXLUA wxLuaInterpreter : public wxObject { public: *************** *** 70,74 **** // destroy and cleanup the interpreter, returns sucess // if 'force' then make sure all wxWindows are destroyed. ! bool Destroy(bool force = TRUE); // has the interpreter been sucessfully created --- 70,77 ---- // destroy and cleanup the interpreter, returns sucess // if 'force' then make sure all wxWindows are destroyed. ! bool Destroy(bool force = true); ! ! // cleanup window list ! void GarbageCollectWindows(bool closeWindows = false); // has the interpreter been sucessfully created *************** *** 77,85 **** // Set the event handler that the events will be sent to, can be null void SetEventHandler(wxEvtHandler *evtHandler); ! wxEvtHandler *GetEventHandler() const; // Get/Set the id that the events will be sent with ! void SetId(int id); ! int GetId() const; // Run a lua file --- 80,88 ---- // Set the event handler that the events will be sent to, can be null void SetEventHandler(wxEvtHandler *evtHandler); ! wxEvtHandler *GetEventHandler() const { return m_evtHandler; } // Get/Set the id that the events will be sent with ! void SetId(int id) { m_id = id; } ! int GetId() const { return m_id; } // Run a lua file *************** *** 91,100 **** // Is a program running now ! bool IsRunning() const; // Break a currently running lua program void Break(const wxString &message = wxT("Interpreter stopped")); // has Break() been called ! bool GetBreak() const; ! wxString GetBreakMessage() const; // Have lua run an internal hook function with this mask --- 94,103 ---- // Is a program running now ! bool IsRunning() const { return m_is_running; } // Break a currently running lua program void Break(const wxString &message = wxT("Interpreter stopped")); // has Break() been called ! bool GetBreak() const { return m_user_break; } ! wxString GetBreakMessage() const { return m_break_msg; } // Have lua run an internal hook function with this mask *************** *** 108,115 **** bool send_debug_evt = FALSE, int hook = LUA_MASKCOUNT); ! int GetLuaDebugHookCount() const; ! int GetLuaDebugHookYield() const; ! bool GetLuaDebugHookSendEvt() const; ! int GetLuaDebugHook() const; // registers a new function for Lua --- 111,118 ---- bool send_debug_evt = FALSE, int hook = LUA_MASKCOUNT); ! int GetLuaDebugHookCount() const { return m_lua_debug_hook_count; } ! int GetLuaDebugHookYield() const { return m_lua_debug_hook_yield; } ! bool GetLuaDebugHookSendEvt() const { return m_lua_debug_hook_send_evt; } ! int GetLuaDebugHook() const { return m_lua_debug_hook; } // registers a new function for Lua *************** *** 168,172 **** //----------------------------------------------------------------------------- ! class wxLuaEvent: public wxNotifyEvent { public: --- 171,175 ---- //----------------------------------------------------------------------------- ! class WXDLLIMPEXP_WXLUA wxLuaEvent: public wxNotifyEvent { public: *************** *** 204,223 **** BEGIN_DECLARE_EVENT_TYPES() ! DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUA_CREATION, 0) // a wxLuaInterpreter is being created ! DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUA_CONSOLE, 0) // print statements and such, check GetString() ! DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUA_WARNING, 0) // unused, lua doesn't seem to warn for anything ! DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUA_ERROR, 0) // error occurred, check GetString() ! DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUA_DEBUG_HOOK, 0) // see LuaDebugHook function ! DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUA_SHUTDOWN, 0) // unused, I used this in some other interpreter, not sure why it'd be useful END_DECLARE_EVENT_TYPES() typedef void (wxEvtHandler::*wxLuaEventFunction)(wxLuaEvent&); ! #define EVT_LUA_CREATION(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_CREATION, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_CONSOLE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_CONSOLE, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_WARNING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_WARNING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_ERROR(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_ERROR, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_DEBUG_HOOK(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_DEBUG_HOOK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_SHUTDOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_SHUTDOWN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), #endif // _WX_LUA_INTERPRETER_H_ --- 207,230 ---- BEGIN_DECLARE_EVENT_TYPES() ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_CREATION, 0) // a wxLuaInterpreter is being created ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_CONSOLE, 0) // print statements and such, check GetString() ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_WARNING, 0) // unused, lua doesn't seem to warn for anything ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_ERROR, 0) // error occurred, check GetString() ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_DEBUG_HOOK, 0) // see LuaDebugHook function ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_SHUTDOWN, 0) // unused, I used this in some other interpreter, not sure why it'd be useful ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_INIT, 0) // after app starts, first idle ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_DEBUGGERATTACHED, 0) // after app starts, first idle END_DECLARE_EVENT_TYPES() typedef void (wxEvtHandler::*wxLuaEventFunction)(wxLuaEvent&); ! #define EVT_LUA_CREATION(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_CREATION, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_CONSOLE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_CONSOLE, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_WARNING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_WARNING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_ERROR(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_ERROR, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_DEBUG_HOOK(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_DEBUG_HOOK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_SHUTDOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_SHUTDOWN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_INIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_INIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUA_DEBUGGERATTACHED(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUA_DEBUGGERATTACHED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), #endif // _WX_LUA_INTERPRETER_H_ Index: wxlua.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlua.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxlua.h 7 Jun 2005 04:17:39 -0000 1.2 --- wxlua.h 18 Jun 2005 20:45:59 -0000 1.3 *************** *** 25,31 **** #endif - // This is the function you need to call to initialize wxLua - void LUACALL RegisterWxLua(lua_State *L, bool registerTypes = true); - // Two cases where you might multiply call RegisterWxLua: // 1. You have several lua_State values. Then registerTypes --- 25,28 ---- Index: library.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/library.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** library.h 7 Jun 2005 04:17:39 -0000 1.2 --- library.h 18 Jun 2005 20:45:59 -0000 1.3 *************** *** 37,41 **** virtual bool ProcessEvent(wxEvent& event) = 0; ! virtual void SetStackFrame(wxLuaStackFrame *pStackFrame) = 0; virtual void DisplayError(const wxString &strError) const = 0; --- 37,43 ---- virtual bool ProcessEvent(wxEvent& event) = 0; ! //#if wxUSE_LUASTACKFRAME ! // virtual void SetStackFrame(wxLuaStackFrame *pStackFrame) = 0; ! //#endif // wxUSE_LUASTACKFRAME virtual void DisplayError(const wxString &strError) const = 0; Index: internal.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/internal.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** internal.h 7 Jun 2005 04:17:39 -0000 1.2 --- internal.h 18 Jun 2005 20:45:59 -0000 1.3 *************** *** 73,80 **** WXLUAMETHOD *methods; // pointer to methods for this class int num_methods; // number of methods ! int baseclassindex; // index in the class list to the base class wxClassInfo *pClassInfo; // pointer to the wxClassInfo associated with this class int *class_tag; // tag for user data allocated by ourselves // and therefore needs gc. }; --- 73,81 ---- WXLUAMETHOD *methods; // pointer to methods for this class int num_methods; // number of methods ! int baseclass_tag; // index in the class list to the base class wxClassInfo *pClassInfo; // pointer to the wxClassInfo associated with this class int *class_tag; // tag for user data allocated by ourselves // and therefore needs gc. + const char *baseclass; // name of base class }; *************** *** 82,86 **** --- 83,89 ---- { const char *name; // name + bool isString; // true if a string definition FIXME use WXLUASTRING double value; // numeric value + const wxChar *strValue; // string value }; *************** *** 106,115 **** }; ! // Functions defined in wxLuaWrap.cpp ! extern WXLUACLASS *GetClassList(size_t &count); ! extern WXLUADEFINE *GetDefineList(size_t &count); ! extern WXLUASTRING *GetStringList(size_t &count); ! extern WXLUAEVENT *GetEventList(size_t &count); ! extern WXLUAOBJECT *GetObjectList(size_t &count); // ---------------------------------------------------------------------------- --- 109,181 ---- }; ! typedef WXLUACLASS* (*GetClassListFunction)(size_t &); ! typedef WXLUADEFINE* (*GetDefineListFunction)(size_t &); ! //typedef WXLUASTRING* (*GetDefineListFunction)(size_t &); FIXME - use this ! typedef WXLUAEVENT* (*GetEventListFunction)(size_t &); ! typedef WXLUAOBJECT* (*GetObjectListFunction)(size_t &); ! ! class WXDLLIMPEXP_WXLUA wxLuaBinding : public wxObject ! { ! public: ! wxLuaBinding(); ! ! // lua namespace e.g. "wx" ! wxString nameSpace; ! ! // Pointers to external Binding Functions ! GetClassListFunction pfGetClassList; ! GetDefineListFunction pfGetDefineList; ! GetEventListFunction pfGetEventList; ! GetObjectListFunction pfGetObjectList; ! ! // Registers binding ! void RegisterBinding(lua_State *L, bool registerTypes); ! void UnRegisterBinding(lua_State *L); ! ! // ! size_t GetLuaClassCount() const { return m_classCount; } ! WXLUACLASS* GetLuaClassList() { return m_classList; } ! ! size_t GetLuaDefineCount() const { return m_defineCount; } ! WXLUADEFINE* GetLuaDefineList() { return m_defineList; } ! ! size_t GetLuaEventCount() { return m_eventCount; } ! WXLUAEVENT* GetLuaEventList() { return m_eventList; } ! ! size_t GetLuaObjectCount() { return m_objectCount; } ! WXLUAOBJECT* GetLuaObjectList() { return m_objectList; } ! ! bool IsTag(int tag) { return (tag >= m_startTag && tag <= m_lastTag); } ! ! // Look for base class WXDLLIMPEXP_CDLUA in binding, set baseclass_tag ! bool SetBaseClassTag(WXLUACLASS *pClass); ! ! protected: ! int LUACALL RegisterFunctions(lua_State *L, bool registerTypes); ! void LUACALL RegisterGeneratedClasses(lua_State *L, int tableOffset, bool registerTypes); ! ! virtual void OnRegister(lua_State * WXUNUSED(L), bool WXUNUSED(registerTypes), int WXUNUSED(luaTable)) {} ! ! // binding objects ! size_t m_classCount; ! WXLUACLASS* m_classList; ! size_t m_defineCount; ! WXLUADEFINE* m_defineList; ! size_t m_eventCount; ! WXLUAEVENT* m_eventList; ! size_t m_objectCount; ! WXLUAOBJECT* m_objectList; ! ! bool m_typesRegistered; // Is the binding registered ! int m_startTag; // The first wxLua allocated lua tag ! int m_lastTag; // The last wxLua lua tag of registered classes ! int m_wxLuaTable; // The lua tag for the wxLua private tables ! ! DECLARE_CLASS(wxLuaBinding) ! }; ! ! // list of wxLua Bindings ! // WX_DECLARE_LIST(wxLuaBinding, wxLuaBindingList); ! WX_DECLARE_USER_EXPORTED_LIST(wxLuaBinding, wxLuaBindingList, WXDLLIMPEXP_WXLUA); // ---------------------------------------------------------------------------- *************** *** 125,129 **** void ClearCallbacks(); ! bool m_typesRegistered; // wxWidgets classes are registed to lua int m_startTag; // The first wxLua allocated lua tag int m_lastTag; // The last wxLua lua tag of registered classes --- 191,209 ---- void ClearCallbacks(); ! void LUACALL RegisterBindings(lua_State *L, bool registerTypes); ! void LUACALL UnRegisterBindings(lua_State *L); ! ! wxLuaBinding* GetLuaBinding(const wxString& nameSpace); ! ! const WXLUACLASS * GetLuaClass(int iClassTag); ! const WXLUACLASS * GetLuaClass(const char* className); ! const WXLUACLASS * GetBaseLuaClass(int iClassTag); ! bool IsDerivedClass(int iClassTag, int iBaseClassTag); ! ! const WXLUAEVENT * GetLuaEvent(wxEvent *pEvent); ! ! wxLuaBindingList m_bindings; // A list of generated lua bindings ! ! bool m_typesRegistered; // Is the binding registered int m_startTag; // The first wxLua allocated lua tag int m_lastTag; // The last wxLua lua tag of registered classes *************** *** 165,169 **** // automatic destructor for making binding easier // ---------------------------------------------------------------------------- ! class SmartStringArray { public: --- 245,249 ---- // automatic destructor for making binding easier // ---------------------------------------------------------------------------- ! class WXDLLIMPEXP_WXLUA SmartStringArray { public: *************** *** 181,185 **** // automatic destructor for making binding easier // ---------------------------------------------------------------------------- ! class SmartIntArray { public: --- 261,265 ---- // automatic destructor for making binding easier // ---------------------------------------------------------------------------- ! class WXDLLIMPEXP_WXLUA SmartIntArray { public: *************** *** 242,245 **** --- 322,329 ---- // ---------------------------------------------------------------------------- + #ifdef GetObject + #undef GetObject + #endif + class WXDLLIMPEXP_WXLUA wxLuaObject : public wxObject { *************** *** 291,294 **** --- 375,384 ---- // ---------------------------------------------------------------------------- + // Lua Registry Table Functions + int LUACALL tinsert(lua_State *L, int iParam); + bool LUACALL tremove(lua_State *L, int iIndex); + bool LUACALL tget(lua_State *L, int iIndex); + int LUACALL tgetn (lua_State *L); + // get a user data type (either allocated by us if the tag is iTagS otherwise // system allocated iTagP. if the data type does not have the correct tag, *************** *** 323,328 **** int * LUACALL tointarray(lua_State *, int iParam, int &count); int LUACALL toarrayint(lua_State *L, int iParam, wxArrayInt &intArray); - // register all the generated classes - void LUACALL registerGeneratedClasses(lua_State *L, int tableOffset, bool registerTypes); // register non-generated functions and types --- 413,416 ---- *************** *** 346,352 **** // get the method or 'get' property for the class at cpIndex ! WXLUAMETHOD * LUACALL getLuaMethod(WXLUACLASS *pClass, const char *cpIndex, bool &isProperty); // get the property for the class at cpIndex ! WXLUAMETHOD * LUACALL getLuaProperty(WXLUACLASS *pClass, const char *cpIndex, bool isSet); // get the derived method for the class cpIndex --- 434,440 ---- // get the method or 'get' property for the class at cpIndex ! WXLUAMETHOD * LUACALL getLuaMethod(lua_State *L, const WXLUACLASS *pClass, const char *cpIndex, bool &isProperty); // get the property for the class at cpIndex ! WXLUAMETHOD * LUACALL getLuaProperty(lua_State *L, const WXLUACLASS *pClass, const char *cpIndex, bool isSet); // get the derived method for the class cpIndex *************** *** 400,408 **** static void DumpGlobals(lua_State *lua_state); static void DumpTable(lua_State *lua_state, const wxString &tableName); ! static void DumpTable(lua_State *lua_state, int stackIndex); private: ! static void DumpType(lua_State *lua_state, const wxString &name, int index, wxString &outputbuffer); ! static wxString GetTableInfo(lua_State *lua_state, int index); static wxString MakeNumber(double dnum); static wxString GetUserDataInfo(lua_State *lua_state, int index); --- 488,496 ---- static void DumpGlobals(lua_State *lua_state); static void DumpTable(lua_State *lua_state, const wxString &tableName); ! static void DumpTable(lua_State *lua_state, int index, const wxString& tablename, wxHashTable& dumpList, int indent); private: ! static void DumpType(lua_State *lua_state, int index, wxString& type, wxString& value, wxString& info); ! static int GetTableInfo(lua_State *lua_state, int index, wxString& address, wxString& info); static wxString MakeNumber(double dnum); static wxString GetUserDataInfo(lua_State *lua_state, int index); *************** *** 417,421 **** // ---------------------------------------------------------------------------- ! class wxLuaFunction { public: --- 505,509 ---- // ---------------------------------------------------------------------------- ! class WXDLLIMPEXP_WXLUA wxLuaFunction { public: *************** *** 450,454 **** // Convert a 8-bit Lua String into wxString ! inline wxString lua2wx(const char * luastr) { if (luastr == NULL) --- 538,542 ---- // Convert a 8-bit Lua String into wxString ! inline WXDLLIMPEXP_WXLUA wxString lua2wx(const char * luastr) { if (luastr == NULL) *************** *** 459,463 **** // Convert a wxString to 8-bit Lua String ! inline const wxCharBuffer wx2lua(const wxString& wxstr) { wxCharBuffer buffer(wxConvertWX2MB(wxstr.c_str())); --- 547,551 ---- // Convert a wxString to 8-bit Lua String ! inline const WXDLLIMPEXP_WXLUA wxCharBuffer wx2lua(const wxString& wxstr) { wxCharBuffer buffer(wxConvertWX2MB(wxstr.c_str())); *************** *** 466,470 **** // Convert a wxString to 8-bit Lua Buffer and store it ! class LuaCharBuffer { public: --- 554,558 ---- // Convert a wxString to 8-bit Lua Buffer and store it ! class WXDLLIMPEXP_WXLUA LuaCharBuffer { public: |