Commit Graph

67 Commits

Author SHA1 Message Date
Peter Wang
066c0b738c Fix value of maybe_string option when negated.
library/getopt.m:
library/getopt_io.m:
    Fix bug where a negation option (--no-foo) would set the value of a
    maybe_string option to maybe_int(no) instead of maybe_string(no)
    in the option table.
2022-11-08 15:19:38 +11:00
Julien Fischer
e7d28ff90f Update copyright notices in stdlib.
library/*.m:
    As above.
2022-06-07 21:51:03 +10:00
Zoltan Somogyi
8ff61f8a4b Delete quotes from `VarNames' in stdlib comments.
In the Mercury standard library, every exported predicate or function
has (or at least *should* have) a comment that documents it, including
the meanings of its arguments. About 35-40% of these modules put `'s
(left and right quotes) around the names of the variable representing
those arguments. Some tried to do it consistently (though there were spots
with unquoted or half quoted names), while some did it only a few places.
This is inconsistent: we should either do it everywhere, or nowhere.
This diff makes it nowhere, because

- this is what the majority of the standard library modules do;
- this is what virtually all of the modules in the compiler, profiler,
  deep_profiler etc directories do;
- typing all those quotes when adding new predicates in modules that
  follow this convention is a pain in the ass; and because
- on many modern terminals, `' looks non-symmetrical and weird.

Likewise, the comment explaining a predicate often started with

    % `predname(arguments)' returns ...

This diff deletes these quotes as well, since they add nothing useful.

This diff does leave in place quotes around code fragments, both terms
and goals, where this helps delineate the boundaries of that fragment.
2022-03-07 11:49:00 +11:00
Zoltan Somogyi
c57c726bd5 Make getopt work in three separate phases.
library/getopt_io.m:
    Split the work of the predicates that process command line argument lists
    into three passes:

    - The first pass separates option args from nonoption args, and record
      which options the option args are set (and to what values, if relevant).

    - The second, optional pass replaces mentions of file_special options
      with the contents of the files they name, including any file_special
      options in them, and so on.

    - The third pass takes the final list of option values from which all
      file_special options have been expanded, and uses them to update
      the option table, applying any special option handlers as needed.

    The point of this is that in several places in the compiler, we sometimes
    want to make changes to the operation of just one of these passes, e.g.
    by adding options from a Mercury.options file to an argument list.
    Doing it the old way works, but it is hard to understand and to modify.

    Add a check for an error we have not tried to detect before: when
    a file named in a file_special option contains to an option list
    that specifies, directly or indirectly, a file_special option for
    that same file. Without the new check, the result would be an infinite
    repetition of the same file_special expansion over and over again.

    Use named types and insts for the frequently used higher order constructs
    used by this module.

    Add inst-preserving versions of cord operations that getopt*.m now need.
    To avoid having to export the implementation type of cords from cord.m,
    duplicate the type, and the few needed operations on it, here.

library/getopt.m:
    Copy the changes from getopt_io.m.

NEWS:
    Mention the new exported predicates.

compiler/handle_options.m:
    Use the new functionality in getopt.m to simplify some code.

    This is just one such place; several others should come later.

compiler/mercury_compile_main.m:
    Conform to the change in handle_options.m.
2022-01-09 08:43:16 +11:00
Zoltan Somogyi
1e296f2411 Replace bools and maybes with bespoke types.
And give some variables more descriptive names.
2022-01-02 10:06:33 +11:00
Zoltan Somogyi
cbe41a1ca9 Make an inst's functor list follow its type's order. 2021-07-18 23:07:40 +10:00
Zoltan Somogyi
0b9b4b862b Mention deletion of _se predicate variants. 2020-10-22 17:58:44 +11:00
Zoltan Somogyi
409cbcb6a3 Unify getopt.m and getopt_io.m ...
... using an approach proposed by Peter, with an extra twist from Julien.

Instead of having two modules, getopt.m and getopt_io.m, with the former
defining predicates that do not take an I/O state pair, and the latter
defining predicates that do take an I/O state pair, put both kinds of
predicates into a single module. The versions with an I/O state pair
have an "_io" suffix added to their names for disambiguation.
Both versions are a veneer on top of a common infrastructure,
which relies on a simple type class to implement the operation
"give the contents of the file with this name". The predicate versions
with I/O state pairs have a normal implementation of this typeclass,
while the predicate versions that do not have I/O state pairs
have an implementation that always returns an error indication.

The above change just about doubles the number of exported predicates.
We already had two versions of most exported predicates that differed
in whether we returned errors in the form of a string, or in the form
of a structured representation, with names of the latter having
an "_se" suffix. Since we agreed that the structured representation
is the form we want to encourage, this diff deletes the string versions,
and deletes the "_se" suffix from the predicate names that used to have them.
(It still remains at the end of the name of a type.) This "undoubling"
should offset the effect of the doubling in the previous paragraph.

Eventually, we want to have just one module, getopt.m, containing
the updated code described above, but for now, we put the same code
into both getopt_io.m and getopt.m to prevent too big a shock to
people with existing code that uses getopt_io.m.

library/getopt.m:
library/getopt_io.m:
    Make the changes described above.

library/Mmakefile:
    Instead of building both getopt_io.m and getopt.m from getopt_template,
    build getopt.m from getopt_io.m.

tools/bootcheck:
    Delete references to getopt_template.

compiler/typecheck_errors.m:
    When a type error involves one of the getopt/getopt_io predicates
    whose interfaces are changed by this diff, tell the user about
    how these changes could have caused the error, and thus what the
    probable fix is.

compiler/handle_options.m:
browser/parse.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
tests/hard_coded/space.m:
    Use the updated getopt interface.

compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/deforest.m:
compiler/det_report.m:
compiler/format_call.m:
compiler/globals.m:
compiler/goal_expr_to_goal.m:
compiler/make.build.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/ml_top_gen.m:
compiler/module_cmds.m:
compiler/op_mode.m:
compiler/optimization_options.m:
compiler/options.m:
compiler/write_module_interface_files.m:
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
    Replace references to getopt_io.m with references to getopt.m.

tests/invalid/getopt_io_old.{m,err_exp}:
tests/invalid/getopt_old.{m,err_exp}:
tests/invalid/getopt_old_se.{m, err_exp}:
    New test cases for the extra help

tests/invalid/Mmakefile:
    Enable the new test cases.
2020-10-09 19:30:46 +11:00
Zoltan Somogyi
0beac98b61 Minor documentation improvements.
compiler/notes/c_coding_standard.html:
    Describe module header comments just once, not twice.
    Expand on what may be in such comments.

    Fix some oversights. For example, until now we didn't say that
    a developer needs git (!), and we didn't say where the definitions,
    as opposed to declarations, of any global variables exported from
    a module should go.)

    Improve the wording of several explanations.

    Make some lists of things into item lists.

    Expand tabs.

compiler/notes/glossary.html:
    Describe what HLDS, LLDS and MLDS mean in more detail.

compiler/notes/overall_design.html:
    Delete the reference to the long-deleted analysis directory.

compiler/notes/allocation.html:
compiler/notes/reviews.html:
compiler/notes/upgrade_boehm_gc.html:
    Fix indentation.
2020-09-19 04:48:00 +10:00
Zoltan Somogyi
08a1591d15 Copy improvements to getopt_io.m to getopt.m.
library/getopt_io.m:
    As above.

library/getopt.m:
library/getopt_io.m:
    Minor changes to things like variable names to remove unneeded
    differences between these two files.

    The only differences now remaining are those that relate to:

    - the name of the module, e.g. in error messages,
    - the presence of an I/O state pair in getopt_io.m, and
    - the file_special option kind, which is why getopt_io.m needs
      the I/O states.

library/Mercury.options:
    Enforce the match between definition order and declaration order
    for getopt.m as well.
2020-09-09 04:20:08 +10:00
Zoltan Somogyi
69a9bc93df Put code in right order. 2020-07-31 23:29:49 +10:00
Zoltan Somogyi
044407edb2 Improve programming style a bit. 2018-06-26 17:24:40 +02: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
Zoltan Somogyi
d9e576a2b2 Specify the type for inst definitions.
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
library/*.m:
mdbcomp/*.m:
ssdb/*.m:
    Specify the type constructor for every inst definition that lists
    the functors that values of that type may be bound to.

    In library/maybe.m, delete the inst maybe_errors/1, because
    (a) its name is misleading, since it is for the maybe_error/1 type (no s),
    and (b) there is already an inst with the non-misleading name maybe_error
    which had an identical definition.

    In compiler/dep_par_conj.m, delete two insts that were duplicates
    of insts defined in hlds_goal.m, and replace references to them
    accordingly.
2017-11-08 16:54:18 +11:00
Zoltan Somogyi
44f9f1f405 Convert (C->T;E) to (if C then T else E). 2015-12-01 07:58:07 +11:00
Julien Fischer
74e3d35ae9 Fixes for library documentation.
library/pretty_printer.m:
library/getopt_io.m:
library/getopt.m:
	Fix typos.

library/array.m:
library/list.m:
library/queue.m:
library/version_array.m:
	s/Nth/N'th/ etc.
2015-01-14 13:49:44 +11:00
Zoltan Somogyi
7f9791aa26 Standardize divider line lengths in the library.
library/*.m:
    As above.

tool/stdlines:
    A new shell script to do the job.
2014-11-23 22:05:34 +11:00
Zoltan Somogyi
15abab79de Wrap some too-long lines in the library. 2014-11-03 21:03:26 +11:00
Julien Fischer
bed96b93ff Avoid module qualification in library interfaces where possible.
NOTE: this change does not affect the io module -- I've left that for a
separate change.

library/*.m:
	As per the recent change to the coding standard, avoid module
	qualification in library interfaces where possible.

	Reformat declarations and descriptive comments to better utilise
	any space freed up by the above.
2014-10-10 15:08:24 +11:00
Julien Fischer
e37d5c5eab Structured errors for getopt and getopt_io.
The getopt and getopt_io modules use strings to describe errors that occur
during option processing.  There are a couple of problems with doing this:

(1) it makes some assumptions about how client programs want to word, and to a
large extent, format these error messages.

(2) it assumes that the error messages are in English.

This diff changes the getopt and getopt_io modules to use structured
representations of errors instead of strings.  This structured representation
is defined by the new option_error/1 type.  We introduce new versions of the
various process_options predicates that are suffixed with "_se" (standing for
"structured error") that return values of type option_error/1 when an error occurs.
A new function, option_error_to_string/1, converts option_error/1 values into
the strings that the getopt and getopt_io modules previously generated.  The
existing process_options predicates are just wrappers around all of this for
the purposes of backwards compatibility.

The new option_error/1 type returns more information than existing error
messages require, for example, where possible we return both the element of the
option enumeration involved and a string giving the option as it actually
appeared on the command line.

library/getopt.m:
library/getopt_io.m:
	Add predicates and types for structured errors as described above.

	Group function clauses together with the corresponding predicate
	ones.

	Avoid unnecessary differences between these two modules in a few
	spots.

NEWS:
	Announce the above changes.
2014-06-16 12:12:33 +10:00
Julien Fischer
5d840bdd53 Fix some documentation errors.
library/getopt.m
library/getopt_io.m:
	The first argument of the long_option predicate is a string,
	not a character (as the comment in getopt.m as said since
	1996!)

README.MS-VisualC:
	Fix a doubled-up word.
2014-03-19 13:18:45 +11:00
Julien Fischer
9480a49274 Change the argument order of predicates in the sparse_bitset modules to make
Branches: main

Change the argument order of predicates in the sparse_bitset modules to make
it more conducive to the use of state variable notation.

Group function clauses together with the clauses for the corresponding
predicates.

library/sparse_bitset.m:
	As above.

library/digraph.m:
compiler/make.dependencies.m:
compiler/mode_robdd.equiv_vars.m:
compiler/mode_robdd.implications.m:
compiler/mode_robdd.tfeirn.m:
tests/hard_coded/bitset_tester.m:
tests/hard_coded/pprint_test.m:
tests/valid/loop_inv_bug.m:
	Conform to the above change.

library/digraph.m:
library/getopt.m:
library/getopt_io.m:
library/map.m:
	Remove dependencies on the svset module.

NEWS:
	Announce the above change.
2011-05-19 13:11:47 +00:00
Julien Fischer
9f68c330f0 Change the argument order of many of the predicates in the map, bimap, and
Branches: main

Change the argument order of many of the predicates in the map, bimap, and
multi_map modules so they are more conducive to the use of state variable
notation, i.e. make the order the same as in the sv* modules.

Prepare for the deprecation of the sv{bimap,map,multi_map} modules by
removing their use throughout the system.

library/bimap.m:
library/map.m:
library/multi_map.m:
	As above.
NEWS:
	Announce the change.

	Separate out the "highlights" from the "detailed listing" for
	the post-11.01 NEWS.

	Reorganise the announcement of the Unicode support.

benchmarks/*/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
extras/*/*.m:
mdbcomp/*.m:
profiler/*.m:
tests/*/*.m:
ssdb/*.m:
samples/*/*.m
slice/*.m:
	Conform to the above change.

	Remove any dependencies on the sv{bimap,map,multi_map} modules.
2011-05-03 04:35:04 +00:00
Julien Fischer
992d8da3b7 Document some details regarding getopt.
Estimated hours taken: 0.5
Branches: main

Document some details regarding getopt.

library/getopt.m:
library/getopt_io.m:
	Document that `--' terminates option processing and that the
	<option>=<arg> is accepted.

	Reformat some paragraphs to make better use of the available
	screen space.
2008-02-21 03:49:32 +00:00
Zoltan Somogyi
672f77c4ec Add a new compiler option. --inform-ite-instead-of-switch.
Estimated hours taken: 20
Branches: main

Add a new compiler option. --inform-ite-instead-of-switch. If this is enabled,
the compiler will generate informational messages about if-then-elses that
it thinks should be converted to switches for the sake of program reliability.

Act on the output generated by this option.

compiler/simplify.m:
	Implement the new option.

	Fix an old bug that could cause us to generate warnings about code
	that was OK in one duplicated copy but not in another (where a switch
	arm's code is duplicated due to the case being selected for more than
	one cons_id).

compiler/options.m:
	Add the new option.

	Add a way to test for the bug fix in simplify.

doc/user_guide.texi:
	Document the new option.

NEWS:
	Mention the new option.

library/*.m:
mdbcomp/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
	Convert if-then-elses to switches at most of the sites suggested by the
	new option. At the remaining sites, switching to switches would have
	nontrivial downsides. This typically happens with the switched-on type
	has many functors, and we treat one or two specially (e.g. cons/2 in
	the cons_id type).

	Perform misc cleanups in the vicinity of the if-then-else to switch
	conversions.

	In a few cases, improve the error messages generated.

compiler/accumulator.m:
compiler/hlds_goal.m:
	(Rename and) move insts for particular kinds of goal from
	accumulator.m to hlds_goal.m, to allow them to be used in other
	modules. Using these insts allowed us to eliminate some if-then-elses
	entirely.

compiler/exprn_aux.m:
	Instead of fixing some if-then-elses, delete the predicates containing
	them, since they aren't used, and (as pointed out by the new option)
	would need considerable other fixing if they were ever needed again.

compiler/lp_rational.m:
	Add prefixes to the names of the function symbols on some types,
	since without those prefixes, it was hard to figure out what type
	the switch corresponding to an old if-then-else was switching on.

tests/invalid/reserve_tag.err_exp:
	Expect a new, improved error message.
2007-11-23 07:36:01 +00:00
Julien Fischer
d5705a7be2 Remove a bug workaround in the the thread module.
Estimated hours taken: 0.5
Branches: main

Remove a bug workaround in the the thread module.

Misc. minor changes to library modules.

library/thread.m:
	Delete the workaround for the bug with foreign_import_module pragmas
	and sub-modules on the lowlevel backends.

library/deconstruct.m:
library/sparse_bitset.m:
library/varset.m:
	Delete duplicate imports.

library/io.m:
library/thread.semaphore.m:
	s/which/that/ in a spot.

library/prolog.m:
	Convert this module to 4-space indentation.

library/dir.m:
library/getopt.m:
library/getopt_io.m:
library/lexer.m:
	Fix some formatting so that it conforms to our current coding
	standard.
2007-03-21 22:30:27 +00:00
Julien Fischer
9cd94b5c72 Various minor cleanups and syntax updates for the standard library.
Estimated hours taken: 1
Branches: main

Various minor cleanups and syntax updates for the standard library.
There are no changes to any algorithms.

library/injection.m:
library/set.m:
library/sparse_bitset.m:
	Use promise_equivalent_clauses where appropriate.

library/set_ordlist.m:
library/set_unordlist.m:
	Convert these module to 4-space indentation:
		Convert these module to 4-space indentation

library/*.m:
	Convert some if-then-elses into switches.

	Remove unnecessary module qualification - this is related
	mainly to the breakup of std_util and the fact that on
	the 0.13 branche we had two versions of the all-solutions
	predicates.

	Various other style cleanups.

vim/syntax/mercury.vim:
	Highlight promise_equivalent_clauses appropriately.
2006-10-23 00:33:04 +00:00
Julien Fischer
e0f5ac47db Make it easier for vi to jump past the initial comments
Estimated hours taken: 0.1
Branches: main

library/*.m:
	Make it easier for vi to jump past the initial comments
	at the head of a module.
2006-04-19 05:18:00 +00:00
Julien Fischer
5e92224eec Improve the library reference manual by formatting the beginning of
Estimated hours taken: 0.2
Branches: main, release

library/*.m:
	Improve the library reference manual by formatting the beginning of
	library modules consistently.

library/integer.m:
	Fix some bad indentation.
2006-04-13 06:08:05 +00:00
Julien Fischer
459847a064 Move the univ, maybe, pair and unit types from std_util into their own
Estimated hours taken: 18
Branches: main

Move the univ, maybe, pair and unit types from std_util into their own
modules.  std_util still contains the general purpose higher-order programming
constructs.

library/std_util.m:
	Move univ, maybe, pair and unit (plus any other related types
	and procedures) into their own modules.

library/maybe.m:
	New module.  This contains the maybe and maybe_error types and
	the associated procedures.

library/pair.m:
	New module.  This contains the pair type and associated procedures.

library/unit.m:
	New module. This contains the types unit/0 and unit/1.

library/univ.m:
	New module. This contains the univ type and associated procedures.

library/library.m:
	Add the new modules.

library/private_builtin.m:
	Update the declaration of the type_ctor_info struct for univ.

runtime/mercury.h:
	Update the declaration for the type_ctor_info struct for univ.

runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
	Update the definition of MR_Univ.

runtime/mercury_init.h:
	Fix a comment: ML_type_name is now exported from type_desc.m.

compiler/mlds_to_il.m:
	Update the the name of the module that defines univs (which are
	handled specially by the il code generator.)

library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
	Conform to the above changes.  Import the new modules where they
	are needed; don't import std_util where it isn't needed.

	Fix formatting in lots of modules.  Delete duplicate module
	imports.

tests/*:
	Update the test suite to confrom to the above changes.
2006-03-29 08:09:58 +00:00
Julien Fischer
a4519ed079 Move the all-solutions predicates from the library module std_util into their
Estimated hours taken: 4
Branches: main

Move the all-solutions predicates from the library module std_util into their
own module, solutions.

Move semidet_fail, semidet_succeed, cc_multi_equal and dynamic cast from
std_util.m into builtin.m.

Add some more utility functions for performing determinism or purity casts.
(The later are primarily intended for use by solver implementors.)

library/std_util.m:
	Move the all-solutions predicates into their own module, solutions.m.
	For now there are (obsolete) forwarding predicates from this module to
	the new one.  The forwarding predicates will be included in the
	upcoming 0.13 release and then removed in later versions.

	Move semidet_succeed, semidet_fail, cc_multi_equal and dynamic_cast
	to builtin.m

library/solutions.m:
	New file.  This is the new home for the all-solutions predicates.
	This is pretty much cut and pasted from std_util (with module
	qualifiers updated accordingly).  I've rearranged the code in a more
	top-down fashion as per our current coding standard.

library/builtin.m:
	Move semidet_fail/0, semidet_succeed/0, cc_multi_equal/2 and
	dynamic_cast/2 to this module.

	Add semidet_true/0 and semidet_false/0 as synonyms for semidet_fail/0
	and semidet_succeed/0.

	Add impure_true/0 and semipure_true/0.  These are useful for performing
	purity casts, e.g. in solver implementations.

library/library.m:
	Add the new module.

NEWS:
	Announce the changes.

library/*.m:
	Update to conform to the above.

compiler/const_prop.m:
	Update evaluate_semidet_call/5 with the new module name for
	dynamic_cast.

compiler/*.m:
	Module qualify calls to solutions to either disambiguate them from the
	versions in std_util (where they weren't module qualified) or change
	the module qualifier where they were (to avoid warnings about calls to
	the now deprecated versions).

tests/debugger/declarative/solutions.*:
	Rename this module as the name conflicts with the new library module.

tests/debugger/declarative/solns.*:
	Renamed version of above (with updated expected output).

tests/debugger/declarative/Mmakefile:
	Handle the renamed version of the solutions test.

tests/debugger/all_solutions.m:
tests/debugger/declarative/args.m:
tests/debugger/declarative/library_forwarding.m:
tests/hard_coded/constant_prop_2.m:
tests/invalid/multisoln_func.m:
tests/invalid/one_member.m:
tests/invalid/promise_equivalent_claueses.m:
tests/valid/simplify_bug2.m:
tests/valid/solv.m:
	Update to conform to the above changes.

sample/solutions/*.m:
	Update to conform to the above changes.
2006-03-24 04:40:59 +00:00
Zoltan Somogyi
b293bd999d Replace __ with . as the module qualifier everywhere.
Estimated hours taken: 1
Branches: main

library/*.m:
	Replace __ with . as the module qualifier everywhere.

tests/hard_coded/test_injection.exp:
	Replace __ with . as the module qualifier in expected exceptions.
2006-03-07 22:23:58 +00:00
Zoltan Somogyi
57b8f436eb Convert to four-space indentation most of the library modules that
Estimated hours taken: 4
Branches: main

library/*.m:
	Convert to four-space indentation most of the library modules that
	weren't already indented that way. Use predmode syntax where possible.
	In some modules, shorten long lines by deleting module name prefixes.
	Fix departures from our coding standards.

	In some modules, simplify code, mostly using field names and/or state
	variables.

	There are no changes in algorithms, except for neg_list in integer.m.
2005-10-17 11:35:22 +00:00
Zoltan Somogyi
88c7539230 Import only one module per line, as we already do in the compiler
Estimated hours taken: 0.3
Branches: main

library/*.m:
	Import only one module per line, as we already do in the compiler
	directory.
2005-06-16 04:08:07 +00:00
Julien Fischer
1de1dbb394 Fix more typos in library documentation.
Estimated hours taken: 0.5
Branches: main

Fix more typos in library documentation.

library/builtin.m:
	s/wheiter/whether.

library/char.m:
	s/consise/concise/

library/getopt.m:
library/getopt_io.m:
	s/keept/keep/

library/int.m:
	s/expontiation/exponentiation/

library/ops.m:
	s/precendence/precedence/

library/robdd.m:
	s/efficent/efficient/

library/set_bbbtree.m:
	s/noticable/noticeable/

library/term_to_xml.m:
	s/funtor/functor/
	s/attrinutes/attributes/
	s/fuctor/functor/

library/version_array.m:
	s/incurr/incur/
2005-01-27 03:59:27 +00:00
Zoltan Somogyi
55740ee0a1 Add this new module as an extended variant of getopt.m.
Estimated hours taken: 2
Branches: main

library/getopt_io.m:
	Add this new module as an extended variant of getopt.m. The extension
	is support for file_special options, which read the contents of a file
	and act as the words in it had appeared on the command line. The
	intention is to use this facility to replace most of the options with
	which mmake currently invokes mmc in a workspace, whose clutter now
	takes up about ten lines per invocation.

	Since processing options may now involve accessing a file, the main
	predicate process_options now needs a pair of I/O state arguments.
	Since some places where one wants to process options do not have I/O
	states, we want to retain the old interface of process_options as well.
	Since it is not practical to parameterize a group of predicates to
	work both in the presence and in the absence of I/O states, I added
	the code in a new module. While most changes to option handling should
	be done to both getopt.m and getopt_io.m, I expect such changes to be
	few and far between, so I think overall the new module is the best
	solution.

library/getopt.m:
	Mention getopt_io.m.

	Fix some style issues.
2005-01-10 01:53:11 +00:00
Zoltan Somogyi
9c488dd2b3 A bunch of small improvements to the library.
Estimated hours taken: 4
Branches: main

A bunch of small improvements to the library.

library/getopt.m:
	Allow the determinism of the the option_defaults predicate
	passed by users to getopt__process_options to be multi as well as
	nondet. The natural determinism of such predicates is multi;
	the nondet determinism dates from before the time the compiler
	supported multi.

	Add a version of process_options that allows it to be run more
	than once (by allowing it to start with an option table returned
	by a previous invocation) and returns the set of options set by
	each invocation, so that the caller can tell which invocation
	(if any) has set any given option.

	Switch to 4-space indentation to reduce the number of bad line breaks.

library/svset.m:
	This new module svset makes it easier to work with sets in
	code that uses state variables. For every predicate in set.m that
	updates sets, svset.m contains a predicate doing the same thing
	with an argument order conducive to the use of state variables.

	This module is now used in getopt.m.

library/library.m:
	Mention the new module.

library/map.m:
library/tree234.m:
	Add new mode to map__map_foldl that I found I needed in elk.

library/map.m:
library/svmap.m:
	Apply type specialization to all the most frequently used predicates
	for updating maps.

NEWS:
	Mention the functionality in getopt.m, and the new module.

	Group all the items related to getopt.m.

browser/parse.m:
compiler/options.m:
profiler/mercury_profile.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
	Conform to the new determinism in getopt.m.
2004-12-16 03:17:30 +00:00
Julien Fischer
57bfcbfc65 Replace the deprecated syntax for :- inst and :- mode
Estimated hours taken: 0.5
Branches: main

library/array.m:
library/builtin.m:
library/getopt.m:
library/io.m:
library/list.m:
library/tree234.m:
	Replace the deprecated syntax for :- inst and :- mode
	declarations.
2004-07-19 04:36:13 +00:00
Zoltan Somogyi
a2bf36e49a This diff contains no changes in algorithms whatsoever.
Estimated hours taken: 4
Branches: main

This diff contains no changes in algorithms whatsoever.

browser/*.m:
compiler/*.m:
library/*.m:
	Replace old-style lambdas with new-style lambdas or with named
	procedures.
2003-11-05 03:17:49 +00:00
Fergus Henderson
c34816949d Fix a bug: it was not reporting an error when an argument value
Estimated hours taken: 0.75
Branches: main

library/getopt.m:
	Fix a bug: it was not reporting an error when an argument value
	was supplied for an option which should not take an argument.

	Also slightly improve some of the other error messages, e.g. for
	`--intval=foo' we now report "option `--intval' requires a numeric
	argument; `foo' is not numeric" instead of "option `--intval=foo'
	requires a numeric argument; `foo' is not numeric".
2003-03-03 06:13:40 +00:00
Simon Taylor
7597ca1e80 Allow reconfiguration of existing installations, for example
Estimated hours taken: 20
Branches: main

Allow reconfiguration of existing installations, for example
to use a different C compiler. The reconfiguration works
by making a new copy of the scripts and mercury_conf.h,
and storing them in a partial installation directory tree
which uses the libraries and executables from the existing
installation.

Use this method to configure binary distributions, rather
than using a cut down version of the configuration script,
to avoid code duplication and to handle the case where the
C compiler in use on the installation machine is different
than that used to build the binary distribution.

This is more robust than the previous method of using a different
C compiler, which was to set the MERCURY_C_COMPILER variable and
hope the different C compilers were compatible enough.

Mmakefile:
runtime/Mmakefile:
scripts/Mmakefile:
	Modify the `install' targets to store files needed to create
	a new configuration in $INSTALL_LIBDIR/reconf.

runtime/Mmakefile:
	Install mercury_conf.h in $INSTALL_LIBDIR/conf, rather than
	$INSTALL_LIBDIR/inc, so that it can be overridden by a
	different configuration.

scripts/mercury_config.in:
	Create a new configuration, by creating part of a Mercury
	source tree from the files stored in $INSTALL_LIBDIR/reconf,
	running configure, then copying the files into a partial
	installation tree.

scripts/Mmake.vars.in:
	Define ENABLE_DEEP_PROFILER, for use by bindist/bindist.Makefile.

	Define variables INSTALL_CONF_DIR (contains the files describing
	the configuration) and INSTALL_RECONF_DIR (contains files needed
	to reconfigure an installation).

configure.in:
	Add an option `--enable-reconfigure', for use by
	mercury_config.in.

	Don't look for runtime/mercury_wrapper.c when checking
	for the sources -- it isn't present when reconfiguring.
	Look for scripts/mmc.in instead.

	Look for the runtime headers in the installation hierarchy
	rather than the `runtime/' and `trace/' directories when
	reconfiguring.

	Output the help message for the `configure' script to
	`configure.help'.  This is included in the help message
	for `mercury_config'.

	Add new configuration variables CONFIG_PREFIX and CONFIG_LIBDIR,
	which are like PREFIX and LIBDIR except that they point
	to the configuration files, not the library files.
	In the normal case PREFIX and CONFIG_PREFIX will be the same.

bindist/bindist.INSTALL.in:
bindist/bindist.Makefile.in:
	Use mercury_config to configure binary distributions.

bindist/Mmakefile:
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
	Remove bindist.configure.in and bindist.build_vars.in.

compiler/options.m:
scripts/parse_ml_options.sh-subr.in:
scripts/mgnuc.in:
doc/user_guide.texi:
	Add an option `--mercury-config-dir', and an environment
	variable MERCURY_CONFIG_DIR, which tell the compiler and
	scripts where to find the configuration files for the
	installation.
	MERCURY_CONFIG_DIR is not documented because it should
	only be used by the scripts.

compiler/compile_target_code.m:
	Pass `--mercury-config-dir' to the scripts.

compiler/handle_options.m:
	Add `--c-include-directory $MERCURY_CONFIG_DIR/conf'.

library/getopt.m:
	Handle `maybe_string_special' options.

doc/user_guide.texi:
	Update the "Using a different C compiler" chapter.

NEWS:
	Document the changes.
2003-01-24 07:17:13 +00:00
Simon Taylor
80a116b61d Implement negation of accumulating options,
Estimated hours taken: 0.25
Branches: main

NEWS:
library/getopt.m:
	Implement negation of accumulating options,
	which empties the accumulated list of strings.
2002-01-15 07:19:07 +00:00
Simon Taylor
1f3dd4c83a Add a version of getopt__process_options which
Estimated hours taken: 0.5

library/getopt.m:
	Add a version of getopt__process_options which
	returns the option arguments. This is needed
	for `mmc --make'.
2001-11-13 13:53:32 +00:00
Fergus Henderson
b0d7ba35bf License under the LGPL rather than the GPL.
Estimated hours taken: 0.25

library/getopt.m:
	License under the LGPL rather than the GPL.  The use of the
	GPL here was accidental; this file was originally in the
	compiler directory, and I forgot to change the license when I
	moved it to the library directory.
2001-02-12 06:56:13 +00:00
Simon Taylor
dedcf29a30 Make the function versions of predicates appear in the
Estimated hours taken: 2.5

library/*.m
	Make the function versions of predicates appear in the
	Mercury Library Reference Manual.
2000-11-12 08:51:39 +00:00
Fergus Henderson
6a6e5495ed Ralph Becket <rwab1@cam.sri.com>'s changes to add functions for
Estimated hours taken: 6

library/pqueue.m:
library/assoc_list.m:
library/getopt.m:
library/bag.m:
library/bimap.m:
library/bintree.m:
library/bintree_set.m:
library/bt_array.m:
library/eqvclass.m:
library/graph.m:
library/group.m:
library/queue.m:
library/rbtree.m:
library/stack.m:
library/term.m:
library/varset.m:
library/tree234.m:
library/relation.m:
library/set.m:
library/set_bbbtree.m:
library/set_ordlist.m:
library/set_unordlist.m:
	Ralph Becket <rwab1@cam.sri.com>'s changes to add functions for
	the remaining output det predicates in a number of modules in the
	standard library.  Basically, for each

		:- pred f(in, ..., in, out) is det.

	he has added the declaration

		:- func f(in, ..., in) = out.

	and definition

		f(X1, ..., Xn) = Y :-
			f(X1, ..., Xn, Y).

	The changes were made using a mostly automatic process.
1999-10-30 04:16:13 +00:00
Andrew Bromage
22e4b130f8 Fix of documentation rot.
Estimated hours taken: 1

Fix of documentation rot.

library/getopt.m:
	Describe the different kinds of options that we support.
1998-09-18 07:00:24 +00:00
Fergus Henderson
7cb525fde3 Undo Zoltan's bogus update of all the copyright dates.
Estimated hours taken: 0.5

library/*.m:
compiler/*.m:
	Undo Zoltan's bogus update of all the copyright dates.
	The dates in the copyright header should reflect the years
	in which the file was modified (and no, changes to the
	copyright header itself don't count as modifications).
1998-01-23 12:33:43 +00:00
Zoltan Somogyi
9ae7acc593 Update all the copyright dates for 1998.
Estimated hours taken: 0.5

library/*.m:
	Update all the copyright dates for 1998.
1998-01-13 10:01:32 +00:00
Andrew Bromage
33f5ea2783 Added a new kind of option: maybe_int, to allow optional
Estimated hours taken: 1.0

library/getopt.m:
	Added a new kind of option: maybe_int, to allow optional
	arguments with integer values.  Also added
	getopt__lookup_maybe_int_option/3 to look up options of
	type maybe_int.

NEWS:
	Note the new option type.
1997-12-19 03:26:43 +00:00