[m-dev.] diff: add MR_ to types and macros in samples/c_interface
Tyson Dowd
trd at cs.mu.OZ.AU
Mon Aug 7 15:54:42 AEST 2000
Hi,
fjh pointed out this needed doing.
===================================================================
Estimated hours taken: 0.5
samples/c_interface/c_calls_mercury/c_main.c:
samples/c_interface/cplusplus_calls_mercury/cpp_main.cc:
samples/c_interface/simpler_c_calls_mercury/c_main.c:
samples/c_interface/simpler_cplusplus_calls_mercury/cpp_main.cc:
Update the samples to use MR_ types and MR_ macros for
creating lists.
Index: samples/c_interface/c_calls_mercury/c_main.c
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/c_interface/c_calls_mercury/c_main.c,v
retrieving revision 1.3
diff -u -r1.3 c_main.c
--- samples/c_interface/c_calls_mercury/c_main.c 1997/02/01 13:54:05 1.3
+++ samples/c_interface/c_calls_mercury/c_main.c 2000/08/07 05:13:34
@@ -4,12 +4,12 @@
#include "c_main.h"
-typedef Word MercuryList;
+typedef MR_Word MercuryList;
static void print_list(MercuryList);
void c_main(void) {
- Integer value;
+ MR_Integer value;
MercuryList list;
printf("In c_main().\n");
@@ -76,15 +76,15 @@
}
static void print_list(MercuryList list) {
- if (list_is_empty(list)) {
+ if (MR_list_is_empty(list)) {
printf("[]");
} else {
printf("[");
printf("%ld", (long) list_head(list));
- list = list_tail(list);
- while (!list_is_empty(list)) {
- printf(", %ld", (long) list_head(list));
- list = list_tail(list);
+ list = MR_list_tail(list);
+ while (!MR_list_is_empty(list)) {
+ printf(", %ld", (long) MR_list_head(list));
+ list = MR_list_tail(list);
}
printf("]");
}
Index: samples/c_interface/cplusplus_calls_mercury/cpp_main.cc
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/c_interface/cplusplus_calls_mercury/cpp_main.cc,v
retrieving revision 1.2
diff -u -r1.2 cpp_main.cc
--- samples/c_interface/cplusplus_calls_mercury/cpp_main.cc 1998/09/02 06:51:32 1.2
+++ samples/c_interface/cplusplus_calls_mercury/cpp_main.cc 2000/08/07 05:13:59
@@ -5,7 +5,7 @@
#include "cpp_main.h"
-typedef Word MercuryList;
+typedef MR_Word MercuryList;
static void print_list(MercuryList);
@@ -25,7 +25,7 @@
** to the Mercury predicate foo/1 in mode
** :- mode foo(out) is cc_multi.
*/
- Integer value;
+ MR_Integer value;
one_foo(&value);
printf("one_foo(&value) gives value = %ld\n", (long) value);
@@ -76,15 +76,15 @@
}
static void print_list(MercuryList list) {
- if (list_is_empty(list)) {
+ if (MR_list_is_empty(list)) {
printf("[]");
} else {
printf("[");
printf("%ld", (long) list_head(list));
- list = list_tail(list);
- while (!list_is_empty(list)) {
- printf(", %ld", (long) list_head(list));
- list = list_tail(list);
+ list = MR_list_tail(list);
+ while (!MR_list_is_empty(list)) {
+ printf(", %ld", (long) MR_list_head(list));
+ list = MR_list_tail(list);
}
printf("]");
}
Index: samples/c_interface/simpler_c_calls_mercury/c_main.c
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/c_interface/simpler_c_calls_mercury/c_main.c,v
retrieving revision 1.3
diff -u -r1.3 c_main.c
--- samples/c_interface/simpler_c_calls_mercury/c_main.c 1998/09/02 06:47:19 1.3
+++ samples/c_interface/simpler_c_calls_mercury/c_main.c 2000/08/07 05:11:49
@@ -3,7 +3,7 @@
#include <stdio.h>
-typedef Word MercuryList;
+typedef MR_Word MercuryList;
static void print_list(MercuryList);
@@ -92,15 +92,15 @@
}
static void print_list(MercuryList list) {
- if (list_is_empty(list)) {
+ if (MR_list_is_empty(list)) {
printf("[]");
} else {
printf("[");
printf("%ld", (long) list_head(list));
- list = list_tail(list);
- while (!list_is_empty(list)) {
- printf(", %ld", (long) list_head(list));
- list = list_tail(list);
+ list = MR_list_tail(list);
+ while (!MR_list_is_empty(list)) {
+ printf(", %ld", (long) MR_list_head(list));
+ list = MR_list_tail(list);
}
printf("]");
}
Index: samples/c_interface/simpler_cplusplus_calls_mercury/cpp_main.cc
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/c_interface/simpler_cplusplus_calls_mercury/cpp_main.cc,v
retrieving revision 1.3
diff -u -r1.3 cpp_main.cc
--- samples/c_interface/simpler_cplusplus_calls_mercury/cpp_main.cc 1998/09/02 06:49:19 1.3
+++ samples/c_interface/simpler_cplusplus_calls_mercury/cpp_main.cc 2000/08/07 05:12:43
@@ -5,13 +5,13 @@
#include <stdio.h>
-typedef Word MercuryList;
+typedef MR_Word MercuryList;
static void print_list(MercuryList);
int main(int argc, char **argv) {
char dummy;
- Integer value;
+ MR_Integer value;
MercuryList list;
int exit_status;
@@ -94,15 +94,15 @@
}
static void print_list(MercuryList list) {
- if (list_is_empty(list)) {
+ if (MR_list_is_empty(list)) {
printf("[]");
} else {
printf("[");
printf("%ld", (long) list_head(list));
- list = list_tail(list);
+ list = MR_list_tail(list);
while (!list_is_empty(list)) {
- printf(", %ld", (long) list_head(list));
- list = list_tail(list);
+ printf(", %ld", (long) MR_list_head(list));
+ list = MR_list_tail(list);
}
printf("]");
}
--
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