00001 #ifndef __lua_cl2_h__ 00002 #define __lua_cl2_h__ 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 #include "lua.h" 00009 #include "lauxlib.h" 00010 00011 #include <glib.h> 00012 00013 void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize); // as in lauxlib.c 00014 00015 lua_State* cl_lua_new(); 00016 lua_State* cl_lua_new_libs(); 00017 00018 gboolean validate_lua_syntax(const gchar* value, GError** error); 00019 00020 int atpanic_txtlog_exit(lua_State* L); 00021 int atpanic_log_exit(lua_State* L); 00022 00023 #ifdef __EPOC32__ 00024 // A Lua error string gives the description for errors like these. 00025 #define KErrLuaErr (-10400) 00026 00027 int atpanic_leave(lua_State* L); 00028 int atpanic_txtlog_leave(lua_State* L); 00029 #endif 00030 00031 // Note that you can only catch these panics in C++ code. 00032 int atpanic_throw(lua_State* L); 00033 int atpanic_txtlog_throw(lua_State* L); 00034 00035 // Raises the specified 'error' as a Lua error. 00036 // Frees 'error' before a non-local return. 00037 // Returns whatever lua_error does. 00038 int lua_raise_gerror(lua_State* L, GError* error); 00039 00040 // Takes the error message at the top of the Lua stack, and returns 00041 // a newly created GError instance. 00042 GError* lua_get_gerror(lua_State* L); 00043 00044 // As with 'lua_get_gerror', but sets to 'error' instead of returning. 00045 void lua_set_gerror(lua_State* L, GError** error); 00046 00047 #ifdef __cplusplus 00048 } /* extern "C" */ 00049 #endif 00050 00051 #ifdef __cplusplus 00052 00053 /***koog 00054 ;; This does work on Symbian as well for long as __LEAVE_EQUALS_THROW__, 00055 ;; as then a leave causes throw-related stack unwinding and cleanup. 00056 00057 (require codegen/cxx) 00058 (def-auto-ptr "lua_State" 00059 (lambda (x) (printf "lua_close(~a);" x))) 00060 ***/ 00061 class lua_State_auto_ptr 00062 { 00063 public: 00064 lua_State_auto_ptr(lua_State* aPtr) : iPtr(aPtr) {} 00065 ~lua_State_auto_ptr() { lua_close(iPtr); } 00066 private: 00067 lua_State* iPtr; 00068 }; 00069 /***end***/ 00070 00071 // We might consider inheriting from std::exception, but that would 00072 // introduce a dependency we do not really require at this point. 00073 class LuaException 00074 { 00075 }; 00076 00077 #endif // __cplusplus 00078 00079 #endif /* __lua_cl2_h__ */ 00080 00081 /** 00082 00083 lua_cl2.h 00084 00085 Copyright 2009 Helsinki Institute for Information Technology (HIIT) 00086 and the authors. All rights reserved. 00087 00088 Authors: Tero Hasu <tero.hasu@hut.fi> 00089 00090 Permission is hereby granted, free of charge, to any person 00091 obtaining a copy of this software and associated documentation files 00092 (the "Software"), to deal in the Software without restriction, 00093 including without limitation the rights to use, copy, modify, merge, 00094 publish, distribute, sublicense, and/or sell copies of the Software, 00095 and to permit persons to whom the Software is furnished to do so, 00096 subject to the following conditions: 00097 00098 The above copyright notice and this permission notice shall be 00099 included in all copies or substantial portions of the Software. 00100 00101 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00102 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00103 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00104 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00105 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00106 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00107 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00108 SOFTWARE. 00109 00110 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:55 2011 by Doxygen 1.6.1