Merged
https://svn.blender.org/svnroot/bf-blender/branches/soc-2008-mxcurioni (r22789) and https://svn.blender.org/svnroot/bf-blender/trunk/blender (r23338) with the "Ignore ancestry" and "Ignore line endings" options enabled (using TortoiseSVN on Windows). After the merge operation, all changes (i.e., deletion) in source/blender/freestyle/ were reverted in order to keep the primary source tree of the Freestyle renderer.
This commit is contained in:
@@ -38,6 +38,14 @@
|
||||
// cool things like (IF(LOD==1,CCurvedValue,IF(LOD==2,CCurvedValue2)) etc...
|
||||
#include "IfExpr.h"
|
||||
|
||||
#if (defined(WIN32) || defined(WIN64)) && !defined(FREE_WINDOWS)
|
||||
#define strcasecmp _stricmp
|
||||
|
||||
#ifndef strtoll
|
||||
#define strtoll _strtoi64
|
||||
#endif
|
||||
|
||||
#endif /* Def WIN32 or Def WIN64 */
|
||||
|
||||
#define NUM_PRIORITY 6
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -58,7 +66,7 @@ CParser::~CParser()
|
||||
|
||||
|
||||
|
||||
void CParser::ScanError(STR_String str)
|
||||
void CParser::ScanError(const char *str)
|
||||
{
|
||||
// sets the global variable errmsg to an errormessage with
|
||||
// contents str, appending if it already exists
|
||||
@@ -73,7 +81,7 @@ void CParser::ScanError(STR_String str)
|
||||
|
||||
|
||||
|
||||
CExpression* CParser::Error(STR_String str)
|
||||
CExpression* CParser::Error(const char *str)
|
||||
{
|
||||
// makes and returns a new CConstExpr filled with an CErrorValue
|
||||
// with string str
|
||||
@@ -172,6 +180,9 @@ void CParser::NextSym()
|
||||
case ',':
|
||||
sym = commasym; NextCh();
|
||||
break;
|
||||
case '%' :
|
||||
sym = opsym; opkind = OPmodulus; NextCh();
|
||||
break;
|
||||
case '+' :
|
||||
sym = opsym; opkind = OPplus; NextCh();
|
||||
break;
|
||||
@@ -271,33 +282,30 @@ void CParser::NextSym()
|
||||
} else if (((ch >= 'a') && (ch <= 'z'))
|
||||
|| ((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;
|
||||
@@ -316,12 +324,14 @@ void CParser::NextSym()
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
int CParser::MakeInt() {
|
||||
// returns the integer representation of the value in the global
|
||||
// variable const_as_string
|
||||
// pre: const_as_string contains only numercal chars
|
||||
return atoi(const_as_string);
|
||||
}
|
||||
#endif
|
||||
|
||||
STR_String CParser::Symbol2Str(int s) {
|
||||
// returns a string representation of of symbol s,
|
||||
@@ -370,6 +380,7 @@ int CParser::Priority(int optorkind) {
|
||||
case OPunequal: return 3;
|
||||
case OPplus:
|
||||
case OPminus: return 4;
|
||||
case OPmodulus:
|
||||
case OPtimes:
|
||||
case OPdivide: return 5;
|
||||
}
|
||||
@@ -390,6 +401,7 @@ CExpression *CParser::Ex(int i) {
|
||||
NextSym();
|
||||
e2 = Ex(i + 1);
|
||||
switch(opkind2) {
|
||||
case OPmodulus: e1 = new COperator2Expr(VALUE_MOD_OPERATOR,e1, e2); break;
|
||||
case OPplus: e1 = new COperator2Expr(VALUE_ADD_OPERATOR,e1, e2); break;
|
||||
case OPminus: e1 = new COperator2Expr(VALUE_SUB_OPERATOR,e1, e2); break;
|
||||
case OPtimes: e1 = new COperator2Expr(VALUE_MUL_OPERATOR,e1, e2); break;
|
||||
@@ -431,8 +443,8 @@ CExpression *CParser::Ex(int i) {
|
||||
break;
|
||||
case inttype:
|
||||
{
|
||||
int temp;
|
||||
temp = atoi(const_as_string);
|
||||
cInt temp;
|
||||
temp = strtoll(const_as_string, NULL, 10); /* atoi is for int only */
|
||||
e1 = new CConstExpr(new CIntValue(temp));
|
||||
break;
|
||||
}
|
||||
@@ -525,7 +537,7 @@ CExpression *CParser::Expr() {
|
||||
}
|
||||
|
||||
CExpression* CParser::ProcessText
|
||||
(STR_String intext) {
|
||||
(const char *intext) {
|
||||
|
||||
// and parses the string in intext and returns it.
|
||||
|
||||
@@ -562,7 +574,7 @@ CExpression* CParser::ProcessText
|
||||
|
||||
|
||||
|
||||
float CParser::GetFloat(STR_String txt)
|
||||
float CParser::GetFloat(STR_String& txt)
|
||||
{
|
||||
// returns parsed text into a float
|
||||
// empty string returns -1
|
||||
@@ -575,7 +587,7 @@ float CParser::GetFloat(STR_String txt)
|
||||
CExpression* expr = ProcessText(txt);
|
||||
if (expr) {
|
||||
val = expr->Calculate();
|
||||
result=val->GetNumber();
|
||||
result=(float)val->GetNumber();
|
||||
|
||||
|
||||
|
||||
@@ -587,7 +599,7 @@ float CParser::GetFloat(STR_String txt)
|
||||
return result;
|
||||
}
|
||||
|
||||
CValue* CParser::GetValue(STR_String txt, bool bFallbackToText)
|
||||
CValue* CParser::GetValue(STR_String& txt, bool bFallbackToText)
|
||||
{
|
||||
// returns parsed text into a value,
|
||||
// empty string returns NULL value !
|
||||
@@ -624,32 +636,3 @@ void CParser::SetContext(CValue* context)
|
||||
}
|
||||
m_identifierContext = context;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
PyObject* CParserPyMake(PyObject* ignored,PyObject* args)
|
||||
{
|
||||
char* txt;
|
||||
if (!PyArg_ParseTuple(args,"s",&txt))
|
||||
return NULL;
|
||||
CParser parser;
|
||||
CExpression* expr = parser.ProcessText(txt);
|
||||
CValue* val = expr->Calculate();
|
||||
expr->Release();
|
||||
return val;
|
||||
}
|
||||
|
||||
static PyMethodDef CParserMethods[] =
|
||||
{
|
||||
{ "calc", CParserPyMake , METH_VARARGS},
|
||||
{ NULL,NULL} // Sentinel
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
void initExpressionModule(void)
|
||||
{
|
||||
Py_InitModule("Expression",CParserMethods);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user