Hi, 2011/11/14 Glynn Clements <[email protected]>: > Except .. that's going to need some support, as you can't use setjmp() > directly from Python (the jmp_buf becomes invalid once you return from > the function which "called" setjmp()). We would need something like: > > static jmp_buf jbuf; > > static void the_handler(void *unused) > { > longjmp(jbuf, 1); > } > > void *G_safe_execute(void *(*func)(void *), void *closure) > { > G_add_error_handler(the_handler, NULL); > if (setjmp(jbuf) == 0) { > G_remove_error_handler(the_handler, NULL); > return (*func)(closure); > } > else { > G_remove_error_handler(the_handler, NULL); > return NULL; > } > }
this could be useful addition to gislib library. +1 to add G-safe_execute() to gislib. Thanks, Martin -- Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa _______________________________________________ grass-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-dev
