00001 #ifndef _PARSE_NUM_H_
00002 #define _PARSE_NUM_H_
00003 
00004 #include "parse.h"
00005 
00006 enum numtype {
00007         UINT8 = 0,
00008         UINT16,
00009         UINT32,
00010         INT8,
00011         INT16,
00012         INT32,
00013 #ifndef CONFIG_MODULE_PARSE_NO_FLOAT
00014         FLOAT,
00015 #endif
00016 };
00017 
00018 struct token_num_data {
00019         enum numtype type;
00020 };
00021 
00022 struct token_num {
00023         struct token_hdr hdr;
00024         struct token_num_data num_data;
00025 };
00026 typedef struct token_num parse_token_num_t;
00027 struct token_num_pgm {
00028         struct token_hdr hdr;
00029         struct token_num_data num_data;
00030 } PROGMEM;
00031 typedef struct token_num_pgm parse_pgm_token_num_t;
00032 
00033 extern struct token_ops token_num_ops;
00034 
00035 int8_t parse_num(parse_pgm_token_hdr_t * tk, 
00036                  const char * srcbuf, void * res);
00037 int8_t get_help_num(parse_pgm_token_hdr_t * tk, 
00038                     char * dstbuf, uint8_t size);
00039 
00040 #define TOKEN_NUM_INITIALIZER(structure, field, numtype)   \
00041 {                                                          \
00042         .hdr = {                                           \
00043                 .ops = &token_num_ops,                     \
00044                 .offset = offsetof(structure, field),      \
00045         },                                                 \
00046         .num_data = {                                      \
00047                 .type = numtype,                           \
00048         },                                                 \
00049 }
00050 
00051 #endif