The R Project SVN R

Rev

Rev 89923 | Rev 89935 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89923 Rev 89924
Line 2796... Line 2796...
2796
NORET void R_MissingArgError(SEXP symbol, SEXP call, const char* subclass)
2796
NORET void R_MissingArgError(SEXP symbol, SEXP call, const char* subclass)
2797
{
2797
{
2798
    R_MissingArgError_c(CHAR(PRINTNAME(symbol)), call, subclass);
2798
    R_MissingArgError_c(CHAR(PRINTNAME(symbol)), call, subclass);
2799
}
2799
}
2800
 
2800
 
-
 
2801
NORET attribute_hidden void R_ObjectNotFoundError(SEXP sym, SEXP call,
-
 
2802
						  const char *mode)
-
 
2803
{
-
 
2804
    if (TYPEOF(sym) != SYMSXP)
-
 
2805
	error(_("not a symbol"));
-
 
2806
    if (call == R_CurrentExpression)
-
 
2807
	call = getCurrentCall();
-
 
2808
    PROTECT(call);
-
 
2809
    SEXP cond;
-
 
2810
    if (mode == NULL) {
-
 
2811
	cond = R_makeErrorCondition(call,
-
 
2812
				    "objectNotFoundError", NULL, 2,
-
 
2813
				    _("object '%s' not found"),
-
 
2814
				    EncodeChar(PRINTNAME(sym)));
-
 
2815
	mode = "any";
-
 
2816
    }
-
 
2817
    else {
-
 
2818
	cond = R_makeErrorCondition(call,
-
 
2819
				    "objectNotFoundError", NULL, 2,
-
 
2820
				    _("object '%s' of mode '%s' was not found"),
-
 
2821
				    EncodeChar(PRINTNAME(sym)),
-
 
2822
				    mode);
-
 
2823
    }
-
 
2824
    PROTECT(cond);
-
 
2825
    R_setConditionField(cond, 2, "name", sym);
-
 
2826
    R_setConditionField(cond, 3, "mode", mkString(mode));
-
 
2827
    R_signalErrorCondition(cond, call);
-
 
2828
    UNPROTECT(2); // not reached
-
 
2829
}
2801
 
2830
 
2802
NORET attribute_hidden void R_FunctionNotFoundError(SEXP call, SEXP sym)
2831
NORET attribute_hidden void R_FunctionNotFoundError(SEXP sym, SEXP call)
2803
{
2832
{
2804
    if (TYPEOF(sym) != SYMSXP)
2833
    if (TYPEOF(sym) != SYMSXP)
2805
	error(_("not a symbol"));
2834
	error(_("not a symbol"));
-
 
2835
    if (call == R_CurrentExpression)
-
 
2836
	call = getCurrentCall();
-
 
2837
    PROTECT(call);
2806
    SEXP cond = R_makeErrorCondition(call, "functionNotFoundError", NULL, 1,
2838
    SEXP cond = R_makeErrorCondition(call,
-
 
2839
				     "objectNotFoundError",
-
 
2840
				     "functionNotFoundError",
-
 
2841
				     2,
2807
				     _("could not find function \"%s\""),
2842
				     _("could not find function \"%s\""),
2808
				     CHAR(PRINTNAME(sym)));
2843
				     EncodeChar(PRINTNAME(sym)));
2809
    PROTECT(cond);
2844
    PROTECT(cond);
2810
    R_setConditionField(cond, 2, "name", sym);
2845
    R_setConditionField(cond, 2, "name", sym);
-
 
2846
    R_setConditionField(cond, 3, "mode", mkString("function"));
2811
    R_signalErrorCondition(cond, call);
2847
    R_signalErrorCondition(cond, call);
2812
    UNPROTECT(1); // not reached
2848
    UNPROTECT(2); // not reached
2813
}
2849
}
2814
 
2850
 
2815
attribute_hidden /* for now */
2851
attribute_hidden /* for now */
2816
void R_setConditionField(SEXP cond, R_xlen_t idx, const char *name, SEXP val)
2852
void R_setConditionField(SEXP cond, R_xlen_t idx, const char *name, SEXP val)
2817
{
2853
{