From 19e6186d1a8cb9cbdd99c8b9fc07010ea8f6df46 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Tue, 26 Dec 2023 22:51:42 +0100 Subject: Reformatted OpType() --- FICS/formula.c | 54 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 17 deletions(-) (limited to 'FICS') diff --git a/FICS/formula.c b/FICS/formula.c index 816445f..69bf824 100644 --- a/FICS/formula.c +++ b/FICS/formula.c @@ -261,24 +261,44 @@ int ScanForOp (char *string, int *i) return (OP_BAD); } /* end of function ScanForOp. */ -/* OpType returns the precedence of the operator op. */ -int OpType (int op) +/* + * OpType() returns the precedence of the operator 'op'. + */ +int +OpType(int op) { - switch (op) - { - case OP_BAD: return (OPTYPE_BAD); - case OP_NONE: return (OPTYPE_NONE); - case OP_RTPAREN: return (OPTYPE_RPAREN); - case OP_OR: return (OPTYPE_OR); - case OP_AND: return (OPTYPE_AND); - case OP_EQ: case OP_NEQ: return (OPTYPE_COMPEQ); - case OP_GT: case OP_GE: case OP_LT: case OP_LE: return (OPTYPE_COMPGL); - case OP_PLUS: case OP_MINUS: return (OPTYPE_ADD); - case OP_MULT: case OP_DIV: return (OPTYPE_MULT); - case OP_NEGATE: case OP_NOT: return (OPTYPE_UNARY); - default: return (OPTYPE_BAD); - } -} /* end of function OpType. */ + switch (op) { + case OP_BAD: + return OPTYPE_BAD; + case OP_NONE: + return OPTYPE_NONE; + case OP_RTPAREN: + return OPTYPE_RPAREN; + case OP_OR: + return OPTYPE_OR; + case OP_AND: + return OPTYPE_AND; + case OP_EQ: + case OP_NEQ: + return OPTYPE_COMPEQ; + case OP_GT: + case OP_GE: + case OP_LT: + case OP_LE: + return OPTYPE_COMPGL; + case OP_PLUS: + case OP_MINUS: + return OPTYPE_ADD; + case OP_MULT: + case OP_DIV: + return OPTYPE_MULT; + case OP_NEGATE: + case OP_NOT: + return OPTYPE_UNARY; + default: + return OPTYPE_BAD; + } +} /* * In EvalBinaryOp() 'left' is the left operand, and 'op' is the -- cgit v1.2.3