[m-dev.] trivial diff: port names
Zoltan Somogyi
zs at cs.mu.OZ.AU
Fri Oct 15 17:30:40 AEST 1999
Estimated hours taken: 0.3
Use a central array of port names.
runtime/mercury_trace_base.c:
Define the array.
runtime/mercury_trace_base.h:
Export its declaration.
trace/mercury_trace_internal.c:
Use the array instead of a switch statement.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/clpr
cvs diff: Diffing extras/clpr/clpr
cvs diff: Diffing extras/clpr/samples
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing runtime
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.19
diff -u -b -r1.19 mercury_trace_base.c
--- mercury_trace_base.c 1999/10/05 07:26:23 1.19
+++ mercury_trace_base.c 1999/10/10 04:23:12
@@ -102,6 +102,25 @@
#endif
+const char *MR_port_names[] =
+{
+ "CALL",
+ "EXIT",
+ "REDO",
+ "FAIL",
+ "COND",
+ "THEN",
+ "ELSE",
+ "NEGE",
+ "NEGS",
+ "NEGF",
+ "DISJ",
+ "SWTC",
+ "FRST",
+ "LATR",
+ "EXCP",
+};
+
Code *
MR_trace_struct(const MR_Trace_Call_Info *trace_call_info)
{
Index: runtime/mercury_trace_base.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.h,v
retrieving revision 1.9
diff -u -b -r1.9 mercury_trace_base.h
--- mercury_trace_base.h 1999/10/05 07:26:23 1.9
+++ mercury_trace_base.h 1999/10/10 04:22:51
@@ -20,8 +20,9 @@
#include "mercury_std.h"
/*
-** This enum should EXACTLY match the definition of the `trace_port_type' type
-** in browser/debugger_interface.
+** This enum should EXACTLY match the definition of the `trace_port_type'
+** type in browser/debugger_interface, and the port names list in the
+** C source file of this module.
*/
typedef enum {
@@ -41,6 +42,8 @@
MR_PORT_PRAGMA_LATER,
MR_PORT_EXCEPTION
} MR_Trace_Port;
+
+extern const char *MR_port_names[];
#define MR_trace_incr_seq() ((Word) ++MR_trace_call_seqno)
#define MR_trace_incr_depth() ((Word) ++MR_trace_call_depth)
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.52
diff -u -b -r1.52 mercury_trace_internal.c
--- mercury_trace_internal.c 1999/10/07 09:31:38 1.52
+++ mercury_trace_internal.c 1999/10/10 04:23:18
@@ -172,7 +172,6 @@
static void MR_trace_event_print_internal_report(
MR_Event_Info *event_info);
-static void MR_trace_print_port(MR_Trace_Port port);
static bool MR_trace_valid_command(const char *word);
@@ -2192,87 +2191,14 @@
void
MR_trace_event_print_internal_report(MR_Event_Info *event_info)
{
- fprintf(MR_mdb_out, "%8ld: %6ld %2ld ",
+ fprintf(MR_mdb_out, "%8ld: %6ld %2ld %s",
(long) event_info->MR_event_number,
(long) event_info->MR_call_seqno,
- (long) event_info->MR_call_depth);
+ (long) event_info->MR_call_depth,
+ MR_port_names[event_info->MR_trace_port);
- MR_trace_print_port(event_info->MR_trace_port);
MR_print_proc_id(MR_mdb_out, event_info->MR_event_sll->MR_sll_entry,
event_info->MR_event_path, NULL, NULL);
-}
-
-static void
-MR_trace_print_port(MR_Trace_Port port)
-{
- const char *port_name;
- switch (port) {
- case MR_PORT_CALL:
- port_name = "CALL";
- break;
-
- case MR_PORT_EXIT:
- port_name = "EXIT";
- break;
-
- case MR_PORT_REDO:
- port_name = "REDO";
- break;
-
- case MR_PORT_FAIL:
- port_name = "FAIL";
- break;
-
- case MR_PORT_COND:
- port_name = "COND";
- break;
-
- case MR_PORT_THEN:
- port_name = "THEN";
- break;
-
- case MR_PORT_ELSE:
- port_name = "ELSE";
- break;
-
- case MR_PORT_NEG_ENTER:
- port_name = "NEGE";
- break;
-
- case MR_PORT_NEG_SUCCESS:
- port_name = "NEGS";
- break;
-
- case MR_PORT_NEG_FAILURE:
- port_name = "NEGF";
- break;
-
- case MR_PORT_DISJ:
- port_name = "DISJ";
- break;
-
- case MR_PORT_SWITCH:
- port_name = "SWTC";
- break;
-
- case MR_PORT_PRAGMA_FIRST:
- port_name = "FRST";
- break;
-
- case MR_PORT_PRAGMA_LATER:
- port_name = "LATR";
- break;
-
- case MR_PORT_EXCEPTION:
- port_name = "EXCP";
- break;
-
- default:
- port_name = "????";
- fatal_error("MR_trace_event_internal called "
- "with bad port");
- }
- fprintf(MR_mdb_out, "%s ", port_name);
}
typedef struct
cvs diff: Diffing trial
cvs diff: Diffing util
--------------------------------------------------------------------------
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