On Sat, 2013-10-05 at 16:34 +0300, Eli Zaretskii wrote:
> >   EXPORT int mk_test_gmk_setup (const gmk_floc *flocp)
> >   {
> >     gmk_add_function ("hello_world", hello_world, 0, 255, 0);
>                          ^^^^^^^^^^^
> Make functions cannot have the '_' character in their names, so it
> seems.  Here's why:
>   /* Look up a function by name.  */
> 
>   static const struct function_table_entry *
>   lookup_function (const char *s)
>   {
>     const char *e = s;
> 
>     while (*e && ( (*e >= 'a' && *e <= 'z') || *e == '-'))  <<<<<<<<<<<<
>       e++;
> 
> So if you name your function hello-world instead, it will work.
> 
> Paul, if this limitation is deliberate, I suggest to document it where
> we explain the arguments of gmk_add_function.

It's not so much a deliberate restriction, as it was a performance
improvement I added in 2002 along with the switch to hash table lookups,
and completely forgot about afterward :-).  All the existing make
functions were lowercase and contained only '-', so we avoided the
lookup effort if we found a name which could not be a function.

Now that users can define their own functions, I don't think that
restriction is appropriate anymore.  I'll fix this, thanks.

> (I can make these changes in documentation, if you agree.)

I have a vivid memory of adding documentation regarding this so let me
look around for it.


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to