The R Project SVN R

Rev

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

Rev 29580 Rev 30225
Line 249... Line 249...
249
	inWarning = 0; /* PR#1570 */
249
	inWarning = 0; /* PR#1570 */
250
	errorcall(call, "(converted from warning) %s", buf);
250
	errorcall(call, "(converted from warning) %s", buf);
251
    }
251
    }
252
    else if(w == 1) {	/* print as they happen */
252
    else if(w == 1) {	/* print as they happen */
253
	if( call != R_NilValue ) {
253
	if( call != R_NilValue ) {
254
	    dcall = CHAR(STRING_ELT(deparse1(call, 0, TRUE, FALSE), 0));
254
	    dcall = CHAR(STRING_ELT(deparse1(call, 0, SIMPLEDEPARSE), 0));
255
	    REprintf("Warning in %s : ", dcall);
255
	    REprintf("Warning in %s : ", dcall);
256
	    if (strlen(dcall) > LONGCALL) REprintf("\n	 ");
256
	    if (strlen(dcall) > LONGCALL) REprintf("\n	 ");
257
	}
257
	}
258
	else
258
	else
259
	    REprintf("Warning: ");
259
	    REprintf("Warning: ");
Line 346... Line 346...
346
	names = CAR(ATTRIB(R_Warnings));
346
	names = CAR(ATTRIB(R_Warnings));
347
	if( VECTOR_ELT(R_Warnings, 0) == R_NilValue )
347
	if( VECTOR_ELT(R_Warnings, 0) == R_NilValue )
348
	   REprintf("%s \n", CHAR(STRING_ELT(names, 0)));
348
	   REprintf("%s \n", CHAR(STRING_ELT(names, 0)));
349
	else
349
	else
350
	   REprintf("%s in: %s \n", CHAR(STRING_ELT(names, 0)),
350
	   REprintf("%s in: %s \n", CHAR(STRING_ELT(names, 0)),
351
		CHAR(STRING_ELT(deparse1(VECTOR_ELT(R_Warnings, 0), 0, TRUE, FALSE), 0)));
351
		CHAR(STRING_ELT(deparse1(VECTOR_ELT(R_Warnings, 0), 0, SIMPLEDEPARSE), 0)));
352
    }
352
    }
353
    else if( R_CollectWarnings <= 10 ) {
353
    else if( R_CollectWarnings <= 10 ) {
354
	REprintf("Warning messages: \n");
354
	REprintf("Warning messages: \n");
355
	names = CAR(ATTRIB(R_Warnings));
355
	names = CAR(ATTRIB(R_Warnings));
356
	for(i=0; i<R_CollectWarnings; i++) {
356
	for(i=0; i<R_CollectWarnings; i++) {
357
	    if( STRING_ELT(R_Warnings, i) == R_NilValue )
357
	    if( STRING_ELT(R_Warnings, i) == R_NilValue )
358
	       REprintf("%d: %s \n",i+1, CHAR(STRING_ELT(names, i)));
358
	       REprintf("%d: %s \n",i+1, CHAR(STRING_ELT(names, i)));
359
	    else
359
	    else
360
	       REprintf("%d: %s in: %s \n", i+1, CHAR(STRING_ELT(names, i)),
360
	       REprintf("%d: %s in: %s \n", i+1, CHAR(STRING_ELT(names, i)),
361
		   CHAR(STRING_ELT(deparse1(VECTOR_ELT(R_Warnings,i), 0, TRUE, FALSE), 0)));
361
		   CHAR(STRING_ELT(deparse1(VECTOR_ELT(R_Warnings,i), 0, SIMPLEDEPARSE), 0)));
362
	}
362
	}
363
    }
363
    }
364
    else {
364
    else {
365
	if (R_CollectWarnings < 50)
365
	if (R_CollectWarnings < 50)
366
	    REprintf("There were %d warnings (use warnings() to see them)\n",
366
	    REprintf("There were %d warnings (use warnings() to see them)\n",
Line 435... Line 435...
435
	char *head = "Error in ";
435
	char *head = "Error in ";
436
	char *mid = " : ";
436
	char *mid = " : ";
437
	char *tail = "\n\t";/* <- TAB */
437
	char *tail = "\n\t";/* <- TAB */
438
	int len = strlen(head) + strlen(mid) + strlen(tail);
438
	int len = strlen(head) + strlen(mid) + strlen(tail);
439
 
439
 
440
	dcall = CHAR(STRING_ELT(deparse1(call, 0, TRUE, FALSE), 0));
440
	dcall = CHAR(STRING_ELT(deparse1(call, 0, SIMPLEDEPARSE), 0));
441
	if (strlen(dcall) + len < BUFSIZE) {
441
	if (strlen(dcall) + len < BUFSIZE) {
442
	    sprintf(errbuf, "%s%s%s", head, dcall, mid);
442
	    sprintf(errbuf, "%s%s%s", head, dcall, mid);
443
	    if (strlen(dcall) > LONGCALL) strcat(errbuf, tail);
443
	    if (strlen(dcall) > LONGCALL) strcat(errbuf, tail);
444
	}
444
	}
445
	else
445
	else
Line 921... Line 921...
921
	 c = c->nextcontext)
921
	 c = c->nextcontext)
922
	if (c->callflag & CTXT_FUNCTION ) {
922
	if (c->callflag & CTXT_FUNCTION ) {
923
	    if (skip > 0)
923
	    if (skip > 0)
924
		skip--;
924
		skip--;
925
	    else {
925
	    else {
926
		SETCAR(t, deparse1(c->call, 0, TRUE, FALSE));
926
		SETCAR(t, deparse1(c->call, 0, SIMPLEDEPARSE));
927
		t = CDR(t);
927
		t = CDR(t);
928
	    }
928
	    }
929
	}
929
	}
930
    UNPROTECT(1);
930
    UNPROTECT(1);
931
    return s;
931
    return s;