[DGD] extension api

Darren Henderson dkh-dgd at nighttide.net
Fri Jan 16 05:28:03 CET 2004


I've been playing around with the extension api a bit. While I prefer
working with an unadorned driver there were a couple of minor irritations
I finally had to scratch.

It's pretty simple to wrap something like strftime in the standard C
library, (yay, Y-M-D H:M:S timestamps without relying on manipulation of
the ctime() return value - probably not much more efficient but doesn't
seem as kludgey).

However, I'm having a bit of block when it comes to wrapping something
like sprintf while keeping the syntax of the call roughly familiar.

Shooting for an lpc prototype of

string sprintf(string format, mixed vals...);

would seem reasonable and would, I believe, lead to an api prototype of
something like

char ext_sprintf_proto[] = { DGD_TYPE_STRING, DGD_TYPE_STRING,
DGD_TYPE_MIXED, DGD_TYPE_ELLIPSIS, 0 };

but I'm not sure I see a way to flatten that ellipses to hand the values
back into the c lib's sprintf. I suppose you could define a dozen or so
varargs instead and live with the limitation but that seems inelegant to
say the least.

How would others approach this? I haven't done much c coding in years so
I'm a bit rusty.


-Darren


______________________________________________________________________
Darren Henderson                                 dkh-dgd at nighttide.net

                   Help fight junk e-mail, visit http://www.cauce.org/


_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list