[m-rev.] Re: diff: add erlang foreign procs for some tests

Peter Wang wangp at students.csse.unimelb.edu.au
Thu Aug 23 14:12:45 AEST 2007


More of the same.

Branches: main

valid/deforest_loop.m:
valid/exported_foreign_type2.m:
valid/headvar_not_found.m:
valid/ho_and_type_spec_bug.m:
valid/inst_perf_bug_1.m:
valid/intermod_impure2.m:
valid/lambda_recompute.m:
valid/livevals_seq.m:
valid/mostly_uniq_neg.m:
valid/multidet_prune1.m:
valid/nondet_live.m:
valid/param_mode_bug.m:
valid/simplify_bug.m:
valid/soln_context.m:
valid/switch_detection_bug2.m:
valid/tricky_assert2.m:
valid/uniq_unify.m:
valid/vn_float.m:
warnings/purity_warnings.m:
warnings/singleton_test.m:
	Add Erlang pragma foreign_* for these test cases.

warnings/singleton_test.exp:
	Update line numbers in expected output for C.

warnings/singleton_test.exp2:
warnings/singleton_test.exp3:
	Update line numbers and format C# and Java (untested).

warnings/singleton_test.exp4:
	Add expected output for Erlang.

Index: valid/deforest_loop.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/deforest_loop.m,v
retrieving revision 1.3
diff -u -r1.3 deforest_loop.m
--- valid/deforest_loop.m	25 Aug 2004 08:21:31 -0000	1.3
+++ valid/deforest_loop.m	23 Aug 2007 02:38:33 -0000
@@ -62,18 +62,23 @@
 :- mode shade_from_light(in(scene), in, in, in, in, out) is det.

 :- external(shade_from_light/6).
+:- pragma foreign_code("Erlang",
+    "shade_from_light_6_p_0(_, _, _, _, _) -> void.").

 :- func colour(attributes) = colour.
 :- external(colour/1).
+:- pragma foreign_code("Erlang", "colour_1_f_0(_) -> void.").

 :- func scale(float, colour) = colour.
 scale(F, rgb(R, G, B)) = rgb(range(F * R), range(F * G), range(F * B)).

 :- func ambient(scene::in(scene)) = (float::out) is det.
 :- external(ambient/1).
+:- pragma foreign_code("Erlang", "ambient_1_f_0(_) -> void.").

 :- func lights(scene::in(scene)) = (list(light)::out) is det.
 :- external(lights/1).
+:- pragma foreign_code("Erlang", "lights_1_f_0(_) -> void.").

 :- pred add_colours(colour::in, colour::in, colour::out) is det.
 add_colours(C0, C1, C0 + C1).
@@ -84,4 +89,5 @@

 :- func range(float) = float.
 :- external(range/1).
+:- pragma foreign_code("Erlang", "range_1_f_0(_) -> void.").

Index: valid/exported_foreign_type2.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/exported_foreign_type2.m,v
retrieving revision 1.1
diff -u -r1.1 exported_foreign_type2.m
--- valid/exported_foreign_type2.m	13 May 2003 06:25:56 -0000	1.1
+++ valid/exported_foreign_type2.m	23 Aug 2007 01:23:17 -0000
@@ -3,6 +3,7 @@

 :- type t ---> t(int).
 :- pragma foreign_type("C", t, "int") where equality is int_equals,
comparison is int_compare.
+:- pragma foreign_type("Erlang", t, "int") where equality is
int_equals, comparison is int_compare.

 :- pred int_equals(t::in, t::in) is semidet.
 :- pred int_compare(comparison_result::uo, t::in, t::in) is det.
@@ -13,6 +14,9 @@
 :- pragma foreign_proc("C", int_equals(T1::in, T2::in), [promise_pure],
 "SUCCESS_INDICATOR = (T1 == T2);").

+:- pragma foreign_proc("Erlang", int_equals(T1::in, T2::in), [promise_pure],
+"SUCCESS_INDICATOR = (T1 =:= T2)").
+
 int_compare((Res < 0 -> (<) ; Res = 0 -> (=) ; (>)), T1, T2) :-
 	int_compare_2(Res, T1, T2).

@@ -22,3 +26,7 @@
 	int_compare_2(Result::out, T1::in, T2::in), [promise_pure],
 "Result = (T1 < T2) ? -1 : ((T1 == T2) ? 0 : 1);").

+:- pragma foreign_proc("Erlang",
+	int_compare_2(Result::out, T1::in, T2::in), [promise_pure],
+"Result = if T1 < T2 -> -1; T1 =:= T2 -> 0 ; true -> 1 end").
+
Index: valid/headvar_not_found.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/headvar_not_found.m,v
retrieving revision 1.2
diff -u -r1.2 headvar_not_found.m
--- valid/headvar_not_found.m	4 Sep 1998 10:08:56 -0000	1.2
+++ valid/headvar_not_found.m	23 Aug 2007 02:18:26 -0000
@@ -17,6 +17,7 @@

 :- pred mode_is_input(module_info::in, (mode)::in) is semidet.
 :- external(mode_is_input/2).
+:- pragma foreign_code("Erlang", "mode_is_input_2_p_0(_, _) -> void.").

 % succeed iff all the inputs in the list of modes precede the outputs

Index: valid/ho_and_type_spec_bug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/ho_and_type_spec_bug.m,v
retrieving revision 1.1
diff -u -r1.1 ho_and_type_spec_bug.m
--- valid/ho_and_type_spec_bug.m	2 May 2005 08:19:08 -0000	1.1
+++ valid/ho_and_type_spec_bug.m	23 Aug 2007 01:27:36 -0000
@@ -47,6 +47,12 @@
 "
 	/* V F */
 ").
+:- pragma foreign_proc("Erlang",
+	gamma(V::in) = (F::out),
+	[will_not_call_mercury, promise_pure],
+"
+	F = V
+").

 :- pred foldl(pred(T, U, U), sparse_bitset(T), U, U) <= foo(T).
 :- mode foldl(pred(in, in, out) is det, in, in, out) is det.
Index: valid/inst_perf_bug_1.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/inst_perf_bug_1.m,v
retrieving revision 1.1
diff -u -r1.1 inst_perf_bug_1.m
--- valid/inst_perf_bug_1.m	22 Feb 2000 10:56:40 -0000	1.1
+++ valid/inst_perf_bug_1.m	23 Aug 2007 02:18:47 -0000
@@ -45,3 +45,4 @@
 :- implementation.

 :- external(p/1).
+:- pragma foreign_code("Erlang", "p_1_p_0(_) -> void.").
Index: valid/intermod_impure2.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/intermod_impure2.m,v
retrieving revision 1.3
diff -u -r1.3 intermod_impure2.m
--- valid/intermod_impure2.m	10 Jul 2006 04:40:59 -0000	1.3
+++ valid/intermod_impure2.m	23 Aug 2007 01:30:11 -0000
@@ -29,3 +29,10 @@
 	ldc.i4 2
 	stloc Int
 ").
+:- pragma foreign_proc("Erlang",
+	intermod_impure_2(Int::out),
+	[will_not_call_mercury],
+"
+	io:format(""Output from impure predicate\\n""),
+	Int = 2
+").
Index: valid/lambda_recompute.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/lambda_recompute.m,v
retrieving revision 1.2
diff -u -r1.2 lambda_recompute.m
--- valid/lambda_recompute.m	29 Mar 2006 08:08:09 -0000	1.2
+++ valid/lambda_recompute.m	23 Aug 2007 02:39:59 -0000
@@ -63,6 +63,7 @@

 :- func pos(int, int) = pos.
 :- external(pos/2).
+:- pragma foreign_code("Erlang", "pos_2_f_0(_, _) -> void.").


 :- type map_i_know
Index: valid/livevals_seq.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/livevals_seq.m,v
retrieving revision 1.1
diff -u -r1.1 livevals_seq.m
--- valid/livevals_seq.m	23 Jul 1997 08:38:18 -0000	1.1
+++ valid/livevals_seq.m	23 Aug 2007 01:41:40 -0000
@@ -40,3 +40,4 @@
 :- mode det_insert(in, in, in, out) is det.

 :- external(det_insert/4).
+:- pragma foreign_code("Erlang", "det_insert_4_p_0(_, _, _, _, _) -> void.").
Index: valid/mostly_uniq_neg.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/mostly_uniq_neg.m,v
retrieving revision 1.2
diff -u -r1.2 mostly_uniq_neg.m
--- valid/mostly_uniq_neg.m	4 Feb 2005 03:38:46 -0000	1.2
+++ valid/mostly_uniq_neg.m	23 Aug 2007 02:42:22 -0000
@@ -20,11 +20,14 @@
 :- mode occurs(in, in, mdi, muo) is semidet.

 :- external(occurs/4).
+:- pragma foreign_code("Erlang", "occurs_4_p_0(_, _, _) -> void.").

 :- pred tr_store_set_mutvar(store_mutvar(T, S), T, store(S), store(S)).
 :- mode tr_store_set_mutvar(in, in, mdi, muo) is det.

 :- external(tr_store_set_mutvar/4).
+:- pragma foreign_code("Erlang",
+    "tr_store_set_mutvar_4_p_0(_, _, _, _) -> void.").

 unify(T1, free, _T2, functor(Name2, Arity2, Args2)) -->
         \+ occurs(T1, Args2),
Index: valid/multidet_prune1.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/multidet_prune1.m,v
retrieving revision 1.1
diff -u -r1.1 multidet_prune1.m
--- valid/multidet_prune1.m	14 May 1996 13:49:55 -0000	1.1
+++ valid/multidet_prune1.m	23 Aug 2007 01:40:35 -0000
@@ -9,6 +9,7 @@

 :- pred q(int::in) is det.
 :- external(q/1).
+:- pragma foreign_code("Erlang", "q_1_p_0(_) -> void.").

 main -->
 	( { X = 1 ; X = 2 ; fail }, { q(X) } ->
Index: valid/nondet_live.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/nondet_live.m,v
retrieving revision 1.1
diff -u -r1.1 nondet_live.m
--- valid/nondet_live.m	4 Jan 1996 01:59:13 -0000	1.1
+++ valid/nondet_live.m	23 Aug 2007 01:42:25 -0000
@@ -63,3 +63,8 @@
 :- external(c/2).
 :- external(d/2).

+:- pragma foreign_code("Erlang", "
+b_2_p_0(_, _) -> void.
+c_2_p_0(_, _) -> void.
+d_2_p_0(_, _) -> void.
+").
Index: valid/param_mode_bug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/param_mode_bug.m,v
retrieving revision 1.1
diff -u -r1.1 param_mode_bug.m
--- valid/param_mode_bug.m	22 Sep 2006 05:35:33 -0000	1.1
+++ valid/param_mode_bug.m	23 Aug 2007 01:43:09 -0000
@@ -33,6 +33,12 @@
 "
 	Y = X;
 ").
+:- pragma foreign_proc("Erlang",
+	foo_2(Y::out(I), X::in(I)),
+	[promise_pure, thread_safe, will_not_call_mercury],
+"
+	Y = X
+").

 :- pragma foreign_export("C", bar(in(I), out(I)), "BAR").
 bar(X, X).
Index: valid/simplify_bug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/simplify_bug.m,v
retrieving revision 1.1
diff -u -r1.1 simplify_bug.m
--- valid/simplify_bug.m	8 Feb 1997 15:51:42 -0000	1.1
+++ valid/simplify_bug.m	23 Aug 2007 01:44:39 -0000
@@ -31,3 +31,4 @@

 :- pred e(list(T)::in) is erroneous.
 :- external(e/1).
+:- pragma foreign_code("Erlang", "e_1_p_0(_, _) -> void.").
Index: valid/soln_context.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/soln_context.m,v
retrieving revision 1.2
diff -u -r1.2 soln_context.m
--- valid/soln_context.m	25 Aug 2004 08:21:32 -0000	1.2
+++ valid/soln_context.m	23 Aug 2007 01:46:09 -0000
@@ -20,3 +20,8 @@

 :- external(p1/2).
 :- external(p2/2).
+
+:- pragma foreign_code("Erlang", "
+p1_2_p_0(_) -> void.
+p2_2_p_0(_, _) -> void.
+").
Index: valid/switch_detection_bug2.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/switch_detection_bug2.m,v
retrieving revision 1.2
diff -u -r1.2 switch_detection_bug2.m
--- valid/switch_detection_bug2.m	29 Mar 2006 08:08:10 -0000	1.2
+++ valid/switch_detection_bug2.m	23 Aug 2007 01:48:29 -0000
@@ -63,6 +63,9 @@

 :- pred first_mentioned_positions(edit :: in, pos :: out, pos :: out) is det.
 :- external(first_mentioned_positions/3).
+:- pragma foreign_code("Erlang", "
+first_mentioned_positions_3_p_0(_) -> void.
+").

 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: valid/tricky_assert2.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/tricky_assert2.m,v
retrieving revision 1.2
diff -u -r1.2 tricky_assert2.m
--- valid/tricky_assert2.m	12 Nov 1999 09:31:54 -0000	1.2
+++ valid/tricky_assert2.m	23 Aug 2007 01:49:54 -0000
@@ -7,4 +7,5 @@

 :- implementation.
 :- external(tricky_assert2__local/0).
+:- pragma foreign_code("Erlang", "local_0_p_0() -> void.").

Index: valid/uniq_unify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/uniq_unify.m,v
retrieving revision 1.1
diff -u -r1.1 uniq_unify.m
--- valid/uniq_unify.m	14 May 1996 13:49:57 -0000	1.1
+++ valid/uniq_unify.m	23 Aug 2007 01:50:35 -0000
@@ -21,6 +21,13 @@
 :- pred r2(fg::di, fg::uo) is det.
 :- external(r2/2).

+:- pragma foreign_code("Erlang", "
+q_2_p_0(_) -> void.
+q2_2_p_0(_) -> void.
+r_2_p_0(_) -> void.
+r2_2_p_0(_) -> void.
+").
+
 % This is a regression test: a previous version of the compiler
 % reported a spurious mode error because after `F0 = f(_)' it
 % inferred `F0 -> unique(f(ground))' rather than `F0 -> unique(f(unique))'.
Index: valid/vn_float.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/vn_float.m,v
retrieving revision 1.2
diff -u -r1.2 vn_float.m
--- valid/vn_float.m	4 Jan 2002 07:49:14 -0000	1.2
+++ valid/vn_float.m	23 Aug 2007 02:46:47 -0000
@@ -133,3 +133,13 @@
 :- func matmult(mat3, mat3) = mat3.

 :- external(matmult/2).
+
+:- pragma foreign_code("Erlang", "
+    move_vertices_to_plane_5_p_0(_, _, _, _) -> void.
+    unit_1_f_0(_) -> void.
+    cross_2_f_0(_, _) -> void.
+    '-_2_f_0'(_, _) -> void.
+    '-_1_f_0'(_) -> void.
+    mag_1_f_0(_) -> void.
+    matmult_2_f_0(_, _) -> void.
+").
Index: warnings/purity_warnings.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/purity_warnings.m,v
retrieving revision 1.5
diff -u -r1.5 purity_warnings.m
--- warnings/purity_warnings.m	10 Jul 2006 04:41:00 -0000	1.5
+++ warnings/purity_warnings.m	23 Aug 2007 01:54:59 -0000
@@ -83,14 +83,20 @@
 :- pragma foreign_proc("C", set_x(X::in), [will_not_call_mercury], "x=X;" ).
 :- pragma foreign_proc("C#", set_x(X::in), [will_not_call_mercury], "x=X;" ).
 :- pragma foreign_proc("Java", set_x(X::in), [will_not_call_mercury], "x=X;" ).
+:- pragma foreign_proc("Erlang", set_x(X::in), [will_not_call_mercury],
+    "put(x,X)" ).

 :- impure pred incr_x is det.
 :- pragma foreign_proc("C", incr_x, [will_not_call_mercury], "++x;" ).
 :- pragma foreign_proc("C#", incr_x, [will_not_call_mercury], "++x;" ).
 :- pragma foreign_proc("Java", incr_x, [will_not_call_mercury], "++x;" ).
+:- pragma foreign_proc("Erlang", incr_x, [will_not_call_mercury],
+    "put(x, get(x) + 1)" ).

 :- semipure pred get_x(int::out) is det.
 :- pragma promise_semipure(get_x/1).
 :- pragma foreign_proc("C", get_x(X::out), [will_not_call_mercury], "X=x;").
 :- pragma foreign_proc("C#", get_x(X::out), [will_not_call_mercury], "X=x;").
 :- pragma foreign_proc("Java", get_x(X::out), [will_not_call_mercury], "X=x;").
+:- pragma foreign_proc("Erlang", get_x(X::out), [will_not_call_mercury],
+    "X = get(x)").
Index: warnings/singleton_test.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/singleton_test.exp,v
retrieving revision 1.13
diff -u -r1.13 singleton_test.exp
--- warnings/singleton_test.exp	12 Sep 2006 04:41:52 -0000	1.13
+++ warnings/singleton_test.exp	23 Aug 2007 02:00:18 -0000
@@ -7,11 +7,11 @@
 singleton_test.m:027:   warning: variable `T' occurs only once in this scope.
 singleton_test.m:029: In the C code for predicate `singleton_test.my_c_pred'/3:
 singleton_test.m:029:   warning: variable `Y' does not occur in the C code.
-singleton_test.m:041: In the C code for function `singleton_test.my_c_func'/2:
-singleton_test.m:041:   warning: variable `X' does not occur in the C code.
-singleton_test.m:055: In the C code for predicate
-singleton_test.m:055:   `singleton_test.c_hello_world'/3:
-singleton_test.m:055:   warning: variable `Msg' does not occur in the C code.
+singleton_test.m:045: In the C code for function `singleton_test.my_c_func'/2:
+singleton_test.m:045:   warning: variable `X' does not occur in the C code.
+singleton_test.m:063: In the C code for predicate
+singleton_test.m:063:   `singleton_test.c_hello_world'/3:
+singleton_test.m:063:   warning: variable `Msg' does not occur in the C code.
 singleton_test.m:008: In function `my_append_func'/2:
 singleton_test.m:008:   warning: unresolved polymorphism.
 singleton_test.m:008:   The variables with unbound types were:
Index: warnings/singleton_test.exp2
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/singleton_test.exp2,v
retrieving revision 1.2
diff -u -r1.2 singleton_test.exp2
--- warnings/singleton_test.exp2	20 Feb 2004 04:18:16 -0000	1.2
+++ warnings/singleton_test.exp2	23 Aug 2007 02:10:54 -0000
@@ -1,19 +1,21 @@
-singleton_test.m:022: In clause for predicate `singleton_test.my_append/3':
+singleton_test.m:022: In clause for predicate `singleton_test.my_append'/3:
 singleton_test.m:022:   warning: variable `L2' occurs only once in this scope.
-singleton_test.m:026: In clause for function `singleton_test.my_append_func/2':
-singleton_test.m:026:   warning: variables `L1, L2' occur only once
in this scope.
-singleton_test.m:027: In clause for function `singleton_test.my_append_func/2':
+singleton_test.m:026: In clause for function `singleton_test.my_append_func'/2:
+singleton_test.m:026:   warning: variables `L1, L2' occur only once in this
+singleton_test.m:026:   scope.
+singleton_test.m:027: In clause for function `singleton_test.my_append_func'/2:
 singleton_test.m:027:   warning: variable `T' occurs only once in this scope.
-singleton_test.m:032: In the C# code for predicate
`singleton_test.my_c_pred/3':
+singleton_test.m:032: In the C# code for predicate
`singleton_test.my_c_pred'/3:
 singleton_test.m:032:   warning: variable `Y' does not occur in the C# code.
-singleton_test.m:044: In the C# code for function `singleton_test.my_c_func/2':
-singleton_test.m:044:   warning: variable `X' does not occur in the C# code.
-singleton_test.m:060: In the C# code for predicate
`singleton_test.c_hello_world/3':
-singleton_test.m:060:   warning: variable `Msg' does not occur in the C# code.
-singleton_test.m:008: In function `singleton_test.my_append_func/2':
+singleton_test.m:048: In the C# code for function `singleton_test.my_c_func'/2:
+singleton_test.m:048:   warning: variable `X' does not occur in the C# code.
+singleton_test.m:068: In the C# code for predicate
+singleton_test.m:068:   `singleton_test.c_hello_world/3':
+singleton_test.m:068:   warning: variable `Msg' does not occur in the C# code.
+singleton_test.m:008: In function `my_append_func'/2:
 singleton_test.m:008:   warning: unresolved polymorphism.
 singleton_test.m:008:   The variables with unbound types were:
-singleton_test.m:008:       L2: V_1
-singleton_test.m:008:       L1: V_1
-singleton_test.m:008:   The unbound type variable(s) will be implicitly
-singleton_test.m:008:   bound to the builtin type `void'.
+singleton_test.m:008:     L2: V_1
+singleton_test.m:008:     L1: V_1
+singleton_test.m:008:   The unbound type variables will be implicitly bound to
+singleton_test.m:008:   the builtin type `void'.
Index: warnings/singleton_test.exp3
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/singleton_test.exp3,v
retrieving revision 1.1
diff -u -r1.1 singleton_test.exp3
--- warnings/singleton_test.exp3	20 Feb 2004 04:18:16 -0000	1.1
+++ warnings/singleton_test.exp3	23 Aug 2007 02:12:26 -0000
@@ -1,19 +1,20 @@
-singleton_test.m:022: In clause for predicate `singleton_test.my_append/3':
+singleton_test.m:022: In clause for predicate `singleton_test.my_append'/3:
 singleton_test.m:022:   warning: variable `L2' occurs only once in this scope.
-singleton_test.m:026: In clause for function `singleton_test.my_append_func/2':
-singleton_test.m:026:   warning: variables `L1, L2' occur only once
in this scope.
-singleton_test.m:027: In clause for function `singleton_test.my_append_func/2':
+singleton_test.m:026: In clause for function `singleton_test.my_append_func'/2:
+singleton_test.m:026:   warning: variables `L1, L2' occur only once in this
+singleton_test.m:026:   scope.
+singleton_test.m:027: In clause for function `singleton_test.my_append_func'/2:
 singleton_test.m:027:   warning: variable `T' occurs only once in this scope.
-singleton_test.m:036: In the Java code for predicate
`singleton_test.my_c_pred/3':
+singleton_test.m:036: In the Java code for predicate
`singleton_test.my_c_pred'/3:
 singleton_test.m:036:   warning: variable `Y' does not occur in the Java code.
-singleton_test.m:048: In the Java code for function
`singleton_test.my_c_func/2':
-singleton_test.m:048:   warning: variable `X' does not occur in the Java code.
-singleton_test.m:065: In the Java code for predicate
`singleton_test.c_hello_world/3':
-singleton_test.m:065:   warning: variable `Msg' does not occur in the
Java code.
-singleton_test.m:008: In function `singleton_test.my_append_func/2':
+singleton_test.m:052: In the Java code for function
`singleton_test.my_c_func'/2:
+singleton_test.m:052:   warning: variable `X' does not occur in the Java code.
+singleton_test.m:073: In the Java code for predicate
`singleton_test.c_hello_world'/3:
+singleton_test.m:073:   warning: variable `Msg' does not occur in the
Java code.
+singleton_test.m:008: In function `singleton_test.my_append_func'/2:
 singleton_test.m:008:   warning: unresolved polymorphism.
 singleton_test.m:008:   The variables with unbound types were:
-singleton_test.m:008:       L2: V_1
-singleton_test.m:008:       L1: V_1
-singleton_test.m:008:   The unbound type variable(s) will be implicitly
-singleton_test.m:008:   bound to the builtin type `void'.
+singleton_test.m:008:     L2: V_1
+singleton_test.m:008:     L1: V_1
+singleton_test.m:008:   The unbound type variables will be implicitly bound to
+singleton_test.m:008:   the builtin type `void'.
Index: warnings/singleton_test.exp4
===================================================================
RCS file: warnings/singleton_test.exp4
diff -N warnings/singleton_test.exp4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ warnings/singleton_test.exp4	23 Aug 2007 02:08:51 -0000
@@ -0,0 +1,26 @@
+singleton_test.m:022: In clause for predicate `singleton_test.my_append'/3:
+singleton_test.m:022:   warning: variable `L2' occurs only once in this scope.
+singleton_test.m:026: In clause for function `singleton_test.my_append_func'/2:
+singleton_test.m:026:   warning: variables `L1, L2' occur only once in this
+singleton_test.m:026:   scope.
+singleton_test.m:027: In clause for function `singleton_test.my_append_func'/2:
+singleton_test.m:027:   warning: variable `T' occurs only once in this scope.
+singleton_test.m:040: In the Erlang code for predicate
+singleton_test.m:040:   `singleton_test.my_c_pred'/3:
+singleton_test.m:040:   warning: variable `Y' does not occur in the Erlang
+singleton_test.m:040:   code.
+singleton_test.m:056: In the Erlang code for function
+singleton_test.m:056:   `singleton_test.my_c_func'/2:
+singleton_test.m:056:   warning: variable `X' does not occur in the Erlang
+singleton_test.m:056:   code.
+singleton_test.m:078: In the Erlang code for predicate
+singleton_test.m:078:   `singleton_test.c_hello_world'/3:
+singleton_test.m:078:   warning: variable `Msg' does not occur in the Erlang
+singleton_test.m:078:   code.
+singleton_test.m:008: In function `my_append_func'/2:
+singleton_test.m:008:   warning: unresolved polymorphism.
+singleton_test.m:008:   The variables with unbound types were:
+singleton_test.m:008:     L2: V_1
+singleton_test.m:008:     L1: V_1
+singleton_test.m:008:   The unbound type variables will be implicitly bound to
+singleton_test.m:008:   the builtin type `void'.
Index: warnings/singleton_test.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/singleton_test.m,v
retrieving revision 1.7
diff -u -r1.7 singleton_test.m
--- warnings/singleton_test.m	20 Feb 2004 04:18:16 -0000	1.7
+++ warnings/singleton_test.m	23 Aug 2007 01:59:20 -0000
@@ -37,6 +37,10 @@
 	[promise_pure, will_not_call_mercury], "
 	Z = 2 * X;
 ").
+:- pragma foreign_proc("Erlang", my_c_pred(X::in, Y::in, Z::out),
+	[promise_pure, will_not_call_mercury], "
+	Z = 2 * X
+").

 :- pragma c_code(my_c_func(X::in, Y::in) = (Z::out), will_not_call_mercury, "
 	Z = 2 * Y;
@@ -49,6 +53,10 @@
 	[promise_pure, will_not_call_mercury], "
 	Z = 2 * Y;
 ").
+:- pragma foreign_proc("Erlang", my_c_func(X::in, Y::in) = (Z::out),
+	[promise_pure, will_not_call_mercury], "
+	Z = 2 * Y
+").

 :- pragma c_header_code("#include <stdio.h>").

@@ -67,3 +75,8 @@
 	System.out.println(""Hello, world"");
 	IO = IO0;
 ").
+:- pragma foreign_proc("Erlang", c_hello_world(Msg::in, IO0::di, IO::uo),
+		[promise_pure, will_not_call_mercury], "
+	io:format(""Hello, world""),
+	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