better kw from Olly's comments

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8151 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-12-31 10:43:06 +00:00
commit f3262ed3d9
3 changed files with 49 additions and 49 deletions

View file

@ -1,20 +1,22 @@
#ifndef __php_phpkw_swg__ //
#define __php_phpkw_swg__ // The 'keywords' in PHP are global, ie, the following names are fine
// when used as class methods.
//
/* Warnings for Php keywords */ #define PHPKW(x) %namewarn("314:" `x` " is a php keyword",rename="_%s") "::" `x`
#define PHPKW(x) %namewarn("314:" `x` " is a php keyword") `x`
#define PHPBN(x) %namewarn("321:" `x` " conflicts with a built-in name in php") "::" `x` #define PHPBN(x) %namewarn("321:" `x` " conflicts with a built-in name in php") "::" `x`
/* /*
from From
http://aspn.activestate.com/ASPN/docs/PHP/reserved.html http://aspn.activestate.com/ASPN/docs/PHP/reserved.html
and reviewed by Olly Betts.
*/ */
/* we catalog these as kw since PHP will not run if used globally */
PHPKW(and); PHPKW(and);
PHPKW($argc);
PHPKW($argv);
PHPKW(as); PHPKW(as);
PHPKW(break); PHPKW(break);
PHPKW(case); PHPKW(case);
@ -25,69 +27,53 @@ PHPKW(declare);
PHPKW(default); PHPKW(default);
PHPKW(die); PHPKW(die);
PHPKW(do); PHPKW(do);
PHPKW(E_ALL);
PHPKW(echo); PHPKW(echo);
PHPKW(E_ERROR);
PHPKW(else); PHPKW(else);
PHPKW(elseif); PHPKW(elseif);
PHPKW(empty);
PHPKW(enddeclare); PHPKW(enddeclare);
PHPKW(endfor); PHPKW(endfor);
PHPKW(endforeach); PHPKW(endforeach);
PHPKW(endif); PHPKW(endif);
PHPKW(endswitch); PHPKW(endswitch);
PHPKW(endwhile); PHPKW(endwhile);
PHPKW(E_PARSE);
PHPKW(eval); PHPKW(eval);
PHPKW(E_WARNING);
PHPKW(exit); PHPKW(exit);
PHPKW(extends); PHPKW(extends);
PHPKW(FALSE);
PHPKW(__FILE__);
PHPKW(for); PHPKW(for);
PHPKW(foreach); PHPKW(foreach);
PHPKW(function); PHPKW(function);
PHPKW(global); PHPKW(global);
PHPKW($HTTP_COOKIE_VARS);
PHPKW($HTTP_ENV_VARS);
PHPKW($HTTP_GET_VARS);
PHPKW($HTTP_POST_FILES);
PHPKW($HTTP_POST_VARS);
PHPKW($HTTP_SERVER_VARS);
PHPKW(if); PHPKW(if);
PHPKW(include); PHPKW(include);
PHPKW(include_once); PHPKW(include_once);
PHPKW(__LINE__);
PHPKW(list); PHPKW(list);
PHPKW(new); PHPKW(new);
PHPKW(not);
PHPKW(NULL);
PHPKW(old_function); PHPKW(old_function);
PHPKW(or); PHPKW(or);
PHPKW(parent); PHPKW(print);
PHPKW(PHP_OS);
PHPKW($PHP_SELF);
PHPKW(PHP_VERSION);
PHPKW(require); PHPKW(require);
PHPKW(require_once); PHPKW(require_once);
PHPKW(return); PHPKW(return);
PHPKW(__sleep);
PHPKW(static); PHPKW(static);
PHPKW(stdClass);
PHPKW(switch); PHPKW(switch);
PHPKW($this);
PHPKW(TRUE);
PHPKW(var); PHPKW(var);
PHPKW(virtual);
PHPKW(__wakeup);
PHPKW(while); PHPKW(while);
PHPKW(xor); PHPKW(xor);
/* we catalog these as built-in names since they conflicts, but PHP still runs */
// These are bad names only if global. PHPBN(E_ALL);
PHPBN(empty); PHPBN(E_ERROR);
PHPBN(print); PHPBN(E_PARSE);
PHPBN(E_WARNING);
PHPBN(FALSE);
PHPBN(PHP_OS);
PHPBN(PHP_VERSION);
PHPBN(TRUE);
PHPBN(__sleep);
PHPBN(__wakeup);
#undef PHPKW #undef PHPKW
#undef PHPBN
#endif //__php_phpkw_swg__

View file

@ -2,8 +2,8 @@
Warnings for Python keywords, built-in names and bad names. Warnings for Python keywords, built-in names and bad names.
*/ */
#define PYTHONKW(x) %namewarn("314:" #x " is a python keyword") #x #define PYTHONKW(x) %namewarn("314:" `x` " is a python keyword, symbol will be renamed as '_" `x`"'", rename="_%s") `x`
#define PYTHONBN(x) %namewarn("321:" #x " conflicts with a built-in name in python") "::"#x #define PYTHONBN(x) %namewarn("321:" `x` " conflicts with a built-in name in python") "::"`x`
/* /*
@ -40,7 +40,6 @@ PYTHONKW(return);
PYTHONKW(try); PYTHONKW(try);
PYTHONKW(while); PYTHONKW(while);
PYTHONKW(yield); PYTHONKW(yield);
PYTHONKW(staticmethod);
/* /*
built-in functions built-in functions
@ -49,20 +48,26 @@ PYTHONKW(staticmethod);
PYTHONBN(abs); PYTHONBN(abs);
PYTHONBN(apply); PYTHONBN(apply);
PYTHONBN(bool);
PYTHONBN(buffer); PYTHONBN(buffer);
PYTHONBN(callable); PYTHONBN(callable);
PYTHONBN(chr); PYTHONBN(chr);
PYTHONBN(classmethod);
PYTHONBN(cmp); PYTHONBN(cmp);
PYTHONBN(coerce); PYTHONBN(coerce);
PYTHONBN(compile); PYTHONBN(compile);
PYTHONBN(complex); PYTHONBN(complex);
PYTHONBN(delattr); PYTHONBN(delattr);
PYTHONBN(dict);
PYTHONBN(dir); PYTHONBN(dir);
PYTHONBN(divmod); PYTHONBN(divmod);
PYTHONBN(enumerate);
PYTHONBN(eval); PYTHONBN(eval);
PYTHONBN(execfile); PYTHONBN(execfile);
PYTHONBN(file);
PYTHONBN(filter); PYTHONBN(filter);
PYTHONBN(float); PYTHONBN(float);
PYTHONBN(frozenset);
PYTHONBN(getattr); PYTHONBN(getattr);
PYTHONBN(globals); PYTHONBN(globals);
PYTHONBN(hasattr); PYTHONBN(hasattr);
@ -74,6 +79,7 @@ PYTHONBN(int);
PYTHONBN(intern); PYTHONBN(intern);
PYTHONBN(isinstance); PYTHONBN(isinstance);
PYTHONBN(issubclass); PYTHONBN(issubclass);
PYTHONBN(iter);
PYTHONBN(len); PYTHONBN(len);
PYTHONBN(list); PYTHONBN(list);
PYTHONBN(locals); PYTHONBN(locals);
@ -81,21 +87,32 @@ PYTHONBN(long);
PYTHONBN(map); PYTHONBN(map);
PYTHONBN(max); PYTHONBN(max);
PYTHONBN(min); PYTHONBN(min);
PYTHONBN(object);
PYTHONBN(oct); PYTHONBN(oct);
PYTHONBN(open); PYTHONBN(open);
PYTHONBN(ord); PYTHONBN(ord);
PYTHONBN(pow); PYTHONBN(pow);
PYTHONBN(property);
PYTHONBN(range); PYTHONBN(range);
PYTHONBN(raw_input); PYTHONBN(raw_input);
PYTHONBN(reduce); PYTHONBN(reduce);
PYTHONBN(reload); PYTHONBN(reload);
PYTHONBN(repr); PYTHONBN(repr);
PYTHONBN(reversed);
PYTHONBN(round); PYTHONBN(round);
PYTHONBN(set);
PYTHONBN(setattr); PYTHONBN(setattr);
PYTHONBN(slice); PYTHONBN(slice);
PYTHONBN(sorted);
PYTHONBN(staticmethod);
PYTHONBN(staticmethod);
PYTHONBN(str); PYTHONBN(str);
PYTHONBN(sum);
PYTHONBN(super);
PYTHONBN(tuple); PYTHONBN(tuple);
PYTHONBN(type); PYTHONBN(type);
PYTHONBN(unichr);
PYTHONBN(unicode);
PYTHONBN(vars); PYTHONBN(vars);
PYTHONBN(xrange); PYTHONBN(xrange);
PYTHONBN(zip); PYTHONBN(zip);
@ -109,6 +126,7 @@ PYTHONBN(True);
PYTHONBN(False); PYTHONBN(False);
PYTHONBN(None); PYTHONBN(None);
/* /*
'self' is also a bad Name 'self' is also a bad Name
*/ */

View file

@ -2,7 +2,7 @@
#define __ruby_rubykw_swg__ #define __ruby_rubykw_swg__
/* Warnings for Ruby keywords */ /* Warnings for Ruby keywords */
#define RUBYKW(x) %namewarn("314:" #x " is a ruby keyword") #x #define RUBYKW(x) %namewarn("314:'" `x` "' is a ruby keyword, and it will renamed as 'C_"`x`"'",rename="C_%s") `x`
/* /*
@ -49,11 +49,7 @@ RUBYKW(end);
RUBYKW(next); RUBYKW(next);
RUBYKW(return); RUBYKW(return);
RUBYKW(until); RUBYKW(until);
RUBYKW("defined");
/* swig doesn't like this one in a macro, adding it by hand */
//RUBYKW(defined);
%namewarn("314: defined is a ruby keyword") "defined";
#undef RUBYKW #undef RUBYKW