Turbo C and Prolog

Scott Andrew Nedderman san4023 at aim1.tamu.edu
Tue Feb 26 10:44:57 AEST 1991


I'm having trouble linking Turbo C with Turbo Prolog.  The prolog manual
has good examples of calling TC from Prolog but not the other way around.
Has anyone had experience with the following

Prolog stuff:
---------------------------------------------------------------------

GLOBAL DOMAINS
   a, b, d, descr = symbol
   c = real
   slist = symbol*

GLOBAL PREDICATES
   proc(a, b, c, d, slist) - (i, i, i, i, o) language c as "proc"

CLAUSES
% this clause returns a list of the descriptions (Descr) that match
% A, B, C, and D in mydb
proc(A, B, C, D, Slist) :-
   findall(Descr, mydb(A, B, C, _, D, Descr), Slist).

---------------------------------------------------------------------

My questions are:
  How do I call `proc' from Turbo C (including declarations)?
  How can I pass a "don't care" parameter from Turbo C?

The Prolog manual has a TC example similar to the following, but this
is lacking something.
---------------------------------------------------------------------

struct node {
   unsigned char functor;      /* The type */
   char *value;                /* A string pointer */
   struct node *next;          /* A pointer to struct node */
} strlist;

void howdy()
{
   strlist *List;

   printf("I'm in Turbo C\n\n");
   proc("Stuff", "More", "_", "Another",  List);
}

---------------------------------------------------------------------

If anyone has examples of the correct way to do this, I would greatly
appreciate them.

                                            Scott


+-----------------------------+-----------------------------------+
| Scott A. Nedderman          | Internet: sanhelp at venus.tamu.edu  |
| Academic Computing Services | Bitnet:   sanhelp at tamvenus        |
| #include "TeXstuff.h"       | THEnet:   thor::sanhelp           |
+-----------------------------+-----------------------------------+



More information about the Comp.lang.c mailing list