On Wed, Aug 08, 2001 at 08:14:01PM +0700, Dmitry Yu. Bolkhovityanov wrote:
> On Wed, 8 Aug 2001, Dominik Vogt wrote:
> 
> > Is it really necessary to pass function return codes through
> > global variables?  If we do this now we will regret it some day.
> 
>       That's just a logical consequence of current CMD_fff calling
> convention.  I really investigated if globals can be avoided, but there is
> *no* per-call structure to hold the return value.

That's why I wanted avoid function return codes.  Every "return"
in each "CMD_..." function would have to be touched.

>       And yes, there is an obvious case when this solution would break
> -- if someday fvwm will allow concurrent execution of functions (AFAIK,
> currently it does so in an "interrupt" fashion, so that saving/restoring 
> the state in execute_complex_function() is enough).

What do you mean with "if someday"?  Fvwm already supports
asynchronous execution, e.g. when modules send commands.

Anyway, there is a fairly simple solution to save the patch:  add
another parameter to the macros in fvwm.h:

  #define F_CMD_ARGS XEvent *eventp, Window w, FvwmWindow *tmp_win, unsigned 
long context,char *action, int *Module, Bool *ret_rc
  #define F_PASS_ARGS eventp, w, tmp_win, context, action, Module, ret_rc
  #define F_EXEC_ARGS char *action, FvwmWindow *tmp_win, XEvent *eventp, 
unsigned long context, int Module, Bool *ret_rc
  #define F_PASS_EXEC_ARGS action, tmp_win, eventp, context, *Module, ret_rc

(sorry for the long lines).

The *ret_rc would be pre-initialised with "True" just like the
globals in the patch.  Only conditional commands ever set it to
False.  Now, only the few direct calls of CMD_... functions that
do not pass the arguments via one of the macros have to be
modified.  This would be good enough for me.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
--
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]

Reply via email to