The R Project SVN R

Rev

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

Rev 62883 Rev 63181
Line 380... Line 380...
380
		} else
380
		} else
381
		snprintf(pbuf, 115, "Complex,%d", LENGTH(tmp));
381
		snprintf(pbuf, 115, "Complex,%d", LENGTH(tmp));
382
		break;
382
		break;
383
	    case STRSXP:
383
	    case STRSXP:
384
		if (LENGTH(tmp) == 1) {
384
		if (LENGTH(tmp) == 1) {
-
 
385
		    const void *vmax = vmaxget();
385
		    /* This can potentially overflow */
386
		    /* This can potentially overflow */
386
		    const char *ctmp = translateChar(STRING_ELT(tmp, 0));
387
		    const char *ctmp = translateChar(STRING_ELT(tmp, 0));
387
		    int len = (int) strlen(ctmp);
388
		    int len = (int) strlen(ctmp);
388
		    if(len < 100)
389
		    if(len < 100)
389
			snprintf(pbuf, 115, "\"%s\"", ctmp);
390
			snprintf(pbuf, 115, "\"%s\"", ctmp);
390
		    else {
391
		    else {
391
			snprintf(pbuf, 101, "\"%s\"", ctmp);
392
			snprintf(pbuf, 101, "\"%s\"", ctmp);
392
			pbuf[100] = '"'; pbuf[101] = '\0';
393
			pbuf[100] = '"'; pbuf[101] = '\0';
393
			strcat(pbuf, " [truncated]");
394
			strcat(pbuf, " [truncated]");
394
		    }
395
		    }
-
 
396
		    vmaxset(vmax);
395
		} else
397
		} else
396
		snprintf(pbuf, 115, "Character,%d", LENGTH(tmp));
398
		snprintf(pbuf, 115, "Character,%d", LENGTH(tmp));
397
		break;
399
		break;
398
	    case RAWSXP:
400
	    case RAWSXP:
399
		snprintf(pbuf, 115, "Raw,%d", LENGTH(tmp));
401
		snprintf(pbuf, 115, "Raw,%d", LENGTH(tmp));
Line 441... Line 443...
441
	    for (i = 0; i < n_pr; i++) {
443
	    for (i = 0; i < n_pr; i++) {
442
		if (i > 0) Rprintf("\n");
444
		if (i > 0) Rprintf("\n");
443
		if (names != R_NilValue &&
445
		if (names != R_NilValue &&
444
		    STRING_ELT(names, i) != R_NilValue &&
446
		    STRING_ELT(names, i) != R_NilValue &&
445
		    *CHAR(STRING_ELT(names, i)) != '\0') {
447
		    *CHAR(STRING_ELT(names, i)) != '\0') {
-
 
448
		    const void *vmax = vmaxget();
446
		    const char *ss = translateChar(STRING_ELT(names, i));
449
		    const char *ss = translateChar(STRING_ELT(names, i));
447
		    if (taglen + strlen(ss) > TAGBUFLEN) {
450
		    if (taglen + strlen(ss) > TAGBUFLEN) {
448
		    	if (taglen <= TAGBUFLEN)
451
		    	if (taglen <= TAGBUFLEN)
449
			    sprintf(ptag, "$...");
452
			    sprintf(ptag, "$...");
450
		    } else {
453
		    } else {
Line 455... Line 458...
455
			else if( isValidName(ss) )
458
			else if( isValidName(ss) )
456
			    sprintf(ptag, "$%s", ss);
459
			    sprintf(ptag, "$%s", ss);
457
			else
460
			else
458
			    sprintf(ptag, "$`%s`", ss);
461
			    sprintf(ptag, "$`%s`", ss);
459
		    }
462
		    }
-
 
463
		    vmaxset(vmax);
460
		}
464
		}
461
		else {
465
		else {
462
		    if (taglen + IndexWidth(i) > TAGBUFLEN) {
466
		    if (taglen + IndexWidth(i) > TAGBUFLEN) {
463
		    	if (taglen <= TAGBUFLEN)
467
		    	if (taglen <= TAGBUFLEN)
464
			    sprintf(ptag, "$...");
468
			    sprintf(ptag, "$...");
Line 480... Line 484...
480
	    if(n_pr < ns)
484
	    if(n_pr < ns)
481
		Rprintf(" [ reached getOption(\"max.print\") -- omitted %d entries ]\n",
485
		Rprintf(" [ reached getOption(\"max.print\") -- omitted %d entries ]\n",
482
			ns - n_pr);
486
			ns - n_pr);
483
	}
487
	}
484
	else { /* ns = length(s) == 0 */
488
	else { /* ns = length(s) == 0 */
-
 
489
	    const void *vmax = vmaxget();
485
	    /* Formal classes are represented as empty lists */
490
	    /* Formal classes are represented as empty lists */
486
	    const char *className = NULL;
491
	    const char *className = NULL;
487
	    SEXP klass;
492
	    SEXP klass;
488
	    if(isObject(s) && isMethodsDispatchOn()) {
493
	    if(isObject(s) && isMethodsDispatchOn()) {
489
		klass = getAttrib(s, R_ClassSymbol);
494
		klass = getAttrib(s, R_ClassSymbol);
Line 498... Line 503...
498
	    }
503
	    }
499
	    if(className) {
504
	    if(className) {
500
		Rprintf("An object of class \"%s\"\n", className);
505
		Rprintf("An object of class \"%s\"\n", className);
501
		UNPROTECT(1);
506
		UNPROTECT(1);
502
		printAttributes(s, env, TRUE);
507
		printAttributes(s, env, TRUE);
-
 
508
		vmaxset(vmax);
503
		return;
509
		return;
504
	    }
510
	    }
505
	    else {
511
	    else {
506
		if(names != R_NilValue) Rprintf("named ");
512
		if(names != R_NilValue) Rprintf("named ");
507
		Rprintf("list()\n");
513
		Rprintf("list()\n");
508
	    }
514
	    }
-
 
515
	    vmaxset(vmax);
509
	}
516
	}
510
	UNPROTECT(1);
517
	UNPROTECT(1);
511
    }
518
    }
512
    printAttributes(s, env, FALSE);
519
    printAttributes(s, env, FALSE);
513
}
520
}
Line 755... Line 762...
755
    case CPLXSXP:
762
    case CPLXSXP:
756
    case RAWSXP:
763
    case RAWSXP:
757
	PROTECT(t = getAttrib(s, R_DimSymbol));
764
	PROTECT(t = getAttrib(s, R_DimSymbol));
758
	if (TYPEOF(t) == INTSXP) {
765
	if (TYPEOF(t) == INTSXP) {
759
	    if (LENGTH(t) == 1) {
766
	    if (LENGTH(t) == 1) {
-
 
767
		const void *vmax = vmaxget();
760
		PROTECT(t = getAttrib(s, R_DimNamesSymbol));
768
		PROTECT(t = getAttrib(s, R_DimNamesSymbol));
761
		if (t != R_NilValue && VECTOR_ELT(t, 0) != R_NilValue) {
769
		if (t != R_NilValue && VECTOR_ELT(t, 0) != R_NilValue) {
762
		    SEXP nn = getAttrib(t, R_NamesSymbol);
770
		    SEXP nn = getAttrib(t, R_NamesSymbol);
763
		    const char *title = NULL;
771
		    const char *title = NULL;
764
 
772
 
Line 768... Line 776...
768
		    printNamedVector(s, VECTOR_ELT(t, 0), R_print.quote, title);
776
		    printNamedVector(s, VECTOR_ELT(t, 0), R_print.quote, title);
769
		}
777
		}
770
		else
778
		else
771
		    printVector(s, 1, R_print.quote);
779
		    printVector(s, 1, R_print.quote);
772
		UNPROTECT(1);
780
		UNPROTECT(1);
-
 
781
		vmaxset(vmax);
773
	    }
782
	    }
774
	    else if (LENGTH(t) == 2) {
783
	    else if (LENGTH(t) == 2) {
775
		SEXP rl, cl;
784
		SEXP rl, cl;
776
		const char *rn, *cn;
785
		const char *rn, *cn;
777
		GetMatrixDimnames(s, &rl, &cl, &rn, &cn);
786
		GetMatrixDimnames(s, &rl, &cl, &rn, &cn);