[m-dev.] for review: generating traces

Fergus Henderson fjh at cs.mu.oz.au
Fri Oct 3 12:46:37 AEST 1997


Zoltan Somogyi, you wrote:
> 
> % This module handles the generation of traces for the trace analysis system.

It might be good to add a comment explaining what a trace analysis system
is, e.g. perhaps a reference to some appropriate paper about the Opium
system.

> void	MR_trace(MR_trace_port port, MR_trace_code_model model,
> 	int seqno, int depth, const char *modulename, const char *predname,
> 	int arity,
> 	int modenum)
> {

Can you please indent this according to our C coding guidelines,
i.e. the return type should be on a line of its own.

> 	for (i = 0; i < depth; i++)
> 		putc(' ', stderr);

Please use curlies.

> 	switch (port)
> 	{
> case MR_PORT_CALL:	fprintf(stderr, "CALL ");
> 			break;
> 
> case MR_PORT_EXIT:	fprintf(stderr, "EXIT ");
> 			break;
> 
> case MR_PORT_FAIL:	fprintf(stderr, "FAIL ");
> 			break;
> 	}

Please don't outdent the case labels.
Put them intended, on their own line.

> 	switch (model)
> 	{
> case MR_MODEL_DET:	fprintf(stderr, "DET  ");
> 			break;
> 
> case MR_MODEL_SEMI:	fprintf(stderr, "SEMI ");
> 			break;
> 
> case MR_MODEL_NON:	fprintf(stderr, "NON  ");
> 			break;
> 	}

Ditto.

> #define	MR_trace_incr_seq()	++MR_trace_call_seqno
> #define	MR_trace_incr_depth()	++MR_trace_call_depth
> #define	MR_trace_reset_depth(d)	MR_trace_call_depth = d

Please put the macro bodies in parentheses.

> extern	void	MR_trace(
> 	MR_trace_port,
> 	MR_trace_code_model,
> 	int,			/* call sequence number */
> 	int,			/* call depth */
> 	const char *,		/* module name */
> 	const char *,		/* predicate name */
> 	int,			/* predicate arity */
> 	int);			/* mode number within predicate */
> 
> #endif

That #endif is a long way removed from the #if, so a comment

	#endif /* <what #if is being ended> */

would be a good idea.

Otherwise that diff looks good, so please commit it after making those changes.

-- 
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.



More information about the developers mailing list