[m-rev.] diff: changes to make library buildable with erlang backend

Peter Wang wangp at students.csse.unimelb.edu.au
Thu May 31 13:05:43 AEST 2007


Estimated hours taken: 0.2
Branches: main

library/bit_buffer.m:
	Fix incorrect result type on new_buffer_2.

library/math.m:
	Fix Erlang implementation of math.round/1.

library/profiling_builtin.m:
library/table_builtin.m:
	Add Erlang stubs for :- external procedures for deep profiling and
	tabling.

Index: bit_buffer.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/bit_buffer.m,v
retrieving revision 1.1
diff -u -r1.1 bit_buffer.m
--- bit_buffer.m	30 May 2007 02:47:06 -0000	1.1
+++ bit_buffer.m	31 May 2007 02:59:47 -0000
@@ -165,7 +165,7 @@
     ).
 
 :- func new_buffer_2(bitmap, num_bits, bit_index, bool,
-    Stream, State, stream.result(Error)) = bit_buffer(Stream, State, Error).
+    Stream, State, stream.res(Error)) = bit_buffer(Stream, State, Error).
 
 new_buffer_2(BM, Pos, Size, UseStream, Stream, State, ReadStatus) =
     bit_buffer(BM, Pos, Size, UseStream, Stream, State, [], ReadStatus).
Index: math.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/math.m,v
retrieving revision 1.58
diff -u -r1.58 math.m
--- math.m	30 May 2007 08:16:06 -0000	1.58
+++ math.m	31 May 2007 02:59:47 -0000
@@ -456,7 +456,7 @@
     math.round(Num::in) = (Rounded::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
-    Rounded = round(Num)
+    Rounded = float(round(Num))
 ").
 math.round(Num) = math.floor(Num + 0.5).
 
Index: profiling_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/profiling_builtin.m,v
retrieving revision 1.19
diff -u -r1.19 profiling_builtin.m
--- profiling_builtin.m	29 Nov 2006 05:18:18 -0000	1.19
+++ profiling_builtin.m	31 May 2007 02:59:47 -0000
@@ -1687,3 +1687,64 @@
 restore_recursion_depth_fail_9(_, _, _, _, _, _, _, _, _, _, _) :-
     impure private_builtin.imp,
     private_builtin.sorry("restore_recursion_depth_fail_9").
+
+:- pragma foreign_code("Erlang", "
+
+    % These stubs are needed so that the Erlang compiler doesn't complain
+    % about missing definitions for exported functions.
+
+    det_call_port_code_ac_3_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    det_call_port_code_sr_4_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    det_exit_port_code_ac_2_p_0(_, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    det_exit_port_code_sr_3_p_0(_, _, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    non_call_port_code_ac_4_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    non_call_port_code_sr_5_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    non_exit_port_code_ac_2_p_0(_, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    non_exit_port_code_sr_3_p_0(_, _, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    non_fail_port_code_ac_2_p_0(_, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    non_fail_port_code_sr_3_p_0(_, _, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    non_redo_port_code_ac_2_p_0(_, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    non_redo_port_code_sr_2_p_0(_, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    semi_call_port_code_ac_3_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    semi_call_port_code_sr_4_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    semi_exit_port_code_ac_2_p_0(_, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    semi_exit_port_code_sr_3_p_0(_, _, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    semi_fail_port_code_ac_2_p_0(_, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+    semi_fail_port_code_sr_3_p_0(_, _, _) ->
+        mercury__private_builtin:sorry_1_p_0(
+            ""deep profiling in Erlang backend"").
+").
Index: table_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/table_builtin.m,v
retrieving revision 1.59
diff -u -r1.59 table_builtin.m
--- table_builtin.m	30 May 2007 08:16:09 -0000	1.59
+++ table_builtin.m	31 May 2007 02:59:47 -0000
@@ -2010,4 +2010,29 @@
     private_builtin.sorry("table_report_statistics").
 
 %-----------------------------------------------------------------------------%
+
+:- pragma foreign_code("Erlang", "
+
+    % These stubs are needed so that the Erlang compiler doesn't complain
+    % about missing definitions for exported functions.
+
+    table_memo_return_all_answers_multi_2_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
+    table_memo_return_all_answers_nondet_2_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
+    table_mm_completion_1_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
+    table_mm_return_all_multi_2_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
+    table_mm_return_all_nondet_2_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
+    table_mm_suspend_consumer_2_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
+    table_mmos_consume_next_answer_multi_2_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
+    table_mmos_consume_next_answer_nondet_2_p_0(_) ->
+        mercury__private_builtin:sorry_1_p_0(""tabling in Erlang backend"").
+").
+
+%-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
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