[m-rev.] diff: more foreign_proc cleanups

Zoltan Somogyi zs at cs.mu.OZ.AU
Sun Jun 22 21:55:53 AEST 2003


library/builtin.m:
library/rtti_implementation.m:
	Fix indentation in foreign_procs and in comments.

Zoltan.

cvs diff: Diffing .
Index: builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.92
diff -u -b -r1.92 builtin.m
--- builtin.m	13 Jun 2003 16:28:48 -0000	1.92
+++ builtin.m	22 Jun 2003 10:08:08 -0000
@@ -256,8 +256,8 @@
 	% by predicates and functions which depend on an ordering on a given
 	% type, where this ordering is not necessarily the standard ordering.
 	% In addition to the type, mode and determinism constraints, a
-	% comparison predicate C is expected to obey two other laws.  For
-	% all X, Y and Z of the appropriate type, and for all
+	% comparison predicate C is expected to obey two other laws.
+	% For all X, Y and Z of the appropriate type, and for all
 	% comparison_results R:
 	%	1) C(X, Y, (>)) if and only if C(Y, X, (<))
 	%	2) C(X, Y, R) and C(Y, Z, R) implies C(X, Z, R).
@@ -327,16 +327,16 @@
 % non-canonical terms.
 %
 % The declarative semantics of compare_representation for unequal
-% non-canonical terms is that the result is either (<) or (>).  For
-% equal non-canonical terms the result can be anything.
+% non-canonical terms is that the result is either (<) or (>).
+% For equal non-canonical terms the result can be anything.
 %
 % Operationally, the result of compare_representation for
 % non-canonical terms is the same as that for comparing the internal
 % representations of the terms, where the internal representation is
 % that which would be produced by deconstruct__cc.
 %
-% XXX This predicate is not yet implemented for highlevel code.  This
-% is the reason it is not in the official part of the interface.
+% XXX This predicate is not yet implemented for highlevel code.
+% This is the reason it is not in the official part of the interface.
 
 :- pred compare_representation(comparison_result, T, T).
 :- mode compare_representation(uo, in, in) is cc_multi.
@@ -372,22 +372,32 @@
 :- mode cc_cast(pred(out) is cc_nondet) = out(pred(out) is semidet) is det.
 :- mode cc_cast(pred(out) is cc_multi) = out(pred(out) is det) is det.
 
-:- pragma foreign_proc("C", cc_cast(X :: (pred(out) is cc_multi)) =
-                        (Y :: out(pred(out) is det)),
+:- pragma foreign_proc("C",
+	cc_cast(X :: (pred(out) is cc_multi)) = (Y :: out(pred(out) is det)),
                 [will_not_call_mercury, thread_safe],
-                "Y = X;").
-:- pragma foreign_proc("C", cc_cast(X :: (pred(out) is cc_nondet)) =
+"
+	Y = X;
+").
+:- pragma foreign_proc("C",
+	cc_cast(X :: (pred(out) is cc_nondet)) =
                         (Y :: out(pred(out) is semidet)),
                 [will_not_call_mercury, thread_safe],
-                "Y = X;").
-:- pragma foreign_proc("C#", cc_cast(X :: (pred(out) is cc_multi)) =
-                        (Y :: out(pred(out) is det)),
+"
+	Y = X;
+").
+:- pragma foreign_proc("C#",
+	cc_cast(X :: (pred(out) is cc_multi)) = (Y :: out(pred(out) is det)),
                 [will_not_call_mercury, thread_safe],
-                "Y = X;").
-:- pragma foreign_proc("C#", cc_cast(X :: (pred(out) is cc_nondet)) =
+"
+	Y = X;
+").
+:- pragma foreign_proc("C#",
+	cc_cast(X :: (pred(out) is cc_nondet)) =
                         (Y :: out(pred(out) is semidet)),
                 [will_not_call_mercury, thread_safe],
-                "Y = X;").
+"
+	Y = X;
+").
 
 :- pragma promise_pure(promise_only_solution_io/4).
 promise_only_solution_io(Pred, X) -->
@@ -405,12 +415,16 @@
 	cc_cast_io(X :: (pred(out, di, uo) is cc_multi)) = 
 		(Y :: out(pred(out, di, uo) is det)),
                 [will_not_call_mercury, thread_safe],
-                "Y = X;").
+"
+	Y = X;
+").
 :- pragma foreign_proc("C#", 
 		cc_cast_io(X :: (pred(out, di, uo) is cc_multi)) =
 		(Y :: out(pred(out, di, uo) is det)),
                 [will_not_call_mercury, thread_safe],
-                "Y = X;").
+"
+	Y = X;
+").
 
 %-----------------------------------------------------------------------------%
 
@@ -476,7 +490,6 @@
 {
 	compare_3(TypeInfo_for_T, Res, X, Y);
 }
-
 ").
 
 :- pragma foreign_code("C#", "
Index: rtti_implementation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.43
diff -u -b -r1.43 rtti_implementation.m
--- rtti_implementation.m	13 May 2003 08:51:59 -0000	1.43
+++ rtti_implementation.m	22 Jun 2003 10:08:08 -0000
@@ -1348,8 +1348,10 @@
 
 :- pred high_level_data is semidet.
 :- pragma promise_pure(high_level_data/0).
-:- pragma foreign_proc("MC++", high_level_data,
-		[will_not_call_mercury, thread_safe], "
+:- pragma foreign_proc("MC++",
+	high_level_data,
+	[will_not_call_mercury, thread_safe],
+"
 #ifdef MR_HIGHLEVEL_DATA
 	SUCCESS_INDICATOR = MR_TRUE;
 #else
@@ -1444,7 +1446,8 @@
 
 :- pragma foreign_proc("C#",
 	new_type_info(OldTypeInfo::in, Arity::in) = (NewTypeInfo::uo),
-		[promise_pure], "
+	[promise_pure],
+"
 	NewTypeInfo = new object[Arity + 1];
 	System.Array.Copy(OldTypeInfo, NewTypeInfo, OldTypeInfo.Length);
 ").
@@ -1471,7 +1474,8 @@
 
 :- pragma foreign_proc("C#",
 	get_pti_from_type_info(TypeInfo::in, Index::in) = (PTI::out),
-		[promise_pure], "
+	[promise_pure],
+"
 	PTI = TypeInfo[Index];
 ").
 
@@ -1777,11 +1781,10 @@
 
 :- pragma foreign_proc("C#",
 	typeinfo_locns_index(X::in, ExistInfo::in) = (TypeInfoLocn::out),
-		[promise_pure], "
-
+	[promise_pure],
+"
 	TypeInfoLocn = (object[]) ((object[]) ExistInfo[(int)
 			exist_info_field_nums.typeinfo_locns])[X];
-		
 ").
 
 :- func exist_info_typeinfos_plain(exist_info) = int.
@@ -1791,7 +1794,8 @@
 
 :- pragma foreign_proc("C#",
 	exist_info_typeinfos_plain(ExistInfo::in) = (TypeInfosPlain::out),
-		[promise_pure], "
+	[promise_pure],
+"
 	TypeInfosPlain = (int)
 		ExistInfo[(int)
 			exist_info_field_nums.typeinfos_plain];
@@ -1838,7 +1842,8 @@
 
 :- pragma foreign_proc("C#",
 	get_typeinfo_from_term(Term::in, Index::in) = (TypeInfo::out),
-		[promise_pure], "
+	[promise_pure],
+"
 	try {
 		TypeInfo = (object[]) ((object[]) Term)[Index];
 	} catch (System.InvalidCastException) {
@@ -1875,7 +1880,8 @@
 
 :- pragma foreign_proc("C#",
 	type_info_index(X::in, TypeInfo::in) = (TypeInfoAtIndex::out),
-		[will_not_call_mercury, promise_pure], "
+	[will_not_call_mercury, promise_pure],
+"
 	TypeInfoAtIndex = (object[]) TypeInfo[X];
 ").
 
@@ -2210,8 +2216,10 @@
 %-----------------------------------------------------------------------------%
 
 :- func unsafe_index(int, T) = U.
-:- pragma foreign_proc("C#", unsafe_index(Num::in, Array::in) = (Item::out),
-		[will_not_call_mercury, thread_safe, promise_pure], "
+:- pragma foreign_proc("C#",
+	unsafe_index(Num::in, Array::in) = (Item::out),
+	[will_not_call_mercury, thread_safe, promise_pure],
+"
 	Item = ((object []) Array)[Num];
 ").
 unsafe_index(_, _) = _ :-
@@ -2221,7 +2229,8 @@
 
 :- func unsafe_make_enum(int) = T.
 :- pragma foreign_proc("C#", unsafe_make_enum(Num::in) = (Enum::out),
-		[will_not_call_mercury, thread_safe, promise_pure], "
+	[will_not_call_mercury, thread_safe, promise_pure],
+"
 	Enum = mercury.runtime.LowLevelData.make_enum(Num);
 ").
 unsafe_make_enum(_) = _ :-
@@ -2230,12 +2239,14 @@
  %--------------------------%
 
 :- pred null(T::in) is semidet.
-:- pragma foreign_proc("C", null(S::in),
+:- pragma foreign_proc("C",
+	null(S::in),
 		[will_not_call_mercury, thread_safe, promise_pure],
 "
 	SUCCESS_INDICATOR = ((void *)S == NULL);
 ").
-:- pragma foreign_proc("MC++", null(S::in),
+:- pragma foreign_proc("MC++",
+	null(S::in),
 		[will_not_call_mercury, thread_safe, promise_pure],
 "
 	SUCCESS_INDICATOR = (S == 0);
@@ -2248,12 +2259,14 @@
  %--------------------------%
 
 :- func null = T.
-:- pragma foreign_proc("C", null = (T::out),
+:- pragma foreign_proc("C",
+	null = (T::out),
 		[will_not_call_mercury, thread_safe, promise_pure],
 "
 	T = (MR_Word) NULL;
 ").
-:- pragma foreign_proc("MC++", null = (T::out),
+:- pragma foreign_proc("MC++",
+	null = (T::out),
 		[will_not_call_mercury, thread_safe, promise_pure],
 "
 	T = 0;
--------------------------------------------------------------------------
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