Subject: broken $0 args

From: Brad Giaccio <[email-masked]>
Date: Wed, 7 Apr 1999 13:12:38 -0400

Dominik,
alright the problem seems to be in functions.c:expand
you do a 
if(input[i] == '$')
    {
      switch (input[i+1])
        {
        case '0': case '1': case '2': case '3': case '4': case '5':
        case '6': case '7': case '8': case '9':
          n = input[i+1] - '0';
          if(arguments[n] != NULL)
        {
          for(k=0;k<strlen(arguments[n]);k++)
            out[j++] = arguments[n][k];
          i++;
        } 

but arguments is NULL so it never gets filled and you just wind up
putting the int into out.  Now I'm not quite sure where this should be
handled, I figured I would let you look since your name is all over the
annotation.

Brad

-- 
--- There are two kinds of knowledge, you either know the answer or
			you know where to find it
		      -Kane, Johnson, and anonymous
--
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: Brad Giaccio <[email-masked]>
Date: Wed, 7 Apr 1999 13:40:42 -0400

> handled, I figured I would let you look since your name is all over the

Okay I lied here is the fix to functions.c, just 2 lines that put the
dollar in the string if there are no arguments.

Index: functions.c
========================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/functions.c,v retrieving revision
1.47 diff -u -B -b -r1.47 functions.c
--- functions.c 1999/04/07 02:39:57     1.47
+++ functions.c 1999/04/07 17:39:09
@@ -314,6 +314,8 @@
                  for(k=0;k<strlen(arguments[n]);k++)
                    out[j++] = arguments[n][k];
                  i++;
+               } else {
+             out[j++] = '$';
                }
              break;
            case 'w':

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 7 Apr 1999 20:21:27 +0200

> dollar in the string if there are no arguments.

The fix should work, but what utterly confuses me is that $0
doesn't work when I use 2.2 or 2.1.4 executables. I can see what
I've done wrong, but still...

Bye

Dominik ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
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: Brad Giaccio <[email-masked]>
Date: Thu, 8 Apr 1999 12:24:22 -0400

> I've done wrong, but still...

Unfortunatelly I don't have any of the 2.1.x's laying around, to check
I suppose we could look in CVS archive to find it, although I don't
remember how to get an old file version based on tag.

hey but it doesn't matter to much it worked in 2.2 and it works again
now so we are free and clear of seeing any bug reports on it

---

From: Jason L Tibbitts III <[email-masked]>
Date: 08 Apr 1999 12:18:00 -0500

>>>>> "BG" == Brad Giaccio <[email-masked]> writes:

BG> Unfortunatelly I don't have any of the 2.1.x's laying around, to check

They are all on the FTP site.

BG> I suppose we could look in CVS archive to find it, although I don't
BG> remember how to get an old file version based on tag.

cvs update -r version-2_1_4

This may stick the tag; you may need to do cvs update -A to unstick them
and track the head again.

 - J<

---

From: [email-masked] (Paul D. Smith)
Date: 08 Apr 1999 13:33:34 -0400

%% Jason L Tibbitts III <[email-masked]> writes:

  jlt> cvs update -r version-2_1_4

I added a bunch of stuff to the cvs.html file, including how to do this.

  jlt> This may stick the tag; you may need to do cvs update -A to
  jlt> unstick them and track the head again.

Yes, it will stick.

Alternatively, rather than whacking your existing workspace, you can
just check it out into a different directory:

  cvs -d :pserver:... co -d fvwm-test -r version-2_1_4 fvwm

then just delete the fvwm-test directory when you're done playing with it.

-- 
-------------------------------------------------------------------------------
 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: Brad Giaccio <[email-masked]>
Date: Thu, 8 Apr 1999 13:46:26 -0400

>   cvs -d :pserver:... co -d fvwm-test -r version-2_1_4 fvwm

Thanks Jason, and Paul, that worked.

Dominik, it looks like it was a slight off by one error on the
incrementing of i, and after staring at this expand function for a day
now, can I suggest we all agree on an indentation style that actually
moves left as you increase the level.

But anyway, now that it all works, good work on the expand function I am
noticing a definite speed up on executing functions with params as well
as an overall speed up in start time. Thanks,

Brad

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 9 Apr 1999 02:23:54 +0200

> as an overall speed up in start time. Thanks,

Really? I simply replaced a list of if's with a switch. I wouldn't think
that has a noticeable impact.

Bye

Dominik ^_^

---

From: Brad Giaccio <[email-masked]>
Date: Fri, 9 Apr 1999 11:59:08 -0400

> that has a noticeable impact.

Well I was able to notice it on my dual processor ultra2, and then
I really noticed when I brought fv up on a sparc 2.  I think if
I remmember correctlly it has to do with the number of assembly
instructions needed for a switch vice an if-else construct.

But switches were made for char to char compares like this if-else's get
to clumssy and hard to read

Brad

---

From: [email-masked]
Date: Fri, 9 Apr 1999 12:18:12 -0400 (EDT)

> instructions needed for a switch vice an if-else construct.

If I remember correctly, switch statements (especially large ones) can
get "optimized" to use hashing by the compiler.  This could profoundly
affect performance if the code is executed repeatedly.
 
-- 
Larry Gensch					      [email-masked]

I would really appreciate it if the login command had a better sense of humor.

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 9 Apr 1999 21:13:39 +0200

> affect performance if the code is executed repeatedly.

Yes, I know that switches are faster. That's the reason why I used
them. But there were 6 if statements that had to be checked for
each parameter of a function for every call of a fvwm function.
I can't believe it makes a noticeable difference unless you use
tons of functions.

Bye

Dominik ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 9 Apr 1999 21:13:39 +0200

Bye

Dominik ^_^

---

From: Dan Espen <[email-masked]>
Date: Fri, 09 Apr 1999 15:57:49 -0400

> I can't believe it makes a noticeable difference unless you use

I think changing  6  ifs to a   switch might be  faster,  but Domink's
reasoning about the overall impact seems  sound.  The recent change to
the   command table, (using strcmp    vs.  strcasecmp during a  binary
search) might be a better candidate for explaining a visible speedup.

Heres another expression that might not translate too well, "looking a
gift horse in the mouth".

I've got a  sparc 1+, about 1/2 the  speed of the  sparc 2.  I haven't
noticed any recent improvement, but I haven't rebuilt  for a few days.
I'll check it out.

--
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]