command_options.gperf:
%{
#include "command_options.h"
typedef struct CommandOptionCode CommandOptionCode;
%}
struct CommandOption
{
const char *Option;
int OptionCode;
};
%%
+helpverbose, CommandOptionCode::HELPVERBOSE
+password, CommandOptionCode::PASSWORD
+nocopyright, CommandOptionCode::NOCOPYRIGHT
+nolog, CommandOptionCode::NOLOG
+_64bit, CommandOptionCode::_64BIT
command_options.h:
#ifndef __COMMANDOPTIONS_H
#define __COMMANDOPTIONS_H
struct CommandOptionCode
{
enum
{
HELPVERBOSE = 1,
PASSWORD = 2,
NOCOPYRIGHT = 3,
NOLOG = 4,
_64BIT = 5
};
};
#endif
当我运行时:
gperf -L C++ -t --output-file=perfecthash.hpp command_options.gperf
只得到:
不允许空输入关键字。要识别空输入关键字,您的代码应在调用 gperf 生成的查找函数之前检查 len == 0。
版本:GNU gperf 3.0.1 为什么?