This is the mail archive of the
kawa@sourceware.cygnus.com
mailing list for the Kawa project.
Re: kawa question [forwarded]
- To: <kawa at sourceware dot cygnus dot com>
- Subject: Re: kawa question [forwarded]
- From: "Paul R. Potts" <potts at umich dot edu>
- Date: Tue, 15 Feb 2000 19:14:19 -0500
Thanks, Per, for forwarding my question!
I've found another mailer to use temporarily.
I am making great progress; thanks to everyone for the suggestions.
brlewis wrote:
> Your Scheme code will be hard to understand if you have the value of a
> binding changing for unknown reasons.
This is a good idea; I will try to get something like this going. Maybe I
can do something with let or maybe my own call like
(using-journalled 'var1 'var2) ...
(stop-using-journalled)
Marco wrote:
>As a debugging trial you can move the exception handling code into the
>script using the try-catch form; here's an example...
I will probably keep the scripts simple and then wrap them in an exception
handler when I execute them.
For now I am changing my raw scripts to use quoted vars like this:
(equal? 'VegHowHigh "VeryHigh")
This lets me eval the scripts without getting undefined var problems.
Then I use some scheme code on the eval'd script.
(define possible-unbound-symbols '())
(define (fs lis)
(begin
(cond
((null? lis)
#f)
((symbol? (car lis))
(if (not (member (car lis) possible-unbound-symbols))
(set! possible-unbound-symbols (cons (car lis)
possible-unbound-symbols))))
((pair? (car lis))
(fs (car lis))))
(if (pair? (cdr lis)) (fs (cdr lis)))))
This puts the the symbols into the list of possible unbound symbols
(define (fault-possible-unbound-symbols lis)
(cond
((null? lis) #f)
(else
(begin
(fault-jfs-var (car lis))
(fault-possible-unbound-symbols (cdr lis))))))
I knew when I wrote that and it ran correctly the first time that my scheme
was coming back!
I know this is pretty clunky, but bear with me for a moment. I walk through
the list and call fault-jfs-var on each symbol, which will set up the
binding in my scheme environment.
the fault-jfs-var looks like this:
(define (fault-jfs-var j)
((primitive-interface-method
"edu.umich.med.healthmedia.hamster.schemeScriptingEnvironment"
"faultIn" <void> (<string>)) j))
The idea is that after I fault in the vars, I will turn the symbols back
into straight var references, and re-evaluate the script.(This is not the
permanent way I plan to do this).
however, when I try to eval this, kawa always generates the following error:
<string>:1:28: call to
`edu.umich.med.healthmedia.hamster.schemeScriptingEnvironment.faultIn(kawa.l
ang.FString)' has too few arguments (1; must be 2)
so I am doing something wrong.
My schemeScriptingEnvironment looks like this:
public class schemeScriptingEnvironment extends scriptingEnvironment
implements schemeCallbackModel {
void faultIn (String jfsVarName) {
...
}
where faultIn is part of schemeCallbackModel:
public interface schemeCallbackModel extends callbackModel {
public void faultIn (String jfsVarName);
}
Any ideas?
Also, life would be a lot easier if there was a predicate for telling me
whether a variable name was bound in the current environment or not. If
there was a scheme procedure for removing a binding, that would be cool too;
I won't have to do it from Java. ??? From what I can see, there is not a
standard scheme method for doing this, but I will have to check out my
heavy-duty docs at home.
Thanks,
Paul