fix for %import + module name, detected in OSS

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7556 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-09-30 12:00:34 +00:00
commit 5fe9d8ec4a

View file

@ -167,9 +167,9 @@ static String *class_rename = 0;
#define CPLUS_PROTECTED 3
/* include types */
static int include_type = 0;
#define INCLUDE_MODE 1
#define IMPORT_MODE 2
static int include_type = 1;
void SWIG_typemap_lang(const char *tm_lang) {
typemap_lang = Swig_copy_string(tm_lang);
@ -1760,6 +1760,11 @@ include_directive: includetype options string LBRACKET {
set_nodeType($$,"import");
/* try to get the modulename from the options */
modulename = $2 ? Getattr($2,"module") : 0;
/*
we return to include type only here since an
%imported file can also %include other files
*/
include_type = INCLUDE_MODE;
}
Setattr($$,"name",$3);
@ -1780,7 +1785,7 @@ include_directive: includetype options string LBRACKET {
}
;
includetype : INCLUDE { $$.type = (char *) "include"; include_type = INCLUDE_MODE;}
includetype : INCLUDE { $$.type = (char *) "include"; }
| IMPORT { $$.type = (char *) "import"; include_type = IMPORT_MODE;}
;
@ -1889,7 +1894,7 @@ module_directive: MODULE options idstring {
if (include_type == INCLUDE_MODE) {
/* first module included, we apply global
ModuleName, which can be modify by -module */
Setattr($$,"name",Copy(ModuleName));
Setattr($$,"name",ModuleName);
} else {
/* import mode, we just pass the idstring */
Setattr($$,"name",$3);