Commit Graph

93 Commits

Author SHA1 Message Date
Zoltan Somogyi
c4bb1a47b8 Fix indentation. 2025-12-14 18:54:28 +11:00
Zoltan Somogyi
33e3a3bf7b Don't install pdfs by default. 2025-08-11 22:42:00 +02:00
Zoltan Somogyi
ae28a625cc Use consistent file-names in the doc directory.
Previously, we used to build e.g. mercury_ref.info from reference_manual.texi.
We now use these base files names consistently, with all relevant extensions:

    mercury_reference_manual
    mercury_user_guide
    mercury_library_manual
    mercury_transition_guide
    mercury_faq

doc/mercury_reference_manual.texi:
doc/mercury_user_guide.texi:
doc/mercury_library_manual.texi:
doc/mercury_transition_guide.texi:
doc/mercury_faq.texi:
    Rename the original .texi files to the new names.

    Rename any pointers between manuals.

doc/update_opts:
    Delete this unused file, since there is no point in updating it
    to use the new file names.

doc/Mmakefile:
    Rename files in variable definitions, target lists, source lists, actions,
    and comments.

    Replace blocks of file-name-specific rules with a single generic rule
    where the uniformity of names makes this possible.

    Start builtin pdf files by default, since the motivation for this change
    is fixing an inconsistency between .html and .pdf versions of the same
    manual.

    Change the naming scheme of intermediate files to fit into the new pattern.

    Delete the new_opts target, which we do not need anymore.

    Delete references to library_toc and library_1, which we stopped building
    in 2003.

doc/mercury.html.in:
doc/mercury.info.in:
    Conform to the renames.
2025-08-11 07:48:11 +02:00
Peter Wang
cae8c31abd Generate ug_invocation.texi using bootstrap compiler when cross-compiling.
doc/Mmakefile:
    Generate ug_invocation.texi using the bootstrap compiler when
    cross-compiling as we may not be able to run the mercury_compile
    executable.

doc/.gitignore:
    Ignore ug_invocation.texi and ug_invocation.texi_date.
2025-07-23 17:31:02 +10:00
Zoltan Somogyi
2b0813905d Fix grammar. 2025-07-21 19:29:00 +02:00
Julien Fischer
f77bb993ca Do not use .exe extension with ug_invocation depdendencies.
doc/Mmakefile:
    As above. Add a comment explaining why this works.
2025-07-21 22:09:47 +10:00
Julien Fischer
1b73644571 Fix source distribution builds.
Mmakefile:
docs/Mmakefile:
    When building the source distribution, generate ug_invocation.texi
    using the bootstrap Mercury compiler since the building the source
    distribution does not create a mercury_compile executable.
2025-07-21 00:21:15 +10:00
Zoltan Somogyi
7ed966ebbf Keep the invocation chapter always up-to-date.
doc/user_guide.texi:
    Replace the invocation chapter part of this file with a @include
    of a new file, ug_invocation.texi, which contains the output of
    "mmc --help-texinfo".

doc/Mmakefile:
    Make user_guide.texi_pp dependent on ug_invocation.texi.
    Do not force the rebuilding of the info/pdf/etc versions
    of the user guide if, when we check whether ug_invocation.texi
    is still current, we find that it is.
2025-07-19 15:11:39 +02:00
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
Zoltan Somogyi
2ef8b3d13f Implement (mostly) mmc --help-texinfo.
compiler/print_help.m:
    Implement mmc --help-texinfo for real by generating near-final texinfo
    output when asked to.

    Move some utility operations to the end of the file.

doc/update_opts:
    A script to replace the bulk of the invocation chapter of the
    User's Guide with the output of mmc --help-texinfo.

doc/Mmakefile:
    Add a new target, intended to be invoked manually, to both
    invoke update_opts, and to show the user its effect.

compiler/options.m:
    Fix a link and some texinfo format bugs.

tests/warnings/help_text.err_exp:
    Expect the fixed link.
2025-07-03 20:25:59 +02:00
Zoltan Somogyi
57d371cac4 Make the documentation setup work with new software.
doc/Mmakefile:
    Specify --no-split in invocations of makeinfo. Without it,
    makeinfo split the info file for the user guide into two parts
    on my new Linux laptop.

doc/generate_mdb_doc:
    Specify the C locale. Without it, the info program generated
    non-ASCII quotes, which util/info_to_mdb.c did not recognize.
2025-06-29 08:24:56 +02:00
Zoltan Somogyi
c148ce54fe Update style in a bunch of Mmakefiles.
Mmake.common.in:
bindist/Mmakefile:
compiler/Mmakefile:
compiler/notes/Mmakefile:
doc/Mmakefile:
extras/align_right/Mmakefile:
extras/base64/Mmakefile:
extras/dynamic_linking/Mmakefile:
extras/error/Mmakefile:
extras/fixed/Mmakefile:
extras/graphics/samples/gears/Mmakefile.MacOSX:
extras/graphics/samples/maze/Mmakefile.MacOSX:
extras/lex/Mmakefile:
extras/monte/Mmakefile:
extras/posix/Mmakefile:
extras/references/Mmakefile:
extras/references/samples/Mmakefile:
extras/split_file/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
runtime/Mmakefile:
scripts/Mmakefile:
ssdb/Mmakefile:
tests/Mmake.common:
tests/mmc_make/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
    Invoke the sh builtin "test" as "test", not as "[".

    Make some target names more descriptive.

    Fix indentation.
2024-09-17 11:09:18 +02:00
Julien Fischer
3554d6ab64 Reformat the list of man page programs ...
doc/Mmakefile:
   ... and put it in order.
2023-10-15 13:56:55 +11:00
Julien Fischer
adece804aa Build the man page for mtc.
docs/Mmakefile:
    As above.

scripts/mtc:
    Escape double quotes in the usage message.
2023-09-22 23:13:22 +10:00
Julien Fischer
7a19524a06 Fix man page dependencies for mmc.1 and mprof.1.
doc/Mmakefile:
    We need to regenerate the manual page when *any* part
    of the usage message changes, not just the parts in options.m.
2023-09-04 10:24:22 +10:00
Zoltan Somogyi
02f0054d0b Put term_io.m's contents into a logical order.
library/term_io.m:
    Put related predicates next to each other. Put the groups of related
    predicates into descending order on the size of the entity being output.

    We have two groups of predicates that both output atoms, with one group
    taking an adjacent_to_graphic_token argument, and one group not taking
    such an argument. The second group is publicly exported; the first group
    is exported but not publicly documented.

    Until now, we arranged the "exported but not publicly documented" part
    by declaring these predicates in a second interface section. However,
    this is incompatible with them being next to second group. Switch
    to using the new mechanism in doc/Mmakefile to achieve the same
    objective.

doc/Mmakefile:
    Do not include any lines between lines containing the strings
    UNDOC_PART_START and UNDOC_PART_END in library/*.m in the library's
    documentation.
2023-07-04 01:46:26 +02:00
Mark Brown
16fdab788b Overhaul of the Syntax chapter of the reference manual
There are three main aims for this change:

1. Don't rely so much on users having knowledge of Prolog (ideally we
wouldn't require it at all, but this change probably doesn't fully achieve
that). Present the information more linearly, i.e., without requiring
so many forward references.

2. Make important information less likely to be overlooked. As it stands,
we give a lot of semantics in the Syntax chapter where users wouldn't
expect to find it (they're more likely to just skim over such a chapter).

3. Remove some inconsistencies in our descriptions and use of terminology,
and try to remove ambiguities.

Changes to terminology
----------------------

These are aimed at being more consistent, as well as dividing things up
into concepts that we need to refer to later on.

- A term is now a core term or a special term. The latter are for list
syntax, etc. Avoid the use of "is parsed as", the significance of which
is not clear, and instead define an equivalence relation via a term
normalization procedure.

- Define "functor" and "principal functor". Don't use "functor" to talk
about terms: the functor is defined as the name/arity pair. Also give
some synonyms we use for functor.

- Core terms are divided into variables, constants, and functor terms.
Functor terms are names on their own or names with arguments
(i.e., "functor terms" are those terms that have meaningful functors).

- "Higher-order terms" are now called "apply terms", since they aren't
necessarily higher-order themselves, and because that is a semantic
concept anyway.

- Data-terms are now referred to as expressions.

- Refer to "field access" rather than "record syntax". It's not made clear
that these are referring to the same feature, so it's better to stick to
one term (at least until full definitions are given).

Changes to document structure
-----------------------------

The Syntax chapter as a whole has been split into two chapters,
Syntax and Clauses. The new structure is as follows:

Syntax

- Additional sections are added for comments and line number directives.

- The Tokens section is split into token types (so that, e.g., variables
can be looked up quickly).

- "Operators" covers everything about operator syntax, not just builtin
operators.

- "Terms" covers the material previously in that section. It adds a summary
in the form of grammar rules (but makes it clear all the information is
also in the prose), and a term normalization procedure that is _not_
written in pseudo-Mercury. The grammar is there for people who are likely
to skip the prose but less likely to skip a grammar, and the prose is there
because that's the best way to describe things.

- "Items" covers the material previously in "Items", "Declarations",
"Facts", and "Rules".

Clauses

- Added an overview of Mercury semantics.

- "Goals" covers the same material as before, but I have rearranged the
order of the goals so as to avoid forward references, and to put more
commonly used goals earlier.

- "Expressions" covers the material previously in "Data-terms" and its
subsections. The expressions are (mostly) collected into one table, but
field access expressions are kept separate as they require a bit more
explanation. I've used an anchor on this separate bit, however, so maybe
it should be in a section that follows Expressions (i.e., Expressions
should say "see next section for details" or whatever).

- "State variables", "Variable scoping", "Implicit quantifiaction", and
"Elimination of double negation" are kept largely as is.

- "Definite Clause Grammars" is added which collects all the information
relating to DCGs.

Other changes
-------------

- Names now include sequences of graphic chars and a single semicolon,
which is what our parser actually allows.

- Use hyphens in meta-variables rather than underscore, per the texinfo
guidelines.

- Explain that operators are a syntactic concept and you need to import
a module to get, e.g., arithmetic operations. Point out the user defined
operator in the prose rather than in a footnote. And fix the formatting
of that table!

- Try to use a more consistent writing style.
2022-09-12 23:37:26 +10:00
Julien Fischer
3362159147 Fix Mantis bug #558.
Mmakefile:
    Ensure that the mercury_{compile,profile} executables exist
    *before* attempting to build the manual pages.

doc/Mmakefile:
    Rebuild the mprof.1 manual page if the profiler options.m
    file changes.
2022-04-21 19:34:00 +10:00
Zoltan Somogyi
b8b845a568 Fix mmakefile rules for os,cs,css,javas.
The main objective of this change is to get bootchecks in the csharp
and java grades to actually build the slice, profiler, deep_profiler
and mfilterjavac directories, which (due to the bug this diff fixes)
they weren't doing before.

However, since one side effect of this change is to eliminate
one source of annoying warnings from mmake about references to undefined
variables, a subsidiary objective is to eliminate other sources of such
warnings as well, which mostly come from the rules for making tags files.

browser/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
    When creating stage 3, the bootcheck builds, in each directory,
    only the files that it wants to compare against their stage 2 versions.
    This means that it wants to build all the .c, .cs or .java files,
    which it does via the cs, css and javas mmake targets.

    The correct definitions of the rules of these targets depends on
    whether mmc --make is being used or not, so we need at least two
    sets of definitions: one for mmc --make, and for no mmc --make,
    and conditionally selecting the appropriate one. The latter definition
    has the problem that it refers to mmake variables that are intended
    to be defined in .dv files created by mmc --generate-dependencies,
    but until that has been run, those mmake variables are undefined.

    Until now, the only directories that had both the mmc --make
    and the no mmc --make definitions were the ones needed to build
    the compiler. Bootchecks in the csharp and java grades, which
    always use --make make, got errors when they tried to build
    the directories that bootcheck builds after the compiler:
    the slice, profiler, deep_prof and mfilterjavac directories.

    This diff ensures that all directories we build in bootcheck
    get all both versions of the os, cs, css, and javas targets.
    In fact, they get two subversions of the no mmc --make version:
    one for use in the presence of .dv files, and one for use in their
    absence. The latter just builds the .dv files and invokes mmake
    again. This avoids one source of warnings about undefined mmake
    variables.

    To avoid another source, make the rules for tags files and their
    proxies depends on *.m instead of mmake variables such as $(mcov.ms),
    since this makes sense even before making dependencies. The only price
    is that any untracked Mercury source files in the directory have to
    either be given some other suffix, or moved somewhere else.

    Where relevant, make the mtags invocation prefer the master versions
    of files that are copied from the mdbcomp directory to other directories,
    since this is the only writeable version.

    Make the os and cs rules consistently NOT build the _init.[co] files.
    The way we use those files in bootcheck, we never need them;
    when we need them, the right target to give is the executable anyway.

    In the slice directory, don't put mcov between mtc_union and mtc_diff.

    Eliminate unnecessary duplication, e.g. of sources in rules.

    Eliminate double negatives in conditionals.

    Fix formatting.

Mmake.common.in:
bindist/Mmakefile:
bytecode/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
grade_lib/Mmakefile:
robdd/Mmakefile:
samples/Mmakefile:
scripts/Mmakefile:
tools/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
    Add "ft=make" to vim modelines. This is redundant for the files whose
    names is Mmakefile, but it is needed for Mmake.common.
2020-04-11 20:10:38 +10:00
Peter Wang
10d29a489a Generate better man pages.
doc/make_manpage:
    Replace the old script with a new version written in awk.

    The new output should be an improvement in these ways:
      - works for tools that use spaces for indentation instead of tabs
      - uses macros for indenting proportional font text
        instead of monospace text with inconsistent leading spaces
      - option names are in bold
      - removes redundant blank lines

doc/Mmakefile:
    Adjust command line to call the new make_manpage script.

compiler/options.m:
    Minor formatting changes to --help text to keep complexity of
    make_manpage script low.

profiler/mercury_profile.m:
    Add "Name:" line to --help output for make_manpage to read.

scripts/mtags.in:
    Add "Name:" line to --help output for make_manpage to read.

    Delete initial blank line in help and usage text.

    Delete stray full stop.

scripts/mprof_merge_runs:
scripts/parse_ml_options.sh-subr.in:
    Simplify --help text for make_manpage.
2019-05-28 15:54:45 +10:00
Peter Wang
355fb9b693 Install stub mdb_doc if makeinfo/info are not available.
doc/mdb_doc_stub.txt:
    Add a stub file.

doc/Mmakefile
    Copy the stub file if mdb_doc cannot be generated.
2019-05-28 10:28:48 +10:00
Paul Bone
e0360210c8 Don't install .in files with info files
doc/Mmakefile:
    As above.
2017-03-28 16:40:21 +11:00
Zoltan Somogyi
93fea7de37 Address Julien's review comments about the new warnings.
compiler/options.m:
doc/user_guide.texi:
    Change the option --warn-no-stream-calls to --warn-implicit-stream-calls.

    Add a new option, --inhibit-style-warnings, that does what its name says.

    Fix the old option --inhibit-warnings, which was missing code to turn off
    a significant number of warning options.

    Document where new options may need changes. This may help avoid problems
    such as non-updates to --inhibit-warnings when new warning options are
    added.

NEWS:
    Change the announcement of --warn-no-stream-calls to refer to its new name.

    Announce --inhibit-style-warnings.

    Announce --warn-non-contiguous-decls and --warn-inconsistent-pred-order*
    as well, since the diff that added them did not do so.

compiler/simplify_goal_call.m:
compiler/simplify_info.m:
compiler/simplify_tasks.m:
    Change the compiler-internal names that used to refer to
    --warn-no-stream-calls to refer to its new name instead.

tests/warnings/Mercury.options:
    Specify the new name of --warn-no-stream-calls for the test of the
    option's functionality.

doc/Mmakefile:
    Make doc/mmc.1 depend on compiler/options.m, since if that changes,
    then the help message that mmc.1 is derived from may have changed as well.
2016-10-15 22:54:34 +11:00
Sebastian Godelet
e8eeb55d91 Quote documentation commands for Windows.
doc/Mmakefile:
    Quote TEXI2DVI, DVIPS, PDFTEX, MAKEINFO commands since they are resolved
    to absolute path names in configure.ac. This causes problems on Windows
    since MikTex is by default installed in %ProgramFiles%, which contains
    spaces on an English Windows version.
2016-10-14 15:36:07 +11:00
Julien Fischer
92c9a1fe4b Fix github issue #34: make uninstall leaves files behind.
Don't accidently strip the ".exe" extension from the deep profiler executables
on Windows when installing them.  (Deep profiling doesn't really work on
Windows, which is why this hasn't been noticed until now.)

compiler/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
     Add an uninstall target in these directories.

     Delete a stray reference to the IL backend.

deep_profiler/Mmakefile:
     Fix the issue mentioned above w.r.t the ".exe" extension.

     We install mdprof_cgi in (potentially) two locations, make
     sure we (attempt to) uninstall them both.

     Update the uninstall target to handle the other executables in
     this directory.

doc/Mmakefile:
     Make the uninstall target remove the manual pages.

Mmakefile:
     Invoke uninstall targets in directories where we previously didn't.
2016-01-28 22:06:13 +11:00
Zoltan Somogyi
d33273d033 Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.

*/Makefile:
*/Mmakefile:
    As above.

tests/hard_coded/.gitignore:
    Don't ignore the purity subdir. This ignore must have been left over
    from when purity.m was a test in hard_coded, not hard_coded/purity,
    and it ignored an executable, not a directory.
2015-01-08 22:07:29 +11:00
Zoltan Somogyi
a9208b47a8 Specialize ALL calls to string.format and io.format.
Previously, we specialized calls to string.format and io.format only if
the format string specified no flags, widths, precisions or non-default
bases for any conversion. We now specialize calls to those predicates
regardless of the format string. To make this possible, we now have two
copies of the code to parse format strings.

library/string.parse_runtime.m:
    This new module, carved out out library/string.format.m, contains
    one of those copies. As the name suggests, this copy is used by
    the runtime system.

compiler/parse_string_format.m:
    This new module contains the other copy. As its location suggests,
    this copy is used by the compiler. The separate copy is necessary
    because the compiler's parsing needs are different from the runtime's.

    The main reason for the separation is that the compiler needs to be
    able to handle cases where widths and predicates are given by manifest
    constants, as well as when they are given by the values of variables
    at runtime (when the format string contains conversion specifiers
    such as "%*d"). Having the runtime handle this extra complexity
    would have inevitably increased the runtime's format string interpretation
    overhead, which is undesirable.

    The other reason is that compiler can afford to postprocess the result
    of the parsing in order to avoid having to concatenate two or more
    constant strings at runtime.

library/string.parse_util.m:
    Types and predicates that are common to the library and compiler copies
    of the format string parsing code.

compiler/format_call.m:
    We used to check whether format strings match the supplied list
    of values to be printed by invoking string.format on dummy inputs
    of the supplied types, and seeing whether you got an exception.
    We now call parse_string_format.m instead. Not only does this
    avoid shenanigans with exceptions (which the deep profiler cannot
    yet handle), but it also allows us to specialize all calls
    to string.format and io.format. We therefore do so.

    We used to specialize calls to io.format by creating a single string
    to be printed (using the machinery needed to specialize calls to
    string.format), and then printing that. This did unnecessary memory
    allocations to hold the intermediate strings. We now simply print
    each component one after the other, which avoids this overhead.

library/string.format.m:
    Add versions of the predicates that print chars, strings, ints and floats
    that are specialized to each possible situation about whether the caller
    specifies a width and/or a precision. This means that format_call.m
    doesn't have to generate code that allocates cells on the heap.

    Remove the code that was moved to new submodules of string.m.

compiler/simplify_proc.m:
    List the predicates in string.format.m that the compiler
    may generate calls to in the list of such predicates that we maintain
    to prevent dead_pred_elim from deleting them before format_call.m
    gets a chance to do its work.

compiler/module_imports.m:
    If the code of the module calls a predicate named "format" that
    may refer to string.format or io.format, then implicitly import
    the modules that contain the types and predicates that the code
    generated by format_call.m will refer to. Note that since this
    module_imports.m works on Mercury code that has not been module
    qualified yet, we have to use a conservative approximation.

    Reorganize the way we discover what library modules we have to
    implicitly import. Instead of a separate boolean for each piece
    of functionality that needs an implicit import, put them together
    into a structure. Due to Peter's work on argument packing some
    years back, this is now more efficient as well as more convenient
    that passing around a bunch of booleans. Also switch to passing
    around the structure as an accumulator, instead of having to do
    bool.ors all over the place.

    Since the code for computing the list of modules to be implicitly
    imported can sometimes add a library module to the list twice,
    sort that list and remove any duplicates.

    To make this possible, remove the version of the main predicate
    that appends the implicitly imported module names to a list of
    module names passed by our caller, since we don't want to sort
    THAT list of module names.

    Give the remaining version of that predicate that does this
    a name that better matches the names of related predicates.

compiler/modules.m:
    Conform to the change in module_imports.m. Mark some suspicious code
    with XXXs.

    Remove some redundant comments.

compiler/options.m:
doc/user_guide.texi:
    Add a new option that tells format_call.m what it should do
    when it finds more than one problem with a format string: whether
    it should print a message only for the first problem, or for all
    the problems. (The default is the latter.)

library/MODULES_DOC:
    A list of the all the Mercury source files in the library that
    should be included in the user guide.

library/MODULES_UNDOC:
    A list of the all the Mercury source files in the library that
    should NOT be included in the user guide.

library/library.m:
    Include the new publicly visible new submodule of string.m,
    (string.parse_util). And both string.parse_util and string.parse_runtime
    (which is NOT visible from outside string.m) to the list of modules
    in the Mercury standard library.

    Update the rules for where new library modules should be documented
    to account for non-publically-visible submodules, which we haven't had
    before. Document the need to include new modules in either MODULES_DOC
    or MODULES_UNDOC.

mdbcomp/builtin_modules.m:
    Provide convenient access for format_call.m to the names of the
    submodules of string.m that it needs access to.

library/Mmakefile:
    Add a new target, check_doc_undoc, which checks whether any source files
    are missing from MODULES_DOC or MODULES_UNDOC.

doc/Mmakefile:
    Read the list of modules to be documented from MODULES_DOC. This replaces
    old code that tried to list all the undocumented modules, but missed one:
    it referred to erlang_conf.m instead of erlang_builtin.m.

    When creating the library documentation, filter out any lines that
    contain the string NOTE_TO_IMPLEMENTORS. We now use this mechanism
    to include reminders to implementors in what would otherwise be a
    publically visible part of string.m.

tools/bootcheck:
    Copy MODULES_DOC and MODULES_UNDOC to the stage 2 and 3 library
    directories, since the check_doc_undoc target, which is invoked by
    "make all" in the library directory, needs them.

compiler/hlds_out_module.m:
    When dumping out the table of types, dump out discriminated union types
    in a style that follows our recommended coding style.
2014-11-25 12:46:08 +11:00
Zoltan Somogyi
50c1e04480 Carve two submodules out of string.m.
There are no algorithmic changes, though there are some name changes.

library/string.format.m:
    New submodule of string.m. Contains the parts of old string.m
    that implement string.format. About 1500 lines.

library/string.to_string.m:
    New submodule of string.m. Contains the parts of old string.m
    that implement string.string, string.string_ops and
    string.string_ops_noncanon. About 500 lines.

library/string.m:
    Replace the code that is now in the new submodules with includes
    of those submodules.

library/library.m:
    List the two new submodules. Fix some bitrot about where
    new library modules may need to be listed.

doc/Mmakefile:
    Do not document the two new submodules, since they are implementation
    details.
2014-11-10 14:31:51 +11:00
Zoltan Somogyi
7e1cdb70aa 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.
2014-01-22 09:31:37 +11:00
Paul Bone
6751f00167 Refactor clean Mmake targets in doc/
doc/Mmakefile:
    Refactor the clean targets in the doc/ directory.  Now it is very clear
    that the 'realclean' and 'distclean' targets do the same thing, and
    'distclean' is only removes a few additional things than 'clean' does.

    This will reduce the chance of problems similar to the one affecting the
    table of contents' in the PDF documents.
2013-10-05 11:51:59 +10:00
Paul Bone
27f8a25f85 Fix problems with building PDF documentation
The PDF documents were sometimes generated without their tables of contents.
This could happen if for some reason there was no .toc file but the .dvi
file still existed.  The Mmakefile would not run texi2dvi which would
normally produce a toc file if the .dvi file already existed, this caused
pdftex to fail to include the table of contents in the generated PDF file.

This was common as distclean deleted the .toc file but did not delete the
.dvi file, so this commonly happened when generating documentation from a
source distribution tarball as we do for the webpage.

This change causes distclean to also delete the .dvi files.

doc/Mmakefile:
    As above

    Also make library.dvi depend upon library-menu.texi_pp
    and library-chapters.texi_pp
2013-10-05 11:45:58 +10:00
Julien Fischer
d14755a20a Delete out-of-date file references in doc directory.
doc/Mmakefile:
    Delete references to files that no longer exist.
2013-06-24 12:17:27 +10:00
Paul Bone
adee55a8dc More support for building the documentation for the website.
doc/Mmakefile:
    Exit and report an error if the VERSION is "DEV".

    Add clean targets

    Make several other changes so that 'mmake webpage.tar.gz" works after
    "mmake distclean".
2013-04-12 14:25:04 +10:00
Paul Bone
84dccffaf4 Build the documentation for the website in the main repository
Add support (actually there was some existing but unused support here
already) for building the documentation parts of the website within the doc/
directory of the main repository, rather than within the www repository
(which had to checkout the main repository).  This makes it easy to build
the documentation and upload it to the webserver, as the webserver has
limited resources.

doc/Mmakefile:
    As above.
2013-04-11 22:31:54 +10:00
Julien Fischer
d118a89c8c Don't include the now empty relation and svrelation modules
Branches: main

doc/Mmakefile:
	Don't include the now empty relation and svrelation modules
	in the libary documentation.
2012-07-04 14:23:36 +00:00
Julien Fischer
638d8bb35c Don't include the now empty graph and group modules in the
Branches: main

doc/Mmakefile:
	Don't include the now empty graph and group modules in the
	library documentation.
2012-07-04 11:09:03 +00:00
Zoltan Somogyi
a0bc277d60 Fix a performance problem in liveness. Liveness makes many calls to
Estimated hours taken: 12
Branches: main

Fix a performance problem in liveness. Liveness makes many calls to
divide_by_set, but the existing implementation of that predicate in
tree_bitset.m did not exploit the structure of its operands.
After this diff, it now does so, though not yet to the fullest extent
possible. However, even this is enough to reduce the time needed
to compile a variant of the zm_rcpsp_cpx.m stress test from 66 seconds
to 15, with liveness analysis no longer being the bottleneck.
On tools/speedtest, we get about a 0.4% speedup, which is just
above the noise threshold.

library/tree_bitset.m:
	Specialize the implementation of divide_by_set for many of
	the possible cases. Leave XXXs where further specialization
	is possible.

	Put some predicate definitions in a more logical order.

compiler/test_bitset.m:
	This module has long been used (initially by Simon Taylor, later
	by me) to test the correctness of the implementation of first
	sparse_bitset.m and later tree_bitset.m. However, since it
	slows down all set operations a lot (by doing them twice, once using
	a bitset module and once using set_ordlist, and then comparing
	the results), it is never enabled in production compilers,
	and since it is usually not imported by any ordinary compiler
	modules, it is rarely even compiled. It has thus tended to
	get bitrot; changes in the set modules it uses need corresponding
	changes in this module, but it has not been getting them.

	To fix this, move this module from the compiler directory to the
	library directory. By including the moved version in the library,
	it will always be compiled, and anyone who breaks it will have
	to fix the breakage before checking in their change.

	The cost is about 16 kilobytes in the Mercury library's .so file,
	which is well worth it.

library/test_bitset.m:
	The moved module. It had to be updated to compile and work
	with the current versions of tree_bitset.m and set_ordlist.m.

library/library.m:
	Include the moved module in the library.

doc/Mmakefile:
	Since the moved module is only for the implementors of the bitset
	modules, do not include it in the documentation.

	Sort the names of the modules that are not included in the
	documentation.

tests/hard_coded/test_tree_bitset.{m,exp}:
	Make this module, which tests the operation of tree_bitset.m,
	both more thorough and more controllable.

	Make it more thorough by testing it not just with some toy sets
	and some small random sets as inputs, but also with some inputs
	specifically designed to be stress tests. These are taken from
	the old tree_bitset_difference test case.

	Make it more thorough in another way by also testing the divide_by_set
	operation.

	Make it more controllable by making it easy to test just one operation
	(for me now, that was of course divide_by_set), without the distraction
	of outputs from tests of other operations.

tests/hard_coded/tree_bitset_tester.m:
	This module used to do the job of test_bitset.m for test_tree_bitset.m.
	This was needed while test_bitset.m was in the compiler directory,
	but it is not needed now, and keeping it presents a double maintenance
	problem. This diff therefore deletes it, and makes test_tree_bitset.m
	use test_bitset.m from the library.

tests/hard_coded/tree_bitset_difference.{m,exp}:
	Delete this test case. The stress test inputs it used to test the
	difference operation with are now in test_tree_bitset.m, which
	uses them to test not just the difference operation, but other
	operations as well.

tests/hard_coded/test_bitset.{m,exp}:
	Delete this test case, since it seems to be a duplicate of an early
	version of tree_bitset_tester.m. Despite its name, it was NOT a copy
	of the identically named module that used to be in the compiler
	directory.

tests/hard_coded/Mmakefile:
	Remove the now unneeded tree_bitset_difference and test_bitset
	test cases from the list of test cases.
2012-03-29 04:03:12 +00:00
Julien Fischer
b13989c75f Fix bug #173 in Mantis. The manual page for mmc in the source distribution
Branches: main, 11.07

Fix bug #173 in Mantis.  The manual page for mmc in the source distribution
contains an error message reporting that the Mercury.config file cannot be
found.

doc/Mmakefile:
	Tell mmc not to look for the standard library
	(which implies --no-mercury-configuration-directory)
	when building the manual pages.
2011-08-18 17:19:25 +00:00
Julien Fischer
8c82c3cce2 Delete predicates from the standard library that were deprecated in Mercury
version 0.13.  (All of the following are still supported in version 10.04.)

library/io.m:
	Delete predicates that were marked as obsolete in version 0.13.

	Delete the binary_stream/1 type class and it's instances.
	They are no longer needed (and were only ever required to supported
	predicates that were deprecated.)

library/bitmap.m:
library/version_bitmap.m:
	Delete the obsolete get/2 predicates.

library/store.m:
	Delete an empty interface section.

library/term_to_xml.m:
	Delete obsolete predicates.

library/bintree.m:
library/bintree_set.m:
	Delete the contents of these modules - I haven't deleted the files
	themselves in case we wish to re-use them.

library/library.m:
	Remove the bintree* modules from the stdlib.

doc/Mmakefile:
	Ignore the bintree*.m files when generating the library guide.

tests/valid/lazy_list.m:
	Don't import bintree_set (and a couple of other unused modules).
2010-07-30 13:16:48 +00:00
Paul Bone
69d7f49841 Fix bug #153.
Branches: main, 10.04

Fix bug #153.

An empty table of contents (TOC) would be generated in the PDF version of the
user's guide.  This is caused when the user_guide.pdf make rule is executed
before the user_guide.dvi_log rule.  pdftexi executes tex only once, therefore
it is not able to generate the TOC.  Executing the .dvi_log rule before the
.pdf rule solves this problem because texinfo (used to create the .dvi) runs
tex the correct number of times.

doc/Mmakefile:
    Make %.dvi_log a dependency of %.pdf so that pdftex can use the TOC
    generated by texinfo.

doc/texinfo.tex:
    Update the version of texinfo, the existing version was from 1999.  Some
    users reported having invalid TOCs when using older versions of texinfo.
2010-07-03 08:05:23 +00:00
Zoltan Somogyi
190764a083 Fix some usability problems in the deep profiler.
Estimated hours taken: 8
Branches: main

Fix some usability problems in the deep profiler.

deep_profiler/exclude.m:
	Provide a better, more explicit representation of the contour exclusion
	file. This representation allows the application of contour exclusion
	even if the contour exclusion file contains some unrecognized module
	names. This is useful, because some modules of the Mercury standard
	library, such as profiling_builtin and mer_std, are unrecognized.
	They are unrecognized because either they export no predicates,
	or because deep profiling is turned off for them.

deep_profiler/query.m:
	Make a provision for controlling the number of a procedure's callers
	displayed at a time.

deep_profiler/create_report.m:
	Take advantage of the new capabilities listed above.

deep_profiler/display_report.m:
	When listing a procedure's callers, print any warning messages
	generated at startup about recognized modules.

	When listing a procedure's callers, list the application of contour
	exclusion among the links only if contour exclusion is in fact
	applicable.

	When listing a procedure's callers, allow the user to control how
	many callers are shown at a time. Make the default bunch size 20,
	instead of previous hardwired (and too small) 5.

	Fix some counterintuitive behavior. When clicking on one of the fields
	in the header of a table, in all but one of the displayed reports, this
	sorts the data being displayed on the selected column. The exception
	was top_procs, in which it changed the criterion on which the top_procs
	were selected, and thus changed the procedures being displayed as well.
	This diff eliminates the exception. The links in the header cells now
	do the expected thing, obeying the law of least astonishment. The
	criterion for selected what procs are top can still be changed using
	the already existing (and previously mostly redundant) links below
	the table.

deep_profiler/startup.m:
	Look for contour exclusion files not in Deep.data.contour, but in
	Deep.contour, since this is more consistent with what we do for other
	auxiliary files, like Data.procrep.

	Make the reading of the exclusion file and the program representation
	file part of the normal startup process, instead of setting their
	fields to dummies and filling them in with real values later.

	If there is a program representation file, make sure that the names
	of the modules in it are not unrecognized by contour exclusion.

	Fix a minor old bug: don't count the time spent reading Deep.contour
	as part of the propagation pass.

	Print meaningful messages (to the log file in /var/tmp) about
	any problems in reading Deep.contour files.

deep_profiler/apply_exclusion.m:
deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
deep_profiler/profile.m:
deep_profiler/report.m:
	Conform to the changes above.

doc/user_guide.texi:
	Document contour exclusion, and to make this possible, expand
	considerably the documentation of the deep profiler as a whole.

doc/Mmakefile:
	Ensure that invocations of latex cannot hang waiting for user input.
2009-10-02 04:38:22 +00:00
Julien Fischer
5fd597822b Add G12's backjump module to the standard library.
Estimated hours taken: 1.5
Branches: main

Add G12's backjump module to the standard library.
This will not be inlcuded in the library documentation or announced until
more of the XXXs have been dealt with.

I've included a diff between the G12 version of the backjump
module and this one below.

library/backump.m:
	A module (from G12) that provides support for backjumping.
	There are a number of minor modifications from the G12 version in
	order to make this compile in .par and .profdeep grades but it is
	otherwise unchanged.

library/library.m:
	Include the new module.

doc/Mmakefile:
	Do not include the backjump module in the library reference guide
	for now.

tests/hard_coded/Mmakefile:
tests/hard_coded/backjump_test.{m,exp}:
	Test backjumping (from the G12 nogood example.)
2008-03-09 09:39:25 +00:00
Peter Wang
45a52d3346 Ignore exit status of texi2dvi' for systems with texi2dvi' but not
Estimated hours taken: 0
Branches: main

doc/Mmakefile:
	Ignore exit status of `texi2dvi' for systems with `texi2dvi' but not
	TeX.
2007-12-18 04:28:53 +00:00
Leon Ilario Mika
8ee87e0ec2 New module for handling STM transactions.
Estimated hours taken: 18
Branches: main

library/stm_builtin.m:
	New module for handling STM transactions.

library/library.m:
	Add stm_builtin to the list of standard library modules.

library/exception.m:
	Added try_stm, which is like try_io but with STM state.

doc/Mmakefile:
	Don't list stm_builtin in the documentation.
2007-08-22 06:40:58 +00:00
Julien Fischer
389ddb37d3 Update Mmakefile in doc directory.
Esimated hours taken: 0
Branches: main

Update Mmakefile in doc directory.

doc/Mmakefile:
	Don't include erlang_conf.m in the library reference manual.

	Clean up any *.dvi_log files created.
2007-08-03 06:36:58 +00:00
Julien Fischer
1fce1dfc8b Work around one of the problems that is preventing the documentation
being installed on the webpage.  (Most of the others are gone since
we moved the webserver from ceres to earth.)

doc/Mmakefile:
	Disable building the ps version of the documentation while
	problems building it are resolved.  This has been stopping
	the documentation being installed on the website in other
	formats.
2007-07-03 08:43:06 +00:00
Julien Fischer
10bbd5ed4b Add a new builtin module that defines a type and some predicates that
Estimated hours taken: 0.5
Branches: main

Add a new builtin module that defines a type and some predicates that
will be introduced by RBMM transformation.  These are all just
placeholders at the moment.

library/region_builtin.m:
	Add a new builtin module that contains types and predicates
	that will be used by RBMM.

library/library.m:
	Import the new module.

	Unrelated change: delete the commented out clause of
	mercury_std_library_module/1 for the unsafe module.
	(The unsafe module was deleted from the standard library
	after trace goals were introduced.)

doc/Mmakefile:
	Don't include region_builtin.m in the library reference manual.
2007-06-12 03:22:25 +00:00
Julien Fischer
8cfc1e2cc4 Exclude the Erlang RTTI implementation from the library
Estimated hours taken: 0.1
Branches: main

doc/Mmakefile:
	Exclude the Erlang RTTI implementation from the library
	reference manual.
2007-06-01 14:23:43 +00:00
Julien Fischer
09c2dbc643 Delete references to unafe.m so that has been removed.
doc/Makefile:
	Delete references to unafe.m so that has been removed.
2007-03-27 02:31:59 +00:00
Julien Fischer
9a9d56918a Cleanups for the rtree module.
Estimated hours taken: 2
Branches: main

Cleanups for the rtree module.
There are no changes to any algorithms.

library/rtree.m:
	Add a reference to the paper by Guttman that is the basis of this
	implementation.

	Conform more closely to our coding standards.

doc/Mmakefile:
	Include the rtree documentation in the library reference guide.
2006-10-23 05:37:22 +00:00