Author: remi
Date: 2008-12-01 10:23:31 +0100 (Mon, 01 Dec 2008)
New Revision: 2948

Modified:
   software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.c
   software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.h
Log:
* added comments and doxygen.

Modified: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.c
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.c      
2008-12-01 08:19:01 UTC (rev 2947)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.c      
2008-12-01 09:23:31 UTC (rev 2948)
@@ -18,6 +18,13 @@
  * 02111-1307, USA.
  */
 
+/**
+ * \file tux_cmd_parser.c
+ * \brief Command parser functions.
+ * \author [EMAIL PROTECTED]
+ * \ingroup command_parser
+ */
+
 #include <stdio.h>
 #include <string.h>
 #include <time.h>
@@ -44,22 +51,25 @@
 
 #define NRCMDS 512
 
-
+/** \brief Cmd stack structure */
 typedef struct {
-    delay_cmd_t cmd_list[NRCMDS];
-    int cmd_count;
+    delay_cmd_t cmd_list[NRCMDS]; /**< Stack */
+    int cmd_count; /**< Number of commands in stack */
 } cmd_stack_t;
 
+/** \brief Cmd stack for user */
 static cmd_stack_t user_cmd_stack;
+/** \brief Cmd stack for internal system */
 static cmd_stack_t sys_cmd_stack;
 #ifdef USE_MUTEX
 static mutex_t __stack_mutex;
 static mutex_t __macro_mutex;
 #endif
+/** \brief Flag which indicates if the parser is enabled */
 static bool cmd_parser_enable = true;
 
 /**
- *
+ * \brief Initialize the parser.
  */
 LIBLOCAL void
 tux_cmd_parser_init(void)
@@ -73,7 +83,8 @@
 }
 
 /**
- *
+ * \brief Enabling/disabling the parser.
+ * \param value Flag value.
  */
 LIBLOCAL void
 tux_cmd_parser_set_enable(bool value)
@@ -81,9 +92,13 @@
     cmd_parser_enable = value;
 }
 
-
 /**
- *
+ * \brief Get tokens from a string line.
+ * \param src_str Line to parse.
+ * \param toks Output tokens.
+ * \param max_tokens Maximum tokens to retrieve.
+ * \param delimiters Delimiters chars.
+ * \return The number of retrieved tokens.
  */
 LIBLOCAL int
 tux_cmd_parser_get_tokens(const char *src_str, tokens_t *toks,
@@ -131,7 +146,10 @@
 }
 
 /**
- *
+ * \brief Convert a string to a final movement state value.
+ * \brief conststr String to convert.
+ * \brief state Output final movement state.
+ * \return The convertion success.
  */
 static bool
 str_to_state_t(const char *conststr, move_final_state_t *state)
@@ -175,7 +193,10 @@
 }
 
 /**
- *
+ * \brief Convert a string to a led type.
+ * \brief conststr String to convert.
+ * \brief leds Output led type.
+ * \return The convertion success.
  */
 static bool
 str_to_leds_t(const char *conststr, leds_t *leds)
@@ -204,7 +225,10 @@
 }
 
 /**
- *
+ * \brief Convert a string to a led effect type.
+ * \brief conststr String to convert.
+ * \brief effect_type Output led effect type.
+ * \return The convertion success.
  */
 static bool
 str_to_effect_type(const char *conststr, effect_type_t *effect_type)
@@ -253,7 +277,10 @@
 }
 
 /**
- *
+ * \brief Parse an audio command [Level 2]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_audio_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -283,7 +310,10 @@
 }
 
 /**
- *
+ * \brief Parse an eyes command [Level 2]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_eyes_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -327,7 +357,10 @@
 }
 
 /**
- *
+ * \brief Parse an IR command [Level 2]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_ir_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -358,7 +391,10 @@
 }
 
 /**
- *
+ * \brief Parse a led command [Level 2]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_led_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -422,7 +458,10 @@
 }
 
 /**
- *
+ * \brief Parse a mouth command [Level 2]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_mouth_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -466,7 +505,10 @@
 }
 
 /**
- *
+ * \brief Parse a sound flash command [Level 2]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_sound_flash_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -486,7 +528,10 @@
 }
 
 /**
- *
+ * \brief Parse a spinning command [Level 2]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_spinning_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -542,7 +587,10 @@
 }
 
 /**
- *
+ * \brief Parse a flippers command [Level 2]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_flippers_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -596,7 +644,10 @@
 }
 
 /**
- *
+ * \brief Parse a WiFi avoidance command [Level 2]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_wifi_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -616,7 +667,10 @@
 }
 
 /**
- *
+ * \brief Parse a Tux command [Level 1]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_tux_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -672,7 +726,10 @@
 }
 
 /**
- *
+ * \brief Parse a RAW command [Level 1]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_raw_command(tokens_t tokens, delay_cmd_t *cmd)
@@ -697,7 +754,10 @@
 }
 
 /**
- *
+ * \brief Parse a command [Level 0]
+ * \param tokens Command tokens.
+ * \param cmd Cmd structure.
+ * \return The error result.
  */
 static TuxDrvError
 parse_command(const char *cmd_str, delay_cmd_t *cmd)
@@ -730,7 +790,8 @@
 }
 
 /**
- *
+ * \brief Execute an audio command.
+ * \param cmd Command to execute.
  */
 static void
 execute_audio_command (delay_cmd_t *cmd)
@@ -751,7 +812,8 @@
 }
 
 /**
- *
+ * \brief Execute an eyes command.
+ * \param cmd Command to execute.
  */
 static void
 execute_eyes_command (delay_cmd_t *cmd)
@@ -782,7 +844,8 @@
 }
 
 /**
- *
+ * \brief Execute an IR command.
+ * \param cmd Command to execute.
  */
 static void
 execute_ir_command (delay_cmd_t *cmd)
@@ -804,7 +867,8 @@
 }
 
 /**
- *
+ * \brief Execute a led command.
+ * \param cmd Command to execute.
  */
 static void
 execute_led_command (delay_cmd_t *cmd)
@@ -862,7 +926,8 @@
 }
 
 /**
- *
+ * \brief Execute a mouth command.
+ * \param cmd Command to execute.
  */
 static void
 execute_mouth_command (delay_cmd_t *cmd)
@@ -893,7 +958,8 @@
 }
 
 /**
- *
+ * \brief Execute a sound flash command.
+ * \param cmd Command to execute.
  */
 static void
 execute_sound_flash_command (delay_cmd_t *cmd)
@@ -910,7 +976,8 @@
 }
 
 /**
- *
+ * \brief Execute a spinning command.
+ * \param cmd Command to execute.
  */
 static void
 execute_spinning_command (delay_cmd_t *cmd)
@@ -940,7 +1007,8 @@
 }
 
 /**
- *
+ * \brief Execute a flippers command.
+ * \param cmd Command to execute.
  */
 static void
 execute_flippers_command (delay_cmd_t *cmd)
@@ -974,7 +1042,8 @@
 }
 
 /**
- *
+ * \brief Execute a WiFi avoidance command.
+ * \param cmd Command to execute.
  */
 static void
 execute_wifi_command (delay_cmd_t *cmd)
@@ -990,7 +1059,8 @@
 }
 
 /**
- *
+ * \brief Execute a RAW command.
+ * \param cmd Command to execute.
  */
 static void
 execute_raw_command (delay_cmd_t *cmd)
@@ -999,7 +1069,8 @@
 }
 
 /**
- *
+ * \brief Execute a command.
+ * \param cmd Command to execute.
  */
 static void
 execute_command (delay_cmd_t *cmd)
@@ -1047,7 +1118,9 @@
 }
 
 /**
- *
+ * \brief Cleanup of the system commands in order to keep the consistency of 
the
+ * system stack.
+ * \param command Command to check.
  */
 LIBLOCAL void
 tux_cmd_parser_clean_sys_command(tux_command_t command)
@@ -1096,7 +1169,10 @@
 }
 
 /**
- *
+ * \brief Insert a command in a command stack.
+ * \param delay Delay before the execution of the command.
+ * \param cmd Command to execute.
+ * \param stack Command stack how to insert the command.
  */
 static TuxDrvError
 insert_command(float delay, delay_cmd_t *cmd, cmd_stack_t *stack)
@@ -1120,7 +1196,9 @@
 }
 
 /**
- *
+ * \brief Insert a command in the system stack.
+ * \param delay Delay before the execution of the command.
+ * \param cmd Command to execute.
  */
 LIBLOCAL TuxDrvError
 tux_cmd_parser_insert_sys_command(float delay, delay_cmd_t *cmd)
@@ -1140,7 +1218,9 @@
 }
 
 /**
- *
+ * \brief Insert a command in the user stack.
+ * \param delay Delay before the execution of the command.
+ * \param cmd Command to execute.
  */
 LIBLOCAL TuxDrvError
 tux_cmd_parser_insert_user_command(float delay, const char *cmd_str)
@@ -1164,7 +1244,8 @@
 }
 
 /**
- *
+ * \brief Clear the delayed commands from the system stack.
+ * \return The result success.
  */
 LIBLOCAL bool
 tux_cmd_parser_clear_delay_commands(void)
@@ -1202,7 +1283,7 @@
 }
 
 /**
- *
+ * \brief Execute the expired commands from the stacks.
  */
 LIBLOCAL void
 tux_cmd_parser_delay_stack_perform(void)
@@ -1246,7 +1327,9 @@
 }
 
 /**
- *
+ * \brief Parse a command line string.
+ * \param line_str Line to parse.
+ * \return The error result (always E_TUXDRV_NOERROR).
  */
 static TuxDrvError
 parse_line(const char *line_str)
@@ -1267,7 +1350,9 @@
 
 
 /**
- *
+ * \brief Parse a macro string of commands.
+ * \param macro_str Macro string.
+ * \return The success result.
  */
 LIBLOCAL TuxDrvError
 tux_cmd_parser_parse_macro(const char *macro_str)
@@ -1324,7 +1409,9 @@
 }
 
 /**
- *
+ * \brief Parse a macro file of commands.
+ * \param file_path Macro file path.
+ * \return The success result.
  */
 LIBLOCAL TuxDrvError
 tux_cmd_parser_parse_file(const char *file_path)
@@ -1369,7 +1456,9 @@
 }
 
 /**
- *  Parse a command.
+ * \brief Parse a command string.
+ * \param cmd_str Command string.
+ * \return The result success.
  */
 LIBLOCAL TuxDrvError
 tux_cmd_parser_parse_command(const char *cmd_str)

Modified: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.h
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.h      
2008-12-01 08:19:01 UTC (rev 2947)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.h      
2008-12-01 09:23:31 UTC (rev 2948)
@@ -18,6 +18,13 @@
  * 02111-1307, USA.
  */
 
+/**
+ * \file tux_cmd_parser.h
+ * \brief Command parser header.
+ * \author [EMAIL PROTECTED]
+ * \ingroup command_parser
+ */
+
 #ifndef _TUX_CMD_PARSER_H_
 #define _TUX_CMD_PARSER_H_
 
@@ -26,10 +33,14 @@
 #include "tux_error.h"
 #include "tux_types.h"
 
+/** \brief Maximal size of a token */
 #define TOKENSIZE 1024
+/** \brief Maximal tokens count in a command */
 #define MAXNRTOKENS 256
 
+/** \brief Token string */
 typedef char token_str_t[TOKENSIZE];
+/** \brief Token string array */
 typedef token_str_t tokens_t[MAXNRTOKENS];
 
 extern void tux_cmd_parser_init(void);


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to