From 45bcf113d90cf11ffabf128e129b9ba591658147 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 31 Oct 2014 23:55:03 -0400 Subject: [PATCH] Context - Removed unnecessary Parser calls, leaving only minimal rc processing. --- src/Context.cpp | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 1c7fd4df4..6e56ba20c 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -217,25 +217,12 @@ int Context::initialize (int argc, const char** argv) std::map ::iterator cmd; for (cmd = commands.begin (); cmd != commands.end (); ++cmd) { - parser.entity ("cmd", cmd->first); cli.entity ("cmd", cmd->first); if (cmd->first[0] == '_') - { - parser.entity ("helper", cmd->first); cli.entity ("helper", cmd->first); - } - if (cmd->second->read_only ()) - { - parser.entity ("readcmd", cmd->first); - cli.entity ("readcmd", cmd->first); - } - else - { - parser.entity ("writecmd", cmd->first); - cli.entity ("writecmd", cmd->first); - } + cli.entity ((cmd->second->read_only () ? "readcmd" : "writecmd"), cmd->first); } // Instantiate built-in column objects. @@ -244,21 +231,9 @@ int Context::initialize (int argc, const char** argv) // Extend the fixed list of attribute names with any dynamic ones. std::map ::iterator col; for (col = columns.begin (); col != columns.end (); ++col) - { - parser.entity ("attribute", col->first); cli.entity ("attribute", col->first); - } - - // Now the entities are loaded, parsing may resume. - parser.findBinary (); // - parser.resolveAliases (); - parser.findCommand (); // - parser.findUUIDList (); // Before findIdSequence - parser.findIdSequence (); // - parser.injectDefaults (); // rc.default.command staticInitialization (); // Decouple code from Context. - parser.parse (); // Parse all elements. cli.analyze (); // Parse all elements. tdb2.set_location (data_dir); // Prepare the task database. @@ -687,32 +662,22 @@ void Context::assumeLocations () void Context::setupEntities () { // Entities: Pseudo-attributes. Hard-coded. - parser.entity ("pseudo", "limit"); cli.entity ("pseudo", "limit"); // Entities: Attributes. for (unsigned int i = 0; i < NUM_ATTRIBUTE_NAMES; ++i) - { - parser.entity ("attribute", attributeNames[i]); cli.entity ("attribute", attributeNames[i]); - } // Entities: Modifiers. for (unsigned int i = 0; i < NUM_MODIFIER_NAMES; ++i) - { - parser.entity ("modifier", modifierNames[i]); cli.entity ("modifier", modifierNames[i]); - } // Entities: Operators. std::vector operators; Eval::getOperators (operators); std::vector ::iterator op; for (op = operators.begin (); op != operators.end (); ++op) - { - parser.entity ("operator", *op); cli.entity ("operator", *op); - } } //////////////////////////////////////////////////////////////////////////////// @@ -770,10 +735,11 @@ void Context::decomposeSortField ( // Note: The reason some of these are commented out is because the ::clear // method is not really "clear" but "clear_some". Some members do not need to // be initialized. That makes this method something of a misnomer. So be it. +// +// TODO Is this method used anywhere? void Context::clear () { tdb2.clear (); - parser.clear (); // Eliminate the command objects. std::map ::iterator com; @@ -833,10 +799,7 @@ void Context::loadAliases () std::map ::iterator i; for (i = config.begin (); i != config.end (); ++i) if (i->first.substr (0, 6) == "alias.") - { - parser.alias (i->first.substr (6), i->second); cli.alias (i->first.substr (6), i->second); - } } ////////////////////////////////////////////////////////////////////////////////