summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschodet2006-03-11 10:35:28 +0000
committerschodet2006-03-11 10:35:28 +0000
commita097d1dd557743d1f379dfaefaf8fdce7af078c4 (patch)
treedcbdf1f12e7a5c6aa9402736a6e084c94666d26e
parent25e0271f872d86cd1fce02327ccc7534127c9cf7 (diff)
Ajout du suport des quillemets :
!p"hello world
-rw-r--r--n/avr/modules/proto/proto.c20
-rw-r--r--n/avr/modules/proto/proto.txt12
2 files changed, 28 insertions, 4 deletions
diff --git a/n/avr/modules/proto/proto.c b/n/avr/modules/proto/proto.c
index 5d54b36..72aa251 100644
--- a/n/avr/modules/proto/proto.c
+++ b/n/avr/modules/proto/proto.c
@@ -54,7 +54,8 @@ static uint8_t args[AC_PROTO_ARGS_MAX_SIZE];
* - 1: bang received.
* - 2: command received.
* - 3: command received, and processing a number.
- * - 4: quote received. */
+ * - 4: quote received.
+ * - 5: double quote received. */
static uint8_t step;
/** Accept a new character. */
@@ -94,6 +95,8 @@ proto_accept (uint8_t c)
#if AC_PROTO_QUOTE == 1
else if (c == '\'')
step = 4;
+ else if (c == '"')
+ step = 5;
#endif
else
{
@@ -110,6 +113,17 @@ proto_accept (uint8_t c)
step = 2;
proto_accept_char (c);
break;
+ case 5:
+ if (c == '\r')
+ {
+ AC_PROTO_CALLBACK (cmd, size, args);
+ step = 0;
+ }
+ else
+ {
+ proto_accept_char (c);
+ }
+ break;
#endif
}
}
@@ -151,8 +165,8 @@ proto_accept_digit (uint8_t c)
static void
proto_accept_char (uint8_t c)
{
- /* Test for argument list overflow. */
- if (size >= AC_PROTO_ARGS_MAX_SIZE)
+ /* Test for argument list overflow or unwanted char. */
+ if (size >= AC_PROTO_ARGS_MAX_SIZE || !isprint (c))
{
AC_PROTO_CALLBACK ('?', 0, 0);
step = 0;
diff --git a/n/avr/modules/proto/proto.txt b/n/avr/modules/proto/proto.txt
index 780dbef..2a20d26 100644
--- a/n/avr/modules/proto/proto.txt
+++ b/n/avr/modules/proto/proto.txt
@@ -35,7 +35,7 @@ Par exemple :
^>>
On peut aussi envoyer directement un caractère ascii en paramètre en le
-précédant d'une apostrophe.
+précédant d'une apostrophe, ce caractère devant être imprimable.
Par exemple :
@@ -43,6 +43,16 @@ Par exemple :
!p'sa800
^>>
+Enfin, on peut envoyer une chaine de caractères imprimables.
+
+Par exemple :
+
+^<<
+!p"Hello World
+^>>
+
+Attention, le point d'exclamation reste un caractère spécial.
+
* Vérification d'erreur
La vérification d'erreur n'est pas forcée par l'utilisation de ce module. En