The R Project SVN R

Rev

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

Rev 5458 Rev 5731
Line 71... Line 71...
71
    if (length(text) > 0) {
71
    if (length(text) > 0) {
72
	if (num == NA_INTEGER)
72
	if (num == NA_INTEGER)
73
	    num = -1;
73
	    num = -1;
74
	s = R_ParseVector(text, num, &status);
74
	s = R_ParseVector(text, num, &status);
75
	if (status != PARSE_OK)
75
	if (status != PARSE_OK)
76
	    errorcall(call, "parse error\n");
76
	    errorcall(call, "parse error");
77
	UNPROTECT(3);
77
	UNPROTECT(3);
78
	return s;
78
	return s;
79
    }
79
    }
80
    else if (ValidFileSpec(file)) {
80
    else if (ValidFileSpec(file)) {
81
	if (num == NA_INTEGER)
81
	if (num == NA_INTEGER)
82
	    num = -1;
82
	    num = -1;
83
	fp = R_fopen(R_ExpandFileName(CHAR(STRING(file)[0])), "r");
83
	fp = R_fopen(R_ExpandFileName(CHAR(STRING(file)[0])), "r");
84
	if (!fp)
84
	if (!fp)
85
	    errorcall(call, "unable to open file for parsing\n");
85
	    errorcall(call, "unable to open file for parsing");
86
	s = R_ParseFile(fp, num, &status);
86
	s = R_ParseFile(fp, num, &status);
87
	fclose(fp);
87
	fclose(fp);
88
	if (status != PARSE_OK)
88
	if (status != PARSE_OK)
89
	    errorcall(call, "syntax error on line %d\n", R_ParseError);
89
	    errorcall(call, "syntax error on line %d", R_ParseError);
90
	UNPROTECT(3);
90
	UNPROTECT(3);
91
	return s;
91
	return s;
92
    }
92
    }
93
    else {
93
    else {
94
	if (num == NA_INTEGER)
94
	if (num == NA_INTEGER)
95
	    num = 1;
95
	    num = 1;
96
	s = R_ParseBuffer(&R_ConsoleIob, num, &status, prompt);
96
	s = R_ParseBuffer(&R_ConsoleIob, num, &status, prompt);
97
	if (status != PARSE_OK)
97
	if (status != PARSE_OK)
98
	    errorcall(call, "parse error\n");
98
	    errorcall(call, "parse error");
99
	UNPROTECT(3);
99
	UNPROTECT(3);
100
	return s;
100
	return s;
101
    }
101
    }
102
}
102
}