void CgCallBackNewCtored( // NEW OBJECT WAS CTOR'ED SE* se_del, // - state entry for delete during CTOR throw FN_CTL* fctl ) // - function information { cg_name expr; // - emitted expression patch_entry* pe; // - entry when patching cg_type type; // - not used CondInfoNewCtorBeg( fctl ); expr = CgExprPopType( &type ); CgCommaBefore( expr, type ); pe = CarveAlloc( carve_patch_se ); pe->se = se_del; expr = CgExprPopType( &type ); expr = CgCallBackLeft( expr , &callBackNewCtorBeg , pe , type ); expr = CgComma( emitPatch( &pe->patch ), expr, type ); CgExprPush( expr, type ); CondInfoNewCtorEnd( fctl ); expr = CgExprPopType( &type ); CgCommaOptional( expr, type ); pe = CarveAlloc( carve_patch_se ); pe->se = se_del; expr = CgExprPopType( &type ); expr = CgSideEffect( expr, emitPatch( &pe->patch ), type ); expr = CgCallBackRight( expr , &callBackNewCtorEnd , pe , type ); CgExprPush( expr, type ); }
cg_name CgCallBackLeft( // MAKE A LEFT CALL-BACK cg_name expr, // - expression void (*fun)( void* ), // - call-back function void* data, // - data for call back cg_type type ) // - type of expression { return CgComma( CGCallback( fun, data ), expr, type ); }
cg_name CgSideEffect( // CONSTRUCT SIDE-EFFECT EXPRESSION cg_name lhs, // - expression on left cg_name rhs, // - expression on right cg_type type ) // - type of right expression { #if 0 return cgCommaSideEffect( lhs, rhs, type, O_SIDE_EFFECT ); #else cg_name expr; // - result if( NULL == lhs ) { expr = rhs; } else if( NULL == rhs ) { expr = lhs; } else { temp_handle handle; // - handle expr = CgSaveAsTemp( &handle, lhs, type ); expr = CgComma( expr, rhs, type ); expr = CgComma( expr, CgFetchTemp( handle, type ), type ); } return expr; #endif }
void CgCommaWithTopExpr( // PUSH COMMA'D EXPRESSION WITH TOP EXPR cg_name expr, // - rhs expression cg_type type ) // - rhs type { cg_name lhs; // - lhs expression if( CgExprPopGarbage() ) { lhs = NULL; } else { lhs = CgExprPop(); } CgExprPush( CgComma( lhs, expr, type ), type ); }
void CgCommaBefore( // EMIT COMMA'ED EXPRESSION BEFORE cg_name expr, // - expression cg_type type ) // - type of above expression { cg_name top_expr; // - expression on top cg_type top_type; // - type on top top_expr = CgExprPopType( &top_type ); if( top_expr == NULL ) { if( expr != NULL ) { CgDone( expr, type ); } } else { CgExprPush( CgComma( expr, top_expr, top_type ), top_type ); } }
static cg_name genCtorFlagClr( // CLEAR CTOR FLAGGING cg_name expr, // - current expression cg_type type, // - expression type SE* se ) // - state entry for ctor'ed object { FN_CTL* fctl = FnCtlTop(); // - function information CTOR_FLAG_SET* cfs; // - call-back data if( DtmTabular( fctl ) ) { cfs = CarveAlloc( carve_ctor_flag ); cfs->se = se; expr = CgComma( ctorFlagSet( fctl, O_AND, &cfs->ph_clr ) , expr , type ); expr = CgCallBackRight( expr, &callBackCtorFlag, cfs, type ); } return expr; }