Re: [eclipse-clp-users] Forward of moderated message

From: Joachim Schimpf (Independent Contractor) <"Joachim>
Date: Fri, 06 Jun 2008 20:56:54 +0100
Hi,

the C/C++ API predates the Java/Tcl/VB APIs and is a tighter coupling.
The communication of complex terms via EXDR-encoded messages is not
implemented (although it could be done), because ECLiPSe terms can be
constructed/deconstructed directly in C/C++ without copying or conversion.
So unfortunately there is not a straight one-to-one mapping between the two.

Your ECLiPSe installation has C and C++ examples in the doc/examples directory.
Look first at eg_cc_basic.cc and eg_cc_main.cc.


> Hi ,
> 
>  
> 
> Can anybody help me for
> 
> How to create the queues using eclipse C++ API
> 
> OR
> 
> How to map/write  to the queue created in the .pl file using C++ API
> 
> OR
> 
> Can any body suggest the C++ representation of the following java code.
> 
>  
> 
> /* Compile the CLP file*/
> 
> eclipse.compile(new File(path+"\\"+eclipseFileName));

This would be done as

char *file = ...
post_goal(term(EC_functor("compile",1), file);
EC_resume();


> 
>           
> 
> /* Set up the java representation of the two (input and output) queue 
> streams*/
> 
> java_to_eclipse = eclipse.getToEclipseQueue("java_to_eclipse");
> 
> eclipse_to_java = eclipse.getFromEclipseQueue("eclipse_to_java");
> 
>         
> 
> /* Set up the two formatting streams*/
> 
> java_to_eclipse_formatted = new EXDROutputStream(java_to_eclipse);
> 
> eclipse_to_java_formatted = new EXDRInputStream(eclipse_to_java);

As I said, EXDR is not supported for the C/C++ interface.

Without knowing how you use these streams, it is hard to say know how
toctranslate this most easily - it depends on the control/data flow
that is required.  You may be able to just use post_goal/resume and use
the posted goal arguments to pass data back and forth.  Or you may use
resume/yield to switch control between C++ and ECLiPSe and pass data
via resume/yield arguments.  Or you might use text queues if your
transferred data is not of complicated structure (in that case, create
the queues in ECLiPSe using open/3,4 and access them with the functions
described for the C interface: ec_queue_read/write(), ec_queue_avail()
and ec_stream_nr()).


-- Joachim
Received on Fri Jun 06 2008 - 12:57:09 CEST

This archive was generated by hypermail 2.3.0 : Thu Feb 22 2024 - 18:13:19 CET