2009/8/17 Juan Lang juan.lang@gmail.com:
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
Good idea. I'll do it for the next try.