Re: [eclipse-users] embebing prolog in C++

From: J. Manuel Velasco <jvelasco_at_guest.uji.es>
Date: Fri, 27 Oct 2006 16:57:45 +0200
Hi Kish,

Thanks for your reply.

I've tried your trick, but I don't get nothing.

This is what I try:

/* LICENSE BLock
...
*/

#include	"eclipseclass.h"
#include <iostream>

using namespace std;

main()
{
    char	buf[1024];
    int		n;

    ec_set_option_int(EC_OPTION_IO, MEMORY_IO);
    ec_init();
    
   // orientacion_main is  a Prolog file
    post_goal(term(EC_functor("compile", 1), "orientacion_main"));

   // orientacion is a Prolog file got it after processing the CHR file with 
chr2pl command
    post_goal(term(EC_functor("compile", 1), "orientacion"));
    
   // This is the query I want to pass to prolog.
   // I need to do it like that because I get strings like that after
   // an image processing from a C++ controller
    ec_post_string("ctr_orient(C,A,B,[lm]),ctr_orient(D,C,B,[lm])");
    
    ec_resume();

    n = ec_queue_read(1, buf, 1024);
    buf[n] = 0;
    cout << "eclipse returned: " << buf << ".\n";

    n = ec_queue_read(2, buf, 1024);
    buf[n] = 0;
    cout << "eclipse error returned: " << buf << ".\n";

    ec_cleanup();
    exit(0);
}


And when I compile and execute it, nothing happends:

manou_at_acad5071act:~/test$ make
g++ -O  -I/home/manou/eclipse/include/i386_linux -c eg_cc_basic.cc
g++ eg_cc_basic.o -L/home/manou/eclipse/lib/i386_linux -leclipse -lgmp  
-L/home/manou/eclipse/tcltk/i386_linux/lib -L.  -lnsl -ldl -lieee -lm  -s 
-Wl,--export-dynamic -o eg_cc_basic
manou_at_acad5071act:~/test$ ./eg_cc_basic
eclipse returned: .
eclipse error returned: .

Thanks in advance for any comment.


El Viernes, 27 de Octubre de 2006 14:32, Kish Shen escribió:
> post_goal(term(EC_functor("compile", 1), "orientacion"));
Received on Fri Oct 27 2006 - 15:57:51 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:57 CET