The R Project SVN R

Rev

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

Rev 31671 Rev 31757
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1997--2002  The R Development Core Team.
4
 *  Copyright (C) 1997--2004  The R Development Core Team.
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
Line 44... Line 44...
44
in the error handling.
44
in the error handling.
45
*/
45
*/
46
static int inError = 0;
46
static int inError = 0;
47
static int inWarning = 0;
47
static int inWarning = 0;
48
static int inPrintWarnings = 0;
48
static int inPrintWarnings = 0;
-
 
49
static int immediateWarning = 0;
49
 
50
 
50
static void try_jump_to_restart(void);
51
static void try_jump_to_restart(void);
51
static void jump_to_top_ex(Rboolean, Rboolean, Rboolean, Rboolean, Rboolean);
52
static void jump_to_top_ex(Rboolean, Rboolean, Rboolean, Rboolean, Rboolean);
52
static void signalInterrupt(void);
53
static void signalInterrupt(void);
53
 
54
 
Line 232... Line 233...
232
	w = 0;
233
	w = 0;
233
 
234
 
234
    if(w < 0 || inWarning || inError)  {/* ignore if w<0 or already in here*/
235
    if(w < 0 || inWarning || inError)  {/* ignore if w<0 or already in here*/
235
	return;
236
	return;
236
    }
237
    }
-
 
238
    if( w == 0 && immediateWarning ) w = 1;
237
 
239
 
238
    /* set up a context which will restore inWarning if there is an exit */
240
    /* set up a context which will restore inWarning if there is an exit */
239
    begincontext(&cntxt, CTXT_CCODE, R_NilValue, R_NilValue, R_NilValue,
241
    begincontext(&cntxt, CTXT_CCODE, R_NilValue, R_NilValue, R_NilValue,
240
		 R_NilValue, R_NilValue);
242
		 R_NilValue, R_NilValue);
241
    cntxt.cend = &reset_inWarning;
243
    cntxt.cend = &reset_inWarning;
Line 721... Line 723...
721
	c_call = findCall();
723
	c_call = findCall();
722
    else
724
    else
723
	c_call = R_NilValue;
725
	c_call = R_NilValue;
724
 
726
 
725
    args = CDR(args);
727
    args = CDR(args);
-
 
728
    if(asLogical(CAR(args))) { /* immediate = TRUE */
-
 
729
	immediateWarning = 1;
-
 
730
    } else 
-
 
731
	immediateWarning = 0;
-
 
732
    args = CDR(args);
726
    if (CAR(args) != R_NilValue) {
733
    if (CAR(args) != R_NilValue) {
727
	SETCAR(args, coerceVector(CAR(args), STRSXP));
734
	SETCAR(args, coerceVector(CAR(args), STRSXP));
728
	if(!isValidString(CAR(args)))
735
	if(!isValidString(CAR(args)))
729
	    warningcall(c_call, " [invalid string in warning(.)]");
736
	    warningcall(c_call, " [invalid string in warning(.)]");
730
	else
737
	else
731
	    warningcall(c_call, "%s", CHAR(STRING_ELT(CAR(args), 0)));
738
	    warningcall(c_call, "%s", CHAR(STRING_ELT(CAR(args), 0)));
732
    }
739
    }
733
    else
740
    else
734
	warningcall(c_call, "");
741
	warningcall(c_call, "");
-
 
742
    immediateWarning = 0; /* reset to internal calls */
735
 
743
 
736
    /* need to set R_Visible since it may have been changed by a callback */
744
    /* need to set R_Visible since it may have been changed by a callback */
737
    R_Visible = 0;
745
    R_Visible = 0;
738
    return CAR(args);
746
    return CAR(args);
739
}
747
}