I think Alexander Shinn wrote:
>
>
> Hi,
>
> I'm trying to make a NullApplet class, similar to ConsoleApplet except
> that it provides no graphical components itself, and simply assumes the
> jess code will handle everything. To do this I need to bind the address
> of the applet to a jess variable, so that I can make calls in the jess
> code such as
>
> (?*applet* add (new java.awt.Button "Push Me"))
>
> I tried modifying the code in the README, where the variable foo is
> bound to the jess variable ?*x*, resulting in
>
>
> // Define the defglobal
> m_rete.executeCommand("(defglobal ?*applet* = 0)");
>
> // Create the Funcall object
> Funcall f = new Funcall("bind", m_rete);
>
> // Now add the arguments, in left-to-right order. Each argument
> // is a jess.Value object. Note the use of the
> // RU.EXTERNAL_ADDRESS type to pass in the Java object
> f.add(new Value(RU.putAtom("*applet*"), RU.VARIABLE));
> f.add(new Value(this, RU.EXTERNAL_ADDRESS));
>
> // Now execute the function (simpleExecute is a static
> function.)
> f.simpleExecute(f, m_rete.globalContext());
>
>
> but when I run this I get the following:
>
> Rete Exception in routine Value::externalAddressValue.
> Message: Not an external address: ?*applet* type = 8 at line 3102: (
> run ) at line 0: ( batch "brcoat.clp" ) .
>
> complaining that ?*applet* is a variable, not an address. How would I
> pass it as an address?
>
The code you show above looks fine to me.
The error message is saying that at the time that the offending
statement is executed, on the RHS of a rule, ?*applet* is not defined
yet. Most likely this is due to either accidentally using two
different Rete objects to make the calls above and the "batch" call,
or making them in the wrong order (presumably the defglobal would have
to be first, then the bind, then the batch), or perhaps the batch file
contains a (clear) function?
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (510) 294-2154
Sandia National Labs FAX: (510) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------