The R Project SVN R

Rev

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

Rev 33397 Rev 33598
Line 330... Line 330...
330
}
330
}
331
 
331
 
332
void PrintWarnings(void)
332
void PrintWarnings(void)
333
{
333
{
334
    int i;
334
    int i;
-
 
335
    char *header;
335
    SEXP names, s, t;
336
    SEXP names, s, t;
336
    RCNTXT cntxt;
337
    RCNTXT cntxt;
337
 
338
 
338
    if (R_CollectWarnings == 0)
339
    if (R_CollectWarnings == 0)
339
	return;
340
	return;
Line 351... Line 352...
351
    begincontext(&cntxt, CTXT_CCODE, R_NilValue, R_BaseEnv, R_BaseEnv,
352
    begincontext(&cntxt, CTXT_CCODE, R_NilValue, R_BaseEnv, R_BaseEnv,
352
		 R_NilValue, R_NilValue);
353
		 R_NilValue, R_NilValue);
353
    cntxt.cend = &cleanup_PrintWarnings;
354
    cntxt.cend = &cleanup_PrintWarnings;
354
 
355
 
355
    inPrintWarnings = 1;
356
    inPrintWarnings = 1;
-
 
357
    header = ngettext("Warning message:\n", "Warning messages:\n", 
-
 
358
		      R_CollectWarnings);
356
    if( R_CollectWarnings == 1 ) {
359
    if( R_CollectWarnings == 1 ) {
357
	REprintf(_("Warning message:\n"));
360
	REprintf(header);
358
	names = CAR(ATTRIB(R_Warnings));
361
	names = CAR(ATTRIB(R_Warnings));
359
	if( VECTOR_ELT(R_Warnings, 0) == R_NilValue )
362
	if( VECTOR_ELT(R_Warnings, 0) == R_NilValue )
360
	   REprintf("%s \n", CHAR(STRING_ELT(names, 0)));
363
	   REprintf("%s \n", CHAR(STRING_ELT(names, 0)));
361
	else
364
	else
362
	   REprintf("%s in: %s \n", CHAR(STRING_ELT(names, 0)),
365
	   REprintf("%s in: %s \n", CHAR(STRING_ELT(names, 0)),
363
		CHAR(STRING_ELT(deparse1(VECTOR_ELT(R_Warnings, 0), 0, SIMPLEDEPARSE), 0)));
366
		CHAR(STRING_ELT(deparse1(VECTOR_ELT(R_Warnings, 0), 0, SIMPLEDEPARSE), 0)));
364
    }
367
    }
365
    else if( R_CollectWarnings <= 10 ) {
368
    else if( R_CollectWarnings <= 10 ) {
366
	REprintf(_("Warning messages:\n"));
369
	REprintf(header);
367
	names = CAR(ATTRIB(R_Warnings));
370
	names = CAR(ATTRIB(R_Warnings));
368
	for(i=0; i<R_CollectWarnings; i++) {
371
	for(i=0; i<R_CollectWarnings; i++) {
369
	    if( STRING_ELT(R_Warnings, i) == R_NilValue )
372
	    if( STRING_ELT(R_Warnings, i) == R_NilValue )
370
	       REprintf("%d: %s \n",i+1, CHAR(STRING_ELT(names, i)));
373
	       REprintf("%d: %s \n",i+1, CHAR(STRING_ELT(names, i)));
371
	    else
374
	    else