This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: compiling KRL document
- From: Per Bothner <per at bothner dot com>
- To: Andre Labelle <andre at ammunerve dot com>
- Cc: kawa at sources dot redhat dot com
- Date: Thu, 06 Feb 2003 11:10:12 -0800
- Subject: Re: compiling KRL document
- References: <003901c2cdee$96967af0$0100a8c0@ammunerd>
Andre Labelle wrote:
Hello,
Is there any way to expand a .krl file from within kawa like this.
#|kawa:1|#(define name "andre")
#|kawa:2|#(compile-krl "jiffy.krl" "jiffy.txt")
The following seems to work:
(define (eval-krl krl-file out-file)
(let* ((env :: <gnu.mapping.Environment>
(invoke-static <gnu.mapping.Environment> 'getCurrent))
(krl :: <gnu.kawa.brl.BRL>
(invoke-static <gnu.kawa.brl.BRL> 'getKrlInstance))
(reader :: <java.io.Reader>
(open-input-file krl-file))
(output :: <output-port>
(open-output-file out-file)))
(invoke krl 'setEnvironment env)
(invoke krl 'eval reader (as <gnu.lists.Consumer> output))
(close-output-port output)))
(I suggest avoiding the name "compile-krl", as it to me
suggests compiling to a class file.)
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/