I have the following Jess code:

...

(deffunction openInputStream ()
    (return pipedReader)
)

...

The Java side looks like this:

        pwrt = new PipedWriter();
        prdr = new PipedReader();
        pwrt.connect(prdr);
        bufprdr = new BufferedReader(prdr, 20);
        bufwrt = new BufferedWriter(pwrt, 20);
        rete = new Rete();
        rete.addInputRouter("pipedReader", bufprdr, false);

Later in Java:

...

bufwrt.write(text);  // where text looks like "T66G"
bufwrt.newLine();
...


The Jess code below gives the errors that follow:


; This is the Main logic Agent code.
(deffunction logicAgent ()
    (bind ?logFileName (constructLogFileName))
    (bind ?logID (openLogFile ?logFileName))
    (bind ?inStream (openInputStream))
    (bind ?outStream (openOutputStream))
    (bind ?systemState (bag create systemState))
    (constructSystemState ?logID ?systemState)
    (notifyUser ?logID ?outStream "Black")
    (bind ?eventCode (read ?inStream))
    (while (and (<> 0 (str-compare ?eventCode "EOF"))
           (<> 0 (str-compare ?eventCode "AEND"))) do
        (processEventCode ?logID ?outStream ?systemState ?eventCode)
        (printout t "Processed code: " ?eventCode crlf)
        (bind ?eventCode (read ?inStream))
    )
;   (printSystemState ?logID ?systemState)
    (deleteSystemState ?logID ?systemState)
    (close ?inStream)
    (close ?outStream)
    (log ?logID "Logic Agent Terminating")
    (close ?logID)
)

...

The output is:

Processed code: T25C
Processed code: T42D
Processed code: T41C
Jess reported an error in routine Tokenizer.nextChar
        while executing (read ?inStream)
        while executing (bind ?eventCode (read ?inStream))
        while executing (while (and (<> 0 (str-compare ?eventCode "EOF")) (<> 0
(str-compare ?eventCode "AEND"))) do (processEventCode ?logID ?outStream ?system
State ?eventCode) (printout t "Processed code: " ?eventCode crlf) (bind ?eventCo
de (read ?inStream)))
        while executing deffunction logicAgent
        while executing (logicAgent).
  Message: Error on input stream.
  Program text: ( logicAgent )  at line 1.
        at jess.Tokenizer.nextChar(Tokenizer.java:202)
        at jess.Tokenizer.nextToken(Tokenizer.java:132)
        at jess.Read.call(Funcall.java:599)
        at jess.FunctionHolder.call(FunctionHolder.java:37)
        at jess.Funcall.execute(Funcall.java:270)
        at jess.FuncallValue.resolveValue(FuncallValue.java:33)
        at jess.Bind.call(Funcall.java:773)
        at jess.FunctionHolder.call(FunctionHolder.java:37)
        at jess.Funcall.execute(Funcall.java:270)
        at jess.FuncallValue.resolveValue(FuncallValue.java:33)
        at jess.While.call(Funcall.java:676)
        at jess.FunctionHolder.call(FunctionHolder.java:37)
        at jess.Funcall.execute(Funcall.java:270)
        at jess.FuncallValue.resolveValue(FuncallValue.java:33)
        at jess.Deffunction.call(Deffunction.java:187)
        at jess.FunctionHolder.call(FunctionHolder.java:37)
        at jess.Funcall.execute(Funcall.java:270)
        at jess.Jesp.parseAndExecuteFuncall(Jesp.java:1596)
        at jess.Jesp.parseSexp(Jesp.java:183)
        at jess.Jesp.parse(Jesp.java:62)
        at jess.Rete.executeCommand(Rete.java:1205)


....

Any help appreciated.  I have tried with and without buffers on writer and reader.  
Different size buffers.  AsConsole or not.  readline, in all above combinations.  
Works better with ssmall buffers.

Thanks,

Kelvin

--------------------------------------------------------------------
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