systems.pas 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333
  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. type
  31. tasmmode= (asmmode_none
  32. ,asmmode_i386_direct,asmmode_i386_att,asmmode_i386_intel
  33. ,asmmode_m68k_mot
  34. );
  35. const
  36. {$ifdef i386} i386asmmodecnt=3; {$else} i386asmmodecnt=0; {$endif}
  37. {$ifdef m68k} m68kasmmodecnt=1; {$else} m68kasmmodecnt=0; {$endif}
  38. asmmodecnt=i386asmmodecnt+m68kasmmodecnt+1;
  39. type
  40. ttarget = (target_none
  41. ,target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
  42. target_i386_OS2,target_i386_Win32
  43. ,target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac,
  44. target_m68k_linux,target_m68k_PalmOS
  45. );
  46. const
  47. {$ifdef i386} i386targetcnt=5; {$else} i386targetcnt=0; {$endif}
  48. {$ifdef m68k} m68ktargetcnt=5; {$else} m68ktargetcnt=0; {$endif}
  49. targetcnt=i386targetcnt+m68ktargetcnt+1;
  50. type
  51. tasm = (as_none
  52. ,as_i386_o,as_i386_o_aout,as_i386_asw,
  53. as_i386_nasmcoff,as_i386_nasmelf,as_i386_nasmobj,
  54. as_i386_tasm,as_i386_masm
  55. ,as_m68k_o,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw
  56. );
  57. const
  58. {$ifdef i386} i386asmcnt=8; {$else} i386asmcnt=0; {$endif}
  59. {$ifdef m68k} m68kasmcnt=5; {$else} m68kasmcnt=0; {$endif}
  60. asmcnt=i386asmcnt+m68kasmcnt+1;
  61. type
  62. tlink = (link_none
  63. ,link_i386_ld,link_i386_ldgo32v1,
  64. link_i386_ldgo32v2,link_i386_ldw,
  65. link_i386_ldos2
  66. ,link_m68k_ld
  67. );
  68. const
  69. {$ifdef i386} i386linkcnt=5; {$else} i386linkcnt=0; {$endif}
  70. {$ifdef m68k} m68klinkcnt=1; {$else} m68klinkcnt=0; {$endif}
  71. linkcnt=i386linkcnt+m68klinkcnt+1;
  72. type
  73. tar = (ar_none
  74. ,ar_i386_ar,ar_i386_arw
  75. ,ar_m68k_ar
  76. );
  77. const
  78. {$ifdef i386} i386arcnt=2; {$else} i386arcnt=0; {$endif}
  79. {$ifdef m68k} m68karcnt=1; {$else} m68karcnt=0; {$endif}
  80. arcnt=i386arcnt+m68karcnt+1;
  81. type
  82. tos = ( os_none,
  83. os_i386_GO32V1,os_i386_GO32V2,os_i386_Linux,os_i386_OS2,
  84. os_i386_Win32,
  85. os_m68k_Amiga,os_m68k_Atari,os_m68k_Mac,os_m68k_Linux,
  86. os_m68k_PalmOS
  87. );
  88. const
  89. i386oscnt=5;
  90. m68koscnt=5;
  91. oscnt=i386oscnt+m68koscnt+1;
  92. type
  93. tosinfo = packed record
  94. id : tos;
  95. name : string[30];
  96. sharedlibext,
  97. staticlibext,
  98. sourceext,
  99. pasext,
  100. exeext,
  101. scriptext : string[4];
  102. libprefix : string[3];
  103. Cprefix : string[2];
  104. newline : string[2];
  105. endian : tendian;
  106. use_function_relative_addresses : boolean;
  107. end;
  108. tasminfo = packed record
  109. id : tasm;
  110. idtxt : string[8];
  111. asmbin : string[8];
  112. asmcmd : string[50];
  113. externals : boolean;
  114. labelprefix : string[2];
  115. comment : string[2];
  116. end;
  117. tlinkinfo = packed record
  118. id : tlink;
  119. linkbin : string[8];
  120. linkcmd : string[50];
  121. bindbin : string[8];
  122. bindcmd : string[50];
  123. stripopt : string[2];
  124. libpathprefix : string[13];
  125. libpathsuffix : string[2];
  126. groupstart : string[8];
  127. groupend : string[2];
  128. inputstart : string[8];
  129. inputend : string[2];
  130. libprefix : string[2];
  131. end;
  132. tarinfo = packed record
  133. id : tar;
  134. arbin : string[8];
  135. arcmd : string[50];
  136. end;
  137. ttargetinfo = packed record
  138. target : ttarget;
  139. cpu : ttargetcpu;
  140. short_name : string[8];
  141. unit_env : string[12];
  142. system_unit : string[8];
  143. smartext,
  144. unitext,
  145. unitlibext,
  146. asmext,
  147. objext,
  148. exeext : string[4];
  149. os : tos;
  150. link : tlink;
  151. assem : tasm;
  152. ar : tar;
  153. heapsize,
  154. maxheapsize,
  155. stacksize : longint;
  156. end;
  157. tasmmodeinfo=packed record
  158. id : tasmmode;
  159. idtxt : string[8];
  160. end;
  161. var
  162. target_cpu : ttargetcpu;
  163. target_info : ttargetinfo;
  164. target_os : tosinfo;
  165. target_asm : tasminfo;
  166. target_link : tlinkinfo;
  167. target_ar : tarinfo;
  168. source_os : tosinfo;
  169. function set_string_target(s : string) : boolean;
  170. function set_string_asm(s : string) : boolean;
  171. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  172. implementation
  173. const
  174. {****************************************************************************
  175. OS Info
  176. ****************************************************************************}
  177. os_infos : array[1..oscnt] of tosinfo = (
  178. (
  179. id : os_none;
  180. name : 'No operating system'
  181. ),
  182. (
  183. id : os_i386_go32v1;
  184. name : 'GO32 V1 DOS extender';
  185. sharedlibext : '.dll';
  186. staticlibext : '.a';
  187. sourceext : '.pp';
  188. pasext : '.pas';
  189. exeext : ''; { No .exe, the linker only output a.out ! }
  190. scriptext : '.bat';
  191. libprefix : '';
  192. Cprefix : '_';
  193. newline : #13#10;
  194. endian : endian_little;
  195. use_function_relative_addresses : true
  196. ),
  197. (
  198. id : os_i386_go32v2;
  199. name : 'GO32 V2 DOS extender';
  200. sharedlibext : '.dll';
  201. staticlibext : '.a';
  202. sourceext : '.pp';
  203. pasext : '.pas';
  204. exeext : '.exe';
  205. scriptext : '.bat';
  206. libprefix : '';
  207. Cprefix : '_';
  208. newline : #13#10;
  209. endian : endian_little;
  210. use_function_relative_addresses : true
  211. ),
  212. (
  213. id : os_i386_linux;
  214. name : 'Linux-i386';
  215. sharedlibext : '.so';
  216. staticlibext : '.a';
  217. sourceext : '.pp';
  218. pasext : '.pas';
  219. exeext : '';
  220. scriptext : '.sh';
  221. libprefix : 'lib';
  222. Cprefix : '';
  223. newline : #10;
  224. endian : endian_little;
  225. use_function_relative_addresses : true
  226. ),
  227. (
  228. id : os_i386_os2;
  229. name : 'OS/2 via EMX';
  230. sharedlibext : '.ao2';
  231. staticlibext : '.ao2';
  232. sourceext : '.pas';
  233. pasext : '.pp';
  234. exeext : '.exe';
  235. scriptext : '.cmd';
  236. libprefix : '';
  237. Cprefix : '_';
  238. newline : #13#10;
  239. endian : endian_little;
  240. use_function_relative_addresses : false
  241. ),
  242. (
  243. id : os_i386_win32;
  244. name : 'Win32';
  245. sharedlibext : '.dll';
  246. staticlibext : '.aw';
  247. sourceext : '.pp';
  248. pasext : '.pas';
  249. exeext : '.exe';
  250. scriptext : '.bat';
  251. libprefix : 'lib';
  252. Cprefix : '_';
  253. newline : #13#10;
  254. endian : endian_little;
  255. use_function_relative_addresses : true
  256. ),
  257. (
  258. id : os_m68k_amiga;
  259. name : 'Commodore Amiga';
  260. sharedlibext : '.library';
  261. staticlibext : '.a';
  262. sourceext : '.pp';
  263. pasext : '.pas';
  264. exeext : '';
  265. scriptext : '';
  266. libprefix : '';
  267. Cprefix : '_';
  268. newline : #10;
  269. endian : endian_big;
  270. use_function_relative_addresses : false
  271. ),
  272. (
  273. id : os_m68k_atari;
  274. name : 'Atari ST/STE';
  275. sharedlibext : '.dll';
  276. staticlibext : '.a';
  277. sourceext : '.pp';
  278. pasext : '.pas';
  279. exeext : '.tpp';
  280. scriptext : '';
  281. libprefix : '';
  282. Cprefix : '_';
  283. newline : #10;
  284. endian : endian_big;
  285. use_function_relative_addresses : false
  286. ),
  287. (
  288. id : os_m68k_mac;
  289. name : 'Macintosh m68k';
  290. sharedlibext : '.dll';
  291. staticlibext : '.a';
  292. sourceext : '.pp';
  293. pasext : '.pas';
  294. exeext : '.tpp';
  295. scriptext : '';
  296. libprefix : '';
  297. Cprefix : '_';
  298. newline : #13;
  299. endian : endian_big;
  300. use_function_relative_addresses : false
  301. ),
  302. (
  303. id : os_m68k_linux;
  304. name : 'Linux-m68k';
  305. sharedlibext : '.so';
  306. staticlibext : '.a';
  307. sourceext : '.pp';
  308. pasext : '.pas';
  309. exeext : '';
  310. scriptext : '.sh';
  311. libprefix : 'lib';
  312. Cprefix : '';
  313. newline : #10;
  314. endian : endian_big;
  315. use_function_relative_addresses : true
  316. ),
  317. (
  318. id : os_m68k_palmos;
  319. name : 'PalmOS';
  320. sharedlibext : '.so';
  321. staticlibext : '.a';
  322. sourceext : '.pp';
  323. pasext : '.pas';
  324. exeext : '';
  325. scriptext : '.sh';
  326. libprefix : 'lib';
  327. Cprefix : '_';
  328. newline : #10;
  329. endian : endian_big;
  330. use_function_relative_addresses : false
  331. )
  332. );
  333. {****************************************************************************
  334. Assembler Info
  335. ****************************************************************************}
  336. as_infos : array[1..asmcnt] of tasminfo = (
  337. (
  338. id : as_none;
  339. idtxt : 'no'
  340. )
  341. {$ifdef i386}
  342. ,(
  343. id : as_i386_o;
  344. idtxt : 'O';
  345. asmbin : 'as';
  346. asmcmd : '-o $OBJ $ASM';
  347. externals : false;
  348. labelprefix : '.L';
  349. comment : '# '
  350. )
  351. ,(
  352. id : as_i386_o_aout;
  353. idtxt : 'O_AOUT';
  354. asmbin : 'as';
  355. asmcmd : '-o $OBJ $ASM';
  356. externals : false;
  357. labelprefix : 'L';
  358. comment : '# '
  359. )
  360. ,(
  361. id : as_i386_asw;
  362. idtxt : 'ASW';
  363. asmbin : 'asw';
  364. asmcmd : '-o $OBJ $ASM';
  365. externals : false;
  366. labelprefix : '.L';
  367. comment : '# '
  368. )
  369. ,(
  370. id : as_i386_nasmcoff;
  371. idtxt : 'NASMCOFF';
  372. asmbin : 'nasm';
  373. asmcmd : '-f coff -o $OBJ $ASM';
  374. externals : true;
  375. labelprefix : 'L';
  376. comment : '; '
  377. )
  378. ,(
  379. id : as_i386_nasmelf;
  380. idtxt : 'NASMELF';
  381. asmbin : 'nasm';
  382. asmcmd : '-f elf -o $OBJ $ASM';
  383. externals : true;
  384. labelprefix : 'L';
  385. comment : '; '
  386. )
  387. ,(
  388. id : as_i386_nasmobj;
  389. idtxt : 'NASMOBJ';
  390. asmbin : 'nasm';
  391. asmcmd : '-f obj -o $OBJ $ASM';
  392. externals : true;
  393. labelprefix : 'L';
  394. comment : '; '
  395. )
  396. ,(
  397. id : as_i386_tasm;
  398. idtxt : 'TASM';
  399. asmbin : 'tasm';
  400. asmcmd : '/m2 $ASM $OBJ';
  401. externals : true;
  402. labelprefix : '.L';
  403. comment : '; '
  404. )
  405. ,(
  406. id : as_i386_masm;
  407. idtxt : 'MASM';
  408. asmbin : 'masm';
  409. asmcmd : '$ASM $OBJ';
  410. externals : true;
  411. labelprefix : '.L';
  412. comment : '; '
  413. )
  414. {$endif i386}
  415. {$ifdef m68k}
  416. ,(
  417. id : as_m68k_o;
  418. idtxt : 'O';
  419. asmbin : 'as';
  420. asmcmd : '-o $OBJ $ASM';
  421. externals : false;
  422. labelprefix : '.L';
  423. comment : '# '
  424. )
  425. ,(
  426. id : as_m68k_gas;
  427. idtxt : 'GAS';
  428. asmbin : 'as68k'; { Gas for the Amiga}
  429. asmcmd : '--register-prefix-optional -o $OBJ $ASM';
  430. externals : false;
  431. labelprefix : '.L';
  432. comment : '| '
  433. )
  434. ,(
  435. id : as_m68k_mit;
  436. idtxt : 'MIT';
  437. asmbin : '';
  438. asmcmd : '-o $OBJ $ASM';
  439. externals : false;
  440. labelprefix : '.L';
  441. comment : '| '
  442. )
  443. ,(
  444. id : as_m68k_mot;
  445. idtxt : 'MOT';
  446. asmbin : '';
  447. asmcmd : '-o $OBJ $ASM';
  448. externals : false;
  449. labelprefix : '__L';
  450. comment : '| '
  451. )
  452. ,(
  453. id : as_m68k_mpw;
  454. idtxt : 'MPW';
  455. asmbin : '';
  456. asmcmd : '-model far -o $OBJ $ASM';
  457. externals : false;
  458. labelprefix : '__L';
  459. comment : '| '
  460. )
  461. {$endif m68k}
  462. );
  463. {****************************************************************************
  464. Linker Info
  465. ****************************************************************************}
  466. link_infos : array[1..linkcnt] of tlinkinfo = (
  467. (
  468. id : link_none
  469. )
  470. {$ifdef i386}
  471. ,(
  472. id : link_i386_ld;
  473. linkbin : 'ld';
  474. linkcmd : '$OPT -o $EXE $RES';
  475. bindbin : '';
  476. bindcmd : '';
  477. stripopt : '-s';
  478. libpathprefix : 'SEARCH_DIR(';
  479. libpathsuffix : ')';
  480. groupstart : 'GROUP(';
  481. groupend : ')';
  482. inputstart : 'INPUT(';
  483. inputend : ')';
  484. libprefix : '-l'
  485. )
  486. ,(
  487. id : link_i386_ldgo32v1;
  488. linkbin : 'ld';
  489. linkcmd : '-oformat coff-go32 $OPT -o $EXE @$RES';
  490. bindbin : 'aout2exe';
  491. bindcmd : '$EXE';
  492. stripopt : '-s';
  493. libpathprefix : '-L';
  494. libpathsuffix : '';
  495. groupstart : '-(';
  496. groupend : '-)';
  497. inputstart : '';
  498. inputend : '';
  499. libprefix : '-l'
  500. )
  501. ,(
  502. id : link_i386_ldgo32v2;
  503. linkbin : 'ld';
  504. linkcmd : '-oformat coff-go32-exe $OPT -o $EXE @$RES';
  505. bindbin : '';
  506. bindcmd : '';
  507. stripopt : '-s';
  508. libpathprefix : '-L';
  509. libpathsuffix : '';
  510. groupstart : '-(';
  511. groupend : '-)';
  512. inputstart : '';
  513. inputend : '';
  514. libprefix : '-l'
  515. )
  516. ,(
  517. id : link_i386_ldw;
  518. linkbin : 'ldw';
  519. linkcmd : '$OPT -o $EXE $RES';
  520. bindbin : '';
  521. bindcmd : '';
  522. stripopt : '-s';
  523. libpathprefix : 'SEARCH_DIR(';
  524. libpathsuffix : ')';
  525. groupstart : 'GROUP(';
  526. groupend : ')';
  527. inputstart : 'INPUT(';
  528. inputend : ')';
  529. libprefix : '-l'
  530. )
  531. ,(
  532. id : link_i386_ldos2;
  533. linkbin : 'ld'; { Os/2 }
  534. linkcmd : '-o $EXE @$RES';
  535. bindbin : 'emxbind';
  536. bindcmd : '-b -k$STACKKB -h$HEAPMB -o $EXE.exe $EXE -aim -s$DOSHEAPKB';
  537. stripopt : '-s';
  538. libpathprefix : '-L';
  539. libpathsuffix : '';
  540. groupstart : ''; {Linker is too primitive...}
  541. groupend : '';
  542. inputstart : '';
  543. inputend : '';
  544. libprefix : '-l'
  545. )
  546. {$endif i386}
  547. {$ifdef m68k}
  548. ,(
  549. id : link_m68k_ld;
  550. linkbin : 'ld';
  551. linkcmd : '$OPT -o $EXE $RES';
  552. bindbin : '';
  553. bindcmd : '';
  554. stripopt : '-s';
  555. libpathprefix : 'SEARCH_DIR(';
  556. libpathsuffix : ')';
  557. groupstart : 'GROUP(';
  558. groupend : ')';
  559. inputstart : 'INPUT(';
  560. inputend : ')';
  561. libprefix : '-l'
  562. )
  563. {$endif m68k}
  564. );
  565. {****************************************************************************
  566. Ar Info
  567. ****************************************************************************}
  568. ar_infos : array[1..arcnt] of tarinfo = (
  569. (
  570. id : ar_none
  571. )
  572. {$ifdef i386}
  573. ,(
  574. id : ar_i386_ar;
  575. arbin : 'ar';
  576. arcmd : 'rs $LIB $FILES'
  577. ),
  578. (
  579. id : ar_i386_arw;
  580. arbin : 'arw';
  581. arcmd : 'rs $LIB $FILES'
  582. )
  583. {$endif i386}
  584. {$ifdef m68k}
  585. ,(
  586. id : ar_m68k_ar;
  587. arbin : 'ar';
  588. arcmd : 'rs $LIB $FILES'
  589. )
  590. {$endif m68k}
  591. );
  592. {****************************************************************************
  593. Targets Info
  594. ****************************************************************************}
  595. target_infos : array[1..targetcnt] of ttargetinfo = (
  596. (
  597. target : target_none;
  598. cpu : no_cpu;
  599. short_name : 'notarget'
  600. )
  601. {$ifdef i386}
  602. ,(
  603. target : target_i386_GO32V1;
  604. cpu : i386;
  605. short_name : 'GO32V1';
  606. unit_env : 'GO32V1UNITS';
  607. system_unit : 'SYSTEM';
  608. smartext : '.sl';
  609. unitext : '.pp1';
  610. unitlibext : '.ppl';
  611. asmext : '.s1';
  612. objext : '.o1';
  613. exeext : ''; { The linker produces a.out }
  614. os : os_i386_GO32V1;
  615. link : link_i386_ldgo32v1;
  616. assem : as_i386_o;
  617. ar : ar_i386_ar;
  618. heapsize : 2048*1024;
  619. maxheapsize : 32768*1024;
  620. stacksize : 16384
  621. ),
  622. (
  623. target : target_i386_GO32V2;
  624. cpu : i386;
  625. short_name : 'GO32V2';
  626. unit_env : 'GO32V2UNITS';
  627. system_unit : 'SYSTEM';
  628. smartext : '.sl';
  629. unitext : '.ppu';
  630. unitlibext : '.ppl';
  631. asmext : '.s';
  632. objext : '.o';
  633. exeext : '.exe';
  634. os : os_i386_GO32V2;
  635. link : link_i386_ldgo32v2;
  636. assem : as_i386_o;
  637. ar : ar_i386_ar;
  638. heapsize : 2048*1024;
  639. maxheapsize : 32768*1024;
  640. stacksize : 16384
  641. ),
  642. (
  643. target : target_i386_LINUX;
  644. cpu : i386;
  645. short_name : 'LINUX';
  646. unit_env : 'LINUXUNITS';
  647. system_unit : 'syslinux';
  648. smartext : '.sl';
  649. unitext : '.ppu';
  650. unitlibext : '.ppl';
  651. asmext : '.s';
  652. objext : '.o';
  653. exeext : '';
  654. os : os_i386_Linux;
  655. link : link_i386_ld;
  656. assem : as_i386_o;
  657. ar : ar_i386_ar;
  658. heapsize : 2048*1024;
  659. maxheapsize : 32768*1024;
  660. stacksize : 8192
  661. ),
  662. (
  663. target : target_i386_OS2;
  664. cpu : i386;
  665. short_name : 'OS2';
  666. unit_env : 'OS2UNITS';
  667. system_unit : 'SYSOS2';
  668. smartext : '.sl';
  669. unitext : '.ppo';
  670. unitlibext : '.ppl';
  671. asmext : '.so2';
  672. objext : '.oo2';
  673. exeext : ''; { The linker produces a.out }
  674. os : os_i386_OS2;
  675. link : link_i386_ldos2;
  676. assem : as_i386_o_aout;
  677. ar : ar_i386_ar;
  678. heapsize : 256*1024;
  679. maxheapsize : 32768*1024;
  680. stacksize : 32768
  681. ),
  682. (
  683. target : target_i386_WIN32;
  684. cpu : i386;
  685. short_name : 'WIN32';
  686. unit_env : 'WIN32UNITS';
  687. system_unit : 'SYSWIN32';
  688. smartext : '.slw';
  689. unitext : '.ppw';
  690. unitlibext : '.ppl';
  691. asmext : '.sw';
  692. objext : '.ow';
  693. exeext : '.exe';
  694. os : os_i386_Win32;
  695. link : link_i386_ldw;
  696. assem : as_i386_asw;
  697. ar : ar_i386_arw;
  698. heapsize : 2048*1024;
  699. maxheapsize : 32768*1024;
  700. stacksize : 32768
  701. )
  702. {$endif i386}
  703. {$ifdef m68k}
  704. ,(
  705. target : target_m68k_Amiga;
  706. cpu : m68k;
  707. short_name : 'AMIGA';
  708. unit_env : '';
  709. system_unit : 'sysamiga';
  710. smartext : '.sl';
  711. unitext : '.ppa';
  712. unitlibext : '.ppl';
  713. asmext : '.asm';
  714. objext : '.o';
  715. exeext : '';
  716. os : os_m68k_Amiga;
  717. link : link_m68k_ld;
  718. assem : as_m68k_o;
  719. ar : ar_m68k_ar;
  720. heapsize : 128*1024;
  721. maxheapsize : 32768*1024;
  722. stacksize : 8192
  723. ),
  724. (
  725. target : target_m68k_Atari;
  726. cpu : m68k;
  727. short_name : 'ATARI';
  728. unit_env : '';
  729. system_unit : 'SYSATARI';
  730. smartext : '.sl';
  731. unitext : '.ppt';
  732. unitlibext : '.ppl';
  733. asmext : '.s';
  734. objext : '.o';
  735. exeext : '.ttp';
  736. os : os_m68k_Atari;
  737. link : link_m68k_ld;
  738. assem : as_m68k_o;
  739. ar : ar_m68k_ar;
  740. heapsize : 16*1024;
  741. maxheapsize : 32768*1024;
  742. stacksize : 8192
  743. ),
  744. (
  745. target : target_m68k_Mac;
  746. cpu : m68k;
  747. short_name : 'MACOS';
  748. unit_env : '';
  749. system_unit : 'sysmac';
  750. smartext : '.sl';
  751. unitext : '.ppt';
  752. unitlibext : '.ppl';
  753. asmext : '.a';
  754. objext : '.o';
  755. exeext : '';
  756. os : os_m68k_Mac;
  757. link : link_m68k_ld;
  758. assem : as_m68k_mpw;
  759. ar : ar_m68k_ar;
  760. heapsize : 128*1024;
  761. maxheapsize : 32768*1024;
  762. stacksize : 8192
  763. ),
  764. (
  765. target : target_m68k_linux;
  766. cpu : m68k;
  767. short_name : 'LINUX';
  768. unit_env : 'LINUXUNITS';
  769. system_unit : 'syslinux';
  770. smartext : '.sl';
  771. unitext : '.ppu';
  772. unitlibext : '.ppl';
  773. asmext : '.s';
  774. objext : '.o';
  775. exeext : '';
  776. os : os_m68k_Linux;
  777. link : link_m68k_ld;
  778. assem : as_m68k_o;
  779. ar : ar_m68k_ar;
  780. heapsize : 128*1024;
  781. maxheapsize : 32768*1024;
  782. stacksize : 8192
  783. ),
  784. (
  785. target : target_m68k_PalmOS;
  786. cpu : m68k;
  787. short_name : 'PALMOS';
  788. unit_env : 'PALMUNITS';
  789. system_unit : 'syspalm';
  790. smartext : '.sl';
  791. unitext : '.ppu';
  792. unitlibext : '.ppl';
  793. asmext : '.s';
  794. objext : '.o';
  795. exeext : '';
  796. os : os_m68k_PalmOS;
  797. link : link_m68k_ld;
  798. assem : as_m68k_o;
  799. ar : ar_m68k_ar;
  800. heapsize : 128*1024;
  801. maxheapsize : 32768*1024;
  802. stacksize : 8192
  803. )
  804. {$endif m68k}
  805. );
  806. {****************************************************************************
  807. AsmModeInfo
  808. ****************************************************************************}
  809. asmmodeinfos : array[1..asmmodecnt] of tasmmodeinfo = (
  810. (
  811. id : asmmode_none;
  812. idtxt : 'none'
  813. )
  814. {$ifdef i386}
  815. ,(
  816. id : asmmode_i386_direct;
  817. idtxt : 'DIRECT'
  818. ),
  819. (
  820. id : asmmode_i386_att;
  821. idtxt : 'ATT'
  822. ),
  823. (
  824. id : asmmode_i386_intel;
  825. idtxt : 'INTEL'
  826. )
  827. {$endif i386}
  828. {$ifdef m68k}
  829. ,(
  830. id : asmmode_m68k_mot;
  831. idtxt : 'MOT'
  832. )
  833. {$endif m68k}
  834. );
  835. {****************************************************************************
  836. Helpers
  837. ****************************************************************************}
  838. function upper(const s : string) : string;
  839. var
  840. i : longint;
  841. begin
  842. for i:=1 to length(s) do
  843. if s[i] in ['a'..'z'] then
  844. upper[i]:=char(byte(s[i])-32)
  845. else
  846. upper[i]:=s[i];
  847. upper[0]:=s[0];
  848. end;
  849. function set_target_os(t:tos):boolean;
  850. var
  851. i : longint;
  852. begin
  853. set_target_os:=false;
  854. { target 1 is none }
  855. for i:=2 to oscnt do
  856. if os_infos[i].id=t then
  857. begin
  858. target_os:=os_infos[i];
  859. set_target_os:=true;
  860. exit;
  861. end;
  862. end;
  863. function set_target_asm(t:tasm):boolean;
  864. var
  865. i : longint;
  866. begin
  867. set_target_asm:=false;
  868. for i:=1 to asmcnt do
  869. if as_infos[i].id=t then
  870. begin
  871. target_asm:=as_infos[i];
  872. set_target_asm:=true;
  873. exit;
  874. end;
  875. end;
  876. function set_target_link(t:tlink):boolean;
  877. var
  878. i : longint;
  879. begin
  880. set_target_link:=false;
  881. for i:=1 to linkcnt do
  882. if link_infos[i].id=t then
  883. begin
  884. target_link:=link_infos[i];
  885. set_target_link:=true;
  886. exit;
  887. end;
  888. end;
  889. function set_target_ar(t:tar):boolean;
  890. var
  891. i : longint;
  892. begin
  893. set_target_ar:=false;
  894. for i:=1 to arcnt do
  895. if ar_infos[i].id=t then
  896. begin
  897. target_ar:=ar_infos[i];
  898. set_target_ar:=true;
  899. exit;
  900. end;
  901. end;
  902. function set_target_info(t:ttarget):boolean;
  903. var
  904. i : longint;
  905. begin
  906. set_target_info:=false;
  907. for i:=1 to targetcnt do
  908. if target_infos[i].target=t then
  909. begin
  910. target_info:=target_infos[i];
  911. set_target_os(target_info.os);
  912. set_target_asm(target_info.assem);
  913. set_target_link(target_info.link);
  914. set_target_ar(target_info.ar);
  915. target_cpu:=target_info.cpu;
  916. set_target_info:=true;
  917. exit;
  918. end;
  919. end;
  920. {****************************************************************************
  921. Load from string
  922. ****************************************************************************}
  923. function set_string_target(s : string) : boolean;
  924. var
  925. i : longint;
  926. begin
  927. set_string_target:=false;
  928. { this should be case insensitive !! PM }
  929. s:=upper(s);
  930. for i:=1 to targetcnt do
  931. if target_infos[i].short_name=s then
  932. begin
  933. target_info:=target_infos[i];
  934. set_target_os(target_info.os);
  935. set_target_asm(target_info.assem);
  936. set_target_link(target_info.link);
  937. set_target_ar(target_info.ar);
  938. target_cpu:=target_info.cpu;
  939. set_string_target:=true;
  940. exit;
  941. end;
  942. end;
  943. function set_string_asm(s : string) : boolean;
  944. var
  945. i : longint;
  946. begin
  947. set_string_asm:=false;
  948. { this should be case insensitive !! PM }
  949. s:=upper(s);
  950. for i:=1 to asmcnt do
  951. if as_infos[i].idtxt=s then
  952. begin
  953. target_asm:=as_infos[i];
  954. set_string_asm:=true;
  955. end;
  956. end;
  957. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  958. var
  959. i : longint;
  960. begin
  961. set_string_asmmode:=false;
  962. { this should be case insensitive !! PM }
  963. s:=upper(s);
  964. for i:=1 to asmmodecnt do
  965. if asmmodeinfos[i].idtxt=s then
  966. begin
  967. t:=asmmodeinfos[i].id;
  968. set_string_asmmode:=true;
  969. end;
  970. end;
  971. {****************************************************************************
  972. Initialization of default target
  973. ****************************************************************************}
  974. procedure default_os(t:ttarget);
  975. begin
  976. set_target_info(t);
  977. if source_os.name='' then
  978. source_os:=target_os;
  979. end;
  980. procedure set_source_os(t:tos);
  981. var
  982. i : longint;
  983. begin
  984. { can't use message() here (PFV) }
  985. if source_os.name<>'' then
  986. Writeln('Warning: Source OS Redefined!');
  987. for i:=1 to oscnt do
  988. if os_infos[i].id=t then
  989. begin
  990. source_os:=os_infos[i];
  991. exit;
  992. end;
  993. end;
  994. begin
  995. { first get source OS }
  996. source_os.name:='';
  997. { please note then we use cpu86 and cpu68 here on purpose !! }
  998. {$ifdef cpu86}
  999. {$ifdef GO32V1}
  1000. set_source_os(os_i386_GO32V1);
  1001. {$else}
  1002. {$ifdef GO32V2}
  1003. set_source_os(os_i386_GO32V2);
  1004. {$else}
  1005. {$ifdef OS2}
  1006. set_source_os(os_i386_OS2);
  1007. {$else}
  1008. {$ifdef LINUX}
  1009. set_source_os(os_i386_LINUX);
  1010. {$else}
  1011. {$ifdef WIN32}
  1012. set_source_os(os_i386_WIN32);
  1013. {$endif win32}
  1014. {$endif linux}
  1015. {$endif os2}
  1016. {$endif go32v2}
  1017. {$endif go32v1}
  1018. {$endif cpu86}
  1019. {$ifdef cpu68}
  1020. {$ifdef AMIGA}
  1021. set_source_os(os_m68k_Amiga);
  1022. {$else}
  1023. {$ifdef ATARI}
  1024. set_source_os(os_m68k_Atari);
  1025. {$else}
  1026. {$ifdef MACOS}
  1027. set_source_os(os_m68k_MAC);
  1028. {$else}
  1029. {$ifdef LINUX}
  1030. set_source_os(os_m68k_linux);
  1031. {$endif linux}
  1032. {$endif macos}
  1033. {$endif atari}
  1034. {$endif amiga}
  1035. {$endif cpu68}
  1036. { Now default target !! }
  1037. {$ifdef i386}
  1038. {$ifdef GO32V1}
  1039. default_os(target_i386_GO32V1);
  1040. {$else}
  1041. {$ifdef GO32V2}
  1042. default_os(target_i386_GO32V2);
  1043. {$else}
  1044. {$ifdef OS2}
  1045. default_os(target_i386_OS2);
  1046. {$else}
  1047. {$ifdef LINUX}
  1048. default_os(target_i386_LINUX);
  1049. {$else}
  1050. {$ifdef WIN32}
  1051. default_os(target_i386_WIN32);
  1052. {$else}
  1053. default_os(target_i386_GO32V2);
  1054. {$endif win32}
  1055. {$endif linux}
  1056. {$endif os2}
  1057. {$endif go32v2}
  1058. {$endif go32v1}
  1059. {$endif i386}
  1060. {$ifdef m68k}
  1061. {$ifdef AMIGA}
  1062. default_os(target_m68k_Amiga);
  1063. {$else}
  1064. {$ifdef ATARI}
  1065. default_os(target_m68k_Atari);
  1066. {$else}
  1067. {$ifdef MACOS}
  1068. default_os(target_m68k_Mac);
  1069. {$else}
  1070. {$ifdef LINUX}
  1071. default_os(target_m68k_linux);
  1072. {$else}
  1073. default_os(target_m68k_Amiga);
  1074. {$endif linux}
  1075. {$endif macos}
  1076. {$endif atari}
  1077. {$endif amiga}
  1078. {$endif m68k}
  1079. end.
  1080. {
  1081. $Log$
  1082. Revision 1.45 1998-10-15 16:20:41 peter
  1083. * removed uses verbose which is not possible! this unit may not use
  1084. any other unit !
  1085. Revision 1.44 1998/10/14 11:28:25 florian
  1086. * emitpushreferenceaddress gets now the asmlist as parameter
  1087. * m68k version compiles with -duseansistrings
  1088. Revision 1.43 1998/10/14 08:08:56 pierre
  1089. * following Peters remark, removed all ifdef in
  1090. the systems unit enums
  1091. * last bugs of cg68k removed for sysamiga
  1092. (sysamiga assembles with as68k !!)
  1093. Revision 1.42 1998/10/13 16:50:23 pierre
  1094. * undid some changes of Peter that made the compiler wrong
  1095. for m68k (I had to reinsert some ifdefs)
  1096. * removed several memory leaks under m68k
  1097. * removed the meory leaks for assembler readers
  1098. * cross compiling shoud work again better
  1099. ( crosscompiling sysamiga works
  1100. but as68k still complain about some code !)
  1101. Revision 1.41 1998/10/13 13:10:31 peter
  1102. * new style for m68k/i386 infos and enums
  1103. Revision 1.40 1998/10/13 09:13:09 pierre
  1104. * assembler type output command line was case sensitive
  1105. Revision 1.39 1998/10/13 08:19:42 pierre
  1106. + source_os is now set correctly for cross-processor compilers
  1107. (tos contains all target_infos and
  1108. we use CPU86 and CPU68 conditionnals to
  1109. get the source operating system
  1110. this only works if you do not undefine
  1111. the source target !!)
  1112. * several cg68k memory leaks fixed
  1113. + started to change the code so that it should be possible to have
  1114. a complete compiler (both for m68k and i386 !!)
  1115. Revision 1.38 1998/10/07 04:26:58 carl
  1116. * bugfixes
  1117. + added mpw support
  1118. Revision 1.37 1998/10/06 20:40:58 peter
  1119. * remove -D from assemblers
  1120. Revision 1.36 1998/09/16 16:41:50 peter
  1121. * merged fixes
  1122. Revision 1.33.2.3 1998/09/16 16:13:13 peter
  1123. * win32 .o -> .ow and .a -> .aw
  1124. Revision 1.35 1998/09/11 17:35:33 peter
  1125. * fixed tabs
  1126. Revision 1.34 1998/09/11 12:27:55 pierre
  1127. * restored m68k part
  1128. Revision 1.33.2.2 1998/09/11 17:29:20 peter
  1129. * fixed tabs
  1130. Revision 1.33.2.1 1998/09/11 12:06:00 pierre
  1131. * m68k part restored
  1132. Revision 1.33 1998/09/10 15:25:39 daniel
  1133. + Added maxheapsize.
  1134. * Corrected semi-bug in calling the assembler and the linker
  1135. Revision 1.31 1998/09/01 09:07:13 peter
  1136. * m68k fixes, splitted cg68k like cgi386
  1137. Revision 1.30 1998/08/31 12:26:34 peter
  1138. * m68k and palmos updates from surebugfixes
  1139. Revision 1.29 1998/08/26 10:09:21 peter
  1140. * more lowercase extensions
  1141. Revision 1.28 1998/08/25 12:42:47 pierre
  1142. * CDECL changed to CVAR for variables
  1143. specifications are read in structures also
  1144. + started adding GPC compatibility mode ( option -Sp)
  1145. * names changed to lowercase
  1146. Revision 1.27 1998/08/21 15:16:57 peter
  1147. * win32 compiles a bit better, no growheap crash
  1148. Revision 1.26 1998/08/19 16:07:55 jonas
  1149. * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
  1150. Revision 1.25 1998/08/18 09:24:45 pierre
  1151. * small warning position bug fixed
  1152. * support_mmx switches splitting was missing
  1153. * rhide error and warning output corrected
  1154. Revision 1.24 1998/08/17 09:17:54 peter
  1155. * static/shared linking updates
  1156. Revision 1.23 1998/06/25 08:48:20 florian
  1157. * first version of rtti support
  1158. Revision 1.22 1998/06/17 14:10:21 peter
  1159. * small os2 fixes
  1160. * fixed interdependent units with newppu (remake3 under linux works now)
  1161. Revision 1.20 1998/06/15 15:38:14 pierre
  1162. * small bug in systems.pas corrected
  1163. + operators in different units better hanlded
  1164. Revision 1.19 1998/06/15 13:34:24 daniel
  1165. * Fixed spelling mistakes in comments.
  1166. * Fixed some OS/2 parameters.
  1167. Revision 1.18 1998/06/08 22:59:54 peter
  1168. * smartlinking works for win32
  1169. * some defines to exclude some compiler parts
  1170. Revision 1.17 1998/06/04 23:52:04 peter
  1171. * m68k compiles
  1172. + .def file creation moved to gendef.pas so it could also be used
  1173. for win32
  1174. Revision 1.16 1998/06/01 16:50:22 peter
  1175. + boolean -> ord conversion
  1176. * fixed ord -> boolean conversion
  1177. Revision 1.15 1998/05/30 14:31:11 peter
  1178. + $ASMMODE
  1179. Revision 1.14 1998/05/29 13:24:45 peter
  1180. + asw assembler
  1181. Revision 1.13 1998/05/27 00:20:33 peter
  1182. * some scanner optimizes
  1183. * automaticly aout2exe for go32v1
  1184. * fixed dynamiclinker option which was added at the wrong place
  1185. Revision 1.12 1998/05/23 01:21:32 peter
  1186. + aktasmmode, aktoptprocessor, aktoutputformat
  1187. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1188. + $LIBNAME to set the library name where the unit will be put in
  1189. * splitted cgi386 a bit (codeseg to large for bp7)
  1190. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1191. Revision 1.11 1998/05/22 12:32:49 peter
  1192. * fixed -L on the commandline, Dos commandline is only 128 bytes
  1193. Revision 1.10 1998/05/11 13:07:58 peter
  1194. + $ifdef NEWPPU for the new ppuformat
  1195. + $define GDB not longer required
  1196. * removed all warnings and stripped some log comments
  1197. * no findfirst/findnext anymore to remove smartlink *.o files
  1198. Revision 1.9 1998/05/06 08:38:49 pierre
  1199. * better position info with UseTokenInfo
  1200. UseTokenInfo greatly simplified
  1201. + added check for changed tree after first time firstpass
  1202. (if we could remove all the cases were it happen
  1203. we could skip all firstpass if firstpasscount > 1)
  1204. Only with ExtDebug
  1205. Revision 1.8 1998/05/04 20:19:54 peter
  1206. * small fix for go32v2
  1207. Revision 1.7 1998/05/04 17:54:29 peter
  1208. + smartlinking works (only case jumptable left todo)
  1209. * redesign of systems.pas to support assemblers and linkers
  1210. + Unitname is now also in the PPU-file, increased version to 14
  1211. Revision 1.6 1998/05/01 07:43:57 florian
  1212. + basics for rtti implemented
  1213. + switch $m (generate rtti for published sections)
  1214. Revision 1.5 1998/04/29 10:34:06 pierre
  1215. + added some code for ansistring (not complete nor working yet)
  1216. * corrected operator overloading
  1217. * corrected nasm output
  1218. + started inline procedures
  1219. + added starstarn : use ** for exponentiation (^ gave problems)
  1220. + started UseTokenInfo cond to get accurate positions
  1221. Revision 1.4 1998/04/27 15:45:20 peter
  1222. + -Xl for smartlink
  1223. + target_info.arext = .a
  1224. Revision 1.3 1998/04/16 10:50:45 daniel
  1225. * Fixed some things that were broken for OS/2.
  1226. }