Cbraz wrote: > I would like to know how can i clean all the posted goals > submitted to eclipse not executing > the ec_cleanup() method, i. e., i need that all the variables created > not been destroyed. > > Yet, are there some way to remove a specific goal? > > Cheers, > > Christian I am not sure I fully understand your problem. Maybe the manual is not very good at explaining how the post/resume mechanism works. Let me try to clarify this a bit: Posting goals is actually very similar to typing goals into an Eclipse toplevel. Let's say in your C program you post two goals ec_post_goal(goal1); ec_post_goal(goal2); This is exactly like typing the conjunction of these goals into the toplevel, i.e. ?- goal1, goal2 but note that we have not hit the run-button yet! The equivalent of hitting the run-button is to call ec_resume(). This will run the posted conjunction of goals and report success or failure. If the goals failed, the posted goals are lost and it is like getting a fresh prompt from the toplevel, i.e. ?- and we are back where we started. This means you can now post new goals without the need for any additional cleanup. If the goals succeeded, the situation is slightly different. You can now do something you can't do with the interactive toplevel: you can incrementally add more goals. E.g. ec_post_goal(goal3); will effectively append another goal to the conjunction, like ?- goal1, goal2, goal3 and when you resume, the additional goal3 will be executed, but all the bindings, constraints etc from goal1,goal2 will still be in place. Depending on your application, this may or may not be what you want! Let me assume that you simply wanted to execute a completely independent goal goal3, or rather that you want to post and execute infinitely many independent goals in succession. There are two ways of doing that: 1. If you make sure that your "old" goals do not leave any choicepoints or delayed goals behind, then you can simply post/resume more goals and garbage collection will take care of cleaning up everything leftover from the old goals. 2. You can force your old goal to fail, which will effectively give you a fresh toplevel prompt. To make your old goal fail after it has initially succeeded, you first must make sure that it has no choicepoints, then post a 'fail'-goal and resume. To make sure the goal has no choicepoints, you can either write it in such a way (e.g. wrapped in a once/1), or cut it using the facilities of the C/C++ interface, as explained in section "Calling Eclipse from C++ / Control Flow and Search" in the Embedding Manual. Since you write > i need that all the variables created not been destroyed. you probably have to use method 1. -- Joachim Schimpf / phone: +44 20 7594 8187 IC-Parc / mailto:J.Schimpf@imperial.ac.uk Imperial College London / http://www.icparc.ic.ac.uk/eclipseReceived on Wed Jun 09 14:15:36 2004
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:29 PM GMT GMT