[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

[PATCH] -o flags in .wmkrc



On Mon, 17 May 1999, Fritz Zaucker wrote:

> PROBLEM DESCRIPTION:
> 
> wmk produces a 
> 
>     -ooutputfile optionI 
> 
> for wml. This is not good if -o lines are specified in the .wmlrc
> file.
> 
> I tried to add an option to wmk (-N) that would suppress the creation
> of the -o line for wml. This is a rather trivial patch which I'd
> happily submit.
> 
> However, when I tried to put -N into the .wmkrc file (and this is what
> would be needed in conjunction with the -o lines in .wmlrc) I noticed,
> that .wmkrc is only read if wmk process a directory and not when it
> processes a single file.
> 
> Looks to me as if the code for reading .wmkrc is at the wrong place
> (inside sub determine_files).

Hi Fritz,

below is a patch to allow -o flags in .wmkrc.
I am rethinking how wmk builds options from .wmkrc and command line,
so wmk could change soon.

I believe we don't need the -N flag, am i right?

Denis

diff -u -r1.7 -r1.8 wml_frontend/wmk.src
@@ -119,6 +119,7 @@
 @opt_i = ();
 @opt_D = ();
 $opt_O = '';
+@opt_o = ();
 @opt_P = ();
 @opt_E = ();
 $opt_t = 0;
@@ -149,6 +150,7 @@
             "i|includefile=s@", 
             "D|define=s@",
             "O|optimize=i",
+            "o|output=s@",
             "P|prologue=s@",
             "E|epilogue=s@",
             "t|settime",
@@ -315,10 +317,12 @@
         if ($dir) {
             $cwd = Cwd::cwd;
             chdir($dir);
+            &read_rcfile();
             &process_file($p, $dir, $file);
             chdir($cwd);
         }
         else {
+            &read_rcfile();
             &process_file($p, $dir, $file);
         }
     }
@@ -328,19 +332,18 @@
     }
 }
 
-#   determine files to act on
-sub determine_files {
-    my ($cwd, $reldir, $dir, @DIR, @files, @filesA, @filesF, $fileA, $fileF, %files);
-
-    #   read .wmkrc files
+#   read .wmkrc files
+sub read_rcfile {
     @opt_A_SAV = @opt_A;
     @opt_F_SAV = @opt_F;
     @opt_x_SAV = @opt_x;
     @opt_X_SAV = @opt_X;
+    @opt_o_SAV = @opt_o;
     @opt_A_CUR = @opt_A;
     @opt_F_CUR = @opt_F;
     @opt_x_CUR = @opt_x;
     @opt_X_CUR = @opt_X;
+    @opt_o_CUR = @opt_o;
     if (not $opt_r) {
         ($cwd = Cwd::cwd) =~ s|/$||;
         while ($cwd) {
@@ -365,19 +368,30 @@
                 @opt_F = ();
                 @opt_x = ();
                 @opt_X = ();
+                @opt_o = ();
                 &ProcessOptions();
                 @opt_A_CUR = (@opt_A_CUR, @opt_A);
                 @opt_F_CUR = (@opt_F_CUR, @opt_F);
                 @opt_x_CUR = (@opt_x_CUR, @opt_x);
                 @opt_X_CUR = (@opt_X_CUR, @opt_X);
+                @opt_o_CUR = @opt_o if $#opt_o > -1;
             }
         }
         @opt_A = @opt_A_SAV;
         @opt_F = @opt_F_SAV;
         @opt_x = @opt_x_SAV;
         @opt_X = @opt_X_SAV;
+        @opt_o = @opt_o_SAV;
     }
+}
+
+#   determine files to act on
+sub determine_files {
+    my ($cwd, $reldir, $dir, @DIR, @files, @filesA, @filesF, $fileA, $fileF, %files);
 
+    #   read .wmkrc files to check -A and -F options
+    &read_rcfile();
+
     #   determine files
     @filesA = glob(join(' ', @opt_A_CUR));
     @filesF = glob(join(' ', @opt_F_CUR));
@@ -431,6 +445,8 @@
     #   determine additional options
     open(FP, "<$file");
     $shebang = '';
+    $opts = '';
+    $opts = '-o' . join(' -o', @opt_o_CUR) if $#opt_o_CUR > -1;
     while (1) {
         $shebang .= <FP>;
         if ($shebang =~ m|^(.*)\\\s*$|s) {
@@ -439,7 +455,6 @@
         }
         last;
     }
-    $opts = '';
     if ($shebang =~ m|^#!wml\s+(.+\S)\s*$|is) {
        $opts = $1;
     }

______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com