summaryrefslogtreecommitdiff
path: root/plugins/Variables/src/parse_logic.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2013-02-14 09:54:52 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2013-02-14 09:54:52 +0000
commitc202861e939e64336fd2eb2efc614cbbeeb8bf8e (patch)
tree134ad4a5c3fccc714dfc30ae8e090abba329f00e /plugins/Variables/src/parse_logic.cpp
parent262a20f04f06f4e51eca2afeff172b1f75138d88 (diff)
correct fix for [3590]
git-svn-id: http://svn.miranda-ng.org/main/trunk@3595 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables/src/parse_logic.cpp')
-rw-r--r--plugins/Variables/src/parse_logic.cpp91
1 files changed, 39 insertions, 52 deletions
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp
index 03fd0b0e5f..6a22c5c736 100644
--- a/plugins/Variables/src/parse_logic.cpp
+++ b/plugins/Variables/src/parse_logic.cpp
@@ -55,18 +55,15 @@ static TCHAR *parseFalse(ARGUMENTSINFO *ai) {
}
static TCHAR *parseIf(ARGUMENTSINFO *ai) {
-
- FORMATINFO fi;
- TCHAR *szCondition;
-
if (ai->argc != 4) {
return NULL;
}
+ FORMATINFO fi;
ZeroMemory(&fi, sizeof(fi));
memcpy(&fi, ai->fi, sizeof(fi));
fi.eCount = fi.pCount = 0;
fi.tszFormat = ai->targv[1];
- szCondition = formatString(&fi);
+ TCHAR *szCondition = formatString(&fi);
mir_free(szCondition);
//if (fi.pCount > 0) {
if (fi.eCount == 0) {
@@ -78,18 +75,16 @@ static TCHAR *parseIf(ARGUMENTSINFO *ai) {
}
static TCHAR *parseIf2(ARGUMENTSINFO *ai) {
-
- FORMATINFO fi;
- TCHAR *szCondition;
-
if (ai->argc != 3) {
return NULL;
}
+
+ FORMATINFO fi;
ZeroMemory(&fi, sizeof(fi));
memcpy(&fi, ai->fi, sizeof(fi));
fi.eCount = fi.pCount = 0;
fi.tszFormat = ai->targv[1];
- szCondition = formatString(&fi);
+ TCHAR *szCondition = formatString(&fi);
//if (fi.pCount > 0) {
if (fi.eCount == 0) {
return szCondition;
@@ -130,17 +125,15 @@ static TCHAR *parseIf3(ARGUMENTSINFO *ai) {
static TCHAR *parseIfequal(ARGUMENTSINFO *ai)
{
- TCHAR *tszFirst, *tszSecond;
-
if (ai->argc != 5)
return NULL;
FORMATINFO fi = { 0 };
memcpy(&fi, ai->fi, sizeof(fi));
fi.szFormat = ai->argv[1];
- tszFirst = formatString(&fi);
+ TCHAR *tszFirst = formatString(&fi);
fi.szFormat = ai->argv[2];
- tszSecond = formatString(&fi);
+ TCHAR *tszSecond = formatString(&fi);
if ((tszFirst == NULL) || (tszSecond == NULL)) {
if (tszFirst != NULL)
mir_free(tszFirst);
@@ -162,20 +155,18 @@ static TCHAR *parseIfequal(ARGUMENTSINFO *ai)
}
static TCHAR *parseIfgreater(ARGUMENTSINFO *ai) {
-
- FORMATINFO fi;
- TCHAR *tszFirst, *tszSecond;
-
if (ai->argc != 5) {
return NULL;
}
+
+ FORMATINFO fi;
//ai->flags |= AIF_DONTPARSE;
ZeroMemory(&fi, sizeof(fi));
memcpy(&fi, ai->fi, sizeof(fi));
fi.szFormat = ai->argv[1];
- tszFirst = formatString(&fi);
+ TCHAR *tszFirst = formatString(&fi);
fi.szFormat = ai->argv[2];
- tszSecond = formatString(&fi);
+ TCHAR *tszSecond = formatString(&fi);
if ((tszFirst == NULL) || (tszSecond == NULL)) {
if (tszFirst != NULL) {
mir_free(tszFirst);
@@ -197,19 +188,17 @@ static TCHAR *parseIfgreater(ARGUMENTSINFO *ai) {
}
static TCHAR *parseIflonger(ARGUMENTSINFO *ai) {
-
- FORMATINFO fi;
- TCHAR *tszFirst, *tszSecond;
-
if (ai->argc != 5) {
return NULL;
}
+
+ FORMATINFO fi;
ZeroMemory(&fi, sizeof(fi));
memcpy(&fi, ai->fi, sizeof(fi));
fi.szFormat = ai->argv[1];
- tszFirst = formatString(&fi);
+ TCHAR *tszFirst = formatString(&fi);
fi.szFormat = ai->argv[2];
- tszSecond = formatString(&fi);
+ TCHAR *tszSecond = formatString(&fi);
if ((tszFirst == NULL) || (tszSecond == NULL)) {
if (tszFirst != NULL) {
mir_free(tszFirst);
@@ -236,14 +225,14 @@ static TCHAR *parseIflonger(ARGUMENTSINFO *ai) {
*/
static TCHAR *parseFor(ARGUMENTSINFO *ai) {
-
- TCHAR *parsed, *res;
- FORMATINFO fi;
-
if (ai->argc != 5) {
return NULL;
}
- res = mir_tstrdup(_T(""));
+
+ TCHAR *parsed;
+ FORMATINFO fi;
+
+ TCHAR *res = mir_tstrdup(_T(""));
// ai->flags |= AIF_DONTPARSE;
ZeroMemory(&fi, sizeof(fi));
CopyMemory(&fi, ai->fi, sizeof(fi));
@@ -309,17 +298,15 @@ static TCHAR *parseLonger(ARGUMENTSINFO *ai)
}
static TCHAR *parseNot(ARGUMENTSINFO *ai) {
-
- FORMATINFO fi;
- TCHAR *szCondition;
-
if (ai->argc != 2) {
return NULL;
}
+
+ FORMATINFO fi;
ZeroMemory(&fi, sizeof(fi));
memcpy(&fi, ai->fi, sizeof(fi));
fi.tszFormat = ai->targv[1];
- szCondition = formatString(&fi);
+ TCHAR *szCondition = formatString(&fi);
mir_free(szCondition);
//if (fi.pCount > 0) {
if (fi.eCount == 0) {
@@ -393,22 +380,22 @@ static TCHAR *parseXor(ARGUMENTSINFO *ai) {
int registerLogicTokens() {
- registerIntToken(_T(AND), parseAnd, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(x,y, ...)\tperforms logical AND (x && y && ...)"));
- registerIntToken(_T(STR_FALSE), parseFalse, TRF_FIELD, Translate("Logical Expressions\tBoolean FALSE"));
- registerIntToken(_T(FOR), parseFor, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(w,x,y,z)\tperforms w, then shows z and performs y while x is TRUE"));
- registerIntToken(_T(IF), parseIf, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(x,y,z)\tshows y if x is TRUE, otherwise it shows z"));
- registerIntToken(_T(IF2), parseIf2, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(x,y)\tshows x if x is TRUE, otherwise it shows y (if(x,x,y))"));
- registerIntToken(_T(IF3), parseIf3, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(x,y, ...)\tthe first argument parsed successfully"));
- registerIntToken(_T(IFEQUAL), parseIfequal, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(w,x,y,z)\ty if w = x, else z"));
- registerIntToken(_T(IFGREATER), parseIfgreater, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(w,x,y,z)\ty if w > x, else z"));
- registerIntToken(_T(IFLONGER), parseIflonger, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(w,x,y,z)\ty if string length of w > x, else z"));
- registerIntToken(_T(EQUAL), parseEqual, TRF_FUNCTION, Translate("Logical Expressions\t(x,y)\tTRUE if x = y"));
- registerIntToken(_T(GREATER), parseGreater, TRF_FUNCTION, Translate("Logical Expressions\t(x,y)\tTRUE if x > y"));
- registerIntToken(_T(LONGER), parseLonger, TRF_FUNCTION, Translate("Logical Expressions\t(x,y)\tTRUE if x is longer than y"));
- registerIntToken(_T(NOT), parseNot, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(x)\tperforms logical NOT (!x)"));
- registerIntToken(_T(OR), parseOr, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(x,y,...)\tperforms logical OR (x || y || ...)"));
- registerIntToken(_T(STR_TRUE), parseTrue, TRF_FIELD, Translate("Logical Expressions\tBoolean TRUE"));
- registerIntToken(_T(XOR), parseXor, TRF_UNPARSEDARGS|TRF_FUNCTION, Translate("Logical Expressions\t(x,y)\tperforms logical XOR (x ^ y)"));
+ registerIntToken(_T(AND), parseAnd, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y, ...)\t"LPGEN("performs logical AND (x && y && ...)"));
+ registerIntToken(_T(STR_FALSE), parseFalse, TRF_FIELD, LPGEN("Logical Expressions")"\t"LPGEN("Boolean FALSE"));
+ registerIntToken(_T(FOR), parseFor, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("performs w, then shows z and performs y while x is TRUE"));
+ registerIntToken(_T(IF), parseIf, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y,z)\t"LPGEN("shows y if x is TRUE, otherwise it shows z"));
+ registerIntToken(_T(IF2), parseIf2, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("shows x if x is TRUE, otherwise it shows y (if(x,x,y))"));
+ registerIntToken(_T(IF3), parseIf3, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y, ...)\t"LPGEN("the first argument parsed successfully"));
+ registerIntToken(_T(IFEQUAL), parseIfequal, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("y if w = x, else z"));
+ registerIntToken(_T(IFGREATER), parseIfgreater, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("y if w > x, else z"));
+ registerIntToken(_T(IFLONGER), parseIflonger, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("y if string length of w > x, else z"));
+ registerIntToken(_T(EQUAL), parseEqual, TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("TRUE if x = y"));
+ registerIntToken(_T(GREATER), parseGreater, TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("TRUE if x > y"));
+ registerIntToken(_T(LONGER), parseLonger, TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("TRUE if x is longer than y"));
+ registerIntToken(_T(NOT), parseNot, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x)\t"LPGEN("performs logical NOT (!x)"));
+ registerIntToken(_T(OR), parseOr, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y,...)\t"LPGEN("performs logical OR (x || y || ...)"));
+ registerIntToken(_T(STR_TRUE), parseTrue, TRF_FIELD, LPGEN("Logical Expressions")"\t"LPGEN("Boolean TRUE"));
+ registerIntToken(_T(XOR), parseXor, TRF_UNPARSEDARGS|TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("performs logical XOR (x ^ y)"));
return 0;
}