2
0

ppc.dpr 9.5 KB

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