[aravis] evaluator: fix variable with digits in their name.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] evaluator: fix variable with digits in their name.
- Date: Thu, 10 Feb 2011 10:12:27 +0000 (UTC)
commit 448dc6dd96e4607283e1195bd274fc102d2b353a
Author: Emmanuel Pacaud <emmanuel pacaud lapp in2p3 fr>
Date: Thu Feb 10 11:11:34 2011 +0100
evaluator: fix variable with digits in their name.
src/arvevaluator.c | 8 +++++++-
tests/evaluator.c | 4 ++--
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/arvevaluator.c b/src/arvevaluator.c
index 2adbd22..64efd98 100644
--- a/src/arvevaluator.c
+++ b/src/arvevaluator.c
@@ -362,7 +362,7 @@ arv_get_next_token (char **expression, ArvEvaluatorToken *previous_token)
char *end = *expression;
ptrdiff_t token_length;
- while (g_ascii_isalpha (*end) || *end == '_')
+ while (g_ascii_isalnum (*end) || *end == '_')
end++;
token_length = end - *expression;
@@ -953,6 +953,9 @@ arv_evaluator_evaluate_as_double (ArvEvaluator *evaluator, GError **error)
g_return_val_if_fail (ARV_IS_EVALUATOR (evaluator), 0.0);
+ arv_debug ("evaluator", "[Evaluator::evaluate_as_double] Expression = '%s'",
+ evaluator->priv->expression);
+
if (evaluator->priv->parsing_status == ARV_EVALUATOR_STATUS_NOT_PARSED) {
evaluator->priv->parsing_status = parse_expression (evaluator->priv->expression,
&evaluator->priv->rpn_stack);
@@ -982,6 +985,9 @@ arv_evaluator_evaluate_as_int64 (ArvEvaluator *evaluator, GError **error)
g_return_val_if_fail (ARV_IS_EVALUATOR (evaluator), 0.0);
+ arv_debug ("evaluator", "[Evaluator::evaluate_as_int64] Expression = '%s'",
+ evaluator->priv->expression);
+
if (evaluator->priv->parsing_status == ARV_EVALUATOR_STATUS_NOT_PARSED) {
evaluator->priv->parsing_status = parse_expression (evaluator->priv->expression,
&evaluator->priv->rpn_stack);
diff --git a/tests/evaluator.c b/tests/evaluator.c
index 9921d42..5c7855b 100644
--- a/tests/evaluator.c
+++ b/tests/evaluator.c
@@ -118,9 +118,9 @@ set_int64_variable_test (void)
const char *expression;
gint64 v_int64;
- evaluator = arv_evaluator_new ("A");
+ evaluator = arv_evaluator_new ("A_1");
- arv_evaluator_set_int64_variable (evaluator, "A", 123);
+ arv_evaluator_set_int64_variable (evaluator, "A_1", 123);
v_int64 = arv_evaluator_evaluate_as_int64 (evaluator, NULL);
g_assert_cmpfloat (v_int64, ==, 123);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]