Re: Plugin API



Second, the API to provide help information for plugin functions has
changed, which seems to make it quite a bit harder to provide quick help
information in scripting language plugins. Specifically,
GNM_FUNC_HELP_OLD and the arg_names field of the GnmFuncDescriptor
struct are gone. I'm sure that this was done on purpose ;-), but how are
we supposed to do this now?

That was indeed on purpose.  The old format was too
loosely defined and it was hard to parse the informtion
out that we wanted.  Also, it was creating trouble for the
translators and we have wanted to ditch it for years.

Here's a sample of how things are done now:

static GnmFuncHelp const help_lcm[] = {
        { GNM_FUNC_HELP_NAME, F_("LCM:the least common multiple")},
        { GNM_FUNC_HELP_ARG, F_("n0:positive integer")},
        { GNM_FUNC_HELP_ARG, F_("n1:positive integer")},
        { GNM_FUNC_HELP_DESCRIPTION, F_("LCM calculates the least common
multiple of the given numbers @{n0},@{n1},..., the smallest integer
that is a multiple of each argment.")},
        { GNM_FUNC_HELP_NOTE, F_("If any of the arguments is not an integer,
it is truncated.")},
        { GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
        { GNM_FUNC_HELP_EXAMPLES, "=LCM(2,13)" },
        { GNM_FUNC_HELP_EXAMPLES, "=LCM(4,7,5)" },
        { GNM_FUNC_HELP_SEEALSO, "GCD"},
        { GNM_FUNC_HELP_END}
};


Morten



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]