Commit Graph

2 Commits

Author SHA1 Message Date
Zoltan Somogyi
d692bb674f Move the rest of mode_errors.m to use error_util.
Estimated hours taken: 8
Branches: main

Move the rest of mode_errors.m to use error_util.

compiler/mode_errors.m:
	The parts of this module that generate error messages (as opposed to
	progress messages) now all return a description of the error to a
	central place for printing by error_util.m. This should make it
	significantly easier to add new error messages.

compiler/error_util.m:
	Add the new capability to support mode_errors.m: that of describing
	in one data structure a sequence of calls to write_error_pieces.

compiler/hlds_out.m:
	Given a bunch of existing predicates that print various things,
	provide versions that convert those things to strings, for use
	in mode_errors.m.

	Write_unify_context had two versions for printing and only one version
	for conversion to pieces; add the second version for conversion to
	pieces. Change the order of arguments of the five-argument version
	of write_unify_context to allow the use of state variables.

compiler/mercury_to_mercury.m:
compiler/prog_out.m:
	Given a bunch of existing predicates that print various things,
	provide versions that convert those things to strings, for use
	in hlds_out.m and mode_errors.m.

compiler/det_report.m:
	Conform to the changed argument order of write_unify_context.

library/term_io.m:
	Fix an old bug: the code of add_escaped_char wasn't actually doing
	any escaping. hlds_out.m now relies on it doing so.

tests/hard_coded/xmlable_test.m:
	Due to the bugfix in term_io.m, string__string now protects &s with
	backslashes; expect this.

tests/invalid/*.err_exp:
	Expect mode error messages in the new, better format.
2005-08-22 03:55:23 +00:00
Ian MacLarty
42ec572494 Add a new method to convert terms to XML using a typeclass.
Estimated hours taken: 6
Branches: main

Add a new method to convert terms to XML using a typeclass.
The new method is more flexible than the previous method in that values can be
converted to arbitrary elements with arbitrary attributes and children
(the previous method mapped a functor to one element with limited attributes).
DTDs cannot be automatically generated using the new method.

library/term_to_xml.m:
	Update the documentation to describe the new method.
	Divide the interface into two parts -- one for the new method and
	one for the old method.
	Rename some function symbols and variables of the old method to
	distinguish them from names used in the new method.
	Implement predicates for writing terms that are members of the xmlable
	typeclass.

tests/hard_coded/Mmakefile:
tests/hard_coded/xmlable_test.exp:
tests/hard_coded/xmlable_test.m:
	Test the new method.

tests/hard_coded/write_xml.m:
	Use attr_from_source instead of attribute.
2005-07-29 01:57:00 +00:00