ppc.dpr 5.0 KB

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