systems.pas 50 KB

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