add support for options in rename/namewarn and central methods to access the rename/warning hashs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8150 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
79acadb777
commit
b034e6c266
8 changed files with 211 additions and 67 deletions
|
|
@ -1,6 +1,56 @@
|
|||
Version 1.3.28 (unreleased).
|
||||
===========================
|
||||
|
||||
12/30/2005: mmatus
|
||||
|
||||
- Add option/format support to %rename and %namewarn.
|
||||
Now %namewarn can force renaming, for example:
|
||||
|
||||
%namewarn("314: import is a keyword",rename="_%s") "import";
|
||||
|
||||
and rename can also support format forms:
|
||||
|
||||
%rename("swig_%s") import;
|
||||
|
||||
Now, since the format is processed via swig Printf, you
|
||||
can use encoder as follows:
|
||||
|
||||
%rename("%(title)s") import; -> Import
|
||||
%rename("%(upper)s") import; -> IMPORT
|
||||
%rename("%(lower)s") Import; -> import
|
||||
|
||||
This will allow us to add more encoders, as the next
|
||||
expected 'regexp'.
|
||||
|
||||
- In the meantime, add the 'command' encoder, you can use it as follows
|
||||
|
||||
%rename(%(command:sed -e 's/\([a-z]\)/\U\\1/' <<< %s)s) import; -> Import
|
||||
|
||||
where swig executes the command defined as %(command:<command here>)s.
|
||||
Note that swig pass the name and the prefix as parameters
|
||||
that can capture via '%s'. Another example
|
||||
|
||||
#define awk_cmd "%(command:awk '{if (NF==2) {print $2_$1} else {print _$1}}' <<< %s %s)s"
|
||||
|
||||
%rename(awk_cmd) ns1::import; -> ns1_import;
|
||||
%rename(awk_cmd) import; -> _import
|
||||
|
||||
Just remember, first parameter is the name, the second is
|
||||
the prefix. If you don't need the prefix, just put one '%s'
|
||||
argument in your command.
|
||||
|
||||
Note that the 'command' encoder requires popen in your platform.
|
||||
|
||||
- The rename directive has its first option 'match', to
|
||||
match the node type, for example:
|
||||
|
||||
%rename(%(title)s,match="enumitem") *;
|
||||
|
||||
enum Hello {
|
||||
hi, hello -> Hi, Hello
|
||||
};
|
||||
|
||||
|
||||
12/30/2005: mmatus
|
||||
|
||||
- Add initial support for gcj and Java -> <target language> mechanism.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue