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

From: Gregory Harman <greg_at_dropfire.com>
Date: Wed, 07 Oct 2009 20:08:45 -0400
Hi Kish,

Thanks for your reply. I'm using ECLiPSe v6.0 #75. Full disclosure: I'm
a rookie at ECLiPSe, Prolog, and CHR; I've inherited the ECLiPSe
codebase, and am learning as I go. (The reason for using an old version
- if in fact I am - is that there is a pre-existing codebase and I don't
know any better.)

The prolog file I use as an entry point has a lib(ech) declaration. I'm
not sure how to determine whether the .chr source file itself is written
in the new or old version. Is there a different compile function for
ech?

Regarding the differences between OutOfProcessEclipse and
EmbeddedEclipse: I'm sure they are using the same eclipse, same
configuration, everything. The only difference is which one I use to
instantiate my Java instance - everything else is the same from there.
However, your explanation of stream handling does seem to explain the
behavior I was seeing if the warning stream is not explicitly mapped in
EE.

Agreed about creating a custom output stream; I'll do that. 

thanks,
Greg

On Wed, 2009-10-07 at 23:12 +0100, Kish Shen wrote:
> 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
> 
Received on Thu Oct 08 2009 - 00:10:04 CEST

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