This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gh_assert?


Hi,

In gh.h there is a declaration for gh_assert that has been commented
out.  Is there any reason?

I'm hacking the SWIG guile stuff together and it's quite useful to be
able to throw errors from a user routine. 

Here's a simple definition that should work:

#define gh_assert(a,b,c) if (a) scm_misc_error("GH",(b),(c))

but I actually use:

static void swig_assert(int cond, char *msg, SCM obj) {
   if (cond) return;
   scm_misc_error("GH",msg,obj);
}
#define gh_assert(c,m,o) swig_assert((c),(m),(o))

This let's me put a break point on swig_assert to help debug.

Cheers,

Clark