int main(int argc, char **argv) { char dummy; MR_Integer value; MercuryList list; int exit_status; printf("In main().\n"); /* ** call mercury_init() to initialize the Mercury engine. ** This must be done before we can call any Mercury predicates ** or functions. */ mercury_init(argc, argv, &dummy); /* ** call the C function foo_test(), which is the interface ** to the Mercury predicate foo/1 in mode ** :- mode foo(in) is semidet. */ printf("foo_test(42) returns %s\n", foo_test(42) ? "TRUE" : "FALSE"); printf("foo_test(43) returns %s\n", foo_test(43) ? "TRUE" : "FALSE"); /* ** call the C function one_foo(), which is the interface ** to the Mercury predicate foo/1 in mode ** :- mode foo(out) is cc_multi. */ one_foo(&value); printf("one_foo(&value) gives value = %ld\n", (long) value); /* ** call the C function foo_list(), which is the interface ** to the Mercury predicate foo/1 in mode ** :- mode foo(out) is multi. */ printf("foo_list() = "); foo_list(&list); print_list(list); printf("\n"); /* ** call the C functions bar(), bar_test(), and bar_inverse(), ** which are the C interfaces to the Mercury function bar/1 ** in the modes ** :- mode bar(in) = out is det. ** :- mode bar(out) = in is det. ** :- mode bar(in) = in is det. ** respectively. */ printf("bar(100) = %ld\n", (long) bar(100)); printf("bar_test(100, 101) returns %s\n", (bar_test(100, 101) ? "TRUE" : "FALSE")); printf("bar_test(100, 200) returns %s\n", (bar_test(100, 200) ? "TRUE" : "FALSE")); bar_inverse(&value, 101); printf("bar_inverse(&value, 101) gives value = %ld\n", (long) value); bar_inverse(&value, 200); printf("bar_inverse(&value, 200) gives value = %ld\n", (long) value); if (baz(1, &value)) { printf("baz(1, &value) returns TRUE with value = %ld\n", (long) value); } else { printf("baz(100, &value) returns FALSE\n"); } if (baz(100, &value)) { printf("baz(100, &value) returns TRUE with value = %ld\n", (long) value); } else { printf("baz(100, &value) returns FALSE\n"); } /* ** call mercury_terminate() to shutdown the Mercury engine. ** This should be done after we have finished calling Mercury ** predicates or functions. */ exit_status = mercury_terminate(); printf("Returning from main().\n"); return exit_status; }
void foo() { bpptree_map<int, int> bp_0; bpptree_map<std::string, std::string> bp_1; bpptree_map<int, int> const bp_2; bpptree_map<std::string, std::string> const bp_3; bpptree_multimap<int, int> bp_4; bpptree_multimap<std::string, std::string> bp_5; bpptree_multimap<int, int> const bp_6; bpptree_multimap<std::string, std::string> const bp_7; bpptree_set<int> bp_8; bpptree_set<std::string> bp_9; bpptree_set<int> const bp_a; bpptree_set<std::string> const bp_b; bpptree_multiset<int> bp_c; bpptree_multiset<std::string> bp_d; bpptree_multiset<int> const bp_e; bpptree_multiset<std::string> const bp_f; foo_test(bp_0); foo_test(bp_1); foo_test(bp_2); foo_test(bp_3); foo_test(bp_4); foo_test(bp_5); foo_test(bp_6); foo_test(bp_7); foo_test(bp_8); foo_test(bp_9); foo_test(bp_a); foo_test(bp_b); foo_test(bp_c); foo_test(bp_d); foo_test(bp_e); foo_test(bp_f); }