From 02a6779adc067e8bdd8ee0e6abd8404dd54850ac Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 14 Jun 2010 13:55:46 +0200 Subject: [PATCH] Fixed: variable_parser compilation --- .../leveldesign/variable_parser/StdAfx.h | 1 + .../variable_parser/lua_helper.cpp | 275 +++++++++--- .../leveldesign/variable_parser/lua_helper.h | 78 ++-- .../variable_parser/lua_helper_inline.h | 49 +-- .../variable_parser/variable_parser.vcproj | 391 ++++-------------- .../variable_parser/variable_parserDlg.cpp | 4 +- 6 files changed, 364 insertions(+), 434 deletions(-) diff --git a/code/ryzom/tools/leveldesign/variable_parser/StdAfx.h b/code/ryzom/tools/leveldesign/variable_parser/StdAfx.h index cc4bc437b..199c84879 100644 --- a/code/ryzom/tools/leveldesign/variable_parser/StdAfx.h +++ b/code/ryzom/tools/leveldesign/variable_parser/StdAfx.h @@ -27,6 +27,7 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define NOMINMAX #include // MFC core and standard components #include // MFC extensions diff --git a/code/ryzom/tools/leveldesign/variable_parser/lua_helper.cpp b/code/ryzom/tools/leveldesign/variable_parser/lua_helper.cpp index 984feec94..a24792c9b 100644 --- a/code/ryzom/tools/leveldesign/variable_parser/lua_helper.cpp +++ b/code/ryzom/tools/leveldesign/variable_parser/lua_helper.cpp @@ -23,20 +23,14 @@ extern "C" { -#ifdef max -# undef max -#endif #include "lualib.h" -} +} -#ifdef NL_OS_WINDOWS -# ifndef NL_EXTENDED_FOR_SCOPE -# undef for -# endif -#endif -#undef new +// to get rid of you_must_not_use_assert___use_nl_assert___read_debug_h_file messages +#include +#undef assert +#define assert nlassert #include -#define new NL_NEW using namespace std; using namespace NLMISC; @@ -57,30 +51,91 @@ void CLuaStackChecker::decrementExceptionContextCounter() nlassert(_ExceptionContextCounter > 0); -- _ExceptionContextCounter; } - + + +#ifdef LUA_NEVRAX_VERSION + ILuaIDEInterface *LuaDebuggerIDE = NULL; + static bool LuaDebuggerVisible = false; +#endif + +#ifdef NL_OS_WINDOWS + HMODULE LuaDebuggerModule = 0; +#endif + +void luaDebuggerMainLoop() +{ +#ifdef LUA_NEVRAX_VERSION + if (!LuaDebuggerIDE) return; + if (!LuaDebuggerVisible) + { + LuaDebuggerIDE->showDebugger(true); + LuaDebuggerIDE->expandProjectTree(); + LuaDebuggerIDE->sortFiles(); + LuaDebuggerVisible = true; + } + LuaDebuggerIDE->doMainLoop(); +#endif +} + + + +static std::allocator l_stlAlloc; + + +static void l_free_func(void *block, int oldSize) +{ + l_stlAlloc.deallocate((uint8 *) block, oldSize); +} + +static void *l_realloc_func(void *b, int os, int s) +{ + if (os == s) return b; + void *newB = l_stlAlloc.allocate(s); + memcpy(newB, b, std::min(os, s)); + l_free_func(b, os); + return newB; +} + + + +const int MinGCThreshold = 128; // min value at which garbage collector will be triggered (in kilobytes) // *************************************************************************** CLuaState::CLuaState() -{ +{ + _State = NULL; + #ifdef LUA_NEVRAX_VERSION - _State = lua_open(NULL, NULL); - #else - _State = lua_open(); + _GCThreshold = MinGCThreshold; #endif - nlassert(_State); + + if (!_State) + { + #ifdef LUA_NEVRAX_VERSION + _State = lua_open(l_realloc_func, l_free_func); + #else + _State = lua_open(); + #endif + nlassert(_State); + } // *** Load base libs { CLuaStackChecker lsc(this); +#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 + luaL_openlibs(_State); +#else luaopen_base (_State); luaopen_table (_State); luaopen_io (_State); luaopen_string (_State); luaopen_math (_State); luaopen_debug (_State); +#endif + // open are buggy???? clear(); } - + // *** Register basics CLuaStackChecker lsc(this); @@ -88,15 +143,15 @@ CLuaState::CLuaState() pushLightUserData((void *) this); newTable(); push("classes"); - newTable(); // registry class + newTable(); // registry class setTable(-3); setTable(LUA_REGISTRYINDEX); // add pointer from lua state to this CLuaState object // do: LUA_REGISTRYINDEX.(lightuserdata*)_State= this pushLightUserData((void *) _State); // NB : as creator of the state, we make the assumption that - // no one will be using this pointer in the registry (cf. ref manual about registry) - pushLightUserData((void *) this); + // no one will be using this pointer in the registry (cf. ref manual about registry) + pushLightUserData((void *) this); setTable(LUA_REGISTRYINDEX); // Create the Table that contains Function cache for small script execution @@ -111,7 +166,7 @@ CLuaState::CLuaState() // *************************************************************************** -CLuaStackRestorer::CLuaStackRestorer(CLuaState *state, int finalSize) : _State(state), _FinalSize(finalSize) +CLuaStackRestorer::CLuaStackRestorer(CLuaState *state, int finalSize) : _State(state), _FinalSize(finalSize) { } @@ -122,11 +177,43 @@ CLuaStackRestorer::~CLuaStackRestorer() _State->setTop(_FinalSize); } +#ifdef NL_OS_WINDOWS + static int NoOpReportHook( int /* reportType */, char * /* message */, int * /* returnValue */ ) + { + return TRUE; + } +#endif + + // *************************************************************************** CLuaState::~CLuaState() { - nlassert(_State); - lua_close(_State); + nlassert(_State); + + #ifdef LUA_NEVRAX_VERSION + if (!LuaDebuggerIDE) + #else + if (1) + #endif + { + lua_close(_State); + } + else + { + #ifdef LUA_NEVRAX_VERSION + LuaDebuggerIDE->stopDebug(); // this will also close the lua state + LuaDebuggerIDE = NULL; + LuaDebuggerVisible = false; + #ifdef NL_OS_WINDOWS + nlassert(LuaDebuggerModule) + _CrtSetReportHook(NoOpReportHook); // prevent dump of memory leaks at this point + //::FreeLibrary(LuaDebuggerModule); // don't free the library now (seems that it destroy, the main window, causing + // a crash when the app window is destroyed for real... + // -> FreeLibrary will be called when the application is closed + LuaDebuggerModule = 0; + #endif + #endif + } // Clear Small Script Cache _SmallScriptPool= 0; @@ -135,7 +222,7 @@ CLuaState::~CLuaState() // *************************************************************************** CLuaState *CLuaState::fromStatePointer(lua_State *state) -{ +{ nlassert(state); int initialStackSize = lua_gettop(state); lua_checkstack(state, initialStackSize + 2); @@ -161,9 +248,10 @@ struct CLuaReader void CLuaState::loadScript(const std::string &code, const std::string &dbgSrc) { + if (code.empty()) return; struct CHelper { - static const char *luaChunkReaderFromString(lua_State *L, void *ud, size_t *sz) + static const char *luaChunkReaderFromString(lua_State * /* L */, void *ud, size_t *sz) { CLuaReader *rd = (CLuaReader *) ud; if (!rd->Done) @@ -182,6 +270,7 @@ void CLuaState::loadScript(const std::string &code, const std::string &dbgSrc) CLuaReader rd; rd.Str = &code; rd.Done = false; + int result = lua_load(_State, CHelper::luaChunkReaderFromString, (void *) &rd, dbgSrc.c_str()); if (result !=0) { @@ -190,17 +279,17 @@ void CLuaState::loadScript(const std::string &code, const std::string &dbgSrc) pop(); // throw error throw ELuaParseError(err); - } + } } // *************************************************************************** void CLuaState::executeScriptInternal(const std::string &code, const std::string &dbgSrc, int numRet) { - CLuaStackChecker lsc(this, numRet); - + CLuaStackChecker lsc(this, numRet); + // load the script loadScript(code, dbgSrc); - + // execute if (pcall(0, numRet) != 0) { @@ -240,7 +329,16 @@ bool CLuaState::executeFile(const std::string &pathName) CIFile inputFile; if(!inputFile.open(pathName)) return false; - + + #ifdef LUA_NEVRAX_VERSION + if (LuaDebuggerIDE) + { + std::string path = NLMISC::CPath::getCurrentPath() + "/" + pathName.c_str(); + path = CPath::standardizeDosPath(path); + LuaDebuggerIDE->addFile(path.c_str()); + } + #endif + // load the script text string script; /* @@ -253,9 +351,9 @@ bool CLuaState::executeFile(const std::string &pathName) } */ script.resize(NLMISC::CFile::getFileSize(pathName)); - inputFile.serialBuffer((uint8 *) &script[0], script.size()); + inputFile.serialBuffer((uint8 *) &script[0], (uint)script.size()); + - // execute the script text, with dbgSrc==filename (use @ for lua internal purpose) executeScriptInternal(script, string("@") + NLMISC::CFile::getFilename(pathName)); @@ -265,15 +363,16 @@ bool CLuaState::executeFile(const std::string &pathName) // *************************************************************************** void CLuaState::executeSmallScript(const std::string &script) { + if (script.empty()) return; // *** if the small script has not already been called before, parse it now TSmallScriptCache::iterator it= _SmallScriptCache.find(script); if(it==_SmallScriptCache.end()) { - CLuaStackChecker lsc(this); + CLuaStackChecker lsc(this); // add it to a function loadScript(script, script); - + // Assign the method to the NEL table: NELSmallScriptTable[_SmallScriptPool]= function push(_NELSmallScriptTableName); // 1:function 2:NelTableName getTable(LUA_REGISTRYINDEX); // 1:function 2:NelTable @@ -289,7 +388,7 @@ void CLuaState::executeSmallScript(const std::string &script) } // *** Execute the function associated to the script - CLuaStackChecker lsc(this); + CLuaStackChecker lsc(this); push(_NELSmallScriptTableName); // 1:NelTableName getTable(LUA_REGISTRYINDEX); // 1:NelTable // get the function at the given index in the "NELSmallScriptTable" table @@ -311,12 +410,11 @@ void CLuaState::executeSmallScript(const std::string &script) // Stack: 1:NelTable pop(); // .... } - } // *************************************************************************** void CLuaState::registerFunc(const char *name, lua_CFunction function) -{ +{ lua_register(_State, name, function); } @@ -355,7 +453,7 @@ void CLuaState::push(TLuaWrappedFunction function) lua_pushstring(ls, e.what()); // TODO : see if this is safe to call lua error there" ... (it does a long jump) lua_error(ls); - } + } return numResults; } }; @@ -446,16 +544,16 @@ int CLuaState::pcallByName(const char *functionName, int nargs, int nresults nlassert(functionName); nlassert(isTable(funcTableIndex)); pushValue(funcTableIndex); - push(functionName); + push(functionName); getTable(-2); remove(-2); // get rid of the table nlassert(getTop() >= nargs); // not enough arguments on the stack // insert function before its arguments - insert(- 1 - nargs); - int result = pcall(nargs, nresults, errfunc); + insert(- 1 - nargs); + int result = pcall(nargs, nresults, errfunc); int currSize = getTop(); if (result == 0) - { + { nlassert(currSize == initialStackSize - nargs + nresults); } else @@ -488,7 +586,7 @@ void CLuaState::dumpStack() // *************************************************************************** void CLuaState::getStackAsString(std::string &dest) { - dest = NLMISC::toString("Stack size = %d\n", getTop()); + dest = NLMISC::toString("Stack size = %d\n", getTop()); CLuaStackChecker lsc(this); for(int k = 1; k <= getTop(); ++k) { @@ -512,10 +610,10 @@ CLuaStackChecker::~CLuaStackChecker() if (assertWanted) { nlwarning("Lua stack size error : expected size is %d, current size is %d", _FinalWantedSize, currSize); - _State->dumpStack(); + _State->dumpStack(); nlassert(0); } - } + } } else { @@ -527,37 +625,102 @@ CLuaStackChecker::~CLuaStackChecker() // *************************************************************************** void ELuaWrappedFunctionException::init(CLuaState *ls, const std::string &reason) -{ -/* // Print first Lua Stack Context - CInterfaceManager *pIM= CInterfaceManager::getInstance(); +{ + // Print first Lua Stack Context +/* + CInterfaceManager *pIM= CInterfaceManager::getInstance(); if(ls) { ls->getStackContext(_Reason, 1); // 1 because 0 is the current C function => return 1 for script called // enclose with cool colors pIM->formatLuaStackContext(_Reason); } - +*/ // Append the reason - _Reason+= reason;*/ + _Reason+= reason; } // *************************************************************************** ELuaWrappedFunctionException::ELuaWrappedFunctionException(CLuaState *luaState) -{ - init(luaState, ""); +{ + init(luaState, ""); } // *************************************************************************** ELuaWrappedFunctionException::ELuaWrappedFunctionException(CLuaState *luaState, const std::string &reason) -{ +{ init(luaState, reason); } // *************************************************************************** ELuaWrappedFunctionException::ELuaWrappedFunctionException(CLuaState *luaState, const char *format, ...) -{ +{ + //H_AUTO(Lua_ELuaWrappedFunctionException_ELuaWrappedFunctionException) std::string reason; - NLMISC_CONVERT_VARGS (reason, format, NLMISC::MaxCStringSize); + NLMISC_CONVERT_VARGS (reason, format, NLMISC::MaxCStringSize); init(luaState, reason); } +//================================================================================ +void CLuaState::newTable() +{ + nlverify( lua_checkstack(_State, 1) ); + lua_newtable(_State); +} + +//================================================================================ +int CLuaState::getGCCount() +{ + return lua_getgccount(_State); +} + +//================================================================================ +int CLuaState::getGCThreshold() +{ + //H_AUTO(Lua_CLuaState_getGCThreshold) +#ifdef LUA_NEVRAX_VERSION + return _GCThreshold; +#else +# if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 + return lua_gc(_State, LUA_GCCOUNT, 0); +# else + return lua_getgcthreshold(_State); +# endif +#endif +} + +//================================================================================ +void CLuaState::setGCThreshold(int kb) +{ + //H_AUTO(Lua_CLuaState_setGCThreshold) +#ifdef LUA_NEVRAX_VERSION + _GCThreshold = kb; + handleGC(); +#else +# if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 + lua_gc(_State, LUA_GCCOLLECT, kb); +# else + lua_setgcthreshold(_State, kb); +# endif +#endif +} + +//================================================================================ +void CLuaState::handleGC() +{ + //H_AUTO(Lua_CLuaState_handleGC) + #ifdef LUA_NEVRAX_VERSION + // must handle gc manually with the refcounted version + int gcCount = getGCCount(); + if (gcCount >= _GCThreshold) + { + nlwarning("Triggering GC : memory in use = %d kb, current threshold = %d kb", gcCount, _GCThreshold); + lua_setgcthreshold(_State, 0); + gcCount = getGCCount(); + _GCThreshold = std::max(MinGCThreshold, gcCount * 2); + nlwarning("After GC : memory in use = %d kb, threshold = %d kb", gcCount, _GCThreshold); + } + #endif +} + + diff --git a/code/ryzom/tools/leveldesign/variable_parser/lua_helper.h b/code/ryzom/tools/leveldesign/variable_parser/lua_helper.h index 3a1a2e884..4a7cb0095 100644 --- a/code/ryzom/tools/leveldesign/variable_parser/lua_helper.h +++ b/code/ryzom/tools/leveldesign/variable_parser/lua_helper.h @@ -21,7 +21,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/smart_ptr.h" -extern "C" +extern "C" { #include } @@ -53,17 +53,17 @@ private: }; -//************************************************************************** +// ************************************************************************** /** Helper class to restore the lua stack to the desired size when this object goes out of scope - */ + */ class CLuaStackRestorer { -public: +public: CLuaStackRestorer(CLuaState *state, int finalSize); - ~CLuaStackRestorer(); + ~CLuaStackRestorer(); private: int _FinalSize; - CLuaState *_State; + CLuaState *_State; }; //////////////// @@ -74,7 +74,7 @@ class ELuaError : public NLMISC::Exception { public: ELuaError() { CLuaStackChecker::incrementExceptionContextCounter(); } - virtual ~ELuaError() { CLuaStackChecker::decrementExceptionContextCounter(); } + virtual ~ELuaError() throw() { CLuaStackChecker::decrementExceptionContextCounter(); } ELuaError(const std::string &reason) : Exception(reason) { CLuaStackChecker::incrementExceptionContextCounter(); } // what(), plus append the Reason virtual std::string luaWhat() const throw() {return NLMISC::toString("LUAError: %s", what());} @@ -86,21 +86,23 @@ class ELuaParseError : public ELuaError public: ELuaParseError() {} ELuaParseError(const std::string &reason) : ELuaError(reason) {} + virtual ~ELuaParseError() throw() { } // what(), plus append the Reason virtual std::string luaWhat() const throw() {return NLMISC::toString("ELuaParseError: %s", what());} }; -/** Exception thrown when something when wrong inside a wrapped function called by lua +/** Exception thrown when something went wrong inside a wrapped function called by lua */ class ELuaWrappedFunctionException : public ELuaError { public: - ELuaWrappedFunctionException(CLuaState *luaState); - ELuaWrappedFunctionException(CLuaState *luaState, const std::string &reason); - ELuaWrappedFunctionException(CLuaState *luaState, const char *format, ...); - virtual const char *what() const {return _Reason.c_str();} + ELuaWrappedFunctionException(CLuaState *luaState); + ELuaWrappedFunctionException(CLuaState *luaState, const std::string &reason); + ELuaWrappedFunctionException(CLuaState *luaState, const char *format, ...); + virtual ~ELuaWrappedFunctionException() throw() { } + virtual const char *what() const throw() {return _Reason.c_str();} protected: - void init(CLuaState *ls, const std::string &reason); + void init(CLuaState *ls, const std::string &reason); protected: std::string _Reason; }; @@ -111,6 +113,7 @@ class ELuaExecuteError : public ELuaError public: ELuaExecuteError() {} ELuaExecuteError(const std::string &reason) : ELuaError(reason) {} + virtual ~ELuaExecuteError() throw() { } // what(), plus append the Reason virtual std::string luaWhat() const throw() {return NLMISC::toString("ELuaExecuteError: %s", what());} }; @@ -142,11 +145,13 @@ typedef int (* TLuaWrappedFunction) (CLuaState &ls); // *************************************************************************** -/** C++ version of a lua state +/** C++ version of a lua state */ class CLuaState : public NLMISC::CRefCount { public: + typedef NLMISC::CRefPtr TRefPtr; + // Create a new environement CLuaState(); ~CLuaState(); @@ -157,7 +162,7 @@ public: // register a wrapped function void registerFunc(const char *name, TLuaWrappedFunction function); // @} - + /// \name Script execution // @{ @@ -179,7 +184,6 @@ public: bool executeScriptNoThrow(const std::string &code, int numRet = 0); /** Load a Script from a File (maybe in a BNP), and execute it - * The script is executed, so it may contains only function/variable declaration * \return false if file not found * \throw ELuaParseError, ELuaExecuteError */ @@ -241,7 +245,7 @@ public: const void *toPointer(int index = -1); /** Helper functions : get value of the wanted type in the top table after conversion * A default value is used if the stack entry is NULL. - * If conversion fails then an exception is thrown (with optionnal msg) + * If conversion fails then an exception is thrown (with optional msg) */ bool getTableBooleanValue(const char *name, bool defaultValue= false); double getTableNumberValue(const char *name, double defaultValue= 0); @@ -258,7 +262,8 @@ public: void pushLightUserData(void *); // push a light user data (use newUserData to push a full userdata) // metatables bool getMetaTable(int index = -1); - bool setMetaTable(int index = -1); + bool setMetaTable(int index = -1); // set the metatable at top of stack to the object at 'index' (usually -2), then pop the metatable + // even if asignment failed // comparison bool equal(int index1, int index2); bool rawEqual(int index1, int index2); @@ -284,15 +289,15 @@ public: void call(int nargs, int nresults); int pcall(int nargs, int nresults, int errfunc = 0); /** Helper : Execute a function by name. Lookup for the function is done in the table at the index 'funcTableIndex' - * the behaviour is the same than with call of pcall. + * the behaviour is the same than with call of pcall. */ int pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex = LUA_GLOBALSINDEX, int errfunc = 0); - + // push a C closure (pop n element from the stack and associate with the function) void pushCClosure(lua_CFunction function, int n); // @} - + /// \name Misc // @{ /** Retrieve pointer to a CLuaState environment from its lua_State pointer, or NULL @@ -305,16 +310,19 @@ public: // an assertion is raised if the index is not valid void checkIndex(int index); - // registering C function to use with a lua state pointer + // registering C function to use with a lua state pointer void registerFunc(const char *name, lua_CFunction function); - + // Garbage collector int getGCCount(); // get memory in use in KB int getGCThreshold(); // get max memory in KB - void setGCThreshold(int kb); // set max memory in KB - + void setGCThreshold(int kb); // set max memory in KB (no-op with ref-counted version) + + // handle garbage collector for ref-counted version of lua (no-op with standard version, in which case gc handling is automatic) + void handleGC(); + /** For Debug: get the Stack context of execution (filename / line) - * \param stackLevel: get the context of execution of the given stackLevel. + * \param stackLevel: get the context of execution of the given stackLevel. * 0 for the current function * 1 for the function that called 0 * 2 .... @@ -327,8 +335,9 @@ public: // for debug : dump the current content of the stack (no recursion) void dumpStack(); + static void dumpStack(lua_State *ls); void getStackAsString(std::string &dest); - + private: lua_State *_State; @@ -341,13 +350,20 @@ private: private: // this object isn't intended to be copied - CLuaState(const CLuaState &other) { nlassert(0); } - CLuaState &operator=(const CLuaState &other) { nlassert(0); return *this; } + CLuaState(const CLuaState &/* other */):NLMISC::CRefCount() { nlassert(0); } + CLuaState &operator=(const CLuaState &/* other */) { nlassert(0); return *this; } void executeScriptInternal(const std::string &code, const std::string &dbgSrc, int numRet = 0); - + }; - + + +// Access to lua function +// one should not include lua.h directly because if a debugger is present, lua +// function pointer will be taken from a dynamic library. + + + //============================================================================================= // include implementation #define RZ_INCLUDE_LUA_HELPER_INLINE diff --git a/code/ryzom/tools/leveldesign/variable_parser/lua_helper_inline.h b/code/ryzom/tools/leveldesign/variable_parser/lua_helper_inline.h index 9d49caf6c..e3011bd74 100644 --- a/code/ryzom/tools/leveldesign/variable_parser/lua_helper_inline.h +++ b/code/ryzom/tools/leveldesign/variable_parser/lua_helper_inline.h @@ -41,7 +41,7 @@ inline void CLuaState::checkIndex(int index) { // NB : more restrictive test that in the documentation there, because // we don't expose the check stack function - nlassert( (index!=0 && abs(index) <= getTop()) + nlassert( (index!=0 && abs(index) <= getTop()) || index == LUA_REGISTRYINDEX || index == LUA_GLOBALSINDEX ); @@ -248,7 +248,7 @@ inline const void *CLuaState::toPointer(int index) inline void CLuaState::push(bool value) { nlverify( lua_checkstack(_State, 1) ); - lua_pushboolean(_State, (int) value); + lua_pushboolean(_State, (int) value); } //================================================================================ @@ -347,50 +347,25 @@ inline void CLuaState::concat(int numElem) lua_concat(_State, numElem); } -//================================================================================ -inline int CLuaState::getGCCount() -{ - return lua_getgccount(_State); -} - -//================================================================================ -inline int CLuaState::getGCThreshold() -{ - return lua_getgcthreshold(_State); -} - -//================================================================================ -inline void CLuaState::setGCThreshold(int kb) -{ - lua_setgcthreshold(_State, kb); -} - -//================================================================================ -inline void CLuaState::newTable() -{ - nlverify( lua_checkstack(_State, 1) ); - lua_newtable(_State); -} - //================================================================================ inline void CLuaState::getTable(int index) { checkIndex(index); - nlassert(isTable(index)); + nlassert(isTable(index) || isUserData(index)); lua_gettable(_State, index); } //================================================================================ inline void CLuaState::rawGet(int index) { - checkIndex(index); + checkIndex(index); lua_rawget(_State, index); } //================================================================================ inline void CLuaState::setTable(int index) { - checkIndex(index); + checkIndex(index); nlassert(getTop() >= 2); nlassert(isTable(index)); lua_settable(_State, index); @@ -399,41 +374,43 @@ inline void CLuaState::setTable(int index) //================================================================================ inline void CLuaState::rawSet(int index) { - checkIndex(index); + checkIndex(index); lua_rawset(_State, index); } //================================================================================ inline bool CLuaState::next(int index) { - checkIndex(index); + //H_AUTO(Lua_CLuaState_next) + checkIndex(index); return lua_next(_State, index) != 0; } //================================================================================ inline void CLuaState::rawSetI(int index, int n) { - checkIndex(index); + //H_AUTO(Lua_CLuaState_rawSetI) + checkIndex(index); lua_rawseti(_State, index, n); } //================================================================================ inline void CLuaState::rawGetI(int index, int n) { - checkIndex(index); + checkIndex(index); lua_rawgeti(_State, index, n); } //================================================================================ inline void CLuaState::call(int nargs, int nresults) { - nlassert(getTop() >= nargs); + nlassert(getTop() >= nargs); lua_call(_State, nargs, nresults); } //================================================================================ inline int CLuaState::pcall(int nargs, int nresults, int errfunc) -{ +{ return lua_pcall(_State, nargs, nresults, errfunc); } diff --git a/code/ryzom/tools/leveldesign/variable_parser/variable_parser.vcproj b/code/ryzom/tools/leveldesign/variable_parser/variable_parser.vcproj index 9526fb969..e69ed92a6 100644 --- a/code/ryzom/tools/leveldesign/variable_parser/variable_parser.vcproj +++ b/code/ryzom/tools/leveldesign/variable_parser/variable_parser.vcproj @@ -1,12 +1,10 @@ - @@ -85,7 +69,6 @@ OutputFile="variable_parser_r.exe" LinkIncremental="1" SuppressStartupBanner="true" - ProgramDatabaseFile=".\Release/variable_parser_r.pdb" SubSystem="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" @@ -100,107 +83,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -232,33 +114,22 @@ - + + + + + + + + + + + + + + + + - - @@ -414,42 +327,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 ) ) @@ -288,7 +288,7 @@ void CVariableParserDlg::BuildParseParameters( ParseParameters& params, uint lig params.push_back( "" ); CString str = m_variables[colonne][0].c_str(); - for ( uint j=m_nomVariables.size(); j>0; j-- ) + for ( uint j=(uint)m_nomVariables.size(); j>0; j-- ) { str.Replace( toString( "C%d", j-1 ).c_str(), params[j-1].c_str() ); }