absolute = False;
else
absolute = True;
- if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(value, &rtrn))
return ReportMismatch(action->type, field, "integer");
if (field == F_X)
{
scrn = value;
}
- if (!ExprResolveInteger(scrn, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(scrn, &rtrn))
return ReportMismatch(action->type, field, "integer (0..255)");
if ((rtrn.ival < 0) || (rtrn.ival > 255))
{
else
{
unsigned ndx;
- if (!ExprResolveInteger(array_ndx, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(array_ndx, &rtrn))
{
ERROR("Array subscript must be integer\n");
ACTION("Illegal subscript ignored\n");
ACTION("Attempt to use data[%d] ignored\n", ndx);
return False;
}
- if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(value, &rtrn))
return ReportMismatch(action->type, field, "integer");
if ((rtrn.ival < 0) || (rtrn.ival > 255))
{
{
if (array_ndx != NULL)
return ReportActionNotArray(action->type, field);
- if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(value, &rtrn))
return ReportMismatch(action->type, field,
"integer (range 1..255)");
if ((rtrn.ival < 0) || (rtrn.ival > 255))
{
if (array_ndx != NULL)
return ReportActionNotArray(action->type, field);
- if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(value, &rtrn))
return ReportMismatch(action->type, field,
"integer (range 1..255)");
if ((rtrn.ival < 0) || (rtrn.ival > 255))
switch (field)
{
case F_Type:
- if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(value, &rtrn))
return ReportMismatch(PrivateAction, field, "integer");
if ((rtrn.ival < 0) || (rtrn.ival > 255))
{
else
{
unsigned ndx;
- if (!ExprResolveInteger(array_ndx, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(array_ndx, &rtrn))
{
ERROR("Array subscript must be integer\n");
ACTION("Illegal subscript ignored\n");
ACTION("Attempt to use data[%d] ignored\n", ndx);
return False;
}
- if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(value, &rtrn))
return ReportMismatch(action->type, field, "integer");
if ((rtrn.ival < 0) || (rtrn.ival > 255))
{
}
return False;
}
-int
-ExprResolveInteger(ExprDef * expr,
- ExprResult * val_rtrn,
- IdentLookupFunc lookup, char * lookupPriv)
+
+/**
+ * This function returns ... something. It's a bit of a guess, really.
+ *
+ * If a string is given in value context, its first character will be
+ * returned in uval. If an integer is given in value context, it will be
+ * returned in ival. If a float is given in value context, it will be
+ * returned as millimetres (rather than points) in ival.
+ *
+ * If an ident or field reference is given, the lookup function (if given)
+ * will be called. At the moment, only RadioLookup and SimpleLookup use
+ * this, and they both return the results in uval. And don't support field
+ * references.
+ *
+ * Cool.
+ */
+static int
+ExprResolveIntegerLookup(ExprDef * expr,
+ ExprResult * val_rtrn,
+ IdentLookupFunc lookup, char * lookupPriv)
{
int ok = 0;
ExprResult leftRtrn, rightRtrn;
case OpDivide:
left = expr->value.binary.left;
right = expr->value.binary.right;
- if (ExprResolveInteger(left, &leftRtrn, lookup, lookupPriv) &&
- ExprResolveInteger(right, &rightRtrn, lookup, lookupPriv))
+ if (ExprResolveIntegerLookup(left, &leftRtrn, lookup, lookupPriv) &&
+ ExprResolveIntegerLookup(right, &rightRtrn, lookup, lookupPriv))
{
switch (expr->op)
{
WSGO("Assignment operator not implemented yet\n");
break;
case OpNot:
- left = expr->value.child;
- if (ExprResolveInteger(left, &leftRtrn, lookup, lookupPriv))
- {
- ERROR("The ! operator cannot be applied to an integer\n");
- }
+ ERROR("The ! operator cannot be applied to an integer\n");
return False;
case OpInvert:
case OpNegate:
left = expr->value.child;
- if (ExprResolveInteger(left, &leftRtrn, lookup, lookupPriv))
+ if (ExprResolveIntegerLookup(left, &leftRtrn, lookup, lookupPriv))
{
if (expr->op == OpNegate)
val_rtrn->ival = -leftRtrn.ival;
return False;
case OpUnaryPlus:
left = expr->value.child;
- return ExprResolveInteger(left, val_rtrn, lookup, lookupPriv);
+ return ExprResolveIntegerLookup(left, val_rtrn, lookup, lookupPriv);
default:
WSGO("Unknown operator %d in ResolveInteger\n", expr->op);
break;
return False;
}
+int
+ExprResolveInteger(ExprDef * expr,
+ ExprResult * val_rtrn)
+{
+ return ExprResolveIntegerLookup(expr, val_rtrn, NULL, NULL);
+}
+
int
ExprResolveRadioGroup(ExprDef * expr,
ExprResult * val_rtrn)
{
- return ExprResolveInteger(expr, val_rtrn, RadioLookup, NULL);
+ return ExprResolveIntegerLookup(expr, val_rtrn, RadioLookup, NULL);
}
int
{ NULL, 0 }
};
- return ExprResolveInteger(expr, val_rtrn, SimpleLookup,
- (char *) group_names);
+ return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup,
+ (char *) group_names);
}
int
{ NULL, 0 }
};
- return ExprResolveInteger(expr, val_rtrn, SimpleLookup,
- (char *) level_names);
+ return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup,
+ (char *) level_names);
}
int
{ NULL, 0 }
};
- return ExprResolveInteger(expr, val_rtrn, SimpleLookup,
- (char *) button_names);
+ return ExprResolveIntegerLookup(expr, val_rtrn, SimpleLookup,
+ (char *) button_names);
}
int
break;
case OpInvert:
left = expr->value.child;
- if (ExprResolveInteger(left, &leftRtrn, lookup, lookupPriv))
+ if (ExprResolveIntegerLookup(left, &leftRtrn, lookup, lookupPriv))
{
val_rtrn->ival = ~leftRtrn.ival;
return True;
case OpNegate:
case OpNot:
left = expr->value.child;
- if (ExprResolveInteger(left, &leftRtrn, lookup, lookupPriv))
+ if (ExprResolveIntegerLookup(left, &leftRtrn, lookup, lookupPriv))
{
ERROR("The %s operator cannot be used with a mask\n",
(expr->op == OpNegate ? "-" : "!"));
return True;
}
}
- ok = ExprResolveInteger(expr, val_rtrn, NULL, NULL);
+ ok = ExprResolveInteger(expr, val_rtrn);
if ((ok) && (val_rtrn->uval < 10))
val_rtrn->uval += '0';
return ok;
);
extern int ExprResolveInteger(ExprDef * /* expr */ ,
- ExprResult * /* val_rtrn */ ,
- IdentLookupFunc /* lookup */ ,
- char * /* lookupPriv */
+ ExprResult * /* val_rtrn */
);
extern int ExprResolveRadioGroup(ExprDef * /* expr */ ,
info->errorCount++;
return ReportNotArray("doodad", field, ddText(di));
}
- if (!ExprResolveInteger(value, &tmp, NULL, NULL))
+ if (!ExprResolveInteger(value, &tmp))
{
info->errorCount++;
return ReportBadType("doodad", field, ddText(di), "integer");
info->errorCount++;
return ReportNotArray("keyboard section", field, scText(si));
}
- if (!ExprResolveInteger(value, &tmp, NULL, NULL))
+ if (!ExprResolveInteger(value, &tmp))
{
info->errorCount++;
ReportBadType("keyboard section", field, scText(si), "integer");
{
if (arrayNdx != NULL)
return ReportIndicatorNotArray(led, field);
- if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
+ if (!ExprResolveInteger(value, &rtrn))
return ReportIndicatorBadType(led, field,
"indicator index");
if ((rtrn.uval < 1) || (rtrn.uval > 32))
tmp.uval = 0;
}
else {
- ok = ExprResolveInteger(value, &tmp, NULL, 0);
+ ok = ExprResolveInteger(value, &tmp);
}
if (!ok)
{
}
}
}
- if (ExprResolveInteger(def, val_rtrn, NULL, NULL))
+ if (ExprResolveInteger(def, val_rtrn))
{
if (val_rtrn->uval < XkbNumVirtualMods)
return True;