FoxBinarySymbolFile.SymU 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. MODULE FoxBinarySymbolFile;
  2. IMPORT Basic := FoxBasic, Scanner := FoxScanner, SyntaxTree := FoxSyntaxTree, Global := FoxGlobal, Files, Streams, Kernel, SYSTEM, D := Debugging, Diagnostics, Options, Formats := FoxFormats, InterfaceComparison := FoxInterfaceComparison, Commands, Printout := FoxPrintout, SemanticChecker := FoxSemanticChecker, Machine;
  3. CONST
  4. TraceImport = 0;
  5. TraceExport = 1;
  6. Trace = {};
  7. sfTypeBoolean = 1;
  8. sfTypeChar8 = 2;
  9. sfTypeChar16 = 3;
  10. sfTypeChar32 = 4;
  11. sfTypeShortint = 5;
  12. sfTypeInteger = 6;
  13. sfTypeLongint = 7;
  14. sfTypeHugeint = 8;
  15. sfTypeReal = 9;
  16. sfTypeLongreal = 10;
  17. sfTypeSet = 11;
  18. sfTypeString = 12;
  19. sfTypeNoType = 13;
  20. sfTypeNilType = 14;
  21. sfTypeByte = 15;
  22. sfTypeAny = 16;
  23. sfTypeObject = 17;
  24. sfTypeAddress = 18;
  25. sfTypeSize = 19;
  26. sfTypeUnsigned8 = 20;
  27. sfTypeUnsigned16 = 21;
  28. sfTypeUnsigned32 = 22;
  29. sfTypeUnsigned64 = 23;
  30. sfLastType = 23;
  31. sfMod1 = (sfLastType + 1);
  32. sfModOther = 45;
  33. sfTypeOpenArray = 46;
  34. sfTypeStaticArray = 48;
  35. sfTypePointer = 49;
  36. sfTypeRecord = 50;
  37. sfTypeProcedure = 51;
  38. sfSysFlag = 52;
  39. sfInvisible = 53;
  40. sfHidden = 172;
  41. sfReadOnly = 54;
  42. sfObjFlag = 55;
  43. sfConst = 55;
  44. sfVar = 56;
  45. sfTypeEnumeration = 57;
  46. sfXProcedure = 58;
  47. sfOperator = 59;
  48. sfTProcedure = 60;
  49. sfCProcedure = sfTProcedure;
  50. sfAlias = 61;
  51. sfType = 62;
  52. sfEnd = 63;
  53. sfTypeOpenMathArray = 64;
  54. sfTypeTensor = 66;
  55. sfTypeStaticMathArray = 67;
  56. sfTypeAll = 68;
  57. sfTypeRange = 69;
  58. sfTypeComplex = 70;
  59. sfTypeLongcomplex = 71;
  60. sfInline = 171;
  61. sfProtected = 0;
  62. sfActive = 1;
  63. sfSafe = 2;
  64. sfClass = 16;
  65. sfDelegate = 5;
  66. sfUntraced = 4;
  67. sfWinAPIParam = 13;
  68. sfCParam = 14;
  69. sfDarwinCParam = 15;
  70. sfRealtime = 21;
  71. sfDynamic = 22;
  72. sfUnsafe = 23;
  73. sfDisposable = 24;
  74. sfFictive = 25;
  75. Undef = MIN(LONGINT);
  76. FileTag = 0BBX;
  77. NoZeroCompress = 0ADX;
  78. FileVersion* = 0B1X;
  79. FileVersionOC* = 0B2X;
  80. FileVersionCurrent* = 0B4X;
  81. TYPE
  82. TypeReference = OBJECT (SyntaxTree.Type)
  83. VAR
  84. nr: LONGINT;
  85. PROCEDURE ^ & InitTypeReference(nr: LONGINT);
  86. END TypeReference;
  87. IndexToType = OBJECT (Basic.List)
  88. PROCEDURE ^ PutType(nr: LONGINT; type: SyntaxTree.Type);
  89. PROCEDURE ^ GetType(nr: LONGINT): SyntaxTree.Type;
  90. END IndexToType;
  91. LateFix = POINTER TO RECORD
  92. p: ANY;
  93. next: LateFix;
  94. END;
  95. LateFixList = OBJECT
  96. VAR
  97. first, last: LateFix;
  98. PROCEDURE ^ & Init;
  99. PROCEDURE ^ Get(): ANY;
  100. PROCEDURE ^ Add(p: ANY);
  101. END LateFixList;
  102. Resolver = OBJECT (SyntaxTree.Visitor)
  103. VAR
  104. typeList: IndexToType;
  105. system: Global.System;
  106. typeFixes: LateFixList;
  107. checker: SemanticChecker.Checker;
  108. PROCEDURE ^ & Init(system: Global.System; symbolFile: BinarySymbolFile; importCache: SyntaxTree.ModuleScope);
  109. PROCEDURE ^ VisitType*(x: SyntaxTree.Type);
  110. PROCEDURE ^ VisitBasicType*(x: SyntaxTree.BasicType);
  111. PROCEDURE ^ VisitByteType*(x: SyntaxTree.ByteType);
  112. PROCEDURE ^ VisitBooleanType*(x: SyntaxTree.BooleanType);
  113. PROCEDURE ^ VisitSetType*(x: SyntaxTree.SetType);
  114. PROCEDURE ^ VisitAddressType*(x: SyntaxTree.AddressType);
  115. PROCEDURE ^ VisitSizeType*(x: SyntaxTree.SizeType);
  116. PROCEDURE ^ VisitAnyType*(x: SyntaxTree.AnyType);
  117. PROCEDURE ^ VisitObjectType*(x: SyntaxTree.ObjectType);
  118. PROCEDURE ^ VisitNilType*(x: SyntaxTree.NilType);
  119. PROCEDURE ^ VisitCharacterType*(x: SyntaxTree.CharacterType);
  120. PROCEDURE ^ VisitIntegerType*(x: SyntaxTree.IntegerType);
  121. PROCEDURE ^ VisitFloatType*(x: SyntaxTree.FloatType);
  122. PROCEDURE ^ VisitComplexType*(x: SyntaxTree.ComplexType);
  123. PROCEDURE ^ VisitQualifiedType*(x: SyntaxTree.QualifiedType);
  124. PROCEDURE ^ VisitStringType*(x: SyntaxTree.StringType);
  125. PROCEDURE ^ VisitRangeType*(x: SyntaxTree.RangeType);
  126. PROCEDURE ^ CheckEnumerationScope(x: SyntaxTree.EnumerationScope);
  127. PROCEDURE ^ VisitEnumerationType*(x: SyntaxTree.EnumerationType);
  128. PROCEDURE ^ VisitArrayType*(arrayType: SyntaxTree.ArrayType);
  129. PROCEDURE ^ VisitMathArrayType*(arrayType: SyntaxTree.MathArrayType);
  130. PROCEDURE ^ VisitPointerType*(pointerType: SyntaxTree.PointerType);
  131. PROCEDURE ^ FixPointerType(pointerType: SyntaxTree.PointerType);
  132. PROCEDURE ^ VisitRecordType*(recordType: SyntaxTree.RecordType);
  133. PROCEDURE ^ VisitProcedureType*(procedureType: SyntaxTree.ProcedureType);
  134. PROCEDURE ^ FixProcedureType(procedureType: SyntaxTree.ProcedureType);
  135. PROCEDURE ^ ResolveType(type: SyntaxTree.Type): SyntaxTree.Type;
  136. PROCEDURE ^ FixTypes;
  137. PROCEDURE ^ Scope(scope: SyntaxTree.Scope);
  138. PROCEDURE ^ Resolve(module: SyntaxTree.Module; typeList: IndexToType);
  139. END Resolver;
  140. Index = POINTER TO RECORD
  141. tag: LONGINT;
  142. END;
  143. TypeToIndex = OBJECT (Basic.HashTable)
  144. PROCEDURE ^ GetIndex(type: SyntaxTree.Type): LONGINT;
  145. PROCEDURE ^ PutIndex(type: SyntaxTree.Type; nr: LONGINT);
  146. END TypeToIndex;
  147. Attribute = OBJECT
  148. VAR
  149. numberTypes: LONGINT;
  150. indexToType: IndexToType;
  151. typeToIndex: TypeToIndex;
  152. PROCEDURE ^ & Init;
  153. END Attribute;
  154. IndexToAttribute = OBJECT (Basic.List)
  155. PROCEDURE ^ PutAttribute(nr: LONGINT; attribute: Attribute);
  156. PROCEDURE ^ GetAttribute(nr: LONGINT): Attribute;
  157. END IndexToAttribute;
  158. BinarySymbolFile* = OBJECT (Formats.SymbolFileFormat)
  159. VAR
  160. file-: Files.File;
  161. extension-: Basic.FileName;
  162. noRedefinition, noModification, noInterfaceCheck: BOOLEAN;
  163. version: CHAR;
  164. PROCEDURE ^ Import*(CONST moduleName: ARRAY OF CHAR; importCache: SyntaxTree.ModuleScope): SyntaxTree.Module;
  165. PROCEDURE ^ Export*(module: SyntaxTree.Module; importCache: SyntaxTree.ModuleScope): BOOLEAN;
  166. PROCEDURE ^ DefineOptions*(options: Options.Options);
  167. PROCEDURE ^ GetOptions*(options: Options.Options);
  168. END BinarySymbolFile;
  169. PROCEDURE ^ MakeFileName(VAR file: ARRAY OF CHAR; CONST name, prefix, suffix: ARRAY OF CHAR);
  170. PROCEDURE ^ OpenSymFile(CONST name, prefix, suffix: ARRAY OF CHAR; VAR r: Streams.Reader; VAR version: CHAR): BOOLEAN;
  171. PROCEDURE ^ Get*(): Formats.SymbolFileFormat;
  172. PROCEDURE ^ Test*(context: Commands.Context);
  173. BEGIN
  174. END FoxBinarySymbolFile.