fpintf.pas 3.1 KB

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