Allow referencing of typemap keywords inside of "$typemap("

This commit is contained in:
Seth R Johnson 2018-09-20 15:50:27 -04:00
commit 1329670640
4 changed files with 46 additions and 14 deletions

View file

@ -1,10 +1,15 @@
import special_variable_macros
cvar = special_variable_macros.cvar
name = special_variable_macros.Name()
if special_variable_macros.testFred(name) != "none":
raise "test failed"
if cvar.accessed_examplekw != 0:
raise "Precondition failed"
if special_variable_macros.testJack(name) != "$specialname":
raise "test failed"
if cvar.accessed_examplekw != 1:
raise "Postcondition failed"
if special_variable_macros.testJill(name) != "jilly":
raise "test failed"
if special_variable_macros.testMary(name) != "SWIGTYPE_p_NameWrap":

View file

@ -39,10 +39,13 @@ struct NameWrap {
private:
Name name;
};
// Global variable for testing whether examplekw was touched
int accessed_examplekw = 0;
%}
// check $1 and $input get expanded properly when used from $typemap()
%typemap(in) Name *GENERIC ($*1_type temp)
%typemap(in, examplekw="accessed_examplekw=1;") Name *GENERIC ($*1_type temp)
%{
/*%typemap(in) Name *GENERIC start */
temp = Name("$specialname");
@ -80,6 +83,7 @@ static const char *nameDescriptor = "$descriptor(Name)";
%typemap(in) Name *jack {
// %typemap(in) Name *jack start
$typemap(in, Name *GENERIC)
$typemap(in:examplekw, Name *GENERIC)
// %typemap(in) Name *jack end
}