[13/18] wpp: Add wpp_set_exit_on_error function

Juan Lang juan.lang at gmail.com
Mon Aug 17 14:37:38 CDT 2009


Hi Matteo,

this approach seems pretty inflexible to me:

+/* Whether to exit the app on errors (default: true) */
+extern void wpp_set_exit_on_error( int exit );

@@ -646,7 +654,8 @@ int ppy_error(const char *s, ...)
 	va_start(ap, s);
 	generic_msg(s, "Error", ppy_text, ap);
 	va_end(ap);
-	exit(1);
+	if(pp_status.exit_on_error) exit(1);
+	else pp_status.state = 1;
 	return 1;
 }

It seems as though you might instead have a global error function that
should be called, which defaults to exit().  In fact, that's what
ppy_error seems to be.  So I think you'd want to make ppy_error into a
function pointer, and make the current definition its default value,
or something like that.  I can't imagine that retaining the output to
stderr is all that useful in the context of the D3D9 shader assembler.

You could further split this patch:  this is half of it, setting and
dealing with the exit_on_error flag.  The other half deals with the
current assumption that ppy_error never returns.  You can make
removing that assumption one patch, and this--changing the error
function to something else--a subsequent patch.
--Juan



More information about the wine-devel mailing list