systems.pas 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672
  1. {
  2. $Id$
  3. Copyright (C) 1998-2000 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,powerpc
  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,asmmode_alpha_direct,asmmode_powerpc_direct
  39. );
  40. const
  41. {$ifdef i386} i386asmmodecnt=3; {$else} i386asmmodecnt=0; {$endif}
  42. {$ifdef m68k} m68kasmmodecnt=1; {$else} m68kasmmodecnt=0; {$endif}
  43. {$ifdef alpha} alphaasmmodecnt=1; {$else} alphaasmmodecnt=0; {$endif}
  44. {$ifdef powerpc} powerpcasmmodecnt=1; {$else} powerpcasmmodecnt=0; {$endif}
  45. asmmodecnt=i386asmmodecnt+m68kasmmodecnt+Alphaasmmodecnt+powerpcasmmodecnt+1;
  46. type
  47. ttarget = (target_none
  48. ,target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
  49. target_i386_OS2,target_i386_Win32
  50. ,target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac,
  51. target_m68k_linux,target_m68k_PalmOS,target_alpha_linux,
  52. target_powerpc_linux,target_powerpc_macos
  53. );
  54. ttargetflags = (tf_none,
  55. tf_supports_stack_checking,tf_need_export,tf_needs_isconsole
  56. );
  57. const
  58. {$ifdef i386} i386targetcnt=5; {$else} i386targetcnt=0; {$endif}
  59. {$ifdef m68k} m68ktargetcnt=5; {$else} m68ktargetcnt=0; {$endif}
  60. {$ifdef alpha} alphatargetcnt=1; {$else} alphatargetcnt=0; {$endif}
  61. {$ifdef powerpc} powerpctargetcnt=2; {$else} powerpctargetcnt=0; {$endif}
  62. targetcnt=i386targetcnt+m68ktargetcnt+alphatargetcnt+powerpctargetcnt+1;
  63. type
  64. tasm = (as_none
  65. ,as_i386_as,as_i386_as_aout,as_i386_asw,
  66. as_i386_nasmcoff,as_i386_nasmwin32,
  67. as_i386_nasmelf,as_i386_nasmobj,
  68. as_i386_tasm,as_i386_masm,
  69. as_i386_dbg,as_i386_coff,as_i386_pecoff
  70. ,as_m68k_as,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw,
  71. as_alpha_as,as_powerpc_as,as_powerpc_mpw
  72. );
  73. { binary assembler writers, needed to test for -a }
  74. const
  75. {$ifdef i386} i386asmcnt=12; {$else} i386asmcnt=0; {$endif}
  76. {$ifdef m68k} m68kasmcnt=5; {$else} m68kasmcnt=0; {$endif}
  77. {$ifdef alpha} alphaasmcnt=1; {$else} alphaasmcnt=0; {$endif}
  78. {$ifdef powerpc} powerpcasmcnt=2; {$else} powerpcasmcnt=0; {$endif}
  79. asmcnt=i386asmcnt+m68kasmcnt+alphaasmcnt+powerpcasmcnt+1;
  80. binassem : set of tasm = [
  81. as_i386_dbg,as_i386_coff,as_i386_pecoff
  82. ];
  83. type
  84. tar = (ar_none
  85. ,ar_i386_ar,ar_i386_arw
  86. ,ar_m68k_ar,ar_alpha_ar,ar_powerpc_ar
  87. );
  88. const
  89. {$ifdef i386} i386arcnt=2; {$else} i386arcnt=0; {$endif}
  90. {$ifdef m68k} m68karcnt=1; {$else} m68karcnt=0; {$endif}
  91. {$ifdef alpha} alphaarcnt=1; {$else} alphaarcnt=0; {$endif}
  92. {$ifdef powerpc} powerpcarcnt=1; {$else} powerpcarcnt=0; {$endif}
  93. arcnt=i386arcnt+m68karcnt+alphaarcnt+powerpcarcnt+1;
  94. type
  95. tres = (res_none
  96. ,res_i386_windres,res_m68k_mpw,res_powerpc_mpw
  97. );
  98. const
  99. {$ifdef i386} i386rescnt=1; {$else} i386rescnt=0; {$endif}
  100. {$ifdef m68k} m68krescnt=1; {$else} m68krescnt=0; {$endif}
  101. {$ifdef alpha} alpharescnt=0; {$else} alpharescnt=0; {$endif}
  102. {$ifdef powerpc} powerpcrescnt=1; {$else} powerpcrescnt=0; {$endif}
  103. rescnt=i386rescnt+m68krescnt+alpharescnt+powerpcrescnt+1;
  104. type
  105. tos = ( os_none,
  106. os_i386_GO32V1,os_i386_GO32V2,os_i386_Linux,os_i386_OS2,
  107. os_i386_Win32,
  108. os_m68k_Amiga,os_m68k_Atari,os_m68k_Mac,os_m68k_Linux,
  109. os_m68k_PalmOS,os_alpha_linux,os_powerpc_linux,os_powerpc_macos
  110. );
  111. const
  112. i386oscnt=5;
  113. m68koscnt=5;
  114. alphaoscnt=1;
  115. powerpcoscnt=2;
  116. oscnt=i386oscnt+m68koscnt+alphaoscnt+powerpcoscnt+1;
  117. type
  118. tosinfo = packed record
  119. id : tos;
  120. name : string[30];
  121. shortname : string[8];
  122. sharedlibext : string[10];
  123. staticlibext,
  124. sourceext,
  125. pasext,
  126. exeext,
  127. defext,
  128. scriptext : string[4];
  129. libprefix : string[3];
  130. Cprefix : string[2];
  131. newline : string[2];
  132. endian : tendian;
  133. stackalignment : {longint this is a little overkill no ?? }byte;
  134. size_of_pointer : byte;
  135. size_of_longint : byte;
  136. use_bound_instruction : boolean;
  137. use_function_relative_addresses : boolean;
  138. end;
  139. tasminfo = packed record
  140. id : tasm;
  141. idtxt : string[9];
  142. asmbin : string[8];
  143. asmcmd : string[50];
  144. allowdirect,
  145. externals,
  146. needar : boolean;
  147. labelprefix : string[2];
  148. comment : string[2];
  149. secnames : array[tsection] of string[20];
  150. end;
  151. tarinfo = packed record
  152. id : tar;
  153. arcmd : string[50];
  154. end;
  155. tresinfo = packed record
  156. id : tres;
  157. resbin : string[8];
  158. rescmd : string[50];
  159. end;
  160. ttargetinfo = packed record
  161. target : ttarget;
  162. flags : set of ttargetflags;
  163. cpu : ttargetcpu;
  164. short_name : string[8];
  165. unit_env : string[12];
  166. system_unit : string[8];
  167. smartext,
  168. unitext,
  169. unitlibext,
  170. asmext,
  171. objext,
  172. resext,
  173. resobjext,
  174. exeext : string[4];
  175. os : tos;
  176. assem : tasm;
  177. assemsrc : tasm; { default source writing assembler }
  178. ar : tar;
  179. res : tres;
  180. heapsize,
  181. maxheapsize,
  182. stacksize : longint;
  183. end;
  184. tasmmodeinfo=packed record
  185. id : tasmmode;
  186. idtxt : string[8];
  187. end;
  188. var
  189. target_cpu : ttargetcpu;
  190. target_info : ttargetinfo;
  191. target_os : tosinfo;
  192. target_asm : tasminfo;
  193. target_ar : tarinfo;
  194. target_res : tresinfo;
  195. target_path : string[12]; { for rtl/<X>/,fcl/<X>/, etc. }
  196. source_os : tosinfo;
  197. function set_target_os(t:tos):boolean;
  198. function set_target_asm(t:tasm):boolean;
  199. function set_target_ar(t:tar):boolean;
  200. function set_target_res(t:tres):boolean;
  201. function set_target_info(t:ttarget):boolean;
  202. function set_string_target(s : string) : boolean;
  203. function set_string_asm(s : string) : boolean;
  204. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  205. procedure InitSystems;
  206. implementation
  207. const
  208. {****************************************************************************
  209. OS Info
  210. ****************************************************************************}
  211. os_infos : array[1..oscnt] of tosinfo = (
  212. (
  213. id : os_none;
  214. name : 'No operating system';
  215. shortname : 'none'
  216. ),
  217. (
  218. id : os_i386_go32v1;
  219. name : 'GO32 V1 DOS extender';
  220. shortname : 'go32v1';
  221. sharedlibext : '.dll';
  222. staticlibext : '.a';
  223. sourceext : '.pp';
  224. pasext : '.pas';
  225. exeext : ''; { No .exe, the linker only output a.out ! }
  226. defext : '.def';
  227. scriptext : '.bat';
  228. libprefix : '';
  229. Cprefix : '_';
  230. newline : #13#10;
  231. endian : endian_little;
  232. stackalignment : 2;
  233. size_of_pointer : 4;
  234. size_of_longint : 4;
  235. use_bound_instruction : false;
  236. use_function_relative_addresses : true
  237. ),
  238. (
  239. id : os_i386_go32v2;
  240. name : 'GO32 V2 DOS extender';
  241. shortname : 'go32v2';
  242. sharedlibext : '.dll';
  243. staticlibext : '.a';
  244. sourceext : '.pp';
  245. pasext : '.pas';
  246. exeext : '.exe';
  247. defext : '.def';
  248. scriptext : '.bat';
  249. libprefix : '';
  250. Cprefix : '_';
  251. newline : #13#10;
  252. endian : endian_little;
  253. stackalignment : 2;
  254. size_of_pointer : 4;
  255. size_of_longint : 4;
  256. use_bound_instruction : false;
  257. use_function_relative_addresses : true
  258. ),
  259. (
  260. id : os_i386_linux;
  261. name : 'Linux for i386';
  262. shortname : 'linux';
  263. sharedlibext : '.so';
  264. staticlibext : '.a';
  265. sourceext : '.pp';
  266. pasext : '.pas';
  267. exeext : '';
  268. defext : '.def';
  269. scriptext : '.sh';
  270. libprefix : 'lib';
  271. Cprefix : '';
  272. newline : #10;
  273. endian : endian_little;
  274. stackalignment : 4;
  275. size_of_pointer : 4;
  276. size_of_longint : 4;
  277. use_bound_instruction : false;
  278. use_function_relative_addresses : true
  279. ),
  280. (
  281. id : os_i386_os2;
  282. name : 'OS/2 via EMX';
  283. shortname : 'os2';
  284. sharedlibext : '.ao2';
  285. staticlibext : '.ao2';
  286. sourceext : '.pas';
  287. pasext : '.pp';
  288. exeext : '.exe';
  289. defext : '.def';
  290. scriptext : '.cmd';
  291. libprefix : '';
  292. Cprefix : '_';
  293. newline : #13#10;
  294. endian : endian_little;
  295. stackalignment : 2;
  296. size_of_pointer : 4;
  297. size_of_longint : 4;
  298. use_bound_instruction : false;
  299. use_function_relative_addresses : false
  300. ),
  301. (
  302. id : os_i386_win32;
  303. name : 'Win32 for i386';
  304. shortname : 'win32';
  305. sharedlibext : '.dll';
  306. staticlibext : '.aw';
  307. sourceext : '.pp';
  308. pasext : '.pas';
  309. exeext : '.exe';
  310. defext : '.def';
  311. scriptext : '.bat';
  312. libprefix : 'lib';
  313. Cprefix : '_';
  314. newline : #13#10;
  315. endian : endian_little;
  316. stackalignment : 4;
  317. size_of_pointer : 4;
  318. size_of_longint : 4;
  319. use_bound_instruction : false;
  320. use_function_relative_addresses : true
  321. ),
  322. (
  323. id : os_m68k_amiga;
  324. name : 'Commodore Amiga';
  325. shortname : 'amiga';
  326. sharedlibext : '.library';
  327. staticlibext : '.a';
  328. sourceext : '.pp';
  329. pasext : '.pas';
  330. exeext : '';
  331. defext : '';
  332. scriptext : '';
  333. libprefix : '';
  334. Cprefix : '_';
  335. newline : #10;
  336. endian : endian_big;
  337. stackalignment : 2;
  338. size_of_pointer : 4;
  339. size_of_longint : 4;
  340. use_bound_instruction : false;
  341. use_function_relative_addresses : false
  342. ),
  343. (
  344. id : os_m68k_atari;
  345. name : 'Atari ST/STE';
  346. shortname : 'atari';
  347. sharedlibext : '.dll';
  348. staticlibext : '.a';
  349. sourceext : '.pp';
  350. pasext : '.pas';
  351. exeext : '.tpp';
  352. defext : '';
  353. scriptext : '';
  354. libprefix : '';
  355. Cprefix : '_';
  356. newline : #10;
  357. endian : endian_big;
  358. stackalignment : 2;
  359. size_of_pointer : 4;
  360. size_of_longint : 4;
  361. use_bound_instruction : false;
  362. use_function_relative_addresses : false
  363. ),
  364. (
  365. id : os_m68k_mac;
  366. name : 'Macintosh m68k';
  367. shortname : 'mac';
  368. sharedlibext : 'Lib';
  369. staticlibext : 'Lib';
  370. sourceext : '.pp';
  371. pasext : '.pas';
  372. exeext : '';
  373. defext : '';
  374. scriptext : '';
  375. libprefix : '';
  376. Cprefix : '_';
  377. newline : #13;
  378. endian : endian_big;
  379. stackalignment : 2;
  380. size_of_pointer : 4;
  381. size_of_longint : 4;
  382. use_bound_instruction : false;
  383. use_function_relative_addresses : false
  384. ),
  385. (
  386. id : os_m68k_linux;
  387. name : 'Linux for m68k';
  388. shortname : 'linux';
  389. sharedlibext : '.so';
  390. staticlibext : '.a';
  391. sourceext : '.pp';
  392. pasext : '.pas';
  393. exeext : '';
  394. defext : '';
  395. scriptext : '.sh';
  396. libprefix : 'lib';
  397. Cprefix : '';
  398. newline : #10;
  399. endian : endian_big;
  400. stackalignment : 2;
  401. size_of_pointer : 4;
  402. size_of_longint : 4;
  403. use_bound_instruction : false;
  404. use_function_relative_addresses : true
  405. ),
  406. (
  407. id : os_m68k_palmos;
  408. name : 'PalmOS';
  409. shortname : 'palmos';
  410. sharedlibext : '.so';
  411. staticlibext : '.a';
  412. sourceext : '.pp';
  413. pasext : '.pas';
  414. exeext : '';
  415. defext : '';
  416. scriptext : '.sh';
  417. libprefix : 'lib';
  418. Cprefix : '_';
  419. newline : #10;
  420. endian : endian_big;
  421. stackalignment : 2;
  422. size_of_pointer : 4;
  423. size_of_longint : 4;
  424. use_bound_instruction : false;
  425. use_function_relative_addresses : false
  426. ),
  427. (
  428. id : os_alpha_linux;
  429. name : 'Linux for Alpha';
  430. shortname : 'axplinux';
  431. sharedlibext : '.so';
  432. staticlibext : '.a';
  433. sourceext : '.pp';
  434. pasext : '.pas';
  435. exeext : '';
  436. defext : '.def';
  437. scriptext : '.sh';
  438. libprefix : 'lib';
  439. Cprefix : '';
  440. newline : #10;
  441. endian : endian_little;
  442. stackalignment : 8;
  443. size_of_pointer : 8;
  444. size_of_longint : 4;
  445. use_bound_instruction : false;
  446. use_function_relative_addresses : true
  447. ),
  448. (
  449. id : os_powerpc_linux;
  450. name : 'Linux for PowerPC';
  451. shortname : 'linuxppc';
  452. sharedlibext : '.so';
  453. staticlibext : '.s';
  454. sourceext : '.pp';
  455. pasext : '.pas';
  456. exeext : '';
  457. defext : '.def';
  458. scriptext : '.sh';
  459. libprefix : 'lib';
  460. Cprefix : '';
  461. newline : #10;
  462. endian : endian_big;
  463. stackalignment : 8;
  464. size_of_pointer : 4;
  465. size_of_longint : 4;
  466. use_bound_instruction : false;
  467. use_function_relative_addresses : true
  468. ),
  469. (
  470. id : os_powerpc_macos;
  471. name : 'MacOs (PowerPC)';
  472. shortname : 'MacOs/PPC';
  473. sharedlibext : 'Lib';
  474. staticlibext : 'Lib';
  475. sourceext : '.pp';
  476. pasext : '.pas';
  477. exeext : '';
  478. defext : '';
  479. scriptext : '';
  480. libprefix : '';
  481. Cprefix : '';
  482. newline : #13;
  483. endian : endian_big;
  484. stackalignment : 8;
  485. size_of_pointer : 4;
  486. size_of_longint : 4;
  487. use_bound_instruction : false;
  488. use_function_relative_addresses : true
  489. )
  490. );
  491. {****************************************************************************
  492. Assembler Info
  493. ****************************************************************************}
  494. as_infos : array[1..asmcnt] of tasminfo = (
  495. (
  496. id : as_none;
  497. idtxt : 'no'
  498. )
  499. {$ifdef i386}
  500. ,(
  501. id : as_i386_as;
  502. idtxt : 'AS';
  503. asmbin : 'as';
  504. asmcmd : '-o $OBJ $ASM';
  505. allowdirect : true;
  506. externals : false;
  507. needar : true;
  508. labelprefix : '.L';
  509. comment : '# ';
  510. secnames : ('',
  511. '.text','.data','.bss',
  512. '','','','','','',
  513. '.stab','.stabstr')
  514. )
  515. ,(
  516. id : as_i386_as_aout;
  517. idtxt : 'AS_AOUT';
  518. asmbin : 'as';
  519. asmcmd : '-o $OBJ $ASM';
  520. allowdirect : true;
  521. externals : false;
  522. needar : true;
  523. labelprefix : 'L';
  524. comment : '# ';
  525. secnames : ('',
  526. '.text','.data','.bss',
  527. '','','','','','',
  528. '.stab','.stabstr')
  529. )
  530. ,(
  531. id : as_i386_asw;
  532. idtxt : 'ASW';
  533. asmbin : 'asw';
  534. asmcmd : '-o $OBJ $ASM';
  535. allowdirect : true;
  536. externals : false;
  537. needar : true;
  538. labelprefix : '.L';
  539. comment : '# ';
  540. secnames : ('',
  541. '.text','.data','.section .bss',
  542. '.section .idata$2','.section .idata$4','.section .idata$5',
  543. '.section .idata$6','.section .idata$7','.section .edata',
  544. '.stab','.stabstr')
  545. )
  546. ,(
  547. id : as_i386_nasmcoff;
  548. idtxt : 'NASMCOFF';
  549. asmbin : 'nasm';
  550. asmcmd : '-f coff -o $OBJ $ASM';
  551. allowdirect : true;
  552. externals : true;
  553. needar : true;
  554. labelprefix : 'L';
  555. comment : '; ';
  556. secnames : ('',
  557. '.text','.data','.bss',
  558. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  559. '.stab','.stabstr')
  560. )
  561. ,(
  562. id : as_i386_nasmwin32;
  563. idtxt : 'NASMWIN32';
  564. asmbin : 'nasm';
  565. asmcmd : '-f win32 -o $OBJ $ASM';
  566. allowdirect : true;
  567. externals : true;
  568. needar : true;
  569. labelprefix : 'L';
  570. comment : '; ';
  571. secnames : ('',
  572. '.text','.data','.bss',
  573. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  574. '.stab','.stabstr')
  575. )
  576. ,(
  577. id : as_i386_nasmelf;
  578. idtxt : 'NASMELF';
  579. asmbin : 'nasm';
  580. asmcmd : '-f elf -o $OBJ $ASM';
  581. allowdirect : true;
  582. externals : true;
  583. needar : true;
  584. labelprefix : 'L';
  585. comment : '; ';
  586. secnames : ('',
  587. '.text','.data','.bss',
  588. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  589. '.stab','.stabstr')
  590. )
  591. ,(
  592. id : as_i386_nasmobj;
  593. idtxt : 'NASMOBJ';
  594. asmbin : 'nasm';
  595. asmcmd : '-f obj -o $OBJ $ASM';
  596. allowdirect : true;
  597. externals : true;
  598. needar : true;
  599. labelprefix : 'L';
  600. comment : '; ';
  601. secnames : ('',
  602. '.text','.data','.bss',
  603. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  604. '.stab','.stabstr')
  605. )
  606. ,(
  607. id : as_i386_tasm;
  608. idtxt : 'TASM';
  609. asmbin : 'tasm';
  610. asmcmd : '/m2 $ASM $OBJ';
  611. allowdirect : true;
  612. externals : true;
  613. needar : true;
  614. labelprefix : '@@';
  615. comment : '; ';
  616. secnames : ('',
  617. 'CODE','DATA','BSS',
  618. '','','','','','',
  619. '','')
  620. )
  621. ,(
  622. id : as_i386_masm;
  623. idtxt : 'MASM';
  624. asmbin : 'masm';
  625. asmcmd : '$ASM $OBJ';
  626. allowdirect : true;
  627. externals : true;
  628. needar : true;
  629. labelprefix : '.L';
  630. comment : '; ';
  631. secnames : ('',
  632. 'CODE','DATA','BSS',
  633. '','','','','','',
  634. '','')
  635. )
  636. ,(
  637. id : as_i386_dbg;
  638. idtxt : 'DBG';
  639. asmbin : '';
  640. asmcmd : '';
  641. allowdirect : false;
  642. externals : true;
  643. needar : false;
  644. labelprefix : 'L';
  645. comment : '';
  646. secnames : ('',
  647. '.text','.data','.bss',
  648. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  649. '.stab','.stabstr')
  650. )
  651. ,(
  652. id : as_i386_coff;
  653. idtxt : 'COFF';
  654. asmbin : '';
  655. asmcmd : '';
  656. allowdirect : false;
  657. externals : true;
  658. needar : false;
  659. labelprefix : '.L';
  660. comment : '';
  661. secnames : ('',
  662. '.text','.data','.bss',
  663. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  664. '.stab','.stabstr')
  665. )
  666. ,(
  667. id : as_i386_pecoff;
  668. idtxt : 'PECOFF';
  669. asmbin : '';
  670. asmcmd : '';
  671. allowdirect : false;
  672. externals : true;
  673. needar : false;
  674. labelprefix : '.L';
  675. comment : '';
  676. secnames : ('',
  677. '.text','.data','.bss',
  678. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  679. '.stab','.stabstr')
  680. )
  681. {$endif i386}
  682. {$ifdef m68k}
  683. ,(
  684. id : as_m68k_as;
  685. idtxt : 'AS';
  686. asmbin : 'as';
  687. asmcmd : '-o $OBJ $ASM';
  688. allowdirect : true;
  689. externals : false;
  690. needar : true;
  691. labelprefix : '.L';
  692. comment : '# ';
  693. secnames : ('',
  694. '.text','.data','.bss',
  695. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  696. '.stab','.stabstr')
  697. )
  698. ,(
  699. id : as_m68k_gas;
  700. idtxt : 'GAS';
  701. asmbin : 'as68k'; { Gas for the Amiga}
  702. asmcmd : '--register-prefix-optional -o $OBJ $ASM';
  703. allowdirect : true;
  704. externals : false;
  705. needar : true;
  706. labelprefix : '.L';
  707. comment : '| ';
  708. secnames : ('',
  709. '.text','.data','.bss',
  710. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  711. '.stab','.stabstr')
  712. )
  713. ,(
  714. id : as_m68k_mit;
  715. idtxt : 'MIT';
  716. asmbin : '';
  717. asmcmd : '-o $OBJ $ASM';
  718. allowdirect : true;
  719. externals : false;
  720. needar : true;
  721. labelprefix : '.L';
  722. comment : '| ';
  723. secnames : ('',
  724. '.text','.data','.bss',
  725. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  726. '.stab','.stabstr')
  727. )
  728. ,(
  729. id : as_m68k_mot;
  730. idtxt : 'MOT';
  731. asmbin : '';
  732. asmcmd : '-o $OBJ $ASM';
  733. allowdirect : true;
  734. externals : false;
  735. needar : true;
  736. labelprefix : '__L';
  737. comment : '| ';
  738. secnames : ('',
  739. '.text','.data','.bss',
  740. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  741. '.stab','.stabstr')
  742. )
  743. ,(
  744. id : as_m68k_mpw;
  745. idtxt : 'MPW';
  746. asmbin : '';
  747. asmcmd : '-model far -o $OBJ $ASM';
  748. allowdirect : true;
  749. externals : false;
  750. needar : true;
  751. labelprefix : '__L';
  752. comment : '* ';
  753. secnames : ('',
  754. '.text','.data','.bss',
  755. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  756. '.stab','.stabstr')
  757. )
  758. {$endif m68k}
  759. {$ifdef alpha}
  760. ,(
  761. id : as_alpha_as;
  762. idtxt : 'AS';
  763. asmbin : 'as';
  764. asmcmd : '-o $OBJ $ASM';
  765. allowdirect : true;
  766. externals : false;
  767. needar : true;
  768. labelprefix : '.L';
  769. comment : '# ';
  770. secnames : ('',
  771. '.text','.data','.bss',
  772. '','','','','','',
  773. '.stab','.stabstr')
  774. )
  775. {$endif}
  776. {$ifdef powerpc}
  777. ,(
  778. id : as_powerpc_as;
  779. idtxt : 'AS';
  780. asmbin : 'as';
  781. asmcmd : '-o $OBJ $ASM';
  782. allowdirect : true;
  783. externals : false;
  784. needar : true;
  785. labelprefix : '.L';
  786. comment : '# ';
  787. secnames : ('',
  788. '.text','.data','.bss',
  789. '','','','','','',
  790. '.stab','.stabstr')
  791. )
  792. ,(
  793. id : as_powerpc_mpw;
  794. idtxt : 'PPCAsm';
  795. asmbin : 'PPCAsm';
  796. asmcmd : '-o $OBJ $ASM';
  797. allowdirect : true;
  798. externals : false;
  799. needar : true;
  800. labelprefix : '.L';
  801. comment : '; ';
  802. secnames : ('',
  803. '.text','.data','.bss',
  804. '','','','','','',
  805. '.stab','.stabstr')
  806. )
  807. {$endif}
  808. );
  809. {****************************************************************************
  810. Ar Info
  811. ****************************************************************************}
  812. ar_infos : array[1..arcnt] of tarinfo = (
  813. (
  814. id : ar_none
  815. )
  816. {$ifdef i386}
  817. ,(
  818. id : ar_i386_ar;
  819. arcmd : 'ar rs $LIB $FILES'
  820. ),
  821. (
  822. id : ar_i386_arw;
  823. arcmd : 'arw rs $LIB $FILES'
  824. )
  825. {$endif i386}
  826. {$ifdef m68k}
  827. ,(
  828. id : ar_m68k_ar;
  829. arcmd : 'ar rs $LIB $FILES'
  830. )
  831. {$endif m68k}
  832. {$ifdef alpha}
  833. ,(
  834. id : ar_alpha_ar;
  835. arcmd : 'ar rs $LIB $FILES'
  836. )
  837. {$endif}
  838. {$ifdef powerpc}
  839. ,(
  840. id : ar_powerpc_ar;
  841. arcmd : 'ar rs $LIB $FILES'
  842. )
  843. {$endif}
  844. );
  845. {****************************************************************************
  846. Res Info
  847. ****************************************************************************}
  848. res_infos : array[1..rescnt] of tresinfo = (
  849. (
  850. id : res_none
  851. )
  852. {$ifdef i386}
  853. ,(
  854. id : res_i386_windres;
  855. resbin : 'windres';
  856. rescmd : '--include $INC -O coff -o $OBJ $RES'
  857. )
  858. {$endif i386}
  859. {$ifdef m68k}
  860. ,(
  861. id : res_m68k_mpw;
  862. resbin : 'rez';
  863. rescmd : '-i $INC -o $OBJ $RES'
  864. )
  865. {$endif m68}
  866. {$ifdef powerpc}
  867. ,(
  868. id : res_powerpc_mpw;
  869. resbin : 'rez';
  870. rescmd : '-i $INC -o $OBJ $RES'
  871. )
  872. {$endif powerpc}
  873. );
  874. {****************************************************************************
  875. Targets Info
  876. ****************************************************************************}
  877. target_infos : array[1..targetcnt] of ttargetinfo = (
  878. (
  879. target : target_none;
  880. flags : [];
  881. cpu : no_cpu;
  882. short_name : 'notarget'
  883. )
  884. {$ifdef i386}
  885. ,(
  886. target : target_i386_GO32V1;
  887. flags : [];
  888. cpu : i386;
  889. short_name : 'GO32V1';
  890. unit_env : 'GO32V1UNITS';
  891. system_unit : 'SYSTEM';
  892. smartext : '.sl';
  893. unitext : '.pp1';
  894. unitlibext : '.ppl';
  895. asmext : '.s1';
  896. objext : '.o1';
  897. resext : '.res';
  898. resobjext : '.o1r';
  899. exeext : ''; { The linker produces a.out }
  900. os : os_i386_GO32V1;
  901. assem : as_i386_as;
  902. assemsrc : as_i386_as;
  903. ar : ar_i386_ar;
  904. res : res_none;
  905. heapsize : 2048*1024;
  906. maxheapsize : 32768*1024;
  907. stacksize : 16384
  908. ),
  909. (
  910. target : target_i386_GO32V2;
  911. flags : [];
  912. cpu : i386;
  913. short_name : 'GO32V2';
  914. unit_env : 'GO32V2UNITS';
  915. system_unit : 'SYSTEM';
  916. smartext : '.sl';
  917. unitext : '.ppu';
  918. unitlibext : '.ppl';
  919. asmext : '.s';
  920. objext : '.o';
  921. resext : '.res';
  922. resobjext : '.or';
  923. exeext : '.exe';
  924. os : os_i386_GO32V2;
  925. assem : as_i386_coff;
  926. assemsrc : as_i386_as;
  927. ar : ar_i386_ar;
  928. res : res_none;
  929. heapsize : 2048*1024;
  930. maxheapsize : 32768*1024;
  931. stacksize : 16384
  932. ),
  933. (
  934. target : target_i386_LINUX;
  935. flags : [];
  936. cpu : i386;
  937. short_name : 'LINUX';
  938. unit_env : 'LINUXUNITS';
  939. system_unit : 'syslinux';
  940. smartext : '.sl';
  941. unitext : '.ppu';
  942. unitlibext : '.ppl';
  943. asmext : '.s';
  944. objext : '.o';
  945. resext : '.res';
  946. resobjext : '.or';
  947. exeext : '';
  948. os : os_i386_Linux;
  949. assem : as_i386_as;
  950. assemsrc : as_i386_as;
  951. ar : ar_i386_ar;
  952. res : res_none;
  953. heapsize : 256*1024;
  954. maxheapsize : 32768*1024;
  955. stacksize : 8192
  956. ),
  957. (
  958. target : target_i386_OS2;
  959. flags : [tf_need_export];
  960. cpu : i386;
  961. short_name : 'OS2';
  962. unit_env : 'OS2UNITS';
  963. system_unit : 'SYSOS2';
  964. smartext : '.sl';
  965. unitext : '.ppo';
  966. unitlibext : '.ppl';
  967. asmext : '.so2';
  968. objext : '.oo2';
  969. resext : '.res';
  970. resobjext : '.oor';
  971. exeext : ''; { The linker produces a.out }
  972. os : os_i386_OS2;
  973. assem : as_i386_as_aout;
  974. assemsrc : as_i386_as_aout;
  975. ar : ar_i386_ar;
  976. res : res_none;
  977. heapsize : 256*1024;
  978. maxheapsize : 32768*1024;
  979. stacksize : 32768
  980. ),
  981. (
  982. target : target_i386_WIN32;
  983. flags : [];
  984. cpu : i386;
  985. short_name : 'WIN32';
  986. unit_env : 'WIN32UNITS';
  987. system_unit : 'SYSWIN32';
  988. smartext : '.slw';
  989. unitext : '.ppw';
  990. unitlibext : '.ppl';
  991. asmext : '.sw';
  992. objext : '.ow';
  993. resext : '.rc';
  994. resobjext : '.owr';
  995. exeext : '.exe';
  996. os : os_i386_Win32;
  997. assem : as_i386_pecoff;
  998. assemsrc : as_i386_asw;
  999. ar : ar_i386_arw;
  1000. res : res_i386_windres;
  1001. heapsize : 256*1024;
  1002. maxheapsize : 32*1024*1024;
  1003. stacksize : 32*1024*1024
  1004. )
  1005. {$endif i386}
  1006. {$ifdef m68k}
  1007. ,(
  1008. target : target_m68k_Amiga;
  1009. flags : [];
  1010. cpu : m68k;
  1011. short_name : 'AMIGA';
  1012. unit_env : '';
  1013. system_unit : 'sysamiga';
  1014. smartext : '.sl';
  1015. unitext : '.ppa';
  1016. unitlibext : '.ppl';
  1017. asmext : '.asm';
  1018. objext : '.o';
  1019. resext : '.res';
  1020. resobjext : '.or';
  1021. exeext : '';
  1022. os : os_m68k_Amiga;
  1023. assem : as_m68k_as;
  1024. assemsrc : as_m68k_as;
  1025. ar : ar_m68k_ar;
  1026. res : res_none;
  1027. heapsize : 128*1024;
  1028. maxheapsize : 32768*1024;
  1029. stacksize : 8192
  1030. ),
  1031. (
  1032. target : target_m68k_Atari;
  1033. flags : [];
  1034. cpu : m68k;
  1035. short_name : 'ATARI';
  1036. unit_env : '';
  1037. system_unit : 'SYSATARI';
  1038. smartext : '.sl';
  1039. unitext : '.ppt';
  1040. unitlibext : '.ppl';
  1041. asmext : '.s';
  1042. objext : '.o';
  1043. resext : '.res';
  1044. resobjext : '.or';
  1045. exeext : '.ttp';
  1046. os : os_m68k_Atari;
  1047. assem : as_m68k_as;
  1048. assemsrc : as_m68k_as;
  1049. ar : ar_m68k_ar;
  1050. res : res_none;
  1051. heapsize : 16*1024;
  1052. maxheapsize : 32768*1024;
  1053. stacksize : 8192
  1054. ),
  1055. (
  1056. target : target_m68k_Mac;
  1057. flags : [];
  1058. cpu : m68k;
  1059. short_name : 'MACOS';
  1060. unit_env : '';
  1061. system_unit : 'sysmac';
  1062. smartext : '.sl';
  1063. unitext : '.ppt';
  1064. unitlibext : '.ppl';
  1065. asmext : '.a';
  1066. objext : '.o';
  1067. resext : '.res';
  1068. resobjext : '.or';
  1069. exeext : '';
  1070. os : os_m68k_Mac;
  1071. assem : as_m68k_mpw;
  1072. assemsrc : as_m68k_mpw;
  1073. ar : ar_m68k_ar;
  1074. res : res_none;
  1075. heapsize : 128*1024;
  1076. maxheapsize : 32768*1024;
  1077. stacksize : 8192
  1078. ),
  1079. (
  1080. target : target_m68k_linux;
  1081. flags : [];
  1082. cpu : m68k;
  1083. short_name : 'LINUX';
  1084. unit_env : 'LINUXUNITS';
  1085. system_unit : 'syslinux';
  1086. smartext : '.sl';
  1087. unitext : '.ppu';
  1088. unitlibext : '.ppl';
  1089. asmext : '.s';
  1090. objext : '.o';
  1091. resext : '.res';
  1092. resobjext : '.or';
  1093. exeext : '';
  1094. os : os_m68k_Linux;
  1095. assem : as_m68k_as;
  1096. assemsrc : as_m68k_as;
  1097. ar : ar_m68k_ar;
  1098. res : res_none;
  1099. heapsize : 128*1024;
  1100. maxheapsize : 32768*1024;
  1101. stacksize : 8192
  1102. ),
  1103. (
  1104. target : target_m68k_PalmOS;
  1105. flags : [];
  1106. cpu : m68k;
  1107. short_name : 'PALMOS';
  1108. unit_env : 'PALMUNITS';
  1109. system_unit : 'syspalm';
  1110. smartext : '.sl';
  1111. unitext : '.ppu';
  1112. unitlibext : '.ppl';
  1113. asmext : '.s';
  1114. objext : '.o';
  1115. resext : '.res';
  1116. resobjext : '.or';
  1117. exeext : '';
  1118. os : os_m68k_PalmOS;
  1119. assem : as_m68k_as;
  1120. assemsrc : as_m68k_as;
  1121. ar : ar_m68k_ar;
  1122. res : res_none;
  1123. heapsize : 128*1024;
  1124. maxheapsize : 32768*1024;
  1125. stacksize : 8192
  1126. )
  1127. {$endif m68k}
  1128. {$ifdef alpha}
  1129. ,(
  1130. target : target_alpha_LINUX;
  1131. flags : [];
  1132. cpu : alpha;
  1133. short_name : 'LINUX';
  1134. unit_env : 'LINUXUNITS';
  1135. system_unit : 'syslinux';
  1136. smartext : '.sl';
  1137. unitext : '.ppu';
  1138. unitlibext : '.ppl';
  1139. asmext : '.s';
  1140. objext : '.o';
  1141. resext : '.res';
  1142. resobjext : '.or';
  1143. exeext : '';
  1144. os : os_alpha_Linux;
  1145. assem : as_alpha_as;
  1146. assemsrc : as_alpha_as;
  1147. ar : ar_alpha_ar;
  1148. res : res_none;
  1149. heapsize : 256*1024;
  1150. maxheapsize : 32768*1024;
  1151. stacksize : 8192
  1152. )
  1153. {$endif}
  1154. {$ifdef powerpc}
  1155. ,(
  1156. target : target_powerpc_LINUX;
  1157. flags : [];
  1158. cpu : powerpc;
  1159. short_name : 'LINUX';
  1160. unit_env : '';
  1161. system_unit : 'syslinux';
  1162. smartext : '.sl';
  1163. unitext : '.ppu';
  1164. unitlibext : '.ppl';
  1165. asmext : '.s';
  1166. objext : '.o';
  1167. resext : '.res';
  1168. resobjext : '.or';
  1169. exeext : '';
  1170. os : os_powerpc_Linux;
  1171. assem : as_powerpc_as;
  1172. assemsrc : as_powerpc_as;
  1173. ar : ar_powerpc_ar;
  1174. res : res_none;
  1175. heapsize : 256*1024;
  1176. maxheapsize : 32768*1024;
  1177. stacksize : 8192
  1178. ),
  1179. (
  1180. target : target_powerpc_MACOS;
  1181. flags : [];
  1182. cpu : powerpc;
  1183. short_name : 'MACOS';
  1184. unit_env : '';
  1185. system_unit : 'sysmac';
  1186. smartext : '.sl';
  1187. unitext : '.ppt';
  1188. unitlibext : '.ppl';
  1189. asmext : '.a';
  1190. objext : '.o';
  1191. resext : '.res';
  1192. resobjext : '.or';
  1193. exeext : '';
  1194. os : os_powerpc_macos;
  1195. assem : as_powerpc_mpw;
  1196. assemsrc : as_powerpc_mpw;
  1197. ar : ar_powerpc_ar;
  1198. res : res_powerpc_mpw;
  1199. heapsize : 256*1024;
  1200. maxheapsize : 32768*1024;
  1201. stacksize : 8192
  1202. )
  1203. {$endif}
  1204. );
  1205. {****************************************************************************
  1206. AsmModeInfo
  1207. ****************************************************************************}
  1208. asmmodeinfos : array[1..asmmodecnt] of tasmmodeinfo = (
  1209. (
  1210. id : asmmode_none;
  1211. idtxt : 'none'
  1212. )
  1213. {$ifdef i386}
  1214. ,(
  1215. id : asmmode_i386_direct;
  1216. idtxt : 'DIRECT'
  1217. ),
  1218. (
  1219. id : asmmode_i386_att;
  1220. idtxt : 'ATT'
  1221. ),
  1222. (
  1223. id : asmmode_i386_intel;
  1224. idtxt : 'INTEL'
  1225. )
  1226. {$endif i386}
  1227. {$ifdef m68k}
  1228. ,(
  1229. id : asmmode_m68k_mot;
  1230. idtxt : 'MOT'
  1231. )
  1232. {$endif m68k}
  1233. {$ifdef alpha}
  1234. ,(
  1235. id : asmmode_alpha_direct;
  1236. idtxt : 'DIRECT'
  1237. )
  1238. {$endif}
  1239. {$ifdef powerpc}
  1240. ,(
  1241. id : asmmode_powerpc_direct;
  1242. idtxt : 'DIRECT'
  1243. )
  1244. {$endif}
  1245. );
  1246. {****************************************************************************
  1247. Helpers
  1248. ****************************************************************************}
  1249. function upper(const s : string) : string;
  1250. var
  1251. i : longint;
  1252. begin
  1253. for i:=1 to length(s) do
  1254. if s[i] in ['a'..'z'] then
  1255. upper[i]:=char(byte(s[i])-32)
  1256. else
  1257. upper[i]:=s[i];
  1258. {$ifndef TP}
  1259. {$ifopt H+}
  1260. SetLength(upper,length(s));
  1261. {$else}
  1262. upper[0]:=s[0];
  1263. {$endif}
  1264. {$else}
  1265. upper[0]:=s[0];
  1266. {$endif}
  1267. end;
  1268. function lower(const s : string) : string;
  1269. var
  1270. i : longint;
  1271. begin
  1272. for i:=1 to length(s) do
  1273. if s[i] in ['A'..'Z'] then
  1274. lower[i]:=char(byte(s[i])+32)
  1275. else
  1276. lower[i]:=s[i];
  1277. {$ifndef TP}
  1278. {$ifopt H+}
  1279. setlength(lower,length(s));
  1280. {$else}
  1281. lower[0]:=s[0];
  1282. {$endif}
  1283. {$else}
  1284. lower[0]:=s[0];
  1285. {$endif}
  1286. end;
  1287. function set_target_os(t:tos):boolean;
  1288. var
  1289. i : longint;
  1290. begin
  1291. set_target_os:=false;
  1292. { target 1 is none }
  1293. for i:=2 to oscnt do
  1294. if os_infos[i].id=t then
  1295. begin
  1296. target_os:=os_infos[i];
  1297. set_target_os:=true;
  1298. exit;
  1299. end;
  1300. end;
  1301. function set_target_asm(t:tasm):boolean;
  1302. var
  1303. i : longint;
  1304. begin
  1305. set_target_asm:=false;
  1306. for i:=1 to asmcnt do
  1307. if as_infos[i].id=t then
  1308. begin
  1309. target_asm:=as_infos[i];
  1310. set_target_asm:=true;
  1311. exit;
  1312. end;
  1313. end;
  1314. function set_target_ar(t:tar):boolean;
  1315. var
  1316. i : longint;
  1317. begin
  1318. set_target_ar:=false;
  1319. for i:=1 to arcnt do
  1320. if ar_infos[i].id=t then
  1321. begin
  1322. target_ar:=ar_infos[i];
  1323. set_target_ar:=true;
  1324. exit;
  1325. end;
  1326. end;
  1327. function set_target_res(t:tres):boolean;
  1328. var
  1329. i : longint;
  1330. begin
  1331. set_target_res:=false;
  1332. for i:=1 to rescnt do
  1333. if res_infos[i].id=t then
  1334. begin
  1335. target_res:=res_infos[i];
  1336. set_target_res:=true;
  1337. exit;
  1338. end;
  1339. end;
  1340. function set_target_info(t:ttarget):boolean;
  1341. var
  1342. i : longint;
  1343. begin
  1344. set_target_info:=false;
  1345. for i:=1 to targetcnt do
  1346. if target_infos[i].target=t then
  1347. begin
  1348. target_info:=target_infos[i];
  1349. set_target_os(target_info.os);
  1350. set_target_asm(target_info.assem);
  1351. set_target_ar(target_info.ar);
  1352. set_target_res(target_info.res);
  1353. target_path:=lower(target_info.short_name);
  1354. target_cpu:=target_info.cpu;
  1355. set_target_info:=true;
  1356. exit;
  1357. end;
  1358. end;
  1359. {****************************************************************************
  1360. Load from string
  1361. ****************************************************************************}
  1362. function set_string_target(s : string) : boolean;
  1363. var
  1364. i : longint;
  1365. begin
  1366. set_string_target:=false;
  1367. { this should be case insensitive !! PM }
  1368. s:=upper(s);
  1369. for i:=1 to targetcnt do
  1370. if target_infos[i].short_name=s then
  1371. begin
  1372. set_target_info(target_infos[i].target);
  1373. set_string_target:=true;
  1374. exit;
  1375. end;
  1376. end;
  1377. function set_string_asm(s : string) : boolean;
  1378. var
  1379. i : longint;
  1380. begin
  1381. set_string_asm:=false;
  1382. { this should be case insensitive !! PM }
  1383. s:=upper(s);
  1384. for i:=1 to asmcnt do
  1385. if as_infos[i].idtxt=s then
  1386. begin
  1387. target_asm:=as_infos[i];
  1388. set_string_asm:=true;
  1389. end;
  1390. end;
  1391. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  1392. var
  1393. i : longint;
  1394. begin
  1395. set_string_asmmode:=false;
  1396. { this should be case insensitive !! PM }
  1397. s:=upper(s);
  1398. for i:=1 to asmmodecnt do
  1399. if asmmodeinfos[i].idtxt=s then
  1400. begin
  1401. t:=asmmodeinfos[i].id;
  1402. set_string_asmmode:=true;
  1403. end;
  1404. end;
  1405. {****************************************************************************
  1406. Initialization of default target
  1407. ****************************************************************************}
  1408. procedure default_os(t:ttarget);
  1409. begin
  1410. set_target_info(t);
  1411. if source_os.name='' then
  1412. source_os:=target_os;
  1413. end;
  1414. procedure set_source_os(t:tos);
  1415. var
  1416. i : longint;
  1417. begin
  1418. { can't use message() here (PFV) }
  1419. if source_os.name<>'' then
  1420. Writeln('Warning: Source OS Redefined!');
  1421. for i:=1 to oscnt do
  1422. if os_infos[i].id=t then
  1423. begin
  1424. source_os:=os_infos[i];
  1425. exit;
  1426. end;
  1427. end;
  1428. procedure InitSystems;
  1429. begin
  1430. { first get source OS }
  1431. source_os.name:='';
  1432. { please note then we use cpu86 and cpu68 here on purpose !! }
  1433. {$ifdef cpu86}
  1434. {$ifdef GO32V1}
  1435. set_source_os(os_i386_GO32V1);
  1436. {$else}
  1437. {$ifdef GO32V2}
  1438. set_source_os(os_i386_GO32V2);
  1439. {$else}
  1440. {$ifdef OS2}
  1441. set_source_os(os_i386_OS2);
  1442. if (OS_Mode = osDOS) or (OS_Mode = osDPMI)
  1443. then source_os.scriptext := '.bat';
  1444. {OS/2 via EMX can be run under DOS as well}
  1445. {$else}
  1446. {$ifdef LINUX}
  1447. set_source_os(os_i386_LINUX);
  1448. {$else}
  1449. {$ifdef WIN32}
  1450. set_source_os(os_i386_WIN32);
  1451. {$endif win32}
  1452. {$endif linux}
  1453. {$endif os2}
  1454. {$endif go32v2}
  1455. {$endif go32v1}
  1456. {$endif cpu86}
  1457. {$ifdef cpu68}
  1458. {$ifdef AMIGA}
  1459. set_source_os(os_m68k_Amiga);
  1460. {$else}
  1461. {$ifdef ATARI}
  1462. set_source_os(os_m68k_Atari);
  1463. {$else}
  1464. {$ifdef MACOS}
  1465. set_source_os(os_m68k_MAC);
  1466. {$else}
  1467. {$ifdef LINUX}
  1468. set_source_os(os_m68k_linux);
  1469. {$endif linux}
  1470. {$endif macos}
  1471. {$endif atari}
  1472. {$endif amiga}
  1473. {$endif cpu68}
  1474. { Now default target !! }
  1475. {$ifdef i386}
  1476. {$ifdef GO32V1}
  1477. default_os(target_i386_GO32V1);
  1478. {$else}
  1479. {$ifdef GO32V2}
  1480. default_os(target_i386_GO32V2);
  1481. {$else}
  1482. {$ifdef OS2}
  1483. default_os(target_i386_OS2);
  1484. {$else}
  1485. {$ifdef LINUX}
  1486. default_os(target_i386_LINUX);
  1487. {$else}
  1488. {$ifdef WIN32}
  1489. default_os(target_i386_WIN32);
  1490. {$else}
  1491. default_os(target_i386_GO32V2);
  1492. {$endif win32}
  1493. {$endif linux}
  1494. {$endif os2}
  1495. {$endif go32v2}
  1496. {$endif go32v1}
  1497. {$endif i386}
  1498. {$ifdef m68k}
  1499. {$ifdef AMIGA}
  1500. default_os(target_m68k_Amiga);
  1501. {$else}
  1502. {$ifdef ATARI}
  1503. default_os(target_m68k_Atari);
  1504. {$else}
  1505. {$ifdef MACOS}
  1506. default_os(target_m68k_Mac);
  1507. {$else}
  1508. {$ifdef LINUX}
  1509. default_os(target_m68k_linux);
  1510. {$else}
  1511. default_os(target_m68k_Amiga);
  1512. {$endif linux}
  1513. {$endif macos}
  1514. {$endif atari}
  1515. {$endif amiga}
  1516. {$endif m68k}
  1517. {$ifdef alpha}
  1518. default_os(target_alpha_linux);
  1519. {$endif alpha}
  1520. {$ifdef powerpc}
  1521. default_os(target_powerpc_linux);
  1522. {$endif powerpc}
  1523. end;
  1524. begin
  1525. InitSystems;
  1526. end.
  1527. {
  1528. $Log$
  1529. Revision 1.102 2000-04-22 14:25:03 jonas
  1530. * aasm.pas: pai_align instead of pai_align_abstract if cpu <> i386
  1531. + systems.pas: info for macos/ppc
  1532. * new/cgobj.pas: compiles again without newst define
  1533. * new/powerpc/cgcpu: generate different entry/exit code depending on
  1534. whether target_os is MacOs or Linux
  1535. Revision 1.101 2000/04/04 14:18:15 pierre
  1536. * nasmwin32 is 9 chars long, idtxt changed accordingly
  1537. Revision 1.100 2000/04/04 13:54:58 pierre
  1538. + nasmwin32 for win32 object output with nasm assembler
  1539. Revision 1.99 2000/02/09 13:23:06 peter
  1540. * log truncated
  1541. Revision 1.98 2000/01/07 01:14:42 peter
  1542. * updated copyright to 2000
  1543. Revision 1.97 1999/11/06 14:34:28 peter
  1544. * truncated log to 20 revs
  1545. Revision 1.96 1999/11/03 23:43:45 peter
  1546. * fixed ar commands
  1547. Revision 1.95 1999/10/21 14:29:37 peter
  1548. * redesigned linker object
  1549. + library support for linux (only procedures can be exported)
  1550. Revision 1.94 1999/09/15 22:09:27 florian
  1551. + rtti is now automatically generated for published classes, i.e.
  1552. they are handled like an implicit property
  1553. Revision 1.93 1999/09/15 20:24:56 daniel
  1554. + Dw switch now does something.
  1555. Revision 1.92 1999/09/07 15:02:41 pierre
  1556. * powerpc default was alpha !!
  1557. Revision 1.91 1999/08/16 15:35:29 pierre
  1558. * fix for DLL relocation problems
  1559. * external bss vars had wrong stabs for pecoff
  1560. + -WB11000000 to specify default image base, allows to
  1561. load several DLLs with debugging info included
  1562. (relocatable DLL are stripped because the relocation
  1563. of the .Stab section is misplaced by ldw)
  1564. Revision 1.90 1999/08/04 13:03:11 jonas
  1565. * all tokens now start with an underscore
  1566. * PowerPC compiles!!
  1567. Revision 1.89 1999/08/04 00:23:32 florian
  1568. * renamed i386asm and i386base to cpuasm and cpubase
  1569. Revision 1.88 1999/08/03 22:03:23 peter
  1570. * moved bitmask constants to sets
  1571. * some other type/const renamings
  1572. Revision 1.87 1999/08/03 17:09:43 florian
  1573. * the alpha compiler can be compiled now
  1574. Revision 1.86 1999/08/03 15:52:00 michael
  1575. * changed shortname for linux alpha
  1576. Revision 1.85 1999/08/03 13:50:19 michael
  1577. + Changes for alpha
  1578. Revision 1.84 1999/08/02 23:56:51 michael
  1579. + Added alpha cpu and linux for alpha os
  1580. }