I've just found out that rivet/packages/tclrivet/tclrivet.tcl loaded the
C implementation loading it with command load

load [file join [file dirname [info script]] .. .. \
         librivetparser[info sharedlibextension]]

tclrivet.tcl looks like a draft for a pure Tcl environment, but left
unfinished (actually it looks like it never started a real development)

This caused a rather annoying warning because the explicit load let this
file provide 2 packages and also caused some weird problem with
librivetparser.so

I could not figure it out exactly but on my Ubuntu system requiring the
C implementation with

package require rivetparser

caused the Tcl interpreter to execute correctly one request and then
fail on every other subsequent request complaining about errors that
didn't exist actually. I don't understand why that call messed with the
Tcl interpreter internal status.

anyway I committed in trunk this change and I would like to have
feedback on this

 -- Massimo


On 07/05/2013 08:00 PM, Damon Courtney wrote:
> 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 <[email protected]>
> 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: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


-- 
-- 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]

Reply via email to