Browse Source

* extended primaryfile to load a .pri file

peter 26 years ago
parent
commit
ed4fdd2e0b
1 changed files with 50 additions and 4 deletions
  1. 50 4
      ide/text/fpintf.pas

+ 50 - 4
ide/text/fpintf.pas

@@ -22,12 +22,14 @@ procedure SetRunParameters(const Params: string);
 
 { Compile }
 procedure Compile(const FileName: string);
+procedure SetPrimaryFile(const fn:string);
+
 
 implementation
 
 uses
   Compiler,
-  FPSwitch;
+  FPVars,FPUtils,FPSwitch;
 
 {****************************************************************************
                                    Run
@@ -52,16 +54,60 @@ end;
 ****************************************************************************}
 
 procedure Compile(const FileName: string);
+var
+  cmd : string;
 begin
-{   WriteSwitches('fp.cfg'); }
+  cmd:='[fp.cfg] -d'+SwitchesModeStr[SwitchesMode];
+{ Add the switches from the primary file }
+  if PrimaryFileSwitches<>'' then
+   cmd:=cmd+' '+PrimaryFileSwitches;
 { call the compiler }
-  Compiler.Compile('[fp.cfg] -d'+SwitchesModeStr[SwitchesMode]+' '+FileName);
+  Compiler.Compile(cmd+' '+FileName);
+end;
+
+
+procedure SetPrimaryFile(const fn:string);
+var
+  t : text;
+begin
+  PrimaryFile:='';
+  PrimaryFileMain:='';
+  PrimaryFileSwitches:='';
+  PrimaryFilePara:='';
+  if UpcaseStr(ExtOf(fn))='.PRI' then
+   begin
+     assign(t,fn);
+     {$I-}
+     reset(t);
+     if ioresult=0 then
+      begin
+        PrimaryFile:=fn;
+        readln(t,PrimaryFileMain);
+        readln(t,PrimaryFileSwitches);
+        readln(t,PrimaryFilePara);
+        close(t);
+      end;
+     {$I+}
+     EatIO;
+   end
+  else
+   begin
+     PrimaryFile:=fn;
+     PrimaryFileMain:=fn;
+   end;
+  if PrimaryFilePara<>'' then
+   SetRunParameters(PrimaryFilePara);
 end;
 
+
+
 end.
 {
   $Log$
-  Revision 1.3  1999-02-05 13:51:41  peter
+  Revision 1.4  1999-03-12 01:12:22  peter
+    * extended primaryfile to load a .pri file
+
+  Revision 1.3  1999/02/05 13:51:41  peter
     * unit name of FPSwitches -> FPSwitch which is easier to use
     * some fixes for tp7 compiling