[mercury-users] nondet pragma c_code (LOCALS)

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Nov 30 07:32:58 AEDT 1999


On 29-Nov-1999, Robert Bossy <bossy at ccr.jussieu.fr> wrote:
> Some local_vars I use actually point to dynamically allocated memory but,
> unfortunately, I won't be able to use GC_MALLOC since those variables are handled
> by functions provided in an API.

In that case, you may want to consider the approach of redefining
malloc() and friends to call GC_MALLOC().  As mentioned, this is not
quite as portable, but it does make things a lot simpler.  For an
example of how to do this, see the code at the end of mtcltk.m in the
graphics/mercury_tcltk directory in the mercury-extras distribution.

> Just a little detail:
> 
> >         (1) if the nondet C procedure fails,
> >             which it can do by returning with SUCCESS_INDICATOR = FAIL;
> >
> >         (2) if the nondet C procedure succeeds and indicates
> >             that this is the last solution, which it can do by
> >             returning with SUCCESS_INDICATOR = SUCCEED_LAST;
> 
> Isn't it just FAIL instead SUCCESS_INDICATOR = FAIL , like the reference manual
> mentions (sampes in section Nondet pragma c_code)?

Yes, you're absolutely right.
Likewise for SUCCEED_LAST.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list