From: lottaviano Date: Sun, 28 Nov 2010 13:27:13 +0000 (+0000) Subject: doc: Move function documentation to .c file. X-Git-Tag: 2.7.0~362 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=f87390bf71f44a3ed9dc65c66128c5c6979655a9;p=bertos.git doc: Move function documentation to .c file. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4575 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/mware/parser.c b/bertos/mware/parser.c index 2d47a537..fe6c1352 100644 --- a/bertos/mware/parser.c +++ b/bertos/mware/parser.c @@ -197,6 +197,20 @@ bool parser_get_cmd_id(const char* line, unsigned long* ID) } #endif +/** + * Find the template for the command contained in the text line. + * The template can be used to tokenize the command and interpret + * it. + * + * This function can be used to find out which command is contained + * in a given text line without parsing all the parameters and + * executing it. + * + * \param line 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. + */ const struct CmdTemplate* parser_get_cmd_template(const char *input) { const char *begin = input, *end = input; @@ -230,6 +244,18 @@ static const char *skip_to_params(const char *input, const struct CmdTemplate *c return end; } +/** + * Extract the arguments for the command contained in the text line. + * + * 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 args Will contain the extracted parameters + * + * \return True if everything OK, false in case of parsing error. + */ bool parser_get_cmd_arguments(const char* input, const struct CmdTemplate* cmdp, parms args[CONFIG_PARSER_MAX_ARGS]) { input = skip_to_params(input, cmdp); @@ -250,6 +276,15 @@ static const void* get_key_from_command(const void* cmd, uint8_t* length) return c->name; } +/** + * \brief Command input handler. + * + * Process the input, calling the requested command (if found). + * + * \param line Text line to be processed (ASCIIZ) + * + * \return true if everything is OK, false in case of errors + */ bool parser_process_line(const char* input) { const struct CmdTemplate *cmdp; @@ -268,6 +303,11 @@ bool parser_process_line(const char* input) return true; } +/** + * Register a new command into the parser + * + * \param cmd Command template describing the command + */ void parser_register_cmd(const struct CmdTemplate* cmd) { ht_insert(&commands, cmd); diff --git a/bertos/mware/parser.h b/bertos/mware/parser.h index 382027c6..0e2b0b9d 100644 --- a/bertos/mware/parser.h +++ b/bertos/mware/parser.h @@ -217,13 +217,6 @@ MAKE_TEMPLATE(NAME, ARGS, RES, FLAGS) */ void parser_init(void); - -/** - * Register a new command into the parser - * - * \param cmd Command template describing the command - * - */ void parser_register_cmd(const struct CmdTemplate* cmd); @@ -236,21 +229,8 @@ void parser_register_cmd(const struct CmdTemplate* cmd); */ const char* parser_rl_match(void* dummy, const char* word, int word_len); - -/** - * \brief Command input handler. - * - * Process the input, calling the requested command - * (if found) and calling printResult() to give out - * the result (on device specified with parameter fd). - * - * \param line Text line to be processed (ASCIIZ) - * - * \return true if everything is OK, false in case of errors - */ bool parser_process_line(const char* line); - /** * Execute a command with its arguments, and fetch its results. * @@ -267,39 +247,10 @@ INLINE bool parser_execute_cmd(const struct CmdTemplate* templ, parms args[CONFI return (templ->func(args) == 0); } - -/** - * Find the template for the command contained in the text line. - * The template can be used to tokenize the command and interpret - * it. - * - * This function can be used to find out which command is contained - * in a given text line without parsing all the parameters and - * executing it. - * - * \param line 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. - */ const struct CmdTemplate* parser_get_cmd_template(const char* line); - -/** - * Extract the arguments for the command contained in the text line. - * - * 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 args Will contain the extracted parameters - * - * \return True if everything OK, false in case of parsing error. - */ bool parser_get_cmd_arguments(const char* line, const struct CmdTemplate* templ, parms args[CONFIG_PARSER_MAX_ARGS]); - #if CONFIG_ENABLE_COMPAT_BEHAVIOUR /** * Extract the ID from the command text line.