[m-rev.] diff: fix compilation of extras/logged_output

Julien Fischer juliensf at cs.mu.OZ.AU
Fri Apr 29 11:47:08 AEST 2005


Estimated hours taken: 0.1
Branches: main, release

extras/logged_output/logged_output.m:
	Add a missing 'MR_' prefix.

	Suppress some warnings from the C compiler.

	Use the new foreign language interface.

Julien.

Workspace:/home/swordfish/juliensf/ws76
Index: logged_output.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/logged_output/logged_output.m,v
retrieving revision 1.1
diff -u -r1.1 logged_output.m
--- logged_output.m	11 Aug 2000 16:50:13 -0000	1.1
+++ logged_output.m	29 Apr 2005 01:41:39 -0000
@@ -33,16 +33,19 @@

 %------------------------------------------------------------------------------%

-:- pred create_stream(string::in, io__output_stream::out,
-		io__state::di, io__state::uo) is det.
+:- pred create_stream(string::in, io__output_stream::out, io::di, io::uo)
+	is det.

-:- pragma c_code(create_stream(FileName::in, IOStream::out, IO0::di, IO::uo), "
+:- pragma foreign_proc("C",
+	create_stream(FileName::in, IOStream::out, IO0::di, IO::uo),
+	[will_not_call_mercury, promise_pure],
+"
 	MercuryFile	*stream;
 	FILE		*file;

 	file = fopen(FileName, ""w"");

-	incr_hp(stream, ((sizeof(MercuryFile) / sizeof(MR_Word)) + 1));
+	MR_incr_hp((MR_Word) stream, ((sizeof(MercuryFile) / sizeof(MR_Word)) + 1));

 	stream->stream_type	= MR_FILE_STREAM;
 	stream->stream_info.file= file;
@@ -58,7 +61,7 @@
 	stream->vprintf		= ME_logged_output_vfprintf;
 	stream->putc		= ME_logged_output_putch;

-	IOStream = (MR_Word) stream;
+	IOStream = (MercuryFilePtr) stream;

 	IO = IO0;
 ").
@@ -66,7 +69,7 @@

 %------------------------------------------------------------------------------%

-:- pragma c_header_code("
+:- pragma foreign_decl("C", "
 #ifndef MR_NEW_MERCURYFILE_STRUCT
   #error ""you need to use version of the mercury compiler configured with --enable-new-mercuryfile-struct""
 #endif
@@ -86,7 +89,7 @@
 int ME_logged_output_read(MR_StreamInfo *info, void *buffer, size_t size);
 ").

-:- pragma c_code("
+:- pragma foreign_code("C", "
 int
 ME_logged_output_putch(MR_StreamInfo *info, int ch)
 {

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list