]> ruin.nu Git - popboot.git/commitdiff
some changes
authorMichael Andreen <harv@ruin.nu>
Tue, 17 May 2005 22:01:08 +0000 (22:01 +0000)
committerMichael Andreen <harv@ruin.nu>
Tue, 17 May 2005 22:01:08 +0000 (22:01 +0000)
input.txt
parser.y
planner.cpp

index 96e8683342e6679d374eeda217f5bdb0889e468a..f6c2874097951f0354b67085b483ccb7029752ed 100644 (file)
--- a/input.txt
+++ b/input.txt
@@ -2,14 +2,14 @@
 apache
 NET
 httpd.sh
-0: HTPPD       # kommentar
+0: HTPPD # kommentar
 
 #
 # fds  sfd
 #32 
 #dasdssad
 eth0
-""
+"1"
 "ifconfig up eth0"
 0: NET # kommentar
 
index 663442a8a8bcd87259383c097e418eda5c9680d1..e286054cb2fd1319ac0657f541f8d8f2fe21f95a 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -201,6 +201,7 @@ vector<string> stringToVector(string str){
 
        istringstream ist(str);
        while (ist >> str){
+               cout << str << endl;
                strings.push_back(str);
        }
 
index e06489642ad8be00f1bd4bbff0ddde98e7e884b2..884567dea5c4329e43b6d0020bd05bd5c12af1fc 100644 (file)
@@ -10,14 +10,16 @@ Planner::Planner(std::vector<Action> actions, Literals init, Literals goal){
        _goal = goal;
        _start = new StartNode(_init);
        _finish = new EndNode(_goal);
+       addNode(_start);
 
        for(vector<Action>::iterator action = actions.begin(); action != actions.end(); ++action){
                const Literals& effects = action->effects(0);
                for (Literals::const_iterator effect = effects.begin(); effect != effects.end(); ++effect){
-                       cerr << "Adding effect: " << *effect << endl;
+                       cerr << "Adding effect: '" << *effect << "', action: " << action->name() << endl;
                        _actions[*effect] = *action;
                }
        }
+       cout << "Number of actions: " << _actions.size() << endl;
        makePlan(_finish);
 }
 
@@ -42,7 +44,7 @@ void Planner::makePlan(Node* node){
                _start->addChild(node);
        }else{
                for (Preconditions::const_iterator precond = preconds.begin(); precond != preconds.end(); ++precond){
-                       cerr << "Looking for: " << precond->first << endl;
+                       cerr << "Looking for: '" << precond->first << "'" <<  endl;
                        hash_map<string,Node*>::iterator addedNode = _addedNodes.find(precond->first);
                        if(addedNode != _addedNodes.end()){
                                cerr << "Using already added node" << endl;
@@ -68,7 +70,9 @@ void Planner::makePlan(Node* node){
 }
 
 void Planner::addNode(Node* node){
+       cerr << "Adding node for action: " << node->action().name() << endl;
        const Literals& effects = node->action().effects(0);
+       cerr << "Number of effects: " << effects.size() << endl;
 
        for (Literals::const_iterator effect = effects.begin(); effect != effects.end(); ++effect){
                cout << "Adding node for effect: " << *effect << endl;