From 2fa3e53855dd12c13560dbe7da19eac7b90a3b29 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 21 Sep 2009 01:52:53 +0200 Subject: Adding more skeletons --- Database/database.h | 16 ++++++++++++---- Database/internals/database-internal.h | 3 ++- Engine/Makefile | 15 +++++++++++++++ Engine/crawler.cpp | 1 + Loader/Makefile | 15 +++++++++++++++ Loader/loader.cpp | 2 ++ Lua/Makefile | 15 +++++++++++++++ Lua/lua-engine.cpp | 0 Makefile | 2 +- externals/Base | 2 +- 10 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 Engine/Makefile create mode 100644 Engine/crawler.cpp create mode 100644 Loader/Makefile create mode 100644 Loader/loader.cpp create mode 100644 Lua/Makefile create mode 100644 Lua/lua-engine.cpp diff --git a/Database/database.h b/Database/database.h index dffaaf5..be46598 100644 --- a/Database/database.h +++ b/Database/database.h @@ -7,16 +7,24 @@ class Database : public Base { public: - Database(); - ~Database(); + Database() : start(0), end(0), currentId(1) { } + ~Database() { while(start) delete start; } DatabaseCell * getStart() { return start; } DatabaseCell * getEnd() { return end; } void setStart(DatabaseCell * newStart) { start = newStart; } void setEnd(DatabaseCell * newEnd) { end = newEnd; } - Segment * getSegment(Uint32 id); - Uint32 GetNextSegId(); + Segment * getSegment(Uint32 id) { + DatabaseCell * cursor; + + for (cursor = start; start; cursor = cursor->getNext()) + if (cursor->getId() == id) + return cursor->getSegment(); + return 0; + } + Uint32 GetNextSegId() { return currentId++; } private: DatabaseCell * start, * end; + Uint32 currentId; }; #endif diff --git a/Database/internals/database-internal.h b/Database/internals/database-internal.h index 5ca6050..173eb62 100644 --- a/Database/internals/database-internal.h +++ b/Database/internals/database-internal.h @@ -21,12 +21,13 @@ class DatabaseCell : public Base { */ DatabaseCell(Cpu * cpu, Uint64 cpu_base, absolute_ptr origin, Uint32 size, Uint32 extra_size, DatabaseCell * prev, Database * parent); ~DatabaseCell(); - Uint32 getID() { return segment->getId(); } + Uint32 getId() { return segment->getId(); } void LoadMemory(Handle * src) { segment->LoadMemory(src); } Segment * getSegment() { return segment; } Cpu * getCpu() { return cpu; } Uint64 getCpuBase() { return segment->getCpuBase(); } absolute_ptr getOrigin() { return origin; } + DatabaseCell * getNext() { return next; } private: Segment * segment; diff --git a/Engine/Makefile b/Engine/Makefile new file mode 100644 index 0000000..55c1046 --- /dev/null +++ b/Engine/Makefile @@ -0,0 +1,15 @@ +TARGET = Engine.a + +SRCS = \ +crawler.cpp \ + +SPATH = + +CPPFLAGS = -I. -I../Database -I../Database/internals + +include ../Makefile.cfg + +$(TARGET): $(OBJS) + $(AR) $@ $^ + +-include $(DEPS) diff --git a/Engine/crawler.cpp b/Engine/crawler.cpp new file mode 100644 index 0000000..aef8cab --- /dev/null +++ b/Engine/crawler.cpp @@ -0,0 +1 @@ +#include "database.h" \ No newline at end of file diff --git a/Loader/Makefile b/Loader/Makefile new file mode 100644 index 0000000..058dd5a --- /dev/null +++ b/Loader/Makefile @@ -0,0 +1,15 @@ +TARGET = Loader.a + +SRCS = \ +loader.cpp \ + +SPATH = + +CPPFLAGS = -I. -I../Database -I../Database/internals + +include ../Makefile.cfg + +$(TARGET): $(OBJS) + $(AR) $@ $^ + +-include $(DEPS) diff --git a/Loader/loader.cpp b/Loader/loader.cpp new file mode 100644 index 0000000..5fece50 --- /dev/null +++ b/Loader/loader.cpp @@ -0,0 +1,2 @@ +#include "database.h" + diff --git a/Lua/Makefile b/Lua/Makefile new file mode 100644 index 0000000..27b875e --- /dev/null +++ b/Lua/Makefile @@ -0,0 +1,15 @@ +TARGET = Lua.a + +SRCS = \ +lua-engine.cpp \ + +SPATH = + +CPPFLAGS = -I. -I../Database -I../Database/internals -I../Engine + +include ../Makefile.cfg + +$(TARGET): $(OBJS) + $(AR) $@ $^ + +-include $(DEPS) diff --git a/Lua/lua-engine.cpp b/Lua/lua-engine.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Makefile b/Makefile index 1767149..a072ca4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -DIRS=externals Utils Database +DIRS=externals Utils Engine Lua Loader Database all: $(DIRS) diff --git a/externals/Base b/externals/Base index 6d1dee6..ecd106e 160000 --- a/externals/Base +++ b/externals/Base @@ -1 +1 @@ -Subproject commit 6d1dee65d5ad695670d73bf3e162b4b6e984af35 +Subproject commit ecd106e68cadab41d0f0a4131e668fb251a87a3e -- cgit v1.2.3