[mercury-users] Making Mercury code conditional on the grade?

Tyson Dowd trd at stimpy.cs.mu.oz.au
Tue Jul 21 14:42:47 AEST 1998


On 21-Jul-1998, Warwick HARVEY <warwick at cs.mu.OZ.AU> wrote:
> Hi,
> 
> I was wondering if there was a convenient way to make Mercury code depend on
> the grade with which it is compiled?  Currently I've just created a new
> predicate, implemented using a pragma c_code, which uses an appropriate
> #ifdef to do the (in this case trivial) piece of work which is conditional.
> 
> Is there a better (or an "approved") way of doing this kind of thing?  (E.g.
> am I ignorant of some feature which makes it easy?)

No.

Grades map to a variety of different #defines, and can map to different
#defines on different architectures.  So it is most likely you want
the code to be conditional on the particular definitions.

If you are writing code that is manipulating the Mercury runtime
system, this is the way it is likely to stay for some time.  If you
are simply interfacing to C code, then there are a number of things
that need to be improved to make the C interface (more) independent
of the runtime system.  I'm going to work on these improvements, so I'm
interested in hearing about problems.

-- 
       Tyson Dowd           # "Bill Gates is a white persian cat and a monocle
                            # away from becoming another James Bond villan."
     trd at cs.mu.oz.au        # "No Mr Bond, I expect you to upgrade."
http://www.cs.mu.oz.au/~trd #                -- Dennis Miller and Terri Branch



More information about the users mailing list