The R Project SVN R

Rev

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

Rev 62883 Rev 63050
Line 46... Line 46...
46
    if (TYPEOF(b) != CLOSXP) error(_("generic 'function' is not a function"));
46
    if (TYPEOF(b) != CLOSXP) error(_("generic 'function' is not a function"));
47
    formals = FORMALS(b);
47
    formals = FORMALS(b);
48
 
48
 
49
    tag = TAG(formals);
49
    tag = TAG(formals);
50
    if (tag != R_NilValue && tag != R_DotsSymbol) {
50
    if (tag != R_NilValue && tag != R_DotsSymbol) {
51
	s = R_NilValue;
51
	s = NULL;
52
	/** exact matches **/
52
	/** exact matches **/
53
	for (b = cptr->promargs ; b != R_NilValue ; b = CDR(b))
53
	for (b = cptr->promargs ; b != R_NilValue ; b = CDR(b))
54
	    if (TAG(b) != R_NilValue && pmatch(tag, TAG(b), 1)) {
54
	    if (TAG(b) != R_NilValue && pmatch(tag, TAG(b), 1)) {
55
		if (s != R_NilValue)
55
		if (s != NULL)
56
		    error(_("formal argument \"%s\" matched by multiple actual arguments"), tag);
56
		    error(_("formal argument \"%s\" matched by multiple actual arguments"), tag);
57
		else
57
		else
58
		    s = CAR(b);
58
		    s = CAR(b);
59
	    }
59
	    }
60
 
60
 
61
	if (s == R_NilValue)
61
	if (s == NULL)
62
	    /** partial matches **/
62
	    /** partial matches **/
63
	    for (b = cptr->promargs ; b != R_NilValue ; b = CDR(b))
63
	    for (b = cptr->promargs ; b != R_NilValue ; b = CDR(b))
64
		if (TAG(b) != R_NilValue && pmatch(tag, TAG(b), 0)) {
64
		if (TAG(b) != R_NilValue && pmatch(tag, TAG(b), 0)) {
65
		    if ( s != R_NilValue)
65
		    if ( s != NULL)
66
			error(_("formal argument \"%s\" matched by multiple actual arguments"), tag);
66
			error(_("formal argument \"%s\" matched by multiple actual arguments"), tag);
67
		    else
67
		    else
68
			s = CAR(b);
68
			s = CAR(b);
69
		}
69
		}
70
	if (s == R_NilValue)
70
	if (s == NULL)
71
	    /** first untagged argument **/
71
	    /** first untagged argument **/
72
	    for (b = cptr->promargs ; b != R_NilValue ; b = CDR(b))
72
	    for (b = cptr->promargs ; b != R_NilValue ; b = CDR(b))
73
		if (TAG(b) == R_NilValue )
73
		if (TAG(b) == R_NilValue )
74
		{
74
		{
75
		    s = CAR(b);
75
		    s = CAR(b);
76
		    break;
76
		    break;
77
		}
77
		}
78
	if (s == R_NilValue)
78
	if (s == NULL)
79
	    s = CAR(cptr->promargs);
79
	    s = CAR(cptr->promargs);
80
/*
80
/*
81
	    error("failed to match argument for dispatch");
81
	    error("failed to match argument for dispatch");
82
*/
82
*/
83
    }
83
    }