The R Project SVN R

Rev

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

Rev 77450 Rev 77498
Line 562... Line 562...
562
	    errorcall(call,
562
	    errorcall(call,
563
		      _("Incorrect number of arguments (%d), expecting %d for '%s'"),
563
		      _("Incorrect number of arguments (%d), expecting %d for '%s'"),
564
		      nargs, symbol.symbol.external->numArgs, buf);
564
		      nargs, symbol.symbol.external->numArgs, buf);
565
    }
565
    }
566
 
566
 
567
#ifdef SWITCH_TO_REFCNT
-
 
568
    /* args is escaping into user C code and might get captured, so
567
    /* args is escaping into user C code and might get captured, so
569
       make sure it is reference counting. */
568
       make sure it is reference counting. */
570
    for (SEXP a = args; a != R_NilValue; a = CDR(a))
-
 
571
	if (! TRACKREFS(a)) {
-
 
572
	    ENABLE_REFCNT(a);
-
 
573
	    INCREMENT_REFCNT(CAR(a));
569
    R_args_enable_refcnt(args);
574
	    INCREMENT_REFCNT(CDR(a));
-
 
575
#ifdef TESTING_WRITE_BARRIER
-
 
576
	    /* this should not see non-tracking arguments */
-
 
577
	    if (! TRACKREFS(CAR(a)))
-
 
578
		error("argument not tracking references");
-
 
579
#endif
-
 
580
	}
-
 
581
#endif
-
 
582
 
570
 
583
    if (PRIMVAL(op) == 1) {
571
    if (PRIMVAL(op) == 1) {
584
	R_ExternalRoutine2 fun = (R_ExternalRoutine2) ofun;
572
	R_ExternalRoutine2 fun = (R_ExternalRoutine2) ofun;
585
	retval = fun(call, op, args, env);
573
	retval = fun(call, op, args, env);
586
    } else {
574
    } else {
Line 1358... Line 1346...
1358
    PROTECT(retval = do_External(call, op, args, env));
1346
    PROTECT(retval = do_External(call, op, args, env));
1359
    dd->recordGraphics = record;
1347
    dd->recordGraphics = record;
1360
    if (GErecording(call, dd)) { // which is record && call != R_NilValue
1348
    if (GErecording(call, dd)) { // which is record && call != R_NilValue
1361
	if (!GEcheckState(dd))
1349
	if (!GEcheckState(dd))
1362
	    errorcall(call, _("invalid graphics state"));
1350
	    errorcall(call, _("invalid graphics state"));
-
 
1351
	/* args is escaping, so make sure it is reference counting. */
-
 
1352
	/* should alread be handled in do_External, but be safe ... */
-
 
1353
	R_args_enable_refcnt(args);
1363
	GErecordGraphicOperation(op, args, dd);
1354
	GErecordGraphicOperation(op, args, dd);
1364
    }
1355
    }
1365
    UNPROTECT(1);
1356
    UNPROTECT(1);
1366
    return check_retval(call, retval);
1357
    return check_retval(call, retval);
1367
}
1358
}
Line 1375... Line 1366...
1375
    PROTECT(retval = do_dotcall(call, op, args, env));
1366
    PROTECT(retval = do_dotcall(call, op, args, env));
1376
    dd->recordGraphics = record;
1367
    dd->recordGraphics = record;
1377
    if (GErecording(call, dd)) {
1368
    if (GErecording(call, dd)) {
1378
	if (!GEcheckState(dd))
1369
	if (!GEcheckState(dd))
1379
	    errorcall(call, _("invalid graphics state"));
1370
	    errorcall(call, _("invalid graphics state"));
-
 
1371
	/* args is escaping, so make sure it is reference counting. */
-
 
1372
	R_args_enable_refcnt(args);
1380
	GErecordGraphicOperation(op, args, dd);
1373
	GErecordGraphicOperation(op, args, dd);
1381
    }
1374
    }
1382
    UNPROTECT(1);
1375
    UNPROTECT(1);
1383
    return check_retval(call, retval);
1376
    return check_retval(call, retval);
1384
}
1377
}