systems.pas 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833
  1. {
  2. $Id$
  3. Copyright (C) 1995,97 by Florian Klaempfl
  4. This unit contains information about the target systems supported
  5. (these are not processor specific)
  6. This progsam is free software; you can redistribute it and/or modify
  7. iu under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge- MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit systems;
  20. interface
  21. type
  22. tendian = (endian_little,endian_big);
  23. ttargetcpu=(no_cpu
  24. ,i386,m68k,alpha
  25. );
  26. tprocessors = (no_processor
  27. ,Class386,ClassP5,ClassP6
  28. ,MC68000,MC68100,MC68020
  29. );
  30. tsection=(sec_none,
  31. sec_code,sec_data,sec_bss,
  32. sec_idata2,sec_idata4,sec_idata5,sec_idata6,sec_idata7,sec_edata,
  33. sec_stab,sec_stabstr
  34. );
  35. type
  36. tasmmode= (asmmode_none
  37. ,asmmode_i386_direct,asmmode_i386_att,asmmode_i386_intel
  38. ,asmmode_m68k_mot
  39. );
  40. const
  41. {$ifdef i386} i386asmmodecnt=3; {$else} i386asmmodecnt=0; {$endif}
  42. {$ifdef m68k} m68kasmmodecnt=1; {$else} m68kasmmodecnt=0; {$endif}
  43. asmmodecnt=i386asmmodecnt+m68kasmmodecnt+1;
  44. type
  45. ttarget = (target_none
  46. ,target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
  47. target_i386_OS2,target_i386_Win32
  48. ,target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac,
  49. target_m68k_linux,target_m68k_PalmOS
  50. );
  51. ttargetflags = (tf_needs_isconsole,tf_supports_stack_checking);
  52. const
  53. {$ifdef i386} i386targetcnt=5; {$else} i386targetcnt=0; {$endif}
  54. {$ifdef m68k} m68ktargetcnt=5; {$else} m68ktargetcnt=0; {$endif}
  55. targetcnt=i386targetcnt+m68ktargetcnt+1;
  56. type
  57. tasm = (as_none
  58. ,as_i386_as,as_i386_as_aout,as_i386_asw,
  59. as_i386_nasmcoff,as_i386_nasmelf,as_i386_nasmobj,
  60. as_i386_tasm,as_i386_masm,
  61. as_i386_dbg,as_i386_coff,as_i386_pecoff
  62. ,as_m68k_as,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw
  63. );
  64. { binary assembler writers, needed to test for -a }
  65. const
  66. {$ifdef i386} i386asmcnt=11; {$else} i386asmcnt=0; {$endif}
  67. {$ifdef m68k} m68kasmcnt=5; {$else} m68kasmcnt=0; {$endif}
  68. asmcnt=i386asmcnt+m68kasmcnt+1;
  69. binassem : set of tasm = [
  70. as_i386_dbg,as_i386_coff,as_i386_pecoff
  71. ];
  72. type
  73. tlink = (link_none
  74. ,link_i386_ld,link_i386_ldgo32v1,
  75. link_i386_ldgo32v2,link_i386_ldw,
  76. link_i386_ldos2
  77. ,link_m68k_ld
  78. );
  79. const
  80. {$ifdef i386} i386linkcnt=5; {$else} i386linkcnt=0; {$endif}
  81. {$ifdef m68k} m68klinkcnt=1; {$else} m68klinkcnt=0; {$endif}
  82. linkcnt=i386linkcnt+m68klinkcnt+1;
  83. type
  84. tar = (ar_none
  85. ,ar_i386_ar,ar_i386_arw
  86. ,ar_m68k_ar
  87. );
  88. const
  89. {$ifdef i386} i386arcnt=2; {$else} i386arcnt=0; {$endif}
  90. {$ifdef m68k} m68karcnt=1; {$else} m68karcnt=0; {$endif}
  91. arcnt=i386arcnt+m68karcnt+1;
  92. type
  93. tres = (res_none
  94. ,res_i386_windres
  95. );
  96. const
  97. {$ifdef i386} i386rescnt=1; {$else} i386rescnt=0; {$endif}
  98. {$ifdef m68k} m68krescnt=0; {$else} m68krescnt=0; {$endif}
  99. rescnt=i386rescnt+m68krescnt+1;
  100. type
  101. tos = ( os_none,
  102. os_i386_GO32V1,os_i386_GO32V2,os_i386_Linux,os_i386_OS2,
  103. os_i386_Win32,
  104. os_m68k_Amiga,os_m68k_Atari,os_m68k_Mac,os_m68k_Linux,
  105. os_m68k_PalmOS
  106. );
  107. const
  108. i386oscnt=5;
  109. m68koscnt=5;
  110. oscnt=i386oscnt+m68koscnt+1;
  111. type
  112. tosinfo = packed record
  113. id : tos;
  114. name : string[30];
  115. shortname : string[8];
  116. sharedlibext : string[10];
  117. staticlibext,
  118. sourceext,
  119. pasext,
  120. exeext,
  121. defext,
  122. scriptext : string[4];
  123. libprefix : string[3];
  124. Cprefix : string[2];
  125. newline : string[2];
  126. endian : tendian;
  127. stackalignment : {longint this is a little overkill no ?? }byte;
  128. size_of_pointer : byte;
  129. size_of_longint : byte;
  130. use_bound_instruction : boolean;
  131. use_function_relative_addresses : boolean;
  132. end;
  133. tasminfo = packed record
  134. id : tasm;
  135. idtxt : string[8];
  136. asmbin : string[8];
  137. asmcmd : string[50];
  138. allowdirect,
  139. externals,
  140. needar : boolean;
  141. labelprefix : string[2];
  142. comment : string[2];
  143. secnames : array[tsection] of string[20];
  144. end;
  145. tlinkinfo = packed record
  146. id : tlink;
  147. linkbin : string[8];
  148. linkcmd : string[127];
  149. binders : word;
  150. bindbin : array[1..2]of string[8];
  151. bindcmd : array[1..2]of string[127];
  152. stripopt : string[2];
  153. stripbind : boolean; { Strip symbols in binder? }
  154. libpathprefix : string[13];
  155. libpathsuffix : string[2];
  156. groupstart : string[8];
  157. groupend : string[2];
  158. inputstart : string[8];
  159. inputend : string[2];
  160. libprefix : string[2];
  161. end;
  162. tarinfo = packed record
  163. id : tar;
  164. arbin : string[8];
  165. arcmd : string[50];
  166. end;
  167. tresinfo = packed record
  168. id : tres;
  169. resbin : string[8];
  170. rescmd : string[50];
  171. end;
  172. ttargetinfo = packed record
  173. target : ttarget;
  174. flags : set of ttargetflags;
  175. cpu : ttargetcpu;
  176. short_name : string[8];
  177. unit_env : string[12];
  178. system_unit : string[8];
  179. smartext,
  180. unitext,
  181. unitlibext,
  182. asmext,
  183. objext,
  184. resext,
  185. resobjext,
  186. exeext : string[4];
  187. os : tos;
  188. link : tlink;
  189. assem : tasm;
  190. assemsrc : tasm; { default source writing assembler }
  191. ar : tar;
  192. res : tres;
  193. heapsize,
  194. maxheapsize,
  195. stacksize : longint;
  196. end;
  197. tasmmodeinfo=packed record
  198. id : tasmmode;
  199. idtxt : string[8];
  200. end;
  201. var
  202. target_cpu : ttargetcpu;
  203. target_info : ttargetinfo;
  204. target_os : tosinfo;
  205. target_asm : tasminfo;
  206. target_link : tlinkinfo;
  207. target_ar : tarinfo;
  208. target_res : tresinfo;
  209. source_os : tosinfo;
  210. function set_target_os(t:tos):boolean;
  211. function set_target_asm(t:tasm):boolean;
  212. function set_target_link(t:tlink):boolean;
  213. function set_target_ar(t:tar):boolean;
  214. function set_target_res(t:tres):boolean;
  215. function set_target_info(t:ttarget):boolean;
  216. function set_string_target(s : string) : boolean;
  217. function set_string_asm(s : string) : boolean;
  218. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  219. procedure InitSystems;
  220. implementation
  221. const
  222. {****************************************************************************
  223. OS Info
  224. ****************************************************************************}
  225. os_infos : array[1..oscnt] of tosinfo = (
  226. (
  227. id : os_none;
  228. name : 'No operating system';
  229. shortname : 'none'
  230. ),
  231. (
  232. id : os_i386_go32v1;
  233. name : 'GO32 V1 DOS extender';
  234. shortname : 'go32v1';
  235. sharedlibext : '.dll';
  236. staticlibext : '.a';
  237. sourceext : '.pp';
  238. pasext : '.pas';
  239. exeext : ''; { No .exe, the linker only output a.out ! }
  240. defext : '.def';
  241. scriptext : '.bat';
  242. libprefix : '';
  243. Cprefix : '_';
  244. newline : #13#10;
  245. endian : endian_little;
  246. stackalignment : 2;
  247. size_of_pointer : 4;
  248. size_of_longint : 4;
  249. use_bound_instruction : false;
  250. use_function_relative_addresses : true
  251. ),
  252. (
  253. id : os_i386_go32v2;
  254. name : 'GO32 V2 DOS extender';
  255. shortname : 'go32v2';
  256. sharedlibext : '.dll';
  257. staticlibext : '.a';
  258. sourceext : '.pp';
  259. pasext : '.pas';
  260. exeext : '.exe';
  261. defext : '.def';
  262. scriptext : '.bat';
  263. libprefix : '';
  264. Cprefix : '_';
  265. newline : #13#10;
  266. endian : endian_little;
  267. stackalignment : 2;
  268. size_of_pointer : 4;
  269. size_of_longint : 4;
  270. use_bound_instruction : false;
  271. use_function_relative_addresses : true
  272. ),
  273. (
  274. id : os_i386_linux;
  275. name : 'Linux for i386';
  276. shortname : 'linux';
  277. sharedlibext : '.so';
  278. staticlibext : '.a';
  279. sourceext : '.pp';
  280. pasext : '.pas';
  281. exeext : '';
  282. defext : '.def';
  283. scriptext : '.sh';
  284. libprefix : 'lib';
  285. Cprefix : '';
  286. newline : #10;
  287. endian : endian_little;
  288. stackalignment : 4;
  289. size_of_pointer : 4;
  290. size_of_longint : 4;
  291. use_bound_instruction : false;
  292. use_function_relative_addresses : true
  293. ),
  294. (
  295. id : os_i386_os2;
  296. name : 'OS/2 via EMX';
  297. shortname : 'os2';
  298. sharedlibext : '.ao2';
  299. staticlibext : '.ao2';
  300. sourceext : '.pas';
  301. pasext : '.pp';
  302. exeext : '.exe';
  303. defext : '.def';
  304. scriptext : '.cmd';
  305. libprefix : '';
  306. Cprefix : '_';
  307. newline : #13#10;
  308. endian : endian_little;
  309. stackalignment : 2;
  310. size_of_pointer : 4;
  311. size_of_longint : 4;
  312. use_bound_instruction : false;
  313. use_function_relative_addresses : false
  314. ),
  315. (
  316. id : os_i386_win32;
  317. name : 'Win32 for i386';
  318. shortname : 'win32';
  319. sharedlibext : '.dll';
  320. staticlibext : '.aw';
  321. sourceext : '.pp';
  322. pasext : '.pas';
  323. exeext : '.exe';
  324. defext : '.def';
  325. scriptext : '.bat';
  326. libprefix : 'lib';
  327. Cprefix : '_';
  328. newline : #13#10;
  329. endian : endian_little;
  330. stackalignment : 4;
  331. size_of_pointer : 4;
  332. size_of_longint : 4;
  333. use_bound_instruction : false;
  334. use_function_relative_addresses : true
  335. ),
  336. (
  337. id : os_m68k_amiga;
  338. name : 'Commodore Amiga';
  339. shortname : 'amiga';
  340. sharedlibext : '.library';
  341. staticlibext : '.a';
  342. sourceext : '.pp';
  343. pasext : '.pas';
  344. exeext : '';
  345. defext : '';
  346. scriptext : '';
  347. libprefix : '';
  348. Cprefix : '_';
  349. newline : #10;
  350. endian : endian_big;
  351. stackalignment : 2;
  352. size_of_pointer : 4;
  353. size_of_longint : 4;
  354. use_bound_instruction : false;
  355. use_function_relative_addresses : false
  356. ),
  357. (
  358. id : os_m68k_atari;
  359. name : 'Atari ST/STE';
  360. shortname : 'atari';
  361. sharedlibext : '.dll';
  362. staticlibext : '.a';
  363. sourceext : '.pp';
  364. pasext : '.pas';
  365. exeext : '.tpp';
  366. defext : '';
  367. scriptext : '';
  368. libprefix : '';
  369. Cprefix : '_';
  370. newline : #10;
  371. endian : endian_big;
  372. stackalignment : 2;
  373. size_of_pointer : 4;
  374. size_of_longint : 4;
  375. use_bound_instruction : false;
  376. use_function_relative_addresses : false
  377. ),
  378. (
  379. id : os_m68k_mac;
  380. name : 'Macintosh m68k';
  381. shortname : 'mac';
  382. sharedlibext : '.dll';
  383. staticlibext : '.a';
  384. sourceext : '.pp';
  385. pasext : '.pas';
  386. exeext : '.tpp';
  387. defext : '';
  388. scriptext : '';
  389. libprefix : '';
  390. Cprefix : '_';
  391. newline : #13;
  392. endian : endian_big;
  393. stackalignment : 2;
  394. size_of_pointer : 4;
  395. size_of_longint : 4;
  396. use_bound_instruction : false;
  397. use_function_relative_addresses : false
  398. ),
  399. (
  400. id : os_m68k_linux;
  401. name : 'Linux for m68k';
  402. shortname : 'linux';
  403. sharedlibext : '.so';
  404. staticlibext : '.a';
  405. sourceext : '.pp';
  406. pasext : '.pas';
  407. exeext : '';
  408. defext : '';
  409. scriptext : '.sh';
  410. libprefix : 'lib';
  411. Cprefix : '';
  412. newline : #10;
  413. endian : endian_big;
  414. stackalignment : 2;
  415. size_of_pointer : 4;
  416. size_of_longint : 4;
  417. use_bound_instruction : false;
  418. use_function_relative_addresses : true
  419. ),
  420. (
  421. id : os_m68k_palmos;
  422. name : 'PalmOS';
  423. shortname : 'palmos';
  424. sharedlibext : '.so';
  425. staticlibext : '.a';
  426. sourceext : '.pp';
  427. pasext : '.pas';
  428. exeext : '';
  429. defext : '';
  430. scriptext : '.sh';
  431. libprefix : 'lib';
  432. Cprefix : '_';
  433. newline : #10;
  434. endian : endian_big;
  435. stackalignment : 2;
  436. size_of_pointer : 4;
  437. size_of_longint : 4;
  438. use_bound_instruction : false;
  439. use_function_relative_addresses : false
  440. )
  441. );
  442. {****************************************************************************
  443. Assembler Info
  444. ****************************************************************************}
  445. as_infos : array[1..asmcnt] of tasminfo = (
  446. (
  447. id : as_none;
  448. idtxt : 'no'
  449. )
  450. {$ifdef i386}
  451. ,(
  452. id : as_i386_as;
  453. idtxt : 'AS';
  454. asmbin : 'as';
  455. asmcmd : '-o $OBJ $ASM';
  456. allowdirect : true;
  457. externals : false;
  458. needar : true;
  459. labelprefix : '.L';
  460. comment : '# ';
  461. secnames : ('',
  462. '.text','.data','.bss',
  463. '','','','','','',
  464. '.stab','.stabstr')
  465. )
  466. ,(
  467. id : as_i386_as_aout;
  468. idtxt : 'AS_AOUT';
  469. asmbin : 'as';
  470. asmcmd : '-o $OBJ $ASM';
  471. allowdirect : true;
  472. externals : false;
  473. needar : true;
  474. labelprefix : 'L';
  475. comment : '# ';
  476. secnames : ('',
  477. '.text','.data','.bss',
  478. '','','','','','',
  479. '.stab','.stabstr')
  480. )
  481. ,(
  482. id : as_i386_asw;
  483. idtxt : 'ASW';
  484. asmbin : 'asw';
  485. asmcmd : '-o $OBJ $ASM';
  486. allowdirect : true;
  487. externals : false;
  488. needar : true;
  489. labelprefix : '.L';
  490. comment : '# ';
  491. secnames : ('',
  492. '.text','.data','.section .bss',
  493. '.section .idata$2','.section .idata$4','.section .idata$5',
  494. '.section .idata$6','.section .idata$7','.section .edata',
  495. '.stab','.stabstr')
  496. )
  497. ,(
  498. id : as_i386_nasmcoff;
  499. idtxt : 'NASMCOFF';
  500. asmbin : 'nasm';
  501. asmcmd : '-f coff -o $OBJ $ASM';
  502. allowdirect : true;
  503. externals : true;
  504. needar : true;
  505. labelprefix : 'L';
  506. comment : '; ';
  507. secnames : ('',
  508. '.text','.data','.bss',
  509. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  510. '.stab','.stabstr')
  511. )
  512. ,(
  513. id : as_i386_nasmelf;
  514. idtxt : 'NASMELF';
  515. asmbin : 'nasm';
  516. asmcmd : '-f elf -o $OBJ $ASM';
  517. allowdirect : true;
  518. externals : true;
  519. needar : true;
  520. labelprefix : 'L';
  521. comment : '; ';
  522. secnames : ('',
  523. '.text','.data','.bss',
  524. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  525. '.stab','.stabstr')
  526. )
  527. ,(
  528. id : as_i386_nasmobj;
  529. idtxt : 'NASMOBJ';
  530. asmbin : 'nasm';
  531. asmcmd : '-f obj -o $OBJ $ASM';
  532. allowdirect : true;
  533. externals : true;
  534. needar : true;
  535. labelprefix : 'L';
  536. comment : '; ';
  537. secnames : ('',
  538. '.text','.data','.bss',
  539. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  540. '.stab','.stabstr')
  541. )
  542. ,(
  543. id : as_i386_tasm;
  544. idtxt : 'TASM';
  545. asmbin : 'tasm';
  546. asmcmd : '/m2 $ASM $OBJ';
  547. allowdirect : true;
  548. externals : true;
  549. needar : true;
  550. labelprefix : '@@';
  551. comment : '; ';
  552. secnames : ('',
  553. 'CODE','DATA','BSS',
  554. '','','','','','',
  555. '','')
  556. )
  557. ,(
  558. id : as_i386_masm;
  559. idtxt : 'MASM';
  560. asmbin : 'masm';
  561. asmcmd : '$ASM $OBJ';
  562. allowdirect : true;
  563. externals : true;
  564. needar : true;
  565. labelprefix : '.L';
  566. comment : '; ';
  567. secnames : ('',
  568. 'CODE','DATA','BSS',
  569. '','','','','','',
  570. '','')
  571. )
  572. ,(
  573. id : as_i386_dbg;
  574. idtxt : 'DBG';
  575. asmbin : '';
  576. asmcmd : '';
  577. allowdirect : false;
  578. externals : true;
  579. needar : false;
  580. labelprefix : 'L';
  581. comment : '';
  582. secnames : ('',
  583. '.text','.data','.bss',
  584. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  585. '.stab','.stabstr')
  586. )
  587. ,(
  588. id : as_i386_coff;
  589. idtxt : 'COFF';
  590. asmbin : '';
  591. asmcmd : '';
  592. allowdirect : false;
  593. externals : true;
  594. needar : false;
  595. labelprefix : '.L';
  596. comment : '';
  597. secnames : ('',
  598. '.text','.data','.bss',
  599. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  600. '.stab','.stabstr')
  601. )
  602. ,(
  603. id : as_i386_pecoff;
  604. idtxt : 'PECOFF';
  605. asmbin : '';
  606. asmcmd : '';
  607. allowdirect : false;
  608. externals : true;
  609. needar : false;
  610. labelprefix : '.L';
  611. comment : '';
  612. secnames : ('',
  613. '.text','.data','.bss',
  614. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  615. '.stab','.stabstr')
  616. )
  617. {$endif i386}
  618. {$ifdef m68k}
  619. ,(
  620. id : as_m68k_as;
  621. idtxt : 'AS';
  622. asmbin : 'as';
  623. asmcmd : '-o $OBJ $ASM';
  624. allowdirect : true;
  625. externals : false;
  626. needar : true;
  627. labelprefix : '.L';
  628. comment : '# ';
  629. secnames : ('',
  630. '.text','.data','.bss',
  631. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  632. '.stab','.stabstr')
  633. )
  634. ,(
  635. id : as_m68k_gas;
  636. idtxt : 'GAS';
  637. asmbin : 'as68k'; { Gas for the Amiga}
  638. asmcmd : '--register-prefix-optional -o $OBJ $ASM';
  639. allowdirect : true;
  640. externals : false;
  641. needar : true;
  642. labelprefix : '.L';
  643. comment : '| ';
  644. secnames : ('',
  645. '.text','.data','.bss',
  646. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  647. '.stab','.stabstr')
  648. )
  649. ,(
  650. id : as_m68k_mit;
  651. idtxt : 'MIT';
  652. asmbin : '';
  653. asmcmd : '-o $OBJ $ASM';
  654. allowdirect : true;
  655. externals : false;
  656. needar : true;
  657. labelprefix : '.L';
  658. comment : '| ';
  659. secnames : ('',
  660. '.text','.data','.bss',
  661. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  662. '.stab','.stabstr')
  663. )
  664. ,(
  665. id : as_m68k_mot;
  666. idtxt : 'MOT';
  667. asmbin : '';
  668. asmcmd : '-o $OBJ $ASM';
  669. allowdirect : true;
  670. externals : false;
  671. needar : true;
  672. labelprefix : '__L';
  673. comment : '| ';
  674. secnames : ('',
  675. '.text','.data','.bss',
  676. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  677. '.stab','.stabstr')
  678. )
  679. ,(
  680. id : as_m68k_mpw;
  681. idtxt : 'MPW';
  682. asmbin : '';
  683. asmcmd : '-model far -o $OBJ $ASM';
  684. allowdirect : true;
  685. externals : false;
  686. needar : true;
  687. labelprefix : '__L';
  688. comment : '| ';
  689. secnames : ('',
  690. '.text','.data','.bss',
  691. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  692. '.stab','.stabstr')
  693. )
  694. {$endif m68k}
  695. );
  696. {****************************************************************************
  697. Linker Info
  698. ****************************************************************************}
  699. link_infos : array[1..linkcnt] of tlinkinfo = (
  700. (
  701. id : link_none
  702. )
  703. {$ifdef i386}
  704. ,(
  705. id : link_i386_ld;
  706. linkbin : 'ld';
  707. linkcmd : '$OPT -o $EXE $RES';
  708. binders : 0;
  709. bindbin : ('','');
  710. bindcmd : ('','');
  711. stripopt : '-s';
  712. stripbind : false;
  713. libpathprefix : 'SEARCH_DIR(';
  714. libpathsuffix : ')';
  715. groupstart : 'GROUP(';
  716. groupend : ')';
  717. inputstart : 'INPUT(';
  718. inputend : ')';
  719. libprefix : '-l'
  720. )
  721. ,(
  722. id : link_i386_ldgo32v1;
  723. linkbin : 'ld';
  724. linkcmd : '-oformat coff-go32 $OPT -o $EXE @$RES';
  725. binders : 1;
  726. bindbin : ('aout2exe','');
  727. bindcmd : ('$EXE','');
  728. stripopt : '-s';
  729. stripbind : false;
  730. libpathprefix : '-L';
  731. libpathsuffix : '';
  732. groupstart : '-(';
  733. groupend : '-)';
  734. inputstart : '';
  735. inputend : '';
  736. libprefix : '-l'
  737. )
  738. ,(
  739. id : link_i386_ldgo32v2;
  740. linkbin : 'ld';
  741. linkcmd : '-oformat coff-go32-exe $OPT -o $EXE @$RES';
  742. binders:0;
  743. bindbin : ('','');
  744. bindcmd : ('','');
  745. stripopt : '-s';
  746. stripbind : false;
  747. libpathprefix : '-L';
  748. libpathsuffix : '';
  749. groupstart : '-(';
  750. groupend : '-)';
  751. inputstart : '';
  752. inputend : '';
  753. libprefix : '-l'
  754. )
  755. ,(
  756. id : link_i386_ldw;
  757. linkbin : 'ldw';
  758. linkcmd : '$OPT -o $EXE $RES';
  759. binders : 0;
  760. bindbin : ('dlltool','ldw');
  761. bindcmd : ('--as asw.exe --dllname $EXE --output-exp exp.$$$',
  762. '-s $OPT -o $EXE $RES exp.$$$');
  763. stripopt : '-s';
  764. stripbind : false;
  765. libpathprefix : 'SEARCH_DIR(';
  766. libpathsuffix : ')';
  767. groupstart : 'GROUP(';
  768. groupend : ')';
  769. inputstart : 'INPUT(';
  770. inputend : ')';
  771. libprefix : '-l'
  772. )
  773. ,(
  774. id : link_i386_ldos2;
  775. linkbin : 'ld'; { Os/2 }
  776. linkcmd : '-o $EXE @$RES';
  777. binders : 1;
  778. bindbin : ('emxbind','');
  779. bindcmd : ('-b $STRIP -k$STACKKB -h$HEAPMB -o $EXE.exe $EXE -aim -s$DOSHEAPKB',
  780. '');
  781. stripopt : '-s';
  782. stripbind : true;
  783. libpathprefix : '-L';
  784. libpathsuffix : '';
  785. groupstart : ''; {Linker is too primitive...}
  786. groupend : '';
  787. inputstart : '';
  788. inputend : '';
  789. libprefix : '-l'
  790. )
  791. {$endif i386}
  792. {$ifdef m68k}
  793. ,(
  794. id : link_m68k_ld;
  795. linkbin : 'ld';
  796. linkcmd : '$OPT -o $EXE $RES';
  797. binders:0;
  798. bindbin : ('','');
  799. bindcmd : ('','');
  800. stripopt : '-s';
  801. stripbind : false;
  802. libpathprefix : 'SEARCH_DIR(';
  803. libpathsuffix : ')';
  804. groupstart : 'GROUP(';
  805. groupend : ')';
  806. inputstart : 'INPUT(';
  807. inputend : ')';
  808. libprefix : '-l'
  809. )
  810. {$endif m68k}
  811. );
  812. {****************************************************************************
  813. Ar Info
  814. ****************************************************************************}
  815. ar_infos : array[1..arcnt] of tarinfo = (
  816. (
  817. id : ar_none
  818. )
  819. {$ifdef i386}
  820. ,(
  821. id : ar_i386_ar;
  822. arbin : 'ar';
  823. arcmd : 'rs $LIB $FILES'
  824. ),
  825. (
  826. id : ar_i386_arw;
  827. arbin : 'arw';
  828. arcmd : 'rs $LIB $FILES'
  829. )
  830. {$endif i386}
  831. {$ifdef m68k}
  832. ,(
  833. id : ar_m68k_ar;
  834. arbin : 'ar';
  835. arcmd : 'rs $LIB $FILES'
  836. )
  837. {$endif m68k}
  838. );
  839. {****************************************************************************
  840. Res Info
  841. ****************************************************************************}
  842. res_infos : array[1..rescnt] of tresinfo = (
  843. (
  844. id : res_none
  845. )
  846. {$ifdef i386}
  847. ,(
  848. id : res_i386_windres;
  849. resbin : 'windres';
  850. rescmd : '--include $INC -O coff -o $OBJ $RES'
  851. )
  852. {$endif i386}
  853. );
  854. {****************************************************************************
  855. Targets Info
  856. ****************************************************************************}
  857. target_infos : array[1..targetcnt] of ttargetinfo = (
  858. (
  859. target : target_none;
  860. flags : [];
  861. cpu : no_cpu;
  862. short_name : 'notarget'
  863. )
  864. {$ifdef i386}
  865. ,(
  866. target : target_i386_GO32V1;
  867. flags : [];
  868. cpu : i386;
  869. short_name : 'GO32V1';
  870. unit_env : 'GO32V1UNITS';
  871. system_unit : 'SYSTEM';
  872. smartext : '.sl';
  873. unitext : '.pp1';
  874. unitlibext : '.ppl';
  875. asmext : '.s1';
  876. objext : '.o1';
  877. resext : '.res';
  878. resobjext : '.o1r';
  879. exeext : ''; { The linker produces a.out }
  880. os : os_i386_GO32V1;
  881. link : link_i386_ldgo32v1;
  882. assem : as_i386_as;
  883. assemsrc : as_i386_as;
  884. ar : ar_i386_ar;
  885. res : res_none;
  886. heapsize : 2048*1024;
  887. maxheapsize : 32768*1024;
  888. stacksize : 16384
  889. ),
  890. (
  891. target : target_i386_GO32V2;
  892. flags : [];
  893. cpu : i386;
  894. short_name : 'GO32V2';
  895. unit_env : 'GO32V2UNITS';
  896. system_unit : 'SYSTEM';
  897. smartext : '.sl';
  898. unitext : '.ppu';
  899. unitlibext : '.ppl';
  900. asmext : '.s';
  901. objext : '.o';
  902. resext : '.res';
  903. resobjext : '.or';
  904. exeext : '.exe';
  905. os : os_i386_GO32V2;
  906. link : link_i386_ldgo32v2;
  907. assem : as_i386_coff;
  908. assemsrc : as_i386_as;
  909. ar : ar_i386_ar;
  910. res : res_none;
  911. heapsize : 2048*1024;
  912. maxheapsize : 32768*1024;
  913. stacksize : 16384
  914. ),
  915. (
  916. target : target_i386_LINUX;
  917. flags : [];
  918. cpu : i386;
  919. short_name : 'LINUX';
  920. unit_env : 'LINUXUNITS';
  921. system_unit : 'syslinux';
  922. smartext : '.sl';
  923. unitext : '.ppu';
  924. unitlibext : '.ppl';
  925. asmext : '.s';
  926. objext : '.o';
  927. resext : '.res';
  928. resobjext : '.or';
  929. exeext : '';
  930. os : os_i386_Linux;
  931. link : link_i386_ld;
  932. assem : as_i386_as;
  933. assemsrc : as_i386_as;
  934. ar : ar_i386_ar;
  935. res : res_none;
  936. heapsize : 256*1024;
  937. maxheapsize : 32768*1024;
  938. stacksize : 8192
  939. ),
  940. (
  941. target : target_i386_OS2;
  942. flags : [];
  943. cpu : i386;
  944. short_name : 'OS2';
  945. unit_env : 'OS2UNITS';
  946. system_unit : 'SYSOS2';
  947. smartext : '.sl';
  948. unitext : '.ppo';
  949. unitlibext : '.ppl';
  950. asmext : '.so2';
  951. objext : '.oo2';
  952. resext : '.res';
  953. resobjext : '.oor';
  954. exeext : ''; { The linker produces a.out }
  955. os : os_i386_OS2;
  956. link : link_i386_ldos2;
  957. assem : as_i386_as_aout;
  958. assemsrc : as_i386_as_aout;
  959. ar : ar_i386_ar;
  960. res : res_none;
  961. heapsize : 256*1024;
  962. maxheapsize : 32768*1024;
  963. stacksize : 32768
  964. ),
  965. (
  966. target : target_i386_WIN32;
  967. flags : [];
  968. cpu : i386;
  969. short_name : 'WIN32';
  970. unit_env : 'WIN32UNITS';
  971. system_unit : 'SYSWIN32';
  972. smartext : '.slw';
  973. unitext : '.ppw';
  974. unitlibext : '.ppl';
  975. asmext : '.sw';
  976. objext : '.ow';
  977. resext : '.rc';
  978. resobjext : '.owr';
  979. exeext : '.exe';
  980. os : os_i386_Win32;
  981. link : link_i386_ldw;
  982. assem : as_i386_pecoff;
  983. assemsrc : as_i386_asw;
  984. ar : ar_i386_arw;
  985. res : res_i386_windres;
  986. heapsize : 256*1024;
  987. maxheapsize : 32*1024*1024;
  988. stacksize : 32*1024*1024
  989. )
  990. {$endif i386}
  991. {$ifdef m68k}
  992. ,(
  993. target : target_m68k_Amiga;
  994. flags : [];
  995. cpu : m68k;
  996. short_name : 'AMIGA';
  997. unit_env : '';
  998. system_unit : 'sysamiga';
  999. smartext : '.sl';
  1000. unitext : '.ppa';
  1001. unitlibext : '.ppl';
  1002. asmext : '.asm';
  1003. objext : '.o';
  1004. resext : '.res';
  1005. resobjext : '.or';
  1006. exeext : '';
  1007. os : os_m68k_Amiga;
  1008. link : link_m68k_ld;
  1009. assem : as_m68k_as;
  1010. assemsrc : as_m68k_as;
  1011. ar : ar_m68k_ar;
  1012. res : res_none;
  1013. heapsize : 128*1024;
  1014. maxheapsize : 32768*1024;
  1015. stacksize : 8192
  1016. ),
  1017. (
  1018. target : target_m68k_Atari;
  1019. flags : [];
  1020. cpu : m68k;
  1021. short_name : 'ATARI';
  1022. unit_env : '';
  1023. system_unit : 'SYSATARI';
  1024. smartext : '.sl';
  1025. unitext : '.ppt';
  1026. unitlibext : '.ppl';
  1027. asmext : '.s';
  1028. objext : '.o';
  1029. resext : '.res';
  1030. resobjext : '.or';
  1031. exeext : '.ttp';
  1032. os : os_m68k_Atari;
  1033. link : link_m68k_ld;
  1034. assem : as_m68k_as;
  1035. assemsrc : as_m68k_as;
  1036. ar : ar_m68k_ar;
  1037. res : res_none;
  1038. heapsize : 16*1024;
  1039. maxheapsize : 32768*1024;
  1040. stacksize : 8192
  1041. ),
  1042. (
  1043. target : target_m68k_Mac;
  1044. flags : [];
  1045. cpu : m68k;
  1046. short_name : 'MACOS';
  1047. unit_env : '';
  1048. system_unit : 'sysmac';
  1049. smartext : '.sl';
  1050. unitext : '.ppt';
  1051. unitlibext : '.ppl';
  1052. asmext : '.a';
  1053. objext : '.o';
  1054. resext : '.res';
  1055. resobjext : '.or';
  1056. exeext : '';
  1057. os : os_m68k_Mac;
  1058. link : link_m68k_ld;
  1059. assem : as_m68k_mpw;
  1060. assemsrc : as_m68k_mpw;
  1061. ar : ar_m68k_ar;
  1062. res : res_none;
  1063. heapsize : 128*1024;
  1064. maxheapsize : 32768*1024;
  1065. stacksize : 8192
  1066. ),
  1067. (
  1068. target : target_m68k_linux;
  1069. flags : [];
  1070. cpu : m68k;
  1071. short_name : 'LINUX';
  1072. unit_env : 'LINUXUNITS';
  1073. system_unit : 'syslinux';
  1074. smartext : '.sl';
  1075. unitext : '.ppu';
  1076. unitlibext : '.ppl';
  1077. asmext : '.s';
  1078. objext : '.o';
  1079. resext : '.res';
  1080. resobjext : '.or';
  1081. exeext : '';
  1082. os : os_m68k_Linux;
  1083. link : link_m68k_ld;
  1084. assem : as_m68k_as;
  1085. assemsrc : as_m68k_as;
  1086. ar : ar_m68k_ar;
  1087. res : res_none;
  1088. heapsize : 128*1024;
  1089. maxheapsize : 32768*1024;
  1090. stacksize : 8192
  1091. ),
  1092. (
  1093. target : target_m68k_PalmOS;
  1094. flags : [];
  1095. cpu : m68k;
  1096. short_name : 'PALMOS';
  1097. unit_env : 'PALMUNITS';
  1098. system_unit : 'syspalm';
  1099. smartext : '.sl';
  1100. unitext : '.ppu';
  1101. unitlibext : '.ppl';
  1102. asmext : '.s';
  1103. objext : '.o';
  1104. resext : '.res';
  1105. resobjext : '.or';
  1106. exeext : '';
  1107. os : os_m68k_PalmOS;
  1108. link : link_m68k_ld;
  1109. assem : as_m68k_as;
  1110. assemsrc : as_m68k_as;
  1111. ar : ar_m68k_ar;
  1112. res : res_none;
  1113. heapsize : 128*1024;
  1114. maxheapsize : 32768*1024;
  1115. stacksize : 8192
  1116. )
  1117. {$endif m68k}
  1118. );
  1119. {****************************************************************************
  1120. AsmModeInfo
  1121. ****************************************************************************}
  1122. asmmodeinfos : array[1..asmmodecnt] of tasmmodeinfo = (
  1123. (
  1124. id : asmmode_none;
  1125. idtxt : 'none'
  1126. )
  1127. {$ifdef i386}
  1128. ,(
  1129. id : asmmode_i386_direct;
  1130. idtxt : 'DIRECT'
  1131. ),
  1132. (
  1133. id : asmmode_i386_att;
  1134. idtxt : 'ATT'
  1135. ),
  1136. (
  1137. id : asmmode_i386_intel;
  1138. idtxt : 'INTEL'
  1139. )
  1140. {$endif i386}
  1141. {$ifdef m68k}
  1142. ,(
  1143. id : asmmode_m68k_mot;
  1144. idtxt : 'MOT'
  1145. )
  1146. {$endif m68k}
  1147. );
  1148. {****************************************************************************
  1149. Helpers
  1150. ****************************************************************************}
  1151. function upper(const s : string) : string;
  1152. var
  1153. i : longint;
  1154. begin
  1155. for i:=1 to length(s) do
  1156. if s[i] in ['a'..'z'] then
  1157. upper[i]:=char(byte(s[i])-32)
  1158. else
  1159. upper[i]:=s[i];
  1160. {$ifndef TP}
  1161. {$ifopt H+}
  1162. SetLength(upper,length(s));
  1163. {$else}
  1164. upper[0]:=s[0];
  1165. {$endif}
  1166. {$else}
  1167. upper[0]:=s[0];
  1168. {$endif}
  1169. end;
  1170. function set_target_os(t:tos):boolean;
  1171. var
  1172. i : longint;
  1173. begin
  1174. set_target_os:=false;
  1175. { target 1 is none }
  1176. for i:=2 to oscnt do
  1177. if os_infos[i].id=t then
  1178. begin
  1179. target_os:=os_infos[i];
  1180. set_target_os:=true;
  1181. exit;
  1182. end;
  1183. end;
  1184. function set_target_asm(t:tasm):boolean;
  1185. var
  1186. i : longint;
  1187. begin
  1188. set_target_asm:=false;
  1189. for i:=1 to asmcnt do
  1190. if as_infos[i].id=t then
  1191. begin
  1192. target_asm:=as_infos[i];
  1193. set_target_asm:=true;
  1194. exit;
  1195. end;
  1196. end;
  1197. function set_target_link(t:tlink):boolean;
  1198. var
  1199. i : longint;
  1200. begin
  1201. set_target_link:=false;
  1202. for i:=1 to linkcnt do
  1203. if link_infos[i].id=t then
  1204. begin
  1205. target_link:=link_infos[i];
  1206. set_target_link:=true;
  1207. exit;
  1208. end;
  1209. end;
  1210. function set_target_ar(t:tar):boolean;
  1211. var
  1212. i : longint;
  1213. begin
  1214. set_target_ar:=false;
  1215. for i:=1 to arcnt do
  1216. if ar_infos[i].id=t then
  1217. begin
  1218. target_ar:=ar_infos[i];
  1219. set_target_ar:=true;
  1220. exit;
  1221. end;
  1222. end;
  1223. function set_target_res(t:tres):boolean;
  1224. var
  1225. i : longint;
  1226. begin
  1227. set_target_res:=false;
  1228. for i:=1 to rescnt do
  1229. if res_infos[i].id=t then
  1230. begin
  1231. target_res:=res_infos[i];
  1232. set_target_res:=true;
  1233. exit;
  1234. end;
  1235. end;
  1236. function set_target_info(t:ttarget):boolean;
  1237. var
  1238. i : longint;
  1239. begin
  1240. set_target_info:=false;
  1241. for i:=1 to targetcnt do
  1242. if target_infos[i].target=t then
  1243. begin
  1244. target_info:=target_infos[i];
  1245. set_target_os(target_info.os);
  1246. set_target_asm(target_info.assem);
  1247. set_target_link(target_info.link);
  1248. set_target_ar(target_info.ar);
  1249. set_target_res(target_info.res);
  1250. target_cpu:=target_info.cpu;
  1251. set_target_info:=true;
  1252. exit;
  1253. end;
  1254. end;
  1255. {****************************************************************************
  1256. Load from string
  1257. ****************************************************************************}
  1258. function set_string_target(s : string) : boolean;
  1259. var
  1260. i : longint;
  1261. begin
  1262. set_string_target:=false;
  1263. { this should be case insensitive !! PM }
  1264. s:=upper(s);
  1265. for i:=1 to targetcnt do
  1266. if target_infos[i].short_name=s then
  1267. begin
  1268. target_info:=target_infos[i];
  1269. set_target_os(target_info.os);
  1270. set_target_asm(target_info.assem);
  1271. set_target_link(target_info.link);
  1272. set_target_ar(target_info.ar);
  1273. set_target_res(target_info.res);
  1274. target_cpu:=target_info.cpu;
  1275. set_string_target:=true;
  1276. exit;
  1277. end;
  1278. end;
  1279. function set_string_asm(s : string) : boolean;
  1280. var
  1281. i : longint;
  1282. begin
  1283. set_string_asm:=false;
  1284. { this should be case insensitive !! PM }
  1285. s:=upper(s);
  1286. for i:=1 to asmcnt do
  1287. if as_infos[i].idtxt=s then
  1288. begin
  1289. target_asm:=as_infos[i];
  1290. set_string_asm:=true;
  1291. end;
  1292. end;
  1293. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  1294. var
  1295. i : longint;
  1296. begin
  1297. set_string_asmmode:=false;
  1298. { this should be case insensitive !! PM }
  1299. s:=upper(s);
  1300. for i:=1 to asmmodecnt do
  1301. if asmmodeinfos[i].idtxt=s then
  1302. begin
  1303. t:=asmmodeinfos[i].id;
  1304. set_string_asmmode:=true;
  1305. end;
  1306. end;
  1307. {****************************************************************************
  1308. Initialization of default target
  1309. ****************************************************************************}
  1310. procedure default_os(t:ttarget);
  1311. begin
  1312. set_target_info(t);
  1313. if source_os.name='' then
  1314. source_os:=target_os;
  1315. end;
  1316. procedure set_source_os(t:tos);
  1317. var
  1318. i : longint;
  1319. begin
  1320. { can't use message() here (PFV) }
  1321. if source_os.name<>'' then
  1322. Writeln('Warning: Source OS Redefined!');
  1323. for i:=1 to oscnt do
  1324. if os_infos[i].id=t then
  1325. begin
  1326. source_os:=os_infos[i];
  1327. exit;
  1328. end;
  1329. end;
  1330. procedure InitSystems;
  1331. begin
  1332. { first get source OS }
  1333. source_os.name:='';
  1334. { please note then we use cpu86 and cpu68 here on purpose !! }
  1335. {$ifdef cpu86}
  1336. {$ifdef GO32V1}
  1337. set_source_os(os_i386_GO32V1);
  1338. {$else}
  1339. {$ifdef GO32V2}
  1340. set_source_os(os_i386_GO32V2);
  1341. {$else}
  1342. {$ifdef OS2}
  1343. set_source_os(os_i386_OS2);
  1344. if (OS_Mode = osDOS) or (OS_Mode = osDPMI)
  1345. then source_os.scriptext := '.bat';
  1346. {OS/2 via EMX can be run under DOS as well}
  1347. {$else}
  1348. {$ifdef LINUX}
  1349. set_source_os(os_i386_LINUX);
  1350. {$else}
  1351. {$ifdef WIN32}
  1352. set_source_os(os_i386_WIN32);
  1353. {$endif win32}
  1354. {$endif linux}
  1355. {$endif os2}
  1356. {$endif go32v2}
  1357. {$endif go32v1}
  1358. {$endif cpu86}
  1359. {$ifdef cpu68}
  1360. {$ifdef AMIGA}
  1361. set_source_os(os_m68k_Amiga);
  1362. {$else}
  1363. {$ifdef ATARI}
  1364. set_source_os(os_m68k_Atari);
  1365. {$else}
  1366. {$ifdef MACOS}
  1367. set_source_os(os_m68k_MAC);
  1368. {$else}
  1369. {$ifdef LINUX}
  1370. set_source_os(os_m68k_linux);
  1371. {$endif linux}
  1372. {$endif macos}
  1373. {$endif atari}
  1374. {$endif amiga}
  1375. {$endif cpu68}
  1376. { Now default target !! }
  1377. {$ifdef i386}
  1378. {$ifdef GO32V1}
  1379. default_os(target_i386_GO32V1);
  1380. {$else}
  1381. {$ifdef GO32V2}
  1382. default_os(target_i386_GO32V2);
  1383. {$else}
  1384. {$ifdef OS2}
  1385. default_os(target_i386_OS2);
  1386. {$else}
  1387. {$ifdef LINUX}
  1388. default_os(target_i386_LINUX);
  1389. {$else}
  1390. {$ifdef WIN32}
  1391. default_os(target_i386_WIN32);
  1392. {$else}
  1393. default_os(target_i386_GO32V2);
  1394. {$endif win32}
  1395. {$endif linux}
  1396. {$endif os2}
  1397. {$endif go32v2}
  1398. {$endif go32v1}
  1399. {$endif i386}
  1400. {$ifdef m68k}
  1401. {$ifdef AMIGA}
  1402. default_os(target_m68k_Amiga);
  1403. {$else}
  1404. {$ifdef ATARI}
  1405. default_os(target_m68k_Atari);
  1406. {$else}
  1407. {$ifdef MACOS}
  1408. default_os(target_m68k_Mac);
  1409. {$else}
  1410. {$ifdef LINUX}
  1411. default_os(target_m68k_linux);
  1412. {$else}
  1413. default_os(target_m68k_Amiga);
  1414. {$endif linux}
  1415. {$endif macos}
  1416. {$endif atari}
  1417. {$endif amiga}
  1418. {$endif m68k}
  1419. end;
  1420. begin
  1421. InitSystems;
  1422. end.
  1423. {
  1424. $Log$
  1425. Revision 1.82 1999-06-08 11:50:28 peter
  1426. * 2mb again for go32v2/v1
  1427. Revision 1.81 1999/06/02 20:46:39 peter
  1428. * fixed os2 bindcmd which was double
  1429. Revision 1.80 1999/06/02 14:20:31 hajny
  1430. * fixed my mistake from previously commited version
  1431. Revision 1.79 1999/06/02 13:25:34 hajny
  1432. * fixed stripping symbols for OS/2
  1433. Revision 1.78 1999/05/31 20:34:00 peter
  1434. * changed heapsize to 256k
  1435. Revision 1.77 1999/05/27 19:45:10 peter
  1436. * removed oldasm
  1437. * plabel -> pasmlabel
  1438. * -a switches to source writing automaticly
  1439. * assembler readers OOPed
  1440. * asmsymbol automaticly external
  1441. * jumptables and other label fixes for asm readers
  1442. Revision 1.76 1999/05/18 09:30:10 michael
  1443. + changes by thomas hajt
  1444. Revision 1.74 1999/05/17 13:02:12 pierre
  1445. * -Csmmm works for win32 but default is set to 32Mb
  1446. Revision 1.73 1999/05/11 00:44:06 peter
  1447. * released pecoff for win32 as default
  1448. Revision 1.72 1999/05/05 22:22:05 peter
  1449. * updated messages
  1450. Revision 1.71 1999/05/05 17:34:33 peter
  1451. * output is more like as 2.9.1
  1452. * stabs really working for go32v2
  1453. Revision 1.70 1999/05/05 09:19:18 florian
  1454. * more fixes to get it with delphi running
  1455. Revision 1.69 1999/05/03 18:03:29 peter
  1456. * no ar.exe running field in target_asm
  1457. Revision 1.68 1999/05/02 22:41:59 peter
  1458. * moved section names to systems
  1459. * fixed nasm,intel writer
  1460. Revision 1.67 1999/05/01 14:18:12 peter
  1461. * win32 pecoff disabled because it's still not ok
  1462. Revision 1.66 1999/05/01 13:24:44 peter
  1463. * merged nasm compiler
  1464. * old asm moved to oldasm/
  1465. Revision 1.65 1999/03/26 00:05:47 peter
  1466. * released valintern
  1467. + deffile is now removed when compiling is finished
  1468. * ^( compiles now correct
  1469. + static directive
  1470. * shrd fixed
  1471. Revision 1.64 1999/03/24 23:17:33 peter
  1472. * fixed bugs 212,222,225,227,229,231,233
  1473. Revision 1.63 1999/03/09 11:54:09 pierre
  1474. * pecoff default assem for win32 with ag386bin
  1475. Revision 1.62 1999/03/04 13:55:48 pierre
  1476. * some m68k fixes (still not compilable !)
  1477. * new(tobj) does not give warning if tobj has no VMT !
  1478. Revision 1.61 1999/03/03 11:41:51 pierre
  1479. + stabs info corrected to give results near to GAS output
  1480. * local labels (with .L are not stored in object anymore)
  1481. so we get the same number of symbols as from GAS !
  1482. Revision 1.60 1999/02/26 00:48:25 peter
  1483. * assembler writers fixed for ag386bin
  1484. Revision 1.59 1999/02/25 21:02:53 peter
  1485. * ag386bin updates
  1486. + coff writer
  1487. Revision 1.58 1999/02/24 00:59:16 peter
  1488. * small updates for ag386bin
  1489. Revision 1.57 1999/02/22 02:15:42 peter
  1490. * updates for ag386bin
  1491. Revision 1.56 1999/01/10 15:38:01 peter
  1492. * moved some tables from ra386*.pas -> i386.pas
  1493. + start of coff writer
  1494. * renamed asmutils unit to rautils
  1495. Revision 1.55 1999/01/06 22:58:47 florian
  1496. + some stuff for the new code generator
  1497. Revision 1.54 1998/12/28 23:26:26 peter
  1498. + resource file handling ($R directive) for Win32
  1499. Revision 1.53 1998/12/15 10:23:30 peter
  1500. + -iSO, -iSP, -iTO, -iTP
  1501. Revision 1.52 1998/12/03 10:17:32 peter
  1502. * target_os.use_bound_instruction boolean
  1503. Revision 1.51 1998/11/30 09:43:23 pierre
  1504. * some range check bugs fixed (still not working !)
  1505. + added DLL writing support for win32 (also accepts variables)
  1506. + TempAnsi for code that could be used for Temporary ansi strings
  1507. handling
  1508. Revision 1.50 1998/11/16 15:41:45 peter
  1509. * tp7 didn't like my ifopt H+ :(
  1510. Revision 1.49 1998/11/16 10:17:09 peter
  1511. * fixed for H+ compilation
  1512. Revision 1.48 1998/10/26 14:19:30 pierre
  1513. + added options -lS and -lT for source and target os output
  1514. (to have a easier way to test OS_SOURCE abd OS_TARGET in makefiles)
  1515. * several problems with rtti data
  1516. (type of sym was not checked)
  1517. assumed to be varsym when they could be procsym or property syms !!
  1518. Revision 1.47 1998/10/20 08:07:04 pierre
  1519. * several memory corruptions due to double freemem solved
  1520. => never use p^.loc.location:=p^.left^.loc.location;
  1521. + finally I added now by default
  1522. that ra386dir translates global and unit symbols
  1523. + added a first field in tsymtable and
  1524. a nextsym field in tsym
  1525. (this allows to obtain ordered type info for
  1526. records and objects in gdb !)
  1527. Revision 1.46 1998/10/16 08:51:54 peter
  1528. + target_os.stackalignment
  1529. + stack can be aligned at 2 or 4 byte boundaries
  1530. Revision 1.45 1998/10/15 16:20:41 peter
  1531. * removed uses verbose which is not possible! this unit may not use
  1532. any other unit !
  1533. Revision 1.44 1998/10/14 11:28:25 florian
  1534. * emitpushreferenceaddress gets now the asmlist as parameter
  1535. * m68k version compiles with -duseansistrings
  1536. Revision 1.43 1998/10/14 08:08:56 pierre
  1537. * following Peters remark, removed all ifdef in
  1538. the systems unit enums
  1539. * last bugs of cg68k removed for sysamiga
  1540. (sysamiga assembles with as68k !!)
  1541. Revision 1.42 1998/10/13 16:50:23 pierre
  1542. * undid some changes of Peter that made the compiler wrong
  1543. for m68k (I had to reinsert some ifdefs)
  1544. * removed several memory leaks under m68k
  1545. * removed the meory leaks for assembler readers
  1546. * cross compiling shoud work again better
  1547. ( crosscompiling sysamiga works
  1548. but as68k still complain about some code !)
  1549. Revision 1.41 1998/10/13 13:10:31 peter
  1550. * new style for m68k/i386 infos and enums
  1551. Revision 1.40 1998/10/13 09:13:09 pierre
  1552. * assembler type output command line was case sensitive
  1553. Revision 1.39 1998/10/13 08:19:42 pierre
  1554. + source_os is now set correctly for cross-processor compilers
  1555. (tos contains all target_infos and
  1556. we use CPU86 and CPU68 conditionnals to
  1557. get the source operating system
  1558. this only works if you do not undefine
  1559. the source target !!)
  1560. * several cg68k memory leaks fixed
  1561. + started to change the code so that it should be possible to have
  1562. a complete compiler (both for m68k and i386 !!)
  1563. Revision 1.38 1998/10/07 04:26:58 carl
  1564. * bugfixes
  1565. + added mpw support
  1566. Revision 1.37 1998/10/06 20:40:58 peter
  1567. * remove -D from assemblers
  1568. Revision 1.36 1998/09/16 16:41:50 peter
  1569. * merged fixes
  1570. Revision 1.33.2.3 1998/09/16 16:13:13 peter
  1571. * win32 .o -> .ow and .a -> .aw
  1572. Revision 1.35 1998/09/11 17:35:33 peter
  1573. * fixed tabs
  1574. Revision 1.34 1998/09/11 12:27:55 pierre
  1575. * restored m68k part
  1576. Revision 1.33.2.2 1998/09/11 17:29:20 peter
  1577. * fixed tabs
  1578. Revision 1.33.2.1 1998/09/11 12:06:00 pierre
  1579. * m68k part restored
  1580. Revision 1.33 1998/09/10 15:25:39 daniel
  1581. + Added maxheapsize.
  1582. * Corrected semi-bug in calling the assembler and the linker
  1583. Revision 1.31 1998/09/01 09:07:13 peter
  1584. * m68k fixes, splitted cg68k like cgi386
  1585. Revision 1.30 1998/08/31 12:26:34 peter
  1586. * m68k and palmos updates from surebugfixes
  1587. Revision 1.29 1998/08/26 10:09:21 peter
  1588. * more lowercase extensions
  1589. Revision 1.28 1998/08/25 12:42:47 pierre
  1590. * CDECL changed to CVAR for variables
  1591. specifications are read in structures also
  1592. + started adding GPC compatibility mode ( option -Sp)
  1593. * names changed to lowercase
  1594. Revision 1.27 1998/08/21 15:16:57 peter
  1595. * win32 compiles a bit better, no growheap crash
  1596. Revision 1.26 1998/08/19 16:07:55 jonas
  1597. * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
  1598. Revision 1.25 1998/08/18 09:24:45 pierre
  1599. * small warning position bug fixed
  1600. * support_mmx switches splitting was missing
  1601. * rhide error and warning output corrected
  1602. Revision 1.24 1998/08/17 09:17:54 peter
  1603. * static/shared linking updates
  1604. Revision 1.23 1998/06/25 08:48:20 florian
  1605. * first version of rtti support
  1606. Revision 1.22 1998/06/17 14:10:21 peter
  1607. * small os2 fixes
  1608. * fixed interdependent units with newppu (remake3 under linux works now)
  1609. Revision 1.20 1998/06/15 15:38:14 pierre
  1610. * small bug in systems.pas corrected
  1611. + operators in different units better hanlded
  1612. Revision 1.19 1998/06/15 13:34:24 daniel
  1613. * Fixed spelling mistakes in comments.
  1614. * Fixed some OS/2 parameters.
  1615. Revision 1.18 1998/06/08 22:59:54 peter
  1616. * smartlinking works for win32
  1617. * some defines to exclude some compiler parts
  1618. Revision 1.17 1998/06/04 23:52:04 peter
  1619. * m68k compiles
  1620. + .def file creation moved to gendef.pas so it could also be used
  1621. for win32
  1622. Revision 1.16 1998/06/01 16:50:22 peter
  1623. + boolean -> ord conversion
  1624. * fixed ord -> boolean conversion
  1625. Revision 1.15 1998/05/30 14:31:11 peter
  1626. + $ASMMODE
  1627. Revision 1.14 1998/05/29 13:24:45 peter
  1628. + asw assembler
  1629. Revision 1.13 1998/05/27 00:20:33 peter
  1630. * some scanner optimizes
  1631. * automaticly aout2exe for go32v1
  1632. * fixed dynamiclinker option which was added at the wrong place
  1633. Revision 1.12 1998/05/23 01:21:32 peter
  1634. + aktasmmode, aktoptprocessor, aktoutputformat
  1635. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1636. + $LIBNAME to set the library name where the unit will be put in
  1637. * splitted cgi386 a bit (codeseg to large for bp7)
  1638. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1639. Revision 1.11 1998/05/22 12:32:49 peter
  1640. * fixed -L on the commandline, Dos commandline is only 128 bytes
  1641. Revision 1.10 1998/05/11 13:07:58 peter
  1642. + $ifdef NEWPPU for the new ppuformat
  1643. + $define GDB not longer required
  1644. * removed all warnings and stripped some log comments
  1645. * no findfirst/findnext anymore to remove smartlink *.o files
  1646. Revision 1.9 1998/05/06 08:38:49 pierre
  1647. * better position info with UseTokenInfo
  1648. UseTokenInfo greatly simplified
  1649. + added check for changed tree after first time firstpass
  1650. (if we could remove all the cases were it happen
  1651. we could skip all firstpass if firstpasscount > 1)
  1652. Only with ExtDebug
  1653. Revision 1.8 1998/05/04 20:19:54 peter
  1654. * small fix for go32v2
  1655. Revision 1.7 1998/05/04 17:54:29 peter
  1656. + smartlinking works (only case jumptable left todo)
  1657. * redesign of systems.pas to support assemblers and linkers
  1658. + Unitname is now also in the PPU-file, increased version to 14
  1659. Revision 1.6 1998/05/01 07:43:57 florian
  1660. + basics for rtti implemented
  1661. + switch $m (generate rtti for published sections)
  1662. Revision 1.5 1998/04/29 10:34:06 pierre
  1663. + added some code for ansistring (not complete nor working yet)
  1664. * corrected operator overloading
  1665. * corrected nasm output
  1666. + started inline procedures
  1667. + added starstarn : use ** for exponentiation (^ gave problems)
  1668. + started UseTokenInfo cond to get accurate positions
  1669. Revision 1.4 1998/04/27 15:45:20 peter
  1670. + -Xl for smartlink
  1671. + target_info.arext = .a
  1672. Revision 1.3 1998/04/16 10:50:45 daniel
  1673. * Fixed some things that were broken for OS/2.
  1674. }