Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!satisfied.apocalypse.org!news.mathworks.com!uunet!world!amzi
From: amzi@world.std.com (Amzi!)
Subject: Re: (no subject)
Message-ID: <D67tGL.9nF@world.std.com>
Organization: The World Public Access UNIX, Brookline, MA
References: <3lapur$nhk@slip-1.slip.net>
Date: Wed, 29 Mar 1995 18:45:57 GMT
Lines: 47

David Francis <francis@slip.net> writes:


>I hope this is possible:

>What I need is a lightweight prolog engine callable from C/C++ code for 
>example like this: (or similar)

Cogent Prolog is an Edinburgh-standard 150kb engine.  It has a C 
interface, C++ wrapper and general (Visual Basic et al) interface.
 
>..[other C/C++ code]

>assert("fact1");
>assert("fact2");

How about:
	cpAssertaStr(engID, "fact(1)");
	cpAssertaStr(engID, "fact(2)");

>query(&facts); // facts is avariable which gets filled in with the
>               // query results.

	tf = cpCallStr(engID, &term, "fact(X)");
	while (tf)
		{
		cpGetArg(engID, term, 1, cINT, &i);
		tf = cpRedo(engID, &term);
		}

>..[more C/C++ code]

>Do such Prolog engines exist yet??

You can get more information on the details of the Cogent API in the 
Sep/Oct issue of PC AI.  The article is also available in 
http://world.std.com/~amzi/ and on ftp.std.com:ftp/vendors/amzi/articles
or by e-mail (send us a request at amzi@world.std.com).

Regards,
Mary Kroening

-- 

    Amzi! inc.                             Cogent Prolog
    40 Samuel Prescott Drive          + Logic Server API
    Stow, MA 01775                   Active Prolog Tutor
