示例#1
0
// [[Rcpp::internal]]
SEXP rcpp_error_recorder(SEXP e){ 
    SEXP cache = get_rcpp_cache() ;
    
    // error occured
    set_error_occured( cache, Rf_ScalarLogical(TRUE) ) ;
	
    // current error
    set_current_error(cache, e ) ;
    
    return R_NilValue ;
}
示例#2
0
// [[Rcpp::register]]
int* get_cache( int m){
    SEXP cache = get_rcpp_cache() ;
    SEXP hash_cache = VECTOR_ELT( cache, RCPP_HASH_CACHE_INDEX) ;
    int n = Rf_length(hash_cache) ;
    if( m > n ){
        Rcpp::Shield<SEXP> new_hash_cache( Rf_allocVector( INTSXP, m) ) ;
        hash_cache = new_hash_cache ;
        SET_VECTOR_ELT(cache,RCPP_HASH_CACHE_INDEX, hash_cache); 
    }
    int *res = INTEGER(hash_cache) ;
    std::fill(res, res+m, 0 ) ;
    return res ;
}
示例#3
0
// [[Rcpp::register]]
SEXP reset_current_error(){ 
    SEXP cache = get_rcpp_cache() ;
    
    // error occured
    set_error_occured( cache, Rf_ScalarLogical(FALSE) ) ;
	
    // current error
    set_current_error( cache, R_NilValue ) ;
	
    // stack trace
    SET_VECTOR_ELT( cache, 3, R_NilValue ) ;
	
    return R_NilValue ;
}
示例#4
0
// [[Rcpp::register]]
SEXP rcpp_get_current_error(){
    return VECTOR_ELT( get_rcpp_cache(), 2 ) ;
}
示例#5
0
// [[Rcpp::register]]
int error_occured(){
    SEXP err = VECTOR_ELT( get_rcpp_cache(), 1 ) ;
    return LOGICAL(err)[0] ;
}
示例#6
0
// [[Rcpp::register]]
SEXP rcpp_set_stack_trace(SEXP e){
    SET_VECTOR_ELT( get_rcpp_cache(), 3, e ) ;
    return R_NilValue ;
}
示例#7
0
// [[Rcpp::register]]
SEXP rcpp_get_stack_trace(){
    return VECTOR_ELT( get_rcpp_cache(), 3 ) ;
}
示例#8
0
 // [[Rcpp::register]]
 SEXP get_Rcpp_namespace(){ 
 	    return VECTOR_ELT( get_rcpp_cache() , 0 ) ;
 }
示例#9
0
文件: barrier.cpp 项目: rforge/rcpp
SEXP get_Rcpp_protection_stack(){
    if( ! Rcpp_cache_know ){
        get_rcpp_cache() ;
    }
    return Rcpp_protection_stack ;
}