This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

some questions using callbacks to java


typing with 1 hand (broke the other) so apologies for lowercase and lack of
punctuation, etc.

i'm installing some objects in the kawa environment like this:

public class kawaToJavaCallbacks {
    
    public class debugCallbacks {
        Environment e;
        public void print ( String message ) {
            System.out.println( "debugCallbacks: print()
            called with message: " + message );
        }
        
        public void test_bind ( String name ) {
            Object result = e . put ( name, "test-bound-object" );
        }

        public debugCallbacks ( Environment theEnvironment ) {
            e = theEnvironment;
        }
    }

    public kawaToJavaCallbacks ( Environment e ) {
        Object result;
        result = e . put ( "debug-callbacks", new debugCallbacks ( e ) );
    }

then i'm invoking these like this in a kawa program:

            (begin
                (invoke debug-callbacks 'print "script point 1")
                (invoke parameter-callbacks 'test_bind "patient")
                (invoke debug-callbacks 'print patient)
            )

when i evaluate the kawa body i get

<string>:1:332: warning - no method `print' in java.lang.Object
<string>:1:381: warning - no method `test_bind' in java.lang.Object
<string>:1:427: warning - no method `print' in java.lang.Object

is there a way to avoid these warnings going to stdout?

the first callback works, then the test_bind fires. it appears to execute
ok, but then when executing the next callback i get

Unbound Symbol exception: Unbound symbol patient

is this possible, to change bindings in the environment at run-time using
callbacks? am i doing something obviously wrong?

thanks, 

paul

--
Paul R. Potts * Technology Group Leader * Health Media Research Lab
Comprehensive Cancer Center * University of Michigan Medical Center
734.936.0096 * potts@umich.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]