Commit Graph

19 Commits

Author SHA1 Message Date
Julien Fischer
03aa92fa34 Fix failure of hard_coded/write_xml with 32-bit MSVC.
tests/hard_coded/write_xml.m:
tests/hard_coded/write_xml.exp5:
     Add an expected output for 32-bit MSVC.
2023-07-15 01:33:25 +10:00
Julien Fischer
f999105ad4 Fix the failure tests/hard_coded/write_xml on Windows.
tests/hard_coded/write_xml.m:
tests/hard_coded/write_xml.exp4:
     Add an expected output for the low-level C grades on Windows.
2023-07-09 13:23:31 +10:00
Julien Fischer
0e980917e1 Fix the failure tests/hard_coded/write_xml on Windows.
tests/hard_coded/write_xml.m:
    Update the comment at the head of this module that explains the
    differences between the expected outputs.

tests/hard_coded/write_xml.exp3:
    Expected output for this test on in a high-level C grade on Windows.
2023-07-08 23:16:12 +10:00
Peter Wang
88047bbb45 Delete Erlang from tests.
tests/general/float_test.exp3:
tests/general/float_test.m:
tests/general/read_dir_regression.exp4:
tests/general/read_dir_regression.m:
tests/hard_coded/remove_file.exp2:
tests/hard_coded/remove_file.m:
    Delete Erlang backend specific expected outputs.

tests/hard_coded/Mmakefile:
tests/hard_coded/erlang_deconstruct.exp:
tests/hard_coded/erlang_deconstruct.m:
tests/hard_coded/existential_list.exp:
tests/hard_coded/existential_list.m:
tests/valid/Mmakefile:
tests/valid/erl_ite_vars.m:
tests/valid/zf_erlang_bug.m:
    Delete erlang target specific tests.

tests/*:
    Delete Erlang foreign procs and foreign types.
2020-10-27 11:10:11 +11:00
Julien Fischer
66c5c80fc6 Address review comments.
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.
2019-10-16 21:14:13 +11:00
Julien Fischer
88c16bcfa4 Handle all builtin types in library/term_to_xml.m.
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.
2019-10-16 17:35:14 +11:00
Zoltan Somogyi
4d276a6505 Fix a bug in deconstructing foreign types.
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.
2015-06-10 12:28:27 +02:00
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11: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
Peter Wang
417151ca01 Improve the C# backend.
Branches: main

Improve the C# backend.

C# foreign types remain commented out so as not to force an upgrade of the
bootstrap compiler yet.


compiler/handle_options.m:
        Enable static ground cells for C# backend.

compiler/ml_global_data.m:
        Make fields of static vector structures have `public' access.
        Local access doesn't make sense.

        Use structs to hold vector common data in C#.

        Conform to changes.

compiler/ml_proc_gen.m:
        Enable use_common_cells on C#.

        Conform to changes.

compiler/mlds.m:
        Rename `finality' to `overridability'.  The `final' keyword in Java
        has multiple meanings, so avoid that word.  Use the word `sealed'
        to describe classes or virtual methods which cannot be overridden,
        which is the keyword in C#.

compiler/ml_switch_gen.m:
        Remember the types of mlconst_foreign constants.  In the C# backend a
        foreign enum value needs to be cast to the right type.  For some
        reason, there was a field already which could be used for this purpose
        but was only ever set to mlds_native_int_type.

compiler/ml_type_gen.m:
        Replace ml_gen_final_member_decl_flags with
        ml_gen_const_member_decl_flags.  Return flags with the `sealed' flag
        unset, as that wouldn't make sense for member variables.

        Remember the type in mlconst_foreign.

compiler/ml_unify_gen.m:
        Remember the type in mlconst_foreign.

compiler/mlds_to_cs.m:
        Support static data in C#.

        Support foreign enumerations.

        Use the `default(T)' operator to initialise certain types of variables,
        particularly user-defined types, which the Mercury compiler may not
        know enumeration defined in another module, i.e. a value type, which
        cannot be initialised with `null'.

        Remove the requirement to add mark foreign types which are of value
        types with the "valuetype" prefix.

compiler/mlds_to_java.m:
        Write out the `final' keyword when either the `sealed' or `const' flags
        are set.

        Conform to changes.

compiler/rtti_to_mlds.m:
        RTTI data doesn't need the `sealed' flag set.

compiler/ml_code_util.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/ml_elim_nested.m:
        Conform to changes.

library/builtin.m:
        Export `comparison_result' to C# foreign code.

        Fix `deep_copy' for arrays.

library/bitmap.m:
library/pretty_printer.m:
library/store.m:
library/version_array.m:
library/version_hash_table.m:
        Implement these modules for C#.

library/io.m:
library/dir.m:
        Implement `dir.current_directory' for C#.

library/exception.m:
        Implement `catch_impl' for multi and nondet predicates.

library/rtti_implementation.m:
        Implement `get_typeclass_info_from_term' for C#.

library/string.m:
        Fix `string.set_char' for C#.

library/time.m:
        Delete now-unnecessary "valuetype" prefix on foreign type.

library/type_desc.m:
        Implement `make_type' for C#.

runtime/mercury_dotnet.cs.in:
        Collapse equivalences when comparing TypeInfo_Structs for equality.

tests/hard_coded/Mmakefile:
        Disable some tests in C# grade.

tests/hard_coded/ee_dummy.m:
tests/hard_coded/ee_valid_test.m:
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/exported_foreign_enum.m:
tests/hard_coded/export_test.m:
tests/hard_coded/external_unification_pred.m:
tests/hard_coded/float_gv.m:
tests/hard_coded/foreign_enum_dummy.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_name_mutable.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/hash_table_test.m:
tests/hard_coded/impure_init_and_final.m:
tests/hard_coded/intermod_poly_mode_2.m:
tests/hard_coded/loop_inv_test1.m:
tests/hard_coded/loop_inv_test.m:
tests/hard_coded/multimode.m:
tests/hard_coded/pragma_export.m:
tests/hard_coded/pragma_foreign_export.m:
tests/hard_coded/redoip_clobber.m:
tests/hard_coded/trace_goal_4.m:
tests/hard_coded/uc_export_enum.m:
tests/hard_coded/user_compare.m:
tests/hard_coded/write_xml.m:
        Make these test cases work on C#.

tests/hard_coded/deep_copy.exp3:
tests/hard_coded/expand.exp3:
tests/hard_coded/float_reg.exp3:
        Add expected results for C#.

tests/hard_coded/string_strip.exp2:
        Update this result, which was not updated when the test case changed
        previously.
2010-09-23 05:32:01 +00:00
Peter Wang
75771a9b6e Allow testing of java grade. Requires using `mmc --make' for now.
Branches: main

Allow testing of java grade.  Requires using `mmc --make' for now.
This patch does not attempt to fix test failures.

tests/Mmake.common:
        Delete unneeded Java-specific rule, which was broken.

tests/benchmarks/Mmakefile:
tests/general/Mmakefile:
tests/general/string_format/Mmakefile:
tests/grade_subdirs/Mmakefile:
tests/hard_coded/Mmakefile:
tests/recompilation/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
        Don't deliberately disable tests in java grade.

tests/*.m:
        Add Java foreign code.

        Write dummy procedures instead of abusing `:- external'.
2009-08-14 03:21:55 +00:00
Peter Wang
18658321b0 Disable solver type tests in non-C grades.
Estimated hours taken: 1
Branches: main

hard_coded/Mmakefile:
	Disable solver type tests in non-C grades.

	Disable C foreign interface tests in non-C grades.

	Disable C runtime option test in non-C grades.

valid/Mmakefile:
	Disable solver type tests in non-C grades.

	Disable C foreign interface tests in non-C grades.

	Delete stray `$' character.

hard_coded/foreign_import_module.m:
hard_coded/foreign_import_module_2.m:
valid/mert.m:
valid/solver_type_bug.m:
	Make these test cases work in Erlang

hard_coded/write_xml.m:
	Add Erlang foreign code (still fails for other reasons).
2007-09-17 07:16:09 +00:00
Ian MacLarty
3cba42d5cc Use the new stream typeclass in the term_to_xml standard library module.
Estimated hours taken: 5
Branches: main

Use the new stream typeclass in the term_to_xml standard library module.
In the process remove some clutter from the interface by marking as obsolete
the predicates that do not take a stream argument and remove the
"_to_stream" suffix from those predicates that do take a stream
argument.

library/term_to_xml.m:
	Use the stream.writer/3 typeclass where appropriate.

	Make all XML writer predicates require a stream argument
	and remove the "_to_stream" suffix from these predicates.

	Move all deprecated predicates to the end of the interface and
	pragma obsolete them.

	Reword some comments.

	Remove the behaviour of replacing "]]>" with "]]>" in CDATA
	elements, since that behaviour is a bit misleading, because ">"
	has no special meaning in CDATA.  Instead just document that "]]>"
	is not allowed in CDATA elements.

browser/browse.m:
tests/hard_coded/write_xml.m:
tests/hard_coded/xmlable_test.m:
	Conform to the above changes.
2006-10-30 07:20:57 +00:00
Zoltan Somogyi
2ca194ab17 Rename some function symbols and predicates to eliminate a bunch
Estimated hours taken: 3
Branches: main

library/term_to_xml.m:
library/rtti_implementation.m:
	Rename some function symbols and predicates to eliminate a bunch
	of ambiguities.

browser/browse.m:
tests/hard_coded/write_xml.m:
tests/hard_coded/xmlable_test.m:
	Conform to the change above.
2006-09-25 01:56:17 +00:00
Zoltan Somogyi
ef55b420fd Remove from std_util.m the predicates that merely call predicates in
Estimated hours taken: 12
Branches: main

Remove from std_util.m the predicates that merely call predicates in
the type_desc, construct and deconstruct modules, to reduce clutter
in std_util.m.

library/std_util.m:
	Remove those predicates from std_util.m.

library/deconstruct.m:
	Add a type we need that was previously defined in std_util.m.

library/construct.m:
	Delete some module qualifications that have now become unnecessary,

browser/browse.m:
browser/browser_info.m:
browser/declarative_tree.m:
browser/dl.m:
browser/help.m:
browser/sized_pretty.m:
browser/term_rep.m:
compiler/bytecode_gen.m:
compiler/llds_out.m:
compiler/mlds_to_il.m:
compiler/mlds_to_managed.m:
library/assoc_list.m:
library/hash_table.m:
library/io.m:
library/pprint.m:
library/private_builtin.m:
library/prolog.m:
library/require.m:
library/rtti_implementation.m:
library/store.m:
library/term.m:
library/term_to_xml.m:
library/version_hash_table.m:
mdbcomp/program_representation.m:
	Import type_desc.m, construct.m and/or deconstruct.m to provide
	definitions of functions or predicates that up till now were in
	std_util.m. Modify the calls if the called function or predicate
	had a slightly different interface in std_util.m.

	Also, convert term_to_xml.m to four-space indentation, and delete
	unnecessary module qualifications in term.m.

tests/debugger/polymorphic_output.{m,inp,exp,exp2}:
tests/hard_coded/copy_pred_2.m:
tests/hard_coded/deconstruct_arg.exp:
tests/hard_coded/deconstruct_arg.exp2:
tests/hard_coded/deconstruct_arg.m:
tests/hard_coded/elim_special_pred.m:
tests/hard_coded/existential_bound_tvar.m:
tests/hard_coded/expand.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/higher_order_type_manip.m:
tests/hard_coded/nullary_ho_func.m:
tests/hard_coded/tuple_test.m:
tests/hard_coded/type_ctor_desc.m:
tests/hard_coded/type_qual.m:
tests/hard_coded/write_xml.m:
tests/hard_coded/sub-modules/class.m:
tests/hard_coded/sub-modules/nested.m:
tests/hard_coded/sub-modules/nested2.m:
tests/hard_coded/sub-modules/nested3.m:
tests/hard_coded/sub-modules/parent.m:
tests/hard_coded/sub-modules/parent2.child.m:
tests/hard_coded/typeclasses/existential_rtti.m:
tests/recompilation/type_qual_re.m.1:
cvs update: Updating tests/submodules
cvs update: Updating tests/tabling
cvs update: Updating tests/term
cvs update: Updating tests/tools
cvs update: Updating tests/trailing
cvs update: Updating tests/typeclasses
cvs update: Updating tests/valid
tests/valid/agc_unbound_typevars.m:
tests/valid/agc_unbound_typevars2.m:
tests/valid/agc_unused_in.m:
	Replace references to the deleted predicates in std_util with
	references to the equivalent predicates in type_desc, construct
	and/or deconstruct. In test cases that already tested both the
	functionality in std_util and in the other modules, simply delete
	the part exercising std_util.
2006-03-22 02:56:44 +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
Ian MacLarty
3d2a216480 In term_to_xml check that no functor arguments are existentially typed when
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.
2004-12-15 04:40:24 +00:00
Ian MacLarty
87aa5d01b9 Allow custom functor to element mappings in term_to_xml library.
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.
2004-12-10 09:44:24 +00:00
Ian MacLarty
92add6376a Add library module to convert Mercury terms to XML documents and generate DTDs
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.
2004-12-07 04:55:51 +00:00