Subject: Problem with FvwmCommand

From: Dan Espen <[email-masked]>
Date: Sat, 03 Mar 2001 20:39:39 -0500

A long while  back we "fixed" command lookup  in functions.c by making
the table of functions contain all lower case function names.

Looking thru FvwmCommand I see that parts of FvwmCommand expect
the old mixed case function names.  For example, scripts/test1.pl
expects to be able to issue the command "Desk" but it now has to
issue "desk".

I guess we could add an unused column to the table in functions.c
to get the old behavior back...

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

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 5 Mar 2001 20:40:18 +0100

> to get the old behavior back...

I don't know.  It's easy to adapt the perl scripts that we supply,
but that won't help people who have written their own perl scripts
and are still using the old spelling.  Is this really relevant?

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: Dan Espen <[email-masked]>
Date: Mon, 05 Mar 2001 14:15:44 -0500

> and are still using the old spelling.  Is this really relevant?

Actually, with all lowercase names  for the fvwm functions, its pretty
hopeless.  Too  many of our commands clash  with Perl functions, (like
"next","close","exec").

Of  course its possible to rewrite  Perl stuff just doing system calls
to FvwmCommand, but its  not as pretty  or natural  as the mixed  case
solution.

I thought a simple macro to define commands might be ok, we could replace:

  {"addtofunc",    add_item_to_func, F_ADDFUNC,              FUNC_ADD_TO},
  {"addtomenu",    add_item_to_menu, F_ADDMENU,              0},

with

FD(AddToFunc,"addtofunc",add_item_to_func,F_ADDFUNC,FUNC_ADD_TO)
FD(AddToMenu,"addtomenu",add_item_to_menu,F_ADDMENU,0)

or we could rename the functions to make the second column usable.
We'd need to do some kind of trick with "+" and "function".

I switched to  using the shell  interface for the FvwmButton tests  so
its not an immediate problem for me.

If you want to drop the FvwmCommand.pm stuff, thats OK too, but
someone, somewhere might be using it.

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 6 Mar 2001 02:03:08 +0100

> hopeless.  Too  many of our commands clash  with Perl functions, (like

:-P

> FD(AddToMenu,"addtomenu",add_item_to_menu,F_ADDMENU,0)

Looks good to me.  Now, if we only could get rig of the
redundancy.

Bye

Dominik ^_^  ^_^

---

From: Mikhael Goikhman <[email-masked]>
Date: Mon, 5 Mar 2001 18:57:56 -0600

> hopeless.  Too  many of our commands clash  with Perl functions, (like

There is the same problem with FvwmCommand.sh, like the commands
"function", "wait", "exec", "echo".

> FD(AddToMenu,"addtomenu",add_item_to_menu,F_ADDMENU,0)

Probably a good idea if we want to continue with FvwmConsole.{pm,sh}.

> someone, somewhere might be using it.

I myself don't think either FvwmCommand.sh or FvwmCommand.pm are useful.
They may be ok for simple cases, but for more complex ones it is much
better to open once a pipe to FvwmCommand/FvwmConsole and write to pipe.

I really don't see a point to have perl (or shell) function without any
parameter checking and with quoting/spacing/escaping problems. Consider:

  Current ("My Window", !iconified) Move 10p 20p

Which is more understandable, the one using FvwmCommand.pm:

  current('("My Window",', '!iconified)', 'Move', '10p', '20p');

or simply:

  system("FvwmCommand", q{Current ("My Window", !iconified) Move 10p 20p});

or maybe just:

  sub fvwm ($) { system("FvwmCommand", $_[0]); }

  fvwm q{Current ("My Window", !iconified) Move 10p 20p};
  fvwm q{Exec exec xmessage 'Try the same using "FvwmCommand.pm"'};

I would not recomment using FvwmCommand.sh or FvwmCommand.pm, there are
better methods using FvwmCommand directly. :)

Regards,
Mikhael.

---

From: Pekka Marjola <[email-masked]>
Date: 06 Mar 2001 10:52:54 +0200

>>>>> In <[email-masked]>,
>>>>> On Mon, 5 Mar 2001 18:57:56 -0600,
>>>>> "Mikhael" == Mikhael Goikhman <[email-masked]> writes:

Mikhael> I myself don't think either FvwmCommand.sh or FvwmCommand.pm
Mikhael> are useful. They may be ok for simple cases, but for more
Mikhael> complex ones it is much better to open once a pipe to
Mikhael> FvwmCommand/FvwmConsole and write to pipe.

Mikhael> Current ("My Window", !iconified) Move 10p 20p

Mikhael> Which is more understandable, the one using FvwmCommand.pm:

Mikhael> current('("My Window",', '!iconified)', 'Move', '10p', '20p');

current(qw/("My Window", !iconified) Move 10p 20p/);

Mikhael> I would not recomment using FvwmCommand.sh or FvwmCommand.pm,
Mikhael> there are better methods using FvwmCommand directly. :)

Not in the present form. Make a Perl extension of FvwmCommand.c, then
functions in FvwmCommand could be directly called from Perl without
separate process. Don't know if it is worthwhile, though.

-- 
[email-masked] * http://www.iki.fi/pema/
Saga Keeper 	(Ars Magica web tool)	1.0b6	http://www.sagakeeper.com/
--
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: Dan Espen <[email-masked]>
Date: Tue, 06 Mar 2001 07:48:10 -0500

Dominik Vogt <[email-masked]> writes:
> Looks good to me.  Now, if we only could get rid of the
> redundancy.

Well we could with:

   {"addtofunc",  CMD_AddToFunc, F_ADDFUNC, FUNC_ADD_TO},
   {"addtomenu",  CMD_AddToMenu, F_ADDMENU, 0},

The advantage here is that there is less redundancy, and all functions
that implement commands would have a common naming scheme ("CMD_").
It might make navigating and reading the source code easier too.

Mikhael Goikhman <[email-masked]> writes:
...
> better methods using FvwmCommand directly. :)

I agree, but the cost of keeping this working seems pretty small.
After we decide on a solution or decide to drop the feature,
I can make the change although I'm going to finish the FvwmButtons tests
first and that may still take a while.

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 10 Mar 2001 18:16:44 -0600

> current(qw/("My Window", !iconified) Move 10p 20p/);

Your syntax can't be used if the script is run under "perl -w" (the only
correct way) and/or if the command has tabs, like in menu items.

> separate process. Don't know if it is worthwhile, though.

I am not against if you implement FvwmCommand.pm natively in perl with
only one exported function fvwm() or FvwmCommands().

But I think we should simply replace FvwmCommand.pm with the code like:

	BEGIN { open(FVWMCOMMAND, "| FvwmCommand -c") || die; }
	END { close(FVWMCOMMAND); }
	sub FvwmCommands (@) { foreach (@_) { print FVWMCOMMAND "$_\n"; } }
	1;

So perl scripts may look like:

	use FvwmCommand;
	FvwmCommands q{
		Current ("My Window", !iconified) Move 10p 20p
		Exec exec xmessage 'Try with the current "FvwmCommand.pm"'
	};
	FvwmCommands "Beep", "All (XTerm) Iconify $toggle", "Beep";

If there are no objections, I can do this.

It is probably worth to use -S to open a separate FvwmCommandS for every
script, but FvwmCommandS should support aliases to do it correctly (so it
can be stopped independantly of FvwmCommandS's for other scripts).

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Sat, 24 Mar 2001 16:58:14 +0100

> It might make navigating and reading the source code easier too.

Done.

Bye

Dominik ^_^  ^_^