From: Sam Moore Date: Wed, 26 Mar 2014 16:27:44 +0000 (+0800) Subject: Merge branch 'master' of git.ucc.asn.au:/ipdf/code X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=0d33eac5144178de754ad9f53e39463f79a31398;p=ipdf%2Fcode.git Merge branch 'master' of git.ucc.asn.au:/ipdf/code Conflicts: src/main.cpp Fixed that and also fixed other things. --- 0d33eac5144178de754ad9f53e39463f79a31398 diff --cc src/Makefile index 0a1bc96,3e8d8a0..6d7f100 --- a/src/Makefile +++ b/src/Makefile @@@ -15,16 -14,9 +15,16 @@@ BIN = ../bin/ipd all : $(BIN) -$(BIN) : $(LINKOBJ) +tests/% : tests/%.cpp ../obj/tests/%.o $(LINKOBJ) + $(CXX) -o $@.test $(LINKOBJ) ../obj/$@.o $(LIB) + +runtests : tests/runtests.sh + cd tests; ./runtests.sh + + - $(BIN) : $(LINKOBJ) ++$(BIN) : $(LINKOBJ) ../obj/$(MAIN) @mkdir -p $(dir $@) - $(CXX) -o $(BIN) $(LINKOBJ) $(LIB) + $(CXX) -o $(BIN) $(LINKOBJ) ../obj/$(MAIN) $(LIB) ../obj/%.o : %.cpp @mkdir -p $(dir $@) @@@ -32,21 -24,14 +32,21 @@@ -include $(DEPS) +clean_bin : + $(RM) $(BIN) + clean : -- $(RM) $(BIN) $(DEPS) $(LINKOBJ) ++ $(RM) $(BIN) $(DEPS) $(LINKOBJ) ../obj/$(MAIN) + $(RM) tests/*~ + $(RM) tests/*.test + $(RM) tests/*.out + $(RM) tests/*.err + -clean_full: #cleans up all backup files - $(RM) $(BIN) $(DEPS) $(LINKOBJ) +clean_full: clean $(RM) *.*~ $(RM) *~ - $(RM) *.o + diff --cc src/main.cpp index 72f29e3,2a85c14..339ea8d --- a/src/main.cpp +++ b/src/main.cpp @@@ -1,16 -1,27 +1,22 @@@ -#include "common.h" - -#include "document.h" -#include "view.h" -#include "screen.h" - -using namespace std; -using namespace IPDF; - +#include "main.h" +#include // Because we can. int main(int argc, char ** argv) -{ +{ Document doc; + srand(time(NULL)); - doc.Add(RECT_FILLED, Rect(Random(), Random(), Random(), Random())); - - View view(doc); - - Screen scr; - - while (scr.PumpEvents()) + if (argc > 1) { - view.Render(); - scr.Present(); + for (int i = 2; i < argc; ++i) + { + if (fork() == 0) doc.Load(argv[i]); + } + doc.Load(argv[1]); } - ++ else ++ { ++ Debug("Add random object"); ++ doc.Add(RECT_FILLED, Rect(Random()*0.5, Random()*0.5, Random()*0.5, Random()*0.5)); ++ } + MainLoop(doc); return 0; }