[Python-checkins] python/dist/src/Python newcompile.c,1.1.2.30,1.1.2.31
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Tue, 25 Mar 2003 08:38:54 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv25865/Python
Modified Files:
Tag: ast-branch
newcompile.c
Log Message:
Map from our internal codes for comparison operators to the codes used by
ceval.h.
Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.30
retrieving revision 1.1.2.31
diff -C2 -d -r1.1.2.30 -r1.1.2.31
*** newcompile.c 25 Mar 2003 16:27:56 -0000 1.1.2.30
--- newcompile.c 25 Mar 2003 16:38:49 -0000 1.1.2.31
***************
*** 1012,1015 ****
--- 1012,1043 ----
static int
+ cmpop(cmpop_ty op)
+ {
+ switch (op) {
+ case Eq:
+ return PyCmp_EQ;
+ case NotEq:
+ return PyCmp_NE;
+ case Lt:
+ return PyCmp_LT;
+ case LtE:
+ return PyCmp_LE;
+ case Gt:
+ return PyCmp_GT;
+ case GtE:
+ return PyCmp_GE;
+ case Is:
+ return PyCmp_IS;
+ case IsNot:
+ return PyCmp_IS_NOT;
+ case In:
+ return PyCmp_IN;
+ case NotIn:
+ return PyCmp_NOT_IN;
+ }
+ return PyCmp_BAD;
+ }
+
+ static int
inplace_binop(struct compiler *c, operator_ty op)
{
***************
*** 1180,1186 ****
ADDOP(c, DUP_TOP);
ADDOP(c, ROT_THREE);
! /* XXX We're casting a void* to an int in the next stmt -- bad */
ADDOP_I(c, COMPARE_OP,
! (cmpop_ty)asdl_seq_GET(e->v.Compare.ops, i - 1));
ADDOP_JREL(c, JUMP_IF_FALSE, cleanup);
NEXT_BLOCK(c);
--- 1208,1214 ----
ADDOP(c, DUP_TOP);
ADDOP(c, ROT_THREE);
! /* XXX We're casting a void* to cmpop_ty in the next stmt. */
ADDOP_I(c, COMPARE_OP,
! cmpop((cmpop_ty)asdl_seq_GET(e->v.Compare.ops, i - 1)));
ADDOP_JREL(c, JUMP_IF_FALSE, cleanup);
NEXT_BLOCK(c);
***************
*** 1189,1193 ****
VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, n - 1));
ADDOP_I(c, COMPARE_OP,
! (cmpop_ty)asdl_seq_GET(e->v.Compare.ops, n - 1));
if (n > 1) {
int end = compiler_new_block(c);
--- 1217,1222 ----
VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, n - 1));
ADDOP_I(c, COMPARE_OP,
! /* XXX We're casting a void* to cmpop_ty in the next stmt. */
! cmpop((cmpop_ty)asdl_seq_GET(e->v.Compare.ops, n - 1)));
if (n > 1) {
int end = compiler_new_block(c);