pp.pas 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Commandline compiler for Free Pascal
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************}
  17. {
  18. possible compiler switches (* marks a currently required switch):
  19. -----------------------------------------------------------------
  20. USE_RHIDE generates errors and warning in an format recognized
  21. by rhide
  22. TP to compile the compiler with Turbo or Borland Pascal
  23. GDB* support of the GNU Debugger
  24. I386 generate a compiler for the Intel i386+
  25. M68K generate a compiler for the M68000
  26. USEOVERLAY compiles a TP version which uses overlays
  27. EXTDEBUG some extra debug code is executed
  28. SUPPORT_MMX only i386: releases the compiler switch
  29. MMX which allows the compiler to generate
  30. MMX instructions
  31. EXTERN_MSG Don't compile the msgfiles in the compiler, always
  32. use external messagefiles, default for TP
  33. NOAG386INT no Intel Assembler output
  34. NOAG386NSM no NASM output
  35. -----------------------------------------------------------------
  36. Required switches for a i386 compiler be compiled by Free Pascal Compiler:
  37. GDB;I386
  38. Required switches for a i386 compiler be compiled by Turbo Pascal:
  39. GDB;I386;TP
  40. Required switches for a 68000 compiler be compiled by Turbo Pascal:
  41. GDB;M68k;TP
  42. }
  43. {$ifdef FPC}
  44. {$ifndef GDB}
  45. { people can try to compile without GDB }
  46. { $error The compiler switch GDB must be defined}
  47. {$endif GDB}
  48. { but I386 or M68K must be defined }
  49. { and only one of the two }
  50. {$ifndef I386}
  51. {$ifndef M68K}
  52. {$fatal One of the switches I386 or M68K must be defined}
  53. {$endif M68K}
  54. {$endif I386}
  55. {$ifdef I386}
  56. {$ifdef M68K}
  57. {$fatal ONLY one of the switches I386 or M68K must be defined}
  58. {$endif M68K}
  59. {$endif I386}
  60. {$ifdef support_mmx}
  61. {$ifndef i386}
  62. {$fatal I386 switch must be on for MMX support}
  63. {$endif i386}
  64. {$endif support_mmx}
  65. {$endif}
  66. {$ifdef TP}
  67. {$IFNDEF DPMI}
  68. {$M 24000,0,655360}
  69. {$ELSE}
  70. {$M 65000}
  71. {$ENDIF DPMI}
  72. {$E+,N+,F+,S-,R-}
  73. {$endif TP}
  74. program pp;
  75. {$IFDEF TP}
  76. {$UNDEF PROFILE}
  77. {$IFDEF DPMI}
  78. {$UNDEF USEOVERLAY}
  79. {$ENDIF}
  80. {$ENDIF}
  81. {$ifdef FPC}
  82. {$UNDEF USEOVERLAY}
  83. {$ENDIF}
  84. uses
  85. {$ifdef useoverlay}
  86. {$ifopt o+}
  87. Overlay,ppovin,
  88. {$else}
  89. {$error You must compile with the $O+ switch}
  90. {$endif}
  91. {$endif useoverlay}
  92. {$ifdef profile}
  93. profile,
  94. {$endif profile}
  95. {$ifdef FPC}
  96. {$ifdef heaptrc}
  97. ppheap,
  98. {$endif heaptrc}
  99. {$ifdef linux}
  100. catch,
  101. {$endif}
  102. {$endif FPC}
  103. globals,compiler
  104. ;
  105. {$ifdef useoverlay}
  106. {$O files}
  107. {$O globals}
  108. {$O hcodegen}
  109. {$O pass_1}
  110. {$O pass_2}
  111. {$O tree}
  112. {$O types}
  113. {$O objects}
  114. {$O options}
  115. {$O cobjects}
  116. {$O globals}
  117. {$O systems}
  118. {$O parser}
  119. {$O pbase}
  120. {$O pdecl}
  121. {$O pexports}
  122. {$O pexpr}
  123. {$O pmodules}
  124. {$O pstatmnt}
  125. {$O psub}
  126. {$O psystem}
  127. {$O ptconst}
  128. {$O script}
  129. {$O switches}
  130. {$O temp_gen}
  131. {$O comphook}
  132. {$O dos}
  133. {$O scanner}
  134. {$O symtable}
  135. {$O objects}
  136. {$O aasm}
  137. {$O link}
  138. {$O assemble}
  139. {$O messages}
  140. {$O gendef}
  141. {$O import}
  142. {$ifdef i386}
  143. {$O os2_targ}
  144. {$O win_targ}
  145. {$endif i386}
  146. {$O asmutils}
  147. {$ifdef gdb}
  148. {$O gdb}
  149. {$endif gdb}
  150. {$ifdef i386}
  151. {$O opts386}
  152. {$O i386}
  153. {$O cgai386}
  154. {$O tgeni386}
  155. {$O cg386add}
  156. {$O cg386cal}
  157. {$O cg386cnv}
  158. {$O cg386con}
  159. {$O cg386flw}
  160. {$O cg386ld}
  161. {$O cg386inl}
  162. {$O cg386mat}
  163. {$O cg386set}
  164. {$ifndef NOOPT}
  165. {$O aopt386}
  166. {$endif}
  167. {$IfNDef Nora386dir}
  168. {$O ra386dir}
  169. {$endif}
  170. {$IfNDef Nora386int}
  171. {$O ra386int}
  172. {$endif}
  173. {$IfNDef Nora386att}
  174. {$O ra386att}
  175. {$endif}
  176. {$ifndef NoAg386Int}
  177. {$O ag386int}
  178. {$endif}
  179. {$ifndef NoAg386Att}
  180. {$O ag386att}
  181. {$endif}
  182. {$ifndef NoAg386Nsm}
  183. {$O ag386nsm}
  184. {$endif}
  185. {$endif}
  186. {$ifdef m68k}
  187. {$O opts68k}
  188. {$O m68k}
  189. {$O cga68k}
  190. {$O tgen68k}
  191. {$O cg68kadd}
  192. {$O cg68kcal}
  193. {$O cg68kcnv}
  194. {$O cg68kcon}
  195. {$O cg68kflw}
  196. {$O cg68kld}
  197. {$O cg68kinl}
  198. {$O cg68kmat}
  199. {$O cg68kset}
  200. {$IfNDef Nora68kMot}
  201. {$O ra68kmot}
  202. {$endif}
  203. {$IfNDef Noag68kGas}
  204. {$O ag68kgas}
  205. {$endif}
  206. {$IfNDef Noag68kMot}
  207. {$O ag68kmot}
  208. {$endif}
  209. {$IfNDef Noag68kMit}
  210. {$O ag68kmit}
  211. {$endif}
  212. {$endif}
  213. {$endif useoverlay}
  214. var
  215. oldexit : pointer;
  216. procedure myexit;{$ifndef FPC}far;{$endif}
  217. begin
  218. exitproc:=oldexit;
  219. { Show Runtime error if there was an error }
  220. if (erroraddr<>nil) then
  221. begin
  222. case exitcode of
  223. 202 : begin
  224. erroraddr:=nil;
  225. Writeln('Error: Stack Overflow');
  226. end;
  227. 203 : begin
  228. erroraddr:=nil;
  229. Writeln('Error: Out of memory');
  230. end;
  231. end;
  232. Writeln('Compilation aborted at line ',aktfilepos.line);
  233. end;
  234. end;
  235. begin
  236. oldexit:=exitproc;
  237. exitproc:=@myexit;
  238. {$ifdef fpc}
  239. heapblocks:=true;
  240. {$endif}
  241. {$ifdef UseOverlay}
  242. InitOverlay;
  243. {$endif}
  244. { Call the compiler with empty command, so it will take the parameters }
  245. Halt(Compile(''));
  246. end.
  247. {
  248. $Log$
  249. Revision 1.1 1998-12-26 15:20:31 florian
  250. + more changes for the new version
  251. }