[m-dev.] for review: print parts of variables

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Jul 18 13:20:09 AEST 2000


For review by anyone.

Allow users to request the printouts of only parts of variables.
Instead of the old sequence

	browse Varnameornum
	^1^2^3^4
	p
	^D

users can now just a single command: print Varnameornum^1^2^3^4, or print
Varnameornum/1/2/3/4. The required component is given by a sequence of
argument numbers, separated by ^s or /s.

(This syntax should eventually be extended to support the use of field names
instead of argument numbers. However, implementation of this extension will
need to wait until the RTTI interface to field names is stable.)

trace/mercury_trace_vars.[ch]:
	Provide a mechanism to print not just the whole value of a variable,
	but also just a component, if that is what the user wants.

trace/mercury_trace_internal.c:
	Use the new mechanism in mercury_trace_vars.c.

trace/mercury_trace_util.[ch]:
	Move a function to the new file mercury_trace_util.c from
	mercury_trace_internal.c, since new mercury_trace_vars.c also
	wants to use it.

trace/Mmakefile:
	Add the new file to the list of source files.

tests/debugger/browser_test.{inp,exp,exp2}:
	Test the new functionality.

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/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/curses
cvs diff: Diffing extras/curses/sample
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/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/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 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/browser_test.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/browser_test.exp,v
retrieving revision 1.6
diff -u -b -r1.6 browser_test.exp
--- tests/debugger/browser_test.exp	1999/12/13 07:43:39	1.6
+++ tests/debugger/browser_test.exp	2000/07/18 03:11:47
@@ -79,6 +79,10 @@
   3-small
 
 browser> quit
+mdb> print HeadVar__1/1/2
+       HeadVar__1             	2
+mdb> print 1^1^2^3
+mdb: the path 3 does not exist.
 mdb> retry
        2:      2  2 CALL pred browser_test:big_data/1-0 (det) browser_test.m:18 (browser_test.m:12)
 mdb> continue -a
Index: tests/debugger/browser_test.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/browser_test.exp2,v
retrieving revision 1.7
diff -u -b -r1.7 browser_test.exp2
--- tests/debugger/browser_test.exp2	2000/01/23 01:13:45	1.7
+++ tests/debugger/browser_test.exp2	2000/07/18 03:11:51
@@ -79,6 +79,10 @@
   3-small
 
 browser> quit
+mdb> print HeadVar__1/1/2
+       HeadVar__1             	2
+mdb> print 1^1^2^3
+mdb: the path 3 does not exist.
 mdb> retry
        2:      2  2 CALL pred browser_test:big_data/1-0 (det) browser_test.m:18 (browser_test.m:12)
 mdb> continue -a
Index: tests/debugger/browser_test.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/browser_test.inp,v
retrieving revision 1.2
diff -u -b -r1.2 browser_test.inp
--- tests/debugger/browser_test.inp	1999/06/26 17:01:56	1.2
+++ tests/debugger/browser_test.inp	2000/07/18 01:12:03
@@ -17,6 +17,8 @@
 cd
 ls
 quit
+print HeadVar__1/1/2
+print 1^1^2^3
 retry
 continue -a
 
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/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/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/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/Mmakefile,v
retrieving revision 1.16
diff -u -b -r1.16 Mmakefile
--- trace/Mmakefile	2000/06/22 08:50:26	1.16
+++ trace/Mmakefile	2000/07/18 00:37:00
@@ -62,6 +62,7 @@
 			mercury_trace_readline.c	\
 			mercury_trace_spy.c		\
 			mercury_trace_tables.c		\
+			mercury_trace_util.c		\
 			mercury_trace_vars.c
 
 # The object files in this directory depend on many of the header files
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.68
diff -u -b -r1.68 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	2000/06/19 07:59:28	1.68
+++ trace/mercury_trace_internal.c	2000/07/18 00:48:06
@@ -180,7 +180,6 @@
 		MR_Browser browser);
 
 static	const char *MR_trace_read_help_text(void);
-static	bool	MR_trace_is_number(const char *word, int *value);
 static	const char *MR_trace_parse_line(char *line,
 			char ***words, int *word_max, int *word_count);
 static	int	MR_trace_break_into_words(char *line,
@@ -855,9 +854,7 @@
 		}
 	} else if (streq(words[0], "print")) {
 		if (word_count == 2) {
-			MR_Var_Spec	var_spec;
 			const char	*problem;
-			int		n;
 
 			if (streq(words[1], "*")) {
 				problem = MR_trace_browse_all(MR_mdb_out,
@@ -865,16 +862,9 @@
 			} else if (streq(words[1], "exception")) {
 				problem = MR_trace_browse_exception(event_info,
 					MR_trace_print_var);
-			} else if (MR_trace_is_number(words[1], &n)) {
-				var_spec.MR_var_spec_kind = MR_VAR_SPEC_NUMBER;
-				var_spec.MR_var_spec_number = n;
-				problem = MR_trace_browse_one(MR_mdb_out,
-					var_spec, MR_trace_print_var, FALSE);
-			} else {
-				var_spec.MR_var_spec_kind = MR_VAR_SPEC_NAME;
-				var_spec.MR_var_spec_name = words[1];
-				problem = MR_trace_browse_one(MR_mdb_out,
-					var_spec, MR_trace_print_var, FALSE);
+			} else {
+				problem = MR_trace_parse_browse_one(MR_mdb_out,
+					words[1], MR_trace_print_var, FALSE);
 			}
 
 			if (problem != NULL) {
@@ -886,23 +876,14 @@
 		}
 	} else if (streq(words[0], "browse")) {
 		if (word_count == 2) {
-			MR_Var_Spec	var_spec;
 			const char	*problem;
-			int		n;
 
 			if (streq(words[1], "exception")) {
 				problem = MR_trace_browse_exception(event_info,
 					MR_trace_browse_var);
-			} else if (MR_trace_is_number(words[1], &n)) {
-				var_spec.MR_var_spec_kind = MR_VAR_SPEC_NUMBER;
-				var_spec.MR_var_spec_number = n;
-				problem = MR_trace_browse_one(NULL, var_spec,
-					MR_trace_browse_var, TRUE);
-			} else {
-				var_spec.MR_var_spec_kind = MR_VAR_SPEC_NAME;
-				var_spec.MR_var_spec_name = words[1];
-				problem = MR_trace_browse_one(NULL, var_spec,
-					MR_trace_browse_var, TRUE);
+			} else {
+				problem = MR_trace_parse_browse_one(NULL,
+					words[1], MR_trace_browse_var, TRUE);
 			}
 
 			if (problem != NULL) {
@@ -2026,31 +2007,6 @@
 
 	doc_chars[next_char_slot] = '\0';
 	return doc_chars;
-}
-
-/*
-** Is the string pointed to by word a natural number,
-** i.e. a sequence of digits?
-** If yes, return its value in *value.
-*/
-
-static bool
-MR_trace_is_number(const char *word, int *value)
-{
-	if (MR_isdigit(*word)) {
-		*value = *word - '0';
-		word++;
-		while (MR_isdigit(*word)) {
-			*value = (*value * 10) + *word - '0';
-			word++;
-		}
-
-		if (*word == '\0') {
-			return TRUE;
-		}
-	}
-
-	return FALSE;
 }
 
 /*
Index: trace/mercury_trace_util.c
===================================================================
RCS file: mercury_trace_util.c
diff -N mercury_trace_util.c
--- /dev/null	Thu Mar  4 04:20:11 1999
+++ mercury_trace_util.c	Mon Jul 17 17:18:48 2000
@@ -0,0 +1,38 @@
+
+/*
+** Copyright (C) 2000 The University of Melbourne.
+** This file may only be copied under the terms of the GNU Library General
+** Public License - see the file COPYING.LIB in the Mercury distribution.
+*/
+
+/*
+** This file contains utility functions for debugger.
+**
+** Author: zs.
+*/
+
+#include "mercury_imp.h"
+#include "mercury_trace_util.h"
+
+#include <ctype.h>
+
+bool	MR_trace_is_number(const char *word, int *value);
+
+bool
+MR_trace_is_number(const char *word, int *value)
+{
+	if (MR_isdigit(*word)) {
+		*value = *word - '0';
+		word++;
+		while (MR_isdigit(*word)) {
+			*value = (*value * 10) + *word - '0';
+			word++;
+		}
+
+		if (*word == '\0') {
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
Index: trace/mercury_trace_util.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_util.h,v
retrieving revision 1.1
diff -u -b -r1.1 mercury_trace_util.h
--- trace/mercury_trace_util.h	1998/11/06 10:35:41	1.1
+++ trace/mercury_trace_util.h	2000/07/17 07:18:48
@@ -1,12 +1,13 @@
 /*
-** Copyright (C) 1998 The University of Melbourne.
+** Copyright (C) 1998,2000 The University of Melbourne.
 ** This file may only be copied under the terms of the GNU Library General
 ** Public License - see the file COPYING.LIB in the Mercury distribution.
 */
 
 /*
-** mercury_trace_util.h defines macros for dealing with registers.
+** This module provides utility functions for the debugger.
 **
+** This header files defines macros for dealing with registers.
 ** These macros assume, and enforce, the conventions described
 ** in trace/README.
 */
@@ -30,6 +31,7 @@
 ** That in turn needs to be preceded/followed by
 ** restore/save_transient_registers() if it is in a C function.
 */
+
 #define MR_TRACE_CALL_MERCURY(STATEMENTS) do {				\
 		restore_transient_registers();				\
 		save_registers();					\
@@ -37,5 +39,13 @@
 		restore_registers();					\
 		save_transient_registers();				\
 	} while (0)
+
+/*
+** MR_trace_is_number checks whether the given word contains a natural number,
+** i.e. a sequence of digits. If yes, it puts the value of the number in
+** *value and returns TRUE, otherwise it returns FALSE.
+*/
+
+extern	bool	MR_trace_is_number(const char *word, int *value);
 
 #endif /* MERCURY_TRACE_UTIL_H */
Index: trace/mercury_trace_vars.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_vars.c,v
retrieving revision 1.18
diff -u -b -r1.18 mercury_trace_vars.c
--- trace/mercury_trace_vars.c	2000/07/12 15:20:59	1.18
+++ trace/mercury_trace_vars.c	2000/07/18 03:09:52
@@ -17,7 +17,7 @@
 #include "mercury_memory.h"
 #include "mercury_layout_util.h"
 #include "mercury_stack_layout.h"
-
+#include "mercury_trace_util.h"
 #include "mercury_trace_vars.h"
 
 #include <stdio.h>
@@ -106,14 +106,18 @@
 	MR_Var_Details			*MR_point_vars;
 } MR_Point;
 
-static	bool	MR_trace_type_is_ignored(MR_PseudoTypeInfo pseudo_type_info);
+static	bool		MR_trace_type_is_ignored(
+				MR_PseudoTypeInfo pseudo_type_info);
 static	int	MR_trace_compare_var_details(const void *arg1,
 			const void *arg2);
-static	void	MR_trace_browse_var(FILE *out, MR_Var_Details *var,
-			MR_Browser browser);
+static	const char *	MR_trace_browse_one_path(FILE *out,
+			MR_Var_Spec var_spec, char *path, MR_Browser browser,
+			bool must_be_unique);
+static	char *		MR_trace_browse_var(FILE *out, MR_Var_Details *var,
+				char *path, MR_Browser browser);
+static	const char *	MR_trace_bad_path(char *path);
 static	int	MR_trace_print_var_name(FILE *out, MR_Var_Details *var);
-static	const char *
-		MR_trace_valid_var_number(int var_number);
+static	const char *	MR_trace_valid_var_number(int var_number);
 
 #define	MR_INIT_VAR_DETAIL_COUNT	20
 #define	MR_TRACE_PADDED_VAR_NAME_LENGTH	23
@@ -628,25 +632,96 @@
 }
 
 const char *
+MR_trace_parse_browse_one(FILE *out, char *word_spec, MR_Browser browser,
+	bool must_be_unique)
+{
+	MR_Var_Spec	var_spec;
+	char		*path;
+	char		*s;
+	int		n;
+
+	s = word_spec;
+	while (*s != '\0' && *s != '^' && *s != '/') {
+		s++;
+	}
+
+	if (*s == '\0') {
+		path = NULL;
+	} else {
+		path = s;
+
+		do {
+			if (*s == '^' || *s == '/') {
+				s++;
+			} else {
+				return "bad component selector";
+			}
+
+			if (MR_isdigit(*s)) {
+				s++;
+			} else {
+				return "bad component selector";
+			}
+
+			while (MR_isdigit(*s)) {
+				s++;
+			}
+		} while (*s != '\0');
+
+		*path = '\0';
+		path++;
+	}
+
+	if (MR_trace_is_number(word_spec, &n)) {
+		var_spec.MR_var_spec_kind = MR_VAR_SPEC_NUMBER;
+		var_spec.MR_var_spec_number = n;
+		return MR_trace_browse_one_path(out, var_spec, path,
+			browser, must_be_unique);
+	} else {
+		var_spec.MR_var_spec_kind = MR_VAR_SPEC_NAME;
+		var_spec.MR_var_spec_name = word_spec;
+		return MR_trace_browse_one_path(out, var_spec, path,
+			browser, must_be_unique);
+	}
+}
+
+const char *
 MR_trace_browse_one(FILE *out, MR_Var_Spec var_spec, MR_Browser browser,
 	bool must_be_unique)
 {
+	return MR_trace_browse_one_path(out, var_spec, NULL, browser,
+		must_be_unique);
+}
+
+static const char *
+MR_trace_browse_one_path(FILE *out, MR_Var_Spec var_spec, char *path,
+	MR_Browser browser, bool must_be_unique)
+{
 	int		i;
 	bool		found;
 	const char	*problem;
+	char		*bad_path;
 
 	if (MR_point.MR_point_problem != NULL) {
 		return MR_point.MR_point_problem;
 	}
 
 	if (var_spec.MR_var_spec_kind == MR_VAR_SPEC_NUMBER) {
+		int	varno;
+
 		problem = MR_trace_valid_var_number(
 					var_spec.MR_var_spec_number);
 		if (problem != NULL) {
 			return problem;
 		}
-		MR_trace_browse_var(out, &MR_point.MR_point_vars
-			[var_spec.MR_var_spec_number - 1], browser);
+
+		varno = var_spec.MR_var_spec_number - 1;
+		bad_path = MR_trace_browse_var(out,
+				&MR_point.MR_point_vars[varno],
+				path, browser);
+		if (bad_path != NULL) {
+			return MR_trace_bad_path(bad_path);
+		}
 	} else if (var_spec.MR_var_spec_kind == MR_VAR_SPEC_NAME) {
 		found = FALSE;
 		for (i = 0; i < MR_point.MR_point_var_count; i++) {
@@ -663,21 +738,38 @@
 		}
 
 		if (MR_point.MR_point_vars[i].MR_var_is_ambiguous) {
+			int	success_count;
+
 			if (must_be_unique) {
 				return "variable name is not unique";
 			}
 
+			success_count = 0;
 			do {
-				MR_trace_browse_var(out,
-					&MR_point.MR_point_vars[i], browser);
+				bad_path = MR_trace_browse_var(out,
+					&MR_point.MR_point_vars[i], path,
+					browser);
+
+				if (bad_path == NULL) {
+					success_count++;
+				}
+
 				i++;
 			} while (i < MR_point.MR_point_var_count &&
 				streq(var_spec.MR_var_spec_name,
 				MR_point.MR_point_vars[i].MR_var_fullname));
+
+			if (success_count == 0) {
+				return "the selected path does not exist in any of the variables with that name";
+			}
 		} else {
-			MR_trace_browse_var(out, &MR_point.MR_point_vars[i],
+			bad_path = MR_trace_browse_var(out,
+				&MR_point.MR_point_vars[i], path,
 				browser);
+			if (bad_path != NULL) {
+				return MR_trace_bad_path(bad_path);
 		}
+		}
 	} else {
 		MR_fatal_error("internal error: bad var_spec kind");
 	}
@@ -685,6 +777,26 @@
 	return NULL;
 }
 
+#define	BAD_PATH_BUFFER_SIZE	128
+#define	BAD_PATH_MSG_PREFIX	"the path "
+#define	BAD_PATH_MSG_SUFFIX	" does not exist"
+
+static const char *
+MR_trace_bad_path(char *path)
+{
+	static	char	buffer[BAD_PATH_BUFFER_SIZE];
+
+	if (strlen(BAD_PATH_MSG_PREFIX) + strlen(path) +
+		strlen(BAD_PATH_MSG_SUFFIX) < BAD_PATH_BUFFER_SIZE)
+	{
+		sprintf(buffer, "%s%s%s", BAD_PATH_MSG_PREFIX, path,
+			BAD_PATH_MSG_SUFFIX);
+		return buffer;
+	} else {
+		return "the given path does not exist";
+	}
+}
+
 const char *
 MR_trace_browse_all(FILE *out, MR_Browser browser)
 {
@@ -699,17 +811,58 @@
 	}
 
 	for (i = 0; i < MR_point.MR_point_var_count; i++) {
-		MR_trace_browse_var(out, &MR_point.MR_point_vars[i], browser);
+		(void) MR_trace_browse_var(out, &MR_point.MR_point_vars[i],
+			NULL, browser);
 	}
 
 	return NULL;
 }
 
-static void
-MR_trace_browse_var(FILE *out, MR_Var_Details *var, MR_Browser browser)
-{
+/* ML_arg() is defined in std_util.m */
+extern	bool 	ML_arg(MR_TypeInfo term_type_info, Word *term, int arg_index,
+			MR_TypeInfo *arg_type_info_ptr, Word **arg_ptr);
+
+static char *
+MR_trace_browse_var(FILE *out, MR_Var_Details *var, char *path,
+	MR_Browser browser)
+{
+	MR_TypeInfo	typeinfo;
+	MR_TypeInfo	new_typeinfo;
+	Word		*value;
+	Word		*new_value;
+	char		*old_path;
+	int		arg_num;
 	int	len;
 
+	typeinfo = var->MR_var_type;
+	value = &var->MR_var_value;
+
+	if (path != NULL) {
+		while (*path != '\0') {
+			old_path = path;
+
+			arg_num = 0;
+			while (MR_isdigit(*path)) {
+				arg_num = arg_num * 10 + *path - '0';
+				path++;
+			}
+
+			if (*path != '\0') {
+				path++; /* step over / or ^ */
+			}
+
+			/* ML_arg starts indexing fields from 0, not 1 */
+			if (ML_arg(typeinfo, value, arg_num - 1,
+				&new_typeinfo, &new_value))
+			{
+				typeinfo = new_typeinfo;
+				value = new_value;
+			} else {
+				return old_path;
+			}
+		}
+	}
+
 	if (out != NULL) {
 		/*
 		** The initial blanks are to visually separate
@@ -731,7 +884,8 @@
 		fflush(out);
 	}
 
-	(*browser)((Word) var->MR_var_type, var->MR_var_value);
+	(*browser)((Word) typeinfo, *value);
+	return NULL;
 }
 
 static int
Index: trace/mercury_trace_vars.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_vars.h,v
retrieving revision 1.7
diff -u -b -r1.7 mercury_trace_vars.h
--- trace/mercury_trace_vars.h	2000/03/24 10:28:07	1.7
+++ trace/mercury_trace_vars.h	2000/07/17 07:18:48
@@ -17,10 +17,10 @@
 ** MR_trace_current_level returns this information, while enquiry function
 ** MR_trace_current_level_details returns information about this level.
 **
-** The six functions MR_trace_var_count, MR_trace_list_vars,
-** MR_trace_return_var_info, MR_trace_headvar_num, MR_trace_browse_one
-** and MR_trace_browse_all all work in the context established by the
-** MR_trace_init_point_vars and possibly MR_trace_set_level.
+** The functions MR_trace_var_count, MR_trace_list_vars,
+** MR_trace_return_var_info, MR_trace_headvar_num, MR_trace_parse_browse_one,
+** MR_trace_browse_one and MR_trace_browse_all all work in the context
+** established by MR_trace_init_point_vars and possibly MR_trace_set_level.
 **
 ** This context may say that there is no information available about
 ** the variables live at the current location (this is possible if the
@@ -92,6 +92,21 @@
 */
 
 extern	const char	*MR_trace_headvar_num(int n, int *num);
+
+/*
+** Print the (names and) values of (the specified parts of) the specified
+** variables. (The variable is specified by either its name or its sequence
+** number in the set of live variables at the current point; the desired part
+** is specified by zero or more suffixes of the form ^argnum or /argnum.
+**
+** The names are printed to the given file if the file pointer is non-NULL.
+** The values are printed by giving them to the specified browser.
+** The last argument governs whether this function returns an error
+** if the given variable specification is ambiguous.
+*/
+
+extern	const char	*MR_trace_parse_browse_one(FILE *out, char *word_spec,
+				MR_Browser browser, bool must_be_unique);
 
 /*
 ** Print the (names and) values of the specified variables.
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