systems.pas 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828
  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 -k$STACKKB -h$HEAPMB -o $EXE.exe $EXE -aim -s$DOSHEAPKB','');
  780. stripopt : '-s';
  781. bindcmd : ('-b $STRIP -k$STACKKB -h$HEAPMB -o $EXE.exe $EXE -aim -s$DOSHEAPKB','');
  782. stripopt : '-s';
  783. stripbind : true;
  784. libpathprefix : '-L';
  785. libpathsuffix : '';
  786. groupstart : ''; {Linker is too primitive...}
  787. groupend : '';
  788. inputstart : '';
  789. inputend : '';
  790. libprefix : '-l'
  791. )
  792. {$endif i386}
  793. {$ifdef m68k}
  794. ,(
  795. id : link_m68k_ld;
  796. linkbin : 'ld';
  797. linkcmd : '$OPT -o $EXE $RES';
  798. binders:0;
  799. bindbin : ('','');
  800. bindcmd : ('','');
  801. stripopt : '-s';
  802. stripbind : false;
  803. libpathprefix : 'SEARCH_DIR(';
  804. libpathsuffix : ')';
  805. groupstart : 'GROUP(';
  806. groupend : ')';
  807. inputstart : 'INPUT(';
  808. inputend : ')';
  809. libprefix : '-l'
  810. )
  811. {$endif m68k}
  812. );
  813. {****************************************************************************
  814. Ar Info
  815. ****************************************************************************}
  816. ar_infos : array[1..arcnt] of tarinfo = (
  817. (
  818. id : ar_none
  819. )
  820. {$ifdef i386}
  821. ,(
  822. id : ar_i386_ar;
  823. arbin : 'ar';
  824. arcmd : 'rs $LIB $FILES'
  825. ),
  826. (
  827. id : ar_i386_arw;
  828. arbin : 'arw';
  829. arcmd : 'rs $LIB $FILES'
  830. )
  831. {$endif i386}
  832. {$ifdef m68k}
  833. ,(
  834. id : ar_m68k_ar;
  835. arbin : 'ar';
  836. arcmd : 'rs $LIB $FILES'
  837. )
  838. {$endif m68k}
  839. );
  840. {****************************************************************************
  841. Res Info
  842. ****************************************************************************}
  843. res_infos : array[1..rescnt] of tresinfo = (
  844. (
  845. id : res_none
  846. )
  847. {$ifdef i386}
  848. ,(
  849. id : res_i386_windres;
  850. resbin : 'windres';
  851. rescmd : '--include $INC -O coff -o $OBJ $RES'
  852. )
  853. {$endif i386}
  854. );
  855. {****************************************************************************
  856. Targets Info
  857. ****************************************************************************}
  858. target_infos : array[1..targetcnt] of ttargetinfo = (
  859. (
  860. target : target_none;
  861. flags : [];
  862. cpu : no_cpu;
  863. short_name : 'notarget'
  864. )
  865. {$ifdef i386}
  866. ,(
  867. target : target_i386_GO32V1;
  868. flags : [];
  869. cpu : i386;
  870. short_name : 'GO32V1';
  871. unit_env : 'GO32V1UNITS';
  872. system_unit : 'SYSTEM';
  873. smartext : '.sl';
  874. unitext : '.pp1';
  875. unitlibext : '.ppl';
  876. asmext : '.s1';
  877. objext : '.o1';
  878. resext : '.res';
  879. resobjext : '.o1r';
  880. exeext : ''; { The linker produces a.out }
  881. os : os_i386_GO32V1;
  882. link : link_i386_ldgo32v1;
  883. assem : as_i386_as;
  884. assemsrc : as_i386_as;
  885. ar : ar_i386_ar;
  886. res : res_none;
  887. heapsize : 256*1024;
  888. maxheapsize : 32768*1024;
  889. stacksize : 16384
  890. ),
  891. (
  892. target : target_i386_GO32V2;
  893. flags : [];
  894. cpu : i386;
  895. short_name : 'GO32V2';
  896. unit_env : 'GO32V2UNITS';
  897. system_unit : 'SYSTEM';
  898. smartext : '.sl';
  899. unitext : '.ppu';
  900. unitlibext : '.ppl';
  901. asmext : '.s';
  902. objext : '.o';
  903. resext : '.res';
  904. resobjext : '.or';
  905. exeext : '.exe';
  906. os : os_i386_GO32V2;
  907. link : link_i386_ldgo32v2;
  908. assem : as_i386_coff;
  909. assemsrc : as_i386_as;
  910. ar : ar_i386_ar;
  911. res : res_none;
  912. heapsize : 256*1024;
  913. maxheapsize : 32768*1024;
  914. stacksize : 16384
  915. ),
  916. (
  917. target : target_i386_LINUX;
  918. flags : [];
  919. cpu : i386;
  920. short_name : 'LINUX';
  921. unit_env : 'LINUXUNITS';
  922. system_unit : 'syslinux';
  923. smartext : '.sl';
  924. unitext : '.ppu';
  925. unitlibext : '.ppl';
  926. asmext : '.s';
  927. objext : '.o';
  928. resext : '.res';
  929. resobjext : '.or';
  930. exeext : '';
  931. os : os_i386_Linux;
  932. link : link_i386_ld;
  933. assem : as_i386_as;
  934. assemsrc : as_i386_as;
  935. ar : ar_i386_ar;
  936. res : res_none;
  937. heapsize : 256*1024;
  938. maxheapsize : 32768*1024;
  939. stacksize : 8192
  940. ),
  941. (
  942. target : target_i386_OS2;
  943. flags : [];
  944. cpu : i386;
  945. short_name : 'OS2';
  946. unit_env : 'OS2UNITS';
  947. system_unit : 'SYSOS2';
  948. smartext : '.sl';
  949. unitext : '.ppo';
  950. unitlibext : '.ppl';
  951. asmext : '.so2';
  952. objext : '.oo2';
  953. resext : '.res';
  954. resobjext : '.oor';
  955. exeext : ''; { The linker produces a.out }
  956. os : os_i386_OS2;
  957. link : link_i386_ldos2;
  958. assem : as_i386_as_aout;
  959. assemsrc : as_i386_as_aout;
  960. ar : ar_i386_ar;
  961. res : res_none;
  962. heapsize : 256*1024;
  963. maxheapsize : 32768*1024;
  964. stacksize : 32768
  965. ),
  966. (
  967. target : target_i386_WIN32;
  968. flags : [];
  969. cpu : i386;
  970. short_name : 'WIN32';
  971. unit_env : 'WIN32UNITS';
  972. system_unit : 'SYSWIN32';
  973. smartext : '.slw';
  974. unitext : '.ppw';
  975. unitlibext : '.ppl';
  976. asmext : '.sw';
  977. objext : '.ow';
  978. resext : '.rc';
  979. resobjext : '.owr';
  980. exeext : '.exe';
  981. os : os_i386_Win32;
  982. link : link_i386_ldw;
  983. assem : as_i386_pecoff;
  984. assemsrc : as_i386_asw;
  985. ar : ar_i386_arw;
  986. res : res_i386_windres;
  987. heapsize : 256*1024;
  988. maxheapsize : 32*1024*1024;
  989. stacksize : 32*1024*1024
  990. )
  991. {$endif i386}
  992. {$ifdef m68k}
  993. ,(
  994. target : target_m68k_Amiga;
  995. flags : [];
  996. cpu : m68k;
  997. short_name : 'AMIGA';
  998. unit_env : '';
  999. system_unit : 'sysamiga';
  1000. smartext : '.sl';
  1001. unitext : '.ppa';
  1002. unitlibext : '.ppl';
  1003. asmext : '.asm';
  1004. objext : '.o';
  1005. resext : '.res';
  1006. resobjext : '.or';
  1007. exeext : '';
  1008. os : os_m68k_Amiga;
  1009. link : link_m68k_ld;
  1010. assem : as_m68k_as;
  1011. assemsrc : as_m68k_as;
  1012. ar : ar_m68k_ar;
  1013. res : res_none;
  1014. heapsize : 128*1024;
  1015. maxheapsize : 32768*1024;
  1016. stacksize : 8192
  1017. ),
  1018. (
  1019. target : target_m68k_Atari;
  1020. flags : [];
  1021. cpu : m68k;
  1022. short_name : 'ATARI';
  1023. unit_env : '';
  1024. system_unit : 'SYSATARI';
  1025. smartext : '.sl';
  1026. unitext : '.ppt';
  1027. unitlibext : '.ppl';
  1028. asmext : '.s';
  1029. objext : '.o';
  1030. resext : '.res';
  1031. resobjext : '.or';
  1032. exeext : '.ttp';
  1033. os : os_m68k_Atari;
  1034. link : link_m68k_ld;
  1035. assem : as_m68k_as;
  1036. assemsrc : as_m68k_as;
  1037. ar : ar_m68k_ar;
  1038. res : res_none;
  1039. heapsize : 16*1024;
  1040. maxheapsize : 32768*1024;
  1041. stacksize : 8192
  1042. ),
  1043. (
  1044. target : target_m68k_Mac;
  1045. flags : [];
  1046. cpu : m68k;
  1047. short_name : 'MACOS';
  1048. unit_env : '';
  1049. system_unit : 'sysmac';
  1050. smartext : '.sl';
  1051. unitext : '.ppt';
  1052. unitlibext : '.ppl';
  1053. asmext : '.a';
  1054. objext : '.o';
  1055. resext : '.res';
  1056. resobjext : '.or';
  1057. exeext : '';
  1058. os : os_m68k_Mac;
  1059. link : link_m68k_ld;
  1060. assem : as_m68k_mpw;
  1061. assemsrc : as_m68k_mpw;
  1062. ar : ar_m68k_ar;
  1063. res : res_none;
  1064. heapsize : 128*1024;
  1065. maxheapsize : 32768*1024;
  1066. stacksize : 8192
  1067. ),
  1068. (
  1069. target : target_m68k_linux;
  1070. flags : [];
  1071. cpu : m68k;
  1072. short_name : 'LINUX';
  1073. unit_env : 'LINUXUNITS';
  1074. system_unit : 'syslinux';
  1075. smartext : '.sl';
  1076. unitext : '.ppu';
  1077. unitlibext : '.ppl';
  1078. asmext : '.s';
  1079. objext : '.o';
  1080. resext : '.res';
  1081. resobjext : '.or';
  1082. exeext : '';
  1083. os : os_m68k_Linux;
  1084. link : link_m68k_ld;
  1085. assem : as_m68k_as;
  1086. assemsrc : as_m68k_as;
  1087. ar : ar_m68k_ar;
  1088. res : res_none;
  1089. heapsize : 128*1024;
  1090. maxheapsize : 32768*1024;
  1091. stacksize : 8192
  1092. ),
  1093. (
  1094. target : target_m68k_PalmOS;
  1095. flags : [];
  1096. cpu : m68k;
  1097. short_name : 'PALMOS';
  1098. unit_env : 'PALMUNITS';
  1099. system_unit : 'syspalm';
  1100. smartext : '.sl';
  1101. unitext : '.ppu';
  1102. unitlibext : '.ppl';
  1103. asmext : '.s';
  1104. objext : '.o';
  1105. resext : '.res';
  1106. resobjext : '.or';
  1107. exeext : '';
  1108. os : os_m68k_PalmOS;
  1109. link : link_m68k_ld;
  1110. assem : as_m68k_as;
  1111. assemsrc : as_m68k_as;
  1112. ar : ar_m68k_ar;
  1113. res : res_none;
  1114. heapsize : 128*1024;
  1115. maxheapsize : 32768*1024;
  1116. stacksize : 8192
  1117. )
  1118. {$endif m68k}
  1119. );
  1120. {****************************************************************************
  1121. AsmModeInfo
  1122. ****************************************************************************}
  1123. asmmodeinfos : array[1..asmmodecnt] of tasmmodeinfo = (
  1124. (
  1125. id : asmmode_none;
  1126. idtxt : 'none'
  1127. )
  1128. {$ifdef i386}
  1129. ,(
  1130. id : asmmode_i386_direct;
  1131. idtxt : 'DIRECT'
  1132. ),
  1133. (
  1134. id : asmmode_i386_att;
  1135. idtxt : 'ATT'
  1136. ),
  1137. (
  1138. id : asmmode_i386_intel;
  1139. idtxt : 'INTEL'
  1140. )
  1141. {$endif i386}
  1142. {$ifdef m68k}
  1143. ,(
  1144. id : asmmode_m68k_mot;
  1145. idtxt : 'MOT'
  1146. )
  1147. {$endif m68k}
  1148. );
  1149. {****************************************************************************
  1150. Helpers
  1151. ****************************************************************************}
  1152. function upper(const s : string) : string;
  1153. var
  1154. i : longint;
  1155. begin
  1156. for i:=1 to length(s) do
  1157. if s[i] in ['a'..'z'] then
  1158. upper[i]:=char(byte(s[i])-32)
  1159. else
  1160. upper[i]:=s[i];
  1161. {$ifndef TP}
  1162. {$ifopt H+}
  1163. SetLength(upper,length(s));
  1164. {$else}
  1165. upper[0]:=s[0];
  1166. {$endif}
  1167. {$else}
  1168. upper[0]:=s[0];
  1169. {$endif}
  1170. end;
  1171. function set_target_os(t:tos):boolean;
  1172. var
  1173. i : longint;
  1174. begin
  1175. set_target_os:=false;
  1176. { target 1 is none }
  1177. for i:=2 to oscnt do
  1178. if os_infos[i].id=t then
  1179. begin
  1180. target_os:=os_infos[i];
  1181. set_target_os:=true;
  1182. exit;
  1183. end;
  1184. end;
  1185. function set_target_asm(t:tasm):boolean;
  1186. var
  1187. i : longint;
  1188. begin
  1189. set_target_asm:=false;
  1190. for i:=1 to asmcnt do
  1191. if as_infos[i].id=t then
  1192. begin
  1193. target_asm:=as_infos[i];
  1194. set_target_asm:=true;
  1195. exit;
  1196. end;
  1197. end;
  1198. function set_target_link(t:tlink):boolean;
  1199. var
  1200. i : longint;
  1201. begin
  1202. set_target_link:=false;
  1203. for i:=1 to linkcnt do
  1204. if link_infos[i].id=t then
  1205. begin
  1206. target_link:=link_infos[i];
  1207. set_target_link:=true;
  1208. exit;
  1209. end;
  1210. end;
  1211. function set_target_ar(t:tar):boolean;
  1212. var
  1213. i : longint;
  1214. begin
  1215. set_target_ar:=false;
  1216. for i:=1 to arcnt do
  1217. if ar_infos[i].id=t then
  1218. begin
  1219. target_ar:=ar_infos[i];
  1220. set_target_ar:=true;
  1221. exit;
  1222. end;
  1223. end;
  1224. function set_target_res(t:tres):boolean;
  1225. var
  1226. i : longint;
  1227. begin
  1228. set_target_res:=false;
  1229. for i:=1 to rescnt do
  1230. if res_infos[i].id=t then
  1231. begin
  1232. target_res:=res_infos[i];
  1233. set_target_res:=true;
  1234. exit;
  1235. end;
  1236. end;
  1237. function set_target_info(t:ttarget):boolean;
  1238. var
  1239. i : longint;
  1240. begin
  1241. set_target_info:=false;
  1242. for i:=1 to targetcnt do
  1243. if target_infos[i].target=t then
  1244. begin
  1245. target_info:=target_infos[i];
  1246. set_target_os(target_info.os);
  1247. set_target_asm(target_info.assem);
  1248. set_target_link(target_info.link);
  1249. set_target_ar(target_info.ar);
  1250. set_target_res(target_info.res);
  1251. target_cpu:=target_info.cpu;
  1252. set_target_info:=true;
  1253. exit;
  1254. end;
  1255. end;
  1256. {****************************************************************************
  1257. Load from string
  1258. ****************************************************************************}
  1259. function set_string_target(s : string) : boolean;
  1260. var
  1261. i : longint;
  1262. begin
  1263. set_string_target:=false;
  1264. { this should be case insensitive !! PM }
  1265. s:=upper(s);
  1266. for i:=1 to targetcnt do
  1267. if target_infos[i].short_name=s then
  1268. begin
  1269. target_info:=target_infos[i];
  1270. set_target_os(target_info.os);
  1271. set_target_asm(target_info.assem);
  1272. set_target_link(target_info.link);
  1273. set_target_ar(target_info.ar);
  1274. set_target_res(target_info.res);
  1275. target_cpu:=target_info.cpu;
  1276. set_string_target:=true;
  1277. exit;
  1278. end;
  1279. end;
  1280. function set_string_asm(s : string) : boolean;
  1281. var
  1282. i : longint;
  1283. begin
  1284. set_string_asm:=false;
  1285. { this should be case insensitive !! PM }
  1286. s:=upper(s);
  1287. for i:=1 to asmcnt do
  1288. if as_infos[i].idtxt=s then
  1289. begin
  1290. target_asm:=as_infos[i];
  1291. set_string_asm:=true;
  1292. end;
  1293. end;
  1294. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  1295. var
  1296. i : longint;
  1297. begin
  1298. set_string_asmmode:=false;
  1299. { this should be case insensitive !! PM }
  1300. s:=upper(s);
  1301. for i:=1 to asmmodecnt do
  1302. if asmmodeinfos[i].idtxt=s then
  1303. begin
  1304. t:=asmmodeinfos[i].id;
  1305. set_string_asmmode:=true;
  1306. end;
  1307. end;
  1308. {****************************************************************************
  1309. Initialization of default target
  1310. ****************************************************************************}
  1311. procedure default_os(t:ttarget);
  1312. begin
  1313. set_target_info(t);
  1314. if source_os.name='' then
  1315. source_os:=target_os;
  1316. end;
  1317. procedure set_source_os(t:tos);
  1318. var
  1319. i : longint;
  1320. begin
  1321. { can't use message() here (PFV) }
  1322. if source_os.name<>'' then
  1323. Writeln('Warning: Source OS Redefined!');
  1324. for i:=1 to oscnt do
  1325. if os_infos[i].id=t then
  1326. begin
  1327. source_os:=os_infos[i];
  1328. exit;
  1329. end;
  1330. end;
  1331. procedure InitSystems;
  1332. begin
  1333. { first get source OS }
  1334. source_os.name:='';
  1335. { please note then we use cpu86 and cpu68 here on purpose !! }
  1336. {$ifdef cpu86}
  1337. {$ifdef GO32V1}
  1338. set_source_os(os_i386_GO32V1);
  1339. {$else}
  1340. {$ifdef GO32V2}
  1341. set_source_os(os_i386_GO32V2);
  1342. {$else}
  1343. {$ifdef OS2}
  1344. set_source_os(os_i386_OS2);
  1345. if (OS_Mode = osDOS) or (OS_Mode = osDPMI)
  1346. then source_os.scriptext := '.bat';
  1347. {OS/2 via EMX can be run under DOS as well}
  1348. {$else}
  1349. {$ifdef LINUX}
  1350. set_source_os(os_i386_LINUX);
  1351. {$else}
  1352. {$ifdef WIN32}
  1353. set_source_os(os_i386_WIN32);
  1354. {$endif win32}
  1355. {$endif linux}
  1356. {$endif os2}
  1357. {$endif go32v2}
  1358. {$endif go32v1}
  1359. {$endif cpu86}
  1360. {$ifdef cpu68}
  1361. {$ifdef AMIGA}
  1362. set_source_os(os_m68k_Amiga);
  1363. {$else}
  1364. {$ifdef ATARI}
  1365. set_source_os(os_m68k_Atari);
  1366. {$else}
  1367. {$ifdef MACOS}
  1368. set_source_os(os_m68k_MAC);
  1369. {$else}
  1370. {$ifdef LINUX}
  1371. set_source_os(os_m68k_linux);
  1372. {$endif linux}
  1373. {$endif macos}
  1374. {$endif atari}
  1375. {$endif amiga}
  1376. {$endif cpu68}
  1377. { Now default target !! }
  1378. {$ifdef i386}
  1379. {$ifdef GO32V1}
  1380. default_os(target_i386_GO32V1);
  1381. {$else}
  1382. {$ifdef GO32V2}
  1383. default_os(target_i386_GO32V2);
  1384. {$else}
  1385. {$ifdef OS2}
  1386. default_os(target_i386_OS2);
  1387. {$else}
  1388. {$ifdef LINUX}
  1389. default_os(target_i386_LINUX);
  1390. {$else}
  1391. {$ifdef WIN32}
  1392. default_os(target_i386_WIN32);
  1393. {$else}
  1394. default_os(target_i386_GO32V2);
  1395. {$endif win32}
  1396. {$endif linux}
  1397. {$endif os2}
  1398. {$endif go32v2}
  1399. {$endif go32v1}
  1400. {$endif i386}
  1401. {$ifdef m68k}
  1402. {$ifdef AMIGA}
  1403. default_os(target_m68k_Amiga);
  1404. {$else}
  1405. {$ifdef ATARI}
  1406. default_os(target_m68k_Atari);
  1407. {$else}
  1408. {$ifdef MACOS}
  1409. default_os(target_m68k_Mac);
  1410. {$else}
  1411. {$ifdef LINUX}
  1412. default_os(target_m68k_linux);
  1413. {$else}
  1414. default_os(target_m68k_Amiga);
  1415. {$endif linux}
  1416. {$endif macos}
  1417. {$endif atari}
  1418. {$endif amiga}
  1419. {$endif m68k}
  1420. end;
  1421. begin
  1422. InitSystems;
  1423. end.
  1424. {
  1425. $Log$
  1426. Revision 1.80 1999-06-02 14:20:31 hajny
  1427. * fixed my mistake from previously commited version
  1428. Revision 1.79 1999/06/02 13:25:34 hajny
  1429. * fixed stripping symbols for OS/2
  1430. Revision 1.78 1999/05/31 20:34:00 peter
  1431. * changed heapsize to 256k
  1432. Revision 1.77 1999/05/27 19:45:10 peter
  1433. * removed oldasm
  1434. * plabel -> pasmlabel
  1435. * -a switches to source writing automaticly
  1436. * assembler readers OOPed
  1437. * asmsymbol automaticly external
  1438. * jumptables and other label fixes for asm readers
  1439. Revision 1.76 1999/05/18 09:30:10 michael
  1440. + changes by thomas hajt
  1441. Revision 1.74 1999/05/17 13:02:12 pierre
  1442. * -Csmmm works for win32 but default is set to 32Mb
  1443. Revision 1.73 1999/05/11 00:44:06 peter
  1444. * released pecoff for win32 as default
  1445. Revision 1.72 1999/05/05 22:22:05 peter
  1446. * updated messages
  1447. Revision 1.71 1999/05/05 17:34:33 peter
  1448. * output is more like as 2.9.1
  1449. * stabs really working for go32v2
  1450. Revision 1.70 1999/05/05 09:19:18 florian
  1451. * more fixes to get it with delphi running
  1452. Revision 1.69 1999/05/03 18:03:29 peter
  1453. * no ar.exe running field in target_asm
  1454. Revision 1.68 1999/05/02 22:41:59 peter
  1455. * moved section names to systems
  1456. * fixed nasm,intel writer
  1457. Revision 1.67 1999/05/01 14:18:12 peter
  1458. * win32 pecoff disabled because it's still not ok
  1459. Revision 1.66 1999/05/01 13:24:44 peter
  1460. * merged nasm compiler
  1461. * old asm moved to oldasm/
  1462. Revision 1.65 1999/03/26 00:05:47 peter
  1463. * released valintern
  1464. + deffile is now removed when compiling is finished
  1465. * ^( compiles now correct
  1466. + static directive
  1467. * shrd fixed
  1468. Revision 1.64 1999/03/24 23:17:33 peter
  1469. * fixed bugs 212,222,225,227,229,231,233
  1470. Revision 1.63 1999/03/09 11:54:09 pierre
  1471. * pecoff default assem for win32 with ag386bin
  1472. Revision 1.62 1999/03/04 13:55:48 pierre
  1473. * some m68k fixes (still not compilable !)
  1474. * new(tobj) does not give warning if tobj has no VMT !
  1475. Revision 1.61 1999/03/03 11:41:51 pierre
  1476. + stabs info corrected to give results near to GAS output
  1477. * local labels (with .L are not stored in object anymore)
  1478. so we get the same number of symbols as from GAS !
  1479. Revision 1.60 1999/02/26 00:48:25 peter
  1480. * assembler writers fixed for ag386bin
  1481. Revision 1.59 1999/02/25 21:02:53 peter
  1482. * ag386bin updates
  1483. + coff writer
  1484. Revision 1.58 1999/02/24 00:59:16 peter
  1485. * small updates for ag386bin
  1486. Revision 1.57 1999/02/22 02:15:42 peter
  1487. * updates for ag386bin
  1488. Revision 1.56 1999/01/10 15:38:01 peter
  1489. * moved some tables from ra386*.pas -> i386.pas
  1490. + start of coff writer
  1491. * renamed asmutils unit to rautils
  1492. Revision 1.55 1999/01/06 22:58:47 florian
  1493. + some stuff for the new code generator
  1494. Revision 1.54 1998/12/28 23:26:26 peter
  1495. + resource file handling ($R directive) for Win32
  1496. Revision 1.53 1998/12/15 10:23:30 peter
  1497. + -iSO, -iSP, -iTO, -iTP
  1498. Revision 1.52 1998/12/03 10:17:32 peter
  1499. * target_os.use_bound_instruction boolean
  1500. Revision 1.51 1998/11/30 09:43:23 pierre
  1501. * some range check bugs fixed (still not working !)
  1502. + added DLL writing support for win32 (also accepts variables)
  1503. + TempAnsi for code that could be used for Temporary ansi strings
  1504. handling
  1505. Revision 1.50 1998/11/16 15:41:45 peter
  1506. * tp7 didn't like my ifopt H+ :(
  1507. Revision 1.49 1998/11/16 10:17:09 peter
  1508. * fixed for H+ compilation
  1509. Revision 1.48 1998/10/26 14:19:30 pierre
  1510. + added options -lS and -lT for source and target os output
  1511. (to have a easier way to test OS_SOURCE abd OS_TARGET in makefiles)
  1512. * several problems with rtti data
  1513. (type of sym was not checked)
  1514. assumed to be varsym when they could be procsym or property syms !!
  1515. Revision 1.47 1998/10/20 08:07:04 pierre
  1516. * several memory corruptions due to double freemem solved
  1517. => never use p^.loc.location:=p^.left^.loc.location;
  1518. + finally I added now by default
  1519. that ra386dir translates global and unit symbols
  1520. + added a first field in tsymtable and
  1521. a nextsym field in tsym
  1522. (this allows to obtain ordered type info for
  1523. records and objects in gdb !)
  1524. Revision 1.46 1998/10/16 08:51:54 peter
  1525. + target_os.stackalignment
  1526. + stack can be aligned at 2 or 4 byte boundaries
  1527. Revision 1.45 1998/10/15 16:20:41 peter
  1528. * removed uses verbose which is not possible! this unit may not use
  1529. any other unit !
  1530. Revision 1.44 1998/10/14 11:28:25 florian
  1531. * emitpushreferenceaddress gets now the asmlist as parameter
  1532. * m68k version compiles with -duseansistrings
  1533. Revision 1.43 1998/10/14 08:08:56 pierre
  1534. * following Peters remark, removed all ifdef in
  1535. the systems unit enums
  1536. * last bugs of cg68k removed for sysamiga
  1537. (sysamiga assembles with as68k !!)
  1538. Revision 1.42 1998/10/13 16:50:23 pierre
  1539. * undid some changes of Peter that made the compiler wrong
  1540. for m68k (I had to reinsert some ifdefs)
  1541. * removed several memory leaks under m68k
  1542. * removed the meory leaks for assembler readers
  1543. * cross compiling shoud work again better
  1544. ( crosscompiling sysamiga works
  1545. but as68k still complain about some code !)
  1546. Revision 1.41 1998/10/13 13:10:31 peter
  1547. * new style for m68k/i386 infos and enums
  1548. Revision 1.40 1998/10/13 09:13:09 pierre
  1549. * assembler type output command line was case sensitive
  1550. Revision 1.39 1998/10/13 08:19:42 pierre
  1551. + source_os is now set correctly for cross-processor compilers
  1552. (tos contains all target_infos and
  1553. we use CPU86 and CPU68 conditionnals to
  1554. get the source operating system
  1555. this only works if you do not undefine
  1556. the source target !!)
  1557. * several cg68k memory leaks fixed
  1558. + started to change the code so that it should be possible to have
  1559. a complete compiler (both for m68k and i386 !!)
  1560. Revision 1.38 1998/10/07 04:26:58 carl
  1561. * bugfixes
  1562. + added mpw support
  1563. Revision 1.37 1998/10/06 20:40:58 peter
  1564. * remove -D from assemblers
  1565. Revision 1.36 1998/09/16 16:41:50 peter
  1566. * merged fixes
  1567. Revision 1.33.2.3 1998/09/16 16:13:13 peter
  1568. * win32 .o -> .ow and .a -> .aw
  1569. Revision 1.35 1998/09/11 17:35:33 peter
  1570. * fixed tabs
  1571. Revision 1.34 1998/09/11 12:27:55 pierre
  1572. * restored m68k part
  1573. Revision 1.33.2.2 1998/09/11 17:29:20 peter
  1574. * fixed tabs
  1575. Revision 1.33.2.1 1998/09/11 12:06:00 pierre
  1576. * m68k part restored
  1577. Revision 1.33 1998/09/10 15:25:39 daniel
  1578. + Added maxheapsize.
  1579. * Corrected semi-bug in calling the assembler and the linker
  1580. Revision 1.31 1998/09/01 09:07:13 peter
  1581. * m68k fixes, splitted cg68k like cgi386
  1582. Revision 1.30 1998/08/31 12:26:34 peter
  1583. * m68k and palmos updates from surebugfixes
  1584. Revision 1.29 1998/08/26 10:09:21 peter
  1585. * more lowercase extensions
  1586. Revision 1.28 1998/08/25 12:42:47 pierre
  1587. * CDECL changed to CVAR for variables
  1588. specifications are read in structures also
  1589. + started adding GPC compatibility mode ( option -Sp)
  1590. * names changed to lowercase
  1591. Revision 1.27 1998/08/21 15:16:57 peter
  1592. * win32 compiles a bit better, no growheap crash
  1593. Revision 1.26 1998/08/19 16:07:55 jonas
  1594. * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
  1595. Revision 1.25 1998/08/18 09:24:45 pierre
  1596. * small warning position bug fixed
  1597. * support_mmx switches splitting was missing
  1598. * rhide error and warning output corrected
  1599. Revision 1.24 1998/08/17 09:17:54 peter
  1600. * static/shared linking updates
  1601. Revision 1.23 1998/06/25 08:48:20 florian
  1602. * first version of rtti support
  1603. Revision 1.22 1998/06/17 14:10:21 peter
  1604. * small os2 fixes
  1605. * fixed interdependent units with newppu (remake3 under linux works now)
  1606. Revision 1.20 1998/06/15 15:38:14 pierre
  1607. * small bug in systems.pas corrected
  1608. + operators in different units better hanlded
  1609. Revision 1.19 1998/06/15 13:34:24 daniel
  1610. * Fixed spelling mistakes in comments.
  1611. * Fixed some OS/2 parameters.
  1612. Revision 1.18 1998/06/08 22:59:54 peter
  1613. * smartlinking works for win32
  1614. * some defines to exclude some compiler parts
  1615. Revision 1.17 1998/06/04 23:52:04 peter
  1616. * m68k compiles
  1617. + .def file creation moved to gendef.pas so it could also be used
  1618. for win32
  1619. Revision 1.16 1998/06/01 16:50:22 peter
  1620. + boolean -> ord conversion
  1621. * fixed ord -> boolean conversion
  1622. Revision 1.15 1998/05/30 14:31:11 peter
  1623. + $ASMMODE
  1624. Revision 1.14 1998/05/29 13:24:45 peter
  1625. + asw assembler
  1626. Revision 1.13 1998/05/27 00:20:33 peter
  1627. * some scanner optimizes
  1628. * automaticly aout2exe for go32v1
  1629. * fixed dynamiclinker option which was added at the wrong place
  1630. Revision 1.12 1998/05/23 01:21:32 peter
  1631. + aktasmmode, aktoptprocessor, aktoutputformat
  1632. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1633. + $LIBNAME to set the library name where the unit will be put in
  1634. * splitted cgi386 a bit (codeseg to large for bp7)
  1635. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1636. Revision 1.11 1998/05/22 12:32:49 peter
  1637. * fixed -L on the commandline, Dos commandline is only 128 bytes
  1638. Revision 1.10 1998/05/11 13:07:58 peter
  1639. + $ifdef NEWPPU for the new ppuformat
  1640. + $define GDB not longer required
  1641. * removed all warnings and stripped some log comments
  1642. * no findfirst/findnext anymore to remove smartlink *.o files
  1643. Revision 1.9 1998/05/06 08:38:49 pierre
  1644. * better position info with UseTokenInfo
  1645. UseTokenInfo greatly simplified
  1646. + added check for changed tree after first time firstpass
  1647. (if we could remove all the cases were it happen
  1648. we could skip all firstpass if firstpasscount > 1)
  1649. Only with ExtDebug
  1650. Revision 1.8 1998/05/04 20:19:54 peter
  1651. * small fix for go32v2
  1652. Revision 1.7 1998/05/04 17:54:29 peter
  1653. + smartlinking works (only case jumptable left todo)
  1654. * redesign of systems.pas to support assemblers and linkers
  1655. + Unitname is now also in the PPU-file, increased version to 14
  1656. Revision 1.6 1998/05/01 07:43:57 florian
  1657. + basics for rtti implemented
  1658. + switch $m (generate rtti for published sections)
  1659. Revision 1.5 1998/04/29 10:34:06 pierre
  1660. + added some code for ansistring (not complete nor working yet)
  1661. * corrected operator overloading
  1662. * corrected nasm output
  1663. + started inline procedures
  1664. + added starstarn : use ** for exponentiation (^ gave problems)
  1665. + started UseTokenInfo cond to get accurate positions
  1666. Revision 1.4 1998/04/27 15:45:20 peter
  1667. + -Xl for smartlink
  1668. + target_info.arext = .a
  1669. Revision 1.3 1998/04/16 10:50:45 daniel
  1670. * Fixed some things that were broken for OS/2.
  1671. }