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: Non-global KRL template variables?


> I have a function that parses a KRL template. I'm wondering if it's
> possible to pass in parameters to this function that I can use as
> the variables in the KRL template.

Sorry, don't know how to do that easily.  I wanted to do the same
thing so I wrote a function that hooks directly into the underlying
Lexer to produce a function that takes in parameters and then renders
a KRL-type string.  That code has hooks into the rest of my app, so it
won't compile without some work.

I can send you the code off line if you would like, but it will
require some work on your part to make it compile.

> Oh, on an unrelated note: is there a "describe" function in scheme for 
> extracting documentation strings from a method? Are there method
> documentation strings?

Not directly.  You can define docs strings to your own functions in
Kawa using, say, set-procedure-property!

Regards,
Chris Dean

"Newton, Dave (CS)" <Dave.Newton@morganstanley.com> writes:
> Howdy,
>
> I have a function that parses a KRL template. I'm wondering if it's
> possible to pass in parameters to this function that I can use as
> the variables in the KRL template.
>
> No matter how I word that it sounds crappy. Here's an abbreviated
> version or what I want to do (more or less):
>
> -------------
> test-attr.scm
> -------------
> (define (make-attr desc type name)
>   (krl-template "attr.krl" desc type name))
> (make-attr "First name" "String" "firstName")
>
> --------
> attr.krl
> --------
>     /** [desc]. */
>     protected [type] _[name];
>
> Right now I can only do this if I define globals vars of the appropriate
> name and I've just started playing with this to see if I can get it to
> do
> what I want. I don't want to set globals but I'm not sure how to inject
> what I want into the KRL namespace (or whatever it's called in Scheme).
>
> Searching the archives didn't immediately help (although I was able to
> have
> the KRL in a string rather than in a file, which was cool, but didn't
> really
> address this issue ;)
>
> Oh, on an unrelated note: is there a "describe" function in scheme for 
> extracting documentation strings from a method? Are there method
> documentation 
> strings? Bah, my lisp/scheme is old and rusty. 
>
> Sorry for the no-brainers!
>
> Thanks,
> Dave 
> --------------------------------------------------------
>  
> NOTICE: If received in error, please destroy and notify sender.  Sender does not waive confidentiality or privilege, and use is prohibited. 
>  


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