4 * Created on: Sep 11, 2012
8 #ifndef LOADER_COMPILER_H_
9 #define LOADER_COMPILER_H_
23 explicit Compiler(const Interpreter &intp);
26 Compiler(const Compiler &);
27 Compiler &operator =(const Compiler &);
30 void Write(std::ostream &);
44 struct ImageProperties {
56 void WriteHeader(std::ostream &);
57 void WriteExports(std::ostream &);
58 void WriteExternals(std::ostream &);
59 void WriteExportStrings(std::ostream &);
60 void WriteExternalStrings(std::ostream &);
61 void WriteImages(std::ostream &);
62 void WriteObjects(std::ostream &);
64 void Write(std::ostream &, const char *data, int amount);
65 void Pad(std::ostream &, int to);
66 static int Remaining(int value, int alignment);
68 int ReferenceOffset(int typeId, int objectId, std::ptrdiff_t fieldOffset) const;
69 int ObjectOffset(int typeId, int objectId) const;
70 int TypeOffset(int typeId) const;
73 const Interpreter &intp;
79 int externalStringsOffset;
80 int exportStringsOffset;
84 std::map<int, int> objectOffsets;
90 #endif /* LOADER_COMPILER_H_ */