ppc.dpr 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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. program ppc;
  19. {$MINSTACKSIZE $00004000}
  20. {$MAXSTACKSIZE $00100000}
  21. {$IMAGEBASE $00400000}
  22. {$APPTYPE CONSOLE}
  23. {
  24. possible compiler switches (* marks a currently required switch):
  25. -----------------------------------------------------------------
  26. USE_RHIDE generates errors and warning in an format recognized
  27. by rhide
  28. GDB* support of the GNU Debugger
  29. I386 generate a compiler for the Intel i386+
  30. M68K generate a compiler for the M68000
  31. USEOVERLAY compiles a TP version which uses overlays
  32. DEBUG version with debug code is generated
  33. EXTDEBUG some extra debug code is executed
  34. SUPPORT_MMX only i386: releases the compiler switch
  35. MMX which allows the compiler to generate
  36. MMX instructions
  37. EXTERN_MSG Don't compile the msgfiles in the compiler, always
  38. use external messagefiles, default for TP
  39. NOAG386INT no Intel Assembler output
  40. NOAG386NSM no NASM output
  41. NOAG386BIN leaves out the binary writer, default for TP
  42. LOGMEMBLOCKS adds memory manager which logs the size of
  43. each allocated memory block, the information
  44. is written to memuse.log after compiling
  45. -----------------------------------------------------------------
  46. Required switches for a i386 compiler be compiled by Free Pascal Compiler:
  47. GDB;I386
  48. Required switches for a i386 compiler be compiled by Turbo Pascal:
  49. GDB;I386;TP
  50. Required switches for a 68000 compiler be compiled by Turbo Pascal:
  51. GDB;M68k;TP
  52. }
  53. {$i fpcdefs.inc}
  54. {$ifdef FPC}
  55. {$ifndef GDB}
  56. { people can try to compile without GDB }
  57. { $error The compiler switch GDB must be defined}
  58. {$endif GDB}
  59. { but I386 or M68K must be defined }
  60. { and only one of the two }
  61. {$ifndef I386}
  62. {$ifndef M68K}
  63. {$fatal One of the switches I386 or M68K must be defined}
  64. {$endif M68K}
  65. {$endif I386}
  66. {$ifdef I386}
  67. {$ifdef M68K}
  68. {$fatal ONLY one of the switches I386 or M68K must be defined}
  69. {$endif M68K}
  70. {$endif I386}
  71. {$ifdef support_mmx}
  72. {$ifndef i386}
  73. {$fatal I386 switch must be on for MMX support}
  74. {$endif i386}
  75. {$endif support_mmx}
  76. {$endif}
  77. uses
  78. {$ifdef FPC}
  79. {$ifdef profile}
  80. profile,
  81. {$endif profile}
  82. {$ifdef heaptrc}
  83. ppheap,
  84. {$endif heaptrc}
  85. {$ifdef Unix}
  86. catch,
  87. {$endif}
  88. {$ifdef go32v2}
  89. {$ifdef DEBUG}
  90. {$define NOCATCH}
  91. {$endif DEBUG}
  92. catch,
  93. {$endif}
  94. { we've now a lineinfo unit for all OSes }
  95. {$ifdef DEBUG}
  96. lineinfo,
  97. {$endif DEBUG}
  98. {$endif FPC}
  99. globals,compiler;
  100. var
  101. oldexit : pointer;
  102. procedure myexit;
  103. begin
  104. exitproc:=oldexit;
  105. { Show Runtime error if there was an error }
  106. if (erroraddr<>nil) then
  107. begin
  108. case exitcode of
  109. 100:
  110. begin
  111. erroraddr:=nil;
  112. writeln('Error while reading file');
  113. end;
  114. 101:
  115. begin
  116. erroraddr:=nil;
  117. writeln('Error while writing file');
  118. end;
  119. 202:
  120. begin
  121. erroraddr:=nil;
  122. writeln('Error: Stack Overflow');
  123. end;
  124. 203:
  125. begin
  126. erroraddr:=nil;
  127. writeln('Error: Out of memory');
  128. end;
  129. end;
  130. { we cannot use aktfilepos.file because all memory might have been
  131. freed already !
  132. But we can use global parser_current_file var }
  133. Writeln('Compilation aborted ',parser_current_file,':',aktfilepos.line);
  134. end;
  135. end;
  136. begin
  137. oldexit:=exitproc;
  138. exitproc:=@myexit;
  139. { Call the compiler with empty command, so it will take the parameters }
  140. Halt(compiler.Compile(''));
  141. end.
  142. {
  143. $Log$
  144. Revision 1.6 2002-10-05 12:43:27 carl
  145. * fixes for Delphi 6 compilation
  146. (warning : Some features do not work under Delphi)
  147. Revision 1.5 2002/09/07 15:25:07 peter
  148. * old logs removed and tabs fixed
  149. Revision 1.4 2002/08/12 15:08:40 carl
  150. + stab register indexes for powerpc (moved from gdb to cpubase)
  151. + tprocessor enumeration moved to cpuinfo
  152. + linker in target_info is now a class
  153. * many many updates for m68k (will soon start to compile)
  154. - removed some ifdef or correct them for correct cpu
  155. }