systems.pas 55 KB

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