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

From: J. Manuel Velasco <jvelasco_at_...4...>
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:


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

using namespace std;

    char	buf[1024];
    int		n;

    ec_set_option_int(EC_OPTION_IO, MEMORY_IO);
   // 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

    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";


And when I compile and execute it, nothing happends:

manou_at_...12...:~/test$ make
g++ -O  -I/home/manou/eclipse/include/i386_linux -c
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_...12...:~/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.3.0 : Tue Aug 20 2019 - 09:14:20 CEST