fpintf.pas 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Misc routines for the IDE
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. unit FPIntf;
  13. interface
  14. { Run }
  15. function GetRunParameters: string;
  16. procedure SetRunParameters(const Params: string);
  17. { Compile }
  18. procedure Compile(const FileName: string);
  19. procedure SetPrimaryFile(const fn:string);
  20. implementation
  21. uses
  22. Compiler,
  23. {$ifndef NODEBUG}
  24. FPDebug,
  25. {$endif NODEBUG}
  26. FPVars,FPUtils,FPSwitch;
  27. {****************************************************************************
  28. Run
  29. ****************************************************************************}
  30. var
  31. RunParameters : string;
  32. function GetRunParameters: string;
  33. begin
  34. GetRunParameters:=RunParameters;
  35. end;
  36. procedure SetRunParameters(const Params: string);
  37. begin
  38. RunParameters:=Params;
  39. {$ifndef NODEBUG}
  40. If assigned(Debugger) then
  41. Debugger^.SetArgs(RunParameters);
  42. {$endif}
  43. end;
  44. {****************************************************************************
  45. Compile
  46. ****************************************************************************}
  47. procedure Compile(const FileName: string);
  48. var
  49. cmd : string;
  50. begin
  51. cmd:='[fp.cfg] -d'+SwitchesModeStr[SwitchesMode];
  52. if LinkAfter then
  53. cmd:=cmd+' -s';
  54. { Add the switches from the primary file }
  55. if PrimaryFileSwitches<>'' then
  56. cmd:=cmd+' '+PrimaryFileSwitches;
  57. { call the compiler }
  58. Compiler.Compile(cmd+' '+FileName);
  59. end;
  60. procedure SetPrimaryFile(const fn:string);
  61. var
  62. t : text;
  63. begin
  64. PrimaryFile:='';
  65. PrimaryFileMain:='';
  66. PrimaryFileSwitches:='';
  67. PrimaryFilePara:='';
  68. if UpcaseStr(ExtOf(fn))='.PRI' then
  69. begin
  70. assign(t,fn);
  71. {$I-}
  72. reset(t);
  73. if ioresult=0 then
  74. begin
  75. PrimaryFile:=fn;
  76. readln(t,PrimaryFileMain);
  77. readln(t,PrimaryFileSwitches);
  78. readln(t,PrimaryFilePara);
  79. close(t);
  80. end;
  81. {$I+}
  82. EatIO;
  83. end
  84. else
  85. begin
  86. PrimaryFile:=fn;
  87. PrimaryFileMain:=fn;
  88. end;
  89. if PrimaryFilePara<>'' then
  90. SetRunParameters(PrimaryFilePara);
  91. end;
  92. end.
  93. {
  94. $Log$
  95. Revision 1.8 2000-01-03 11:38:34 michael
  96. Changes from Gabor
  97. Revision 1.7 1999/09/16 14:34:59 pierre
  98. + TBreakpoint and TWatch registering
  99. + WatchesCollection and BreakpointsCollection stored in desk file
  100. * Syntax highlighting was broken
  101. Revision 1.6 1999/06/30 23:58:15 pierre
  102. + BreakpointsList Window implemented
  103. with Edit/New/Delete functions
  104. + Individual breakpoint dialog with support for all types
  105. ignorecount and conditions
  106. (commands are not yet implemented, don't know if this wolud be useful)
  107. awatch and rwatch have problems because GDB does not annotate them
  108. I fixed v4.16 for this
  109. Revision 1.5 1999/06/21 23:38:37 pierre
  110. + support for LinkAfter var
  111. Revision 1.4 1999/03/12 01:12:22 peter
  112. * extended primaryfile to load a .pri file
  113. Revision 1.3 1999/02/05 13:51:41 peter
  114. * unit name of FPSwitches -> FPSwitch which is easier to use
  115. * some fixes for tp7 compiling
  116. Revision 1.2 1998/12/28 15:47:45 peter
  117. + Added user screen support, display & window
  118. + Implemented Editor,Mouse Options dialog
  119. + Added location of .INI and .CFG file
  120. + Option (INI) file managment implemented (see bottom of Options Menu)
  121. + Switches updated
  122. + Run program
  123. Revision 1.1 1998/12/22 14:27:54 peter
  124. * moved
  125. Revision 1.4 1998/12/22 10:39:43 peter
  126. + options are now written/read
  127. + find and replace routines
  128. }