Hi all,

Using Jess 41b2, I came across a problem with using read and readline.
I'm using NT4.0, VJ++ and MS SDK 2.01, just for the record.

The problem can be seen in the 'animal.clp' demo, in the rule
'replace-answer-node'.  When the intrinsic function 'read' is called, it
eventually gets around to calling jess.Tokenizer.nextToken().  This
calls jess.Tokenizer.nextChar().  nextChar() correctly converts \r\n
pairs to \n.  Since \n is considered whitespace, when nextChar() returns
that in the second loop of nextToken(), it puts the last char back by
calling m_ios.reset() and terminates.  This seems okay.

My problem is, when the rule then calls 'readline', the first character
read in is the \n put back by nextToken().  The function treats this as
the end of the line, and returns a string of zero length.  (in the
animal.clp demo, when it asks for a question to differentiate the last
known animal with your new animal, it completes immediately with a zero
length question).

Now it seems to me, that nextToken() is doing the right thing, by
restoring the first whitespace character after the token.  And, it seems
reasonable for the readline method to allow entering just a newline for
a string of zero length.  So, how do I get the animal.clp demo to
behave??  that is, get 'read' and 'readline' to work together??

Or, maybe this isn't a problem with other compilers/javaVMs??  Anyone
have this problem on other platforms, java VM?

TIA

Mike Fochtman

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to