systems.pas 59 KB

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