Fix -nopreprocess option to correctly generate output filenames and display filenames in warnings and errors

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10930 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-11-16 21:40:28 +00:00
commit 8ac9453f62
5 changed files with 81 additions and 53 deletions

View file

@ -34,7 +34,9 @@ extern "C" {
extern void scanner_ignore_typedef(void);
extern void scanner_last_id(int);
extern void scanner_clear_rename(void);
extern void scanner_set_location(String_or_char *, int line);
extern void scanner_set_location(String_or_char *file, int line);
extern void scanner_set_main_input_file(String *file);
extern String *scanner_get_main_input_file();
extern void Swig_cparse_follow_locators(int);
extern void start_inline(char *, int);
extern String *scanner_ccode;

View file

@ -22,7 +22,10 @@ char cvsroot_cscanner_c[] = "$Id$";
static Scanner *scan = 0;
/* Global string containing C code. Used by the parser to grab code blocks */
DOHString *scanner_ccode = 0;
String *scanner_ccode = 0;
/* The main file being parsed */
static String *main_input_file = 0;
/* Error reporting/location information */
int cparse_line = 1;
@ -467,6 +470,14 @@ void scanner_next_token(int tok) {
next_token = tok;
}
void scanner_set_main_input_file(String *file) {
main_input_file = file;
}
String *scanner_get_main_input_file() {
return main_input_file;
}
/* ----------------------------------------------------------------------------
* int yylex()
*

View file

@ -1894,6 +1894,8 @@ include_directive: includetype options string LBRACKET {
$1.filename = Copy(cparse_file);
$1.line = cparse_line;
scanner_set_location(NewString($3),1);
if ($2 && GetFlag($2, "maininput"))
scanner_set_main_input_file(NewString($3));
} interface RBRACKET {
String *mname = 0;
$$ = $6;