X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FLoader.h;h=c962f206119a9b67f22d11d52b9b58b806004b2e;hb=8ef435410d1f8aff339e4afef87a5757e77eba45;hp=cf7dd132a3e76b60c44464cb44aff5a0af82a6fd;hpb=8c8061a4f8b88410d6d93c039afe6affc4b69cf2;p=l2e.git diff --git a/src/loader/Loader.h b/src/loader/Loader.h index cf7dd13..c962f20 100644 --- a/src/loader/Loader.h +++ b/src/loader/Loader.h @@ -4,8 +4,10 @@ #include "ObjectFile.h" #include "TypeDescription.h" +#include #include #include +#include #include namespace loader { @@ -19,17 +21,47 @@ public: public: void Load(const std::string &file); + const std::map &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); + void LoadImages(char *src, Image *begin, Image *end); void LoadObjects(char *src, Object *begin, Object *end); void LoadObject(char *src, char *dest, const TypeDescription &); + void LoadArrays(char *src, Array *begin, Array *end); + + void InitObjects(Object *begin, Object *end); + 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 objectFiles; std::map exports; + std::map images; + std::vector unlinked; }; } + + +namespace std { + +inline ostream &operator <<(ostream &o, const loader::Loader &l) { + return l.Dump(o); +} + +} + #endif