On Wed, Aug 08, 2001 at 12:27:18AM +0700, Dmitry Yu. Bolkhovityanov wrote: Content-Description: Mail message body > Hi! > > I've made a patch which implements a simple "if-else" syntax. > > A new "Otherwise" command is introduced (wouldn't clash with possible > future syntax enhancements, right?), which executes supplied command only if > previous command was unsuccessful. So the syntax is: > > AddToFunc "Do-this-or-that" > + "I" Next (SomeProggie) Close > + "I" Otherwise SomeProggie > > (this implements Dominik's example of "if some window exists, kill it, > otherwise start it"). > > Each command may return a True/False value, which defaults to "True". > This logic is implemented in execute_complex_function(), which sets the > "current return value" to True before calling a command. There's no change > in command calling conventions, since "return value of this command" and > "return value of previous command" are global variables (sic!). Changed are > only conditional commands, which set return value to False when > unsuccessful. I also investigated if it would be possible to place these > two vars into exec_func_args_type, but those structs aren't passed between > *execute*function(). > > Since return values are stored in global vars, > execute_complex_function() saves previous state and restores it on exit. > Unfortunately, it contained a number of returns, which had to be replaced > with "goto END_OF_FUNCTION" (I wish C had Ada/Perl "break from a block" > feature...). > > Of course, calling "Otherwise" outside a complex function is senseless. > > Man page modification isn't included.
Is it really necessary to pass function return codes through global variables? If we do this now we will regret it some day. Bye Dominik ^_^ ^_^ -- Dominik Vogt, email: [EMAIL PROTECTED] LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20 -- 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 PROTECTED] To report problems, send mail to [EMAIL PROTECTED]