systems.pas 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591
  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
  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=1; {$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
  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=1; {$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
  97. );
  98. const
  99. {$ifdef i386} i386rescnt=1; {$else} i386rescnt=0; {$endif}
  100. {$ifdef m68k} m68krescnt=0; {$else} m68krescnt=0; {$endif}
  101. {$ifdef alpha} alpharescnt=0; {$else} alpharescnt=0; {$endif}
  102. {$ifdef powerpc} powerpcrescnt=0; {$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
  110. );
  111. const
  112. i386oscnt=5;
  113. m68koscnt=5;
  114. alphaoscnt=1;
  115. powerpcoscnt=1;
  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 : '.dll';
  369. staticlibext : '.a';
  370. sourceext : '.pp';
  371. pasext : '.pas';
  372. exeext : '.tpp';
  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 : '.a';
  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. {****************************************************************************
  471. Assembler Info
  472. ****************************************************************************}
  473. as_infos : array[1..asmcnt] of tasminfo = (
  474. (
  475. id : as_none;
  476. idtxt : 'no'
  477. )
  478. {$ifdef i386}
  479. ,(
  480. id : as_i386_as;
  481. idtxt : 'AS';
  482. asmbin : 'as';
  483. asmcmd : '-o $OBJ $ASM';
  484. allowdirect : true;
  485. externals : false;
  486. needar : true;
  487. labelprefix : '.L';
  488. comment : '# ';
  489. secnames : ('',
  490. '.text','.data','.bss',
  491. '','','','','','',
  492. '.stab','.stabstr')
  493. )
  494. ,(
  495. id : as_i386_as_aout;
  496. idtxt : 'AS_AOUT';
  497. asmbin : 'as';
  498. asmcmd : '-o $OBJ $ASM';
  499. allowdirect : true;
  500. externals : false;
  501. needar : true;
  502. labelprefix : 'L';
  503. comment : '# ';
  504. secnames : ('',
  505. '.text','.data','.bss',
  506. '','','','','','',
  507. '.stab','.stabstr')
  508. )
  509. ,(
  510. id : as_i386_asw;
  511. idtxt : 'ASW';
  512. asmbin : 'asw';
  513. asmcmd : '-o $OBJ $ASM';
  514. allowdirect : true;
  515. externals : false;
  516. needar : true;
  517. labelprefix : '.L';
  518. comment : '# ';
  519. secnames : ('',
  520. '.text','.data','.section .bss',
  521. '.section .idata$2','.section .idata$4','.section .idata$5',
  522. '.section .idata$6','.section .idata$7','.section .edata',
  523. '.stab','.stabstr')
  524. )
  525. ,(
  526. id : as_i386_nasmcoff;
  527. idtxt : 'NASMCOFF';
  528. asmbin : 'nasm';
  529. asmcmd : '-f coff -o $OBJ $ASM';
  530. allowdirect : true;
  531. externals : true;
  532. needar : true;
  533. labelprefix : 'L';
  534. comment : '; ';
  535. secnames : ('',
  536. '.text','.data','.bss',
  537. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  538. '.stab','.stabstr')
  539. )
  540. ,(
  541. id : as_i386_nasmwin32;
  542. idtxt : 'NASMWIN32';
  543. asmbin : 'nasm';
  544. asmcmd : '-f win32 -o $OBJ $ASM';
  545. allowdirect : true;
  546. externals : true;
  547. needar : true;
  548. labelprefix : 'L';
  549. comment : '; ';
  550. secnames : ('',
  551. '.text','.data','.bss',
  552. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  553. '.stab','.stabstr')
  554. )
  555. ,(
  556. id : as_i386_nasmelf;
  557. idtxt : 'NASMELF';
  558. asmbin : 'nasm';
  559. asmcmd : '-f elf -o $OBJ $ASM';
  560. allowdirect : true;
  561. externals : true;
  562. needar : true;
  563. labelprefix : 'L';
  564. comment : '; ';
  565. secnames : ('',
  566. '.text','.data','.bss',
  567. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  568. '.stab','.stabstr')
  569. )
  570. ,(
  571. id : as_i386_nasmobj;
  572. idtxt : 'NASMOBJ';
  573. asmbin : 'nasm';
  574. asmcmd : '-f obj -o $OBJ $ASM';
  575. allowdirect : true;
  576. externals : true;
  577. needar : true;
  578. labelprefix : 'L';
  579. comment : '; ';
  580. secnames : ('',
  581. '.text','.data','.bss',
  582. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  583. '.stab','.stabstr')
  584. )
  585. ,(
  586. id : as_i386_tasm;
  587. idtxt : 'TASM';
  588. asmbin : 'tasm';
  589. asmcmd : '/m2 $ASM $OBJ';
  590. allowdirect : true;
  591. externals : true;
  592. needar : true;
  593. labelprefix : '@@';
  594. comment : '; ';
  595. secnames : ('',
  596. 'CODE','DATA','BSS',
  597. '','','','','','',
  598. '','')
  599. )
  600. ,(
  601. id : as_i386_masm;
  602. idtxt : 'MASM';
  603. asmbin : 'masm';
  604. asmcmd : '$ASM $OBJ';
  605. allowdirect : true;
  606. externals : true;
  607. needar : true;
  608. labelprefix : '.L';
  609. comment : '; ';
  610. secnames : ('',
  611. 'CODE','DATA','BSS',
  612. '','','','','','',
  613. '','')
  614. )
  615. ,(
  616. id : as_i386_dbg;
  617. idtxt : 'DBG';
  618. asmbin : '';
  619. asmcmd : '';
  620. allowdirect : false;
  621. externals : true;
  622. needar : false;
  623. labelprefix : 'L';
  624. comment : '';
  625. secnames : ('',
  626. '.text','.data','.bss',
  627. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  628. '.stab','.stabstr')
  629. )
  630. ,(
  631. id : as_i386_coff;
  632. idtxt : 'COFF';
  633. asmbin : '';
  634. asmcmd : '';
  635. allowdirect : false;
  636. externals : true;
  637. needar : false;
  638. labelprefix : '.L';
  639. comment : '';
  640. secnames : ('',
  641. '.text','.data','.bss',
  642. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  643. '.stab','.stabstr')
  644. )
  645. ,(
  646. id : as_i386_pecoff;
  647. idtxt : 'PECOFF';
  648. asmbin : '';
  649. asmcmd : '';
  650. allowdirect : false;
  651. externals : true;
  652. needar : false;
  653. labelprefix : '.L';
  654. comment : '';
  655. secnames : ('',
  656. '.text','.data','.bss',
  657. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  658. '.stab','.stabstr')
  659. )
  660. {$endif i386}
  661. {$ifdef m68k}
  662. ,(
  663. id : as_m68k_as;
  664. idtxt : 'AS';
  665. asmbin : 'as';
  666. asmcmd : '-o $OBJ $ASM';
  667. allowdirect : true;
  668. externals : false;
  669. needar : true;
  670. labelprefix : '.L';
  671. comment : '# ';
  672. secnames : ('',
  673. '.text','.data','.bss',
  674. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  675. '.stab','.stabstr')
  676. )
  677. ,(
  678. id : as_m68k_gas;
  679. idtxt : 'GAS';
  680. asmbin : 'as68k'; { Gas for the Amiga}
  681. asmcmd : '--register-prefix-optional -o $OBJ $ASM';
  682. allowdirect : true;
  683. externals : false;
  684. needar : true;
  685. labelprefix : '.L';
  686. comment : '| ';
  687. secnames : ('',
  688. '.text','.data','.bss',
  689. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  690. '.stab','.stabstr')
  691. )
  692. ,(
  693. id : as_m68k_mit;
  694. idtxt : 'MIT';
  695. asmbin : '';
  696. asmcmd : '-o $OBJ $ASM';
  697. allowdirect : true;
  698. externals : false;
  699. needar : true;
  700. labelprefix : '.L';
  701. comment : '| ';
  702. secnames : ('',
  703. '.text','.data','.bss',
  704. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  705. '.stab','.stabstr')
  706. )
  707. ,(
  708. id : as_m68k_mot;
  709. idtxt : 'MOT';
  710. asmbin : '';
  711. asmcmd : '-o $OBJ $ASM';
  712. allowdirect : true;
  713. externals : false;
  714. needar : true;
  715. labelprefix : '__L';
  716. comment : '| ';
  717. secnames : ('',
  718. '.text','.data','.bss',
  719. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  720. '.stab','.stabstr')
  721. )
  722. ,(
  723. id : as_m68k_mpw;
  724. idtxt : 'MPW';
  725. asmbin : '';
  726. asmcmd : '-model far -o $OBJ $ASM';
  727. allowdirect : true;
  728. externals : false;
  729. needar : true;
  730. labelprefix : '__L';
  731. comment : '| ';
  732. secnames : ('',
  733. '.text','.data','.bss',
  734. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  735. '.stab','.stabstr')
  736. )
  737. {$endif m68k}
  738. {$ifdef alpha}
  739. ,(
  740. id : as_alpha_as;
  741. idtxt : 'AS';
  742. asmbin : 'as';
  743. asmcmd : '-o $OBJ $ASM';
  744. allowdirect : true;
  745. externals : false;
  746. needar : true;
  747. labelprefix : '.L';
  748. comment : '# ';
  749. secnames : ('',
  750. '.text','.data','.bss',
  751. '','','','','','',
  752. '.stab','.stabstr')
  753. )
  754. {$endif}
  755. {$ifdef powerpc}
  756. ,(
  757. id : as_powerpc_as;
  758. idtxt : 'AS';
  759. asmbin : 'as';
  760. asmcmd : '-o $OBJ $ASM';
  761. allowdirect : true;
  762. externals : false;
  763. needar : true;
  764. labelprefix : '.L';
  765. comment : '# ';
  766. secnames : ('',
  767. '.text','.data','.bss',
  768. '','','','','','',
  769. '.stab','.stabstr')
  770. )
  771. {$endif}
  772. );
  773. {****************************************************************************
  774. Ar Info
  775. ****************************************************************************}
  776. ar_infos : array[1..arcnt] of tarinfo = (
  777. (
  778. id : ar_none
  779. )
  780. {$ifdef i386}
  781. ,(
  782. id : ar_i386_ar;
  783. arcmd : 'ar rs $LIB $FILES'
  784. ),
  785. (
  786. id : ar_i386_arw;
  787. arcmd : 'arw rs $LIB $FILES'
  788. )
  789. {$endif i386}
  790. {$ifdef m68k}
  791. ,(
  792. id : ar_m68k_ar;
  793. arcmd : 'ar rs $LIB $FILES'
  794. )
  795. {$endif m68k}
  796. {$ifdef alpha}
  797. ,(
  798. id : ar_alpha_ar;
  799. arcmd : 'ar rs $LIB $FILES'
  800. )
  801. {$endif}
  802. {$ifdef powerpc}
  803. ,(
  804. id : ar_powerpc_ar;
  805. arcmd : 'ar rs $LIB $FILES'
  806. )
  807. {$endif}
  808. );
  809. {****************************************************************************
  810. Res Info
  811. ****************************************************************************}
  812. res_infos : array[1..rescnt] of tresinfo = (
  813. (
  814. id : res_none
  815. )
  816. {$ifdef i386}
  817. ,(
  818. id : res_i386_windres;
  819. resbin : 'windres';
  820. rescmd : '--include $INC -O coff -o $OBJ $RES'
  821. )
  822. {$endif i386}
  823. );
  824. {****************************************************************************
  825. Targets Info
  826. ****************************************************************************}
  827. target_infos : array[1..targetcnt] of ttargetinfo = (
  828. (
  829. target : target_none;
  830. flags : [];
  831. cpu : no_cpu;
  832. short_name : 'notarget'
  833. )
  834. {$ifdef i386}
  835. ,(
  836. target : target_i386_GO32V1;
  837. flags : [];
  838. cpu : i386;
  839. short_name : 'GO32V1';
  840. unit_env : 'GO32V1UNITS';
  841. system_unit : 'SYSTEM';
  842. smartext : '.sl';
  843. unitext : '.pp1';
  844. unitlibext : '.ppl';
  845. asmext : '.s1';
  846. objext : '.o1';
  847. resext : '.res';
  848. resobjext : '.o1r';
  849. exeext : ''; { The linker produces a.out }
  850. os : os_i386_GO32V1;
  851. assem : as_i386_as;
  852. assemsrc : as_i386_as;
  853. ar : ar_i386_ar;
  854. res : res_none;
  855. heapsize : 2048*1024;
  856. maxheapsize : 32768*1024;
  857. stacksize : 16384
  858. ),
  859. (
  860. target : target_i386_GO32V2;
  861. flags : [];
  862. cpu : i386;
  863. short_name : 'GO32V2';
  864. unit_env : 'GO32V2UNITS';
  865. system_unit : 'SYSTEM';
  866. smartext : '.sl';
  867. unitext : '.ppu';
  868. unitlibext : '.ppl';
  869. asmext : '.s';
  870. objext : '.o';
  871. resext : '.res';
  872. resobjext : '.or';
  873. exeext : '.exe';
  874. os : os_i386_GO32V2;
  875. assem : as_i386_coff;
  876. assemsrc : as_i386_as;
  877. ar : ar_i386_ar;
  878. res : res_none;
  879. heapsize : 2048*1024;
  880. maxheapsize : 32768*1024;
  881. stacksize : 16384
  882. ),
  883. (
  884. target : target_i386_LINUX;
  885. flags : [];
  886. cpu : i386;
  887. short_name : 'LINUX';
  888. unit_env : 'LINUXUNITS';
  889. system_unit : 'syslinux';
  890. smartext : '.sl';
  891. unitext : '.ppu';
  892. unitlibext : '.ppl';
  893. asmext : '.s';
  894. objext : '.o';
  895. resext : '.res';
  896. resobjext : '.or';
  897. exeext : '';
  898. os : os_i386_Linux;
  899. assem : as_i386_as;
  900. assemsrc : as_i386_as;
  901. ar : ar_i386_ar;
  902. res : res_none;
  903. heapsize : 256*1024;
  904. maxheapsize : 32768*1024;
  905. stacksize : 8192
  906. ),
  907. (
  908. target : target_i386_OS2;
  909. flags : [tf_need_export];
  910. cpu : i386;
  911. short_name : 'OS2';
  912. unit_env : 'OS2UNITS';
  913. system_unit : 'SYSOS2';
  914. smartext : '.sl';
  915. unitext : '.ppo';
  916. unitlibext : '.ppl';
  917. asmext : '.so2';
  918. objext : '.oo2';
  919. resext : '.res';
  920. resobjext : '.oor';
  921. exeext : ''; { The linker produces a.out }
  922. os : os_i386_OS2;
  923. assem : as_i386_as_aout;
  924. assemsrc : as_i386_as_aout;
  925. ar : ar_i386_ar;
  926. res : res_none;
  927. heapsize : 256*1024;
  928. maxheapsize : 32768*1024;
  929. stacksize : 32768
  930. ),
  931. (
  932. target : target_i386_WIN32;
  933. flags : [];
  934. cpu : i386;
  935. short_name : 'WIN32';
  936. unit_env : 'WIN32UNITS';
  937. system_unit : 'SYSWIN32';
  938. smartext : '.slw';
  939. unitext : '.ppw';
  940. unitlibext : '.ppl';
  941. asmext : '.sw';
  942. objext : '.ow';
  943. resext : '.rc';
  944. resobjext : '.owr';
  945. exeext : '.exe';
  946. os : os_i386_Win32;
  947. assem : as_i386_pecoff;
  948. assemsrc : as_i386_asw;
  949. ar : ar_i386_arw;
  950. res : res_i386_windres;
  951. heapsize : 256*1024;
  952. maxheapsize : 32*1024*1024;
  953. stacksize : 32*1024*1024
  954. )
  955. {$endif i386}
  956. {$ifdef m68k}
  957. ,(
  958. target : target_m68k_Amiga;
  959. flags : [];
  960. cpu : m68k;
  961. short_name : 'AMIGA';
  962. unit_env : '';
  963. system_unit : 'sysamiga';
  964. smartext : '.sl';
  965. unitext : '.ppa';
  966. unitlibext : '.ppl';
  967. asmext : '.asm';
  968. objext : '.o';
  969. resext : '.res';
  970. resobjext : '.or';
  971. exeext : '';
  972. os : os_m68k_Amiga;
  973. assem : as_m68k_as;
  974. assemsrc : as_m68k_as;
  975. ar : ar_m68k_ar;
  976. res : res_none;
  977. heapsize : 128*1024;
  978. maxheapsize : 32768*1024;
  979. stacksize : 8192
  980. ),
  981. (
  982. target : target_m68k_Atari;
  983. flags : [];
  984. cpu : m68k;
  985. short_name : 'ATARI';
  986. unit_env : '';
  987. system_unit : 'SYSATARI';
  988. smartext : '.sl';
  989. unitext : '.ppt';
  990. unitlibext : '.ppl';
  991. asmext : '.s';
  992. objext : '.o';
  993. resext : '.res';
  994. resobjext : '.or';
  995. exeext : '.ttp';
  996. os : os_m68k_Atari;
  997. assem : as_m68k_as;
  998. assemsrc : as_m68k_as;
  999. ar : ar_m68k_ar;
  1000. res : res_none;
  1001. heapsize : 16*1024;
  1002. maxheapsize : 32768*1024;
  1003. stacksize : 8192
  1004. ),
  1005. (
  1006. target : target_m68k_Mac;
  1007. flags : [];
  1008. cpu : m68k;
  1009. short_name : 'MACOS';
  1010. unit_env : '';
  1011. system_unit : 'sysmac';
  1012. smartext : '.sl';
  1013. unitext : '.ppt';
  1014. unitlibext : '.ppl';
  1015. asmext : '.a';
  1016. objext : '.o';
  1017. resext : '.res';
  1018. resobjext : '.or';
  1019. exeext : '';
  1020. os : os_m68k_Mac;
  1021. assem : as_m68k_mpw;
  1022. assemsrc : as_m68k_mpw;
  1023. ar : ar_m68k_ar;
  1024. res : res_none;
  1025. heapsize : 128*1024;
  1026. maxheapsize : 32768*1024;
  1027. stacksize : 8192
  1028. ),
  1029. (
  1030. target : target_m68k_linux;
  1031. flags : [];
  1032. cpu : m68k;
  1033. short_name : 'LINUX';
  1034. unit_env : 'LINUXUNITS';
  1035. system_unit : 'syslinux';
  1036. smartext : '.sl';
  1037. unitext : '.ppu';
  1038. unitlibext : '.ppl';
  1039. asmext : '.s';
  1040. objext : '.o';
  1041. resext : '.res';
  1042. resobjext : '.or';
  1043. exeext : '';
  1044. os : os_m68k_Linux;
  1045. assem : as_m68k_as;
  1046. assemsrc : as_m68k_as;
  1047. ar : ar_m68k_ar;
  1048. res : res_none;
  1049. heapsize : 128*1024;
  1050. maxheapsize : 32768*1024;
  1051. stacksize : 8192
  1052. ),
  1053. (
  1054. target : target_m68k_PalmOS;
  1055. flags : [];
  1056. cpu : m68k;
  1057. short_name : 'PALMOS';
  1058. unit_env : 'PALMUNITS';
  1059. system_unit : 'syspalm';
  1060. smartext : '.sl';
  1061. unitext : '.ppu';
  1062. unitlibext : '.ppl';
  1063. asmext : '.s';
  1064. objext : '.o';
  1065. resext : '.res';
  1066. resobjext : '.or';
  1067. exeext : '';
  1068. os : os_m68k_PalmOS;
  1069. assem : as_m68k_as;
  1070. assemsrc : as_m68k_as;
  1071. ar : ar_m68k_ar;
  1072. res : res_none;
  1073. heapsize : 128*1024;
  1074. maxheapsize : 32768*1024;
  1075. stacksize : 8192
  1076. )
  1077. {$endif m68k}
  1078. {$ifdef alpha}
  1079. ,(
  1080. target : target_alpha_LINUX;
  1081. flags : [];
  1082. cpu : alpha;
  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_alpha_Linux;
  1095. assem : as_alpha_as;
  1096. assemsrc : as_alpha_as;
  1097. ar : ar_alpha_ar;
  1098. res : res_none;
  1099. heapsize : 256*1024;
  1100. maxheapsize : 32768*1024;
  1101. stacksize : 8192
  1102. )
  1103. {$endif}
  1104. {$ifdef powerpc}
  1105. ,(
  1106. target : target_powerpc_LINUX;
  1107. flags : [];
  1108. cpu : alpha;
  1109. short_name : 'LINUX';
  1110. unit_env : 'LINUXUNITS';
  1111. system_unit : 'syslinux';
  1112. smartext : '.sl';
  1113. unitext : '.ppu';
  1114. unitlibext : '.ppl';
  1115. asmext : '.s';
  1116. objext : '.o';
  1117. resext : '.res';
  1118. resobjext : '.or';
  1119. exeext : '';
  1120. os : os_powerpc_Linux;
  1121. assem : as_powerpc_as;
  1122. assemsrc : as_powerpc_as;
  1123. ar : ar_powerpc_ar;
  1124. res : res_none;
  1125. heapsize : 256*1024;
  1126. maxheapsize : 32768*1024;
  1127. stacksize : 8192
  1128. )
  1129. {$endif}
  1130. );
  1131. {****************************************************************************
  1132. AsmModeInfo
  1133. ****************************************************************************}
  1134. asmmodeinfos : array[1..asmmodecnt] of tasmmodeinfo = (
  1135. (
  1136. id : asmmode_none;
  1137. idtxt : 'none'
  1138. )
  1139. {$ifdef i386}
  1140. ,(
  1141. id : asmmode_i386_direct;
  1142. idtxt : 'DIRECT'
  1143. ),
  1144. (
  1145. id : asmmode_i386_att;
  1146. idtxt : 'ATT'
  1147. ),
  1148. (
  1149. id : asmmode_i386_intel;
  1150. idtxt : 'INTEL'
  1151. )
  1152. {$endif i386}
  1153. {$ifdef m68k}
  1154. ,(
  1155. id : asmmode_m68k_mot;
  1156. idtxt : 'MOT'
  1157. )
  1158. {$endif m68k}
  1159. {$ifdef alpha}
  1160. ,(
  1161. id : asmmode_alpha_direct;
  1162. idtxt : 'DIRECT'
  1163. )
  1164. {$endif}
  1165. {$ifdef powerpc}
  1166. ,(
  1167. id : asmmode_powerpc_direct;
  1168. idtxt : 'DIRECT'
  1169. )
  1170. {$endif}
  1171. );
  1172. {****************************************************************************
  1173. Helpers
  1174. ****************************************************************************}
  1175. function upper(const s : string) : string;
  1176. var
  1177. i : longint;
  1178. begin
  1179. for i:=1 to length(s) do
  1180. if s[i] in ['a'..'z'] then
  1181. upper[i]:=char(byte(s[i])-32)
  1182. else
  1183. upper[i]:=s[i];
  1184. {$ifndef TP}
  1185. {$ifopt H+}
  1186. SetLength(upper,length(s));
  1187. {$else}
  1188. upper[0]:=s[0];
  1189. {$endif}
  1190. {$else}
  1191. upper[0]:=s[0];
  1192. {$endif}
  1193. end;
  1194. function lower(const s : string) : string;
  1195. var
  1196. i : longint;
  1197. begin
  1198. for i:=1 to length(s) do
  1199. if s[i] in ['A'..'Z'] then
  1200. lower[i]:=char(byte(s[i])+32)
  1201. else
  1202. lower[i]:=s[i];
  1203. {$ifndef TP}
  1204. {$ifopt H+}
  1205. setlength(lower,length(s));
  1206. {$else}
  1207. lower[0]:=s[0];
  1208. {$endif}
  1209. {$else}
  1210. lower[0]:=s[0];
  1211. {$endif}
  1212. end;
  1213. function set_target_os(t:tos):boolean;
  1214. var
  1215. i : longint;
  1216. begin
  1217. set_target_os:=false;
  1218. { target 1 is none }
  1219. for i:=2 to oscnt do
  1220. if os_infos[i].id=t then
  1221. begin
  1222. target_os:=os_infos[i];
  1223. set_target_os:=true;
  1224. exit;
  1225. end;
  1226. end;
  1227. function set_target_asm(t:tasm):boolean;
  1228. var
  1229. i : longint;
  1230. begin
  1231. set_target_asm:=false;
  1232. for i:=1 to asmcnt do
  1233. if as_infos[i].id=t then
  1234. begin
  1235. target_asm:=as_infos[i];
  1236. set_target_asm:=true;
  1237. exit;
  1238. end;
  1239. end;
  1240. function set_target_ar(t:tar):boolean;
  1241. var
  1242. i : longint;
  1243. begin
  1244. set_target_ar:=false;
  1245. for i:=1 to arcnt do
  1246. if ar_infos[i].id=t then
  1247. begin
  1248. target_ar:=ar_infos[i];
  1249. set_target_ar:=true;
  1250. exit;
  1251. end;
  1252. end;
  1253. function set_target_res(t:tres):boolean;
  1254. var
  1255. i : longint;
  1256. begin
  1257. set_target_res:=false;
  1258. for i:=1 to rescnt do
  1259. if res_infos[i].id=t then
  1260. begin
  1261. target_res:=res_infos[i];
  1262. set_target_res:=true;
  1263. exit;
  1264. end;
  1265. end;
  1266. function set_target_info(t:ttarget):boolean;
  1267. var
  1268. i : longint;
  1269. begin
  1270. set_target_info:=false;
  1271. for i:=1 to targetcnt do
  1272. if target_infos[i].target=t then
  1273. begin
  1274. target_info:=target_infos[i];
  1275. set_target_os(target_info.os);
  1276. set_target_asm(target_info.assem);
  1277. set_target_ar(target_info.ar);
  1278. set_target_res(target_info.res);
  1279. target_path:=lower(target_info.short_name);
  1280. target_cpu:=target_info.cpu;
  1281. set_target_info:=true;
  1282. exit;
  1283. end;
  1284. end;
  1285. {****************************************************************************
  1286. Load from string
  1287. ****************************************************************************}
  1288. function set_string_target(s : string) : boolean;
  1289. var
  1290. i : longint;
  1291. begin
  1292. set_string_target:=false;
  1293. { this should be case insensitive !! PM }
  1294. s:=upper(s);
  1295. for i:=1 to targetcnt do
  1296. if target_infos[i].short_name=s then
  1297. begin
  1298. set_target_info(target_infos[i].target);
  1299. set_string_target:=true;
  1300. exit;
  1301. end;
  1302. end;
  1303. function set_string_asm(s : string) : boolean;
  1304. var
  1305. i : longint;
  1306. begin
  1307. set_string_asm:=false;
  1308. { this should be case insensitive !! PM }
  1309. s:=upper(s);
  1310. for i:=1 to asmcnt do
  1311. if as_infos[i].idtxt=s then
  1312. begin
  1313. target_asm:=as_infos[i];
  1314. set_string_asm:=true;
  1315. end;
  1316. end;
  1317. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  1318. var
  1319. i : longint;
  1320. begin
  1321. set_string_asmmode:=false;
  1322. { this should be case insensitive !! PM }
  1323. s:=upper(s);
  1324. for i:=1 to asmmodecnt do
  1325. if asmmodeinfos[i].idtxt=s then
  1326. begin
  1327. t:=asmmodeinfos[i].id;
  1328. set_string_asmmode:=true;
  1329. end;
  1330. end;
  1331. {****************************************************************************
  1332. Initialization of default target
  1333. ****************************************************************************}
  1334. procedure default_os(t:ttarget);
  1335. begin
  1336. set_target_info(t);
  1337. if source_os.name='' then
  1338. source_os:=target_os;
  1339. end;
  1340. procedure set_source_os(t:tos);
  1341. var
  1342. i : longint;
  1343. begin
  1344. { can't use message() here (PFV) }
  1345. if source_os.name<>'' then
  1346. Writeln('Warning: Source OS Redefined!');
  1347. for i:=1 to oscnt do
  1348. if os_infos[i].id=t then
  1349. begin
  1350. source_os:=os_infos[i];
  1351. exit;
  1352. end;
  1353. end;
  1354. procedure InitSystems;
  1355. begin
  1356. { first get source OS }
  1357. source_os.name:='';
  1358. { please note then we use cpu86 and cpu68 here on purpose !! }
  1359. {$ifdef cpu86}
  1360. {$ifdef GO32V1}
  1361. set_source_os(os_i386_GO32V1);
  1362. {$else}
  1363. {$ifdef GO32V2}
  1364. set_source_os(os_i386_GO32V2);
  1365. {$else}
  1366. {$ifdef OS2}
  1367. set_source_os(os_i386_OS2);
  1368. if (OS_Mode = osDOS) or (OS_Mode = osDPMI)
  1369. then source_os.scriptext := '.bat';
  1370. {OS/2 via EMX can be run under DOS as well}
  1371. {$else}
  1372. {$ifdef LINUX}
  1373. set_source_os(os_i386_LINUX);
  1374. {$else}
  1375. {$ifdef WIN32}
  1376. set_source_os(os_i386_WIN32);
  1377. {$endif win32}
  1378. {$endif linux}
  1379. {$endif os2}
  1380. {$endif go32v2}
  1381. {$endif go32v1}
  1382. {$endif cpu86}
  1383. {$ifdef cpu68}
  1384. {$ifdef AMIGA}
  1385. set_source_os(os_m68k_Amiga);
  1386. {$else}
  1387. {$ifdef ATARI}
  1388. set_source_os(os_m68k_Atari);
  1389. {$else}
  1390. {$ifdef MACOS}
  1391. set_source_os(os_m68k_MAC);
  1392. {$else}
  1393. {$ifdef LINUX}
  1394. set_source_os(os_m68k_linux);
  1395. {$endif linux}
  1396. {$endif macos}
  1397. {$endif atari}
  1398. {$endif amiga}
  1399. {$endif cpu68}
  1400. { Now default target !! }
  1401. {$ifdef i386}
  1402. {$ifdef GO32V1}
  1403. default_os(target_i386_GO32V1);
  1404. {$else}
  1405. {$ifdef GO32V2}
  1406. default_os(target_i386_GO32V2);
  1407. {$else}
  1408. {$ifdef OS2}
  1409. default_os(target_i386_OS2);
  1410. {$else}
  1411. {$ifdef LINUX}
  1412. default_os(target_i386_LINUX);
  1413. {$else}
  1414. {$ifdef WIN32}
  1415. default_os(target_i386_WIN32);
  1416. {$else}
  1417. default_os(target_i386_GO32V2);
  1418. {$endif win32}
  1419. {$endif linux}
  1420. {$endif os2}
  1421. {$endif go32v2}
  1422. {$endif go32v1}
  1423. {$endif i386}
  1424. {$ifdef m68k}
  1425. {$ifdef AMIGA}
  1426. default_os(target_m68k_Amiga);
  1427. {$else}
  1428. {$ifdef ATARI}
  1429. default_os(target_m68k_Atari);
  1430. {$else}
  1431. {$ifdef MACOS}
  1432. default_os(target_m68k_Mac);
  1433. {$else}
  1434. {$ifdef LINUX}
  1435. default_os(target_m68k_linux);
  1436. {$else}
  1437. default_os(target_m68k_Amiga);
  1438. {$endif linux}
  1439. {$endif macos}
  1440. {$endif atari}
  1441. {$endif amiga}
  1442. {$endif m68k}
  1443. {$ifdef alpha}
  1444. default_os(target_alpha_linux);
  1445. {$endif alpha}
  1446. {$ifdef powerpc}
  1447. default_os(target_powerpc_linux);
  1448. {$endif powerpc}
  1449. end;
  1450. begin
  1451. InitSystems;
  1452. end.
  1453. {
  1454. $Log$
  1455. Revision 1.101 2000-04-04 14:18:15 pierre
  1456. * nasmwin32 is 9 chars long, idtxt changed accordingly
  1457. Revision 1.100 2000/04/04 13:54:58 pierre
  1458. + nasmwin32 for win32 object output with nasm assembler
  1459. Revision 1.99 2000/02/09 13:23:06 peter
  1460. * log truncated
  1461. Revision 1.98 2000/01/07 01:14:42 peter
  1462. * updated copyright to 2000
  1463. Revision 1.97 1999/11/06 14:34:28 peter
  1464. * truncated log to 20 revs
  1465. Revision 1.96 1999/11/03 23:43:45 peter
  1466. * fixed ar commands
  1467. Revision 1.95 1999/10/21 14:29:37 peter
  1468. * redesigned linker object
  1469. + library support for linux (only procedures can be exported)
  1470. Revision 1.94 1999/09/15 22:09:27 florian
  1471. + rtti is now automatically generated for published classes, i.e.
  1472. they are handled like an implicit property
  1473. Revision 1.93 1999/09/15 20:24:56 daniel
  1474. + Dw switch now does something.
  1475. Revision 1.92 1999/09/07 15:02:41 pierre
  1476. * powerpc default was alpha !!
  1477. Revision 1.91 1999/08/16 15:35:29 pierre
  1478. * fix for DLL relocation problems
  1479. * external bss vars had wrong stabs for pecoff
  1480. + -WB11000000 to specify default image base, allows to
  1481. load several DLLs with debugging info included
  1482. (relocatable DLL are stripped because the relocation
  1483. of the .Stab section is misplaced by ldw)
  1484. Revision 1.90 1999/08/04 13:03:11 jonas
  1485. * all tokens now start with an underscore
  1486. * PowerPC compiles!!
  1487. Revision 1.89 1999/08/04 00:23:32 florian
  1488. * renamed i386asm and i386base to cpuasm and cpubase
  1489. Revision 1.88 1999/08/03 22:03:23 peter
  1490. * moved bitmask constants to sets
  1491. * some other type/const renamings
  1492. Revision 1.87 1999/08/03 17:09:43 florian
  1493. * the alpha compiler can be compiled now
  1494. Revision 1.86 1999/08/03 15:52:00 michael
  1495. * changed shortname for linux alpha
  1496. Revision 1.85 1999/08/03 13:50:19 michael
  1497. + Changes for alpha
  1498. Revision 1.84 1999/08/02 23:56:51 michael
  1499. + Added alpha cpu and linux for alpha os
  1500. }