The R Project SVN R

Rev

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

Rev 41861 Rev 41894
Line 113... Line 113...
113
    return R_NilValue;
113
    return R_NilValue;
114
}
114
}
115
 
115
 
116
SEXP attribute_hidden do_devcur(SEXP call, SEXP op, SEXP args, SEXP env)
116
SEXP attribute_hidden do_devcur(SEXP call, SEXP op, SEXP args, SEXP env)
117
{
117
{
118
    SEXP cd = allocVector(INTSXP, 1);
-
 
119
    checkArity(op, args);
118
    checkArity(op, args);
120
    INTEGER(cd)[0] = curDevice() + 1;
119
    return ScalarInteger(curDevice() + 1);
121
    return cd;
-
 
122
}
120
}
123
 
121
 
124
SEXP attribute_hidden do_devnext(SEXP call, SEXP op, SEXP args, SEXP env)
122
SEXP attribute_hidden do_devnext(SEXP call, SEXP op, SEXP args, SEXP env)
125
{
123
{
126
    SEXP nd = allocVector(INTSXP, 1);
-
 
127
    checkArity_length;
124
    checkArity_length;
128
    INTEGER(nd)[0] = nextDevice(INTEGER(CAR(args))[0] - 1) + 1;
125
    return ScalarInteger( nextDevice(INTEGER(CAR(args))[0] - 1) + 1 );
129
    return nd;
-
 
130
}
126
}
131
 
127
 
132
SEXP attribute_hidden do_devprev(SEXP call, SEXP op, SEXP args, SEXP env)
128
SEXP attribute_hidden do_devprev(SEXP call, SEXP op, SEXP args, SEXP env)
133
{
129
{
134
    SEXP pd = allocVector(INTSXP, 1);
-
 
135
    checkArity_length;
130
    checkArity_length;
136
    INTEGER(pd)[0] = prevDevice(INTEGER(CAR(args))[0] - 1) + 1;
131
    return ScalarInteger( prevDevice(INTEGER(CAR(args))[0] - 1) + 1 );
137
    return pd;
-
 
138
}
132
}
139
 
133
 
140
SEXP attribute_hidden do_devset(SEXP call, SEXP op, SEXP args, SEXP env)
134
SEXP attribute_hidden do_devset(SEXP call, SEXP op, SEXP args, SEXP env)
141
{
135
{
142
    int devNum = INTEGER(CAR(args))[0] - 1;
136
    int devNum = INTEGER(CAR(args))[0] - 1;
143
    SEXP sd = allocVector(INTSXP, 1);
-
 
144
    checkArity(op, args);
137
    checkArity(op, args);
145
    INTEGER(sd)[0] = selectDevice(devNum) + 1;
138
    return ScalarInteger( selectDevice(devNum) + 1 );
146
    return sd;
-
 
147
}
139
}
148
 
140
 
149
SEXP attribute_hidden do_devoff(SEXP call, SEXP op, SEXP args, SEXP env)
141
SEXP attribute_hidden do_devoff(SEXP call, SEXP op, SEXP args, SEXP env)
150
{
142
{
151
    checkArity_length;
143
    checkArity_length;
Line 205... Line 197...
205
    int i, n;
197
    int i, n;
206
    SEXP ans = R_NilValue;/* -Wall*/
198
    SEXP ans = R_NilValue;/* -Wall*/
207
 
199
 
208
    n = length(pch);
200
    n = length(pch);
209
    if (n == 0) {
201
    if (n == 0) {
210
	ans = allocVector(INTSXP, 1);
202
	ans = ScalarInteger(dflt);
211
	INTEGER(ans)[0] = dflt;
-
 
212
    }
203
    }
213
    else if (isList(pch)) {
204
    else if (isList(pch)) {
214
	ans = allocVector(INTSXP, n);
205
	ans = allocVector(INTSXP, n);
215
	for (i = 0; pch != R_NilValue;	pch = CDR(pch))
206
	for (i = 0; pch != R_NilValue;	pch = CDR(pch))
216
	    INTEGER(ans)[i++] = asInteger(CAR(pch));
207
	    INTEGER(ans)[i++] = asInteger(CAR(pch));
Line 266... Line 257...
266
{
257
{
267
    int i, n;
258
    int i, n;
268
    SEXP ans;
259
    SEXP ans;
269
    n = length(lty);
260
    n = length(lty);
270
    if (n == 0) {
261
    if (n == 0) {
271
	ans = allocVector(INTSXP, 1);
262
	ans = ScalarInteger(dflt);
272
	INTEGER(ans)[0] = dflt;
-
 
273
    }
263
    }
274
    else {
264
    else {
275
	ans = allocVector(INTSXP, n);
265
	ans = allocVector(INTSXP, n);
276
	for (i = 0; i < n; i++)
266
	for (i = 0; i < n; i++)
277
	    INTEGER(ans)[i] = LTYpar(lty, i);
267
	    INTEGER(ans)[i] = LTYpar(lty, i);
Line 285... Line 275...
285
    int i, n;
275
    int i, n;
286
    double w;
276
    double w;
287
    SEXP ans = NULL;
277
    SEXP ans = NULL;
288
 
278
 
289
    n = length(lwd);
279
    n = length(lwd);
290
    if (n == 0) {
280
    if (n == 0)
291
	ans = allocVector(REALSXP, 1);
281
	ans = ScalarReal(dflt);
292
	REAL(ans)[0] = dflt;
-
 
293
    }
-
 
294
    else {
282
    else {
295
	PROTECT(lwd = coerceVector(lwd, REALSXP));
283
	PROTECT(lwd = coerceVector(lwd, REALSXP));
296
	n = length(lwd);
284
	n = length(lwd);
297
	ans = allocVector(REALSXP, n);
285
	ans = allocVector(REALSXP, n);
298
	for (i = 0; i < n; i++) {
286
	for (i = 0; i < n; i++) {
Line 311... Line 299...
311
{
299
{
312
    int i, k, n;
300
    int i, k, n;
313
    SEXP ans = R_NilValue;/* -Wall*/
301
    SEXP ans = R_NilValue;/* -Wall*/
314
    n = length(font);
302
    n = length(font);
315
    if (n == 0) {
303
    if (n == 0) {
316
	ans = allocVector(INTSXP, 1);
304
	ans = ScalarInteger(dflt);
317
	INTEGER(ans)[0] = dflt;
-
 
318
    }
305
    }
319
    else if (isLogical(font)) {
306
    else if (isLogical(font)) {
320
	ans = allocVector(INTSXP, n);
307
	ans = allocVector(INTSXP, n);
321
	for (i = 0; i < n; i++) {
308
	for (i = 0; i < n; i++) {
322
	    k = LOGICAL(font)[i];
309
	    k = LOGICAL(font)[i];
Line 361... Line 348...
361
{
348
{
362
    int i, n;
349
    int i, n;
363
    SEXP ans;
350
    SEXP ans;
364
    n = length(col);
351
    n = length(col);
365
    if (n == 0) {
352
    if (n == 0) {
366
	PROTECT(ans = allocVector(INTSXP, 1));
353
	PROTECT(ans = ScalarInteger(dflt));
367
	INTEGER(ans)[0] = dflt;
-
 
368
    }
354
    }
369
    else {
355
    else {
370
	ans = PROTECT(allocVector(INTSXP, n));
356
	ans = PROTECT(allocVector(INTSXP, n));
371
	if (isList(col))
357
	if (isList(col))
372
	    for (i = 0; i < n; i++) {
358
	    for (i = 0; i < n; i++) {
Line 3375... Line 3361...
3375
	SETCADR(saveans, pos);
3361
	SETCADR(saveans, pos);
3376
	SETCADDR(saveans, x);
3362
	SETCADDR(saveans, x);
3377
	SETCADDDR(saveans, y);
3363
	SETCADDDR(saveans, y);
3378
	SETCAD4R(saveans, Offset);
3364
	SETCAD4R(saveans, Offset);
3379
	SETCAD4R(CDR(saveans), l);
3365
	SETCAD4R(CDR(saveans), l);
3380
	PROTECT(draw = allocVector(LGLSXP, 1));
-
 
3381
	LOGICAL(draw)[0] = plot;
-
 
3382
	SETCAD4R(CDDR(saveans), draw);
3366
	SETCAD4R(CDDR(saveans), ScalarLogical(plot));
3383
 
3367
 
3384
	/* If we are recording, save enough information to be able to
3368
	/* If we are recording, save enough information to be able to
3385
	   redraw the text labels beside identified points */
3369
	   redraw the text labels beside identified points */
3386
	if (GRecording(call, dd))
3370
	if (GRecording(call, dd))
3387
	    recordGraphicOperation(op, saveans, dd);
3371
	    recordGraphicOperation(op, saveans, dd);
3388
	UNPROTECT(7);
3372
	UNPROTECT(6);
3389
 
3373
 
3390
	R_Visible = TRUE;
3374
	R_Visible = TRUE;
3391
	return ans;
3375
	return ans;
3392
    }
3376
    }
3393
}
3377
}