Accept negative indices's for ListValues

scene.getObjectList()[-1] works like a python sequence.

removed some STR_String creation that was only used to do comparisons, in a simple expressions benchmark this made logic use 4% less overall.
This commit is contained in:
Campbell Barton
2009-02-19 07:01:49 +00:00
parent 7d2582de09
commit 92d4ef0939
4 changed files with 23 additions and 20 deletions

View File

@@ -272,32 +272,29 @@ void CParser::NextSym()
|| ((ch >= 'A') && (ch <= 'Z')))
{ // reserved word?
int start;
STR_String funstr;
start = chcount;
CharRep();
GrabString(start);
funstr = const_as_string;
funstr.Upper();
if (funstr == STR_String("SUM")) {
if (!strcasecmp(const_as_string, "SUM")) {
sym = sumsym;
}
else if (funstr == STR_String("NOT")) {
else if (!strcasecmp(const_as_string, "NOT")) {
sym = opsym;
opkind = OPnot;
}
else if (funstr == STR_String("AND")) {
else if (!strcasecmp(const_as_string, "AND")) {
sym = opsym; opkind = OPand;
}
else if (funstr == STR_String("OR")) {
else if (!strcasecmp(const_as_string, "OR")) {
sym = opsym; opkind = OPor;
}
else if (funstr == STR_String("IF")) {
else if (!strcasecmp(const_as_string, "IF"))
sym = ifsym;
} else if (funstr == STR_String("WHOMADE")) {
else if (!strcasecmp(const_as_string, "WHOMADE"))
sym = whocodedsym;
} else if (funstr == STR_String("FALSE")) {
else if (!strcasecmp(const_as_string, "FALSE")) {
sym = constsym; constkind = booltype; boolvalue = false;
} else if (funstr == STR_String("TRUE")) {
} else if (!strcasecmp(const_as_string, "TRUE")) {
sym = constsym; constkind = booltype; boolvalue = true;
} else {
sym = idsym;