Commit 2e245a9a417ac008aa055ac0e85cb86fdf11faa8

Ran Benita 2012-07-23T11:42:22

expr: Remove ExprResolveFloat Remnant from geometry. Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
index e0fc5b2..7653255 100644
--- a/src/xkbcomp/expr.c
+++ b/src/xkbcomp/expr.c
@@ -301,105 +301,6 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
 }
 
 int
-ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
-                 ExprResult *val_rtrn)
-{
-    int ok = 0;
-    ExprResult leftRtrn, rightRtrn;
-    ExprDef *left, *right;
-
-    switch (expr->op) {
-    case ExprValue:
-        if (expr->type == TypeString) {
-            const char *str;
-            str = xkb_atom_text(ctx, expr->value.str);
-            if ((str != NULL) && (strlen(str) == 1)) {
-                val_rtrn->uval = str[0] * XkbGeomPtsPerMM;
-                return true;
-            }
-        }
-        if (expr->type != TypeInt) {
-            log_err(ctx, "Found constant of type %s, expected a number\n",
-                    exprTypeText(expr->type));
-            return false;
-        }
-        val_rtrn->ival = expr->value.ival;
-        if (expr->type == TypeInt)
-            val_rtrn->ival *= XkbGeomPtsPerMM;
-        return true;
-
-    case ExprIdent:
-        log_err(ctx, "Numeric identifier \"%s\" unknown\n",
-                xkb_atom_text(ctx, expr->value.str));
-        return ok;
-
-    case ExprFieldRef:
-        log_err(ctx, "Numeric default \"%s.%s\" unknown\n",
-                xkb_atom_text(ctx, expr->value.field.element),
-                xkb_atom_text(ctx, expr->value.field.field));
-        return false;
-
-    case OpAdd:
-    case OpSubtract:
-    case OpMultiply:
-    case OpDivide:
-        left = expr->value.binary.left;
-        right = expr->value.binary.right;
-        if (ExprResolveFloat(ctx, left, &leftRtrn) &&
-            ExprResolveFloat(ctx, right, &rightRtrn)) {
-            switch (expr->op) {
-            case OpAdd:
-                val_rtrn->ival = leftRtrn.ival + rightRtrn.ival;
-                break;
-
-            case OpSubtract:
-                val_rtrn->ival = leftRtrn.ival - rightRtrn.ival;
-                break;
-
-            case OpMultiply:
-                val_rtrn->ival = leftRtrn.ival * rightRtrn.ival;
-                break;
-
-            case OpDivide:
-                val_rtrn->ival = leftRtrn.ival / rightRtrn.ival;
-                break;
-            }
-            return true;
-        }
-        return false;
-
-    case OpAssign:
-        log_wsgo(ctx, "Assignment operator not implemented yet\n");
-        break;
-
-    case OpNot:
-        log_err(ctx, "The ! operator cannot be applied to a number\n");
-        return false;
-
-    case OpInvert:
-    case OpNegate:
-        left = expr->value.child;
-        if (ExprResolveFloat(ctx, left, &leftRtrn)) {
-            if (expr->op == OpNegate)
-                val_rtrn->ival = -leftRtrn.ival;
-            else
-                val_rtrn->ival = ~leftRtrn.ival;
-            return true;
-        }
-        return false;
-
-    case OpUnaryPlus:
-        left = expr->value.child;
-        return ExprResolveFloat(ctx, left, val_rtrn);
-
-    default:
-        log_wsgo(ctx, "Unknown operator %d in ResolveFloat\n", expr->op);
-        break;
-    }
-    return false;
-}
-
-int
 ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
                    ExprResult *val_rtrn)
 {
diff --git a/src/xkbcomp/expr.h b/src/xkbcomp/expr.h
index bdaa7c6..15b880a 100644
--- a/src/xkbcomp/expr.h
+++ b/src/xkbcomp/expr.h
@@ -95,9 +95,6 @@ ExprResolveButton(struct xkb_context *ctx, ExprDef *expr,
                   ExprResult *val_rtrn);
 
 extern int
-ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn);
-
-extern int
 ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
                   ExprResult *val_rtrn);