Subject: Re: PATCH: if-elsif-else-endif syntax (v2.0)

From: Uwe Pross <[email-masked]>
Date: Tue, 1 Feb 2005 12:41:25 +0100

Hi there,

On 29 Jan 2005 at 14:26:03 +1100, Scott Smedley wrote:

> Further examples are available at:
> 
> http://users.tpg.com.au/users/scottie7/tmp/config.if
> 
> ...
> 
> Any comments/criticism most welcome.

Sorry Scott for the delay. A couple of days ago I had some
problems accessing http://users.tpg.com.au. 

IMO the syntax and usage is quite intuitive. Sure one could
do most statements using piperead but if-then-else is to
me much more readable and self-explanatory.

I would mostly use it for statemente like

AddToMenu my_menu
if ! ShellCmd /opt/myprogram 
+ "My Program menu" Menu my_program_menu
endif

This should be possible.?

Cheers, Uwe
-- 
  ,_,   For personal reply/mail put "fvwm"
 (O,O)  in the subject.
 (   )  Otherwise your mail is discarded by a filter.
=-"-"-= http://www.tu-chemnitz.de/~uwp
--
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: Scott Smedley <[email-masked]>
Date: Wed, 2 Feb 2005 02:00:12 +1100

Hi Uwe, :)

> This should be possible.?

Yup, it works no problem.

SCoTT. :)

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 2 Feb 2005 18:42:19 +0000

> This should be possible.?

Well, strictly speaking. you may already do this intuitively:

  AddToMenu my_menu
  Test (x myprogram) + "My Program menu" Menu my_program_menu

Similarly, you may already implement any need for if-else using TestRc.
But I do agree that in the general case, the real if-else-elsif-endif
syntax is a better (more intuitive) attempt at scripting than TestRc,
functions and Break.

Well, this new syntax is very similar to the one suggested in the thread:
  http://www.hpc.uh.edu/fvwm/archive/0108/msg00044.html
At that time the short construct made sence, now it is already possible.

This patch seems to be good and complete overall. It may be applied later
(probably after 2.6.0, if we want to ever release it).

Regards,
Mikhael.

---

From: Rafal Bisingier <[email-masked]>
Date: Wed, 2 Feb 2005 23:59:05 +0100

> (probably after 2.6.0, if we want to ever release it).

Some time ago (strictly speeking on 4 october 2004 ;-) I've sent here a
small patch which can do similar things, but with additional help of
PipeRead (so no ShellCmd). My patch doesn't provide so much fexibility
as the if-else-elsif-endif syntax, but has one big advantage: it's
completly transparent for users, that don't want to use it. Virtualy no
change in any config should be needed, for fvwm with my patch applied.
My patch simply adds a new Test option named Compare for comparing two
values. That's why PipeRead is still needed - you have to set the values
to compare.

Details could be found in the archive:
http://www.hpc.uh.edu/fvwm/archive/0410/msg00033.html

I'd really like to see this patch merged into main tree before 2.6.0,
but I don't have much hope... ;-)
Of course if-else-elsif-endif syntax would be even nicer to have,
but I agree that this can wait till 2.6.0 (together with extended
conditionals: Name/IconName/Class/Resource/AnyName :-( )

PS. As usual sorry for my english.

-- 
Rafal Bisingier