Add wizard mark. Clean up. Use kfile instead ser.
authorasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 7 May 2010 16:01:09 +0000 (16:01 +0000)
committerasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 7 May 2010 16:01:09 +0000 (16:01 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3629 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/cfg/cfg_parser.h
bertos/mware/parser.c
bertos/mware/parser.h

index c28dcc3edb35a6f33ba0170535e4f79eb249a24d..572b4a24f40450bf7d45d391ad6a8cfc739a6f2b 100644 (file)
  *
  * \brief Configuration file for parser module.
  *
- * \version $Id$
- *
  * \author Daniele Basile <asterix@develer.com>
  */
 
 #ifndef CFG_PARSER_H
 #define CFG_PARSER_H
 
-/// TODO
-#define CONFIG_INTERNAL_COMMANDS 0
+
 
 #endif /* CFG_PARSER_H */
 
index 57dc6cf960b9bf2608fcda2e3634ae7b0c098cc3..b06013c8186746b76a173f7bf40bfcc9f27f763f 100644 (file)
@@ -30,9 +30,9 @@
  * All Rights Reserved.
  * -->
  *
- * \brief Serial protocol parser and commands.
+ * \brief Channel protocol parser and commands.
  *
- * This file contains the serial protocol parser and
+ * This file contains the channel protocol parser and
  * the definition of the protocol commands. Commands are defined
  * in a "CmdTemplate" type array, containing:
  * - the name of the command,
@@ -45,8 +45,6 @@
  * argument is determined by format strings present in the
  * CmdTemplate table.
  *
- * \version $Id$
- *
  * \author Bernie Innocenti <bernie@codewiz.org>
  * \author Stefano Fedrigo <aleph@develer.com>
  * \author Giovanni Bajo <rasky@develer.com>
 
 #include "cfg/cfg_parser.h"
 
-#include <drv/ser.h>
+#include <kern/kfile.h>
 #include <struct/hashtable.h>
 
 #include <stdlib.h> // atol(), NULL
 #include <string.h> // strchr(), strcmp()
 
-
+//TODO:
+#define CONFIG_INTERNAL_COMMANDS  0
 
 #define ARG_SEP_S " "
 #define ARG_SEP_C ' '
@@ -173,13 +172,13 @@ static bool parseArgs(const char *fmt, const char *input, parms argv[])
  * in the array result, using the format specified
  * in fmt.
  *
- * \param ser     Serial handle.
+ * \param ch     Channel handle.
  * \param fmt     Values format string.
  * \param result  Array containing result to be printed.
  *
  * \return -1 in case of errors, otherwise 0.
  */
-static int printResult(struct Serial *ser, const char *fmt, parms result[])
+static int printResult(KFile *ch, const char *fmt, parms result[])
 {
        long n;
        char repeat_cnt = 0;
@@ -203,23 +202,23 @@ static int printResult(struct Serial *ser, const char *fmt, parms result[])
                                switch (*fmt)
                                {
                                        case 'd':
-                                               ser_printf(ser, ARG_SEP_S "%ld", (*result).l);
+                                               kfile_printf(ch, ARG_SEP_S "%ld", (*result).l);
                                                result++;
                                                break;
                                        case 'c':
-                                               ser_print(ser, ARG_SEP_S);
-                                               ser_print(ser, (*result).s);
+                                               kfile_print(ch, ARG_SEP_S);
+                                               kfile_print(ch, (*result).s);
                                                result++;
                                                break;
                                        case 's':
-                                               ser_printf(ser, ARG_SEP_S "%s", (*result).s);
+                                               kfile_printf(ch, ARG_SEP_S "%s", (*result).s);
                                                result++;
                                                break;
                                        case 'n':
                                                n = (*result++).l;
-                                               ser_printf(ser, ARG_SEP_S "%ld", n);
+                                               kfile_printf(ch, ARG_SEP_S "%ld", n);
                                                while (n--) {
-                                                       ser_printf(ser, ARG_SEP_S "%ld", (*result).l);
+                                                       kfile_printf(ch, ARG_SEP_S "%ld", (*result).l);
                                                        result++;
                                                }
                                                break;
@@ -236,7 +235,7 @@ static int printResult(struct Serial *ser, const char *fmt, parms result[])
        } /* while (*fmt) */
 
 
-       ser_print(ser, "\r\n");
+       kfile_print(ch, "\r\n");
        return 0;
 }
 #endif /* UNUSED_CODE */
index 93fb8d8ff5408fee259046c065a9344d6db0e777..16fa4534974e8bf744aa1ee8225d410b7d2f1ad2 100644 (file)
  * All Rights Reserved.
  * -->
  *
- * \version $Id$
- *
  * \author Bernie Innocenti <bernie@codewiz.org>
  * \author Stefano Fedrigo <aleph@develer.com>
  * \author Giovanni Bajo <rasky@develer.com>
  *
- * \brief serial protocol parser and commands.
+ * \brief Channel protocol parser and commands.
+ *
+ * $WIZ$ module_name = "parser"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_parser.h"
+ * $WIZ$ module_depends = "kfile", "hashtable"
  */