systems.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  1. {
  2. $Id$
  3. Copyright (C) 1995,97 by Florian Klaempfl
  4. This unit contains informations about the target systems supported
  5. (these are not processor specific)
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 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,en_big_endian);
  23. ttargetcpu = (i386,m68k,alpha);
  24. tprocessors = (
  25. {$ifdef i386}
  26. int386,int486,pentium,pentiumpro,cx6x86,pentium2,amdk6
  27. {$endif}
  28. {$ifdef m68k}
  29. MC68000,MC68020
  30. {$endif}
  31. );
  32. tasmmode = (
  33. {$ifdef i386}
  34. I386_ATT,I386_INTEL,I386_DIRECT
  35. {$endif}
  36. {$ifdef m68k}
  37. M68K_MOT
  38. {$endif}
  39. );
  40. ttarget = (
  41. {$ifdef i386}
  42. target_GO32V1,target_GO32V2,target_LINUX,target_OS2,target_WIN32
  43. {$endif i386}
  44. {$ifdef m68k}
  45. target_Amiga,target_Atari,target_Mac68k,target_Linux
  46. {$endif}
  47. );
  48. tasm = (
  49. {$ifdef i386}
  50. as_o,as_o_aout,as_asw,as_nasmcoff, as_nasmelf, as_nasmobj,
  51. as_tasm, as_masm
  52. {$endif}
  53. {$ifdef m68k}
  54. as_o,as_gas,as_mit,as_mot
  55. {$endif}
  56. );
  57. tlink = (
  58. {$ifdef i386}
  59. link_ld,link_ldgo32v1, link_ldgo32v2, link_ldw, link_ldos2
  60. {$endif i386}
  61. {$ifdef m68k}
  62. link_ld
  63. {$endif}
  64. );
  65. tar = (
  66. {$ifdef i386}
  67. ar_ar,ar_arw
  68. {$endif}
  69. {$ifdef m68k}
  70. ar_ar
  71. {$endif}
  72. );
  73. tos = (
  74. {$ifdef i386}
  75. os_GO32V1, os_GO32V2, os_Linux, os_OS2, os_WIN32
  76. {$endif i386}
  77. {$ifdef m68k}
  78. os_Amiga, os_Atari, os_Mac68k, os_Linux
  79. {$endif}
  80. );
  81. tosinfo = record
  82. name : string[30];
  83. sharedlibext,
  84. staticlibext,
  85. sourceext,
  86. pasext,
  87. exeext,
  88. scriptext : string[4];
  89. Cprefix : string[2];
  90. newline : string[2];
  91. endian : tendian;
  92. use_function_relative_addresses : boolean;
  93. end;
  94. tasminfo = record
  95. id : tasm;
  96. idtxt : string[8];
  97. asmbin : string[8];
  98. asmcmd : string[50];
  99. externals : boolean;
  100. labelprefix : string[2];
  101. comment : string[2];
  102. end;
  103. tlinkinfo = record
  104. linkbin : string[8];
  105. linkcmd : string[50];
  106. bindbin : string[8];
  107. bindcmd : string[50];
  108. stripopt : string[2];
  109. libpathprefix : string[12];
  110. libpathsuffix : string[2];
  111. groupstart : string[8];
  112. groupend : string[2];
  113. inputstart : string[8];
  114. inputend : string[2];
  115. libprefix : string[2];
  116. end;
  117. tarinfo = record
  118. arbin : string[8];
  119. arcmd : string[50];
  120. end;
  121. ttargetinfo = record
  122. target : ttarget;
  123. short_name : string[8];
  124. unit_env : string[12];
  125. system_unit : string[8];
  126. smartext,
  127. unitext,
  128. unitlibext,
  129. asmext,
  130. objext,
  131. exeext : string[4];
  132. os : tos;
  133. link : tlink;
  134. assem : tasm;
  135. ar : tar;
  136. end;
  137. tasmmodeinfo=record
  138. id : tasmmode;
  139. idtxt : string[8];
  140. end;
  141. const
  142. {$ifdef i386}
  143. target_cpu = i386;
  144. {$endif i386}
  145. {$ifdef m68k}
  146. target_cpu = m68k;
  147. {$endif m68k}
  148. var
  149. target_info : ttargetinfo;
  150. target_os : tosinfo;
  151. target_asm : tasminfo;
  152. target_link : tlinkinfo;
  153. target_ar : tarinfo;
  154. source_os : tosinfo;
  155. function set_string_target(const s : string) : boolean;
  156. function set_string_asm(const s : string) : boolean;
  157. function set_string_asmmode(const s:string;var t:tasmmode):boolean;
  158. implementation
  159. const
  160. {****************************************************************************
  161. OS Info
  162. ****************************************************************************}
  163. os_infos : array[tos] of tosinfo = (
  164. {$ifdef i386}
  165. (
  166. name : 'GO32 V1 DOS extender';
  167. sharedlibext : '.DLL';
  168. staticlibext : '.A';
  169. sourceext : '.PP';
  170. pasext : '.PAS';
  171. exeext : ''; { No .exe, the linker only output a.out ! }
  172. scriptext : '.BAT';
  173. Cprefix : '_';
  174. newline : #13#10;
  175. endian : endian_little;
  176. use_function_relative_addresses : true
  177. ),
  178. (
  179. name : 'GO32 V2 DOS extender';
  180. sharedlibext : '.DLL';
  181. staticlibext : '.A';
  182. sourceext : '.PP';
  183. pasext : '.PAS';
  184. exeext : '.EXE';
  185. scriptext : '.BAT';
  186. Cprefix : '_';
  187. newline : #13#10;
  188. endian : endian_little;
  189. use_function_relative_addresses : true
  190. ),
  191. (
  192. name : 'Linux-i386';
  193. sharedlibext : '.so';
  194. staticlibext : '.a';
  195. sourceext : '.pp';
  196. pasext : '.pas';
  197. exeext : '';
  198. scriptext : '.sh';
  199. Cprefix : '';
  200. newline : #10;
  201. endian : endian_little;
  202. use_function_relative_addresses : true
  203. ),
  204. (
  205. name : 'OS/2 via EMX';
  206. sharedlibext : '.ao2';
  207. staticlibext : '.ao2';
  208. sourceext : '.pas';
  209. pasext : '.pp';
  210. exeext : '.exe';
  211. scriptext : '.cmd';
  212. Cprefix : '_';
  213. newline : #13#10;
  214. endian : endian_little;
  215. use_function_relative_addresses : false
  216. ),
  217. (
  218. name : 'Win32';
  219. sharedlibext : '.dll';
  220. staticlibext : '.a';
  221. sourceext : '.pp';
  222. pasext : '.pas';
  223. exeext : '.exe';
  224. scriptext : '.bat';
  225. Cprefix : '_';
  226. newline : #13#10;
  227. endian : endian_little;
  228. use_function_relative_addresses : true
  229. )
  230. {$endif i386}
  231. {$ifdef m68k}
  232. (
  233. name : 'Commodore Amiga';
  234. sharedlibext : '.library';
  235. staticlibext : '.a';
  236. sourceext : '.pp';
  237. pasext : '.pas';
  238. exeext : '';
  239. scriptext : '';
  240. Cprefix : '';
  241. newline : #10;
  242. endian : en_big_endian;
  243. use_function_relative_addresses : false
  244. ),
  245. (
  246. name : 'Atari ST/STE';
  247. sharedlibext : '.dll';
  248. staticlibext : '.a';
  249. sourceext : '.pp';
  250. pasext : '.pas';
  251. exeext : '.tpp';
  252. scriptext : '';
  253. Cprefix : '';
  254. newline : #10;
  255. endian : en_big_endian;
  256. use_function_relative_addresses : false
  257. ),
  258. (
  259. name : 'Macintosh m68k';
  260. sharedlibext : '.dll';
  261. staticlibext : '.a';
  262. sourceext : '.pp';
  263. pasext : '.pas';
  264. exeext : '.tpp';
  265. scriptext : '';
  266. Cprefix : '';
  267. newline : #13;
  268. endian : en_big_endian;
  269. use_function_relative_addresses : false
  270. ),
  271. (
  272. name : 'Linux-m68k';
  273. sharedlibext : '.so';
  274. staticlibext : '.a';
  275. sourceext : '.pp';
  276. pasext : '.pas';
  277. exeext : '';
  278. scriptext : '.sh';
  279. Cprefix : '';
  280. newline : #10;
  281. endian : en_big_endian;
  282. use_function_relative_addresses : true
  283. )
  284. {$endif m68k}
  285. );
  286. {****************************************************************************
  287. Assembler Info
  288. ****************************************************************************}
  289. as_infos : array[tasm] of tasminfo = (
  290. {$ifdef i386}
  291. (
  292. id : as_o;
  293. idtxt : 'O';
  294. asmbin : 'as';
  295. asmcmd : '-D -o $OBJ $ASM';
  296. externals : false;
  297. labelprefix : '.L';
  298. comment : '# '
  299. )
  300. ,(
  301. id : as_o_aout;
  302. idtxt : 'O_AOUT';
  303. asmbin : 'as';
  304. asmcmd : '-D -o $OBJ $ASM';
  305. externals : false;
  306. labelprefix : 'L';
  307. comment : '# '
  308. )
  309. ,(
  310. id : as_asw;
  311. idtxt : 'ASW';
  312. asmbin : 'asw';
  313. asmcmd : '-D -o $OBJ $ASM';
  314. externals : false;
  315. labelprefix : '.L';
  316. comment : '# '
  317. )
  318. ,(
  319. id : as_nasmcoff;
  320. idtxt : 'NASMCOFF';
  321. asmbin : 'nasm';
  322. asmcmd : '-f coff -o $OBJ $ASM';
  323. externals : true;
  324. labelprefix : 'L';
  325. comment : '; '
  326. )
  327. ,(
  328. id : as_nasmelf;
  329. idtxt : 'NASMELF';
  330. asmbin : 'nasm';
  331. asmcmd : '-f elf -o $OBJ $ASM';
  332. externals : true;
  333. labelprefix : 'L';
  334. comment : '; '
  335. )
  336. ,(
  337. id : as_nasmobj;
  338. idtxt : 'NASMOBJ';
  339. asmbin : 'nasm';
  340. asmcmd : '-f obj -o $OBJ $ASM';
  341. externals : true;
  342. labelprefix : 'L';
  343. comment : '; '
  344. )
  345. ,(
  346. id : as_tasm;
  347. idtxt : 'TASM';
  348. asmbin : 'tasm';
  349. asmcmd : '/m2 $ASM $OBJ';
  350. externals : true;
  351. labelprefix : '.L';
  352. comment : '; '
  353. )
  354. ,(
  355. id : as_tasm;
  356. idtxt : 'MASM';
  357. asmbin : 'masm';
  358. asmcmd : '$ASM $OBJ';
  359. externals : true;
  360. labelprefix : '.L';
  361. comment : '; '
  362. )
  363. {$endif i386}
  364. {$ifdef m68k}
  365. (
  366. id : as_o;
  367. idtxt : 'O';
  368. asmbin : 'as';
  369. asmcmd : '-D -o $OBJ $ASM';
  370. externals : false;
  371. labelprefix : '.L';
  372. comment : '# '
  373. )
  374. ,(
  375. id : as_gas;
  376. idtxt : 'GAS';
  377. asmbin : 'as68k'; { Gas for the Amiga}
  378. asmcmd : '-D --register-prefix-optional -o $OBJ $ASM';
  379. externals : false;
  380. labelprefix : '__L';
  381. comment : '| '
  382. )
  383. ,(
  384. id : as_mit;
  385. idtxt : 'MIT';
  386. asmbin : '';
  387. asmcmd : '-o $OBJ $ASM';
  388. externals : false;
  389. labelprefix : '__L';
  390. comment : '| '
  391. )
  392. ,(
  393. id : as_mot;
  394. idtxt : 'MOT';
  395. asmbin : '';
  396. asmcmd : '-o $OBJ $ASM';
  397. externals : false;
  398. labelprefix : '__L';
  399. comment : '| '
  400. )
  401. {$endif m68k}
  402. );
  403. {****************************************************************************
  404. Linker Info
  405. ****************************************************************************}
  406. link_infos : array[tlink] of tlinkinfo = (
  407. {$ifdef i386}
  408. (
  409. linkbin : 'ld';
  410. linkcmd : '$OPT -o $EXE $RES';
  411. bindbin : '';
  412. bindcmd : '';
  413. stripopt : '-s';
  414. libpathprefix : 'SEARCH_DIR(';
  415. libpathsuffix : ')';
  416. groupstart : 'GROUP(';
  417. groupend : ')';
  418. inputstart : 'INPUT(';
  419. inputend : ')';
  420. libprefix : '-l'
  421. )
  422. ,(
  423. linkbin : 'ld';
  424. linkcmd : '-oformat coff-go32 $OPT -o $EXE @$RES';
  425. bindbin : 'aout2exe';
  426. bindcmd : '$EXE';
  427. stripopt : '-s';
  428. libpathprefix : '-L';
  429. libpathsuffix : '';
  430. groupstart : '-(';
  431. groupend : '-)';
  432. inputstart : '';
  433. inputend : '';
  434. libprefix : '-l'
  435. )
  436. ,(
  437. linkbin : 'ld';
  438. linkcmd : '-oformat coff-go32-exe $OPT -o $EXE @$RES';
  439. bindbin : '';
  440. bindcmd : '';
  441. stripopt : '-s';
  442. libpathprefix : '-L';
  443. libpathsuffix : '';
  444. groupstart : '-(';
  445. groupend : '-)';
  446. inputstart : '';
  447. inputend : '';
  448. libprefix : '-l'
  449. )
  450. ,(
  451. linkbin : 'ldw';
  452. linkcmd : '$OPT -o $EXE $RES';
  453. bindbin : '';
  454. bindcmd : '';
  455. stripopt : '-s';
  456. libpathprefix : 'SEARCH_DIR(';
  457. libpathsuffix : ')';
  458. groupstart : 'GROUP(';
  459. groupend : ')';
  460. inputstart : 'INPUT(';
  461. inputend : ')';
  462. libprefix : '-l'
  463. )
  464. ,(
  465. linkbin : 'ld';
  466. linkcmd : '-o $EXE @$RES';
  467. bindbin : 'emxbind';
  468. bindcmd : '-o $EXE.exe $EXE -k$STACKKB -aim -s$HEAPKB';
  469. stripopt : '-s';
  470. libpathprefix : '';
  471. libpathsuffix : '';
  472. groupstart : '-(';
  473. groupend : '-)';
  474. inputstart : '';
  475. inputend : '';
  476. libprefix : ''
  477. )
  478. {$endif i386}
  479. {$ifdef m68k}
  480. (
  481. linkbin : 'ld';
  482. linkcmd : '$OPT -o $EXE $RES';
  483. bindbin : '';
  484. bindcmd : '';
  485. stripopt : '-s';
  486. libpathprefix : 'SEARCH_DIR(';
  487. libpathsuffix : ')';
  488. groupstart : 'GROUP(';
  489. groupend : ')';
  490. inputstart : 'INPUT(';
  491. inputend : ')';
  492. libprefix : '-l'
  493. )
  494. {$endif m68k}
  495. );
  496. {****************************************************************************
  497. Ar Info
  498. ****************************************************************************}
  499. ar_infos : array[tar] of tarinfo = (
  500. {$ifdef i386}
  501. (
  502. arbin : 'ar';
  503. arcmd : 'rs $LIB $FILES'
  504. ),
  505. (
  506. arbin : 'arw';
  507. arcmd : 'rs $LIB $FILES'
  508. )
  509. {$endif i386}
  510. {$ifdef m68k}
  511. (
  512. arbin : 'ar';
  513. arcmd : 'rs $LIB $FILES'
  514. )
  515. {$endif m68k}
  516. );
  517. {****************************************************************************
  518. Targets Info
  519. ****************************************************************************}
  520. target_infos : array[ttarget] of ttargetinfo = (
  521. {$ifdef i386}
  522. (
  523. target : target_GO32V1;
  524. short_name : 'GO32V1';
  525. unit_env : 'GO32V1UNITS';
  526. system_unit : 'SYSTEM';
  527. smartext : '.SL';
  528. unitext : '.PP1';
  529. unitlibext : '.PPL';
  530. asmext : '.S1';
  531. objext : '.O1';
  532. exeext : ''; { The linker produces a.out }
  533. os : os_GO32V1;
  534. link : link_ldgo32v1;
  535. assem : as_o;
  536. ar : ar_ar
  537. ),
  538. (
  539. target : target_GO32V2;
  540. short_name : 'GO32V2';
  541. unit_env : 'GO32V2UNITS';
  542. system_unit : 'SYSTEM';
  543. {$ifndef UseAnsiString}
  544. smartext : '.SL';
  545. unitext : '.PPU';
  546. unitlibext : '.PPL';
  547. asmext : '.S';
  548. objext : '.O';
  549. exeext : '.EXE';
  550. {$else UseAnsiString}
  551. smartext : '.SL';
  552. unitext : '.PAU';
  553. unitlibext : '.PPL';
  554. asmext : '.SA';
  555. objext : '.OA';
  556. exeext : '.EXE';
  557. {$endif UseAnsiString}
  558. os : os_GO32V2;
  559. link : link_ldgo32v2;
  560. assem : as_o;
  561. ar : ar_ar
  562. ),
  563. (
  564. target : target_LINUX;
  565. short_name : 'LINUX';
  566. unit_env : 'LINUXUNITS';
  567. system_unit : 'syslinux';
  568. smartext : '.sl';
  569. unitext : '.ppu';
  570. unitlibext : '.ppl';
  571. asmext : '.s';
  572. objext : '.o';
  573. exeext : '';
  574. os : os_Linux;
  575. link : link_ld;
  576. assem : as_o;
  577. ar : ar_ar
  578. ),
  579. (
  580. target : target_OS2;
  581. short_name : 'OS2';
  582. unit_env : 'OS2UNITS';
  583. system_unit : 'SYSOS2';
  584. smartext : '.sl';
  585. unitext : '.ppo';
  586. unitlibext : '.ppl';
  587. asmext : '.so2';
  588. objext : '.oo2';
  589. exeext : ''; { The linker produces a.out }
  590. os : os_OS2;
  591. link : link_ldos2;
  592. assem : as_o_aout;
  593. ar : ar_ar
  594. ),
  595. (
  596. target : target_WIN32;
  597. short_name : 'WIN32';
  598. unit_env : 'WIN32UNITS';
  599. system_unit : 'SYSWIN32';
  600. smartext : '.sl';
  601. unitext : '.ppw';
  602. unitlibext : '.ppl';
  603. asmext : '.s';
  604. objext : '.o';
  605. exeext : '.exe';
  606. os : os_Win32;
  607. link : link_ldw;
  608. assem : as_asw;
  609. ar : ar_arw
  610. )
  611. {$endif i386}
  612. {$ifdef m68k}
  613. (
  614. target : target_Amiga;
  615. short_name : 'AMIGA';
  616. unit_env : '';
  617. system_unit : 'sysamiga';
  618. smartext : '.sl';
  619. unitext : '.ppa';
  620. unitlibext : '.ppl';
  621. asmext : '.asm';
  622. objext : '.o';
  623. exeext : '';
  624. os : os_Amiga;
  625. link : link_ld;
  626. assem : as_o;
  627. ar : ar_ar
  628. ),
  629. (
  630. target : target_Atari;
  631. short_name : 'ATARI';
  632. unit_env : '';
  633. system_unit : 'SYSATARI';
  634. smartext : '.sl';
  635. unitext : '.ppt';
  636. unitlibext : '.ppl';
  637. asmext : '.s';
  638. objext : '.o';
  639. exeext : '';
  640. os : os_Atari;
  641. link : link_ld;
  642. assem : as_o;
  643. ar : ar_ar
  644. ),
  645. (
  646. target : target_Mac68k;
  647. short_name : 'MACOS';
  648. unit_env : '';
  649. system_unit : 'sysmac';
  650. smartext : '.sl';
  651. unitext : '.ppt';
  652. unitlibext : '.ppl';
  653. asmext : '.s';
  654. objext : '.o';
  655. exeext : '';
  656. os : os_Mac68k;
  657. link : link_ld;
  658. assem : as_o;
  659. ar : ar_ar
  660. ),
  661. (
  662. target : target_Linux;
  663. short_name : 'LINUX';
  664. unit_env : 'LINUXUNITS';
  665. system_unit : 'syslinux';
  666. smartext : '.sl';
  667. unitext : '.ppu';
  668. unitlibext : '.ppl';
  669. asmext : '.s';
  670. objext : '.o';
  671. exeext : '';
  672. os : os_Linux;
  673. link : link_ld;
  674. assem : as_o;
  675. ar : ar_ar
  676. )
  677. {$endif m68k}
  678. );
  679. {****************************************************************************
  680. AsmModeInfo
  681. ****************************************************************************}
  682. asmmodeinfos : array[tasmmode] of tasmmodeinfo = (
  683. {$ifdef i386}
  684. (
  685. id : I386_DIRECT;
  686. idtxt : 'DIRECT'
  687. ),
  688. (
  689. id : I386_INTEL;
  690. idtxt : 'INTEL'
  691. ),
  692. (
  693. id : I386_ATT;
  694. idtxt : 'ATT'
  695. )
  696. {$endif i386}
  697. {$ifdef m68k}
  698. (
  699. id : M68K_MOT;
  700. idtxt : 'MOT'
  701. )
  702. {$endif m68k}
  703. );
  704. {****************************************************************************
  705. Helpers
  706. ****************************************************************************}
  707. procedure set_target(t : ttarget);
  708. begin
  709. target_info:=target_infos[t];
  710. target_os:=os_infos[target_info.os];
  711. target_asm:=as_infos[target_info.assem];
  712. target_link:=link_infos[target_info.link];
  713. target_ar:=ar_infos[target_info.ar];
  714. end;
  715. {****************************************************************************
  716. Load from string
  717. ****************************************************************************}
  718. function set_string_target(const s : string) : boolean;
  719. var
  720. i : longint;
  721. begin
  722. set_string_target:=false;
  723. for i:=0 to (sizeof(target_infos) div sizeof(ttargetinfo))-1 do
  724. if target_infos[ttarget(i)].short_name=s then
  725. begin
  726. set_target(ttarget(i));
  727. set_string_target:=true;
  728. end;
  729. end;
  730. function set_string_asm(const s : string) : boolean;
  731. var
  732. i : longint;
  733. begin
  734. set_string_asm:=false;
  735. for i:=0 to (sizeof(as_infos) div sizeof(tasminfo))-1 do
  736. if as_infos[tasm(i)].idtxt=s then
  737. begin
  738. target_asm:=as_infos[tasm(i)];
  739. set_string_asm:=true;
  740. end;
  741. end;
  742. function set_string_asmmode(const s:string;var t:tasmmode):boolean;
  743. var
  744. i : longint;
  745. begin
  746. set_string_asmmode:=false;
  747. for i:=0 to (sizeof(asmmodeinfos) div sizeof(tasmmodeinfo))-1 do
  748. if asmmodeinfos[tasmmode(i)].idtxt=s then
  749. begin
  750. t:=asmmodeinfos[tasmmode(i)].id;
  751. set_string_asmmode:=true;
  752. end;
  753. end;
  754. {****************************************************************************
  755. Initialization of default target
  756. ****************************************************************************}
  757. procedure default_os(t:ttarget);
  758. begin
  759. set_target(t);
  760. source_os:=os_infos[target_info.os];
  761. end;
  762. begin
  763. {$ifdef i386}
  764. {$ifdef GO32V1}
  765. default_os(target_GO32V1);
  766. {$else}
  767. {$ifdef GO32V2}
  768. default_os(target_GO32V2);
  769. {$else}
  770. {$ifdef OS2}
  771. default_os(target_OS2);
  772. {$else}
  773. {$ifdef LINUX}
  774. default_os(target_LINUX);
  775. {$else}
  776. {$ifdef WIN32}
  777. default_os(target_WIN32);
  778. {$else}
  779. default_os(target_GO32V2);
  780. {$endif win32}
  781. {$endif linux}
  782. {$endif os2}
  783. {$endif go32v2}
  784. {$endif go32v1}
  785. {$endif i386}
  786. {$ifdef m68k}
  787. {$ifdef AMIGA}
  788. default_os(target_Amiga);
  789. {$else}
  790. {$ifdef ATARI}
  791. default_os(target_Atari);
  792. {$else}
  793. {$ifdef MACOS}
  794. default_os(target_MAC68k);
  795. {$else}
  796. default_os(target_Amiga);
  797. {$endif macos}
  798. {$endif atari}
  799. {$endif amiga}
  800. {$endif m68k}
  801. end.
  802. {
  803. $Log$
  804. Revision 1.21 1998-06-16 08:56:36 peter
  805. + targetcpu
  806. * cleaner pmodules for newppu
  807. Revision 1.20 1998/06/15 15:38:14 pierre
  808. * small bug in systems.pas corrected
  809. + operators in different units better hanlded
  810. Revision 1.19 1998/06/15 13:34:24 daniel
  811. * Fixed spelling mistakes in comments.
  812. * Fixed some OS/2 parameters.
  813. Revision 1.18 1998/06/08 22:59:54 peter
  814. * smartlinking works for win32
  815. * some defines to exclude some compiler parts
  816. Revision 1.17 1998/06/04 23:52:04 peter
  817. * m68k compiles
  818. + .def file creation moved to gendef.pas so it could also be used
  819. for win32
  820. Revision 1.16 1998/06/01 16:50:22 peter
  821. + boolean -> ord conversion
  822. * fixed ord -> boolean conversion
  823. Revision 1.15 1998/05/30 14:31:11 peter
  824. + $ASMMODE
  825. Revision 1.14 1998/05/29 13:24:45 peter
  826. + asw assembler
  827. Revision 1.13 1998/05/27 00:20:33 peter
  828. * some scanner optimizes
  829. * automaticly aout2exe for go32v1
  830. * fixed dynamiclinker option which was added at the wrong place
  831. Revision 1.12 1998/05/23 01:21:32 peter
  832. + aktasmmode, aktoptprocessor, aktoutputformat
  833. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  834. + $LIBNAME to set the library name where the unit will be put in
  835. * splitted cgi386 a bit (codeseg to large for bp7)
  836. * nasm, tasm works again. nasm moved to ag386nsm.pas
  837. Revision 1.11 1998/05/22 12:32:49 peter
  838. * fixed -L on the commandline, Dos commandline is only 128 bytes
  839. Revision 1.10 1998/05/11 13:07:58 peter
  840. + $ifdef NEWPPU for the new ppuformat
  841. + $define GDB not longer required
  842. * removed all warnings and stripped some log comments
  843. * no findfirst/findnext anymore to remove smartlink *.o files
  844. Revision 1.9 1998/05/06 08:38:49 pierre
  845. * better position info with UseTokenInfo
  846. UseTokenInfo greatly simplified
  847. + added check for changed tree after first time firstpass
  848. (if we could remove all the cases were it happen
  849. we could skip all firstpass if firstpasscount > 1)
  850. Only with ExtDebug
  851. Revision 1.8 1998/05/04 20:19:54 peter
  852. * small fix for go32v2
  853. Revision 1.7 1998/05/04 17:54:29 peter
  854. + smartlinking works (only case jumptable left todo)
  855. * redesign of systems.pas to support assemblers and linkers
  856. + Unitname is now also in the PPU-file, increased version to 14
  857. Revision 1.6 1998/05/01 07:43:57 florian
  858. + basics for rtti implemented
  859. + switch $m (generate rtti for published sections)
  860. Revision 1.5 1998/04/29 10:34:06 pierre
  861. + added some code for ansistring (not complete nor working yet)
  862. * corrected operator overloading
  863. * corrected nasm output
  864. + started inline procedures
  865. + added starstarn : use ** for exponentiation (^ gave problems)
  866. + started UseTokenInfo cond to get accurate positions
  867. Revision 1.4 1998/04/27 15:45:20 peter
  868. + -Xl for smartlink
  869. + target_info.arext = .a
  870. Revision 1.3 1998/04/16 10:50:45 daniel
  871. * Fixed some things that were broken for OS/2.
  872. }