Subject: Patch for fvwmrc_convert

From: [email-masked] (Julian Gilbey)
Date: Tue, 2 Mar 1999 01:26:15 +0000 (GMT)

Here is a patch for the utils/fvwmrc_convert script.  Several things
are done here; in order:

(1) Whitespace only lines are treated as empty.
(2) Remove trailing "&" sign from Exec commands.
(3) Slightly more verbose ButtonStyle error message.
(4) I thought that the paths were going to use fvwm, not fvwm2.  So
    the paths should not have gsub("/fvwm", "/fvwm2"); in them.
(5) Handling of the case Key ...... Exec "name" ...
(6) Awful typo: searching for /^[ \t]**.../ takes huge amounts of time
    and/or memory.  This MUST be fixed (and it's trivial).
(7) Slightly more verbose warning message.
(8) More consistent error message.
(9) If the internal Pager command is used, the output file now gives
    hints in the output file as to how the FvwmPager module can be
    configured to look similar to the original internal pager.

Hope these help,

   Julian

--- fvwm-2.2.orig/utils/fvwmrc_convert	Wed Oct 14 01:03:21 1998
+++ fvwm-2.2/utils/fvwmrc_convert	Tue Mar  2 01:19:51 1999
@@ -23,10 +23,11 @@
 # Originally written by Martin Kraemer <[email-masked]>
 # Corrected, extended, and modified by Grant McDorman <[email-masked]>
 # 24 May 95
-# Addtional corrections and extensions by Bill Oswald <[email-masked]>
+# Additional corrections and extensions by Bill Oswald <[email-masked]>
 # 8 Mar 96 thru 18 Jul 96
 # Minor corrections to make it easier to customize by Charles Hines 08/01/96
-#
+# Further minor corrections by Julian Gilbey <[email-masked]> based on those
+# of Austin Donnelly <[email-masked]>, 1 Mar 1999
 
 echo "fvwmrc-to-fvwm2rc"
 
@@ -91,7 +92,7 @@
 	next;
 }
 
-/^$/                            {   # Empty line, pass it thru
+/^[ \t]*$/                            {   # Empty line, pass it thru
 	print $0;
 	next;
 }
@@ -100,6 +101,9 @@
 /Restart/ && /fvwm/             { gsub("fvwm", "fvwm2"); } # try and leave paths alone
 /GoodStuff/                     { gsub("GoodStuff", "FvwmButtons"); }
 
+############ Chop off trailing "&" from Exec commands ##########
+/^Exec[ \t]+/ || /[ \t]+Exec[ \t]+/ { gsub ("\&[ \t]*$",""); }
+
 ################ Highlight Colors ##############
 /^[ \t]*HiBackColor[ \t]*/	{
         dflt["hibackcolor"]=hibackcolor=$2;
@@ -192,7 +196,7 @@
 /^[ \t]*ButtonStyle[ \t]*/	{
         if ($2 == ":") {  # new style already
            if (NF != $4+4)
-	       print "ERROR: ButtonStyle command incorrect" >"'$TTY'";
+	       print "ERROR: ButtonStyle command incorrect\n" NR $0 >"'$TTY'";
 	   printf ("%s %d %d", $1, $3, $4);
 	   for (i=5; i<=NF; ++i)
 	       printf (" %s", $i);
@@ -231,9 +235,9 @@
 /^[ \t]*IconFont[ \t]*/		{ print $0; next; }
 /^[ \t]*SuppressIcons[ \t]*/	{ print "Style \"*\" NoIcon"; next; }
 /^[ \t]*StickyIcons[ \t]*/	{ print "Style \"*\" StickyIcon"; next; }
-/^[ \t]*ModulePath[ \t]*/	{ gsub("/fvwm", "/fvwm2"); print $0; next; }
-/^[ \t]*PixmapPath[ \t]*/	{ gsub("/fvwm", "/fvwm2"); print $0; next; }
-/^[ \t]*IconPath[ \t]*/		{ gsub("/fvwm", "/fvwm2"); print $0; next; }
+/^[ \t]*ModulePath[ \t]*/	{ print $0; next; }
+/^[ \t]*PixmapPath[ \t]*/	{ print $0; next; }
+/^[ \t]*IconPath[ \t]*/		{ print $0; next; }
 # note: Icon must be followed by some white space
 /^[ \t]*Icon[ \t]+/		{ printf "Style %s Icon %s\n", $2, $3; next; }
 
@@ -275,6 +279,26 @@
 ########## Etc ##########
 /^[ \t]*Lenience[ \t]*/		{ print "Style \"*\" " $0; next; }
 /^[ \t]*Style[ \t]*/		{ print $0; next; }
+# Key keyname context mods Exec ...
+#  used to be followed by a "name"; it is no longer
+/^[ \t]*Key[ \t]+[^ \t]+[ \t]+[^ \t]+[ \t]+[^ \t]+[ \t]+Exec[ \t]+\"/  {
+	# not going to handle escaped quotes
+	label=$6;
+	first=7;
+	quoted=substr(label, 1, 1)=="\"" &&
+		substr(label, length(label), 1)!="\"";
+	for (i=7;i<=NF && quoted;i++) {
+		label=$i;
+		quoted=substr(label, length(label), 1)!="\"";
+		first=i + 1;
+	}
+	printf ("%s %s %s %s %s", $1, $2, $3, $4, $5);
+	for (i=first; i<=NF; ++i)
+		printf (" %s", $i);
+	printf ("\n");
+	next;
+}
+# Any other Key command
 /^[ \t]*Key[ \t]*/		{ print $0; next; }
 /^[ \t]*Mouse[ \t]*/		{
 	if (sub("[ 	]Pop[uU]p[ 	]", " Menu ")) {
@@ -307,12 +331,12 @@
 	next;
 }
 
-/^[ \t]**FvwmButtons[ \t]*/	{
+/^[ \t]*FvwmButtons[ \t]*/	{
 	sub("[ 	]Swallow[ 	]*[^ 	]*", "& Exec");
 	print $0;
 	if (length($0) > 199)
 	{
-	    print "Warning: line too long" >"'$TTY'";
+	    print "Warning: line" NR "too long" >"'$TTY'";
 	    print ">> " $0 >"'$TTY'";
 	}
 	if (!warn["GoodStuff"])
@@ -374,7 +398,7 @@
 
 /^[ \t]*EndPopup[ \t]*/		{
         if (!inpopup)
-	   print "ERROR: EndPopup outside of popup" >"'$TTY'";
+	   print "ERROR: EndPopup outside of popup\n" NR $0 >"'$TTY'";
         inpopup=FALSE;
 	prefix="";
 	next;
@@ -400,7 +424,17 @@
 }
 
 /^[ \t]*Pager[ \t]*/		{
-        print "#! " $0 " [deleted]";
+	print "#! " $0 " [deleted]";
+	print "#! An FvwmPager config to emulate builtin pager would be as follows:"
+	print "# *FvwmPagerBack SlateGrey";
+	print "# *FvwmPagerFore Black";
+	print "# *FvwmPagerFont none";
+	print "# *FvwmPagerHilight SlateBlue4";
+	print "# *FvwmPagerGeometry <xsize> <ysize>";
+	print "# *FvwmPagerSmallFont -*-times-medium-r-*-*-*-80-*-*-*-*-*-*";
+	print "# *FvwmPagerDeskTopScale 32";
+	print "# #! Now start pager";
+	print "# Module FvwmPager 0 0";
 	if (warned[$1]==FALSE) {
            print "Warning: " $1 " omitted, internal pager is obsolete (use FvwmPager)" >"'$TTY'";
 	   warned[$1] = TRUE;

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  Julian Gilbey, Dept of Maths, QMW, Univ. of London. [email-masked]
             Debian GNU/Linux Developer.  [email-masked]
       -*- Finger [email-masked] for my PGP public key. -*-
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: [email-masked] (Paul D. Smith)
Date: 02 Mar 1999 12:15:52 -0500

%% [email-masked] (Julian Gilbey) writes:

  jg> Here is a patch for the utils/fvwmrc_convert script.

Thanks!

  jg> (4) I thought that the paths were going to use fvwm, not fvwm2.  So
  jg>     the paths should not have gsub("/fvwm", "/fvwm2"); in them.

  jg> +/^[ \t]*ModulePath[ \t]*/	{ print $0; next; }

I think we should be commenting ModulePath out altogether.  It's 100%
certain that this will break, isn't it?  You won't be pointing to the
new modules and I believe the old 1.xx module interface is not
compatible, so any "extra" 1.xx modules you might have (were there any?)
won't work anyway.

If you like, you can print a warning about this for the user.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: [email-masked]
Date: Tue, 2 Mar 1999 12:35:35 -0500 (EST)

> compatible, so any "extra" 1.xx modules you might have (were there any?)

Just FYI, there are some modules that are not part of fvwm2. 
tkgoodstuff comes to mind.  I don't foresee tkgoodstuff moving itself
into the libexec/fvwm/2.2 directory...

-- 
Larry Gensch					      [email-masked]

       "I suggest a new strategy, R2:  Let the Wookiee win." -- C-3PO

---

From: [email-masked] (Paul D. Smith)
Date: 02 Mar 1999 13:38:04 -0500

%% [email-masked] writes:

  lg> On  2 Mar, Paul D. Smith wrote:
  jg> +/^[ \t]*ModulePath[ \t]*/	{ print $0; next; }

  >> I think we should be commenting ModulePath out altogether.  It's
  >> 100% certain that this will break, isn't it?  You won't be pointing
  >> to the new modules and I believe the old 1.xx module interface is
  >> not compatible, so any "extra" 1.xx modules you might have (were
  >> there any?)  won't work anyway.

  lg> Just FYI, there are some modules that are not part of fvwm2.
  lg> tkgoodstuff comes to mind.  I don't foresee tkgoodstuff moving
  lg> itself into the libexec/fvwm/2.2 directory...

Sure, understood.  But this is an fvwm 1.xx to 2.xx converter script, so
we can assume the input is an fvwm 1.xx script.

AFAIK, there are _no_ extra modules, including tkgoodstuff, that work
with the fvwm 1.xx module interface (are there?).  So, no ModulePath in
fvwm 1.xx should need translation... just removal.

Or am I confused?

---

From: [email-masked]
Date: Tue, 2 Mar 1999 13:46:02 -0500 (EST)

> fvwm 1.xx should need translation... just removal.

I cannot speak for past versions of tkgoodstuff, but version 8.1 (to be
released shortly) requires tcl/tk 8.x and fvwm2.x (and I'll continue to
track the module interface raising the requirements as new features are
added).

I do know that there was a tkFvwm.c that was written prior to
tkgoodstuff that allowed tcl/tk programs to access Fvwm's module
interface.  I'm not sure, but I believe that this was written around
the time before there was an fvwm 2.x.

---

From: Dan Espen <[email-masked]>
Date: Tue, 02 Mar 1999 14:29:11 -0500

> fvwm 1.xx should need translation... just removal.

I think not.  The module protocol did change between version 1 and 2.
(The header is 1 unsigned long longer.)

> -- 
>  Paul D. Smith <[email-masked]>         Network Management Developmen

--
Dan Espen
444 Hoes Lane  Room RRC 1C-214           E-mail: [email-masked]
Piscataway, NJ 08854                     Phone: (732) 699-5570
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]