[m-rev.] for review: dumping trace counts

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Sep 25 14:55:44 AEST 2006


On Mon, 25 Sep 2006, Ralph Becket wrote:

>> +#ifdef  MR_EXEC_TRACE
>> +    FILE    *fp;
>> +
>> +    if (MR_trace_count_enabled && MR_trace_func_enabled) {
>> +        fp = fopen(FileName, ""w"");
>> +        if (fp != NULL) {
>> +            MR_trace_write_label_exec_counts(fp, MR_FALSE);
>> +            Result = 0;
>> +            (void) fclose(fp);
>> +        } else {
>> +            Result = 3;
>> +        }
>> +    } else {
>> +        Result = 2;
>> +    }
>> +#else
>> +    Result = 1;
>> +#endif
>> +").
>> +
>> +% Default definition for non-C backends.
>> +dump_trace_counts_to(_, 1, !IO).
>> +
>
> The business of magic numbers in mixed C/Mercury code crops up often
> enough that we really should provide better support for sharing
> constants between Mercury and foreign code.

There was a discussion on mercury-users (developers?) a while back about
this sort of thing.  The simple case, mapping a Mercury enumeration
onto an enumerated constant in the target language (assuming the target
language has something that can act like an enumerated constant) is
pretty straightforward.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list