Estimated hours taken: 60
User-guided type specialization.
compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/modules.m:
compiler/module_qual.m:
compiler/mercury_to_mercury.m:
Handle `:- pragma type_spec'.
compiler/prog_io_pragma.m:
Factor out some common code to parse predicate names with arguments.
compiler/hlds_module.m:
Added a field to the module_sub_info to hold information about
user-requested type specializations, filled in by make_hlds.m
and not used by anything after higher_order.m.
compiler/make_hlds.m:
For each `:- pragma type_spec' declaration, introduce a new predicate
which just calls the predicate to be specialized with the
specified argument types. This forces higher_order.m to produce
the specialized versions.
compiler/higher_order.m:
Process the user-requested type specializations first to ensure
that they get the correct names.
Allow partial matches against user-specified versions, e.g.
map__lookup(map(int, list(int)), int, list(int)) matches
map__lookup(map(int, V), int, V).
Perform specialization where a typeclass constraint matches a
known instance, but the construction of the typeclass_info is
done in the calling module.
Give slightly more informative progress messages.
compiler/dead_proc_elim.m:
Remove specializations for dead procedures.
compiler/prog_io_util.m:
Change the definition of the `maybe1' and `maybe_functor' types
to avoid the need for copying to convert between `maybe1'
and `maybe1(generic)'.
Changed the interface of `make_pred_name_with_context' to allow
creation of predicate names for type specializations which describe
the type substitution.
compiler/make_hlds.m:
compiler/prog_io_pragma.m:
Make the specification of pragma declarations in error
messages consistent. (There are probably some more to
be fixed elsewhere for termination and tabling).
compiler/intermod.m:
Write type specialization pragmas for predicates declared
in `.opt' files.
compiler/mercury_to_mercury.m:
Export `mercury_output_item' for use by intermod.m.
compiler/options.m:
Add an option `--user-guided-type-specialization' enabled
with `-O2' or higher.
compiler/handle_options.m:
`--type-specialization' implies `--user-guided-type-specialization'.
compiler/hlds_goal.m:
Add predicates to construct constants. These are duplicated
in several other places, I'll fix that as a separate change.
compiler/type_util.m:
Added functions `int_type/0', `string_type/0', `float_type/0'
and `char_type/0' which return the builtin types.
These are duplicated in several other places,
I'll fix that as a separate change.
library/private_builtin.m:
Added `instance_constraint_from_typeclass_info/3' to extract
the typeclass_infos for a constraint on an instance declaration.
This is useful for specializing class method calls.
Added `thread_safe' to various `:- pragma c_code's.
Added `:- pragma inline' declarations for `builtin_compare_*', which
are important for user-guided type specialization. (`builtin_unify_*'
are simple enough to go in the `.opt' files automatically).
compiler/polymorphism.m:
`instance_constraint_from_typeclass_info/3' does not need type_infos.
Add `instance_constraint_from_typeclass_info/3' to the
list of `typeclass_info_manipulator's which higher_order.m
can interpret.
NEWS:
doc/reference_manual.texi:
doc/user_guide.texi
Document the new pragma and option.
tests/invalid/Mmakefile:
tests/invalid/type_spec.m:
tests/invalid/type_spec.err_exp:
Test error reporting for invalid type specializations.
tests/hard_coded/Mmakefile:
tests/invalid/type_spec.m:
tests/invalid/type_spec.exp:
Test type specialization.
Estimated hours taken: 8
Add rot13 examples to the samples directory.
Note: Estimated time is time for contributors, mainly.
samples/README:
samples/c_interface/README:
Fix the README files, they were a little inaccurate in
describing some files and directories.
Estimated hours taken: 30
Modified files
--------------
samples/diff/Mmakefile:
Minor documentation update.
samples/diff/README:
samples/diff/TODO:
Update stuff that's now done, do a couple of minor wording
changes.
samples/diff/diff.m:
Fix case of identical filenames (which implicitly assumed
no_diff_implies_no_output). Add new match pass, call the
new diff algorithm.
samples/diff/diff_out.m:
Add --cvs-merge-conflict output style. Slight reorganisation
of top-level predicate. Lots of small fixes to use better
syntax (e.g. functional style for integer maths operations).
samples/diff/difftype.m:
Added first_mentioned_positions/3, last_mentioned_positions/3,
add_edit/4.
samples/diff/file.m:
Use io__read_line_as_string.
samples/diff/filter.m:
Minor syntax/wording changes.
samples/diff/options.m:
Update all the newly handled options.
New files
---------
samples/diff/myers.m:
New diff algorithm.
samples/diff/match.m:
New pass to match common lines in the files to be diffed.
Removed file
------------
samples/diff/lcss.m:
Functionality replaced by myers.m.
Estimated hours taken: 10
library/io.m:
library/io.nu.nl:
Implement io__read_line_as_string/{3,4}.
Also sneaked in here are some trivial whitespace fixes in some
of the pragma c_code which did not comply with our coding
standards (to do with type casting).
samples/cat.m:
samples/sort.m:
Use io__read_line_as_string.
tests/general/Mmakefile:
tests/general/read_line_as_string.exp:
tests/general/read_line_as_string.m:
Test case for io__read_line_as_string.
NEWS:
Mention the above change.
Estimated hours taken: 30
Modified files
--------------
samples/diff/README:
Info about this new version. Put the existing READMEs in
reverse order, so that they'll be in the most sensible order
for someone reading top-down.
samples/diff/Mmakefile:
Supply more detail about which bit of this program GCC 2.7.2
under Digital Unix 3.2 doesn't compile properly.
samples/diff/diff.m:
Slight reorganisation. Accept options, remove some high
coupling betweem diff__do_diff and lcss.m.
samples/diff/file.m:
Add support for attaching a filename to a file.
samples/diff/lcss.m:
Add more documentation, one slight performance improvement.
lcss__to_diff now works on the reversed LCSS, to avoid going
to the trouble of reversing it.
New files
---------
samples/diff/TODO:
Meaning should be obvious.
samples/diff/diff_out.m:
Replacement for diffs.m (which was never a very good name).
Now contains code to display a diff in lots more output
styles than previously supported.
samples/diff/difftype.m:
Replacement for lcsstype.m. Contains the type of a diff (but
not of an lcss, which is now local to lcss.m, hence the
renaming).
samples/diff/filter.m:
Contains code to filter a diff before being displayed. This
is only required if the user specified that they didn't want
to see part of the diff (e.g. with --ignore-blank-lines).
samples/diff/globals.m:
samples/diff/options.m:
Support for option handling.
Removed files
-------------
samples/diff/diffs.m:
Functionality moved to diff_out.m.
samples/diff/lcsstype.m:
Functionality moved to difftype.m.
Estimated hours taken: 0.1
extras/trailed_update/samples/interpreter.m:
New file. An example of the use of tr_store.m.
samples/interpreter.m:
Add pointer to extras/trailed_update/samples/interpreter.m.
extras/trailed_update/Mmakefile:
extras/trailed_update/samples/interpreter.inp:
extras/trailed_update/samples/interpreter.exp:
extras/trailed_update/samples/vqueens.exp:
New files. Some testing infrastructure.
Estimated hours taken: 0.1
Place various bits of sample code in the public domain.
extras/complex_numbers/samples/fft.m:
extras/graphics/samples/calc/calc.m:
extras/graphics/samples/maze/maze.m:
samples/ultra_sub.m:
place the source in the public domain.
samples/c_interface/simpler_c_calls_mercury/README:
samples/c_interface/simpler_c_calls_mercury/c_main.c:
samples/c_interface/simpler_c_calls_mercury/mercury_lib.m:
samples/c_interface/simpler_cplusplus_calls_mercury/README:
samples/c_interface/simpler_cplusplus_calls_mercury/cpp_main.cc:
samples/c_interface/simpler_cplusplus_calls_mercury/mercury_lib.m:
Update to use the new mercury_init() and mercury_terminate()
functions.
Estimated hours taken: 1
samples/c_interface/simpler_c_calls_mercury/README:
samples/c_interface/simpler_c_calls_mercury/c_main.c:
samples/c_interface/simpler_c_calls_mercury/mercury_lib.m:
samples/c_interface/simpler_cplusplus_calls_mercury/README:
samples/c_interface/simpler_cplusplus_calls_mercury/cpp_main.cc:
samples/c_interface/simpler_cplusplus_calls_mercury/mercury_lib.m:
Update to use the new mercury_init() and mercury_terminate()
functions.
Estimated hours taken: 3
Added a new sample program, e.m, and fixed some out-of-date
documentation.
samples/Mmakefile:
samples/e.m:
Sample program 'e' which calculates the base of natural
logarithms to lots of digits (if you're prepared to wait).
samples/README:
Added documentation for e.m, updated documentation for
samples/diff/* to reflect recent changes.
Estimated hours taken: 0.05
Minor documentation fix.
samples/diff/README:
It was, of course, not the fix which caused diff to bomb out,
it was the problem solved by the fix.
Estimated hours taken: 4
General cleanup and bug fix for diff. Features of this diff:
- Changed indenting so it more closely matches the
coding standard.
- Bug fix which was causing it to bomb out if the two
files were identical.
- Update to use unique arrays (array.m).
samples/diff/README:
Added something which resembles this log message.
samples/diff/Mmakefile:
Turned C optimisation off to get around a gcc 2.7.2 bug.
samples/diff/diff.m:
samples/diff/diffs.m:
samples/diff/file.m:
samples/diff/lcss.m:
samples/diff/lcsstype.m:
Changes detailed above.
samples/c_interface/simpler_c_calls_mercury:
Add new directory with new files README, c_main.c, Mmakefile,
and mercury_lib.m. These files demonstrate how to interface
to C using a C main() top-level rather than with a Mercury
main/2 top-level.
samples/c_interface/simpler_cplusplus_calls_mercury:
Same as above, but using C++ rather than C.
Estimated hours taken: 3
samples/c_interface/simpler_c_calls_mercury:
Add new directory with new files README, c_main.c, Mmakefile,
and mercury_lib.m. These files demonstrate how to interface
to C using a C main() top-level rather than with a Mercury
main/2 top-level.
samples/c_interface/simpler_cplusplus_calls_mercury:
Same as above, but using C++ rather than C.
Estimated hours taken: 0.25
samples/diff/lcss.m:
Fix a couple of singleton variable warnings by prepending `_'
to the name of a couple of unused variable.
Estimated hours taken: 0.5
Rename all the `Mmake' files as `Mmakefile'. This is necessary to
avoid confusion between `Mmake' and `mmake' on case-insensitive file
systems.
Estimated hours taken: 0.25
samples/c_calls_mercury/c_main.c:
The #include of "mercury_lib.h" should be the first #include,
because that includes "imp.h" which may define global
register variables that need to be declared before any
inline functions in other header files.
Estimated hours taken: 0.5
samples/c_interface/c_calls_mercury:
Update now that exporting semidet procedures works.
Add some examples of exporting functions.
Estimated hours taken: 0.25
samples/c_interface/c_calls_mercury/Mmake:
Remove the line "MCFLAGS=--no-optimize-dead-procs # XXX work-around
for compiler bug", since the bug it refers to has been fixed.
Estimated hours taken: 0.5
samples/diff:
Committed the changes sent by Marnix Klooster <marnix@worldonline.nl>.
His description of the changes:
The major changes I made were
* Moved code for manipulating and displaying diffs to a separate
module called diffs.m (and changed their calls in diff.m). The type
'lcss,' needed both by the rest of lcss.m and by diffs.m, was moved
to a new module lcsstype.m.
* Made lcss.m independent of files, and allowed it to process any kind
of list by adding polymorphism. (The file processing calls have
been moved to diff.m.)
* Added type synonyms 'pos' and 'segment' in diffs.m to clarify the
types. Renamed 'single_diff' to 'edit'.
* Added end-of-file match to the generated lcss, thereby allowing the
to_diff predicate to be simplified considerably.
* Numbered lists from 0 internally in the lcss-algorithm. This made
to_diff simpler still, but also forced changes in the diff-printing
part.
* Removed the swapping in find_lcss, because it doesn't seem to help.
* The array(string) representing a file in file.m was also renumbered
to begin with 0.
* Added and corrected comments.
Have fun,
<><
Marnix
--
Marnix Klooster
marnix@worldonline.nl