summaryrefslogtreecommitdiff
path: root/library/Core.cpp
diff options
context:
space:
mode:
authorTimothy Collett2012-05-26 16:08:15 -0400
committerTimothy Collett2012-05-26 16:08:15 -0400
commit7ec0fd6fc02815d6093cdff97599226045657053 (patch)
treeab6a3a147fcd6212f1c8720d3b285fe0bf2a332a /library/Core.cpp
parent1dd4cc56670819e72d05c306d4f97d9b5a15cd3b (diff)
downloaddfhack-7ec0fd6fc02815d6093cdff97599226045657053.tar.gz
dfhack-7ec0fd6fc02815d6093cdff97599226045657053.tar.bz2
dfhack-7ec0fd6fc02815d6093cdff97599226045657053.tar.xz
Trying to set up an autorelease pool, but not yet succeeding.
Diffstat (limited to 'library/Core.cpp')
-rw-r--r--library/Core.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/library/Core.cpp b/library/Core.cpp
index 63add024..94d408b8 100644
--- a/library/Core.cpp
+++ b/library/Core.cpp
@@ -279,21 +279,29 @@ static command_result runLuaScript(color_ostream &out, std::string filename, vec
command_result Core::runCommand(color_ostream &out, const std::string &command)
{
+ fprintf(stderr,"Inside runCommand");
+ fprintf(stderr," with command %s\n",command.c_str());
if (!command.empty())
{
+ fprintf(stderr,"Command is not empty, tokenizing\n");
vector <string> parts;
Core::cheap_tokenise(command,parts);
+ fprintf(stderr,"Tokenized, got %d parts\n",parts.size());
if(parts.size() == 0)
return CR_NOT_IMPLEMENTED;
string first = parts[0];
+ fprintf(stderr,"Erasing beginning\n");
parts.erase(parts.begin());
+
+ fprintf(stderr,"I think we're about there\n");
if (first[0] == '#')
return CR_OK;
cerr << "Invoking: " << command << endl;
+ fprintf(stderr,"Returning with the next recursion\n");
return runCommand(out, first, parts);
}
else
@@ -674,6 +682,7 @@ void fIOthread(void * iodata)
{
string command = "";
int ret = con.lineedit("[DFHack]# ",command, main_history);
+ fprintf(stderr,"Command: [%s]\n",command.c_str());
if(ret == -2)
{
cerr << "Console is shutting down properly." << endl;
@@ -687,9 +696,13 @@ void fIOthread(void * iodata)
else if(ret)
{
// a proper, non-empty command was entered
+ fprintf(stderr,"Adding command to history\n");
main_history.add(command);
+ fprintf(stderr,"Saving history\n");
main_history.save("dfhack.history");
}
+
+ fprintf(stderr,"Running command\n");
auto rv = core->runCommand(con, command);