Skip to content

Commit 8197739

Browse files
committed
doxygen: finsh: Normalize macro definitions
Regular macro definitions according to [1]. Note: for variadic macros such as MSH_CMD_EXPORT, we can not use normal @param command, otherwise doxygen will report "@param is not found in the argument list of ...". So I just write the parameters by manual. Link: https://rt-thread.github.io/rt-thread/page_howto_macro.html [1] Signed-off-by: Chen Wang <[email protected]>
1 parent 9677283 commit 8197739

File tree

1 file changed

+53
-35
lines changed

1 file changed

+53
-35
lines changed

components/finsh/finsh.h

+53-35
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ typedef long (*syscall_func)(void);
3636
#endif /* __TI_COMPILER_VERSION__ */
3737

3838
/**
39-
* Macro to export a command along with its name, description, and options to the symbol table in MSVC.
40-
* @param name The function name associated with the command.
41-
* @param cmd The command name.
42-
* @param desc The description of the command.
43-
* @param opt The options associated with the command, used for option completion.
39+
* @brief Macro to export a command along with its name, description, and options to the symbol table in MSVC.
40+
*
41+
* @param[in] name The function name associated with the command.
42+
* @param[in] cmd The command name.
43+
* @param[in] desc The description of the command.
44+
* @param[in] opt The options associated with the command, used for option completion.
4445
*/
4546
#ifdef _MSC_VER
4647
#define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc, opt) \
@@ -90,7 +91,7 @@ typedef long (*syscall_func)(void);
9091
#endif /* FINSH_USING_SYMTAB */
9192

9293
/**
93-
* Macro definitions to simplify the declaration of exported functions or commands.
94+
* @brief Macro definitions to simplify the declaration of exported functions or commands.
9495
*/
9596
#define __MSH_GET_MACRO(_1, _2, _3, _FUN, ...) _FUN
9697
#define __MSH_GET_EXPORT_MACRO(_1, _2, _3, _4, _FUN, ...) _FUN
@@ -111,51 +112,65 @@ typedef long (*syscall_func)(void);
111112
/**
112113
* @ingroup group_finsh
113114
*
114-
* This macro exports a system function to finsh shell.
115+
* @brief This macro exports a system function to finsh shell.
115116
*
116-
* @param name the name of function.
117-
* @param desc the description of function, which will show in help.
117+
* @param[in] name Name of function.
118+
* @param[in] desc Description of function, which will show in help.
118119
*/
119120
#define FINSH_FUNCTION_EXPORT(name, desc)
120121

121122
/**
122123
* @ingroup group_finsh
123124
*
124-
* This macro exports a system function with an alias name to finsh shell.
125+
* @brief Exports a system function with an alias name to finsh shell.
125126
*
126-
* @param name the name of function.
127-
* @param alias the alias name of function.
128-
* @param desc the description of function, which will show in help.
127+
* @param[in] name Name of function.
128+
* @param[in] alias Alias name of function.
129+
* @param[in] desc Description of function, which will show in help.
129130
*/
130131
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc)
131132

132133
/**
133134
* @ingroup group_finsh
134135
*
135-
* This macro exports a command to module shell.
136+
* @brief Exports a command to module shell.
137+
*
138+
* @b Parameters
139+
*
140+
* <tt>[in]</tt> @b command Name of the command.
141+
*
142+
* <tt>[in]</tt> @b desc Description of the command, which will show in help list.
136143
*
137-
* param command is the name of the command.
138-
* param desc is the description of the command, which will show in help list.
139-
* param opt This is an option, enter any content to enable option completion
144+
* <tt>[in]</tt> @b opt This is an option, enter any content to enable option completion
145+
*
146+
* @note This macro can be used in two ways:
147+
* @code MSH_CMD_EXPORT(command, desc) @endcode
148+
* or
149+
* @code MSH_CMD_EXPORT(command, desc, opt) @endcode
140150
*/
141-
/* MSH_CMD_EXPORT(command, desc) or MSH_CMD_EXPORT(command, desc, opt) */
142151
#define MSH_CMD_EXPORT(...) \
143152
__MSH_GET_MACRO(__VA_ARGS__, _MSH_FUNCTION_CMD2_OPT, \
144153
_MSH_FUNCTION_CMD2)(__VA_ARGS__)
145154

146155
/**
147156
* @ingroup group_finsh
148157
*
149-
* This macro exports a command with alias to module shell.
158+
* @brief Exports a command with alias to module shell.
159+
*
160+
* @b Parameters
161+
*
162+
* <tt>[in]</tt> @b command Name of the command.
150163
*
151-
* param command is the name of the command.
152-
* param alias is the alias of the command.
153-
* param desc is the description of the command, which will show in help list.
154-
* param opt This is an option, enter any content to enable option completion
155-
* @code
156-
* #define MSH_CMD_EXPORT_ALIAS(command, alias, desc) or
157-
* #define MSH_CMD_EXPORT_ALIAS(command, alias, desc, opt)
158-
* @endcode
164+
* <tt>[in]</tt> @b alias Alias of the command.
165+
*
166+
* <tt>[in]</tt> @b desc Description of the command, which will show in help list.
167+
*
168+
* <tt>[in]</tt> @b opt An option, enter any content to enable option completion.
169+
*
170+
* @note This macro can be used in two ways:
171+
* @code #define MSH_CMD_EXPORT_ALIAS(command, alias, desc) @endcode
172+
* or
173+
* @code #define MSH_CMD_EXPORT_ALIAS(command, alias, desc, opt) @endcode
159174
*/
160175
#define MSH_CMD_EXPORT_ALIAS(...) \
161176
__MSH_GET_EXPORT_MACRO(__VA_ARGS__, _MSH_FUNCTION_EXPORT_CMD3_OPT, \
@@ -193,22 +208,25 @@ typedef struct msh_cmd_opt
193208
/* Command options declaration and definition macros */
194209

195210
/**
196-
* Declares a static array of command options for a specific command.
197-
* @param command The command associated with these options.
211+
* @brief Declares a static array of command options for a specific command.
212+
*
213+
* @param[in] command The command associated with these options.
198214
*/
199215
#define CMD_OPTIONS_STATEMENT(command) static struct msh_cmd_opt command##_msh_options[];
200216

201217
/**
202-
* Starts the definition of command options for a specific command.
203-
* @param command The command these options are associated with.
218+
* @brief Starts the definition of command options for a specific command.
219+
*
220+
* @param[in] command The command these options are associated with.
204221
*/
205222
#define CMD_OPTIONS_NODE_START(command) static struct msh_cmd_opt command##_msh_options[] = {
206223

207224
/**
208-
* Defines a single command option.
209-
* @param _id Unique identifier for the option.
210-
* @param _name The name of the option.
211-
* @param _des Description of the option.
225+
* @brief Defines a single command option.
226+
*
227+
* @param[in] _id Unique identifier for the option.
228+
* @param[in] _name The name of the option.
229+
* @param[in] _des Description of the option.
212230
*/
213231
#define CMD_OPTIONS_NODE(_id, _name, _des) {.id = _id, .name = #_name, .des = #_des},
214232

0 commit comments

Comments
 (0)