On Wed, 18 Nov 2009, Hans-Christoph Steiner wrote:
But in general, I think an object should instantiate regardless of the args so you can get help and having it throw findable errors, i.e. pd_error();
no. instead you should make instantiation errors findable:
------------------8<--------cut-here--------8<------------------ diff -ru pd-0.42-5-orig/src/s_print.c pd-0.42-5/src/s_print.c --- pd-0.42-5-orig/src/s_print.c 2009-11-18 13:49:46.000000000 -0500 +++ pd-0.42-5/src/s_print.c 2009-11-18 13:50:43.000000000 -0500 @@ -132,7 +132,7 @@ offending or offended object around so the user can search for it later. */
-static void *error_object; +void *error_object; static char error_string[256]; void canvas_finderror(void *object);
diff -ru pd-0.42-5-orig/src/g_text.c pd-0.42-5/src/g_text.c --- pd-0.42-5-orig/src/g_text.c 2009-02-04 13:50:13.000000000 -0500 +++ pd-0.42-5/src/g_text.c 2009-11-18 13:52:47.000000000 -0500 @@ -86,6 +86,7 @@ t_binbuf *b) { t_text *x;
@@ -97,7 +98,7 @@ if (!newest) { binbuf_print(b);
post("... couldn't create");
error = 1;
x = 0;
}
else if (!(x = pd_checkobject(newest)))
@@ -111,6 +112,7 @@ { /* LATER make the color reflect this */ x = (t_text *)pd_new(text_class);
if (error) pd_error(x,"... couldn't create");
}
x->te_binbuf = b;
x->te_xpix = xpix;
------------------8<--------cut-here--------8<------------------
it's as simple as that.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801