The R Project SVN R

Rev

Rev 29864 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29864 Rev 30691
Line 24... Line 24...
24
 
24
 
25
#ifdef HAVE_AQUA
25
#ifdef HAVE_AQUA
26
extern void R_ProcessEvents(void);
26
extern void R_ProcessEvents(void);
27
#endif
27
#endif
28
 
28
 
29
 
-
 
30
#include <Defn.h>
29
#include <Defn.h>
31
/* -> Errormsg.h */
30
/* -> Errormsg.h */
32
#include <Startup.h> /* rather cleanup ..*/
31
#include <Startup.h> /* rather cleanup ..*/
33
#include <Rconnections.h>
32
#include <Rconnections.h>
34
 
33
 
Line 90... Line 89...
90
    if (R_interrupts_suspended) {
89
    if (R_interrupts_suspended) {
91
	R_interrupts_pending = 1;
90
	R_interrupts_pending = 1;
92
	return;
91
	return;
93
    }
92
    }
94
    else R_interrupts_pending = 0;
93
    else R_interrupts_pending = 0;
95
 
-
 
96
    signalInterrupt();
94
    signalInterrupt();
97
 
95
 
98
    REprintf("\n");
96
    REprintf("\n");
99
    /* Attempt to run user error option, save a traceback, show
97
    /* Attempt to run user error option, save a traceback, show
100
       warnings, and reset console; also stop at restart (try/browser)
98
       warnings, and reset console; also stop at restart (try/browser)
Line 249... Line 247...
249
	inWarning = 0; /* PR#1570 */
247
	inWarning = 0; /* PR#1570 */
250
	errorcall(call, "(converted from warning) %s", buf);
248
	errorcall(call, "(converted from warning) %s", buf);
251
    }
249
    }
252
    else if(w == 1) {	/* print as they happen */
250
    else if(w == 1) {	/* print as they happen */
253
	if( call != R_NilValue ) {
251
	if( call != R_NilValue ) {
254
	    dcall = CHAR(STRING_ELT(deparse1(call, 0, TRUE, FALSE), 0));
252
	    dcall = CHAR(STRING_ELT(deparse1(call, 0, SIMPLEDEPARSE), 0));
255
	    REprintf("Warning in %s : ", dcall);
253
	    REprintf("Warning in %s : ", dcall);
256
	    if (strlen(dcall) > LONGCALL) REprintf("\n	 ");
254
	    if (strlen(dcall) > LONGCALL) REprintf("\n	 ");
257
	}
255
	}
258
	else
256
	else
259
	    REprintf("Warning: ");
257
	    REprintf("Warning: ");
Line 346... Line 344...
346
	names = CAR(ATTRIB(R_Warnings));
344
	names = CAR(ATTRIB(R_Warnings));
347
	if( VECTOR_ELT(R_Warnings, 0) == R_NilValue )
345
	if( VECTOR_ELT(R_Warnings, 0) == R_NilValue )
348
	   REprintf("%s \n", CHAR(STRING_ELT(names, 0)));
346
	   REprintf("%s \n", CHAR(STRING_ELT(names, 0)));
349
	else
347
	else
350
	   REprintf("%s in: %s \n", CHAR(STRING_ELT(names, 0)),
348
	   REprintf("%s in: %s \n", CHAR(STRING_ELT(names, 0)),
351
		CHAR(STRING_ELT(deparse1(VECTOR_ELT(R_Warnings, 0), 0, TRUE, FALSE), 0)));
349
		CHAR(STRING_ELT(deparse1(VECTOR_ELT(R_Warnings, 0), 0, SIMPLEDEPARSE), 0)));
352
    }
350
    }
353
    else if( R_CollectWarnings <= 10 ) {
351
    else if( R_CollectWarnings <= 10 ) {
354
	REprintf("Warning messages: \n");
352
	REprintf("Warning messages: \n");
355
	names = CAR(ATTRIB(R_Warnings));
353
	names = CAR(ATTRIB(R_Warnings));
356
	for(i=0; i<R_CollectWarnings; i++) {
354
	for(i=0; i<R_CollectWarnings; i++) {
357
	    if( STRING_ELT(R_Warnings, i) == R_NilValue )
355
	    if( STRING_ELT(R_Warnings, i) == R_NilValue )
358
	       REprintf("%d: %s \n",i+1, CHAR(STRING_ELT(names, i)));
356
	       REprintf("%d: %s \n",i+1, CHAR(STRING_ELT(names, i)));
359
	    else
357
	    else
360
	       REprintf("%d: %s in: %s \n", i+1, CHAR(STRING_ELT(names, i)),
358
	       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)));
359
		   CHAR(STRING_ELT(deparse1(VECTOR_ELT(R_Warnings,i), 0, SIMPLEDEPARSE), 0)));
362
	}
360
	}
363
    }
361
    }
364
    else {
362
    else {
365
	if (R_CollectWarnings < 50)
363
	if (R_CollectWarnings < 50)
366
	    REprintf("There were %d warnings (use warnings() to see them)\n",
364
	    REprintf("There were %d warnings (use warnings() to see them)\n",
Line 435... Line 433...
435
	char *head = "Error in ";
433
	char *head = "Error in ";
436
	char *mid = " : ";
434
	char *mid = " : ";
437
	char *tail = "\n\t";/* <- TAB */
435
	char *tail = "\n\t";/* <- TAB */
438
	int len = strlen(head) + strlen(mid) + strlen(tail);
436
	int len = strlen(head) + strlen(mid) + strlen(tail);
439
 
437
 
440
	dcall = CHAR(STRING_ELT(deparse1(call, 0, TRUE, FALSE), 0));
438
	dcall = CHAR(STRING_ELT(deparse1(call, 0, SIMPLEDEPARSE), 0));
441
	if (strlen(dcall) + len < BUFSIZE) {
439
	if (strlen(dcall) + len < BUFSIZE) {
442
	    sprintf(errbuf, "%s%s%s", head, dcall, mid);
440
	    sprintf(errbuf, "%s%s%s", head, dcall, mid);
443
	    if (strlen(dcall) > LONGCALL) strcat(errbuf, tail);
441
	    if (strlen(dcall) > LONGCALL) strcat(errbuf, tail);
444
	}
442
	}
445
	else
443
	else
Line 626... Line 624...
626
       exit.  */
624
       exit.  */
627
 
625
 
628
    /* jump to a browser/try if one is on the stack */
626
    /* jump to a browser/try if one is on the stack */
629
    if (! ignoreRestartContexts)
627
    if (! ignoreRestartContexts)
630
	try_jump_to_restart();
628
	try_jump_to_restart();
631
 
-
 
632
    /* at this point, i.e. if we have not exited in
629
    /* at this point, i.e. if we have not exited in
633
       try_jump_to_restart, we are heading for R_ToplevelContext */
630
       try_jump_to_restart, we are heading for R_ToplevelContext */
634
 
631
 
635
    /* only run traceback if we are not going to bail out of a
632
    /* only run traceback if we are not going to bail out of a
636
       non-interactive session */
633
       non-interactive session */
Line 665... Line 662...
665
	R_CleanUp(SA_NOSAVE, 1, 0); /* quit, no save, no .Last, status=1 */
662
	R_CleanUp(SA_NOSAVE, 1, 0); /* quit, no save, no .Last, status=1 */
666
    }
663
    }
667
 
664
 
668
    R_GlobalContext = R_ToplevelContext;
665
    R_GlobalContext = R_ToplevelContext;
669
    R_restore_globals(R_GlobalContext);
666
    R_restore_globals(R_GlobalContext);
670
 
-
 
671
    LONGJMP(R_ToplevelContext->cjmpbuf, 0);
667
    LONGJMP(R_ToplevelContext->cjmpbuf, 0);
672
 
-
 
673
    /* not reached */
668
    /* not reached */
674
    endcontext(&cntxt);
669
    endcontext(&cntxt);
675
    inError = oldInError;
670
    inError = oldInError;
676
}
671
}
677
 
672
 
Line 921... Line 916...
921
	 c = c->nextcontext)
916
	 c = c->nextcontext)
922
	if (c->callflag & CTXT_FUNCTION ) {
917
	if (c->callflag & CTXT_FUNCTION ) {
923
	    if (skip > 0)
918
	    if (skip > 0)
924
		skip--;
919
		skip--;
925
	    else {
920
	    else {
926
		SETCAR(t, deparse1(c->call, 0, TRUE, FALSE));
921
		SETCAR(t, deparse1(c->call, 0, SIMPLEDEPARSE));
927
		t = CDR(t);
922
		t = CDR(t);
928
	    }
923
	    }
929
	}
924
	}
930
    UNPROTECT(1);
925
    UNPROTECT(1);
931
    return s;
926
    return s;