systems.pas 15 KB

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