Moved constant renames from the c++ code to ruby.swg to reuse the new %rename functionality.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8404 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
16c4a594e7
commit
f4d48d7bfc
2 changed files with 8 additions and 7 deletions
|
|
@ -7,6 +7,11 @@
|
||||||
/* ------------------------------------------------------------
|
/* ------------------------------------------------------------
|
||||||
* The Ruby global rename rules
|
* The Ruby global rename rules
|
||||||
* ------------------------------------------------------------ */
|
* ------------------------------------------------------------ */
|
||||||
|
/* Class names are CamelCase */
|
||||||
|
%rename("%(ctitle)s", %isclass) "";
|
||||||
|
|
||||||
|
/* Constants are UPPER_CASE */
|
||||||
|
%rename("%(upper)s", %isconstant) "";
|
||||||
|
|
||||||
/* Method names should be changed so that they are
|
/* Method names should be changed so that they are
|
||||||
lower_case_with_underscores */
|
lower_case_with_underscores */
|
||||||
|
|
|
||||||
|
|
@ -1521,16 +1521,12 @@ public:
|
||||||
if (!name || name[0] == '\0')
|
if (!name || name[0] == '\0')
|
||||||
return name;
|
return name;
|
||||||
|
|
||||||
|
/* Check to see that constants start with an upper case
|
||||||
|
letter and if they don't raise a warning. Note that
|
||||||
|
renames are specified via %renames in ruby.swg. */
|
||||||
if (isupper(name[0]))
|
if (isupper(name[0]))
|
||||||
return name;
|
return name;
|
||||||
|
|
||||||
if (islower(name[0])) {
|
|
||||||
name[0] = toupper(name[0]);
|
|
||||||
Swig_warning(WARN_RUBY_WRONG_NAME, input_file, line_number,
|
|
||||||
"Wrong %s name (corrected to `%s')\n", reason, name);
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
Swig_warning(WARN_RUBY_WRONG_NAME, input_file, line_number,
|
Swig_warning(WARN_RUBY_WRONG_NAME, input_file, line_number,
|
||||||
"Wrong %s name %s\n", reason, name);
|
"Wrong %s name %s\n", reason, name);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue