fpintf.pas 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. FPDebug,FPVars,FPUtils,FPSwitch;
  24. {****************************************************************************
  25. Run
  26. ****************************************************************************}
  27. var
  28. RunParameters : string;
  29. function GetRunParameters: string;
  30. begin
  31. GetRunParameters:=RunParameters;
  32. end;
  33. procedure SetRunParameters(const Params: string);
  34. begin
  35. RunParameters:=Params;
  36. If assigned(Debugger) then
  37. Debugger^.SetArgs(RunParameters);
  38. end;
  39. {****************************************************************************
  40. Compile
  41. ****************************************************************************}
  42. procedure Compile(const FileName: string);
  43. var
  44. cmd : string;
  45. begin
  46. cmd:='[fp.cfg] -d'+SwitchesModeStr[SwitchesMode];
  47. if LinkAfter then
  48. cmd:=cmd+' -s';
  49. { Add the switches from the primary file }
  50. if PrimaryFileSwitches<>'' then
  51. cmd:=cmd+' '+PrimaryFileSwitches;
  52. { call the compiler }
  53. Compiler.Compile(cmd+' '+FileName);
  54. end;
  55. procedure SetPrimaryFile(const fn:string);
  56. var
  57. t : text;
  58. begin
  59. PrimaryFile:='';
  60. PrimaryFileMain:='';
  61. PrimaryFileSwitches:='';
  62. PrimaryFilePara:='';
  63. if UpcaseStr(ExtOf(fn))='.PRI' then
  64. begin
  65. assign(t,fn);
  66. {$I-}
  67. reset(t);
  68. if ioresult=0 then
  69. begin
  70. PrimaryFile:=fn;
  71. readln(t,PrimaryFileMain);
  72. readln(t,PrimaryFileSwitches);
  73. readln(t,PrimaryFilePara);
  74. close(t);
  75. end;
  76. {$I+}
  77. EatIO;
  78. end
  79. else
  80. begin
  81. PrimaryFile:=fn;
  82. PrimaryFileMain:=fn;
  83. end;
  84. if PrimaryFilePara<>'' then
  85. SetRunParameters(PrimaryFilePara);
  86. end;
  87. end.
  88. {
  89. $Log$
  90. Revision 1.6 1999-06-30 23:58:15 pierre
  91. + BreakpointsList Window implemented
  92. with Edit/New/Delete functions
  93. + Individual breakpoint dialog with support for all types
  94. ignorecount and conditions
  95. (commands are not yet implemented, don't know if this wolud be useful)
  96. awatch and rwatch have problems because GDB does not annotate them
  97. I fixed v4.16 for this
  98. Revision 1.5 1999/06/21 23:38:37 pierre
  99. + support for LinkAfter var
  100. Revision 1.4 1999/03/12 01:12:22 peter
  101. * extended primaryfile to load a .pri file
  102. Revision 1.3 1999/02/05 13:51:41 peter
  103. * unit name of FPSwitches -> FPSwitch which is easier to use
  104. * some fixes for tp7 compiling
  105. Revision 1.2 1998/12/28 15:47:45 peter
  106. + Added user screen support, display & window
  107. + Implemented Editor,Mouse Options dialog
  108. + Added location of .INI and .CFG file
  109. + Option (INI) file managment implemented (see bottom of Options Menu)
  110. + Switches updated
  111. + Run program
  112. Revision 1.1 1998/12/22 14:27:54 peter
  113. * moved
  114. Revision 1.4 1998/12/22 10:39:43 peter
  115. + options are now written/read
  116. + find and replace routines
  117. }