Skip to content

Commit

Permalink
Fix a bug where doc/generate_mdb_doc was putting the documentation for
Browse files Browse the repository at this point in the history
Estimated hours taken: 0.5

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.)
  • Loading branch information
Fergus Henderson committed Mar 25, 1999
1 parent 88cc5b0 commit feb6159
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
6 changes: 5 additions & 1 deletion doc/generate_mdb_doc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ debug_cmd_path="debug debugger"
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
8 changes: 4 additions & 4 deletions trace/mercury_trace_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ MR_trace_handle_cmd(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
}
} else {
fprintf(MR_mdb_out,
"%s is not a valid command.\n",
"`%s' is not a valid command.\n",
words[2]);
}
}
Expand Down Expand Up @@ -2455,9 +2455,9 @@ static MR_trace_cmd_cat_item MR_trace_valid_command_list[] =
** experimental commands.
*/

{ "interactive", "query" },
{ "interactive", "cc_query" },
{ "interactive", "io_query" },
{ "queries", "query" },
{ "queries", "cc_query" },
{ "queries", "io_query" },
{ "forward", "step" },
{ "forward", "goto" },
{ "forward", "finish" },
Expand Down
15 changes: 10 additions & 5 deletions util/info_to_mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ static void put_line_back(char *line);
int
main(int argc, char **argv)
{
char *filename;
char *category; /* mdb help category */
FILE *infp;
char *line;
char command[MAXLINELEN];
Expand All @@ -47,12 +49,15 @@ main(int argc, char **argv)
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);
}

Expand Down Expand Up @@ -81,7 +86,7 @@ main(int argc, char **argv)
}

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]);
Expand Down Expand Up @@ -227,7 +232,7 @@ static void
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);
}

Expand Down

0 comments on commit feb6159

Please sign in to comment.