FoxBinaryObjectFile.SymU 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. MODULE FoxBinaryObjectFile;
  2. IMPORT Scanner := FoxScanner, Basic := FoxBasic, SyntaxTree := FoxSyntaxTree, Global := FoxGlobal, SemanticChecker := FoxSemanticChecker, FingerPrinter := FoxFingerPrinter, Sections := FoxSections, Streams, D := Debugging, Files, SYSTEM, Strings, BinaryCode := FoxBinaryCode, Log := KernelLog, Diagnostics, SymbolFileFormat := FoxBinarySymbolFile, Options, Formats := FoxFormats, IntermediateCode := FoxIntermediateCode, Machine;
  3. CONST
  4. ofFileTag = 0BBX;
  5. ofNoZeroCompress = 0ADX;
  6. ofFileVersion = SymbolFileFormat.FileVersionCurrent;
  7. ofEUEnd = 0X;
  8. ofEURecord = 1X;
  9. ofEUProcFlag = LONGINT(2147483648);
  10. DefaultNofSysCalls = 12;
  11. NewRec = 0;
  12. NewArr = 1;
  13. NewSys = 2;
  14. CaseTable = 3;
  15. ProcAddr = 4;
  16. Lock = 5;
  17. Unlock = 6;
  18. Start = 7;
  19. Await = 8;
  20. InterfaceLookup = 9;
  21. RegisterInterface = 10;
  22. GetProcedure = 11;
  23. Trace = FALSE;
  24. TYPE
  25. Name = ARRAY 256 OF CHAR;
  26. ByteArray = POINTER TO ARRAY OF CHAR;
  27. ObjectFileFormat* = OBJECT (Formats.ObjectFileFormat)
  28. PROCEDURE ^ & InitObjectFileFormat;
  29. PROCEDURE ^ Export*(module: Formats.GeneratedModule; symbolFileFormat: Formats.SymbolFileFormat): BOOLEAN;
  30. PROCEDURE ^ DefineOptions*(options: Options.Options);
  31. PROCEDURE ^ GetOptions*(options: Options.Options);
  32. PROCEDURE ^ DefaultSymbolFileFormat*(): Formats.SymbolFileFormat;
  33. PROCEDURE ^ ForceModuleBodies*(): BOOLEAN;
  34. END ObjectFileFormat;
  35. Fixup = OBJECT
  36. VAR
  37. nextFixup: Fixup;
  38. fixup: BinaryCode.Fixup;
  39. fixupSection: Sections.Section;
  40. END Fixup;
  41. Section = OBJECT
  42. VAR
  43. name: Basic.SegmentedName;
  44. symbol: SyntaxTree.Symbol;
  45. entryNumber: LONGINT;
  46. offset: LONGINT;
  47. fixups: Fixup;
  48. numberFixups: LONGINT;
  49. type: LONGINT;
  50. resolved: BinaryCode.Section;
  51. isCaseTable: BOOLEAN;
  52. referenced: BOOLEAN;
  53. PROCEDURE ^ SetEntryNumber(num: LONGINT);
  54. PROCEDURE ^ SetSymbol(s: SyntaxTree.Symbol);
  55. PROCEDURE ^ & Init(CONST name: Basic.SegmentedName);
  56. PROCEDURE ^ AddFixup(fixup: BinaryCode.Fixup; fixupSection: Sections.Section);
  57. PROCEDURE ^ Dump(w: Streams.Writer);
  58. END Section;
  59. SectionNameLookup = OBJECT (Basic.HashTableSegmentedName)
  60. PROCEDURE ^ GetSection(CONST name: Basic.SegmentedName): Section;
  61. PROCEDURE ^ PutSection(CONST name: Basic.SegmentedName; section: Section);
  62. END SectionNameLookup;
  63. SymbolLookup = OBJECT (Basic.HashTable)
  64. PROCEDURE ^ GetSection(s: SyntaxTree.Symbol): Section;
  65. PROCEDURE ^ PutSection(symbol: SyntaxTree.Symbol; section: Section);
  66. END SymbolLookup;
  67. SectionList = OBJECT (Basic.List)
  68. VAR
  69. lookup: SectionNameLookup;
  70. symbolLookup: SymbolLookup;
  71. PROCEDURE ^ & Init;
  72. PROCEDURE ^ AddSection(name: Basic.SegmentedName): Section;
  73. PROCEDURE ^ BySymbol(symbol: SyntaxTree.Symbol): Section;
  74. PROCEDURE ^ GetSection(i: LONGINT): Section;
  75. PROCEDURE ^ Dump(w: Streams.Writer);
  76. END SectionList;
  77. VAR
  78. SysCallMap: ARRAY DefaultNofSysCalls OF CHAR;
  79. PROCEDURE ^ FindPC(pc: LONGINT; module: Sections.Module; diagnostics: Diagnostics.Diagnostics): BOOLEAN;
  80. PROCEDURE ^ MakeSectionOffsets(module: Sections.Module; VAR constSize, varSize, codeSize, caseTableSize: LONGINT; VAR const, code: ByteArray);
  81. PROCEDURE ^ WriteObjectFile*(w: Streams.Writer; module: Sections.Module; symbolFile: Files.File);
  82. PROCEDURE ^ Get*(): Formats.ObjectFileFormat;
  83. BEGIN
  84. END FoxBinaryObjectFile.