00001 #ifndef _PARSE_STRING_H_
00002 #define _PARSE_STRING_H_
00003
00004 #include "parse.h"
00005
00006
00007 #define STR_TOKEN_SIZE 32
00008
00009 typedef char fixed_string_t[STR_TOKEN_SIZE];
00010
00011 struct token_string_data {
00012 const prog_char * str;
00013 };
00014
00015 struct token_string {
00016 struct token_hdr hdr;
00017 struct token_string_data string_data;
00018 };
00019 typedef struct token_string parse_token_string_t;
00020 struct token_string_pgm {
00021 struct token_hdr hdr;
00022 struct token_string_data string_data;
00023 } PROGMEM;
00024 typedef struct token_string_pgm parse_pgm_token_string_t;
00025
00026 extern struct token_ops token_string_ops;
00027
00028 int8_t parse_string(parse_pgm_token_hdr_t * tk, const char * srcbuf, void * res);
00029 int8_t complete_get_nb_string(parse_pgm_token_hdr_t * tk);
00030 int8_t complete_get_elt_string(parse_pgm_token_hdr_t * tk, int8_t idx,
00031 char * dstbuf, uint8_t size);
00032 int8_t get_help_string(parse_pgm_token_hdr_t * tk, char * dstbuf, uint8_t size);
00033
00034 #define TOKEN_STRING_INITIALIZER(structure, field, string) \
00035 { \
00036 .hdr = { \
00037 .ops = &token_string_ops, \
00038 .offset = offsetof(structure, field), \
00039 }, \
00040 .string_data = { \
00041 .str = string, \
00042 }, \
00043 }
00044
00045 #endif