diff --git a/src/sandbox/Context.cpp b/src/Context.cpp similarity index 98% rename from src/sandbox/Context.cpp rename to src/Context.cpp index eca52e2aa..fece44ab8 100644 --- a/src/sandbox/Context.cpp +++ b/src/Context.cpp @@ -34,6 +34,13 @@ //////////////////////////////////////////////////////////////////////////////// Context::Context () +: config () +, filter () +, keymap () +, sequence () +, task () +, tdb () +, stringtable () { // Set up randomness. #ifdef HAVE_SRANDOM diff --git a/src/sandbox/Context.h b/src/Context.h similarity index 100% rename from src/sandbox/Context.h rename to src/Context.h diff --git a/src/Makefile.am b/src/Makefile.am index c67c61ea7..60662a8ef 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,10 +1,11 @@ bin_PROGRAMS = task -task_SOURCES = Config.cpp Date.cpp Record.cpp T.cpp TDB.cpp Att.cpp Mod.cpp \ - Filter.cpp Sequence.cpp Table.cpp Grid.cpp Timer.cpp \ - Duration.cpp StringTable.cpp Location.cpp Subst.cpp Keymap.cpp \ - Nibbler.cpp color.cpp parse.cpp task.cpp command.cpp edit.cpp \ - report.cpp util.cpp text.cpp rules.cpp import.cpp Config.h \ - Date.h Record.h T.h TDB.h Att.h Mod.h Filter.h Sequence.h \ - Table.h Grid.h Timer.h Duration.h StringTable.h Location.h \ - Subst.h Keymap.h Nibbler.h color.h task.h +task_SOURCES = Config.cpp Date.cpp Record.cpp T.cpp T2.cpp TDB.cpp TDB2.cpp \ + Att.cpp Mod.cpp Filter.cpp Sequence.cpp Table.cpp Grid.cpp \ + Timer.cpp Duration.cpp StringTable.cpp Location.cpp Subst.cpp \ + Keymap.cpp Nibbler.cpp Context.cpp color.cpp parse.cpp \ + task.cpp command.cpp edit.cpp report.cpp util.cpp text.cpp \ + rules.cpp import.cpp Config.h Date.h Record.h T.h TDB.h Att.h \ + Mod.h Filter.h Sequence.h Table.h Grid.h Timer.h Duration.h \ + StringTable.h Location.h Subst.h Keymap.h Nibbler.h Context.h \ + color.h task.h diff --git a/src/StringTable.cpp b/src/StringTable.cpp index 4c11db68b..80ef2a11a 100644 --- a/src/StringTable.cpp +++ b/src/StringTable.cpp @@ -68,6 +68,8 @@ StringTable::~StringTable () // ... void StringTable::load (const std::string& file) { + mMapping.clear (); // Allows dynamic reload. + std::ifstream in; in.open (file.c_str (), std::ifstream::in); if (in.good ()) diff --git a/src/sandbox/T2.cpp b/src/T2.cpp similarity index 93% rename from src/sandbox/T2.cpp rename to src/T2.cpp index dae3b4baf..2e548db73 100644 --- a/src/sandbox/T2.cpp +++ b/src/T2.cpp @@ -26,6 +26,7 @@ //////////////////////////////////////////////////////////////////////////////// #include +#include "Nibbler.h" #include "T2.h" //////////////////////////////////////////////////////////////////////////////// @@ -56,6 +57,11 @@ T2::~T2 () { } +//////////////////////////////////////////////////////////////////////////////// +void T2::legacyParse (const std::string& input) +{ +} + //////////////////////////////////////////////////////////////////////////////// // [name:value, name:"value",name:[name:value,name:value]] std::string T2::composeF4 () diff --git a/src/sandbox/T2.h b/src/T2.h similarity index 97% rename from src/sandbox/T2.h rename to src/T2.h index 5f59337ea..e31111a25 100644 --- a/src/sandbox/T2.h +++ b/src/T2.h @@ -38,6 +38,7 @@ public: T2& operator= (const T2&); // Assignment operator ~T2 (); // Destructor + void legacyParse (const std::string&); std::string composeF4 (); std::string composeCSV (); diff --git a/src/sandbox/TDB2.cpp b/src/TDB2.cpp similarity index 100% rename from src/sandbox/TDB2.cpp rename to src/TDB2.cpp diff --git a/src/sandbox/TDB2.h b/src/TDB2.h similarity index 100% rename from src/sandbox/TDB2.h rename to src/TDB2.h diff --git a/src/sandbox/Makefile b/src/sandbox/Makefile index 80c752d77..2751dc748 100644 --- a/src/sandbox/Makefile +++ b/src/sandbox/Makefile @@ -2,9 +2,10 @@ PROJECT = 1.8 CFLAGS = -I. -I.. -Wall -pedantic -ggdb3 -fno-rtti -fno-stack-check LFLAGS = LIBS = -OBJECTS = main.o Context.o TDB2.o T2.o ../Sequence.o ../Filter.o ../Att.o \ - ../Keymap.o ../Record.o ../Mod.o ../StringTable.o ../util.o \ - ../text.o ../Date.o ../Config.o ../Location.o ../Subst.o ../Nibbler.o +OBJECTS = main.o ../Context.o ../TDB2.o ../T2.o ../Sequence.o ../Filter.o \ + ../Att.o ../Keymap.o ../Record.o ../Mod.o ../StringTable.o \ + ../util.o ../text.o ../Date.o ../Config.o ../Location.o ../Subst.o \ + ../Nibbler.o all: $(PROJECT) diff --git a/src/task.cpp b/src/task.cpp index 5034e0607..65d1f7fb2 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -317,8 +317,13 @@ int main (int argc, char** argv) srand (time (NULL)); #endif + // TODO 1.8.0 requires the Context. + Context context; + try { + context.initialize (argc, argv); + // Load the config file from the home directory. If the file cannot be // found, offer to create a sample one. Config conf; @@ -365,7 +370,7 @@ int main (int argc, char** argv) catch (...) { - std::cerr << "Unknown error." << std::endl; + std::cerr << context.stringtable.get (100, "Unknown error.") << std::endl; return -2; } diff --git a/src/task.h b/src/task.h index 1782de752..04294ca6d 100644 --- a/src/task.h +++ b/src/task.h @@ -29,6 +29,7 @@ #include #include #include +#include "Context.h" #include "T.h" #include "TDB.h" #include "Config.h"