Boost logo

Boost :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2006-05-12 09:52:50


 
Felipe Magno de Almeida wrote:

> > We had a similar discussion already. This involves some kind of
> > re-evaluation of some of the input sequence after changing the
> > internal state of the preprocessor. Wave currently does not
> support this.
>
> Is it hard to make wave support this?
> I was thinking that with some guarantees from wave, wrt
> side-effects in the context, it could be really useful.
> The guarantees that I think would be needed are
> rollback-semantics in face of exceptions and no side-effects
> *before* callbacks are called.
> This would allow for backup of the context only if needed.
> Depending on how much work would be necessary I could work on
> it too for my SoC proposal, since it would easy a lot my work
> on the features I would implement.

In fact, it was easy to implement for this particular case. The
'evaluated_conditional_expression()' preprocessing hook now has a bool
return value, which forces Wave to re-evaluate the expression as long as it
is 'true'. The new prototype will be:

    template <typename ContextT, typename ContainerT>
    bool
    evaluated_conditional_expression(ContextT const &ctx,
        ContainerT const& expression, bool expression_value)
    { return false; } // ok to continue, do not re-evaluate
expression

Wave guarantees to keep the own state unchanged during this, which means you
can save the context state, change a macro definition and return true to
force the expression to be re-evaluated. This scheme should ensure a
consistent behaviour.

I'll check these changes into the CVS as soon as it will be up again. It
won't be part of the Boost 1.34.0 release, though.

Regards Hartmut

>
> [snipped]
>
> Thanks,
> --
> Felipe Magno de Almeida
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk