J. Manuel Velasco wrote: > > // Try to call the prolog main function defined in prologCode > post_goal(term(EC_functor("main",4), A,B,C,D, Result)); main/4 has 4 arguments, but you are giving 5: A,B,C,D,Result. > if (EC_resume() == EC_succeed) > { > // Asingnation error > // prologOutput = Result; My previous mails contained sample code for how to test types and get return values from the EC_refs. See also http://eclipse-clp.org/eclipse/doc/embedding/embroot009.html#toc16 > [eclipse 2]: main(A,B,C,D). > lists.eco loaded traceable 0 bytes in 0.00 seconds > > A = A > B = B > C = C > D = D > > > Constraints: > (2) ctr_orient(1, C_255, A_269, B_283, [lm], 1) > (4) ctr_orient(1, D_1187, C_255, B_283, [lm], 1) > (5) ctr_orient(3, D_1187, A_269, B_283, [lf, l, lm], 2) > (9) ctr_orient(5, D_1187, C_255, A_269, [lm, ibl, bl, sb, br], 2) > Yes (0.01s cpu) > > But from C++ I don't know how to get the result of the CHR execution. This is not a "result". A result is when A,B,C,D have values and there are no more pending constraints. You have to think properly what kind of data you want to return to C++ (strings, numbers, whatever). Then you compute that data in Eclipse and instantiate your main goal's output variables to those results. Then you extract these variable values from the corresponding EC_refs in C++. Keep in mind that C++ has no idea about logical variables or constraints, so deal with these things on the Eclipse side, and pass only simple data types across the C++/Eclipse boundary. Some general remarks about Eclipse embedding are here: http://eclipse-clp.org/eclipse/archive/eclipse-users/0823.html -- JoachimReceived on Wed Nov 08 2006 - 02:02:07 CET
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:57 CET