The R Project SVN R

Rev

Rev 83446 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 83446 Rev 87894
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 2003-2021  The R Core Team
3
 *  Copyright (C) 2003-2025  The R Core Team
4
 *
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 2 of the License, or
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
8
 *  (at your option) any later version.
Line 68... Line 68...
68
 
68
 
69
    SEXP vnames = PROTECT(getAttrib(varyingArgs, R_NamesSymbol));
69
    SEXP vnames = PROTECT(getAttrib(varyingArgs, R_NamesSymbol));
70
    SEXP mindex = PROTECT(allocVector(VECSXP, m));
70
    SEXP mindex = PROTECT(allocVector(VECSXP, m));
71
    SEXP nindex = PROTECT(allocVector(VECSXP, m));
71
    SEXP nindex = PROTECT(allocVector(VECSXP, m));
72
    nprot += 3;
72
    nprot += 3;
73
    Rboolean named = vnames != R_NilValue;
73
    bool named = vnames != R_NilValue;
74
 
74
 
75
    /* build a call like
75
    /* build a call like
76
       f(dots[[1]][[4]], dots[[2]][[4]], dots[[3]][[4]], d=7)
76
       f(dots[[1]][[4]], dots[[2]][[4]], dots[[3]][[4]], d=7)
77
    */
77
    */
78
    SEXP fcall = R_NilValue; // -Wall
78
    SEXP fcall = R_NilValue; // -Wall
Line 83... Line 83...
83
    else if (!isPairList(constantArgs))
83
    else if (!isPairList(constantArgs))
84
	error(_("argument 'MoreArgs' of 'mapply' is not a list or pairlist"));
84
	error(_("argument 'MoreArgs' of 'mapply' is not a list or pairlist"));
85
    PROTECT_INDEX fi;
85
    PROTECT_INDEX fi;
86
    PROTECT_WITH_INDEX(fcall, &fi); nprot++;
86
    PROTECT_WITH_INDEX(fcall, &fi); nprot++;
87
 
87
 
88
    Rboolean realIndx = longest > INT_MAX;
88
    bool realIndx = longest > INT_MAX;
89
    SEXP Dots = install("dots");
89
    SEXP Dots = install("dots");
90
    for (int j = m - 1; j >= 0; j--) {
90
    for (int j = m - 1; j >= 0; j--) {
91
	SET_VECTOR_ELT(mindex, j, ScalarInteger(j + 1));
91
	SET_VECTOR_ELT(mindex, j, ScalarInteger(j + 1));
92
	SET_VECTOR_ELT(nindex, j, allocVector(realIndx ? REALSXP : INTSXP, 1));
92
	SET_VECTOR_ELT(nindex, j, allocVector(realIndx ? REALSXP : INTSXP, 1));
93
	SEXP tmp1 = PROTECT(lang3(R_Bracket2Symbol, Dots, VECTOR_ELT(mindex, j)));
93
	SEXP tmp1 = PROTECT(lang3(R_Bracket2Symbol, Dots, VECTOR_ELT(mindex, j)));