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

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Jul 28 15:10:20 AEST 2006


Estimated hours taken: 0.1
Branches: main, release

extras/error/error.m:
 	Avoid a purity problems by using the new foreign language interface
 	here.

 	Use MR_{YES,NO} instead of hardcoding 1 and 0.

Julien.

Index: error.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/error/error.m,v
retrieving revision 1.2
diff -u -r1.2 error.m
--- error.m	30 Mar 2006 01:21:17 -0000	1.2
+++ error.m	28 Jul 2006 05:06:48 -0000
@@ -307,19 +307,20 @@

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

-:- pragma c_header_code("
-	#include <unistd.h>
-").
+:- pragma foreign_decl("C", "#include <unistd.h>").

  :- pred rename(string, string, bool, io__state, io__state).
  :- mode rename(in, in, out, di, uo) is det.

-:- pragma c_code(rename(Old::in, New::in, Res::out, IO0::di, IO::uo), "{
+:- pragma foreign_proc("C",
+	rename(Old::in, New::in, Res::out, IO0::di, IO::uo),
+	[promise_pure, will_not_call_mercury],
+"
  	int err;
  	err = rename(Old, New);
-	Res = (err == 0 ? 1 : 0);
+	Res = (err == 0 ? MR_YES : MR_NO);
  	IO = IO0;
-}").
+").

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

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list