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 CgCallBackCtorDone( // SET A CALL BACK FOR A CTOR-TEST : DONE cg_name expr, // - expression cg_type type, // - type of expression SE* se ) // - state entry for ctored object { return CgCallBackRight( expr, &checkCtorTest, se, type ); }
static cg_name emitPatchCallBack( // EMIT CODE FOR CALL-BACK FOR STATE PATCH cg_name expr, // - current expression cg_name emit, // - code for state patch cg_type type, // - type of current expression void (*rtn)(void*), // - patch routine patch_handle patch, // - handle for patching SE* se ) // - state entry for patch { patch_entry* pe; // - entry when patching expr = CgSideEffect( expr, emit, type ); pe = CarveAlloc( carve_patch_se ); pe->se = se; pe->patch = patch; return CgCallBackRight( expr, rtn, pe, type ); }
static void condInfoCallBack( // SET A CALL-BACK void (*rtn)( void* ), // - call-back routine bool on_left ) // - true ==> call-back on left { cg_name expr; // - top expression cg_type type; // - top type COND_STK* stk; // - stack ptr stk = PstkTopElement( &stack_cond_blks ); expr = CgExprPopType( &type ); if( on_left ) { expr = CgCallBackLeft( expr, rtn, stk, type ); } else { expr = CgCallBackRight( expr, rtn, stk, type ); } CgExprPush( expr, 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; }
cg_name CgCallBackTempCtor( // SET CALL BACKS FOR TEMP CTORED cg_name expr, // - expression cg_type type, // - type of expression SE* se ) // - state entry to be inserted on call back { temp_entry* te; // - entry for ctored temporary cg_name emit; // - emitted expression te = CarveAlloc( carve_temp_entry ); te->se = se; te->patch = NULL; expr = CgCallBackLeft( expr, &setTempStart, te, type ); emit = emitPatch( &te->patch ); if( emit != NULL ) { expr = CgSideEffect( expr, emit, type ); } expr = CgCallBackRight( expr, &setTempDone, te, type ); return expr; }