|
From: Xavier V. <xav...@fr...> - 2004-01-17 11:12:25
|
Hi Michael, Hi list,
> > I fact, I thinked about a sort of 'callback' function : now if the eval
> > doesn't know a function, it returns an error. It may call a function
> > which loads the good plugin and evaluates the function, so that the
> > evaluator doesn't mind and everybody's happy ;) It's not the evaluator
> > that searches for plugins at startup, it 'learns' with its "errors". In
> > this way, we don't need to modify much the eval.
> And how should the evaluator know which .so to load?
That's what the compile-time generated hash is about. We can generate
(or staticaly write) a hash which lists all functions supported by a
.so, so instead of printing "Unknown function", the eval should call a
sort of "fallback" function which browses this hash, searching for the
function the eval doesn't know, example :
- we have this hash
plugins {
"i2c_sensors.so" -> "i2c_sensors";
"xmms.so" -> "xmms";
"example.so" -> "func1, func2";
...
}
then the eval has to evaluate xmms('Title'), but doesn't know this
function, it calls fallback('xmms') which :
- browses the hash
- finds function xmms is provided by xmms.so
- loads /usr/lib/lcd4linux/plugins/xmms.so
- return 0
then the evaluator can re-evaluate the function is fallback returns 0 or
print "Unknown function" if !fallback(), that's all.
I know it may be a bit confused, but it's clear in my head. I may try to
write an example of such a fallback() func, but I'm not sure to succeed.
> > This .so-ing may be later, but we should keep it in mind so that we
> > don't do silly things that will prevent us to make it then.
> Full ACK.
ACK ? what does it mean ?
Bye !
--
Xavier VELLO <xav...@fr...>
PS: please Michael DON'T cc me anymore when ou reply to the list ! Isn't
there a way to have a "reply-to" header like others maillists ?
|