Re: [eclipse-users] more questions although there are no replies :(

From: J. Manuel Velasco <jvelasco_at_guest.uji.es>
Date: Fri, 3 Nov 2006 11:59:45 +0100
El Martes, 31 de Octubre de 2006 22:03, Joachim Schimpf escribió:
> J. Manuel Velasco wrote:
> > Can't I compile the prolog code like that:
> >     post_goal(term(EC_functor("compile", 1), "familia"));
> >
> > and then make questions from C/C++ ???
>
> Here is an example (on Linux):
>
...

Dear Joachim,

Thanks a lot to give me a hand and on GNU/Linux, the system we love ;) I 
really appreciate because I feel desesperate with this issue.

I have tried you code and works fine, although there is always a 'but'. When I 
try to update to get my goal, I start little by little with a family tree 
example. And although the code executes fine, I obtain results not expected.

Here is the prolog code.

% prolog file: family.pl
padre(juan,juanma).
padre(javier,eduardo).
padre(pedro, pascual).
padre(daniel,juanma).

es_hermano(X,Y):- padre(X,Z),padre(Y,Z).

Here is the C++ code updated from your code to my needs.

// C++ file
#include "eclipseclass.h"
#include <iostream>

using namespace std;

main()
{
ec_init();

post_goal(term(EC_functor("compile",1),"family"));

if (EC_resume() != EC_succeed)
{
  cout << "Compilation failed\n";
  exit(-1);
}

EC_ref Result;

//post_goal(term(EC_functor("twice",2), 123, Result));
post_goal(term(EC_functor("es_hermano",2), "daniel", Result));

if (EC_resume() == EC_succeed)
 {
  long i;
  if (EC_word(Result).is_long(&i) == EC_succeed)
     cout << i << "\n";
  else
     cout << "unexpected result type";
 }
else
 {
   cout << "goal failed" << endl;
 }

ec_cleanup();    

}


In the eclipse environment I get what I expect:

[eclipse 3]: es_hermano(juan,daniel).

Yes (0.00s cpu)

But executing the C++ code I always get:
manou_at_acad5071act:~/test$ ./eg_cc_basic
goal failed


I am studing your foo.ecl code in eclipse to try to understand the right use. 
I saw I can use twice as a function that returns the double - using a 
variable -, or I can ask if one parameter is the double of the other and 
returns yes or not. Anyway, I don't get what I am doing wrong.

When you have time and if that doesn't bother to you too much I would 
appreciate your guide.

Thanks for your time in advance.

Best Regards,
·_· manou

> -- Joachim
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users_at_crosscoreop.com
> http://www.crosscoreop.com/mailman/listinfo/eclipse-users
Received on Fri Nov 03 2006 - 10:59:12 CET

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