Files
mercury/tests/hard_coded/csharp_test.m
Peter Wang c2b1704378 Fix I/O problems in Java backend.
Branches: main

Fix I/O problems in Java backend.

library/io.m:
        Don't write to System.out directly in io.write_*/3.  io.write_*/4
        works with a stream layered on top of System.out, and mixing the two
        sets of predicates results output coming out in the wrong order.

        In MR_MercuryFileStruct.put and MR_MercuryFileStruct.write flush a
        text output stream if a newline is written, otherwise the user is
        liable to not see any output at all (the buffering is very
        aggressive).

tests/hard_coded/csharp_test.m:
tests/hard_coded/java_test.m:
        Update some old :- pragma foreign_* syntax.
2009-05-07 07:42:16 +00:00

31 lines
597 B
Mathematica

% A test of the C# interface.
:- module csharp_test.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
main -->
csharp_write_string("Hello, world\n").
:- pragma foreign_decl("C#", "
// some C Sharp declarations
").
:- pragma foreign_code("C#", "
// some C Sharp code
").
:- pred csharp_write_string(string::in, io__state::di, io__state::uo) is det.
:- pragma foreign_proc("C#",
csharp_write_string(Message::in, _IO0::di, _IO::uo),
[will_not_call_mercury, promise_pure],
"
// a C sharp procedure
Console.WriteLine(Message);
").