// enabling tracing on a function turns it into an S4 object with an 'original' // slot that includes the function's original contents. use this instead if // it's set up. (consider: is it safe to assume that S4 objects here are always // traced functions, or do we need to compare classes to be safe?) SEXP RCntxt::originalFunctionCall() const { SEXP callObject = callfun(); if (Rf_isS4(callObject)) { callObject = r::sexp::getAttrib(callObject, "original"); } return callObject; }
int main() { callfun(& callme); assert(x == 5); return 0; }
bool RCntxt::isErrorHandler() const { SEXP errFlag = r::sexp::getAttrib(callfun(), "errorHandlerType"); return TYPEOF(errFlag) == INTSXP; }
bool RCntxt::isDebugHidden() const { SEXP hideFlag = r::sexp::getAttrib(callfun(), "hideFromDebugger"); return TYPEOF(hideFlag) != NILSXP && r::sexp::asLogical(hideFlag); }