Fix a problem that truncated mdb_doc files.

util/info_to_doc.c:
    Fix a problem that caused the generation of truncated mdb_doc files,
    and from that truncated test/debugger/mdb_command_test.inp files.
    The problem was that this program expected the info program to quote
    the initial line of each mdb command like this:

        `cmdname options ...'

    but on some machines, including mine, it quotes them like this:

        'cmdname options ...'

    i.e. with the initial as well as the final quote being a forward quote.
    This program now accepts either.

util/Mmakefile:
    Fix white space.

doc/generate_mdb_doc:
    Fix inconsistent indentation. Protect shell variable references.

doc/Mmakefile:
    Generate an error message if a similar problem occurs again
    when creating mdb_doc.

    Fix indentation.

tools/bootcheck:
    Generate an error message if a similar problem occurs again
    when copying tests/debugger/mdb_command_test.inp.
This commit is contained in:
Zoltan Somogyi
2014-01-22 09:31:37 +11:00
parent ba57f4a5df
commit 7e1cdb70aa
5 changed files with 58 additions and 26 deletions

View File

@@ -1,3 +1,4 @@
# vim: ts=8 sw=8 noet
#-----------------------------------------------------------------------------#
# Copyright (C) 1996-2007, 2009-2012 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
@@ -228,9 +229,17 @@ mdb_doc: generate_mdb_doc mercury_user_guide.info mdb_categories
mdb_command_list: generate_mdb_command_list mdb_doc
./generate_mdb_command_list < mdb_doc > mdb_command_list
-@if test `wc -l < mdb_command_list` -lt 100; then \
echo "There was a problem when creating mdb_command_list"; \
exit 1; \
fi
mdb_command_test.inp: generate_mdb_command_test mdb_doc
./generate_mdb_command_test < mdb_doc > mdb_command_test.inp
-@if test `wc -l < mdb_command_test.inp` -lt 100; then \
echo "There was a problem when creating mdb_command_test.inp"; \
exit 1; \
fi
#-----------------------------------------------------------------------------#
@@ -433,11 +442,11 @@ install_webpage: library-chapters.texi_pp split_html ps pdf
-[ -d $(INSTALL_WEBPAGE_DIR) ] || mkdir -p $(INSTALL_WEBPAGE_DIR)
( \
. ../VERSION; \
if [ "$$VERSION" = DEV ]; then \
if [ "$$VERSION" = DEV ]; then \
echo "Set the version before you build the website"; \
exit 1; \
fi; \
)
)
cp *.ps $(INSTALL_WEBPAGE_DIR)
cp *.pdf $(INSTALL_WEBPAGE_DIR)
for file in $(INSTALL_WEBPAGE_DIR)/*.ps ; do \

View File

@@ -1,4 +1,5 @@
#!/bin/sh
# vim: sw=4 ts=8 et
#---------------------------------------------------------------------------#
# Copyright (C) 1998-1999,2002, 2004-2006 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
@@ -9,36 +10,39 @@
cat mdb_categories > mdb_doc
tmp="mdb_doc_tmp.$$"
trap 'rm -f $tmp' 0 1 2 3 15
trap 'rm -f ${tmp}' 0 1 2 3 15
info -f ./mercury_user_guide.info -o $tmp -n "Mercury debugger concepts"
../util/info_to_mdb concepts $tmp >> mdb_doc
info -f ./mercury_user_guide.info -o ${tmp} \
-n "Mercury debugger concepts"
../util/info_to_mdb concepts ${tmp} >> mdb_doc
# Document the declarative debugger.
info -f ./mercury_user_guide.info -o $tmp -n "Declarative debugging overview"
info -f ./mercury_user_guide.info -o ${tmp} \
-n "Declarative debugging overview"
echo "document concepts 10 decl_debug" >> mdb_doc
sed 's/^ //' < $tmp | sed -n '6,1000s/^/ /p' >> mdb_doc
sed 's/^ //' < ${tmp} | sed -n '6,1000s/^/ /p' >> mdb_doc
echo >> mdb_doc
info -f ./mercury_user_guide.info -o $tmp -n "Declarative debugging commands"
echo "The following commands are available from within the \
declarative debugger:" `./commands $tmp` | \
fold -w72 -s | sed "s/^/ /" >> mdb_doc
info -f ./mercury_user_guide.info -o ${tmp} \
-n "Declarative debugging commands"
echo "The following commands are available from within the" \
"declarative debugger:" `./commands ${tmp}` | \
fold -w72 -s | sed "s/^/ /" >> mdb_doc
echo end >> mdb_doc
../util/info_to_mdb decl $tmp >> mdb_doc
../util/info_to_mdb decl ${tmp} >> mdb_doc
debug_cmd_path="debug debugger"
for section in interactive forward backward browsing breakpoint \
i/o parameter help declarative misc exp developer
i/o parameter help declarative misc exp developer
do
case $section in
interactive) category=queries ;;
i/o) category=io_tabling ;;
declarative) category=mdb_dd ;;
*) category=$section ;;
esac
info -f ./mercury_user_guide.info -o $tmp $debug_cmd_path $section
../util/info_to_mdb $category $tmp >> mdb_doc
case ${section} in
interactive) category=queries ;;
i/o) category=io_tabling ;;
declarative) category=mdb_dd ;;
*) category=$section ;;
esac
info -f ./mercury_user_guide.info -o ${tmp} ${debug_cmd_path} ${section}
../util/info_to_mdb ${category} ${tmp} >> mdb_doc
done
mv mdb_doc $tmp
./squeeze < $tmp > mdb_doc
mv mdb_doc ${tmp}
./squeeze < ${tmp} > mdb_doc

View File

@@ -1473,6 +1473,8 @@ fi
#-----------------------------------------------------------------------------#
mdb_command_test_inp_status=0
if test "$runtests" = "true" -o "$extras" = "true"
then
# Use everything from stage 2, unless the options say that the tests
@@ -1559,7 +1561,16 @@ then
/bin/rm ${tests_prefix}tests/Mmake.params > /dev/null 2>&1
fi
cp $root/doc/mdb_command_test.inp ${tests_prefix}tests/debugger
if cmp \
${root}/doc/mdb_command_test.inp \
${tests_prefix}tests/debugger/mdb_command_test.inp
then
true
else
mdb_command_test_inp_status=1
fi
cp ${root}/doc/mdb_command_test.inp ${tests_prefix}tests/debugger
sed -e "s:@WORKSPACE@:$WORKSPACE:" \
< ${tests_prefix}tests/WS_FLAGS.ws \
@@ -1829,6 +1840,14 @@ then
exitstatus=1
fi
if test "$mdb_command_test_inp_status" != 0
then
echo "error exit: unexpected change in" \
"${tests_prefix}tests/debugger/mdb_command_test.inp"
exitstatus=1
fi
if test "$test_status" != 0
then
echo "error exit: some tests failed"

View File

@@ -1,3 +1,4 @@
# vim: ts=8 sw=8 noexpandtab
#-----------------------------------------------------------------------------#
# Copyright (C) 1995-2002, 2005, 2006-2007, 2010, 2012 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
@@ -28,7 +29,6 @@ PROGS=mkinit mkinit_erl mdemangle mfiltercc info_to_mdb
PROGFILENAMES=$(PROGS:%=%$(EXT_FOR_EXE))
SRC=$(PROGS:%=%.c)
# Only if getopt.h doesn't exist do we link in a version of getopt.
ifeq ("$(GETOPT_H_AVAILABLE)","no")
GETOPT_SRC=$(RUNTIME_DIR)/GETOPT/getopt.c $(RUNTIME_DIR)/GETOPT/getopt1.c

View File

@@ -174,7 +174,7 @@ is_command(const char *line, MR_bool *is_concept)
int len;
len = strlen(line);
if ((line[0] == '`') && (line[len-2] == '\'')) {
if (((line[0] == '`') || (line[0] == '\'')) && (line[len-2] == '\'')) {
*is_concept = MR_FALSE;
return MR_TRUE;
} else if ((line[0] == '_') && (line[len-2] == '_')) {