On 07/04/2013 03:53 PM, Harald Oehlmann wrote:
> Sorry, Massimo, I did not get it...
>
> 1) Cache: what is cached:
a Tcl script obtained from either a pure Tcl script (trivial case) or a
template which implies parsing and transformation into pure Tcl
> 1.a) the verbatim .rvt file?
No, as I said it's Tcl code produced by the parser
> 1.b) or the parsed html output of the rvt. file ?
Each chunk of HTML is set as argument of a "puts -nonewline ..." and
interleaved with the embedded Tcl code
>
> I would consider 1.b) as quite dangerous, as already a
> "<? [clock now] ?>" would not work any more...
>
I think I have dissolved your concerns: Rivet has been working that way
ever since. In your case "[clock now]" would go into the cache entry
> 2) About the new command "parse -string xxx" -
> This sounds logic to me. We have something like "<bod><h1><? db get
> header ?></h1></body>" in a data base and then, put it into the tag
> replacement, so essentially do:
> subst $template
> where the command tags are not "[]" but "<??>".
>
> Ok, in which scope, the tags are evaluated ?
> 2.a) current scope
> 2.b) global scope
the scope of the caller, as for the 'parse' command
>
> I think this is useful, no issue Massimo.
>
> So parse may be implemented as:
> proc parse filename {
> set f [open $filename r]
> set res [parse -string [read $f]]
> close $f
> return $res
> }
in this case the caching would be lost unless we build a new C function
::rivet::read_file_cached <filename>
which should return either the cached content or read the file, cache
the content and then return it
--
-- Massimo Manghi
Dipartimento di Neuroscienze
Unità di Biofisica e Fisica Sanitaria
via Volturno 39
43125 Parma
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]