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]
Other format: [Raw text]

Re: compiling KRL document


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/


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