Re: [eclipse-clp-users] Inconsistency between ECL/Java interfaces?

From: Kish Shen <kisshen_at_cisco.com>
Date: Wed, 07 Oct 2009 23:12:30 +0100
Hi Greg,

Gregory Harman wrote:
> Hi all, I've got an issue that's driving me nuts. I have a Java-based
> project that utilizes ECLiPSe for an internal calculation. The ECLiPSe
> side has both Prolog and CHR components, which are compiled with
> chr2pl/1. In my last revision, I used EmbeddedEclipse/getInstance for
> the interaction (with streams) and it worked quite well.
> 
> Now, I'm trying to migrate to OutOfProcessEclipse so that I can have
> concurrent computations, but (with the same EclipseEngineOptions and the
> same prolog/chr code) I'm getting different behavior. Specifically, I'm
> getting warnings/advice dumped to stdout (where I'm reading my program's
> output) about deprecated predicates dumped into the output stream (from
> the compiled CHR code!). This causes problems as I now need to parse my
> computation results from warning messages in the same stream.
> 
> So, my questions are:
> 
> 1. Why is chr2pl compiling to deprecated prolog?

You have not given much information:

1. Which version of ECLiPSe are you using?

2. Which version of CHR are you using? lib(ech) or lib(chr)?

Given that you are using chr2pl to compile your CHR code, this suggest 
that you are using the old lib(chr) rather than lib(ech), as lib(ech) 
can compile CHR code directly without using chr2pl. If so, is there any 
reason why you are using lib(chr)? lib(ech) was designed to replace 
lib(ech), and is the recommended library for CHR.

As for warnings about obsolete/deprecated predicates -- I think 
lib(chr)'s chr2pl generated code that uses obsolete/deprecated 
predicates/constructs. However, this should have been fixed more than a 
year ago, before ECLiPSe version 6.0 was released.

> 2. Why do OutOfProcessEclipse and EmbeddedEclipse show different
> behavior?

There are some differences between the two, but I cannot see how you 
could get the compiler warnings in one and not the other. Are you using 
the same version of ECLiPSe for both?

The warnings are sent to the warning_output stream of ECLiPSe, which is 
explicitly mapped to stdout in the OutOfProcessEclipse. I cannot see any 
explicit handling for the warning_output stream in EmbeddedEclipse, but 
I would be surprised if it is not also mapped to stdout.

> 3. Is there some configuration tweak I can make to suppress the
> warnings/advice or direct them to a different stream than stdout?
> 
You can redirect/suppress the output of a stream using set_stream/2 -- 
so you can redirect warning_output to a different stream or suppressed 
it (redirect to null).

If you want to process your computation results, it is probably better 
to send them to Java via a from-eclipse queue that you set up, rather 
than use a pre-defined queue like output. This way you could avoid 
unexpected output. Are you sending the data using EXDR? This should make 
the processing much easier.

Cheers,

Kish

-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Wed Oct 07 2009 - 22:12:45 CEST

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