Simple utilities sink - stuff that doesn't fit anywhere else / objects in plain C Snapshot
|
00001 #ifndef _TOKPARSER_H_ 00002 #define _TOKPARSER_H_ 00003 00004 00005 /** 00006 * @defgroup TOKENDEF 00007 * @brief take a string and check if it any one in list of tokens. 00008 * The entry TOKENDEF defines pair of token string and its integer value that identifies the token. 00009 * Parsing of string is done by comparing the input token in sequence against each entry in the table. 00010 * Not very fast, but very convenient. 00011 * 00012 * @{ 00013 */ 00014 typedef struct tagTOKENDEF { 00015 int token_type; 00016 const char *type; 00017 } TOKENDEF; 00018 00019 int parse_token(const char *token, TOKENDEF *tkdef); 00020 00021 00022 const char *token_string_for_int(int value, TOKENDEF *tkdef); 00023 00024 char *token_possible_values(TOKENDEF *tkdef); 00025 00026 /* 00027 * @} 00028 */ 00029 #endif