]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/Loader.h
support for arrays containing (yet) undefined references
[l2e.git] / src / loader / Loader.h
index 50876384d744b26e617cd8982a1ee282153b24c7..c962f206119a9b67f22d11d52b9b58b806004b2e 100644 (file)
@@ -4,8 +4,10 @@
 #include "ObjectFile.h"
 #include "TypeDescription.h"
 
+#include <iosfwd>
 #include <map>
 #include <string>
+#include <vector>
 #include <SDL.h>
 
 namespace loader {
@@ -21,6 +23,8 @@ public:
 
        const std::map<std::string, LoadedExport> &Exports() const { return exports; }
 
+       std::ostream &Dump(std::ostream &) const;
+
 private:
        void LoadExports(char *src, Export *begin, Export *end);
        void LoadExternals(char *src, External *begin, External *end);
@@ -33,12 +37,31 @@ private:
        void InitObject(char *object, const TypeDescription &);
        void InitArrays(Array *begin, Array *end);
 
+       struct MissingExternal {
+               std::string identifier;
+               char *dest;
+               int typeId;
+               bool inlined;
+       };
+       void LinkExternal(const MissingExternal &, const LoadedExport &);
+
 private:
        std::map<std::string, char *> objectFiles;
        std::map<std::string, LoadedExport> exports;
        std::map<std::string, SDL_Surface *> images;
+       std::vector<MissingExternal> unlinked;
 
 };
 
 }
+
+
+namespace std {
+
+inline ostream &operator <<(ostream &o, const loader::Loader &l) {
+       return l.Dump(o);
+}
+
+}
+
 #endif