diff: fix mdb documentation categories bug

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Mar 25 21:42:29 AEDT 1999


Estimated hours taken: 0.75

Fix a bug where doc/generate_mdb_doc was putting the documentation for
the interactive query commands in the category "interactive" whereas
doc/mdb_categories was expecting this category to be called "queries".

util/info_to_mdb.c:
	Print error messages to stderr rather than stdout.
	Document the first argument as being a category name
	(the name of an mdb help category) rather than a section name.

doc/generate_mdb_doc:
	Avoid the assumption that the category name is the same as the
	section name; that is still the default, but it now sets the
	category for the "interactive" section to "queries".
	Invoke info_to_mdb with the category name rather than the
	section name.

trace/mercury_trace_internal.c:
	Update the category names in the pseudo-automatically-generated 
	command list to reflect the above change.
	(Also improve an error message slightly.)

Index: doc/generate_mdb_doc
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/generate_mdb_doc,v
retrieving revision 1.3
diff -u -r1.3 generate_mdb_doc
--- generate_mdb_doc	1999/03/24 12:26:20	1.3
+++ generate_mdb_doc	1999/03/25 10:34:45
@@ -18,6 +18,10 @@
 for section in interactive forward backward browsing breakpoint \
 	parameter help exp developer misc 
 do
+	case $section in
+		interactive)	category=queries ;;
+		*)		category=$section ;;
+	esac
 	info -f ./mercury_user_guide.info -o $tmp $debug_cmd_path $section
-	../util/info_to_mdb $section $tmp >> mdb_doc
+	../util/info_to_mdb $category $tmp >> mdb_doc
 done
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.33
diff -u -r1.33 mercury_trace_internal.c
--- mercury_trace_internal.c	1999/03/18 08:19:17	1.33
+++ mercury_trace_internal.c	1999/03/25 10:21:59
@@ -1122,7 +1122,7 @@
 				}
 			} else {
 				fprintf(MR_mdb_out,
-					"%s is not a valid command.\n",
+					"`%s' is not a valid command.\n",
 					words[2]);
 			}
 		}
@@ -2455,9 +2455,9 @@
 	** experimental commands.
 	*/
 
-	{ "interactive", "query" },
-	{ "interactive", "cc_query" },
-	{ "interactive", "io_query" },
+	{ "queries", "query" },
+	{ "queries", "cc_query" },
+	{ "queries", "io_query" },
 	{ "forward", "step" },
 	{ "forward", "goto" },
 	{ "forward", "finish" },
Index: util/info_to_mdb.c
===================================================================
RCS file: /home/mercury1/repository/mercury/util/info_to_mdb.c,v
retrieving revision 1.2
diff -u -r1.2 info_to_mdb.c
--- info_to_mdb.c	1999/02/10 18:37:11	1.2
+++ info_to_mdb.c	1999/03/25 10:32:24
@@ -37,6 +37,8 @@
 int
 main(int argc, char **argv)
 {
+	char	*filename;
+	char	*category;	/* mdb help category */
 	FILE	*infp;
 	char	*line;
 	char	command[MAXLINELEN];
@@ -47,12 +49,15 @@
 	bool	next_concept;
 
 	if (argc != 3) {
-		printf("usage: info_to_mdb section_name section_info_file\n");
+		fprintf(stderr,
+			"usage: info_to_mdb category_name section_info_file\n");
 		exit(EXIT_FAILURE);
 	}
+	category = argv[1];
+	filename = argv[2];
 
-	if ((infp = fopen(argv[2], "r")) == NULL) {
-		printf("cannot read %s\n", argv[2]);
+	if ((infp = fopen(filename, "r")) == NULL) {
+		fprintf(stderr, "cannot read `%s'\n", filename);
 		exit(EXIT_FAILURE);
 	}
 
@@ -81,7 +86,7 @@
 		}
 
 		slot += 100;
-		printf("document %s %d ", argv[1], slot);
+		printf("document %s %d ", category, slot);
 		if (is_concept) {
 			for (i = 0; line[i] != '\n'; i++) {
 				command[i] = concept_char(line[i]);
@@ -227,7 +232,7 @@
 put_line_back(char *line)
 {
 	if (putback_line != NULL) {
-		printf("trying to put back more than one line\n");
+		fprintf(stderr, "trying to put back more than one line\n");
 		exit(EXIT_FAILURE);
 	}
 

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