test/hard_coded/write_xml.m:
Document why the output differs between the low- and high-level C backends.
Fix odd argument ordering.
tests/hard_coded/write_xml.exp*:
Conform to the above change.
library/term_to_xml.m:
As above, this module had not been updated to cover the new builtin
integer types.
tests/hard_coded/write_xml.{m,exp,exp2}:
Extend this test case to cover the new integer types.
Document what the expected outputs correspond to.
runtime/mercury_ml_expand_body.h:
Until I changed the handling of foreign types a few days ago, all functor
names came from static data, and thus they could be returned to the callers
of deconstruct.deconstruct without being copied. However, the functor names
we now generate for foreign types come from a buffer that will be reused,
and so DO need to be copied, and they weren't. Fix this.
runtime/mercury_deconstruct.c:
Reserve a single static buffer for this purpose.
tests/hard_coded/write_xml.exp:
Update this expected output to expect the new correct output.
tests/hard_coded/write_xml.m:
Fix the indentation of the source code of the test.
runtime/mercury_float.c:
Fix a bug in MR_sprintf_float where it would convert 1.8e-10
into "1.80000000000000e-1" instead of "1.8e-10".
The problem was that it was stripping the zeros off the end of the string
produced by sprintf without considering the case where the output
was in scientific notation.
The fix is to remove the `#' from the sprintf format string and then to
append ".0" to the string if there is no "." or "e".
tests/general/float_roundtrip.m:
tests/general/float_roundtrip.exp:
Add regression test.
tests/hard_coded/deep_copy.exp:
tests/hard_coded/expand.exp:
tests/hard_coded/float_reg.exp:
tests/hard_coded/write.exp:
tests/hard_coded/write_binary.exp:
tests/hard_coded/write_reg1.exp:
tests/hard_coded/write_xml.exp:
Update the expected output of these tests as trailing zeros are now
also removed from the base part of scientific notation float strings.
Estimated hours taken: 2
Branches: main
runtime/mercury_ml_expand_body.h:
Construct strings representing c_pointer addresses. Used in the
implementation of functor and deconstruct.
library/deconstruct.m:
Document the behaviour of functor and deconstruct for c_pointers.
library/string.m:
Export c_pointer_to_string for getting a string representation
of the pointer address.
library/io.m:
library/rtti_implementation.m:
Use c_pointer_to_string/1 to print c_pointers.
Update comments.
library/pprint.m:
Undo Ralph's earlier change, since it is no longer required.
tests/debugger/Mmakefile:
tests/debugger/declarative/Mmakefile:
Canonicalize the output of test cases in which c_pointers appear.
tests:
Update the expected output of test cases.
Estimated hours taken: 1
Branches: main
In term_to_xml check that no functor arguments are existentially typed when
requested to generate a DTD.
Include field name attribute in generated XML.
library/term_to_xml.m
Use construct.get_functor to check that no functors of a type have
existentially typed arguments before generating a DTD for the type. If
there are existentially typed arguments then report this fact.
Set the field name attribute in generated XML. This previously didn't
work for existentially typed functor arguments, because of a bug in the
rtti, which has now been fixed (thanks to Zoltan).
Use `.' as module qualifier.
tests/hard_coded/write_xml.exp
tests/hard_coded/write_xml.exp2
tests/hard_coded/write_xml.m
Test attempt to generate a DTD for a functor with an existentially
typed argument. Test reporting of field name for an existentially
typed functor argument.
Estimated hours taken: 15
Branches: main
Allow custom functor to element mappings in term_to_xml library.
Disable setting of the `field' attribute in generated XML until a bug in the
runtime system has been fixed. The bug causes a seg fault when
construct.get_functor is called on a functor with an existentially quantified
argument type.
Add a check to see if a DTD can be generated for a type under a custom mapping
scheme. This involves checking that the mapping scheme does not generate the
same element for any two distinct functors that could appear in ground terms of
the type.
Also do not generate DTDs for types other than discriminated unions, arrays,
strings, ints, characters and floats since we cannot predict what the children
will be for other types (e.g. curried preds). Note that XML can still
be generated for any type deconstruct.deconstruct/5 can handle.
NEWS
Mention term_to_xml module.
extras/xml_stylesheets/xul_tree.xsl
Hide the field name by default (since we don't populate this attribute
at the moment).
Fix a bug where quotes were not being printed around strings.
The `typename' attribute has now become simply `type'.
library/term_to_xml.m
Allow custom functor to element mappings and include two predefined
mappings.
Do not call construct.get_functor when writing out an XML document so
that the previously mentioned runtime bug doesn't bite. This line of
code just needs to be uncommented - the line is responsible for getting
the field names of the arguments of a functor.
Check that a mapping scheme cannot assign the same element to
two different functors when a DTD is requested.
tests/hard_coded/write_xml.m
tests/hard_coded/write_xml.exp
Test custom and predefined mapping schemes.
Estimated hours taken: 60
Branches: main
Add library module to convert Mercury terms to XML documents and generate DTDs
for Mercury types.
There is a natural mapping from Mercury terms to XML documents since both are
tree structures. Each functor of a Mercury type is mapped to an element name
in the XML document. Extra information such as the original functor name, type
and field name are stored as attribute values.
Once a Mercury term is in XML it can be converted to many different formats
using the appropriate stylesheet. For example it could be converted to HTML
for a web server or converted to XUL to generate user interface components.
The advantage of this approach is that once the appropriate stylesheet has been
set up, generating HTML, XUL, MusicXML or whatever is as easy as generating a
Mercury term.
This library will be used to create a graphical term browser for mdb and
possibly browsable HLDS dumps.
extras/xml_stylesheets/README
extras/xml_stylesheets/mercury_term.xsl
extras/xml_stylesheets/xul_tree.xsl
Some example stylesheets. One to convert XML generate with the
to_xml library to a Mercury term and one to generate a XUL
term browser for viewing with Mozilla or Firefox.
library/library.m
Add to_xml.
library/to_xml.m
The to_xml module with predicates for generating XML for
Mercury terms and DTDs for Mercury types.
tests/hard_coded/Mmakefile
tests/hard_coded/write_xml.exp
tests/hard_coded/write_xml.m
Test to_xml predicates.