4 * Created on: Sep 11, 2012
8 #ifndef LOADER_COMPILER_H_
9 #define LOADER_COMPILER_H_
11 #include "ObjectFile.h"
25 explicit Compiler(const Interpreter &intp);
28 Compiler(const Compiler &);
29 Compiler &operator =(const Compiler &);
32 void Write(std::ostream &);
35 void WriteHeader(std::ostream &);
36 void WriteExports(std::ostream &);
37 void WriteExternals(std::ostream &);
38 void WriteExportStrings(std::ostream &);
39 void WriteExternalStrings(std::ostream &);
40 void WriteImages(std::ostream &);
41 void WriteObjects(std::ostream &);
43 void Write(std::ostream &, const char *data, int amount);
44 void Pad(std::ostream &, int to);
45 static int Remaining(int value, int alignment);
47 int ReferenceOffset(int typeId, int objectId, std::ptrdiff_t fieldOffset) const;
48 int ObjectOffset(int typeId, int objectId) const;
49 int GetTypeOffset(int typeId) const;
52 const Interpreter &intp;
56 ObjectFileHeader fileHeader;
58 std::map<int, int> objectOffsets;
64 #endif /* LOADER_COMPILER_H_ */