[m-rev.] for review: fix compilation of the library in hl*_nest* grades

Julien Fischer juliensf at cs.mu.OZ.AU
Tue Jul 27 19:43:28 AEST 2004


Estimated hours taken: 2
Branches: main

Some of the tabling functions in the runtime are incompatible
with the library when using the hl*_nest* grades.  The following
diff fixes this to the extent that the library compiles
and passes most of the tests.

runtime/mercury_tabling.h:
runtime/mercury_tabling.c:
	Handle memoing functions when using compiling
	using the hl*_nest* grades.

Julien.

Index: runtime/mercury_tabling.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.c,v
retrieving revision 1.64
diff -u -r1.64 mercury_tabling.c
--- runtime/mercury_tabling.c	20 Jul 2004 04:41:24 -0000	1.64
+++ runtime/mercury_tabling.c	27 Jul 2004 04:36:00 -0000
@@ -1356,58 +1356,116 @@
 }

 #ifdef  MR_HIGHLEVEL_CODE
+    #ifdef MR_USE_GCC_NESTED_FUNCTIONS
+
+        static void MR_CALL
+        mercury__table_builtin__table_memo_return_all_answers_2_p_0(
+            MR_AnswerList answer_list0, MR_Box *boxed_answer_block,
+            MR_NestedCont cont);
+
+        static void MR_CALL
+        mercury__table_builtin__table_memo_return_all_answers_2_p_0(
+                MR_AnswerList answer_list0, MR_Box *boxed_answer_block_ptr,
+                MR_NestedCont cont)
+        {
+            MR_AnswerList answer_list;
+            while (answer_list0 != NULL) {
+                answer_list = answer_list0->MR_aln_next_answer;
+                *boxed_answer_block_ptr =
+                     (MR_Box) answer_list0->MR_aln_answer_block;
+                cont();
+                answer_list0 = answer_list;
+            }
+        }
+
+        void MR_CALL
+        mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0(
+            MR_Box boxed_record, MR_Box *boxed_answer_block_ptr,
+            MR_NestedCont cont)
+        {
+            MR_MemoNonRecordPtr record;
+            MR_AnswerList       list;
+
+            record = (MR_MemoNonRecordPtr) boxed_record;
+            list = record->MR_mn_answer_list;
+            if (list == NULL) {
+                MR_fatal_error(
+                    "table_memo_return_all_answers_multi: no answers");
+            }
+            mercury__table_builtin__table_memo_return_all_answers_2_p_0(list,
+                boxed_answer_block_ptr, cont);
+        }
+
+        void MR_CALL
+        mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0(
+            MR_Box boxed_record, MR_Box *boxed_answer_block_ptr,
+            MR_NestedCont cont)
+        {
+            MR_MemoNonRecordPtr record;
+            MR_AnswerList       list;
+
+            record = (MR_MemoNonRecordPtr) boxed_record;
+            list = record->MR_mn_answer_list;
+            mercury__table_builtin__table_memo_return_all_answers_2_p_0(list,
+                boxed_answer_block_ptr, cont);
+        }
+
+    #else   /* ! MR_USE_GCC_NESTED_FUNCTIONS */
+
+        static void MR_CALL
+        mercury__table_builtin__table_memo_return_all_answers_2_p_0(
+            MR_AnswerList answer_list0, MR_Box *boxed_answer_block,
+            MR_Cont cont, void *cont_env_ptr);
+
+        static void MR_CALL
+        mercury__table_builtin__table_memo_return_all_answers_2_p_0(
+            MR_AnswerList answer_list0, MR_Box *boxed_answer_block_ptr,
+            MR_Cont cont, void *cont_env_ptr)
+        {
+            MR_AnswerList answer_list;
+
+            while (answer_list0 != NULL) {
+                answer_list = answer_list0->MR_aln_next_answer;
+                *boxed_answer_block_ptr =
+                     (MR_Box) answer_list0->MR_aln_answer_block;
+                cont(cont_env_ptr);
+                answer_list0 = answer_list;
+            }
+        }
+
+        void MR_CALL
+        mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0(
+            MR_Box boxed_record, MR_Box *boxed_answer_block_ptr,
+            MR_Cont cont, void *cont_env_ptr)
+        {
+            MR_MemoNonRecordPtr record;
+            MR_AnswerList       list;
+
+            record = (MR_MemoNonRecordPtr) boxed_record;
+            list = record->MR_mn_answer_list;
+            if (list == NULL) {
+                MR_fatal_error(
+                    "table_memo_return_all_answers_multi: no answers");
+            }
+            mercury__table_builtin__table_memo_return_all_answers_2_p_0(list,
+                boxed_answer_block_ptr, cont, cont_env_ptr);
+        }
+
+        void MR_CALL
+        mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0(
+            MR_Box boxed_record, MR_Box *boxed_answer_block_ptr,
+            MR_Cont cont, void *cont_env_ptr)
+        {
+            MR_MemoNonRecordPtr record;
+            MR_AnswerList       list;
+
+            record = (MR_MemoNonRecordPtr) boxed_record;
+            list = record->MR_mn_answer_list;
+            mercury__table_builtin__table_memo_return_all_answers_2_p_0(list,
+                boxed_answer_block_ptr, cont, cont_env_ptr);
+        }

-static void MR_CALL
-    mercury__table_builtin__table_memo_return_all_answers_2_p_0(
-        MR_AnswerList answer_list0, MR_Box *boxed_answer_block,
-        MR_Cont cont, void *cont_env_ptr);
-
-static void MR_CALL
-mercury__table_builtin__table_memo_return_all_answers_2_p_0(
-    MR_AnswerList answer_list0, MR_Box *boxed_answer_block_ptr,
-    MR_Cont cont, void *cont_env_ptr)
-{
-    MR_AnswerList answer_list;
-
-    while (answer_list0 != NULL) {
-        answer_list = answer_list0->MR_aln_next_answer;
-        *boxed_answer_block_ptr = (MR_Box) answer_list0->MR_aln_answer_block;
-        cont(cont_env_ptr);
-        answer_list0 = answer_list;
-    }
-}
-
-void MR_CALL
-mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0(
-    MR_Box boxed_record, MR_Box *boxed_answer_block_ptr,
-    MR_Cont cont, void *cont_env_ptr)
-{
-    MR_MemoNonRecordPtr record;
-    MR_AnswerList       list;
-
-    record = (MR_MemoNonRecordPtr) boxed_record;
-    list = record->MR_mn_answer_list;
-    if (list == NULL) {
-        MR_fatal_error("table_memo_return_all_answers_multi: no answers");
-    }
-    mercury__table_builtin__table_memo_return_all_answers_2_p_0(list,
-        boxed_answer_block_ptr, cont, cont_env_ptr);
-}
-
-void MR_CALL
-mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0(
-    MR_Box boxed_record, MR_Box *boxed_answer_block_ptr,
-    MR_Cont cont, void *cont_env_ptr)
-{
-    MR_MemoNonRecordPtr record;
-    MR_AnswerList       list;
-
-    record = (MR_MemoNonRecordPtr) boxed_record;
-    list = record->MR_mn_answer_list;
-    mercury__table_builtin__table_memo_return_all_answers_2_p_0(list,
-        boxed_answer_block_ptr, cont, cont_env_ptr);
-}
-
+    #endif /* MR_USE_GCC_NESTED_FUNCTIONS */
 #else   /* MR_HIGHLEVEL_CODE */

 MR_define_extern_entry(MR_MEMO_NON_RET_ALL_NONDET_ENTRY);
Index: runtime/mercury_tabling.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.h,v
retrieving revision 1.34
diff -u -r1.34 mercury_tabling.h
--- runtime/mercury_tabling.h	20 Jul 2004 04:41:24 -0000	1.34
+++ runtime/mercury_tabling.h	26 Jul 2004 11:04:36 -0000
@@ -397,15 +397,27 @@
 /*---------------------------------------------------------------------------*/

 #ifdef	MR_HIGHLEVEL_CODE
+    #ifdef MR_USE_GCC_NESTED_FUNCTIONS
+        extern void MR_CALL
+            mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0(
+                MR_Box record, MR_Box *answer_block_ptr,
+		MR_NestedCont cont);

-  extern void MR_CALL
-	mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0(
-		MR_Box record, MR_Box *answer_block_ptr,
-		MR_Cont cont, void *cont_env_ptr);
-  extern void MR_CALL
-  	mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0(
-		MR_Box record, MR_Box *answer_block_ptr,
-		MR_Cont cont, void *cont_env_ptr);
+	extern void MR_CALL
+	    mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0(
+	        MR_Box record, MR_Box *answer_block_ptr,
+		MR_NestedCont cont);
+    #else	/* ! MR_USE_GCC_NESTED_FUNCTIONS */
+        extern void MR_CALL
+             mercury__table_builtin__table_memo_return_all_answers_multi_2_p_0(
+                MR_Box record, MR_Box *answer_block_ptr,
+                MR_Cont cont, void *cont_env_ptr);
+
+	extern void MR_CALL
+              mercury__table_builtin__table_memo_return_all_answers_nondet_2_p_0(
+                MR_Box record, MR_Box *answer_block_ptr,
+                MR_Cont cont, void *cont_env_ptr);
+    #endif /* MR_USE_GCC_NESTED_FUNCTIONS */

 #else	/* ! MR_HIGHLEVEL_CODE */
   #define MR_MEMO_NON_RET_ALL_NONDET_ENTRY				\

--------------------------------------------------------------------------
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