Add support for deconstructing by functor number rather than name,

Estimated hours taken: 20
Branches: main

Add support for deconstructing by functor number rather than name,
for use by write_binary.

library/deconstruct.m:
runtime/mercury_deconstruct.h:
runtime/mercury_deconstruct.c:
runtime/mercury_ml_expand_body.h:
runtime/mercury_ml_deconstruct_body.h:
	Add predicates deconstruct.functor_number and
	deconstruct.deconstruct.du, which returns a functor number
	suitable for use by construct.construct rather than a functor
	name.

library/construct.m:
library/term.m:
browser/term_rep.m:
extras/quickcheck/qcheck.m:
tests/valid/agc_unbound_typevars.m:
tests/valid/agc_unbound_typevars2.m:
	Add a function get_functor_lex, which returns the lexicographic
	functor number given an ordinal functor number.

	Add equivalence types to make it clearer which ordering is
	being used by which functor numbers.

	Remove a C-ism: num_functors now fails rather than returning -1
	for types without functors.

NEWS:
	Document the new predicates and functions.

runtime/mercury_type_info.h:
runtime/mercury_builtin_types.c:
runtime/mercury_mcpp.h:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/type_ctor_info.m:
compiler/rtti_to_mlds.m:
compiler/opt_debug.m:
	Add a field to MR_TypeCtorInfo which contains a mapping from
	an ordinal functor number to a lexicographic functor number
	which can be passed to construct.construct.

	Bump MR_RTTI_VERSION.

tests/hard_coded/expand.m:
tests/hard_coded/expand.exp:
tests/hard_coded/expand.exp2:
tests/hard_coded/construct_test.m:
tests/hard_coded/construct_test.exp:
tests/hard_coded/construct_test_exist.m:
tests/hard_coded/construct_test_exist.exp:
	Test cases.
This commit is contained in:
Simon Taylor
2007-01-05 02:19:46 +00:00
parent 70d435d864
commit 6de3b102ba
28 changed files with 819 additions and 257 deletions

View File

@@ -388,6 +388,7 @@ dump_rtti_name(type_ctor_maybe_res_addr_functor_desc) =
"maybe_res_addr_functor_desc".
dump_rtti_name(type_ctor_type_layout) = "type_layout".
dump_rtti_name(type_ctor_type_functors) = "type_functors".
dump_rtti_name(type_ctor_functor_number_map) = "functor_number_map".
dump_rtti_name(type_ctor_type_ctor_info) = "type_ctor_info".
dump_rtti_name(type_ctor_type_info(_TypeInfo)) = "type_info".
% XXX Should give more info than this for _TypeInfo.