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

From: Kish Shen <kisshen_at_...5...>
Date: Thu, 08 Oct 2009 01:39:15 +0100
Gregory Harman wrote:
> 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.)
ECLiPSe 6.0 #75 is reasonably recent...

> 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?
You can simply compile CHR code with ech directly, i.e. with the normal 
compile command. chr2pl is simply alised to compile in ech for backwards 

Given the above, it seems most likely that the warnings are about your 
code, and you should probably fix these by updating your code. Can you 
give some example of the messages?

> 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.
I would be surprised if the warning_output stream is suppressed by 
default in EmbeddedRclipse, and I can't see where else it can go but 
standard output by default...



> 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

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 Thu Oct 08 2009 - 00:39:32 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 20 2019 - 03:14:36 CEST