mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 23:35:25 +00:00
Implement io.write for arbitrary streams. With type specialization
Estimated hours taken: 25 Branches: main Implement io.write for arbitrary streams. With type specialization this is only slightly slower than the original. library/stream.string_writer.m: library/library.m: A module containing predicates for writing to streams which accept strings. library/stream.m: Move stream.format to stream.string_writer.m. Add stream.put_list, which is like io.write_list. library/io.m: Move io.write and io.print to stream.string_writer.m. library/term_io.m: Add stream versions of predicates used by io.write. library/ops.m: Move io.adjust_priority_for_assoc to here (private predicate used only by library modules). Export ops.mercury_max_priority for use by stream.string_writer.write. Mmake.common.in: compiler/modules.m: compiler/mlds.m: compiler/mlds_to_c.m: compiler/mlds_to_java.m: compiler/mlds_to_managed.m: compiler/prog_util.m: compiler/format_call.m: mdbcomp/prim_data.m: Allow sub-modules in the standard library. compiler/polymorphism.m: Fix a bug which caused tests/hard_coded/print_stream.m to fail with this change. The wrong argument type_info would be extracted from a typeclass_info if the constraints of the typeclass-info were not all variables. browser/browse.m: tests/hard_coded/stream_format.m: tests/hard_coded/test_injection.m: tests/invalid/string_format_bad.m: tests/invalid/string_format_unknown.m: Updated for predicates moved between library modules. util/mdemangle.c: The demangler doesn't properly handle the arguments MR_DECL_LL* and various other recently added macros for type specialized procedures. It's still broken (it doesn't handle mode and label suffixes properly), but the output is at least more readable.
This commit is contained in:
@@ -106,6 +106,13 @@
|
||||
%
|
||||
:- func outermost_qualifier(sym_name) = string.
|
||||
|
||||
:- func add_outermost_qualifier(string, sym_name) = sym_name.
|
||||
|
||||
% Remove and return the top level qualifier of a sym_name.
|
||||
%
|
||||
:- pred strip_outermost_qualifier(sym_name::in,
|
||||
string::out, sym_name::out) is semidet.
|
||||
|
||||
%-----------------------------------------------------------------------------%
|
||||
|
||||
% adjust_func_arity(PredOrFunc, FuncArity, PredArity).
|
||||
@@ -316,6 +323,17 @@ construct_qualified_term(SymName, Args, Term) :-
|
||||
outermost_qualifier(unqualified(Name)) = Name.
|
||||
outermost_qualifier(qualified(Module, _Name)) = outermost_qualifier(Module).
|
||||
|
||||
add_outermost_qualifier(Qual, unqualified(Name)) =
|
||||
qualified(unqualified(Qual), Name).
|
||||
add_outermost_qualifier(Qual, qualified(Module, Name)) =
|
||||
qualified(add_outermost_qualifier(Qual, Module), Name).
|
||||
|
||||
strip_outermost_qualifier(qualified(unqualified(OuterQual), Name),
|
||||
OuterQual, unqualified(Name)).
|
||||
strip_outermost_qualifier(qualified(Module @ qualified(_, _), Name),
|
||||
OuterQual, qualified(RemainingQual, Name)) :-
|
||||
strip_outermost_qualifier(Module, OuterQual, RemainingQual).
|
||||
|
||||
%-----------------------------------------------------------------------------%
|
||||
|
||||
adjust_func_arity(predicate, Arity, Arity).
|
||||
|
||||
Reference in New Issue
Block a user