1 #ifndef LOADER_COMPILER_H_
2 #define LOADER_COMPILER_H_
4 #include "Interpreter.h"
5 #include "ObjectFile.h"
6 #include "TypeDescription.h"
18 explicit Compiler(const Interpreter &intp);
21 Compiler(const Compiler &);
22 Compiler &operator =(const Compiler &);
25 void Write(std::iostream &);
28 void ReserveHeader(std::ostream &);
29 void WriteObjects(std::ostream &);
30 void WriteOwnStrings(std::ostream &);
31 void WriteArrays(std::ostream &);
32 void WriteHeader(std::ostream &);
33 void WriteExports(std::ostream &);
34 void WriteExternals(std::ostream &);
35 void WriteImages(std::ostream &);
37 void Relocate(std::iostream &);
38 void RelocateArray(char *, int size);
39 void Relocate(unsigned int pos, char *dest, const TypeDescription &);
41 void PrepareExport(Export &, const std::string &);
42 void PrepareExternal(External &, const Interpreter::PostponedDefinition &);
43 void PrepareObject(Object &, const TypeDescription &, void *);
45 void Write(std::ostream &, const void *data, int amount);
46 void Pad(std::ostream &, int to);
47 void Fill(std::ostream &, int count, char c = '\0');
48 static int Remaining(int value, int alignment);
51 const Interpreter &intp;
53 ObjectFileHeader fileHeader;
55 std::map<const void *, unsigned int> addressMap;
56 std::map<unsigned int, void *> images;