systems.pas 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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. { target operanting system }
  23. ttarget = (target_GO32V1,target_OS2,target_LINUX,
  24. target_WIN32,target_GO32V2,
  25. target_Amiga,target_Atari,target_Mac68k);
  26. tendian = (endian_little,en_big_endian);
  27. ttargetinfo = record
  28. target : ttarget;
  29. target_name : string[30];
  30. short_name : string[8];
  31. unit_env : string[20];
  32. system_unit : string[8];
  33. exeext,
  34. objext,
  35. dllext,
  36. arext,
  37. unitext,
  38. libext,
  39. asmext,
  40. sourceext,
  41. pasext : string[4];
  42. newline : string[3];
  43. labelprefix : string[2];
  44. Cprefix : string[2];
  45. use_function_relative_addresses : boolean;
  46. endian : tendian;
  47. end;
  48. tsourceinfo = record
  49. source:ttarget;
  50. source_name:string[30];
  51. exeext,
  52. scriptext : string[4];
  53. endian : tendian;
  54. end;
  55. var
  56. source_info : tsourceinfo;
  57. target_info : ttargetinfo;
  58. function set_string_target(const s : string) : boolean;
  59. implementation
  60. const
  61. target_infos : array[ttarget] of ttargetinfo = (
  62. (
  63. target : target_GO32V1;
  64. target_name : 'GO32 V1 DOS extender';
  65. short_name : 'GO32V1';
  66. unit_env : 'GO32V1UNITS';
  67. system_unit : 'SYSTEM';
  68. exeext : '';
  69. objext : '.O1';
  70. dllext : '.DLL';
  71. arext : '.A';
  72. unitext : '.PP1';
  73. libext : '.PPL';
  74. asmext : '.S1';
  75. sourceext : '.PP';
  76. pasext : '.PAS';
  77. newline : #13#10;
  78. labelprefix : '.L';
  79. Cprefix : '_';
  80. use_function_relative_addresses : true;
  81. endian : endian_little
  82. ),
  83. (
  84. target : target_OS2;
  85. target_name : 'OS/2 (32 bit)';
  86. short_name : 'OS2';
  87. unit_env : 'OS2UNITS';
  88. system_unit : 'SYSOS2';
  89. exeext : '';
  90. objext : '.oo2';
  91. dllext : '.ao2';
  92. arext : '.a';
  93. unitext : '.ppo';
  94. libext : '.ppl';
  95. asmext : '.so2';
  96. sourceext : '.pas';
  97. pasext : '.pp';
  98. newline : #13#10;
  99. labelprefix : 'L';
  100. Cprefix : '_';
  101. use_function_relative_addresses : false;
  102. endian : endian_little
  103. ),
  104. (
  105. target : target_LINUX;
  106. target_name : 'Linux';
  107. short_name : 'LINUX';
  108. unit_env : 'LINUXUNITS';
  109. system_unit : 'syslinux';
  110. exeext : '';
  111. objext : '.o';
  112. dllext : '.so';
  113. arext : '.a';
  114. unitext : '.ppu';
  115. libext : '.ppl';
  116. asmext : '.s';
  117. sourceext : '.pp';
  118. pasext : '.pas';
  119. newline : #10;
  120. labelprefix : '.L';
  121. Cprefix : '';
  122. use_function_relative_addresses : true;
  123. endian : endian_little
  124. ),
  125. (
  126. target : target_WIN32;
  127. target_name : 'Win32';
  128. short_name : 'WIN32';
  129. unit_env : 'WIN32UNITS';
  130. system_unit : 'SYSWIN32';
  131. exeext : '.exe';
  132. objext : '.o';
  133. dllext : '.dll';
  134. arext : '.a';
  135. unitext : '.ppw';
  136. libext : '.ppl';
  137. asmext : '.s';
  138. sourceext : '.pp';
  139. pasext : '.pas';
  140. newline : #13#10;
  141. labelprefix : '.L';
  142. Cprefix : '_'; {???}
  143. use_function_relative_addresses : true; {????}
  144. endian : endian_little
  145. ),
  146. (
  147. target : target_GO32V2;
  148. target_name : 'GO32 V2.0 DOS extender';
  149. short_name : 'GO32V2';
  150. unit_env : 'GO32V2UNITS';
  151. system_unit : 'SYSTEM';
  152. exeext : '.EXE';
  153. {$ifndef UseAnsiString}
  154. objext : '.O';
  155. dllext : '.DLL';
  156. arext : '.A';
  157. unitext : '.PPU';
  158. libext : '.PPL';
  159. asmext : '.S';
  160. {$else UseAnsiString}
  161. { just for tests }
  162. objext : '.OA';
  163. dllext : '.DLL';
  164. unitext : '.PAU';
  165. libext : '.PPL';
  166. asmext : '.SA';
  167. {$endif UseAnsiString}
  168. sourceext : '.PP';
  169. pasext : '.PAS';
  170. newline : #13#10;
  171. labelprefix : '.L';
  172. Cprefix : '_';
  173. use_function_relative_addresses : true;
  174. endian : endian_little
  175. ),
  176. (
  177. target : target_Amiga;
  178. target_name : 'Commodore Amiga';
  179. short_name : 'AMIGA';
  180. unit_env : '';
  181. system_unit : 'sysamiga'; { case sensitive }
  182. exeext : '';
  183. objext : '.o';
  184. dllext : '.library';
  185. arext : '.a';
  186. unitext : '.ppa';
  187. libext : '.ppl';
  188. asmext : '.asm';
  189. sourceext : '.pp';
  190. pasext : '.pas';
  191. newline : #10; { ??? }
  192. labelprefix : '.L';
  193. Cprefix : '';
  194. use_function_relative_addresses : true;
  195. endian : endian_little
  196. ),
  197. (
  198. target : target_Atari;
  199. target_name : 'Atari ST/STE';
  200. short_name : 'ATARI';
  201. unit_env : '';
  202. system_unit : 'SYSATARI';
  203. exeext : '.ttp';
  204. objext : '.o';
  205. dllext : '.dll';
  206. arext : '.a';
  207. unitext : '.PPT';
  208. libext : '.PPL';
  209. asmext : '.s';
  210. sourceext : '.pp';
  211. pasext : '.pas';
  212. newline : #13#10;
  213. labelprefix : '.L';
  214. Cprefix : '';
  215. use_function_relative_addresses : true;
  216. endian : endian_little
  217. ),
  218. (
  219. target : target_Mac68k;
  220. target_name : 'Macintosh m68k';
  221. short_name : 'MAC OS';
  222. unit_env : '';
  223. system_unit : 'sysmac'; { case sensitive }
  224. exeext : '';
  225. objext : '.o';
  226. dllext : '.dll';
  227. arext : '.a';
  228. unitext : '.ppm';
  229. libext : '.ppl';
  230. asmext : '.asm';
  231. sourceext : '.pp';
  232. pasext : '.pas';
  233. newline : #13; { ??? }
  234. labelprefix : '__L';{ only ascii A..Z,a..z or _ allowed as first }
  235. Cprefix : '';
  236. use_function_relative_addresses : true;
  237. endian : endian_little
  238. )
  239. );
  240. source_infos : array[ttarget] of tsourceinfo = (
  241. (
  242. source : target_GO32V1;
  243. source_name : 'GO32 V1 DOS extender';
  244. exeext : '.EXE';
  245. scriptext : '.BAT';
  246. endian : endian_little
  247. ),
  248. (
  249. source : target_OS2;
  250. source_name : 'OS/2 (32 bit)';
  251. exeext : '.EXE';
  252. scriptext : '.CMD';
  253. endian : endian_little
  254. ),
  255. (
  256. source : target_LINUX;
  257. source_name : 'Linux';
  258. exeext : '';
  259. scriptext : '.sh';
  260. endian : endian_little
  261. ),
  262. (
  263. source : target_WIN32;
  264. source_name : 'Win32';
  265. exeext : '.EXE';
  266. scriptext : '.BAT';
  267. endian : endian_little
  268. ),
  269. (
  270. source : target_GO32V2;
  271. source_name : 'GO32 V2.0 DOS extender';
  272. exeext : '.EXE';
  273. scriptext : '.BAT';
  274. endian : endian_little
  275. ),
  276. (
  277. source : target_Amiga;
  278. source_name : 'Commodore Amiga';
  279. exeext : '';
  280. scriptext : '';
  281. endian : en_big_endian
  282. ),
  283. (
  284. source : target_Atari;
  285. source_name : 'Atari ST/STE';
  286. exeext : '.ttp';
  287. scriptext : '';
  288. endian : en_big_endian
  289. ),
  290. (
  291. source : target_Mac68k;
  292. source_name : 'Macintosh m68k';
  293. exeext : '';
  294. scriptext : '';
  295. endian : en_big_endian
  296. )
  297. );
  298. procedure set_target(t : ttarget);
  299. begin
  300. target_info:=target_infos[t];
  301. end;
  302. function set_string_target(const s : string) : boolean;
  303. var
  304. t : ttarget;
  305. begin
  306. set_string_target:=false;
  307. for t:=target_GO32V1 to target_mac68k do
  308. if target_infos[t].short_name=s then
  309. begin
  310. set_string_target:=true;
  311. set_target(t);
  312. end;
  313. end;
  314. procedure default_os(t:ttarget);
  315. begin
  316. set_target(t);
  317. source_info:=source_infos[t];
  318. end;
  319. begin
  320. {$ifdef tp}
  321. default_os(target_GO32V2);
  322. {$else}
  323. {$ifdef DOS}
  324. default_os(target_GO32V1);
  325. {$endif}
  326. {$ifdef GO32V1}
  327. default_os(target_GO32V1);
  328. {$endif}
  329. {$ifdef GO32V2}
  330. default_os(target_GO32V2);
  331. {$endif}
  332. {$ifdef OS2}
  333. default_os(target_OS2);
  334. {$endif}
  335. {$ifdef LINUX}
  336. default_os(target_LINUX);
  337. {$endif}
  338. {$ifdef WIN32}
  339. default_os(target_WIN32);
  340. {$endif}
  341. {$ifdef AMIGA}
  342. default_os(target_AMIGA);
  343. {$endif}
  344. {$ifdef ATARI}
  345. default_os(target_ATARI);
  346. {$endif}
  347. {$ifdef MACOS}
  348. default_os(target_MAC68k);
  349. {$endif}
  350. {$endif}
  351. end.
  352. {
  353. $Log$
  354. Revision 1.5 1998-04-29 10:34:06 pierre
  355. + added some code for ansistring (not complete nor working yet)
  356. * corrected operator overloading
  357. * corrected nasm output
  358. + started inline procedures
  359. + added starstarn : use ** for exponentiation (^ gave problems)
  360. + started UseTokenInfo cond to get accurate positions
  361. Revision 1.4 1998/04/27 15:45:20 peter
  362. + -Xl for smartlink
  363. + target_info.arext = .a
  364. Revision 1.3 1998/04/16 10:50:45 daniel
  365. * Fixed some things that were broken for OS/2.
  366. Revision 1.2 1998/03/30 15:53:01 florian
  367. * last changes before release:
  368. - gdb fixed
  369. - ratti386 warning removed (about unset function result)
  370. Revision 1.1.1.1 1998/03/25 11:18:15 root
  371. * Restored version
  372. Revision 1.33 1998/03/10 23:48:37 florian
  373. * a couple of bug fixes to get the compiler with -OGaxz compiler, sadly
  374. enough, it doesn't run
  375. Revision 1.32 1998/03/10 16:27:46 pierre
  376. * better line info in stabs debug
  377. * symtabletype and lexlevel separated into two fields of tsymtable
  378. + ifdef MAKELIB for direct library output, not complete
  379. + ifdef CHAINPROCSYMS for overloaded seach across units, not fully
  380. working
  381. + ifdef TESTFUNCRET for setting func result in underfunction, not
  382. working
  383. Revision 1.31 1998/03/10 01:17:29 peter
  384. * all files have the same header
  385. * messages are fully implemented, EXTDEBUG uses Comment()
  386. + AG... files for the Assembler generation
  387. Revision 1.30 1998/03/05 22:43:53 florian
  388. * some win32 support stuff added
  389. Revision 1.29 1998/03/02 22:04:36 carl
  390. + Added mac line break
  391. Revision 1.28 1998/03/02 13:38:51 peter
  392. + importlib object
  393. * doesn't crash on a systemunit anymore
  394. * updated makefile and depend
  395. Revision 1.25 1998/02/28 00:20:34 florian
  396. * more changes to get import libs for Win32 working
  397. Revision 1.24 1998/02/27 22:28:01 florian
  398. + win_targ unit
  399. + support of sections
  400. + new asmlists: sections, exports and resource
  401. Revision 1.23 1998/02/27 21:24:20 florian
  402. * dll support changed (dll name can be also a string contants)
  403. Revision 1.22 1998/02/23 02:55:08 carl
  404. + added correct extension to AMIGA libext
  405. Revision 1.21 1998/02/22 23:03:39 peter
  406. * renamed msource->mainsource and name->unitname
  407. * optimized filename handling, filename is not seperate anymore with
  408. path+name+ext, this saves stackspace and a lot of fsplit()'s
  409. * recompiling of some units in libraries fixed
  410. * shared libraries are working again
  411. + $LINKLIB <lib> to support automatic linking to libraries
  412. + libraries are saved/read from the ppufile, also allows more libraries
  413. per ppufile
  414. Revision 1.20 1998/02/18 14:14:44 michael
  415. * removed entries for dos_targ and lin_targ
  416. Revision 1.19 1998/02/17 21:21:05 peter
  417. + Script unit
  418. + __EXIT is called again to exit a program
  419. - target_info.link/assembler calls
  420. * linking works again for dos
  421. * optimized a few filehandling functions
  422. * fixed stabs generation for procedures
  423. Revision 1.18 1998/02/14 01:45:35 peter
  424. * more fixes
  425. - pmode target is removed
  426. - search_as_ld is removed, this is done in the link.pas/assemble.pas
  427. + findexe() to search for an executable (linker,assembler,binder)
  428. Revision 1.17 1998/02/13 22:26:45 peter
  429. * fixed a few SigSegv's
  430. * INIT$$ was not written for linux!
  431. * assembling and linking works again for linux and dos
  432. + assembler object, only attasmi3 supported yet
  433. * restore pp.pas with AddPath etc.
  434. Revision 1.16 1998/02/13 10:35:50 daniel
  435. * Made Motorola version compilable.
  436. * Fixed optimizer
  437. Revision 1.15 1998/02/12 17:19:32 florian
  438. * fixed to get remake3 work, but needs additional fixes (output, I don't like
  439. also that aktswitches isn't a pointer)
  440. Revision 1.14 1998/02/12 11:50:50 daniel
  441. Yes! Finally! After three retries, my patch!
  442. Changes:
  443. Complete rewrite of psub.pas.
  444. Added support for DLL's.
  445. Compiler requires less memory.
  446. Platform units for each platform.
  447. Revision 1.11 1998/01/26 16:42:01 daniel
  448. * Reversed source_ext and pas_ext for OS/2 target. The .pas extension is
  449. recognized by the Workplace Shell of OS/2, the .pp is not.
  450. Revision 1.10 1998/01/26 13:35:33 florian
  451. * adapted to work with TP
  452. Revision 1.9 1998/01/25 18:45:50 peter
  453. + Search for as and ld at startup
  454. + source_info works the same as target_info
  455. + externlink allows only external linking
  456. Revision 1.8 1998/01/22 08:57:55 peter
  457. + added target_info.pasext and target_info.libext
  458. Revision 1.7 1998/01/09 19:44:09 carl
  459. * labels for mac68k target now use the MPW correct syntax
  460. Revision 1.6 1997/12/12 13:28:42 florian
  461. + version 0.99.0
  462. * all WASM options changed into MASM
  463. + -O2 for Pentium II optimizations
  464. Revision 1.5 1997/12/09 14:12:21 carl
  465. + added planned m68k systems, and fixed some problems in amiga info.
  466. Revision 1.4 1997/12/08 11:53:49 pierre
  467. reverted to old version of systems.pas,
  468. Daniel's version is not compilable due to the bug (corrected) of
  469. mil value for a procvar const !!
  470. Revision 1.1.1.1 1997/11/27 08:33:02 michael
  471. FPC Compiler CVS start
  472. Pre-CVS log:
  473. CEC Carl-Eric Codere
  474. FK Florian Klaempfl
  475. + feature added
  476. - removed
  477. * bug fixed or changed
  478. History:
  479. 15th october 1996:
  480. + ttargetinfo.newline added (FK)
  481. 19th september 1997:
  482. * the suffix of GO32V1 units is now PP1 (FK)
  483. 8th october 1997:
  484. + target amiga added for tests, unit should divided
  485. into sysi386 and sysm68k (FK)
  486. }