diff --git a/Lib/php4/php4kw.swg b/Lib/php4/php4kw.swg index 9caa2f286..d04abaae4 100644 --- a/Lib/php4/php4kw.swg +++ b/Lib/php4/php4kw.swg @@ -6,8 +6,8 @@ #define PHPKW(x) %namewarn("314:" `x` " is a php keyword, renamed as c_"`x`,sourcefmt="%(lower)s", rename="c_%s",fullname=1) `x` %define PHPCN(x) -%namewarn("314:" `x` " is a php reserved class name, class renamed as c_"`x`,match="class",rename="c_%s") `x`; -%namewarn("314:" `x` " is a php reserved class name, constructor renamed as c_"`x`,match="constructor",rename="c_%s") `x`; +%namewarn("314:" `x` " is a php reserved class name, class renamed as c_"`x`,%$isclass,rename="c_%s") `x`; +%namewarn("314:" `x` " is a php reserved class name, constructor renamed as c_"`x`,%$isconstructor,rename="c_%s") `x`; %enddef #define PHPBN1(x) %namewarn("321:" `x` " conflicts with a built-in name in php",sourcefmt="%(lower)s",fullname=1) `x` diff --git a/Lib/ruby/ruby.swg b/Lib/ruby/ruby.swg index 3582f1def..c14a7064d 100644 --- a/Lib/ruby/ruby.swg +++ b/Lib/ruby/ruby.swg @@ -9,21 +9,21 @@ * ------------------------------------------------------------ */ #if defined(SWIG_RUBY_AUTORENAME) /* Class names are CamelCase */ -%rename("%(camelcase)s", %isclass) ""; +%rename("%(camelcase)s", %$isclass) ""; /* Constants created by %constant or #define are UPPER_CASE */ -%rename("%(uppercase)s", %isconstant) ""; +%rename("%(uppercase)s", %$isconstant) ""; /* SWIG only considers static class members with inline intializers to be constants. For examples of what is and isn't considered a constant by SWIG see naming.i in the Ruby test suite. */ -%rename("%(uppercase)s", %ismember, %isvariable,%isimmutable,%isstatic,%hasvalue,%hasconsttype) ""; +%rename("%(uppercase)s", %$ismember, %$isvariable,%$isimmutable,%$isstatic,%$hasvalue,%$hasconsttype) ""; /* Enums are mapped to constants and thus should be UPPER_CASE */ -%rename("%(uppercase)s", %isenumitem) ""; +%rename("%(uppercase)s", %$isenumitem) ""; /* Method names should be lower_case_with_underscores */ -%rename("%(undercase)s", %isfunction, %ismember, %not %ismemberget, %not %ismemberset) ""; +%rename("%(undercase)s", %$isfunction, %$ismember, %$not %$ismemberget, %$not %$ismemberset) ""; #endif /* ------------------------------------------------------------ diff --git a/Lib/swig.swg b/Lib/swig.swg index 7136a7b9e..2485d9e4d 100644 --- a/Lib/swig.swg +++ b/Lib/swig.swg @@ -213,63 +213,65 @@ static int NAME(TYPE x) { - to rename all the functions: - %rename("%(utitle)s", %isfunction) ""; + %rename("%(utitle)s", %$isfunction) ""; - to rename only the member methods: - %rename("m_%(utitle)s", %isfunction, %ismember) ""; + %rename("m_%(utitle)s", %$isfunction, %$ismember) ""; - to rename only the global functions: - %rename("g_%(utitle)s", %isfunction, %isglobal) ""; + %rename("g_%(utitle)s", %$isfunction, %$isglobal) ""; - to ignore the enumitems in a given class: - %rename("$ignore", %isenumitem, %classname="MyClass") ""; + %rename("$ignore", %$isenumitem, %$classname="MyClass") ""; + we use the prefix '%$' to avoid clashings with other swig + macros/directives. */ -%define %not "not" %enddef -%define %isenum "match"="enum" %enddef -%define %isenumitem "match"="enumitem" %enddef -%define %isaccess "match"="access" %enddef -%define %isclass "match"="class" %enddef -%define %isextend "match"="extend" %enddef -%define %isextend "match"="extend" %enddef -%define %isconstructor "match"="constructor" %enddef -%define %isdestructor "match"="destructor" %enddef -%define %isnamespace "match"="namespace" %enddef -%define %istemplate "match"="template" %enddef -%define %isconstant "match"="constant" %enddef /* %constant definition */ +%define %$not "not" %enddef +%define %$isenum "match"="enum" %enddef +%define %$isenumitem "match"="enumitem" %enddef +%define %$isaccess "match"="access" %enddef +%define %$isclass "match"="class" %enddef +%define %$isextend "match"="extend" %enddef +%define %$isextend "match"="extend" %enddef +%define %$isconstructor "match"="constructor" %enddef +%define %$isdestructor "match"="destructor" %enddef +%define %$isnamespace "match"="namespace" %enddef +%define %$istemplate "match"="template" %enddef +%define %$isconstant "match"="constant" %enddef /* %constant definition */ -%define %isunion "match$kind"="union" %enddef -%define %isfunction "match$kind"="function" %enddef -%define %isvariable "match$kind"="variable" %enddef -%define %isimmutable "match$feature:immutable"="1" %enddef -%define %hasconsttype "match$hasconsttype"="1" %enddef -%define %hasvalue "match$hasvalue"="1" %enddef -%define %isextension "match$isextension"="1" %enddef +%define %$isunion "match$kind"="union" %enddef +%define %$isfunction "match$kind"="function" %enddef +%define %$isvariable "match$kind"="variable" %enddef +%define %$isimmutable "match$feature:immutable"="1" %enddef +%define %$hasconsttype "match$hasconsttype"="1" %enddef +%define %$hasvalue "match$hasvalue"="1" %enddef +%define %$isextension "match$isextension"="1" %enddef -%define %isstatic "match$storage"="static" %enddef -%define %isfriend "match$storage"="friend" %enddef -%define %istypedef "match$storage"="typedef" %enddef -%define %isvirtual "match$storage"="virtual" %enddef -%define %isexplicit "match$storage"="explicit" %enddef -%define %isextern "match$storage"="extern" %enddef +%define %$isstatic "match$storage"="static" %enddef +%define %$isfriend "match$storage"="friend" %enddef +%define %$istypedef "match$storage"="typedef" %enddef +%define %$isvirtual "match$storage"="virtual" %enddef +%define %$isexplicit "match$storage"="explicit" %enddef +%define %$isextern "match$storage"="extern" %enddef -%define %ismember "match$ismember"="1" %enddef -%define %isglobal %not %ismember %enddef -%define %innamespace "match$parentNode$nodeType"="namespace" %enddef +%define %$ismember "match$ismember"="1" %enddef +%define %$isglobal %not %ismember %enddef +%define %$innamespace "match$parentNode$nodeType"="namespace" %enddef -%define %ispublic "match$access"="public" %enddef -%define %isprotected "match$access"="protected" %enddef -%define %isprivate "match$access"="public" %enddef +%define %$ispublic "match$access"="public" %enddef +%define %$isprotected "match$access"="protected" %enddef +%define %$isprivate "match$access"="public" %enddef -%define %ismemberget "match$memberget"="1" %enddef -%define %ismemberset "match$memberset"="1" %enddef +%define %$ismemberget "match$memberget"="1" %enddef +%define %$ismemberset "match$memberset"="1" %enddef -%define %classname %ismember,match$parentNode$name %enddef +%define %$classname %ismember,match$parentNode$name %enddef /* ----------------------------------------------------------------------------- * Include all the warnings labels and macros