| 1 |
|
| /* vi: set ft=c : */ |
| 2 |
|
| |
| 3 |
|
| struct binop_any { |
| 4 |
|
| BASEOP |
| 5 |
|
| OP *op_first; |
| 6 |
|
| OP *op_last; |
| 7 |
|
| ANY *op_any; |
| 8 |
|
| }; |
| 9 |
|
| |
| 10 |
|
| typedef struct binop_any BINOP_ANY; |
| 11 |
|
| |
| 12 |
|
| #define cBINOP_ANYx(o) ((BINOP_ANY *)o) |
| 13 |
|
| #define cBINOP_ANY cBINOP_ANYx(PL_op) |
| 14 |
|
| #define cBINOP_ANYo cBINOP_ANYx(o) |
| 15 |
|
| |
| 16 |
|
| #ifndef OpTYPE_set |
| 17 |
|
| # define OpTYPE_set(op, type) \ |
| 18 |
|
| STMT_START { \ |
| 19 |
|
| op->op_type = (OPCODE)type; \ |
| 20 |
|
| op->op_ppaddr = PL_ppaddr[type]; \ |
| 21 |
|
| } STMT_END |
| 22 |
|
| #endif |
| 23 |
|
| |
| 24 |
|
| #define newBINOP_ANY(type, flags, first, last, anycount) S_newBINOP_ANY(aTHX_ type, flags, first, last, anycount) |
| 25 |
0 |
| static OP *S_newBINOP_ANY(pTHX_ I32 type, I32 flags, OP *first, OP *last, Size_t anycount) |
| 26 |
|
| { |
| 27 |
|
| dVAR; |
| 28 |
|
| BINOP_ANY *binop; |
| 29 |
0 |
| OP *kid = first; |
| 30 |
0 |
| NewOp(1101, binop, 1, BINOP_ANY); |
| 31 |
|
| |
| 32 |
0 |
▶ | if(!first) |
Branch: 1 branch
| Branch | True | False | Total |
| if(!first) |
0 |
0 |
0 |
|
| 33 |
0 |
| first = newOP(OP_NULL, 0); |
| 34 |
|
| |
| 35 |
0 |
| OpTYPE_set(binop, type); |
| 36 |
0 |
| binop->op_first = first; |
| 37 |
0 |
| binop->op_flags = (U8)(flags | OPf_KIDS); |
| 38 |
0 |
▶ | if(!last) { |
Branch: 1 branch
| Branch | True | False | Total |
| if(!last) { |
0 |
0 |
0 |
|
| 39 |
0 |
| last = first; |
| 40 |
0 |
| binop->op_private = (U8)(1 | (flags >> 8)); |
| 41 |
|
| } |
| 42 |
|
| else { |
| 43 |
0 |
| binop->op_private = (U8)(2 | (flags >> 8)); |
| 44 |
0 |
| OpMORESIB_set(first, last); |
| 45 |
|
| } |
| 46 |
|
| |
| 47 |
0 |
▶ | if(!OpHAS_SIBLING(last)) |
Branch: 1 branch
| Branch | True | False | Total |
| if(!OpHAS_SIBLING(last)) |
0 |
0 |
0 |
|
| 48 |
0 |
| OpLASTSIB_set(last, (OP *)binop); |
| 49 |
|
| |
| 50 |
0 |
▶ | binop->op_last = OpSIBLING(binop->op_first); |
Branch: 1 branch
| Branch | True | False | Total |
| binop->op_last = OpSIBLING(binop->op_first); |
0 |
0 |
0 |
|
| 51 |
0 |
▶ | if(binop->op_last) |
Branch: 1 branch
| Branch | True | False | Total |
| if(binop->op_last) |
0 |
0 |
0 |
|
| 52 |
0 |
| OpLASTSIB_set(binop->op_last, (OP *)binop); |
| 53 |
|
| |
| 54 |
0 |
▶ | Newx(binop->op_any, anycount, ANY); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(binop->op_any, anycount, ANY); |
0 |
0 |
0 |
|
| 55 |
|
| |
| 56 |
0 |
| return (OP *)binop; |
| 57 |
|
| } |
| 58 |
|
| |
| 59 |
|
| |
| 60 |
|
| #define newBINOP_ANY_CUSTOM(func, flags, first, last, anycount) S_newBINOP_ANY_CUSTOM(aTHX_ func, flags, first, last, anycount) |
| 61 |
0 |
| static OP *S_newBINOP_ANY_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags, OP *first, OP *last, Size_t anycount) |
| 62 |
|
| { |
| 63 |
|
| BINOP_ANY *binop; |
| 64 |
0 |
| binop = (BINOP_ANY *)newBINOP_ANY(OP_CUSTOM, flags, first, last, anycount); |
| 65 |
0 |
| binop->op_ppaddr = func; |
| 66 |
0 |
| return (OP *)binop; |
| 67 |
|
| } |