expr: Remove ExprResolveFloat
authorRan Benita <ran234@gmail.com>
Mon, 23 Jul 2012 08:42:22 +0000 (11:42 +0300)
committerRan Benita <ran234@gmail.com>
Thu, 26 Jul 2012 19:55:17 +0000 (22:55 +0300)
Remnant from geometry.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/xkbcomp/expr.c
src/xkbcomp/expr.h

index e0fc5b2..7653255 100644 (file)
@@ -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)
 {
index bdaa7c6..15b880a 100644 (file)
@@ -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);