Files
mercury/doc/update_opts
Zoltan Somogyi cc37cbd2b2 Make automatic texinfo documentation of options work.
Include the now-automatically-generated texinfo as the body
of the Invocation chapter of the user's guide. The resulting
guide is still not final, but it already fixes the previous absence
of several options' documentation from the invocation chapter.

compiler/optdb_help.m:
    Provide ways to give different aligned texts to print_help.m
    when it generates plain help text than when generating texinfo.
    We need this because we want to add markup to the texinfo version.

    Provide ways to add index entries to help texts. This is needed
    only when creating texinfo output.

    Add some more kinds of help_pieces, which provide previously
    unavailable combination of what we generate for help text vs
    what we generate for texinfo.

    Either delete obsolete documentation, or replace it
    with current documentation.

compiler/print_help.m:
    Redo the handling of index entries, mainly driven by the need
    to handle both default-on and default-off boolean options
    appropriately.

    Do not generate subsection headings for fully-commented-out subsections.

    Sort the output by option, not first on option category
    and then on option.

compiler/options.m:
    Check that the texinfo we now generate from optdb records
    with --help-texinfo is at least as informative as the entry
    for the relevant option in the old invocation chapter.
    Fix cases where it wasn't.

    Add index entries as they occurred in the old invocation chapter,
    except where I think they are either inappropriate or just not needed
    (usually due to the same index entry on the previous option).

    Add cross references that existed in the old invocation chapter.

    Improve a whole bunch of help texts where I felt the need
    during all the above changes.

    In some cases, just add XXXs calling for future changes.

    In one case, add a non-abbreviated version of an option's old,
    abbreviated-only "long" name.

    Pick "directory", "filename" and "N" as the respective standard
    argument names in their domains.

    Put some options into a new order for greater readability.

doc/Mmakefile:
doc/update_opts:
    For simpliciy and easier control over quotations and errors,
    move all the work of including the output of mmc --help-texinfo
    as the invocation chapter in the user's guide from the Mmakefile
    to the update_opts script.

doc/user_guide.texi:
    Replace the invocation chapter.

    Update all dangling references to that chapter to point to
    the new section or subsection that they want to refer to.

    Add a now-ignored block that can later become a chapter on grades.

tests/warnings/help_text.err_exp:
tests/warnings/help_opt_levels.err_exp:
    Conform to the changes above.
2025-07-06 19:18:29 +02:00

40 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
# vim: sw=4 ts=4 et ft=sh
# This script replaces the body of the Invocation chapter of the User's Guide
# with the texinfo version of the mmc help text.
#
# It is here in a separate shell script because including a dollar sign
# in the last invocation of sed below is unreasonably hard when the
# command is in an action in a makefile, given that we actually want
# the two characters $ and w, not the value of a shell or make variable
# named w.
cp user_guide.texi USER_GUIDE_TEXI_OLD
/bin/rm -f USER_GUIDE_TEXI_START USER_GUIDE_TEXI_END > /dev/null 2>&1
/bin/rm -f INVOCATION_OLD0 INVOCATION_OLD INVOCATION_NEW > /dev/null 2>&1
echo > INVOCATION_NEW
../compiler/mercury_compile --help-texinfo \
--no-mercury-stdlib-dir \
--config-file ../scripts/Mercury.config \
>> INVOCATION_NEW
echo >> INVOCATION_NEW
sed -e '1,/INCLUDE_HELP_TEXT_START/w USER_GUIDE_TEXI_START' \
< user_guide.texi > /dev/null 2>&1
sed -e '/INCLUDE_HELP_TEXT_START/,/INCLUDE_HELP_TEXT_END/w INVOCATION_OLD0' \
< user_guide.texi > /dev/null 2>&1
sed -e '/INCLUDE_HELP_TEXT/d' < INVOCATION_OLD0 > INVOCATION_OLD
sed -e '/INCLUDE_HELP_TEXT_END/,$w USER_GUIDE_TEXI_END' \
< user_guide.texi > /dev/null 2>&1
cat USER_GUIDE_TEXI_START INVOCATION_NEW USER_GUIDE_TEXI_END \
> user_guide.texi.new
mv -f user_guide.texi.new user_guide.texi
/bin/rm -f USER_GUIDE_TEXI_START USER_GUIDE_TEXI_END > /dev/null 2>&1
/bin/rm -f INVOCATION_OLD0 > /dev/null 2>&1
diff -u INVOCATION_OLD INVOCATION_NEW > INVOCATION_DIFF
diff -u USER_GUIDE_TEXI_OLD user_guide.texi > USER_GUIDE_TEXI_DIFF
echo "The diff to invocation chapter is in INVOCATION_DIFF."
echo "The diff to user_guide.texi is in USER_GUIDE_TEXI_DIFF."
exit 0