[m-rev.] for review: Delete unnecessary foreign_exported procedures.
Peter Wang
novalazy at gmail.com
Thu Sep 22 16:57:07 AEST 2016
Is there any reason to keep ML_io_print_to_cur_stream?
ML_io_print_to_stream is only used for some agc debug code in the runtime.
diff --git a/library/io.m b/library/io.m
index 1612383..999da31 100644
--- a/library/io.m
+++ b/library/io.m
@@ -4879,13 +4879,6 @@ write_many(Stream, [f(F) | Rest], !IO) :-
% Various different versions of io.print
%
-:- pragma foreign_export("C", io.print(in, di, uo),
- "ML_io_print_to_cur_stream").
-:- pragma foreign_export("C#", io.print(in, di, uo),
- "ML_io_print_to_cur_stream").
-:- pragma foreign_export("Java", io.print(in, di, uo),
- "ML_io_print_to_cur_stream").
-
print(Term, !IO) :-
output_stream(Stream, !IO),
stream.string_writer.print(Stream, canonicalize, Term, !IO).
@@ -4900,12 +4893,13 @@ print_cc(Term, !IO) :-
output_stream(Stream, !IO),
stream.string_writer.print_cc(Stream, Term, !IO).
+ % XXX Only use this for debugging. Strictly speaking, io.print may throw an
+ % exception which is not allowed across the C interface.
+ %
:- pred io.print_to_stream(io.stream::in, T::in, io::di, io::uo) is det.
:- pragma foreign_export("C", io.print_to_stream(in, in, di, uo),
"ML_io_print_to_stream").
-:- pragma foreign_export("Java", io.print_to_stream(in, in, di, uo),
- "ML_io_print_to_stream").
print_to_stream(Stream, Term, !IO) :-
io.print(output_stream(Stream), canonicalize, Term, !IO).
@@ -5858,28 +5852,6 @@ get_op_table(ops.init_mercury_op_table, !IO).
set_op_table(_OpTable, !IO).
-%---------------------------------------------------------------------------%
-
-% For use by the debugger:
-
-:- pred get_io_input_stream_type(type_desc::out, io::di, io::uo) is det.
-
-:- pragma foreign_export("C", get_io_input_stream_type(out, di, uo),
- "ML_io_input_stream_type").
-
-get_io_input_stream_type(Type, !IO) :-
- stdin_stream(Stream, !IO),
- Type = type_of(Stream).
-
-:- pred get_io_output_stream_type(type_desc::out, io::di, io::uo) is det.
-
-:- pragma foreign_export("C", get_io_output_stream_type(out, di, uo),
- "ML_io_output_stream_type").
-
-get_io_output_stream_type(Type, !IO) :-
- stdout_stream(Stream, !IO),
- Type = type_of(Stream).
-
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
diff --git a/runtime/mercury_init.h b/runtime/mercury_init.h
index 9c51908..c03f665 100644
--- a/runtime/mercury_init.h
+++ b/runtime/mercury_init.h
@@ -116,7 +116,6 @@ extern void ML_io_stdout_stream(MercuryFilePtr *);
extern void ML_io_stdin_stream(MercuryFilePtr *);
extern void ML_io_print_to_stream(MR_Word, MercuryFilePtr, MR_Word);
-extern void ML_io_print_to_cur_stream(MR_Word, MR_Word);
// in library/private_builtin.m
extern const MR_TypeCtorInfo ML_type_ctor_info_for_univ;
diff --git a/runtime/mercury_wrapper.c b/runtime/mercury_wrapper.c
index ee27096..5d50463 100644
--- a/runtime/mercury_wrapper.c
+++ b/runtime/mercury_wrapper.c
@@ -456,7 +456,6 @@ void (*MR_library_finalizer)(void);
void (*MR_io_stderr_stream)(MercuryFilePtr *);
void (*MR_io_stdout_stream)(MercuryFilePtr *);
void (*MR_io_stdin_stream)(MercuryFilePtr *);
-void (*MR_io_print_to_cur_stream)(MR_Word, MR_Word);
void (*MR_io_print_to_stream)(MR_Word, MercuryFilePtr, MR_Word);
void (*MR_DI_output_current_ptr)(MR_Integer, MR_Integer, MR_Integer,
diff --git a/runtime/mercury_wrapper.h b/runtime/mercury_wrapper.h
index 50a2947..64c3805 100644
--- a/runtime/mercury_wrapper.h
+++ b/runtime/mercury_wrapper.h
@@ -79,7 +79,6 @@ extern void (*MR_library_finalizer)(void);
extern void (*MR_io_stderr_stream)(MercuryFilePtr *);
extern void (*MR_io_stdout_stream)(MercuryFilePtr *);
extern void (*MR_io_stdin_stream)(MercuryFilePtr *);
-extern void (*MR_io_print_to_cur_stream)(MR_Word, MR_Word);
extern void (*MR_io_print_to_stream)(MR_Word, MercuryFilePtr, MR_Word);
extern void (*MR_address_of_mercury_init_io)(void);
diff --git a/util/mkinit.c b/util/mkinit.c
index cbaa5b6..f807db6 100644
--- a/util/mkinit.c
+++ b/util/mkinit.c
@@ -468,7 +468,6 @@ static const char mercury_funcs2[] =
" MR_io_stdin_stream = ML_io_stdin_stream;\n"
" MR_io_stdout_stream = ML_io_stdout_stream;\n"
" MR_io_stderr_stream = ML_io_stderr_stream;\n"
- " MR_io_print_to_cur_stream = ML_io_print_to_cur_stream;\n"
" MR_io_print_to_stream = ML_io_print_to_stream;\n"
"#if MR_TRACE_ENABLED\n"
" MR_exec_trace_func_ptr = MR_trace_real;\n"
More information about the reviews
mailing list