--- deliantra/server/include/preprocess 2006/08/31 06:23:19 1.1 +++ deliantra/server/include/preprocess 2006/09/03 22:45:56 1.4 @@ -1,7 +1,16 @@ #!/opt/bin/perl +use List::Util; + # todo: gather dynamically my @kw = qw( + no_pass + walk_on + walk_off + fly_on + fly_off + flying + ac activate_on_push activate_on_release @@ -247,18 +256,19 @@ %define lookup-function-name match %struct-type %compare-strncmp +%ignore-case %delimiters=, -struct kw { const char *name; enum kw index; }; +struct keyword_idx { const char *name; enum keyword index; }; %% EOF for (@kw) { - printf GPERF "%s,%s\n", $_, "KW_" . uc; + printf GPERF "%s,%s\n", $_, "KW_$_"; } print GPERF <", "", EOF @@ -267,7 +277,10 @@ printf GPERF " \"%s\",\n", $_; } -print GPERF "};\n\n"; +print GPERF "};\n"; + +printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n", + join ", ", map length, @kw; open KW, ">", "keyword.h"; @@ -276,11 +289,11 @@ #define KW_H__ enum keyword { - KW_eof, KW_error, + KW_EOF, KW_ERROR, EOF for (@kw) { - printf KW " %s,\n", "KW_" . uc; + printf KW " %s,\n", "KW_$_", } print KW <