On Jun 14, 2007, at 10:30 PM, Nathan Kurz wrote:
> Is there a way I can do this with the BoilerPlater vtable stuff? I
> haven't actually figured out how ORScorer_tally() actually gets called
> from Scorer_Tally().
Scorer_tally ... is a function.
Scorer_Tally ... is a method.
If you call Scorer_tally(foo_scorer), it will execute Scorer_tally in
Scorer.c.
If you call Scorer_Tally(foo_scorer), it will execute FooScorer_tally
in FooScorer.c.
Take a look at the code BoilerPlater generates. Here's how
Scorer_Tally is defined:
#define Kino_Scorer_Tally(self) \
(self)->_->tally((kino_Scorer*)self)
self->_ is a vtable pointer. <http://en.wikipedia.org/wiki/Vtable>
To subclass OrScorer, create MyOrScorer.c and MyOrScorer.h following
the guidelines documented in the POD for devel/lib/BoilerPlater.pm.
All you'll need is a constructor and a MyOrScorer_tally function.
The rest will inherit.
(I'll reply to the rest of your message later, but I wanted to
expedite this bit.)
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/
> Is there a way I can do this with the BoilerPlater vtable stuff? I
> haven't actually figured out how ORScorer_tally() actually gets called
> from Scorer_Tally().
Scorer_tally ... is a function.
Scorer_Tally ... is a method.
If you call Scorer_tally(foo_scorer), it will execute Scorer_tally in
Scorer.c.
If you call Scorer_Tally(foo_scorer), it will execute FooScorer_tally
in FooScorer.c.
Take a look at the code BoilerPlater generates. Here's how
Scorer_Tally is defined:
#define Kino_Scorer_Tally(self) \
(self)->_->tally((kino_Scorer*)self)
self->_ is a vtable pointer. <http://en.wikipedia.org/wiki/Vtable>
To subclass OrScorer, create MyOrScorer.c and MyOrScorer.h following
the guidelines documented in the POD for devel/lib/BoilerPlater.pm.
All you'll need is a constructor and a MyOrScorer_tally function.
The rest will inherit.
(I'll reply to the rest of your message later, but I wanted to
expedite this bit.)
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/