while custom script logging functions dont work, use an own logfile instead

This commit is contained in:
False.Genesis 2007-08-28 17:02:19 +00:00
parent cb26f947c5
commit 71b17e7ced
3 changed files with 17 additions and 12 deletions

View File

@ -25,6 +25,8 @@ DefScriptPackage::DefScriptPackage()
SetLog(printf);
SetDebugLog(printf);
SetErrorLog(printf);
hLogfile.open("DefScriptLog.txt",std::ios_base::out);
hLogfile << "DefScript engine execution log, compilation date: " __DATE__ " " __TIME__ "\n\n" ;
_eventmgr=new DefScript_DynamicEventMgr(this);
_InitFunctions();
# ifdef USING_DEFSCRIPT_EXTENSIONS
@ -36,7 +38,8 @@ DefScriptPackage::~DefScriptPackage()
{
if(_eventmgr)
delete _eventmgr;
Clear();
Clear();
hLogfile.close();
}
void DefScriptPackage::Log(const char* fmt,...)
@ -944,16 +947,12 @@ std::string DefScriptPackage::_NormalizeVarName(std::string vn_in, std::string s
DefReturnResult DefScriptPackage::Interpret(CmdSet& Set)
{
// TODO: remove this debug block again as soon as the interpreter bugs are fixed.
# ifdef DEF_DEBUG_SCRIPT_CALLS
printf("DefScriptPackage::Interpret(), pSet=0x%X\n",&Set);
printf("cmd = '%s'\n",Set.cmd.c_str());
unsigned int ctr=0;
for(_CmdSetArgMap::iterator i=Set.arg.begin(); i!=Set.arg.end(); i++)
{
printf("arg[%u] = '%s'\n",ctr++,i->second.c_str());
}
printf("defaultarg = '%s'\n",Set.defaultarg.c_str());
# endif
hLogfile << "PARENT: '" << Set.caller << "'\n";
hLogfile << "cmd = '" << Set.cmd << "'\n";
unsigned int ctr=0;
for(_CmdSetArgMap::iterator i=Set.arg.begin(); i!=Set.arg.end(); i++)
hLogfile << "arg[" << ctr++ << "] = '" << i->second << "'\n";
hLogfile << "defaultarg = '" << Set.defaultarg << "'\n\n";
DefReturnResult result;

View File

@ -4,6 +4,7 @@
#include <map>
#include <deque>
#include <fstream>
#include "VarSet.h"
#include "DynamicEvent.h"
#include "ListStorage.h"
@ -160,6 +161,7 @@ private:
std::map<std::string,unsigned char> scriptPermissionMap;
DefScriptFunctionTable _functable;
_slog_func _slog,_serrorlog,_sdebuglog;
std::fstream hLogfile;
// Usable internal basic functions:
DefReturnResult func_default(CmdSet&);

View File

@ -350,7 +350,11 @@ DefReturnResult DefScriptPackage::func_equal(CmdSet& Set)
result=stringToLower(Set.defaultarg)==stringToLower(Set.arg[0]);
}
result=Set.defaultarg==Set.arg[0];
_DEFSC_DEBUG(printf("DEFSCRIPT: func_equal: ['%s'=='%s'] = %s\n",Set.arg[0].c_str(),Set.defaultarg.c_str(),result?"true":"false"));
// for debugging
char tmp[500];
sprintf(tmp,"DEFSCRIPT: func_equal: ['%s'=='%s'] = %s\n",Set.arg[0].c_str(),Set.defaultarg.c_str(),result?"true":"false");
hLogfile << tmp;
return result;
}