commit 19e6186d1a8cb9cbdd99c8b9fc07010ea8f6df46 from: Markus Uhlin date: Tue Dec 26 21:51:42 2023 UTC Reformatted OpType() commit - 77bb2e29ec878a452cb06ca0583c4e7f8d9756b1 commit + 19e6186d1a8cb9cbdd99c8b9fc07010ea8f6df46 blob - 816445f36203c7f12cef8aefea10eddd33b170c9 blob + 69bf824847d9630229dabd3e0180880e8af96c19 --- FICS/formula.c +++ 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