default baud rate for xbee is now 57600
[protos/xbee-avr.git] / parse_num.h
1 #ifndef _PARSE_NUM_H_
2 #define _PARSE_NUM_H_
3
4 #include "parse.h"
5
6 enum numtype {
7         UINT8 = 0,
8         UINT16,
9         UINT32,
10         UINT64,
11         INT8,
12         INT16,
13         INT32,
14         INT64,
15 #ifndef CONFIG_MODULE_PARSE_NO_FLOAT
16         FLOAT,
17 #endif
18 };
19
20 struct token_num_data {
21         enum numtype type;
22 };
23
24 struct token_num {
25         struct token_hdr hdr;
26         struct token_num_data num_data;
27 };
28 typedef struct token_num parse_token_num_t;
29 struct token_num_pgm {
30         struct token_hdr hdr;
31         struct token_num_data num_data;
32 } PROGMEM;
33 typedef struct token_num_pgm parse_pgm_token_num_t;
34
35 extern struct token_ops token_num_ops;
36
37 int8_t parse_num(parse_pgm_token_hdr_t * tk, 
38                  const char * srcbuf, void * res);
39 int8_t get_help_num(parse_pgm_token_hdr_t * tk, 
40                     char * dstbuf, uint8_t size);
41
42 #define TOKEN_NUM_INITIALIZER(structure, field, numtype)   \
43 {                                                          \
44         .hdr = {                                           \
45                 .ops = &token_num_ops,                     \
46                 .offset = offsetof(structure, field),      \
47         },                                                 \
48         .num_data = {                                      \
49                 .type = numtype,                           \
50         },                                                 \
51 }
52
53 #endif /* _PARSE_NUM_H_ */