change the %rename predicates to use the prefix %$ and avoid clashings with other rename directives

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8469 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-16 23:27:11 +00:00
commit 526be12c1e
3 changed files with 47 additions and 45 deletions

View file

@ -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 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) %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, class renamed as c_"`x`,%$isclass,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, constructor renamed as c_"`x`,%$isconstructor,rename="c_%s") `x`;
%enddef %enddef
#define PHPBN1(x) %namewarn("321:" `x` " conflicts with a built-in name in php",sourcefmt="%(lower)s",fullname=1) `x` #define PHPBN1(x) %namewarn("321:" `x` " conflicts with a built-in name in php",sourcefmt="%(lower)s",fullname=1) `x`

View file

@ -9,21 +9,21 @@
* ------------------------------------------------------------ */ * ------------------------------------------------------------ */
#if defined(SWIG_RUBY_AUTORENAME) #if defined(SWIG_RUBY_AUTORENAME)
/* Class names are CamelCase */ /* Class names are CamelCase */
%rename("%(camelcase)s", %isclass) ""; %rename("%(camelcase)s", %$isclass) "";
/* Constants created by %constant or #define are UPPER_CASE */ /* 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 /* SWIG only considers static class members with inline intializers
to be constants. For examples of what is and isn't considered to be constants. For examples of what is and isn't considered
a constant by SWIG see naming.i in the Ruby test suite. */ 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 */ /* 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 */ /* 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 #endif
/* ------------------------------------------------------------ /* ------------------------------------------------------------

View file

@ -213,63 +213,65 @@ static int NAME(TYPE x) {
- to rename all the functions: - to rename all the functions:
%rename("%(utitle)s", %isfunction) ""; %rename("%(utitle)s", %$isfunction) "";
- to rename only the member methods: - to rename only the member methods:
%rename("m_%(utitle)s", %isfunction, %ismember) ""; %rename("m_%(utitle)s", %$isfunction, %$ismember) "";
- to rename only the global functions: - 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: - 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 %$not "not" %enddef
%define %isenum "match"="enum" %enddef %define %$isenum "match"="enum" %enddef
%define %isenumitem "match"="enumitem" %enddef %define %$isenumitem "match"="enumitem" %enddef
%define %isaccess "match"="access" %enddef %define %$isaccess "match"="access" %enddef
%define %isclass "match"="class" %enddef %define %$isclass "match"="class" %enddef
%define %isextend "match"="extend" %enddef %define %$isextend "match"="extend" %enddef
%define %isextend "match"="extend" %enddef %define %$isextend "match"="extend" %enddef
%define %isconstructor "match"="constructor" %enddef %define %$isconstructor "match"="constructor" %enddef
%define %isdestructor "match"="destructor" %enddef %define %$isdestructor "match"="destructor" %enddef
%define %isnamespace "match"="namespace" %enddef %define %$isnamespace "match"="namespace" %enddef
%define %istemplate "match"="template" %enddef %define %$istemplate "match"="template" %enddef
%define %isconstant "match"="constant" %enddef /* %constant definition */ %define %$isconstant "match"="constant" %enddef /* %constant definition */
%define %isunion "match$kind"="union" %enddef %define %$isunion "match$kind"="union" %enddef
%define %isfunction "match$kind"="function" %enddef %define %$isfunction "match$kind"="function" %enddef
%define %isvariable "match$kind"="variable" %enddef %define %$isvariable "match$kind"="variable" %enddef
%define %isimmutable "match$feature:immutable"="1" %enddef %define %$isimmutable "match$feature:immutable"="1" %enddef
%define %hasconsttype "match$hasconsttype"="1" %enddef %define %$hasconsttype "match$hasconsttype"="1" %enddef
%define %hasvalue "match$hasvalue"="1" %enddef %define %$hasvalue "match$hasvalue"="1" %enddef
%define %isextension "match$isextension"="1" %enddef %define %$isextension "match$isextension"="1" %enddef
%define %isstatic "match$storage"="static" %enddef %define %$isstatic "match$storage"="static" %enddef
%define %isfriend "match$storage"="friend" %enddef %define %$isfriend "match$storage"="friend" %enddef
%define %istypedef "match$storage"="typedef" %enddef %define %$istypedef "match$storage"="typedef" %enddef
%define %isvirtual "match$storage"="virtual" %enddef %define %$isvirtual "match$storage"="virtual" %enddef
%define %isexplicit "match$storage"="explicit" %enddef %define %$isexplicit "match$storage"="explicit" %enddef
%define %isextern "match$storage"="extern" %enddef %define %$isextern "match$storage"="extern" %enddef
%define %ismember "match$ismember"="1" %enddef %define %$ismember "match$ismember"="1" %enddef
%define %isglobal %not %ismember %enddef %define %$isglobal %not %ismember %enddef
%define %innamespace "match$parentNode$nodeType"="namespace" %enddef %define %$innamespace "match$parentNode$nodeType"="namespace" %enddef
%define %ispublic "match$access"="public" %enddef %define %$ispublic "match$access"="public" %enddef
%define %isprotected "match$access"="protected" %enddef %define %$isprotected "match$access"="protected" %enddef
%define %isprivate "match$access"="public" %enddef %define %$isprivate "match$access"="public" %enddef
%define %ismemberget "match$memberget"="1" %enddef %define %$ismemberget "match$memberget"="1" %enddef
%define %ismemberset "match$memberset"="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 * Include all the warnings labels and macros