Commit Graph

263 Commits

Author SHA1 Message Date
Julien Fischer
5f6981c7de Delete ancient workaround for g++ 2.7.
samples/c_interface/cplusplus_calls_mercury/Mmakefile:
samples/c_interface/mercury_calls_cplusplus/Mmakefile:
samples/c_interface/simpler_cplusplus_calls_mercury/Mmakefile:
     As above.
2023-03-11 14:21:10 +11:00
Julien Fischer
0cd62edc7c Clean-ups and fixes for the C interface examples.
samples/c_interface/*:
    Replace left over references to the old c_header_code pragma.

    Replace some uses of '__' as a module qualifier.

    Replace tabs with spaces.

    Add some missing words.
2023-02-25 12:53:26 +11:00
Julien Fischer
51745bee09 Remove execute bit from a Makefile.
samples/c_interface/standalone_c/Makefile:
     As above.
2022-12-14 01:36:29 +11:00
Zoltan Somogyi
d481a42f59 Give each op class (infix, prefix etc) its own slot.
library/ops.m:
    Instead of an op_table mapping a string to a list of one or more op_infos,
    make it map the string to a single structure, the op_infos, which has
    four slots, one each for infix, binary prefix, prefix and postfix
    op information. This allows parsers and unparsers to go directly to
    the kind of operator (e.g. infix or prefix) that they are interested in.

NEWS:
    Announce the change.

compiler/parse_tree_out_term.m:
library/mercury_term_parser.m:
library/pretty_printer.m:
library/stream.string_writer.m:
library/string.to_string.m:
samples/calculator2.m:
tests/hard_coded/bug383.m:
    Conform to the change. In several places, the new operator representation
    allows the replacement of loops with direct lookups, and the replacement
    of if-then-else chains with switches.

    Add reminders about keeping two predicates in sync.
2022-11-14 13:46:22 +11:00
Zoltan Somogyi
c6d857cb6b Cleanups of ops-related code.
library/io.m:
    Delete the set_io_table predicate, which did nothing and was never
    called from anywhere, and the get_io_table predicate, which always
    returned the same op_table. They were in io.m's interface, but in the
    not-publicly-visible part of the interface.

library/ops.m:
    Rename the lookup_op method to is_op.

    Delete references to the predicates deleted from io.m.

NEWS:
    Announce the lookup_op->is_op rename.

compiler/parse_tree_out_term.m:
library/mercury_term_parser.m:
library/string.to_string.m:
library/term_io.m:
samples/calculator2.m:
tests/hard_coded/bug383.m:
    Conform to the lookup_op->is_op rename.

    Replace calls to get_io_table with code that directly gets
    the Mercury op table.

    In parse_tree_out_term.m, call the predicates operating on the
    Mercury op table directly, not through the op_table type class.

    In mercury_term_parser.m, update some comments.

    In term_io.m, use OpTable to refer to op_tables.

tests/hard_coded/stdlib_init.{m,exp}:
    Don't test get_io_table.
2022-11-12 12:53:07 +11:00
Zoltan Somogyi
4d15588c8b Address review comments.
NEWS:
    Mention that we do no longer accept : as module name separator.
    Improve wording.

extras/README.md:
    Document the new old_library_modules directory.

library/ops.m:
    Fix wording, and a dangling reference.

samples/calculator2.m:
    Update to use the new ops.m.
2022-11-12 01:36:32 +11:00
Zoltan Somogyi
de75b98b18 Make higher operator priorities bind tighter.
Mercury inherited its original system of operator priorities from Prolog,
because during its initial development, we wanted to be able execute
the Mercury compiler using NU-Prolog and later SICStus Prolog.
That consideration has long been obsolete, and now we may fix the
design error that gifted Prolog with its counter-intuitive system
of operator priorities, in which higher *numerical* operator priorities
mean lower *actual* priorities. This diff does that.

library/ops.m:
    Change the meaning of operator priorities, to make higher numerical
    priorities mean also higher actual priorities.

    This semantic change requires corresponding changes in any other module
    that uses ops.m. To force this change to occur, change the type
    representing priorities from being a synonym for a bare int to being
    a notag wrapper around an uint.

    The old "assoc" type had a misleading name, since it is related to
    associativity but is not itself a representation of associativity.
    Its two function symbols, which used to be just "x" and "y", meant that
    the priority of an argument must be (respectively) greater than,
    or greater than equal to, the priority of the operator. So rename
    x to arg_gt, y to arg_ge, and assoc to arg_prio_gt_or_ge.

    Rename the old adjust_priority_for_assoc predicate to min_priority_for_arg,
    which better expresses its semantics. Turn it into a function, since
    some of its users want it that way, and move its declaration to the
    public part of the interface.

    Add a method named tightest_op_priority to replace the use of 0
    as a priority.

    Rename the max_priority method as the loosest_op_priority method.

    Add a method named universal_priority to replace the use of
    max_priority + 1 as a priority.

    Add a function to return the priority of the comma operator,
    to allow other modules to stop hardcoding it.

    Add operations for comparing priorities and for incrementing/decrementing
    priorities.

    Change the prefix on the names of the predicates that take op_infos
    as inputs from "mercury_op_table_" to "op_infos_", since the old prefix
    was misleading.

    Add a note on an significant old problem with an exported type synonym.

library/mercury_term_parser.m:
    Conform to the changes above.

    Delete unnecessary module qualifiers, since they were just clutter.

    Add "XXX OPS" to note further opportunities for improvement.

library/pprint.m:
    Conform to the changes above.

    Rename a function to avoid ambiguity.

library/pretty_printer.m:
library/stream.string_writer.m:
library/string.to_string.m:
library/term_io.m:
    Conform to the changes above.

library/string.m:
    Add a note on an significant old problem.

NEWS:
    Announce the user-visible changes.

tests/hard_coded/bug383.m:
    Update this test case to use the new system of operator priorities.

tests/hard_coded/term_io_test.{m,inp}:
    Fix white space.

extras/old_library_modules/old_mercury_term_parser.m:
extras/old_library_modules/old_ops.m:
    The old contents of the mercury_term_parser and ops modules,
    in case anyone wants to continue using them instead of updating
    their code to use their updated equivalents.

samples/calculator2.m:
    Import the old versions of mercury_term_parser and ops.
2022-11-11 00:11:44 +11:00
Julien Fischer
78150cddd2 Minor fix for a sample.
samples/mcowsay.m:
   Print an empty speech / though bubble if there is nothing to be
   read on the standard input.
2022-06-16 20:50:56 +10:00
Julien Fischer
56946aa88a Simplify some code.
samples/mcowsay.m:
    Use io.read_file_as_string/4 in a spot instead of
    reading a file using the stream interface.
2022-06-16 13:41:42 +10:00
Julien Fischer
4c6c430c34 Add another sample: mcowsay.
samples/mcowsay.m:
    A Mercury version of the cowsay program. It serves an more extended
    example (but still small) example of how to write command line
    utilities in Mercury.

samples/README.md:
    Include the new sample.

samples/Mmakefile:
    Include the new sample.

    Put the list of sample programs in alphabetical order.
2022-06-16 13:33:53 +10:00
Julien Fischer
8ef9073be2 Delete remaining references to --use-trail-segments.
doc/user_guide.texi:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/tests/Mmakefile:
samples/solver_types/Mercury.options:
scripts/init_grade_options.sh-subr:
    As above.

RELEASE_NOTES_NEXT:
    Delete item concerning the above.
2022-04-18 21:45:15 +10:00
Julien Fischer
f3a34e4651 Replace uses of __ as a module qualifier.
samples/muz.zbstract.m:
tests/*/*.m:
    As above.
2022-04-14 20:25:10 +10:00
Julien Fischer
66c1448fb0 Fix spelling.
samples/interpreter.m:
    As above.
2022-03-30 18:02:08 +11:00
Julien Fischer
dd0a15409d Update the Mercury-Fortran interface example.
samples/c_interface/mercury_calls_fortran/Mmakefile:
    g77 was replaced by gfortran in GCC 4.0, use the latter in
    this example.

samples/c_interface/mercury_calls_fortran/fortran_main_int.m:
     Replace a ':- pragma import' with an equivalent foreign_proc.

     Describe the current gfortran name mangling scheme and delete
     references to g77 command line options not supported by gfortran.

samples/c_interface/mercury_calls_fortran/mercury_main.m:
     Replace tabs with spaces.
2022-03-28 15:24:16 +11:00
Julien Fischer
5f2aac88c3 Replaces calls to deleted predicates.
samples/concurrency/midimon/midimon.m:
     As above.
2022-03-25 23:32:50 +11:00
Julien Fischer
39ef38ad27 Replace call to io.see/4 in a sample.
samples/solver_types/sudoku.m:
    As above.
2022-03-25 12:34:12 +11:00
Julien Fischer
90ceef4065 Add missing interface declarations.
samples/c_interface/simpler_c_calls_mercury/c_main.m:
samples/c_interface/simpler_cplusplus_calls_mercury/cpp_main.m:
    As above.
2022-03-25 12:24:00 +11:00
Julien Fischer
a8eddabbf1 Fix description in samples README.
samples/REAMDE.md:
    Fix the description of the 'sort' sample, which hasn't actually
    reflected what that sample did since the description was added.
2022-03-06 14:42:36 +11:00
Julien Fischer
41d2622092 Fix compilation of samples/sort.m.
samples/sort.m:
   Replace use of io.see and io.tell with explicit streams.

   Use state variable notation in more spots.

   Simplify some code.
2022-03-06 02:49:37 +11:00
Julien Fischer
86825c0e0e Fix compilation of samples/expand_terms.
samples/expand_terms.m:
     Replace calls to the now deleted term_io.read_term/3.
2022-03-06 02:30:24 +11:00
Zoltan Somogyi
84223268a0 Delete the tests/general/interpreter test case.
tests/general/interpreter.{m,inp,exp}:
tests/general/Mmakefile:
    As above: delete this test case.

samples/interpreter.m:
    Delete reference to the deleted test case.

tests/debugger/interpreter.m:
    Delete reference to the deleted test case in this copy of
    samples/interpreter.m.

tests/debugger/interpreter.exp:
tests/debugger/interpreter.exp2:
    The last update of interpreter.exp was in 2003. The command we invoke
    this test case with has changed several times since then, but none
    of them have been reflected in interpreter.exp, so now there is no way
    for it to be matched. This diff deletes interpreter.exp, and renames
    the old interpreter.exp2 to become the new interpreter.exp.

tests/general/arithmetic.nl:
tests/general/interpreter.nl:
tests/general/string_test.nl:
    Delete these relics of the time when we compared output generated
    by Mercury to output generated by NU-Prolog, since NU-Prolog is long dead.

tests/general/arithmetic.m:
tests/general/string_test.m:
    Update programming style, and factor out common code.
2022-03-04 17:25:20 +11:00
Zoltan Somogyi
92f60e5c70 Standardize on one interpreter.m.
samples/interpreter.m:
    Make this the primary copy of interpreter.m. Incorporate the improvements
    from the other two versions in tests, and generalize them to be suitable
    as a sample program.

tests/debugger/interpreter.m:
tests/general/interpreter.m:
    Make these copies of the primary version.

tests/debugger/Mmakefile:
tests/general/Mmakefile:
    Keep the tests copies of the primary version.

tests/general/interpreter.exp:
    Expect an output now generated for parameter-less invocations.
2022-03-04 14:45:01 +11:00
Julien Fischer
01061532ab Add short example of Java interface.
samples/java_interface/short_example.m:
    A Java version of the short example.

samples/java_interface/README.md:
    Add an entry for the new example.

samples/c_interface/README.md:
samples/csharp_interface/README.md:
    Fix wording.
2022-01-20 03:42:56 +11:00
Julien Fischer
f23b80613a Adjust a C# interface example.
samples/csharp_interface/standalone_csharp/CSharpMain.cs:
    As above.
2022-01-16 02:50:17 +11:00
Julien Fischer
d8c0de2f38 More samples READMEs.
samples/csharp_interface/README.md:
    Add a README file for this subdirectory.

samples/java_interface/README:
    Rename this file to README.md; convert its contents
    to Markdown.
2022-01-15 23:54:35 +11:00
Julien Fischer
e40a502004 Fix casing of a heading.
samples/c_interface/README.md:
    Not sure why I made the heading all uppercase.
2022-01-15 23:35:49 +11:00
Julien Fischer
aa2380ff3f Convert another README to Markdown.
samples/c_interface/README:
    Rename to README.md and convert the contents to Markdown.
2022-01-15 23:32:42 +11:00
Julien Fischer
1702444cb1 Style and formatting fixes for Java interface samples.
samples/java_interface/java_calls_mercury/mercury_main.m:
samples/java_interface/mercury_calls_java/java_main_int.m:
samples/java_interface/standalone_java/JavaMain.java:
samples/java_interface/standalone_java/Makefile:
samples/java_interface/standalone_java/mercury_lib.m:
    As above.
2022-01-15 17:04:46 +11:00
Julien Fischer
6f5993dd1b Update samples/README.md.
samples/README.md:
     Include the recently C# interface subdirectory.
2022-01-15 16:23:42 +11:00
Julien Fischer
67112aef2b Add short example of C# interface.
samples/csharp_interface/short_example.m:
    A C# version of the C interface short example.
2022-01-15 03:38:14 +11:00
Julien Fischer
2c8675135a Add a standalone C# example.
samples/csharp_interface/standalone_csharp/CSharpMain.cs:
samples/csharp_interface/standalone_csharp/Makefile:
samples/csharp_interface/standalone_csharp/mercury_lib.m:
samples/csharp_interface/standalone_csharp/README.md:
     As above.
2022-01-15 03:28:09 +11:00
Julien Fischer
f417f4b21a Reword an entry in the samples README.
samples/README.md:
    As above.
2022-01-14 14:31:43 +11:00
Zoltan Somogyi
818d69a861 Minor improvements to .md files.
Convert extras/README to .md.
2022-01-07 14:54:00 +11:00
Julien Fischer
b4f3b65293 Update appengine example README file.
samples/appengine/README:
    The sample is no longer deployed on Ian's test instance
    (and probably hasn't been for many years).
2022-01-03 00:17:37 +11:00
Julien Fischer
8eef5d4088 Further work on samples directory README.
samples/README.md:
    Make the top-level heading a level 1 heading.

    Add eliza.m and beer.m to the list of sample programs.

    Fix spelling.
2022-01-03 00:13:08 +11:00
Julien Fischer
6495a31648 Fix a typo.
samples/README.md:
    As above.

samples/calculator.m:
    s/parser.m/mercury_term_parser.m/ in a comment.
2022-01-02 20:55:29 +11:00
Julien Fischer
4cebf83b6d Rename samples/README -> samples/README.md
samples/README:
    As above.
2022-01-02 17:02:14 +11:00
Julien Fischer
c3ef75d4d3 Convert samples/README to Markdown.
Convert the samples README file to Markdown.  The aim is to improve the way
this file appears when viewed in GitHub.

Fix a number of small errors.

samples/README:
    As above.
2022-01-02 17:00:59 +11:00
Julien Fischer
028637c95f Update a sample.
samples/calculator2.m:
   Conform to the parser -> mercury_term_parser renaming.
2021-12-31 12:39:12 +11:00
Zoltan Somogyi
a653024ab7 Update many aspects of style in sample programs.
If we want to encourage people to read the sample programs
and learn Mercury programming from them, they should not be written
in an obsolete style.

samples/beer.m:
samples/calculator.m:
samples/calculator2.m:
samples/concurrency/midimon/midimon.m:
samples/diff/diff_out.m:
samples/e.m:
samples/eliza.m:
samples/muz/dict.m:
samples/muz/higher_order.m:
samples/muz/muz.m:
samples/muz/typecheck.m:
samples/muz/word.m:
samples/muz/zabstract.m:
samples/muz/zlogic.m:
samples/muz/zparser.m:
samples/muz/ztoken.m:
samples/muz/ztoken_io.m:
samples/muz/ztype.m:
samples/muz/ztype_op.m:
samples/rot13/rot13_concise.m:
samples/rot13/rot13_gustavo.m:
samples/rot13/rot13_juergen.m:
samples/rot13/rot13_ralph.m:
samples/rot13/rot13_verbose.m:
samples/solutions/all_solutions.m:
samples/solutions/n_solutions.m:
samples/solutions/one_solution.m:
samples/solutions/some_solutions.m:
samples/solver_types/eqneq.m:
samples/solver_types/sudoku.m:
samples/solver_types/test_eqneq.m:
    Replace uses of __ as module qualifier with dot.

    Replace (C->T;E) with (if C then T else E).

    Use our usual indentation for if-then-elses and for switches.

    Import one module per line. Put those imports into alphabetical order.

    Replace many uses of DCGs with state variables, leaving DCGs
    mostly just for parsing code.

    Use predmode declarations where this helps.

    Put predicates in top-down order where relevant.

    Use io.format where this helps.

    Do not put more than one predicate call on one line.

    Put each function symbol in a du type on a separate line.

    Put spaces after commas, around the bar in list syntax,
    around arithmetic operators, and around minus signs used for pairs.

    Replace tab indentation with four-space indentation.

    Delete spaces at the ends of lines.
    Replace two or more consecutive blank lines with one blank line.
    Delete blank lines that do not help structure the code.

    There are probably still some examples of old practices remaining;
    I do not claim to have fixed them all.
2021-07-07 05:32:09 +10:00
Julien Fischer
fca4c918c8 Avoid potentially ambiguous pragmas in samples.
samples/muz/zparser.m:
    As above.
2021-06-19 20:37:10 +10:00
Peter Wang
8da4853b49 Update programs for getopt changes.
benchmarks/progs/icfp2000_par/main.m:
benchmarks/progs/mandelbrot/mandelbrot.m:
benchmarks/tools/log_to_r/log_to_r.m:
extras/align_right/align_right.m:
extras/error/error.m:
extras/gator/evolve.m:
extras/moose/options.m:
samples/concurrency/midimon/midimon.m:
samples/diff/diff.m:
samples/muz/muz.m:
    Conform to getopt.process_options now returning structured errors
    instead of strings.
2020-10-26 16:24:11 +11:00
Julien Fischer
f5fdc98426 Style updates for benchmarks and samples. 2020-05-20 17:06:20 +10:00
Julien Fischer
0d60fc826b Delete a duplicate import.
samples/muz/ztype.m:
    As above.
2020-05-18 16:01:27 +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
Zoltan Somogyi
4aed1a57e4 Print an arg type list diff for arg lists with wrong arity.
When a user writes a clause for a predicate (or function) that does not exist
with that arity, but does exist with one or more other arities, report not
just the list of the other arity/arities, but, for each such other arity,
a diff between the declared arg types and the inferred arg types.

After this diff, we generate output like this:

bad_pred_arity.m:027: Error: clause for predicate `bad_pred_arity.p'/4
bad_pred_arity.m:027:   without corresponding `:- pred' declaration.
bad_pred_arity.m:027:   However, predicates of that name do exist with arities
bad_pred_arity.m:027:   3 and 5.
bad_pred_arity.m:027: Inferred :- pred p(int, string, int, string).
bad_pred_arity.m:027:   The argument list difference from the arity 3 version
bad_pred_arity.m:027:   is
bad_pred_arity.m:027:     pred(
bad_pred_arity.m:027:         int,
bad_pred_arity.m:027:   +     string,
bad_pred_arity.m:027:         int,
bad_pred_arity.m:027:         string
bad_pred_arity.m:027:     )
bad_pred_arity.m:027:   The argument list difference from the arity 5 version
bad_pred_arity.m:027:   is
bad_pred_arity.m:027:     pred(
bad_pred_arity.m:027:         int,
bad_pred_arity.m:027:   -     float,
bad_pred_arity.m:027:         string,
bad_pred_arity.m:027:         int,
bad_pred_arity.m:027:         string
bad_pred_arity.m:027:     )

compiler/typecheck_errors.m:
    Generate the diff part of the message above.

compiler/typecheck.m:
    Invoke typecheck_errors.m when relevant.

compiler/error_util.m:
    When comparing two error_specs, switch from a two-level comparison
    (first the contexts of error_msgs, then everything else) to three levels
    first the contexts of error_msgs, then their error_msg_components,
    then everything else). This is needed to allow the error message from
    make_hlds_error.m (which reports the error and mentions the arities
    with which the named predicate or function does exist) come out before
    the informational message from typecheck.m that prints the inferred
    arg types and their differences from the other arities. (With the old
    comparison, the difference in severity would trump the invisible order
    components that this diff includes in both specs to force the desire
    order.)

    Base the code comparing error_specs on the code for comparing error_msgs.
    Move the two previously separate pieces code for those tasks next to each
    other.

compiler/make_hlds_error.m:
    Add the invisble ordering component.

    When we see clauses with two or more wrong arities for a given predicate
    or function, don't list the automatically created pred declaration
    for an *earlier* wrong-arity clause as a real declaration whose arity
    is to be listed in the error messages we generate for *later* wrong-arity
    clauses.

    Add some documentation.

compiler/add_pred.m:
    Factor out some common code.

library/edit_seq.m:
    A new module for computing diffs.

library/library.m:
library/MODULES_DOC:
    Add the new module to the standard library.

tests/hard_coded/edit_seq_test.{m,exp}:
    A new test case for the diff algorithm.

tests/invalid/bad_pred_arity.{m,err_exp}:
    A new test case for the new error message.

tests/hard_coded/Mmakefile:
tests/invalid/Mmakefile:
    Enable the new test cases.

tests/invalid/bigtest.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/bug278.err_exp:
tests/invalid/errors2.err_exp:
tests/invalid/invalid_binary_literal.err_exp:
tests/invalid/invalid_float_literal.err_exp:
tests/invalid/invalid_hex_literal.err_exp:
tests/invalid/invalid_main.err_exp:
tests/invalid/invalid_octal_literal.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/multisoln_func.err_exp:
tests/invalid/null_char.err_exp:
tests/invalid/state_vars_test3.err_exp:
tests/invalid/try_detism.err_exp2:
tests/invalid/typeclass_test_5.err_exp:
tests/invalid/typeclass_test_8.err_exp:
tests/invalid/unsatisfiable_constraint.err_exp:
tests/invalid_purity/impure_func_t3.err_exp:
    Update these files to expect error messages in the new order.

samples/diff/*.m:
    Fix comments, mostly by moving them to where our programming style
    wants them.
2019-01-03 08:57:20 +11:00
Paul Bone
a0f4980d9d Move unnecessary execute bits
extras/windows_installer_generator/sample/images/Exclam.ico:
extras/windows_installer_generator/sample/images/Info.ico:
extras/windows_installer_generator/sample/images/banner.bmp:
extras/windows_installer_generator/sample/images/bg.bmp:
samples/solutions/all_solutions.m:
samples/solutions/some_solutions.m:
    These files had their execute bit set unnecessarily.
2018-11-18 16:20:56 +11:00
Julien Fischer
e67afcbecd Initialise standard library in standalone Java example.
samples/java_interface/standalone_java/JavaMain.java:
     We need to initialise the standard library, otherwise things
     like the stream database won't be set up properly.
2018-11-09 16:48:45 +11:00
Mark Brown
d465fa53cb Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.

COPYING.LIB:
    Add a special linking exception to the LGPL.

*:
    Update references to COPYING.LIB.

    Clean up some minor errors that have accumulated in copyright
    messages.
2018-06-09 17:43:12 +10:00
Julien Fischer
e6e295a3cc Generalise the representation of integers in the term module.
In preparation for supporting uint literals and literals for the fixed size
integer types, generalise the representation of integers in the term module, so
that for every integer literal we record its base, value (as an arbitrary
precision integer), signedness and size (the latter two based on the literal's
suffix or lack thereof).

Have the lexer attach information about the integer base to machine sized ints;
we already did this for the 'big_integer' alternative but not the normal one.
In conjunction with the first change, this fixes a problem where the compiler
was accepting non-decimal integers in like arity specifications.  (The
resulting error messages could be improved, but that's a separate change.)

Support uints in more places; mark other places which require further work with
XXX UINT.

library/term.m:
     Generalise the representation of integer terms so that we can store
     the base, signedness and size of a integer along with its value.
     In the new design the value is always stored as an arbitrary precision
     integer so we no longer require the big_integer/2 alternative; delete it.

     Add some utility predicates that make it easier to work with integer terms.

library/term_conversion.m:
library/term_io.m:
     Conform to the above changes,

     Add missing handling for uints in some spots; add XXX UINT comments
     in others -- these will be addressed later.

library/lexer.m:
     Record the base of word sized integer literals.

library/parser.m:
compiler/analysis_file.m:
compiler/fact_table.m:
compiler/get_dependencies.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_util.m:
compiler/intermod.m:
compiler/make.module_dep_file.m:
compiler/parse_class.m:
compiler/parse_inst_mode_name.m:
compiler/parse_item.m:
compiler/parse_pragma.m:
compiler/parse_sym_name.m:
compiler/parse_tree_out_term.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_defn.m:
compiler/parse_util.m:
compiler/prog_ctgc.m:
compiler/prog_util.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/superhomogeneous.m:
mdbcomp/trace_counts.m:
samples/calculator2.m:
extras/moose/moose.m:
    Conform to the above changes.

tests/hard_coded/impl_def_lex.exp:
tests/hard_coded/impl_def_lex_string.exp:
tests/hard_coded/lexer_bigint.exp*:
tests/hard_coded/lexer_zero.exp*:
tests/hard_coded/parse_number_from_string.exp*:
tests/hard_coded/term_to_unit_test.exp:
    Update these expected outputs.
2017-04-22 11:53:14 +10:00