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

From: J. Manuel Velasco <jvelasco_at_guest.uji.es>
Date: Mon, 30 Oct 2006 13:53:24 +0100
Hello,

No, I am sorry. I am not that manou. When I start writing my name in this way
I thought I would be the only... but then I realise that no,... ;)

For use chr2pl you have to:

1) load the library: lib(chr)
2) execute the command: chr2pl(fileWithCHRExtension)
3) compile the Prolog file generated: [fileGenerated].

fileWithCHRExtension must be the prlog constraints file and the file generated 
will have the same name but with pl extension.

Try it ;)

Good luck.

Cheers,
·_· manou

El Viernes, 27 de Octubre de 2006 19:07, escribió:
> Are you manou from tinyerp by chance?  By the way I would love to get some
> help understand how to use chr2pl, can you help me to understand that more?
>
> Thanks,
>
> Tim
>
> On 10/27/06, J. Manuel Velasco <jvelasco_at_guest.uji.es> wrote:
> > 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"));
> >
> > _______________________________________________
> > ECLiPSe-Users mailing list
> > ECLiPSe-Users_at_crosscoreop.com
> > http://www.crosscoreop.com/mailman/listinfo/eclipse-users

-------------------------------------------------------
Received on Mon Oct 30 2006 - 12:53:17 CET

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