Re: [eclipse-clp-users] Events

From: Kish Shen <kisshen_at_...5...>
Date: Fri, 27 Jan 2012 19:12:19 +0000
Hi Bogdan,

Your questions now are probably too specific for posting to the mailing 
list -- please send them to me only, unless you feel very strongly they 
are of general interest to others on the mailing list.

The one thing I think is of general interest is to say I think your 
message illustrate why you should write your ECLiPSe code in ECLiPSe 
rather than C: it is much less readable in C, and finding out what goes 
on when you run the goal(s) is also much more difficult --in your case 
why you are getting the PTHROW error.

You are getting the PTHROW error because an (ECLiPSe) error was raised 
when executing your posted goals. Any error message should have been 
sent to the (ECLiPSe) error stream. Did you connect this stream to any C 
I/O stream so that you can see the error? (If not, outputs to the error 
stream would go to stderr, which might not be displayed when you are 
running a C program).

You seem to be trying to run the following goals:


This is a bit strange -- I am not sure why you called create_module/1 
before use_module/1 -- normally the module would be created and defined 
by the file sched.ecl that you are loading via use_module/1, so there is 
no reason for an explicit create_module before this. [In fact, 
create_module/1 should not normally be used, see its documentation]

Without knowing more details about what you are doing, it is difficult 
to be sure what is wrong. However, I think the most likely reasons for 
your problem is either

1) you already have the module sched defined when you called the above 
goals, or

2) that there is something wrong in your file sched.ecl, which is 
causing the compilation of the file to abort

You should try and see what error messages you are getting 
(alternatively, you can try and run use_module(sched) from an actual 
ECLiPSe top-level and see what happens).



On 27/01/2012 14:23, Bogdan Tanasa wrote:
> I tried to followings (for a file called sched.ecl):
> 		/* Include a user defined search procedure + scheduling */
> 		constraint = ec_term(ec_did("create_module", 1),
> ec_atom(ec_did("sched", 0)));
> 		/* Record the constraint into the CLP engine */
> 		ec_post_goal(constraint);
> 		/* Include a user defined search procedure + scheduling */
> 		constraint = ec_term(ec_did("use_module", 1),
> ec_atom(ec_did("sched", 0)));
> 		/* Record the constraint into the CLP engine */
> 		ec_post_goal(constraint);
> It seems that ec_resume return the PTHROW error which I don't know what
> means.
> Can you please help with a piece a code which loads the desired file with
> the desired clp code in it ?
> Thanks,
> Bogdan.
> -----Original Message-----
> From: Kish Shen [mailto:kisshen@...5...]
> Sent: 27 ianuarie 2012 04:05
> To: Bogdan Tanasa
> Cc:
> Subject: Re: [eclipse-clp-users] Events
> Hi Bogdan,
> First, let me repeat what I have said in my answers to some of your
> previous posts about using C and ECLiPSe: ECLiPSe is *not* a C solver
> library  -- this still seem to be what you are trying to do, as (if I
> understood you correctly), you are trying to call bb_min from C, and
> this is almost certainly not the right level at which the C interface
> should be used (i.e. the bb_min should be called by your ECLiPSe code,
> so you write most of your code in ECLiPSe, and only call the top-level
> goal from C).
> As for your question, I am not sure I understand you: you call an
> ECLiPSe goal from C by posting it, and then calling ec_resume() to pass
> control to ECLiPSe, which then execute the goal(s) you posted, and when
> it has finished (returned a solution, or otherwise terminated (failed or
> aborted)), control is returned to C, i.e. you return from the call to
> ec_resume(), so you have no need to have any signal from ECLiPSe to C to
> tell you that the goal have finished -- there is only a single thread of
> execution, and control is passed between ECLiPSe and C. Have I
> misunderstood what you wanted?
> Note that the C and C++ interfaces are essentially the same in ECLiPSe
> -- the C++ interface is essnetially just a C++ wrapper layer around the
> C interface, so you can read the chapters on the C++ interface in the
> Embedding and Interfacing manual to understand the C interface as well.
> Cheers,
> Kish
> On 26/01/2012 13:36, Bogdan Tanasa wrote:
>> Hi,
>> I am interested if there is a way to signal events to a C application when
> a
>> goal posted in eclipse has finished.
>> For example inside bb_min a search method is called. Every time when the
>> search produces a valid solution I would to notify the C application and
> do
>> some processing.
>> Thanks,
>> Bogdan.
> ----------------------------------------------------------------------------
> --
>> Keep Your Developer Skills Current with LearnDevNow!
>> The most comprehensive online learning library for Microsoft developers
>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>> Metro Style Apps, more. Free future releases when you subscribe now!
>> _______________________________________________
>> ECLiPSe-CLP-Users mailing list

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 Fri Jan 27 2012 - 19:12:28 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST