The R Project SVN R

Rev

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

Rev 51657 Rev 51702
Line 321... Line 321...
321
} while (0)
321
} while (0)
322
 
322
 
323
SEXP attribute_hidden R_binary(SEXP call, SEXP op, SEXP x, SEXP y)
323
SEXP attribute_hidden R_binary(SEXP call, SEXP op, SEXP x, SEXP y)
324
{
324
{
325
    SEXP klass, dims, tsp, xnames, ynames, val;
325
    SEXP klass, dims, tsp, xnames, ynames, val;
326
    int mismatch = 0, nx, ny, xarray, yarray, xts, yts;
326
    int mismatch = 0, nx, ny, xarray, yarray, xts, yts, xS4 = 0, yS4 = 0;
327
    int xattr, yattr;
327
    int xattr, yattr;
328
    SEXP lcall = call;
328
    SEXP lcall = call;
329
    PROTECT_INDEX xpi, ypi;
329
    PROTECT_INDEX xpi, ypi;
330
    ARITHOP_TYPE oper = (ARITHOP_TYPE) PRIMVAL(op);
330
    ARITHOP_TYPE oper = (ARITHOP_TYPE) PRIMVAL(op);
331
    int nprotect = 2; /* x and y */
331
    int nprotect = 2; /* x and y */
Line 340... Line 340...
340
    nx = LENGTH(x);
340
    nx = LENGTH(x);
341
    if (ATTRIB(x) != R_NilValue) {
341
    if (ATTRIB(x) != R_NilValue) {
342
	xattr = TRUE;
342
	xattr = TRUE;
343
	xarray = isArray(x);
343
	xarray = isArray(x);
344
	xts = isTs(x);
344
	xts = isTs(x);
-
 
345
	xS4 = isS4(x);
345
    }
346
    }
346
    else xarray = xts = xattr = FALSE;
347
    else xarray = xts = xattr = FALSE;
347
    ny = LENGTH(y);
348
    ny = LENGTH(y);
348
    if (ATTRIB(y) != R_NilValue) {
349
    if (ATTRIB(y) != R_NilValue) {
349
	yattr = TRUE;
350
	yattr = TRUE;
350
	yarray = isArray(y);
351
	yarray = isArray(y);
351
	yts = isTs(y);
352
	yts = isTs(y);
-
 
353
	yS4 = isS4(y);
352
    }
354
    }
353
    else yarray = yts = yattr = FALSE;
355
    else yarray = yts = yattr = FALSE;
354
 
356
 
355
    /* If either x or y is a matrix with length 1 and the other is a
357
    /* If either x or y is a matrix with length 1 and the other is a
356
       vector, we want to coerce the matrix to be a vector.
358
       vector, we want to coerce the matrix to be a vector.
Line 491... Line 493...
491
    if (xts || yts) {		/* must set *after* dims! */
493
    if (xts || yts) {		/* must set *after* dims! */
492
	setAttrib(val, R_TspSymbol, tsp);
494
	setAttrib(val, R_TspSymbol, tsp);
493
	setAttrib(val, R_ClassSymbol, klass);
495
	setAttrib(val, R_ClassSymbol, klass);
494
    }
496
    }
495
 
497
 
-
 
498
    if(xS4 || yS4) {   /* Only set the bit:  no method defined! */
-
 
499
        val = asS4(val, TRUE, TRUE);
-
 
500
    }
496
    UNPROTECT(nprotect);
501
    UNPROTECT(nprotect);
497
    return val;
502
    return val;
498
}
503
}
499
 
504
 
500
SEXP attribute_hidden R_unary(SEXP call, SEXP op, SEXP s1)
505
SEXP attribute_hidden R_unary(SEXP call, SEXP op, SEXP s1)