ppc.dpr 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. {$MINSTACKSIZE $00004000}
  2. {$MAXSTACKSIZE $00100000}
  3. {$IMAGEBASE $00400000}
  4. {$APPTYPE CONSOLE}
  5. {
  6. $Id$
  7. Copyright (c) 1998-2000 by Florian Klaempfl
  8. Commandline compiler for Free Pascal
  9. This program is free software; you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation; either version 2 of the License, or
  12. (at your option) any later version.
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. GNU General Public License for more details.
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. ****************************************************************************}
  21. {
  22. possible compiler switches (* marks a currently required switch):
  23. -----------------------------------------------------------------
  24. USE_RHIDE generates errors and warning in an format recognized
  25. by rhide
  26. TP to compile the compiler with Turbo or Borland Pascal
  27. GDB* support of the GNU Debugger
  28. I386 generate a compiler for the Intel i386+
  29. M68K generate a compiler for the M68000
  30. USEOVERLAY compiles a TP version which uses overlays
  31. EXTDEBUG some extra debug code is executed
  32. SUPPORT_MMX only i386: releases the compiler switch
  33. MMX which allows the compiler to generate
  34. MMX instructions
  35. EXTERN_MSG Don't compile the msgfiles in the compiler, always
  36. use external messagefiles, default for TP
  37. NOAG386INT no Intel Assembler output
  38. NOAG386NSM no NASM output
  39. -----------------------------------------------------------------
  40. Required switches for a i386 compiler be compiled by Free Pascal Compiler:
  41. GDB;I386
  42. Required switches for a i386 compiler be compiled by Turbo Pascal:
  43. GDB;I386;TP
  44. Required switches for a 68000 compiler be compiled by Turbo Pascal:
  45. GDB;M68k;TP
  46. To compile the compiler with Delphi do the following:
  47. }
  48. {$ifdef FPC}
  49. {$ifndef GDB}
  50. { people can try to compile without GDB }
  51. { $error The compiler switch GDB must be defined}
  52. {$endif GDB}
  53. { but I386 or M68K must be defined }
  54. { and only one of the two }
  55. {$ifndef I386}
  56. {$ifndef M68K}
  57. {$fatal One of the switches I386 or M68K must be defined}
  58. {$endif M68K}
  59. {$endif I386}
  60. {$ifdef I386}
  61. {$ifdef M68K}
  62. {$fatal ONLY one of the switches I386 or M68K must be defined}
  63. {$endif M68K}
  64. {$endif I386}
  65. {$ifdef support_mmx}
  66. {$ifndef i386}
  67. {$fatal I386 switch must be on for MMX support}
  68. {$endif i386}
  69. {$endif support_mmx}
  70. {$endif}
  71. {$ifndef DELPHI}
  72. {$ifdef TP}
  73. {$IFNDEF DPMI}
  74. {$M 24000,0,655360}
  75. {$ELSE}
  76. {$M 65000}
  77. {$ENDIF DPMI}
  78. {$E+,N+,F+,S-,R-}
  79. {$endif TP}
  80. {$endif DELPHI}
  81. program pp;
  82. {$IFDEF TP}
  83. {$UNDEF PROFILE}
  84. {$IFDEF DPMI}
  85. {$UNDEF USEOVERLAY}
  86. {$ENDIF}
  87. {$ENDIF}
  88. {$ifdef FPC}
  89. {$UNDEF USEOVERLAY}
  90. {$ENDIF}
  91. uses
  92. {$ifdef useoverlay}
  93. {$ifopt o+}
  94. Overlay,ppovin,
  95. {$else}
  96. {$error You must compile with the $O+ switch}
  97. {$endif}
  98. {$endif useoverlay}
  99. {$ifdef profile}
  100. profile,
  101. {$endif profile}
  102. globals,compiler;
  103. {$ifdef useoverlay}
  104. {$O files}
  105. {$O globals}
  106. {$O hcodegen}
  107. {$O pass_1}
  108. {$O tree}
  109. {$O types}
  110. {$O objects}
  111. {$O options}
  112. {$O cobjects}
  113. {$O globals}
  114. {$O systems}
  115. {$O parser}
  116. {$O pbase}
  117. {$O pdecl}
  118. {$O pexports}
  119. {$O pexpr}
  120. {$O pmodules}
  121. {$O pstatmnt}
  122. {$O psub}
  123. {$O psystem}
  124. {$O ptconst}
  125. {$O script}
  126. {$O switches}
  127. {$O temp_gen}
  128. {$O comphook}
  129. {$O dos}
  130. {$O scanner}
  131. {$O symtable}
  132. {$O objects}
  133. {$O aasm}
  134. {$O link}
  135. {$O assemble}
  136. {$O messages}
  137. {$O gendef}
  138. {$O import}
  139. {$O os2_targ}
  140. {$O win_targ}
  141. {$O asmutils}
  142. {$ifdef gdb}
  143. {$O gdb}
  144. {$endif gdb}
  145. {$ifdef i386}
  146. {$O opts386}
  147. {$O cgi386}
  148. {$O cg386add}
  149. {$O cg386cal}
  150. {$O cg386cnv}
  151. {$O cg386con}
  152. {$O cg386flw}
  153. {$O cg386ld}
  154. {$O cg386mat}
  155. {$O cg386set}
  156. {$ifndef NOOPT}
  157. {$O aopt386}
  158. {$endif NOOPT}
  159. {$O cgai386}
  160. {$O i386}
  161. {$IfNDef Nora386dir}
  162. {$O ra386dir}
  163. {$endif Nora386dir}
  164. {$IfNDef Nora386int}
  165. {$O ra386int}
  166. {$endif Nora386int}
  167. {$IfNDef Nora386att}
  168. {$O ra386att}
  169. {$endif Nora386att}
  170. {$O tgeni386}
  171. {$ifndef NoAg386Int}
  172. {$O ag386int}
  173. {$endif NoAg386Int}
  174. {$O ag386att}
  175. {$ifndef NoAg386Nsm}
  176. {$O ag386nsm}
  177. {$endif}
  178. {$endif}
  179. {$ifdef m68k}
  180. {$O opts68k}
  181. {$O cg68k}
  182. {$O ra68kmot}
  183. {$O ag68kgas}
  184. {$O ag68kmot}
  185. {$O ag68kmit}
  186. {$endif}
  187. {$endif useoverlay}
  188. var
  189. oldexit : pointer;
  190. procedure myexit;{$ifndef FPC}far;{$endif}
  191. begin
  192. exitproc:=oldexit;
  193. { Show Runtime error if there was an error }
  194. if (erroraddr<>nil) then
  195. begin
  196. case exitcode of
  197. 202 : begin
  198. erroraddr:=nil;
  199. Writeln('Error: Stack Overflow');
  200. end;
  201. 203 : begin
  202. erroraddr:=nil;
  203. Writeln('Error: Out of memory');
  204. end;
  205. end;
  206. Writeln('Compilation aborted at line ',aktfilepos.line);
  207. end;
  208. end;
  209. begin
  210. oldexit:=exitproc;
  211. exitproc:=@myexit;
  212. {$ifndef VER0_99_5}
  213. {$ifndef TP}
  214. {$ifndef Delphi}
  215. heapblocks:=true;
  216. {$endif Delphi}
  217. {$endif}
  218. {$endif}
  219. {$ifdef UseOverlay}
  220. InitOverlay;
  221. {$endif}
  222. { Call the compiler with empty command, so it will take the parameters }
  223. Halt(Compile(''));
  224. end.
  225. {
  226. $Log$
  227. Revision 1.4 2000-01-07 01:14:30 peter
  228. * updated copyright to 2000
  229. Revision 1.3 1999/07/18 10:20:00 florian
  230. * made it compilable with Dlephi 4 again
  231. + fixed problem with large stack allocations on win32
  232. Revision 1.2 1999/05/04 21:44:58 florian
  233. * changes to compile it with Delphi 4.0
  234. Revision 1.1 1998/09/18 16:03:44 florian
  235. * some changes to compile with Delphi
  236. Revision 1.28 1998/08/26 15:31:17 peter
  237. * heapblocks for >0.99.5
  238. Revision 1.27 1998/08/11 00:00:00 peter
  239. * fixed dup log
  240. Revision 1.26 1998/08/10 15:49:40 peter
  241. * small fixes for 0.99.5
  242. Revision 1.25 1998/08/10 14:50:16 peter
  243. + localswitches, moduleswitches, globalswitches splitting
  244. Revision 1.24 1998/08/10 10:18:32 peter
  245. + Compiler,Comphook unit which are the new interface units to the
  246. compiler
  247. Revision 1.23 1998/08/05 16:00:16 florian
  248. * some fixes for ansi strings
  249. Revision 1.22 1998/08/04 16:28:40 jonas
  250. * added support for NoRa386* in the $O ... section
  251. Revision 1.21 1998/07/18 17:11:12 florian
  252. + ansi string constants fixed
  253. + switch $H partial implemented
  254. Revision 1.20 1998/07/14 14:46:55 peter
  255. * released NEWINPUT
  256. Revision 1.19 1998/07/07 11:20:04 peter
  257. + NEWINPUT for a better inputfile and scanner object
  258. Revision 1.18 1998/06/24 14:06:33 peter
  259. * fixed the name changes
  260. Revision 1.17 1998/06/23 08:59:22 daniel
  261. * Recommitted.
  262. Revision 1.16 1998/06/17 14:10:17 peter
  263. * small os2 fixes
  264. * fixed interdependent units with newppu (remake3 under linux works now)
  265. Revision 1.15 1998/06/16 11:32:18 peter
  266. * small cosmetic fixes
  267. Revision 1.14 1998/06/15 13:43:45 daniel
  268. * Updated overlays.
  269. Revision 1.12 1998/05/23 01:21:23 peter
  270. + aktasmmode, aktoptprocessor, aktoutputformat
  271. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  272. + $LIBNAME to set the library name where the unit will be put in
  273. * splitted cgi386 a bit (codeseg to large for bp7)
  274. * nasm, tasm works again. nasm moved to ag386nsm.pas
  275. Revision 1.11 1998/05/20 09:42:35 pierre
  276. + UseTokenInfo now default
  277. * unit in interface uses and implementation uses gives error now
  278. * only one error for unknown symbol (uses lastsymknown boolean)
  279. the problem came from the label code !
  280. + first inlined procedures and function work
  281. (warning there might be allowed cases were the result is still wrong !!)
  282. * UseBrower updated gives a global list of all position of all used symbols
  283. with switch -gb
  284. Revision 1.10 1998/05/12 10:47:00 peter
  285. * moved printstatus to verb_def
  286. + V_Normal which is between V_Error and V_Warning and doesn't have a
  287. prefix like error: warning: and is included in V_Default
  288. * fixed some messages
  289. * first time parameter scan is only for -v and -T
  290. - removed old style messages
  291. Revision 1.9 1998/05/11 13:07:56 peter
  292. + $ifdef NEWPPU for the new ppuformat
  293. + $define GDB not longer required
  294. * removed all warnings and stripped some log comments
  295. * no findfirst/findnext anymore to remove smartlink *.o files
  296. Revision 1.8 1998/05/08 09:21:57 michael
  297. + Librarysearchpath is now a linker object field;
  298. Revision 1.7 1998/05/04 17:54:28 peter
  299. + smartlinking works (only case jumptable left todo)
  300. * redesign of systems.pas to support assemblers and linkers
  301. + Unitname is now also in the PPU-file, increased version to 14
  302. Revision 1.6 1998/04/29 13:40:23 peter
  303. + heapblocks:=true
  304. Revision 1.5 1998/04/29 10:33:59 pierre
  305. + added some code for ansistring (not complete nor working yet)
  306. * corrected operator overloading
  307. * corrected nasm output
  308. + started inline procedures
  309. + added starstarn : use ** for exponentiation (^ gave problems)
  310. + started UseTokenInfo cond to get accurate positions
  311. Revision 1.3 1998/04/21 10:16:48 peter
  312. * patches from strasbourg
  313. * objects is not used anymore in the fpc compiled version
  314. Revision 1.2 1998/04/07 13:19:47 pierre
  315. * bugfixes for reset_gdb_info
  316. in MEM parsing for go32v2
  317. better external symbol creation
  318. support for rhgdb.exe (lowercase file names)
  319. }