[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
including two gperf-generated .c files
From: |
Jim Meyering |
Subject: |
including two gperf-generated .c files |
Date: |
Fri, 07 Sep 2007 18:05:23 +0200 |
Brendan Kehoe <address@hidden> wrote:
>> As you probably know, the sourceforge gperf-bugs list is useless.
>> All it gets is spam. And gperf-list has had no traffic for 4(!) years.
>>
>> Have you considered moving the sources and mailing list to savannah?
>> There, the lists are essentially guaranteed to be spam-free,
>> and you can use git.
>
> I thought about the above but put off the idea since there didn't seem
> to be enough activity to make it worth the effort. Of course
> savannah's improved since then, so perhaps it was my first
> impression...
Hi Brendan,
That makes sense. But if you decide to move to git, I can help.
BTW, recently I included two gperf-generated .c files
into one, but got redefinition errors on a handful of
macros as well as the "hash" function. Here's the
kludge I had to use to avoid those errors:
#define hash(a,b) hash_attr_lookup (a, b)
#include "attr-lookup.c"
#undef hash
/* Un-define the following so that subsequent of the next gperf-generated
.c file doesn't evoke redefinition errors. */
#undef TOTAL_KEYWORDS
#undef MIN_WORD_LENGTH
#undef MAX_WORD_LENGTH
#undef MIN_HASH_VALUE
#undef MAX_HASH_VALUE
#include "col-lookup.c"
It would be nice if those #undef directives were
emitted automatically into each .c file.
Also nice would be an option to specify a new name for the
"hash" function. You could even use the name specified via
--lookup-function-name=NAME as a prefix for the associated "hash"
function. Then there'd be no need for a new option.
FYI, here are the options I'm using, followed by the commands
used to generated the two files mentioned above:
GPERF_OPTIONS = \
--language=ANSI-C \
--readonly-tables \
--no-strlen \
--struct-type \
--size-multiple 2 \
--key-positions='*'
$(GPERF) $(GPERF_OPTIONS) --lookup-function-name=attr_lookup $<
$(GPERF) $(GPERF_OPTIONS) --lookup-function-name=col_lookup $<