Very nice.

Thank you.
-Mitch

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, February 11, 2004 4:33 AM
To: [EMAIL PROTECTED]
Subject: Re: JESS: executeCommand() not re-entrant?


I think Mitch Christensen wrote:
> I have a user-defined function implemented in Java called
> (execute-command) that accepts a resource name (i.e. filename) argument.
> This function reads the contents of the specified resource into a
> String, and calls rete.executeCommand() on the resource's contents. 

Don't do that. executeCommand() isn't designed, as you noticed, to be
reentrant, nor to deal with large amounts of Jess code; it's designed
to handle single lines quickly. If you need to do more, then use the
parser class directly. To parse code from a URL, you'd do this:

  Rete engine = ...
  URL u = ...
  InputStream is = u.openStream();
  Jesp j = new Jesp(new InputStreamReader(is), engine);
  Value lastResult = j.parse(false);

This is all that "batch" does, except that it deals with file and
resource names.

---------------------------------------------------------
Ernest Friedman-Hill  
Science and Engineering PSEs        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to