[m-dev.] for review: Add missing MC++ definitions.

Tyson Dowd trd at cs.mu.OZ.AU
Wed Jan 17 16:00:02 AEDT 2001


Hi,

This patch is against the release version, but I plan to commit it on
both branches.

===================================================================

Estimated hours taken: 0.5

library/private_builtin.m:
	Add missing foreign_code("MC++", ...) for new predicates defined in C.
	Change c_code to foreign_code("C", ...) to be consistent with
	the rest of the library.

Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.62.2.2
diff -u -r1.62.2.2 private_builtin.m
--- library/private_builtin.m	2001/01/15 00:48:51	1.62.2.2
+++ library/private_builtin.m	2001/01/17 02:09:56
@@ -119,10 +119,15 @@
 :- pragma inline(builtin_compare_string/3).
 :- pragma inline(builtin_compare_float/3).
 
-:- pragma c_code(free_heap(Val::di),
+:- pragma foreign_code("C", free_heap(Val::di),
 	[will_not_call_mercury, thread_safe],
 	"MR_free_heap((void *) Val);").
 
+:- pragma foreign_code("MC++", free_heap(_Val::di),
+	[will_not_call_mercury, thread_safe], "
+	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+").
+
 builtin_unify_int(X, X).
 
 builtin_compare_int(R, X, Y) :-
@@ -781,7 +786,7 @@
 
 :- implementation.
 
-:- pragma c_code(store_ticket(Ticket::out),
+:- pragma foreign_code("C", store_ticket(Ticket::out),
 	[will_not_call_mercury, thread_safe],
 "
 #ifdef MR_USE_TRAIL
@@ -791,7 +796,7 @@
 #endif
 ").
 
-:- pragma c_code(reset_ticket_undo(Ticket::in),
+:- pragma foreign_code("C", reset_ticket_undo(Ticket::in),
 	[will_not_call_mercury, thread_safe],
 "
 #ifdef MR_USE_TRAIL
@@ -799,7 +804,7 @@
 #endif
 ").
 
-:- pragma c_code(reset_ticket_commit(Ticket::in),
+:- pragma foreign_code("C", reset_ticket_commit(Ticket::in),
 	[will_not_call_mercury, thread_safe],
 "
 #ifdef MR_USE_TRAIL
@@ -807,7 +812,7 @@
 #endif
 ").
 
-:- pragma c_code(reset_ticket_solve(Ticket::in),
+:- pragma foreign_code("C", reset_ticket_solve(Ticket::in),
 	[will_not_call_mercury, thread_safe],
 "
 #ifdef MR_USE_TRAIL
@@ -815,7 +820,7 @@
 #endif
 ").
 
-:- pragma c_code(discard_ticket,
+:- pragma foreign_code("C", discard_ticket,
 	[will_not_call_mercury, thread_safe],
 "
 #ifdef MR_USE_TRAIL
@@ -823,7 +828,7 @@
 #endif
 ").
 
-:- pragma c_code(prune_ticket,
+:- pragma foreign_code("C", prune_ticket,
 	[will_not_call_mercury, thread_safe],
 "
 #ifdef MR_USE_TRAIL
@@ -831,7 +836,7 @@
 #endif
 ").
 
-:- pragma c_code(mark_ticket_stack(TicketCounter::out),
+:- pragma foreign_code("C", mark_ticket_stack(TicketCounter::out),
 	[will_not_call_mercury, thread_safe],
 "
 #ifdef MR_USE_TRAIL
@@ -841,13 +846,90 @@
 #endif
 ").
 
-:- pragma c_code(prune_tickets_to(TicketCounter::in),
+:- pragma foreign_code("C", prune_tickets_to(TicketCounter::in),
 	[will_not_call_mercury, thread_safe],
 "
 #ifdef MR_USE_TRAIL
 	MR_prune_tickets_to(TicketCounter);
 #endif
 ").
+
+:- pragma foreign_code("MC++", store_ticket(Ticket::out),
+	[will_not_call_mercury, thread_safe],
+"
+#ifdef MR_USE_TRAIL
+	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	// MR_store_ticket(Ticket);
+#else
+	Ticket = 0;
+#endif
+").
+
+:- pragma foreign_code("MC++", reset_ticket_undo(Ticket::in),
+	[will_not_call_mercury, thread_safe],
+"
+#ifdef MR_USE_TRAIL
+	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	// MR_reset_ticket(Ticket, MR_undo);
+#endif
+").
+
+:- pragma foreign_code("MC++", reset_ticket_commit(Ticket::in),
+	[will_not_call_mercury, thread_safe],
+"
+#ifdef MR_USE_TRAIL
+	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	// MR_reset_ticket(Ticket, MR_commit);
+#endif
+").
+
+:- pragma foreign_code("MC++", reset_ticket_solve(Ticket::in),
+	[will_not_call_mercury, thread_safe],
+"
+#ifdef MR_USE_TRAIL
+	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	// MR_reset_ticket(Ticket, MR_solve);
+#endif
+").
+
+:- pragma foreign_code("MC++", discard_ticket,
+	[will_not_call_mercury, thread_safe],
+"
+#ifdef MR_USE_TRAIL
+	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	// MR_discard_ticket();
+#endif
+").
+
+:- pragma foreign_code("MC++", prune_ticket,
+	[will_not_call_mercury, thread_safe],
+"
+#ifdef MR_USE_TRAIL
+	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	// MR_prune_ticket();
+#endif
+").
+
+:- pragma foreign_code("MC++", mark_ticket_stack(TicketCounter::out),
+	[will_not_call_mercury, thread_safe],
+"
+#ifdef MR_USE_TRAIL
+	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	// MR_mark_ticket_stack(TicketCounter);
+#else
+	TicketCounter = 0;
+#endif
+").
+
+:- pragma foreign_code("MC++", prune_tickets_to(TicketCounter::in),
+	[will_not_call_mercury, thread_safe],
+"
+#ifdef MR_USE_TRAIL
+	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	// MR_prune_tickets_to(TicketCounter);
+#endif
+").
+
 
 trailed_nondet_pragma_foreign_code :-
 	Msg = string__append_list([


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list