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@8404 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Charlie Savage 2006-01-13 00:51:49 +00:00
commit 62cb2b8e90
2 changed files with 8 additions and 7 deletions

View file

@ -7,6 +7,11 @@
/* ------------------------------------------------------------
* 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
lower_case_with_underscores */

View file

@ -1521,16 +1521,12 @@ public:
if (!name || name[0] == '\0')
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]))
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,
"Wrong %s name %s\n", reason, name);