The R Project SVN R

Rev

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

Rev 61399 Rev 62580
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Langage for Statistical Data Analysis
2
 *  R : A Computer Langage 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) 2001-12     The R Core Team
4
 *  Copyright (C) 2001-13     The R 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 138... Line 138...
138
	case 0:
138
	case 0:
139
	    error("%s%d:%d: %s",
139
	    error("%s%d:%d: %s",
140
		  filename, linenum, R_ParseErrorCol, R_ParseErrorMsg);
140
		  filename, linenum, R_ParseErrorCol, R_ParseErrorMsg);
141
	    break;
141
	    break;
142
	case 1: // replaces use of %n
142
	case 1: // replaces use of %n
143
	    width = sprintf(buffer, "%d: ", R_ParseContextLine); 
143
	    width = snprintf(buffer, 10, "%d: ", R_ParseContextLine); 
144
	    error("%s%d:%d: %s\n%d: %s\n%*s",
144
	    error("%s%d:%d: %s\n%d: %s\n%*s",
145
		  filename, linenum, R_ParseErrorCol, R_ParseErrorMsg,
145
		  filename, linenum, R_ParseErrorCol, R_ParseErrorMsg,
146
		  R_ParseContextLine, CHAR(STRING_ELT(context, 0)), 
146
		  R_ParseContextLine, CHAR(STRING_ELT(context, 0)), 
147
		  width+R_ParseErrorCol, "^");
147
		  width+R_ParseErrorCol, "^");
148
	    break;
148
	    break;
149
	default:
149
	default:
150
	    width = sprintf(buffer, "%d:", R_ParseContextLine);
150
	    width = snprintf(buffer, 10, "%d:", R_ParseContextLine);
151
	    error("%s%d:%d: %s\n%d: %s\n%d: %s\n%*s",
151
	    error("%s%d:%d: %s\n%d: %s\n%d: %s\n%*s",
152
		  filename, linenum, R_ParseErrorCol, R_ParseErrorMsg,
152
		  filename, linenum, R_ParseErrorCol, R_ParseErrorMsg,
153
		  R_ParseContextLine-1, CHAR(STRING_ELT(context, len-2)),
153
		  R_ParseContextLine-1, CHAR(STRING_ELT(context, len-2)),
154
		  R_ParseContextLine, CHAR(STRING_ELT(context, len-1)), 
154
		  R_ParseContextLine, CHAR(STRING_ELT(context, len-1)), 
155
		  width+R_ParseErrorCol, "^");
155
		  width+R_ParseErrorCol, "^");