]> ruin.nu Git - popboot.git/commitdiff
more sane test
authorMichael Andreen <harv@ruin.nu>
Tue, 17 May 2005 21:18:30 +0000 (21:18 +0000)
committerMichael Andreen <harv@ruin.nu>
Tue, 17 May 2005 21:18:30 +0000 (21:18 +0000)
Makefile [deleted file]
input.txt
parser.y
src.pro

diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 0e6852d..0000000
--- a/Makefile
+++ /dev/null
@@ -1,147 +0,0 @@
-#############################################################################
-# Makefile for building: planner
-# Generated by qmake (1.07a) (Qt 3.3.4) on: Mon May  9 12:42:54 2005
-# Project:  src.pro
-# Template: app
-# Command: $(QMAKE) -o Makefile src.pro
-#############################################################################
-
-####### Compiler, tools and options
-
-CC       = gcc
-CXX      = g++
-LEX      = flex
-YACC     = yacc
-CFLAGS   = -pipe -Wall -W -g  
-CXXFLAGS = -pipe -Wall -W -g  
-LEXFLAGS = 
-YACCFLAGS= -d
-INCPATH  = -I/usr/qt/3/mkspecs/linux-g++ -I. -I.
-LINK     = g++
-LFLAGS   = 
-LIBS     = $(SUBLIBS)  
-AR       = ar cqs
-RANLIB   = 
-MOC      = $(QTDIR)/bin/moc
-UIC      = $(QTDIR)/bin/uic
-QMAKE    = qmake
-TAR      = tar -cf
-GZIP     = gzip -9f
-COPY     = cp -f
-COPY_FILE= $(COPY)
-COPY_DIR = $(COPY) -r
-INSTALL_FILE= $(COPY_FILE)
-INSTALL_DIR = $(COPY_DIR)
-DEL_FILE = rm -f
-SYMLINK  = ln -sf
-DEL_DIR  = rmdir
-MOVE     = mv -f
-CHK_DIR_EXISTS= test -d
-MKDIR    = mkdir -p
-
-####### Output directory
-
-OBJECTS_DIR = ./
-
-####### Files
-
-HEADERS = action.h \
-               node.h \
-               planner.h
-SOURCES = action.cpp \
-               main.cpp \
-               node.cpp \
-               planner.cpp
-OBJECTS = action.o \
-               main.o \
-               node.o \
-               planner.o
-FORMS = 
-UICDECLS = 
-UICIMPLS = 
-SRCMOC   = 
-OBJMOC = 
-DIST      = src.pro
-QMAKE_TARGET = planner
-DESTDIR  = 
-TARGET   = planner
-
-first: all
-####### Implicit rules
-
-.SUFFIXES: .c .o .cpp .cc .cxx .C
-
-.cpp.o:
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
-
-.cc.o:
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
-
-.cxx.o:
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
-
-.C.o:
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
-
-.c.o:
-       $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
-
-####### Build rules
-
-all: Makefile $(TARGET)
-
-$(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC)  
-       $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)
-
-mocables: $(SRCMOC)
-uicables: $(UICDECLS) $(UICIMPLS)
-
-$(MOC): 
-       ( cd $(QTDIR)/src/moc && $(MAKE) )
-
-Makefile: src.pro  /usr/qt/3/mkspecs/linux-g++/qmake.conf 
-       $(QMAKE) -o Makefile src.pro
-qmake: 
-       @$(QMAKE) -o Makefile src.pro
-
-dist: 
-       @mkdir -p .tmp/planner && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/planner/ && ( cd `dirname .tmp/planner` && $(TAR) planner.tar planner && $(GZIP) planner.tar ) && $(MOVE) `dirname .tmp/planner`/planner.tar.gz . && $(DEL_FILE) -r .tmp/planner
-
-mocclean:
-uiclean:
-
-yaccclean:
-lexclean:
-clean:
-       -$(DEL_FILE) $(OBJECTS)
-       -$(DEL_FILE) *~ core *.core
-
-
-####### Sub-libraries
-
-distclean: clean
-       -$(DEL_FILE) $(TARGET) $(TARGET)
-
-
-FORCE:
-
-####### Compile
-
-action.o: action.cpp action.h
-
-main.o: main.cpp planner.h \
-               action.h
-
-node.o: node.cpp node.h \
-               action.h
-
-planner.o: planner.cpp planner.h \
-               node.h \
-               action.h
-
-####### Install
-
-install:  
-
-uninstall:  
-
index f54b31a9b0c14f1207d3ae86db38819a3751ff25..96e8683342e6679d374eeda217f5bdb0889e468a 100644 (file)
--- a/input.txt
+++ b/input.txt
@@ -1,17 +1,16 @@
 # kommenatar
 apache
-a, b, ?c, d, e 
+NET
 httpd.sh
-1: q, w, r, t, y       # kommentar
+0: HTPPD       # kommentar
 
 #
 # fds  sfd
 #32 
 #dasdssad
-test
-b, ce, de, ee
-"testar.sh -foo bar"
-99: uu, ve # kommentar
-88: uu
+eth0
+""
+"ifconfig up eth0"
+0: NET # kommentar
 
 
index d39a88a34e9c01c5d25804c09e9e243c63ade085..663442a8a8bcd87259383c097e418eda5c9680d1 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -8,6 +8,7 @@
     #include <vector>
 
     #include "action.h"
+       #include "planner.h"
 
     using namespace std;
 
@@ -55,7 +56,7 @@ action        : id preconds '\n' exec effects '\n' {
                                cout << "id:  " << *$1 << endl;
 
                                // Precondition flags:
-                               cout << "a: " << (*$2)["a"] << endl;
+                               cout << "a: " << (*$2)["NET"] << endl;
                                cout << "b: " << (*$2)["b"] << endl;
                                cout << "c: " << (*$2)["c"] << endl;
                                cout << "d: " << (*$2)["d"] << endl;
@@ -64,7 +65,7 @@ action        : id preconds '\n' exec effects '\n' {
                                cout << "exe: " << *$4 << endl;
 
                                // Print number of effects
-                               cout << "1: " << (*$5)[1].size() << endl;
+                               cout << "1: " << (*$5)[0].size() << endl;
                                cout << "99: " << (*$5)[99].size() << endl;
                                cout << "88: " << (*$5)[88].size() << endl;
 
@@ -195,6 +196,16 @@ yyerror (char const *s)
     cerr << "Parse error : " << s;
 }
 
+vector<string> stringToVector(string str){
+       vector<string> strings;
+
+       istringstream ist(str);
+       while (ist >> str){
+               strings.push_back(str);
+       }
+
+       return strings;
+}
 
 int 
 main (int argc, char** argv)
@@ -219,4 +230,7 @@ main (int argc, char** argv)
     actions = new vector<Action>();
 
     yyparse();
+
+       Planner p(*actions, stringToVector(argv[2]), stringToVector(argv[3]));
+       p.execute();
 }
diff --git a/src.pro b/src.pro
index e8c02b915af74467803c2477db48e1b055509fa0..67eb5f73d1a4ff8c32d58e81ee08bb9fce8d2f24 100644 (file)
--- a/src.pro
+++ b/src.pro
@@ -11,4 +11,5 @@ TARGET = planner
 
 # Input
 HEADERS += action.h node.h planner.h
-SOURCES += action.cpp main.cpp node.cpp planner.cpp
+SOURCES += action.cpp node.cpp planner.cpp
+YACCSOURCES += parser.y