[m-dev.] For review: calling MR_collect_filter() in MR_trace_real()

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Mar 6 20:14:59 AEDT 2001


On 06-Mar-2001, Erwan Jahier <Erwan.Jahier at irisa.fr> wrote:
> +++ trace/mercury_trace.c	2001/03/06 08:53:01
> @@ -57,7 +57,8 @@
>  	0,	/* stop event */
>  	MR_PRINT_LEVEL_SOME,
>  	FALSE,	/* not strict */
> -	TRUE	/* must check */
> +	TRUE,	/* must check */
> +	NULL
>  };

It would be nice to comment what the NULL is for.

> Index: trace/mercury_trace.h
> @@ -202,6 +207,12 @@
>  				** MR_trace_print_level != MR_PRINT_LEVEL_NONE
>  				*/
>  	bool			MR_trace_must_check;
> +
> +				/*
> +				** The MR_filter_ptr field points to the filter/4
> +				** procedure during a collect request
> +				*/
> +	void *    		MR_filter_ptr;
>  } MR_Trace_Cmd_Info;

`void *' is a data pointer, but MR_filter_ptr should be a code pointer.
On some systems (e.g. 8086), these need not be the same size.

It would be better to use the full function pointer type here, or even better
to define a typedef in this file

	typedef void (*MR_FilterFuncPtr)(MR_Integer, MR_Integer,
					MR_Integer, MR_Word, MR_Word,
					MR_String, MR_String, MR_String,
					MR_Integer, MR_Integer, MR_Word,
					MR_Integer, MR_String, MR_Word,
					MR_Word *, MR_Char *);

and then use MR_FilterFuncPtr both here and in mercury_trace_external.c.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list