fpintf.pas 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. 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. end;
  37. {****************************************************************************
  38. Compile
  39. ****************************************************************************}
  40. procedure Compile(const FileName: string);
  41. var
  42. cmd : string;
  43. begin
  44. cmd:='[fp.cfg] -d'+SwitchesModeStr[SwitchesMode];
  45. { Add the switches from the primary file }
  46. if PrimaryFileSwitches<>'' then
  47. cmd:=cmd+' '+PrimaryFileSwitches;
  48. { call the compiler }
  49. Compiler.Compile(cmd+' '+FileName);
  50. end;
  51. procedure SetPrimaryFile(const fn:string);
  52. var
  53. t : text;
  54. begin
  55. PrimaryFile:='';
  56. PrimaryFileMain:='';
  57. PrimaryFileSwitches:='';
  58. PrimaryFilePara:='';
  59. if UpcaseStr(ExtOf(fn))='.PRI' then
  60. begin
  61. assign(t,fn);
  62. {$I-}
  63. reset(t);
  64. if ioresult=0 then
  65. begin
  66. PrimaryFile:=fn;
  67. readln(t,PrimaryFileMain);
  68. readln(t,PrimaryFileSwitches);
  69. readln(t,PrimaryFilePara);
  70. close(t);
  71. end;
  72. {$I+}
  73. EatIO;
  74. end
  75. else
  76. begin
  77. PrimaryFile:=fn;
  78. PrimaryFileMain:=fn;
  79. end;
  80. if PrimaryFilePara<>'' then
  81. SetRunParameters(PrimaryFilePara);
  82. end;
  83. end.
  84. {
  85. $Log$
  86. Revision 1.4 1999-03-12 01:12:22 peter
  87. * extended primaryfile to load a .pri file
  88. Revision 1.3 1999/02/05 13:51:41 peter
  89. * unit name of FPSwitches -> FPSwitch which is easier to use
  90. * some fixes for tp7 compiling
  91. Revision 1.2 1998/12/28 15:47:45 peter
  92. + Added user screen support, display & window
  93. + Implemented Editor,Mouse Options dialog
  94. + Added location of .INI and .CFG file
  95. + Option (INI) file managment implemented (see bottom of Options Menu)
  96. + Switches updated
  97. + Run program
  98. Revision 1.1 1998/12/22 14:27:54 peter
  99. * moved
  100. Revision 1.4 1998/12/22 10:39:43 peter
  101. + options are now written/read
  102. + find and replace routines
  103. }