FoxCompiler.Mod 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. MODULE Compiler; (** AUTHOR "fof & fn"; PURPOSE "Oberon Compiler Command Interface"; **)
  2. (* (c) fof ETH Zürich, 2008 *)
  3. IMPORT
  4. Basic := FoxBasic, Scanner := FoxScanner, Parser := FoxParser,
  5. SemanticChecker := FoxSemanticChecker, SyntaxTree := FoxSyntaxTree, Formats := FoxFormats,
  6. Streams, Commands,Diagnostics, Options, Kernel, Printout := FoxPrintout, Backend := FoxBackend,Strings, Global := FoxGlobal,
  7. Frontend := FoxFrontend, Files;
  8. CONST
  9. (* flags *)
  10. Print* = 0;
  11. Silent* = 1;
  12. Check* = 2;
  13. TraceError* = 3;
  14. Info* = 4;
  15. FindPC* = 5;
  16. Warnings*=7;
  17. ForceModuleBodies*=8;
  18. UseDarwinCCalls*=9; (* use Darwin stack alignment for ext. C procedures *) (*fld*)
  19. SingleModule*=10;
  20. Oberon07*=11;
  21. ChangeCase*=12;
  22. Cooperative*=13;
  23. CellsAreObjects*=14;
  24. DefaultBackend = "AMD";
  25. DefaultFrontend = "Oberon";
  26. TYPE
  27. SectionName = ARRAY 256 OF CHAR; (*! move *)
  28. CompilerOptions*= RECORD
  29. flags*: SET;
  30. frontend*: Frontend.Frontend;
  31. backend*: Backend.Backend;
  32. symbolFile*: Formats.SymbolFileFormat;
  33. objectFile*: Formats.ObjectFileFormat;
  34. findPC*: SectionName;
  35. documentation*: Backend.Backend;
  36. srcPath, destPath: Files.FileName;
  37. replacements: SemanticChecker.Replacement;
  38. END;
  39. PROCEDURE ParseReplacements(CONST filename: ARRAY OF CHAR; VAR replacement: SemanticChecker.Replacement; diagnostics: Diagnostics.Diagnostics): BOOLEAN;
  40. VAR reader: Streams.Reader; r: SemanticChecker.Replacement;
  41. identifier: SyntaxTree.QualifiedIdentifier;
  42. scanner: Scanner.Scanner; parser: Parser.Parser; expression: SyntaxTree.Expression;
  43. BEGIN
  44. replacement := NIL;
  45. reader := Basic.GetFileReader(filename);
  46. IF reader = NIL THEN
  47. diagnostics.Error (filename, Diagnostics.Invalid, Diagnostics.Invalid, "failed to open");
  48. ELSE
  49. NEW(scanner, filename, reader,0, diagnostics);
  50. NEW(parser, scanner, diagnostics);
  51. REPEAT (* WHILE parser.Peek(Scanner.Identifier) DO*)
  52. identifier := parser.QualifiedIdentifier();
  53. IF parser.Mandatory(Scanner.Equal) THEN
  54. expression := parser.Expression();
  55. NEW(r); identifier.GetName(r.name); r.expression := expression; r.used := FALSE;
  56. r.next := replacement; replacement := r;
  57. END;
  58. WHILE parser.Optional(Scanner.Semicolon) DO END;
  59. UNTIL ~parser.Peek(Scanner.Identifier); (*END;*)
  60. END;
  61. (*done := FALSE;
  62. WHILE reader.GetString(name) & ~done DO
  63. IF reader.GetChar(equal) & (equal = "=") & reader.GetString(value) THEN
  64. NEW(r); r.name := name; r.string := Strings.NewString(value); r.used := FALSE;
  65. r.next := replacement; replacement := r;
  66. ELSE done := TRUE;
  67. END;
  68. END;
  69. *)
  70. RETURN (replacement # NIL)
  71. END ParseReplacements;
  72. PROCEDURE Modules*(CONST source: ARRAY OF CHAR; (* source file name, for debugging and better error reports *)
  73. reader: Streams.Reader; (* reader to read from *)
  74. position: LONGINT; (* starting position in reader *)
  75. diagnostics: Diagnostics.Diagnostics; (* error output and status report *)
  76. log: Streams.Writer;
  77. CONST options: CompilerOptions;
  78. VAR importCache: SyntaxTree.ModuleScope): BOOLEAN;
  79. VAR
  80. module: SyntaxTree.Module;
  81. checker: SemanticChecker.Checker;
  82. warnings: SemanticChecker.Warnings;
  83. printer: Printout.Printer;
  84. system: Global.System;
  85. generatedModule: Formats.GeneratedModule;
  86. split: Strings.StringArray;
  87. sectionOffset: LONGINT;
  88. flags: SET;
  89. backendName: ARRAY 32 OF CHAR;
  90. PROCEDURE FinalMessage(error: BOOLEAN; CONST msg: ARRAY OF CHAR);
  91. VAR message,name: ARRAY 256 OF CHAR;
  92. BEGIN
  93. message := "";
  94. IF (module # NIL) & (module.context # SyntaxTree.invalidIdentifier) THEN
  95. Basic.GetString(module.context,message);
  96. Strings.Append (message, ".");
  97. ELSE
  98. message := "";
  99. END;
  100. IF (module # NIL) & (module.name # SyntaxTree.invalidIdentifier) THEN
  101. Basic.GetString(module.name,name);
  102. Strings.Append (message, name);
  103. END;
  104. Strings.Append (message, msg);
  105. IF error THEN
  106. IF diagnostics # NIL THEN
  107. diagnostics.Error (source, Diagnostics.Invalid, Diagnostics.Invalid, message);
  108. END;
  109. ELSE
  110. IF (log # NIL) & ~(Silent IN options.flags) & ~(FindPC IN options.flags) THEN
  111. log.String("compiling ");
  112. IF source # "" THEN log.String(source); log.String(" => "); END;
  113. log.String(message); log.Ln;
  114. log.Update;
  115. END;
  116. END;
  117. END FinalMessage;
  118. PROCEDURE PrintModule;
  119. VAR print: Streams.Writer;
  120. BEGIN
  121. print := Basic.GetWriter(Basic.GetDebugWriter("Compiler Debug Output"));
  122. IF Info IN options.flags THEN
  123. printer := Printout.NewPrinter(print,Printout.All,Info IN options.flags);
  124. ELSE
  125. printer := Printout.NewPrinter(print,Printout.SourceCode,Info IN options.flags);
  126. END;
  127. print.Ln; printer.Module(module); print.Ln;
  128. print.Update;
  129. END PrintModule;
  130. BEGIN
  131. flags := options.flags;
  132. IF options.findPC # "" THEN EXCL(flags, Warnings) END;
  133. IF TraceError IN options.flags THEN
  134. diagnostics := Basic.GetTracingDiagnostics(diagnostics)
  135. END;
  136. IF options.backend = NIL THEN
  137. system := Global.DefaultSystem()
  138. ELSE
  139. IF Oberon07 IN options.flags THEN options.backend.SetOberon07 END; (* inform the backend about that the Oberon07 mode, it will return the corresponding Sytem object *)
  140. system := options.backend.GetSystem();
  141. END;
  142. system.SetCellsAreObjects(CellsAreObjects IN flags);
  143. IF (options.objectFile # NIL) & (options.objectFile.ForceModuleBodies()) THEN INCL(flags, ForceModuleBodies) END;
  144. options.frontend.Initialize(diagnostics, reader, source, position);
  145. REPEAT
  146. (** first phase: scan and parse **)
  147. module := options.frontend.Parse();
  148. IF options.frontend.Error() THEN
  149. FinalMessage(TRUE," could not be compiled (parser errors).");
  150. RETURN FALSE;
  151. END;
  152. ASSERT(module # NIL);
  153. IF Check IN flags THEN
  154. (** second phase: check and resolve symbols **)
  155. IF (options.symbolFile # NIL) THEN
  156. options.symbolFile.Initialize(diagnostics,system,options.destPath);
  157. END;
  158. IF options.backend # NIL THEN
  159. COPY(options.backend.name, backendName);
  160. ELSE
  161. backendName := "";
  162. END;
  163. checker := SemanticChecker.NewChecker(diagnostics,Info IN flags,UseDarwinCCalls IN flags,Cooperative IN flags,system,options.symbolFile,importCache,backendName);
  164. checker.replacements := options.replacements;
  165. checker.Module(module);
  166. IF checker.error THEN
  167. FinalMessage(TRUE," could not be compiled (checker errors).");
  168. RETURN FALSE
  169. ELSIF Warnings IN flags THEN
  170. warnings := SemanticChecker.NewWarnings(diagnostics);
  171. warnings.Module(module);
  172. END;
  173. IF Print IN flags THEN
  174. IF ChangeCase IN flags THEN module.SetCase(1-module.case) END;
  175. PrintModule;
  176. IF ChangeCase IN flags THEN module.SetCase(1-module.case) END;
  177. END;
  178. (** third phase: generate code, can consist of sub-phases (such as intermediate backend / hardware backend) **)
  179. IF options.backend # NIL THEN
  180. options.backend.Initialize(diagnostics, log, flags, checker, system);
  181. IF options.findPC # "" THEN
  182. split := Strings.Split(options.findPC,":");
  183. IF LEN(split)>1 THEN
  184. Strings.StrToInt(split[1]^,sectionOffset);
  185. options.backend.FindPC(module, split[0]^,sectionOffset);
  186. IF options.backend.error THEN
  187. FinalMessage(TRUE," could not be compiled (backend errors).");
  188. RETURN FALSE
  189. ELSE
  190. RETURN TRUE
  191. END;
  192. END;
  193. END;
  194. generatedModule := options.backend.ProcessSyntaxTreeModule(module);
  195. IF options.backend.error THEN
  196. FinalMessage(TRUE, " could not be compiled (backend errors).");
  197. RETURN FALSE
  198. END;
  199. END;
  200. (** generate symbol file **)
  201. IF (options.symbolFile # NIL) & ~options.symbolFile.Export(module, importCache) THEN
  202. FinalMessage(TRUE, " could not be compiled (symbol File errors).");
  203. RETURN FALSE
  204. END;
  205. (** generate object file **)
  206. IF options.objectFile # NIL THEN
  207. options.objectFile.Initialize(diagnostics);
  208. options.objectFile.SetPath(options.destPath);
  209. IF options.findPC # "" THEN
  210. Strings.StrToInt(options.findPC, sectionOffset);
  211. generatedModule.SetFindPC(sectionOffset);
  212. END;
  213. IF generatedModule = NIL THEN
  214. FinalMessage(TRUE, " could not write object file (nothing generated).");
  215. RETURN FALSE
  216. ELSIF ~options.objectFile.Export(generatedModule,options.symbolFile) THEN
  217. FinalMessage(TRUE, " could not be compiled (object file errors).");
  218. RETURN FALSE
  219. END;
  220. END;
  221. IF options.documentation # NIL THEN
  222. options.documentation.Initialize(diagnostics,log, flags,checker,system);
  223. generatedModule := options.documentation.ProcessSyntaxTreeModule(module);
  224. END;
  225. FinalMessage(FALSE, " done.");
  226. ELSIF Print IN flags THEN
  227. IF ChangeCase IN flags THEN module.SetCase(1-module.case) END;
  228. PrintModule;
  229. FinalMessage(FALSE, " done.")
  230. ELSE
  231. FinalMessage(FALSE, " done.");
  232. END;
  233. UNTIL (SingleModule IN flags) OR options.frontend.Done();
  234. RETURN TRUE;
  235. END Modules;
  236. PROCEDURE GetOptions*(input: Streams.Reader; error:Streams.Writer; diagnostics: Diagnostics.Diagnostics;
  237. VAR compilerOptions: CompilerOptions): BOOLEAN;
  238. VAR options: Options.Options; name: ARRAY 256 OF CHAR; result: BOOLEAN; position: LONGINT;
  239. defaults: Streams.Reader;
  240. parsed: BOOLEAN;
  241. PROCEDURE Error(CONST error: ARRAY OF CHAR);
  242. BEGIN
  243. IF diagnostics # NIL THEN
  244. diagnostics.Error("",Diagnostics.Invalid,Diagnostics.Invalid,error);
  245. END;
  246. END Error;
  247. BEGIN
  248. result := TRUE;
  249. NEW(options);
  250. options.Add("p","platform",Options.String);
  251. options.Add(0X,"showOptions",Options.Flag);
  252. options.Add(0X,"print",Options.Flag);
  253. options.Add(0X,"Print",Options.Flag);
  254. options.Add(0X,"silent",Options.Flag);
  255. options.Add("c","check",Options.Flag);
  256. options.Add("e","traceError",Options.Flag);
  257. options.Add("I","interface",Options.Flag);
  258. options.Add("i","info",Options.Flag);
  259. options.Add(0X,"oberon07",Options.Flag);
  260. options.Add("b","backend",Options.String);
  261. options.Add("F","frontEnd",Options.String);
  262. options.Add("f","findPC",Options.String);
  263. options.Add(0X,"singleModule",Options.Flag);
  264. options.Add(0X, "symbolFile", Options.String);
  265. options.Add(0X, "objectFile", Options.String);
  266. options.Add("w","warnings", Options.Flag);
  267. options.Add(0X,"darwinHost", Options.Flag);
  268. options.Add(0X,"hardware", Options.String);
  269. options.Add("d","documentation", Options.String);
  270. options.Add("S","srcPath", Options.String);
  271. options.Add("D","destPath", Options.String);
  272. options.Add(0X,"replacements", Options.String);
  273. options.Add(0X,"cooperative", Options.Flag);
  274. position := input.Pos();
  275. parsed := options.Parse(input,NIL);
  276. IF options.GetString("platform", name) THEN
  277. defaults := platforms.Get(name);
  278. IF defaults = NIL THEN
  279. error.String("Unknown platform"); error.Ln
  280. ELSE
  281. parsed := options.Parse(defaults, NIL) & parsed;
  282. input.SetPos(position);
  283. parsed := options.Parse(input, NIL) & parsed; (* reparse overwrites *)
  284. END;
  285. ELSE
  286. defaults := NIL;
  287. END;
  288. IF options.GetString("b", name) THEN
  289. IF name = "" THEN compilerOptions.backend := NIL
  290. ELSE
  291. compilerOptions.backend := Backend.GetBackendByName(name);
  292. IF (compilerOptions.backend = NIL) THEN
  293. Error("backend could not be installed"); result := FALSE;
  294. END;
  295. END;
  296. ELSE compilerOptions.backend := Backend.GetBackendByName(DefaultBackend);
  297. IF compilerOptions.backend = NIL THEN Error("default backend could not be installed"); result := FALSE END;
  298. END;
  299. IF options.GetString("F", name) THEN
  300. IF name = "" THEN compilerOptions.frontend := NIL
  301. ELSE
  302. compilerOptions.frontend := Frontend.GetFrontendByName(name);
  303. IF (compilerOptions.frontend = NIL) THEN
  304. Error("backend could not be installed"); result := FALSE;
  305. END;
  306. END;
  307. ELSE compilerOptions.frontend := Frontend.GetFrontendByName(DefaultFrontend);
  308. IF compilerOptions.frontend = NIL THEN Error("default frontend could not be installed"); result := FALSE END;
  309. END;
  310. IF options.GetString("objectFile",name) THEN
  311. IF name = "" THEN compilerOptions.objectFile := NIL
  312. ELSE
  313. compilerOptions.objectFile := Formats.GetObjectFileFormat(name);
  314. IF compilerOptions.objectFile = NIL THEN Error("object file format could not be installed"); result := FALSE END;
  315. END;
  316. ELSIF compilerOptions.backend # NIL THEN
  317. compilerOptions.objectFile := compilerOptions.backend.DefaultObjectFileFormat();
  318. END;
  319. IF options.GetString("symbolFile",name) THEN
  320. IF name = "" THEN compilerOptions.symbolFile := NIL
  321. ELSE
  322. compilerOptions.symbolFile := Formats.GetSymbolFileFormat(name);
  323. IF compilerOptions.symbolFile = NIL THEN Error("symbol file format could not be installed"); result := FALSE END;
  324. END;
  325. ELSIF compilerOptions.backend # NIL THEN
  326. compilerOptions.symbolFile := compilerOptions.backend.DefaultSymbolFileFormat();
  327. IF (compilerOptions.symbolFile = NIL) & (compilerOptions.objectFile # NIL) THEN
  328. compilerOptions.symbolFile := compilerOptions.objectFile.DefaultSymbolFileFormat();
  329. END;
  330. ELSIF compilerOptions.objectFile # NIL THEN
  331. compilerOptions.symbolFile := compilerOptions.objectFile.DefaultSymbolFileFormat();
  332. END;
  333. IF options.GetString("d", name) THEN
  334. compilerOptions.documentation := Backend.GetBackendByName("Documentation");
  335. IF (compilerOptions.documentation = NIL) THEN
  336. Error("documentation engine could not be installed"); result := FALSE;
  337. END;
  338. ELSE
  339. compilerOptions.documentation := NIL
  340. END;
  341. IF options.GetString("replacements", name) THEN
  342. IF ~ParseReplacements(name, compilerOptions.replacements, diagnostics) THEN
  343. Error("replacement file could not be opened or is empty"); result := FALSE;
  344. END;
  345. ELSE compilerOptions.replacements := NIL
  346. END;
  347. IF compilerOptions.backend # NIL THEN compilerOptions.backend.DefineOptions (options); INCL(compilerOptions.flags,Check); END;
  348. IF compilerOptions.symbolFile # NIL THEN compilerOptions.symbolFile.DefineOptions(options); INCL(compilerOptions.flags,Check) END;
  349. IF compilerOptions.objectFile # NIL THEN compilerOptions.objectFile.DefineOptions(options); INCL(compilerOptions.flags,Check) END;
  350. IF compilerOptions.documentation # NIL THEN compilerOptions.documentation.DefineOptions(options) END;
  351. IF result & ~parsed THEN
  352. options.Clear;
  353. IF defaults # NIL THEN
  354. defaults.SetPos(0);
  355. parsed := options.Parse(defaults, error);
  356. END;
  357. input.SetPos(position);
  358. result := options.Parse(input,error)
  359. END;
  360. IF result THEN
  361. IF options.GetFlag("print") THEN INCL(compilerOptions.flags, Print) END;
  362. IF options.GetFlag("Print") THEN INCL(compilerOptions.flags, Print); INCL(compilerOptions.flags, ChangeCase) END;
  363. IF options.GetFlag("silent") THEN INCL(compilerOptions.flags, Silent) END;
  364. IF options.GetFlag("check") THEN INCL(compilerOptions.flags, Check) END;
  365. IF options.GetFlag("traceError") THEN INCL(compilerOptions.flags, TraceError) END;
  366. IF options.GetFlag("info") THEN INCL(compilerOptions.flags,Info) END;
  367. IF options.GetString("findPC",compilerOptions.findPC) THEN INCL(compilerOptions.flags,FindPC) END;
  368. IF options.GetFlag("warnings") THEN INCL(compilerOptions.flags, Warnings) END;
  369. IF options.GetFlag("darwinHost") THEN INCL(compilerOptions.flags,UseDarwinCCalls) END; (*fld*)
  370. IF options.GetFlag("singleModule") THEN INCL(compilerOptions.flags,SingleModule) END;
  371. IF options.GetFlag("oberon07") THEN INCL(compilerOptions.flags, Oberon07) END;
  372. IF options.GetFlag("cooperative") THEN INCL(compilerOptions.flags, Cooperative) END;
  373. IF options.GetFlag("cellsAreObjects") THEN INCL(compilerOptions.flags, CellsAreObjects) END;
  374. IF ~options.GetString("srcPath", compilerOptions.srcPath) THEN compilerOptions.srcPath := "" END;
  375. IF ~options.GetString("destPath", compilerOptions.destPath) THEN compilerOptions.destPath := "" END;
  376. IF compilerOptions.backend # NIL THEN compilerOptions.backend.GetOptions (options) END;
  377. IF compilerOptions.symbolFile # NIL THEN compilerOptions.symbolFile.GetOptions(options) END;
  378. IF compilerOptions.objectFile # NIL THEN compilerOptions.objectFile.GetOptions(options) END;
  379. IF compilerOptions.documentation # NIL THEN compilerOptions.documentation.GetOptions(options) END;
  380. END;
  381. IF options.GetFlag("showOptions") THEN options.Show(error) END;
  382. RETURN result
  383. END GetOptions;
  384. PROCEDURE Compile*(context : Commands.Context);
  385. VAR
  386. filename, path, file: Files.FileName;
  387. error: BOOLEAN;
  388. diagnostics: Diagnostics.Diagnostics;
  389. time: LONGINT; reader: Streams.Reader;
  390. importCache: SyntaxTree.ModuleScope;
  391. options: CompilerOptions;
  392. replacement: SemanticChecker.Replacement;
  393. name: ARRAY 128 OF CHAR;
  394. BEGIN
  395. error := FALSE;
  396. diagnostics := Basic.GetDiagnostics(context.error);
  397. IF GetOptions(context.arg,context.error,diagnostics,options) THEN
  398. time := Kernel.GetTicks();
  399. WHILE Basic.GetStringParameter(context.arg,filename) & ~error DO
  400. IF options.srcPath # "" THEN
  401. Files.SplitPath(filename, path, file);
  402. IF path = "" THEN Files.JoinPath(options.srcPath, file, filename) END;
  403. END;
  404. reader := Basic.GetFileReader(filename);
  405. IF reader = NIL THEN
  406. diagnostics.Error (filename, Diagnostics.Invalid, Diagnostics.Invalid, "failed to open"); error := TRUE;
  407. ELSE
  408. error := ~Modules(filename, reader, 0, diagnostics,context.out, options, importCache);
  409. END;
  410. context.out.Update;
  411. context.error.Update;
  412. END;
  413. IF Silent IN options.flags THEN
  414. time := Kernel.GetTicks()-time;
  415. context.out.Ln; context.out.String("compiler elapsed ms"); context.out.Int(time,10);
  416. END;
  417. IF ~error THEN
  418. replacement := options.replacements;
  419. WHILE replacement # NIL DO
  420. IF ~replacement.used THEN
  421. name := replacement.name;
  422. diagnostics.Warning(name, Diagnostics.Invalid, Diagnostics.Invalid, " unused replacement.");
  423. END;
  424. replacement := replacement.next;
  425. END;
  426. END;
  427. END;
  428. IF error THEN context.result := -1 ELSE context.result := Commands.Ok END;
  429. END Compile;
  430. PROCEDURE CompileReader*(context: Commands.Context; reader: Streams.Reader);
  431. VAR
  432. filename: ARRAY 256 OF CHAR;
  433. error: BOOLEAN;
  434. diagnostics: Diagnostics.Diagnostics;
  435. importCache: SyntaxTree.ModuleScope;
  436. options: CompilerOptions;
  437. BEGIN
  438. error := FALSE;
  439. diagnostics := Basic.GetDiagnostics(context.error);
  440. IF GetOptions(context.arg,context.error,diagnostics,options) THEN
  441. IF reader = NIL THEN
  442. diagnostics.Error (filename, Diagnostics.Invalid, Diagnostics.Invalid, "failed to open"); error := TRUE;
  443. ELSE
  444. error := ~Modules(filename, reader, 0, diagnostics, context.out, options, importCache);
  445. END;
  446. context.out.Update;
  447. END;
  448. END CompileReader;
  449. VAR platforms: Options.Defaults;
  450. PROCEDURE AddPlatform(CONST name: ARRAY OF CHAR; CONST defaults: ARRAY OF CHAR);
  451. BEGIN
  452. platforms.Add(name, defaults);
  453. END AddPlatform;
  454. PROCEDURE ShowDefaults*(context: Commands.Context);
  455. BEGIN
  456. platforms.Show(context.out)
  457. END ShowDefaults;
  458. BEGIN
  459. NEW(platforms);
  460. (* platform definitions hard coded for the common cases -- maybe (parts of it) should be outsourced to a file ?*)
  461. AddPlatform("Win32","-b=AMD --objectFile=Binary --symbolFile=Binary --objectFileExtensions=.Obw --symbolFileExtension=.Obw");
  462. AddPlatform("Win32G","-b=AMD --objectFile=Generic --symbolFile=Textual --newObjectFile --mergeSections --objectFileExtension=.GofW --symbolFileExtension=.SymW --preciseGC");
  463. AddPlatform("ARM","-b=ARM --objectFile=Generic --newObjectFile --metaData=simple --objectFileExtension=.Goa --symbolFileExtension=.Sya");
  464. AddPlatform("Minos","-b=ARM --objectFile=Minos");
  465. AddPlatform("TRM","-b=TRM --objectFile=Generic --newObjectFile --metaData=simple --objectFileExtension=.GofT --symbolFileExtension=.SymT");
  466. AddPlatform("TRMI","-b=TRM --objectFile=Intermediate --newObjectFile --metaData=simple --objectFileExtension=.IroT --symbolFileExtension=.IrsT");
  467. AddPlatform("A2","-b=AMD --objectFile=Binary --objectFileExtension=.Obx --symbolFileExtension=.Obx");
  468. AddPlatform("A2G","-b=AMD --objectFile=Generic --newObjectFile --mergeSections --objectFileExtension=.GofG --symbolFileExtension=.SymG");
  469. AddPlatform("A2Coop","-b=AMD --cooperative --objectFile=Generic --newObjectFile --traceModule=Trace --mergeSections");
  470. AddPlatform("ARMA2","-b=ARM --objectFile=Generic --newObjectFile --symbolFile=Textual --mergeSections");
  471. AddPlatform("Linux32G","-b=AMD --objectFile=Generic --newObjectFile --traceModule=Trace --symbolFile=Textual --objectFileExtension=.GofU --symbolFileExtension=.SymU --preciseGC");
  472. END Compiler.