[m-rev.] for review:
Zoltan Somogyi
zs at cs.mu.OZ.AU
Tue Jan 20 13:52:45 AEDT 2004
On 13-Jan-2004, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> In the case of ambiguity, why not keep a list of all the matching module
> layout pointers? It may be possible to resolve the ambiguity later,
> when a module name is used. In particular, it should be possible for
> MR_process_matching_procedures() to iterate through all the matching
> module names.
I have done as you asked. The diff with the updated code and expanded
test case follows. I will commit it as soon as I have the new contents
of the .exp2 file.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing analysis
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/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
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/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
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 samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/breakpoints.a.m
===================================================================
RCS file: tests/debugger/breakpoints.a.m
diff -N tests/debugger/breakpoints.a.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/breakpoints.a.m 20 Jan 2004 02:28:29 -0000
@@ -0,0 +1,6 @@
+:- module breakpoints__a.
+
+:- interface.
+
+:- include_module breakpoints__a__testmod.
+:- import_module breakpoints__a__testmod.
Index: tests/debugger/breakpoints.a.testmod.m
===================================================================
RCS file: tests/debugger/breakpoints.a.testmod.m
diff -N tests/debugger/breakpoints.a.testmod.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/breakpoints.a.testmod.m 20 Jan 2004 02:30:25 -0000
@@ -0,0 +1,11 @@
+:- module breakpoints__a__testmod.
+
+:- interface.
+
+:- func test_in_a = string.
+:- func test_in_ab = string.
+
+:- implementation.
+
+test_in_a = "a".
+test_in_ab = "ab".
Index: tests/debugger/breakpoints.b.m
===================================================================
RCS file: tests/debugger/breakpoints.b.m
diff -N tests/debugger/breakpoints.b.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/breakpoints.b.m 20 Jan 2004 02:28:49 -0000
@@ -0,0 +1,6 @@
+:- module breakpoints__b.
+
+:- interface.
+
+:- include_module breakpoints__b__testmod.
+:- import_module breakpoints__b__testmod.
Index: tests/debugger/breakpoints.b.testmod.m
===================================================================
RCS file: tests/debugger/breakpoints.b.testmod.m
diff -N tests/debugger/breakpoints.b.testmod.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/breakpoints.b.testmod.m 20 Jan 2004 02:30:49 -0000
@@ -0,0 +1,11 @@
+:- module breakpoints__b__testmod.
+
+:- interface.
+
+:- func test_in_b = string.
+:- func test_in_ab = string.
+
+:- implementation.
+
+test_in_b = "b".
+test_in_ab = "ab".
Index: tests/debugger/breakpoints.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/breakpoints.exp,v
retrieving revision 1.9
diff -u -b -r1.9 breakpoints.exp
--- tests/debugger/breakpoints.exp 17 Jan 2003 05:56:51 -0000 1.9
+++ tests/debugger/breakpoints.exp 20 Jan 2004 02:47:22 -0000
@@ -1,4 +1,4 @@
- E1: C1 1 CALL pred breakpoints.main/2-0 (cc_multi) breakpoints.m:17
+ E1: C1 1 CALL pred breakpoints.main/2-0 (cc_multi) breakpoints.m:31
mdb> echo on
Command echo enabled.
mdb> register --quiet
@@ -22,7 +22,7 @@
Which do you want to put a breakpoint on (0-1 or *)? 0
0: + stop interface pred breakpoints.data/1-0 (det)
mdb> continue
- E2: C2 3 CALL pred breakpoints.data/1-0 (det) breakpoints.m:44 (breakpoints.m:42)
+ E2: C2 3 CALL pred breakpoints.data/1-0 (det) breakpoints.m:58 (breakpoints.m:56)
mdb> disable 0
0: - stop interface pred breakpoints.data/1-0 (det)
mdb> break info
@@ -91,21 +91,21 @@
mdb> break nodiag
0: + stop interface pred breakpoints.nodiag/3-0 (semidet)
mdb> continue
- E3: C3 3 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:50 (breakpoints.m:47)
+ E3: C3 3 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:61)
mdb> continue
- E4: C3 3 SWTC pred breakpoints.qperm/2-0 (nondet) s2; breakpoints.m:51
+ E4: C3 3 SWTC pred breakpoints.qperm/2-0 (nondet) s2; breakpoints.m:65
mdb> finish -N
- E5: C4 4 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:50 (breakpoints.m:54)
+ E5: C4 4 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
mdb> finish -n
- E6: C4 4 EXIT pred breakpoints.qperm/2-0 (nondet) breakpoints.m:50 (breakpoints.m:54)
+ E6: C4 4 EXIT pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
mdb> continue
- E7: C3 3 EXIT pred breakpoints.qperm/2-0 (nondet) breakpoints.m:50 (breakpoints.m:47)
+ E7: C3 3 EXIT pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:61)
mdb> continue
- E8: C5 3 CALL pred breakpoints.safe/1-0 (semidet) breakpoints.m:60 (breakpoints.m:48)
+ E8: C5 3 CALL pred breakpoints.safe/1-0 (semidet) breakpoints.m:74 (breakpoints.m:62)
mdb> finish
- E9: C6 4 CALL pred breakpoints.nodiag/3-0 (semidet) breakpoints.m:65 (breakpoints.m:62)
- E10: C6 4 FAIL pred breakpoints.nodiag/3-0 (semidet) breakpoints.m:65 (breakpoints.m:62)
- E11: C5 3 FAIL pred breakpoints.safe/1-0 (semidet) breakpoints.m:60 (breakpoints.m:48)
+ E9: C6 4 CALL pred breakpoints.nodiag/3-0 (semidet) breakpoints.m:79 (breakpoints.m:76)
+ E10: C6 4 FAIL pred breakpoints.nodiag/3-0 (semidet) breakpoints.m:79 (breakpoints.m:76)
+ E11: C5 3 FAIL pred breakpoints.safe/1-0 (semidet) breakpoints.m:74 (breakpoints.m:62)
mdb> delete *
0: E stop interface pred breakpoints.nodiag/3-0 (semidet)
1: E stop interface pred breakpoints.qperm/2-0 (nondet)
@@ -127,17 +127,58 @@
0: + stop interface pred breakpoints.qperm/2-0 (nondet)
(ignore next 3 interface events)
mdb> continue
- E12: C7 6 REDO pred breakpoints.qperm/2-0 (nondet) breakpoints.m:50 (breakpoints.m:54)
+ E12: C7 6 REDO pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
mdb> print *
HeadVar__1 [4, 5]
mdb> ignore -E4 0
0: + stop interface pred breakpoints.qperm/2-0 (nondet)
(ignore next 4 call events)
mdb> continue
- E13: C8 8 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:50 (breakpoints.m:54)
+ E13: C8 8 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
mdb> print *
HeadVar__1 []
mdb> delete *
0: E stop interface pred breakpoints.qperm/2-0 (nondet)
+mdb> break -O test_in_both
+Ambiguous procedure specification. The matches are:
+0: pred breakpoints.test_in_both/2-0 (det)
+1: pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> break breakpoints.test_in_both
+ 0: + stop interface pred breakpoints.test_in_both/2-0 (det)
+mdb> break breakpoints.print_list.test_in_both
+ 1: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> delete *
+ 0: E stop interface pred breakpoints.test_in_both/2-0 (det)
+ 1: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> break print_list.test_in_both
+ 0: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> break print_list.test_only_in_printlist
+ 1: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> delete *
+ 0: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+ 1: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> break test_only_in_printlist
+ 0: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> delete *
+ 0: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> procedures testmod
+Module name `testmod' is ambiguous.
+The matches are:
+breakpoints.a.testmod
+breakpoints.b.testmod
+mdb> break -O test_in_ab
+Ambiguous procedure specification. The matches are:
+0: func breakpoints.a.testmod.test_in_ab/0-0 (det)
+1: func breakpoints.b.testmod.test_in_ab/0-0 (det)
+mdb> break -O testmod.test_in_ab
+Ambiguous procedure specification. The matches are:
+0: func breakpoints.a.testmod.test_in_ab/0-0 (det)
+1: func breakpoints.b.testmod.test_in_ab/0-0 (det)
+mdb> break -O a.testmod.test_in_ab
+ 0: + stop interface func breakpoints.a.testmod.test_in_ab/0-0 (det)
+mdb> break -O b.testmod.test_in_ab
+ 1: + stop interface func breakpoints.b.testmod.test_in_ab/0-0 (det)
mdb> continue
[1, 3, 5, 2, 4]
+"a"
+"b"
Index: tests/debugger/breakpoints.exp2
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/breakpoints.exp2,v
retrieving revision 1.5
diff -u -b -r1.5 breakpoints.exp2
--- tests/debugger/breakpoints.exp2 17 Jan 2003 05:56:51 -0000 1.5
+++ tests/debugger/breakpoints.exp2 12 Jan 2004 16:03:39 -0000
@@ -147,5 +147,27 @@
HeadVar__1 []
mdb> delete *
0: E stop interface pred breakpoints.qperm/2-0 (nondet)
+mdb> break -O test_in_both
+Ambiguous procedure specification. The matches are:
+0: pred breakpoints.test_in_both/2-0 (det)
+1: pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> break breakpoints.test_in_both
+ 0: + stop interface pred breakpoints.test_in_both/2-0 (det)
+mdb> break breakpoints.print_list.test_in_both
+ 1: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> delete *
+ 0: E stop interface pred breakpoints.test_in_both/2-0 (det)
+ 1: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> break print_list.test_in_both
+ 0: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> break print_list.test_only_in_printlist
+ 1: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> delete *
+ 0: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+ 1: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> break test_only_in_printlist
+ 0: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> delete *
+ 0: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> continue
[1, 3, 5, 2, 4]
Index: tests/debugger/breakpoints.inp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/breakpoints.inp,v
retrieving revision 1.5
diff -u -b -r1.5 breakpoints.inp
--- tests/debugger/breakpoints.inp 17 Jan 2003 05:56:51 -0000 1.5
+++ tests/debugger/breakpoints.inp 20 Jan 2004 02:47:08 -0000
@@ -44,4 +44,18 @@
continue
print *
delete *
+break -O test_in_both
+break breakpoints.test_in_both
+break breakpoints.print_list.test_in_both
+delete *
+break print_list.test_in_both
+break print_list.test_only_in_printlist
+delete *
+break test_only_in_printlist
+delete *
+procedures testmod
+break -O test_in_ab
+break -O testmod.test_in_ab
+break -O a.testmod.test_in_ab
+break -O b.testmod.test_in_ab
continue
Index: tests/debugger/breakpoints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/breakpoints.m,v
retrieving revision 1.4
diff -u -b -r1.4 breakpoints.m
--- tests/debugger/breakpoints.m 26 May 2003 09:00:51 -0000 1.4
+++ tests/debugger/breakpoints.m 20 Jan 2004 02:45:16 -0000
@@ -7,13 +7,27 @@
:- pred main(io__state, io__state).
:- mode main(di, uo) is cc_multi.
:- func string / string = string.
+
:- implementation.
+
:- include_module breakpoints__print_list.
-:- import_module list, int, string, breakpoints__print_list.
+:- include_module breakpoints__a.
+:- include_module breakpoints__b.
+:- import_module breakpoints__print_list.
+:- import_module breakpoints__a.
+:- import_module breakpoints__b.
+:- import_module breakpoints__a__testmod.
+:- import_module breakpoints__b__testmod.
+
+:- import_module list, int, string.
main -->
( { queen(data, Out) } ->
- print_list(Out)
+ print_list(Out),
+ io__write(test_in_a),
+ io__nl,
+ io__write(test_in_b),
+ io__nl
;
io__write_string("No solution\n")
).
@@ -77,3 +91,8 @@
nodiag(B, D1, L).
X / _ = X.
+
+:- pred test_in_both(io::di, io::uo) is det.
+
+test_in_both(!IO) :-
+ io__write_string("test_in_both in breakpoints\n", !IO).
Index: tests/debugger/breakpoints.print_list.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/breakpoints.print_list.m,v
retrieving revision 1.1
diff -u -b -r1.1 breakpoints.print_list.m
--- tests/debugger/breakpoints.print_list.m 11 Feb 2002 12:52:54 -0000 1.1
+++ tests/debugger/breakpoints.print_list.m 9 Jan 2004 14:52:56 -0000
@@ -10,6 +10,10 @@
:- func string / string = string.
:- func string - string = string.
+:- pred test_only_in_printlist(io__state::di, io__state::uo) is det.
+
+:- pred test_in_both(io__state::di, io__state::uo) is det.
+
:- implementation.
print_list(Xs) -->
@@ -40,3 +44,9 @@
Str1 / Str2 = Str1 ++ "/" ++ Str2.
Str1 - Str2 = Str1 ++ "-" ++ Str2.
+
+test_only_in_printlist(!IO) :-
+ io__write_string("test_only_in_printlist\n", !IO).
+
+test_in_both(!IO) :-
+ io__write_string("test_in_both\n", !IO).
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/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
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_tables.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_tables.c,v
retrieving revision 1.24
diff -u -b -r1.24 mercury_trace_tables.c
--- trace/mercury_trace_tables.c 26 Feb 2003 08:55:59 -0000 1.24
+++ trace/mercury_trace_tables.c 20 Jan 2004 00:43:15 -0000
@@ -15,6 +15,7 @@
#include "mercury_label.h"
#include "mercury_array_macros.h"
#include "mercury_stack_trace.h"
+#include "mercury_dlist.h"
#include "mercury_trace_tables.h"
#include "mercury_trace_internal.h"
@@ -24,18 +25,41 @@
#include <string.h>
#include <ctype.h>
+/*
+** We record module layout structures in two tables. The MR_module_infos
+** array contains one pointer to every module layout structure, and is ordered
+** by the fully qualified module name. The MR_module_nickname array contains
+** one reference to every module layout structure by every one of the module's
+** (zero or more) less-than-fully-qualified names (which we call `nickname'
+** here), ordered by the nickname.
+*/
+
+typedef struct {
+ const char *MR_nick_name;
+ MR_Dlist *MR_nick_layouts;
+ /* the list entries are MR_Module_Layouts */
+} MR_Module_Nick;
+
static const MR_Module_Layout **MR_module_infos;
static int MR_module_info_next = 0;
static int MR_module_info_max = 0;
+
+static MR_Module_Nick *MR_module_nicks;
+static int MR_module_nick_next = 0;
+static int MR_module_nick_max = 0;
+
static int MR_module_info_proc_count = 0;
#define INIT_MODULE_TABLE_SIZE 10
-static const MR_Module_Layout *MR_search_module_info(const char *name);
-static void MR_insert_module_info(const MR_Module_Layout *);
+static const MR_Module_Layout
+ *MR_search_module_info_by_name(const char *name);
+static MR_Dlist
+ *MR_search_module_info_by_nickname(const char *name);
+static void MR_insert_module_info(const MR_Module_Layout *module);
static void MR_process_matching_procedures_in_module(
const MR_Module_Layout *module, MR_Proc_Spec *spec,
- void f(void *, const MR_Proc_Layout *), void *);
+ void f(void *, const MR_Proc_Layout *), void *data);
static void MR_process_line_layouts(const MR_Module_File_Layout
*file_layout, int line,
MR_file_line_callback callback_func, int callback_arg);
@@ -125,13 +149,13 @@
** already exists in the table is really only for paranoia.
*/
- if (MR_search_module_info(module->MR_ml_name) == NULL) {
+ if (MR_search_module_info_by_name(module->MR_ml_name) == NULL) {
MR_insert_module_info(module);
}
}
static const MR_Module_Layout *
-MR_search_module_info(const char *name)
+MR_search_module_info_by_name(const char *name)
{
int slot;
MR_bool found;
@@ -145,10 +169,27 @@
}
}
+static MR_Dlist *
+MR_search_module_info_by_nickname(const char *name)
+{
+ int slot;
+ MR_bool found;
+
+ MR_bsearch(MR_module_nick_next, slot, found,
+ strcmp(MR_module_nicks[slot].MR_nick_name, name));
+ if (found) {
+ return MR_module_nicks[slot].MR_nick_layouts;
+ } else {
+ return NULL;
+ }
+}
+
static void
MR_insert_module_info(const MR_Module_Layout *module)
{
int slot;
+ MR_bool found;
+ const char *nickname;
MR_ensure_room_for_next(MR_module_info, const MR_Module_Layout *,
INIT_MODULE_TABLE_SIZE);
@@ -158,6 +199,32 @@
MR_module_infos[slot] = module;
MR_module_info_proc_count += module->MR_ml_proc_count;
+
+ nickname = strchr(module->MR_ml_name, '.');
+ while (nickname != NULL) {
+ nickname++; /* step over the '.' */
+ MR_bsearch(MR_module_nick_next, slot, found,
+ strcmp(MR_module_nicks[slot].MR_nick_name, nickname));
+ if (found) {
+ MR_module_nicks[slot].MR_nick_layouts =
+ MR_dlist_addtail(
+ MR_module_nicks[slot].MR_nick_layouts,
+ module);
+ } else {
+ MR_ensure_room_for_next(MR_module_nick,
+ MR_Module_Nick, INIT_MODULE_TABLE_SIZE);
+ MR_prepare_insert_into_sorted(MR_module_nicks,
+ MR_module_nick_next,
+ slot,
+ strcmp(MR_module_nicks[slot].MR_nick_name,
+ nickname));
+ MR_module_nicks[slot].MR_nick_name = nickname;
+ MR_module_nicks[slot].MR_nick_layouts =
+ MR_dlist_makelist(module);
+ }
+
+ nickname = strchr(nickname, '.');
+ }
}
void
@@ -243,17 +310,30 @@
MR_dump_module_procs(FILE *fp, const char *name)
{
const MR_Module_Layout *module;
+ const MR_Dlist *modules;
+ const MR_Dlist *element_ptr;
int j;
- module = MR_search_module_info(name);
- if (module == NULL) {
- fprintf(fp, "There is no debugging info about module `%s'\n",
- name);
- } else {
+ module = MR_search_module_info_by_name(name);
+ if (module != NULL) {
fprintf(fp, "List of procedures in module `%s'\n\n", name);
for (j = 0; j < module->MR_ml_proc_count; j++) {
MR_print_proc_id_and_nl(fp, module->MR_ml_procs[j]);
}
+ } else {
+ modules = MR_search_module_info_by_nickname(name);
+ if (modules == NULL) {
+ fprintf(fp, "There is no debugging info "
+ "about module `%s'\n", name);
+ } else {
+ fprintf(fp, "Module name `%s' is ambiguous.\n", name);
+ fprintf(fp, "The matches are:\n");
+ MR_for_dlist (element_ptr, modules) {
+ module = (const MR_Module_Layout *)
+ MR_dlist_data(element_ptr);
+ fprintf(fp, "%s\n", module->MR_ml_name);
+ }
+ }
}
}
@@ -480,10 +560,22 @@
if (spec->MR_proc_module != NULL) {
const MR_Module_Layout *module;
- module = MR_search_module_info(spec->MR_proc_module);
+ module = MR_search_module_info_by_name(spec->MR_proc_module);
if (module != NULL) {
MR_process_matching_procedures_in_module(
module, spec, f, data);
+ } else {
+ const MR_Dlist *modules;
+ const MR_Dlist *element_ptr;
+
+ modules = MR_search_module_info_by_nickname(
+ spec->MR_proc_module);
+ MR_for_dlist (element_ptr, modules) {
+ module = (const MR_Module_Layout *)
+ MR_dlist_data(element_ptr);
+ MR_process_matching_procedures_in_module(
+ module, spec, f, data);
+ }
}
} else {
int i;
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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