Commit Graph

3 Commits

Author SHA1 Message Date
Zoltan Somogyi
c6d857cb6b Cleanups of ops-related code.
library/io.m:
    Delete the set_io_table predicate, which did nothing and was never
    called from anywhere, and the get_io_table predicate, which always
    returned the same op_table. They were in io.m's interface, but in the
    not-publicly-visible part of the interface.

library/ops.m:
    Rename the lookup_op method to is_op.

    Delete references to the predicates deleted from io.m.

NEWS:
    Announce the lookup_op->is_op rename.

compiler/parse_tree_out_term.m:
library/mercury_term_parser.m:
library/string.to_string.m:
library/term_io.m:
samples/calculator2.m:
tests/hard_coded/bug383.m:
    Conform to the lookup_op->is_op rename.

    Replace calls to get_io_table with code that directly gets
    the Mercury op table.

    In parse_tree_out_term.m, call the predicates operating on the
    Mercury op table directly, not through the op_table type class.

    In mercury_term_parser.m, update some comments.

    In term_io.m, use OpTable to refer to op_tables.

tests/hard_coded/stdlib_init.{m,exp}:
    Don't test get_io_table.
2022-11-12 12:53:07 +11:00
Zoltan Somogyi
d23c4f74a3 Update the style of more tests. 2020-10-06 19:20:18 +11:00
Julien Fischer
5e09921375 Workaround standard library initialization problems in the Java grades.
In the Java grade, the standard streams were not being entered into the stream
database and the I/O globals were not being initialized.  For executables,
generate a call to library.std_library_init/2 before main/2 is invoked.  There
is still a problem for Mercury libraries called from Java programs and for
predicates specified in `:- initialise' declarations.   For the latter, Mercury
requires that all standard library initialization be performed *before* any
user specified initialize predicates, but because we currently implement all of
this in Java using static initializers we can't guarantee that the order things
occur in.

The same issue affects the C# grade; I'll add a workaround for it separately.

library/io.m:
    In the predicate io.init_state/2, in the Java grade do not
    bother setting the current stream since for the standard text
    streams we do so as part of class initialization and

library/library.m:
    Export std_library_init/2 to Java.

compiler/mlds_to_java.m:
     Generate a call to library.std_library_init/2 before main/2 is called.
     XXX TODO we should roll the call that initializes the benchmarking module
     into the same.

tests/hard_coded/Mmakefile:
tests/hard_coded/stdlib_init.{m,exp}:
    Test that the stream database and globals in the io module are
    initialized before main/2 is called.
2016-03-06 00:30:20 +11:00