[m-rev.] for review: new mdb command all_procedures
Ian MacLarty
maclarty at cs.mu.OZ.AU
Wed Dec 8 20:38:24 AEDT 2004
On Wed, Dec 08, 2004 at 04:12:32PM +1100, Zoltan Somogyi wrote:
> Add an mdb command, all_procedures, for listing all the procedures in the
> program. It has two options: -u or --uci for listing unify, compare, index and
> init predicates, and -s or --separate for printing the various parts of
> procedure names in separate fields, for automatic processing (e.g. by awk
> scripts).
>
> Index: doc/user_guide.texi
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
> retrieving revision 1.398
> diff -u -b -r1.398 user_guide.texi
> --- doc/user_guide.texi 19 Nov 2004 11:54:21 -0000 1.398
> +++ doc/user_guide.texi 6 Dec 2004 13:48:10 -0000
> @@ -3538,6 +3538,19 @@
> @sp 1
> If the option @samp{-i} or @samp{--print-instance} option is given,
Remove one "option".
> it also lists all the instances of each type class.
> + at sp 1
> + at item all_procedures [-su] @var{filename}
> + at kindex all_procedures (mdb command)
> +Puts a list of all the debuggable procedures in the program
> +into the named file.
> + at sp 1
> +If the option @samp{-s} or @samp{--separate} option is given,
And here.
> +the various components of procedure names are separated by spaces.
> + at sp 1
> +If the option @samp{-u} or @samp{--uci} option is given,
And here.
> @@ -1310,8 +1325,12 @@
> }
>
> if (print_mode) {
> + if (separate) {
> + fprintf(fp, " %ld", (long) uci->MR_uci_mode);
> + } else {
> fprintf(fp, "-%ld", (long) uci->MR_uci_mode);
> }
The above two lines should be indented.
> + }
>
> if (strcmp(uci->MR_uci_type_module,
> uci->MR_uci_def_module) != 0)
> @@ -1329,19 +1348,32 @@
> MR_fatal_error("procedure is not pred or func");
> }
>
> - if (spec) {
> + if (separate) {
> + fprintf(fp, " ");
> + } else if (spec) {
> fprintf(fp, "*");
> } else {
> fprintf(fp, " ");
> }
>
> + if (separate) {
> + fprintf(fp, "%s %s %ld",
> + user->MR_user_decl_module,
> + user->MR_user_name,
> + (long) MR_sle_user_adjusted_arity(entry));
> + } else {
> fprintf(fp, "%s.%s/%ld",
> user->MR_user_decl_module,
> user->MR_user_name,
> (long) MR_sle_user_adjusted_arity(entry));
> + }
Indent the else part.
>
> if (print_mode) {
> + if (separate) {
> + fprintf(fp, " %ld", (long) user->MR_user_mode);
> + } else {
> fprintf(fp, "-%ld", (long) user->MR_user_mode);
> + }
Indent the else part.
> Index: tests/debugger/Mercury.options
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/tests/debugger/Mercury.options,v
> retrieving revision 1.9
> diff -u -b -r1.9 Mercury.options
> --- tests/debugger/Mercury.options 6 Dec 2004 01:32:47 -0000 1.9
> +++ tests/debugger/Mercury.options 8 Dec 2004 02:19:32 -0000
> @@ -36,6 +36,11 @@
> # asm_fast.gc.debug.tr.
> MCFLAGS-uci_index = --compare-specialization 2 --intermodule-optimization
>
> +# Solver_test exercises the printing of a procedure name, and that procedure
I would say s/Solver_test/solver_test.
> Index: trace/mercury_trace_tables.c
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_tables.c,v
> retrieving revision 1.30
> diff -u -b -r1.30 mercury_trace_tables.c
> --- trace/mercury_trace_tables.c 20 Sep 2004 04:50:26 -0000 1.30
> +++ trace/mercury_trace_tables.c 6 Dec 2004 03:52:52 -0000
> @@ -271,17 +271,25 @@
> }
>
> void
> -MR_dump_module_tables(FILE *fp)
> +MR_dump_module_tables(FILE *fp, MR_bool separate, MR_bool uci)
> {
> int i, j;
> + const char *module_name;
> + const MR_Proc_Layout *proc;
>
> for (i = 0; i < MR_module_info_next; i++) {
> - fprintf(fp, "====================\n");
> - fprintf(fp, "module %s\n", MR_module_infos[i]->MR_ml_name);
> - fprintf(fp, "====================\n");
> + module_name = MR_module_infos[i]->MR_ml_name;
`module_name' doesn't seem to get used by anything. How is the module heading now
printed?
> for (j = 0; j < MR_module_infos[i]->MR_ml_proc_count; j++) {
> - MR_print_proc_id_and_nl(fp,
> - MR_module_infos[i]->MR_ml_procs[j]);
> + proc = MR_module_infos[i]->MR_ml_procs[j];
> + if (uci || !MR_PROC_LAYOUT_IS_UCI(proc)) {
> + if (separate) {
> + MR_print_proc_separate(fp, proc);
> + } else {
> + MR_print_proc_id(fp, proc);
> + }
> +
> + fprintf(fp, "\n");
> + }
> }
> }
> }
Otherwise that looks fine.
Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list