The R Project SVN R

Rev

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

Rev 72034 Rev 75528
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) 2001-2015   The R Core Team.
3
 *  Copyright (C) 2001-2018   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 136... Line 136...
136
		k++;
136
		k++;
137
		if(k > nret - 1){
137
		if(k > nret - 1){
138
		    nret *= 2;
138
		    nret *= 2;
139
		    PROTECT(retval2 = allocMatrixNA(STRSXP, LENGTH(what), nret));
139
		    PROTECT(retval2 = allocMatrixNA(STRSXP, LENGTH(what), nret));
140
		    transferVector(retval2, retval);
140
		    transferVector(retval2, retval);
141
		    UNPROTECT_PTR(retval);
-
 
142
		    retval = retval2;
141
		    retval = retval2;
-
 
142
		    UNPROTECT(2); /* retval, retval2 */
-
 
143
		    PROTECT(retval);
143
		}
144
		}
144
		blank_skip = TRUE;
145
		blank_skip = TRUE;
145
		lastm = -1;
146
		lastm = -1;
146
		field_skip = FALSE;
147
		field_skip = FALSE;
147
		field_fold = TRUE;
148
		field_fold = TRUE;
Line 252... Line 253...
252
						   STRING_ELT(retval,
253
						   STRING_ELT(retval,
253
							      nr+nc*nrows(retval)));
254
							      nr+nc*nrows(retval)));
254
				}
255
				}
255
			    }
256
			    }
256
			}
257
			}
257
			UNPROTECT_PTR(retval);
-
 
258
			UNPROTECT_PTR(what);
-
 
259
			retval = retval2;
258
			retval = retval2;
260
			what = what2;
259
			what = what2;
-
 
260
			UNPROTECT(5); /* what, fold_excludes, retval, what2, retval2 */
-
 
261
			PROTECT(what);
-
 
262
			PROTECT(fold_excludes);
-
 
263
			PROTECT(retval);
261
			/* Make sure enough space was used */
264
			/* Make sure enough space was used */
262
			need = (int) (Rf_strchr(line, ':') - line + 1);
265
			need = (int) (Rf_strchr(line, ':') - line + 1);
263
			if(buflen < need){
266
			if(buflen < need){
264
			    char *tmp = (char *) realloc(buf, need);
267
			    char *tmp = (char *) realloc(buf, need);
265
			    if(!tmp) {
268
			    if(!tmp) {
Line 318... Line 321...
318
    INTEGER(dims)[0] = k;
321
    INTEGER(dims)[0] = k;
319
    INTEGER(dims)[1] = LENGTH(what);
322
    INTEGER(dims)[1] = LENGTH(what);
320
    SET_VECTOR_ELT(dimnames, 1, what);
323
    SET_VECTOR_ELT(dimnames, 1, what);
321
    setAttrib(retval2, R_DimSymbol, dims);
324
    setAttrib(retval2, R_DimSymbol, dims);
322
    setAttrib(retval2, R_DimNamesSymbol, dimnames);
325
    setAttrib(retval2, R_DimNamesSymbol, dimnames);
323
    UNPROTECT(6);
326
    UNPROTECT(6); /* what, fold_excludes, retval, retval2, dimnames, dims */
324
    return(retval2);
327
    return(retval2);
325
}
328
}
326
 
329
 
327
 
330
 
328
static SEXP allocMatrixNA(SEXPTYPE mode, int nrow, int ncol)
331
static SEXP allocMatrixNA(SEXPTYPE mode, int nrow, int ncol)