aboutsummaryrefslogtreecommitdiffstats
path: root/evaluator.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--evaluator.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/evaluator.c b/evaluator.c
index 87cf9a7..7f20ac0 100644
--- a/evaluator.c
+++ b/evaluator.c
@@ -1,4 +1,4 @@
-/* $Id: evaluator.c 1153 2011-07-27 05:12:30Z michael $
+/* $Id: evaluator.c 1186 2012-04-09 04:45:07Z michael $
* $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/evaluator.c $
*
* expression evaluation
@@ -631,6 +631,44 @@ static void Parse(void)
Word[length++] = '\r';
ExprPtr += 2;
break;
+ case 'x':
+ {
+ int i;
+ char hexC;
+ int hex[2];
+
+ for (i = 0; i < 2; i++) {
+ hexC = *(ExprPtr + 2 + i);
+ if (hexC >= '0' && hexC <= '9')
+ hex[i] = hexC - '0';
+ else if (hexC >= 'a' && hexC <= 'f')
+ hex[i] = hexC - 'a' + 10;
+ else if (hexC >= 'A' && hexC <= 'F')
+ hex[i] = hexC - 'A' + 10;
+ else
+ break;
+ }
+ switch (i) {
+ case 1:
+ Word[length] = hex[0];
+ ExprPtr += 3;
+ break;
+ case 2:
+ Word[length] = hex[0] * 16 + hex[1];
+ ExprPtr += 4;
+ break;
+ default:
+ error("Evaluator: Illegal hex sequence '\\x%c' in <%s> keeps unchanged.",
+ *(ExprPtr + 2), Expression);
+ Word[length] = '\\';
+ ExprPtr += 1;
+ }
+ if (Word[length] == 0)
+ error("Evaluator: Null character(s) in <%s> will be ignored.", Expression);
+ else
+ length++;
+ }
+ break;
case '0':
case '1':
case '2':