X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=bertos%2Fmware%2Fparser.c;h=71aec30dc980f58d1c4b1ada8060224c96878e7c;hb=751e0228258e4c9e738fdcbfd43e45cdf873a553;hp=fe6c1352714332f84da30430664fd8e90dce007d;hpb=f87390bf71f44a3ed9dc65c66128c5c6979655a9;p=bertos.git diff --git a/bertos/mware/parser.c b/bertos/mware/parser.c index fe6c1352..71aec30d 100644 --- a/bertos/mware/parser.c +++ b/bertos/mware/parser.c @@ -55,6 +55,8 @@ #include "parser.h" +#include "cfg/cfg_parser.h" + #include #include @@ -206,7 +208,7 @@ bool parser_get_cmd_id(const char* line, unsigned long* ID) * in a given text line without parsing all the parameters and * executing it. * - * \param line Text line to be processed (ASCIIZ) + * \param input Text line to be processed (ASCIIZ) * * \return The command template associated with the command contained * in the line, or NULL if the command is invalid. @@ -250,8 +252,8 @@ static const char *skip_to_params(const char *input, const struct CmdTemplate *c * The first argument will always be the command name, so the actual arguments * will start at index 1. * - * \param line Text line to be processed (ASCIIZ) - * \param templ Command template for this line + * \param input Text line to be processed (ASCIIZ) + * \param cmdp Command template for this line * \param args Will contain the extracted parameters * * \return True if everything OK, false in case of parsing error. @@ -281,7 +283,7 @@ static const void* get_key_from_command(const void* cmd, uint8_t* length) * * Process the input, calling the requested command (if found). * - * \param line Text line to be processed (ASCIIZ) + * \param input Text line to be processed (ASCIIZ) * * \return true if everything is OK, false in case of errors */ @@ -307,10 +309,11 @@ bool parser_process_line(const char* input) * Register a new command into the parser * * \param cmd Command template describing the command + * \return true if registration was successful, false otherwise */ -void parser_register_cmd(const struct CmdTemplate* cmd) +bool parser_register_cmd(const struct CmdTemplate* cmd) { - ht_insert(&commands, cmd); + return ht_insert(&commands, cmd); } void parser_init(void)