We should be doing what tcllib does in these cases. librivetparser includes a C implementation for parsing Rivet documents, but we have a Tcl version in a package that can be loaded in case the compiled version is unavailable. They should be the same command name.
Tcllib does this everywhere. If we can compile one, we will. If we can't, we fall back to a slower, Tcl-only implementation of the same command. On Jul 5, 2013, at 11:52 AM, Massimo Manghi <massimo.man...@unipr.it> wrote: > I realized there is a Tcl interface to librivetparser implemented in > src/parser/parserPkgInit.c. > > Well this is unforgivable (am I going to be defrocked of my rank of > project chair??)....I changed the command creation calls in order to > move the commands into the ::rivet namespace but forgot about it > altogether. > > Time for writing some documentation about it, so that the memory of it > can fix into my mind. > > The code implementing the command ::rivet::parserivetdata > (Parse_RivetData) is nearly the same code I put in Rivet_ParseExecString > except for my version calling also Rivet_ExecuteAndCheck. > > On 07/05/2013 01:19 PM, Kirill Shtumf wrote: >> For example, I use templates for email-newsletters. >> >> At the moment I use for this the parser implementation on Tcl. >> >> register.html looks like this: <p>Hello <? append output $vars(username) >> ?>!</p> ... >> >> package require tclrivetparser >> set text_for_parse [read_file [file join $::conf(template) {mail} >> {register.html}]] >> set output "" >> ::tclrivetparser::setoutputcmd {append output } >> set data [::tclrivetparser::parserivetdata $text_for_parse] >> eval $data >> functions-> mail $vars(email) $vars(from) $vars(subj) $output >> > > Unless you need a pure Tcl implementation for the parser the way > tclrivetparser does, it seems ::rivet::parserivetdata might work out a > solution for your problem. > > -- > -- Massimo Manghi > > Dipartimento di Neuroscienze > Unità di Biofisica e Fisica Sanitaria > via Volturno 39 > 43125 Parma > > --------------------------------------------------------------------- > To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org > For additional commands, e-mail: rivet-dev-h...@tcl.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org For additional commands, e-mail: rivet-dev-h...@tcl.apache.org