From c202861e939e64336fd2eb2efc614cbbeeb8bf8e Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Thu, 14 Feb 2013 09:54:52 +0000 Subject: correct fix for [3590] git-svn-id: http://svn.miranda-ng.org/main/trunk@3595 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/src/parse_alias.cpp | 6 +- plugins/Variables/src/parse_external.cpp | 73 ++++++++-------------- plugins/Variables/src/parse_inet.cpp | 38 +++++------- plugins/Variables/src/parse_logic.cpp | 91 ++++++++++++---------------- plugins/Variables/src/parse_math.cpp | 89 ++++++++++----------------- plugins/Variables/src/parse_metacontacts.cpp | 33 +++------- plugins/Variables/src/parse_miranda.cpp | 60 +++++++++--------- plugins/Variables/src/parse_regexp.cpp | 27 ++++----- plugins/Variables/src/parse_str.cpp | 76 +++++++++++------------ plugins/Variables/src/parse_system.cpp | 42 ++++++------- plugins/Variables/src/parse_variables.cpp | 6 +- plugins/Variables/src/parse_xml.cpp | 41 +++++-------- 12 files changed, 241 insertions(+), 341 deletions(-) diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index 2dfa89490c..e5f033cc38 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -194,14 +194,14 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) { szHelp = ( char* )mir_alloc(32 + strlen(szArgsA)); memset(szHelp, '\0', 32 + strlen(szArgsA)); - sprintf(szHelp, Translate("Alias\t(%s)\tuser defined"), szArgsA); + sprintf(szHelp, LPGEN("Alias\t(%s)\tuser defined"), szArgsA); res = registerIntToken(alias, parseTranslateAlias, TRF_FUNCTION|TRF_UNPARSEDARGS, szHelp); mir_free(szArgsA); } else { szHelp = ( char* )mir_alloc(32); memset(szHelp, '\0', 32); - sprintf(szHelp, Translate("Alias\t\tuser defined")); + sprintf(szHelp, LPGEN("Alias")"\t\t"LPGEN("user defined")); res = registerIntToken(alias, parseTranslateAlias, TRF_FIELD|TRF_UNPARSEDARGS, szHelp); } mir_free(szArgs); @@ -212,7 +212,7 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) { int registerAliasTokens() { - registerIntToken(_T(ADDALIAS), parseAddAlias, TRF_FUNCTION|TRF_UNPARSEDARGS, Translate("Variables\t(x,y)\tstores y as alias named x"));//TRF_UNPARSEDARGS); + registerIntToken(_T(ADDALIAS), parseAddAlias, TRF_FUNCTION|TRF_UNPARSEDARGS, LPGEN("Variables")"\t(x,y)\t"LPGEN("stores y as alias named x"));//TRF_UNPARSEDARGS); InitializeCriticalSection(&csAliasRegister); return 0; } diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 418eb0f3a9..b8b0b5f942 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -28,18 +28,14 @@ static void (WINAPI *acUninit)() = NULL; static unsigned int lastAMIPFailure = -1; static TCHAR *getFullWinampTitleText() { - - TCHAR *szTitle, *szWinText; - HWND hwndWinamp; - - hwndWinamp = FindWindow(_T("STUDIO"), NULL); + HWND hwndWinamp = FindWindow(_T("STUDIO"), NULL); if (hwndWinamp == NULL) hwndWinamp = FindWindow(_T("Winamp v1.x"),NULL); if (hwndWinamp == NULL) return NULL; - szWinText = (TCHAR*)mir_alloc((GetWindowTextLength(hwndWinamp) + 1)*sizeof(TCHAR)); + TCHAR *szWinText = (TCHAR*)mir_alloc((GetWindowTextLength(hwndWinamp) + 1)*sizeof(TCHAR)); if (szWinText == NULL) return NULL; @@ -47,7 +43,7 @@ static TCHAR *getFullWinampTitleText() { mir_free(szWinText); return NULL; } - szTitle = (TCHAR*)mir_alloc((2*_tcslen(szWinText)+1)*sizeof(TCHAR)); + TCHAR *szTitle = (TCHAR*)mir_alloc((2*_tcslen(szWinText)+1)*sizeof(TCHAR)); if (szTitle == NULL) { mir_free(szWinText); return NULL; @@ -60,19 +56,16 @@ static TCHAR *getFullWinampTitleText() { } static TCHAR *parseWinampSong(ARGUMENTSINFO *ai) { - - TCHAR *szTitle, *scur, *cur, *res; - if (ai->argc != 1) { return NULL; } - res = NULL; - szTitle = getFullWinampTitleText(); + TCHAR *res = NULL; + TCHAR *szTitle = getFullWinampTitleText(); if (szTitle == NULL) { return NULL; } - scur = _tcschr(szTitle, _T('.')); - cur = _tcsstr(scur, _T(" - Winamp")); + TCHAR *scur = _tcschr(szTitle, _T('.')); + TCHAR *cur = _tcsstr(scur, _T(" - Winamp")); if ((scur == NULL) || (cur == NULL) || (scur >= cur) || (scur > (szTitle + _tcslen(szTitle) - 2)) || (cur > (szTitle + _tcslen(szTitle)))) { mir_free(szTitle); return NULL; @@ -88,19 +81,16 @@ static TCHAR *parseWinampSong(ARGUMENTSINFO *ai) { } static TCHAR *parseWinampState(ARGUMENTSINFO *ai) { - - TCHAR *szTitle, *scur, *cur, *res; - if (ai->argc != 1) { return NULL; } - res = NULL; - szTitle = getFullWinampTitleText(); + TCHAR *res = NULL; + TCHAR *szTitle = getFullWinampTitleText(); if (szTitle == NULL) { return NULL; } - scur = _tcschr(szTitle, _T('.')); - cur = _tcsstr(scur, _T(" - Winamp")); + TCHAR *scur = _tcschr(szTitle, _T('.')); + TCHAR *cur = _tcsstr(scur, _T(" - Winamp")); if ((scur == NULL) || (cur == NULL)) { mir_free(szTitle); return mir_tstrdup(TranslateT("Stopped")); @@ -144,17 +134,14 @@ static unsigned int checkAMIP() { } static TCHAR *parseAMIPEval(ARGUMENTSINFO *ai) { - - TCHAR *tszRes; - char *cmd; char szRes[AC_BUFFER_SIZE]; - tszRes = NULL; + TCHAR *tszRes = NULL; if (ai->argc != 2) { return NULL; } - cmd = mir_t2a(ai->targv[1]); + char *cmd = mir_t2a(ai->targv[1]); if (checkAMIP() != 0) { log_debugA("checkAMIP failed"); @@ -176,17 +163,14 @@ static TCHAR *parseAMIPEval(ARGUMENTSINFO *ai) { } static TCHAR *parseAMIPFormat(ARGUMENTSINFO *ai) { - - TCHAR *tszRes; - char *cmd; char szRes[AC_BUFFER_SIZE]; - tszRes = NULL; + TCHAR *tszRes = NULL; if (ai->argc != 2) { return NULL; } - cmd = mir_t2a(ai->targv[1]); + char *cmd = mir_t2a(ai->targv[1]); if (checkAMIP() != 0) { @@ -206,21 +190,16 @@ static TCHAR *parseAMIPFormat(ARGUMENTSINFO *ai) { } static int initAMIP() { - - HMODULE hModule; - - hModule = LoadLibraryA("ac.dll"); + HMODULE hModule = LoadLibrary(_T("ac.dll")); if (hModule == NULL) { - char path[MAX_PATH]; - char *cur; - - GetModuleFileNameA(NULL, path, sizeof(path)); - cur = strrchr(path, '\\'); + TCHAR path[MAX_PATH]; + GetModuleFileName(NULL, path, MAX_PATH); + TCHAR *cur = _tcsrchr(path, '\\'); if (cur != NULL) - strcpy(cur+1, "ac.dll"); + _tcscpy(cur+1, _T("ac.dll")); else - strcpy(cur, "ac.dll"); - hModule = LoadLibraryA(path); + _tcscpy(cur, _T("ac.dll")); + hModule = LoadLibrary(path); } if (hModule == NULL) { return -1; @@ -235,11 +214,11 @@ static int initAMIP() { int registerExternalTokens() { - registerIntToken(_T(WINAMPSONG), parseWinampSong, TRF_FIELD, Translate("External Applications\tretrieves song name of the song currently playing in Winamp")); - registerIntToken(_T(WINAMPSTATE), parseWinampState, TRF_FIELD, Translate("External Applications\tretrieves current Winamp state (Playing/Paused/Stopped)")); + registerIntToken(_T(WINAMPSONG), parseWinampSong, TRF_FIELD, LPGEN("External Applications")"\t"LPGEN("retrieves song name of the song currently playing in Winamp")); + registerIntToken(_T(WINAMPSTATE), parseWinampState, TRF_FIELD, LPGEN("External Applications")"\t"LPGEN("retrieves current Winamp state (Playing/Paused/Stopped)")); if (!initAMIP()) { - registerIntToken(_T(AMIPEVAL), parseAMIPEval, TRF_FUNCTION, Translate("External Applications\t(x)\tretrieves info from AMIP (x is var_ with any AMIP variable)")); - registerIntToken(_T(AMIPFORMAT), parseAMIPFormat, TRF_FUNCTION|TRF_UNPARSEDARGS, Translate("External Applications\t(x)\tretrieves info from AMIP (x is AMIP format string)")); + registerIntToken(_T(AMIPEVAL), parseAMIPEval, TRF_FUNCTION, LPGEN("External Applications")"\t(x)\t"LPGEN("retrieves info from AMIP (x is var_ with any AMIP variable)")); + registerIntToken(_T(AMIPFORMAT), parseAMIPFormat, TRF_FUNCTION|TRF_UNPARSEDARGS, LPGEN("External Applications")"\t(x)\t"LPGEN("retrieves info from AMIP (x is AMIP format string)")); } else { log_infoA("Variables: ac.dll for AMIP not found"); diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index 0bc8ca2ed9..95c94aba7d 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -21,21 +21,18 @@ #include static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) { - - TCHAR *tres; - char hex[8], *res; - unsigned int cur; + char hex[8]; if (ai->argc != 2) { return NULL; } - res = mir_t2a(ai->targv[1]); + char *res = mir_t2a(ai->targv[1]); if (res == NULL) { return NULL; } - cur = 0; + unsigned int cur = 0; while (cur < strlen(res)) { if (( (*(res+cur) >= '0') && (*(res+cur) <= '9')) || ( (*(res+cur) >= 'a') && (*(res+cur) <= 'z')) || ( (*(res+cur) >= 'A') && (*(res+cur) <= 'Z')) ) { cur++; @@ -51,7 +48,7 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) { cur+=strlen(hex); } - tres = mir_a2t(res); + TCHAR *tres = mir_a2t(res); mir_free(res); @@ -59,21 +56,18 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) { } static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) { - - char *res, hex[8]; - TCHAR *tres; - unsigned int cur; + char hex[8]; if (ai->argc != 2) { return NULL; } - res = mir_t2a(ai->targv[1]); + char *res = mir_t2a(ai->targv[1]); if (res == NULL) { return NULL; } - cur = 0; + unsigned int cur = 0; while (cur < strlen(res)) { if ((*(res+cur) == '%') && (strlen(res+cur) >= 3)) { memset(hex, '\0', sizeof(hex)); @@ -85,7 +79,7 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) { } res = ( char* )mir_realloc(res, strlen(res)+1); - tres = mir_a2t(res); + TCHAR *tres = mir_a2t(res); mir_free(res); @@ -93,8 +87,6 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) { } static TCHAR *parseNToA(ARGUMENTSINFO *ai) { - - char *res; struct in_addr in; if (ai->argc != 2) { @@ -102,7 +94,7 @@ static TCHAR *parseNToA(ARGUMENTSINFO *ai) { } in.s_addr = ttoi(ai->targv[1]); - res = inet_ntoa(in); + char *res = inet_ntoa(in); if (res != NULL) { return mir_a2t(res); @@ -113,8 +105,6 @@ static TCHAR *parseNToA(ARGUMENTSINFO *ai) { } static TCHAR *parseHToA(ARGUMENTSINFO *ai) { - - char *res; struct in_addr in; if (ai->argc != 2) { @@ -122,7 +112,7 @@ static TCHAR *parseHToA(ARGUMENTSINFO *ai) { } in.s_addr = htonl(ttoi(ai->targv[1])); - res = inet_ntoa(in); + char *res = inet_ntoa(in); if (res != NULL) { return mir_a2t(res); @@ -134,10 +124,10 @@ static TCHAR *parseHToA(ARGUMENTSINFO *ai) { int registerInetTokens() { - registerIntToken(_T(URLENC), parseUrlEnc, TRF_FUNCTION, Translate("Internet Related\t(x)\tconverts each non-html character into hex format")); - registerIntToken(_T(URLDEC), parseUrlDec, TRF_FUNCTION, Translate("Internet Related\t(x)\tconverts each hex value into non-html character")); - registerIntToken(_T(NTOA), parseNToA, TRF_FUNCTION, Translate("Internet Related\t(x)\tconverts a 32-bit number to IPv4 dotted notation")); - registerIntToken(_T(HTOA), parseHToA, TRF_FUNCTION, Translate("Internet Related\t(x)\tconverts a 32-bit number (in host byte order) to IPv4 dotted notation")); + registerIntToken(_T(URLENC), parseUrlEnc, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts each non-html character into hex format")); + registerIntToken(_T(URLDEC), parseUrlDec, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts each hex value into non-html character")); + registerIntToken(_T(NTOA), parseNToA, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts a 32-bit number to IPv4 dotted notation")); + registerIntToken(_T(HTOA), parseHToA, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts a 32-bit number (in host byte order) to IPv4 dotted notation")); return 0; } 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; } diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp index 36b5afa8cc..5c3c51f7aa 100644 --- a/plugins/Variables/src/parse_math.cpp +++ b/plugins/Variables/src/parse_math.cpp @@ -20,30 +20,23 @@ #include "parse_math.h" static TCHAR *parseAdd(ARGUMENTSINFO *ai) { - - unsigned int i; - int result; - if (ai->argc < 3) { return NULL; } - result = 0; - for (i=1;iargc;i++) { + int result = 0; + for (unsigned int i=1;iargc;i++) { result += ttoi(ai->targv[i]); } return itot(result); } static TCHAR *parseDiv(ARGUMENTSINFO *ai) { - - int val1, val2; - if (ai->argc != 3) { return NULL; } - val1 = ttoi(ai->targv[1]); - val2 = ttoi(ai->targv[2]); + int val1 = ttoi(ai->targv[1]); + int val2 = ttoi(ai->targv[2]); if (val2 == 0) { return NULL; } @@ -51,20 +44,17 @@ static TCHAR *parseDiv(ARGUMENTSINFO *ai) { } static TCHAR *parseHex(ARGUMENTSINFO *ai) { - - int val; - unsigned int i, zeros; - int padding; - TCHAR *res, szVal[34]; + unsigned int i; + TCHAR szVal[34]; if (ai->argc != 3) return NULL; - val = ttoi(ai->targv[1]); - padding = ttoi(ai->targv[2]); + int val = ttoi(ai->targv[1]); + int padding = ttoi(ai->targv[2]); mir_sntprintf(szVal, SIZEOF(szVal), _T("%x"), val); - zeros = max(padding - (signed int)_tcslen(szVal), 0); - res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 3)*sizeof(TCHAR)); + unsigned int zeros = max(padding - (signed int)_tcslen(szVal), 0); + TCHAR *res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 3)*sizeof(TCHAR)); if (res == NULL) return NULL; @@ -78,14 +68,11 @@ static TCHAR *parseHex(ARGUMENTSINFO *ai) { } static TCHAR *parseMod(ARGUMENTSINFO *ai) { - - int val1, val2; - if (ai->argc != 3) { return NULL; } - val1 = ttoi(ai->targv[1]); - val2 = ttoi(ai->targv[2]); + int val1 = ttoi(ai->targv[1]); + int val2 = ttoi(ai->targv[2]); if (val2 == 0) { return NULL; } @@ -94,14 +81,12 @@ static TCHAR *parseMod(ARGUMENTSINFO *ai) { } static TCHAR *parseMul(ARGUMENTSINFO *ai) { - unsigned int i; - int result; if (ai->argc < 3) { return NULL; } - result = ttoi(ai->targv[1]); + int result = ttoi(ai->targv[1]); for (i=2;iargc;i++) { result *= ttoi(ai->targv[i]); } @@ -122,14 +107,12 @@ static TCHAR *parseMuldiv(ARGUMENTSINFO *ai) { } static TCHAR *parseMin(ARGUMENTSINFO *ai) { - unsigned int i; - int minVal; if (ai->argc < 2) { return NULL; } - minVal = ttoi(ai->targv[1]); + int minVal = ttoi(ai->targv[1]); for (i=2;iargc;i++) { minVal = min(ttoi(ai->targv[i]), minVal); } @@ -138,14 +121,12 @@ static TCHAR *parseMin(ARGUMENTSINFO *ai) { } static TCHAR *parseMax(ARGUMENTSINFO *ai) { - unsigned int i; - int maxVal; if (ai->argc < 2) { return NULL; } - maxVal = ttoi(ai->targv[1]); + int maxVal = ttoi(ai->targv[1]); for (i=2;iargc;i++) { maxVal = max(ttoi(ai->targv[i]), maxVal); } @@ -154,28 +135,24 @@ static TCHAR *parseMax(ARGUMENTSINFO *ai) { } static TCHAR *parseNum(ARGUMENTSINFO *ai) { - - int val; unsigned int zeros, i; - int padding; - TCHAR *res, *szVal, *cur; if (ai->argc != 3) return NULL; - val = ttoi(ai->targv[1]); - padding = ttoi(ai->targv[2]); - szVal = itot(val); + int val = ttoi(ai->targv[1]); + int padding = ttoi(ai->targv[2]); + TCHAR *szVal = itot(val); if (szVal == NULL) return NULL; zeros = max(padding - (signed int)_tcslen(szVal), 0); - res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 1)*sizeof(TCHAR)); + TCHAR *res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; ZeroMemory(res, (zeros + _tcslen(szVal) + 1)*sizeof(TCHAR)); - cur = res; + TCHAR *cur = res; for (i=0;iargc < 3) { return NULL; } - result = ttoi(ai->targv[1]); + int result = ttoi(ai->targv[1]); for (i=2;iargc;i++) { result -= ttoi(ai->targv[i]); } @@ -208,17 +183,17 @@ static TCHAR *parseSub(ARGUMENTSINFO *ai) { int registerMathTokens() { - registerIntToken(_T(ADD), parseAdd, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y ,...)\tx + y + ...")); - registerIntToken(_T(DIV), parseDiv, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y)\tx divided by y")); - registerIntToken(_T(HEX), parseHex, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y)\tconverts decimal value x to hex value and padds to length y")); - registerIntToken(_T(MOD), parseMod, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y)\tx modulo y (remainder of x divided by y)")); - registerIntToken(_T(MUL), parseMul, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y)\tx times y")); - registerIntToken(_T(MULDIV), parseMuldiv, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y,z)\tx times y divided by z")); - registerIntToken(_T(MIN), parseMin, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y,...)\tminimum value of (decimal) arguments")); - registerIntToken(_T(MAX), parseMax, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y,...)\tmaximum value of (decimal) arguments")); - registerIntToken(_T(NUM), parseNum, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y)\tpads decimal value x to length y with zeros")); - registerIntToken(_T(RAND), parseRand, TRF_FUNCTION, Translate("Mathematical Functions\t()\trandom number")); - registerIntToken(_T(SUB), parseSub, TRF_FUNCTION, Translate("Mathematical Functions\t(x,y,...)\tx - y - ...")); + registerIntToken(_T(ADD), parseAdd, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y ,...)\t"LPGEN("x + y + ...")); + registerIntToken(_T(DIV), parseDiv, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("x divided by y")); + registerIntToken(_T(HEX), parseHex, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("converts decimal value x to hex value and padds to length y")); + registerIntToken(_T(MOD), parseMod, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("x modulo y (remainder of x divided by y)")); + registerIntToken(_T(MUL), parseMul, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("x times y")); + registerIntToken(_T(MULDIV), parseMuldiv, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,z)\t"LPGEN("x times y divided by z")); + registerIntToken(_T(MIN), parseMin, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,...)\t"LPGEN("minimum value of (decimal) arguments")); + registerIntToken(_T(MAX), parseMax, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,...)\t"LPGEN("maximum value of (decimal) arguments")); + registerIntToken(_T(NUM), parseNum, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("pads decimal value x to length y with zeros")); + registerIntToken(_T(RAND), parseRand, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t()\t"LPGEN("random number")); + registerIntToken(_T(SUB), parseSub, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,...)\t"LPGEN("x - y - ...")); srand((unsigned int)GetTickCount()); return 0; diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 80cb123e4b..98df006c8c 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -49,7 +49,6 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai) if (hContact == NULL) return NULL; - TCHAR* res = NULL; TCHAR* szUniqueID = NULL; char* szProto = GetContactProto(hContact); if (szProto != NULL) @@ -64,17 +63,13 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai) return NULL; } - res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR)); + TCHAR *res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR)); if (res == NULL) { mir_free(szUniqueID); return NULL; } - TCHAR* tszProto; - - tszProto = mir_a2t(szProto); - - + TCHAR *tszProto = mir_a2t(szProto); if (tszProto != NULL && szUniqueID != NULL) { wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID); mir_free(szUniqueID); @@ -110,7 +105,6 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai) if (hContact == NULL) return NULL; - TCHAR* res = NULL; TCHAR* szUniqueID = NULL; char* szProto = GetContactProto(hContact); if (szProto != NULL) @@ -124,17 +118,13 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai) return NULL; } - res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR)); + TCHAR* res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR)); if (res == NULL) { mir_free(szUniqueID); return NULL; } - TCHAR* tszProto; - - tszProto = mir_a2t(szProto); - - + TCHAR *tszProto = mir_a2t(szProto); if (tszProto != NULL && szUniqueID != NULL) { wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID); mir_free(szUniqueID); @@ -170,7 +160,6 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) if (hContact == NULL) return NULL; - TCHAR* res = NULL; TCHAR* szUniqueID = NULL; char* szProto = GetContactProto(hContact); if (szProto != NULL) @@ -184,17 +173,13 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) return NULL; } - res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR)); + TCHAR *res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR)); if (res == NULL) { mir_free(szUniqueID); return NULL; } - TCHAR* tszProto; - - tszProto = mir_a2t(szProto); - - + TCHAR *tszProto = mir_a2t(szProto); if (tszProto != NULL && szUniqueID != NULL) { wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID); mir_free(szUniqueID); @@ -207,9 +192,9 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) int registerMetaContactsTokens() { if (ServiceExists( MS_MC_GETPROTOCOLNAME )) { - registerIntToken( _T(MC_GETPARENT), parseGetParent, TRF_FUNCTION, Translate("MetaContacts\t(x)\tget parent metacontact of contact x")); - registerIntToken( _T(MC_GETDEFAULT), parseGetDefault, TRF_FUNCTION, Translate("MetaContacts\t(x)\tget default subcontact x")); - registerIntToken( _T(MC_GETMOSTONLINE), parseGetMostOnline, TRF_FUNCTION, Translate("MetaContacts\t(x)\tget the 'most online' subcontact x")); + registerIntToken( _T(MC_GETPARENT), parseGetParent, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get parent metacontact of contact x")); + registerIntToken( _T(MC_GETDEFAULT), parseGetDefault, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get default subcontact x")); + registerIntToken( _T(MC_GETMOSTONLINE), parseGetMostOnline, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get the 'most online' subcontact x")); } return 0; diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 46447c2489..549a3f5ac5 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -791,39 +791,39 @@ static TCHAR *parseMirSrvExists(ARGUMENTSINFO *ai) int registerMirandaTokens() { if (ServiceExists(MS_UTILS_REPLACEVARS)) { // global vars - registerIntToken(_T("miranda_path"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core Global\tpath to root miranda folder")); - registerIntToken(_T("miranda_profile"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core Global\tpath to current miranda profile")); - registerIntToken(_T("miranda_profilename"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core Global\tname of current miranda profile (filename, without extension)")); - registerIntToken(_T("miranda_userdata"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core Global\twill return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%")); - registerIntToken(_T("miranda_avatarcache"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core Global\twill return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%\\AvatarCache")); - registerIntToken(_T("miranda_logpath"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core Global\twill return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%\\Logs")); + registerIntToken(_T("miranda_path"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("path to root miranda folder")); + registerIntToken(_T("miranda_profile"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("path to current miranda profile")); + registerIntToken(_T("miranda_profilename"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("name of current miranda profile (filename, without extension)")); + registerIntToken(_T("miranda_userdata"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%")); + registerIntToken(_T("miranda_avatarcache"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%\\AvatarCache")); + registerIntToken(_T("miranda_logpath"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%\\Logs")); // OS vars - registerIntToken(_T("appdata"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core OS\tsame as environment variable %APPDATA% for currently logged-on Windows user")); - registerIntToken(_T("username"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core OS\tusername for currently logged-on Windows user")); - registerIntToken(_T("mydocuments"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core OS\t\"My Documents\" folder for currently logged-on Windows user")); - registerIntToken(_T("desktop"), parseMirandaCoreVar , TRF_FIELD, Translate("Miranda Core OS\t\"Desktop\" folder for currently logged-on Windows user")); + registerIntToken(_T("appdata"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("same as environment variable %APPDATA% for currently logged-on Windows user")); + registerIntToken(_T("username"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("username for currently logged-on Windows user")); + registerIntToken(_T("mydocuments"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("\"My Documents\" folder for currently logged-on Windows user")); + registerIntToken(_T("desktop"), parseMirandaCoreVar , TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("\"Desktop\" folder for currently logged-on Windows user")); } - registerIntToken(_T(CODETOSTATUS), parseCodeToStatus, TRF_FUNCTION, Translate("Miranda Related\t(x)\ttranslates status code x into a status description")); - registerIntToken(_T(CONTACT), parseContact, TRF_FUNCTION, Translate("Miranda Related\t(x,y,z)\tzth contact with property y described by x, example: (unregistered,nick) (z is optional)")); - registerIntToken(_T(CONTACTCOUNT), parseContactCount, TRF_FUNCTION, Translate("Miranda Related\t(x,y)\tnumber of contacts with property y described by x, example: (unregistered,nick)")); - registerIntToken(_T(CONTACTINFO), parseContactInfo, TRF_FUNCTION, Translate("Miranda Related\t(x,y)\tinfo property y of contact x")); - registerIntToken(_T(DBPROFILENAME), parseDBProfileName, TRF_FIELD, Translate("Miranda Related\tdb profile name")); - registerIntToken(_T(DBPROFILEPATH), parseDBProfilePath, TRF_FIELD, Translate("Miranda Related\tdb profile path")); - registerIntToken(_T(DBSETTING), parseDBSetting, TRF_FUNCTION, Translate("Miranda Related\t(x,y,z,w)\tdb setting z of module y of contact x and return w if z isn't exist (w is optional)")); - registerIntToken(_T(DBEVENT), parseDbEvent, TRF_FUNCTION, Translate("Miranda Related\t(x,y,z,w)\tget event for contact x (optional), according to y,z,w, see documentation")); - registerIntToken(_T(LSTIME), parseLastSeenTime, TRF_FUNCTION, Translate("Miranda Related\t(x,y)\tget last seen time of contact x in format y (y is optional)")); - registerIntToken(_T(LSDATE), parseLastSeenDate, TRF_FUNCTION, Translate("Miranda Related\t(x,y)\tget last seen date of contact x in format y (y is optional)")); - registerIntToken(_T(LSSTATUS), parseLastSeenStatus, TRF_FUNCTION, Translate("Miranda Related\t(x)\tget last seen status of contact x")); - registerIntToken(_T(MIRANDAPATH), parseMirandaPath, TRF_FIELD, Translate("Miranda Related\tpath to the Miranda-IM executable")); - registerIntToken(_T(MYSTATUS), parseMyStatus, TRF_FUNCTION, Translate("Miranda Related\t(x)\tcurrent status description of protocol x (without x, the global status is retrieved)")); - registerIntToken(_T(PROTOINFO), parseProtoInfo, TRF_FUNCTION, Translate("Miranda Related\t(x,y)\tinfo property y of protocol id x")); - registerIntToken(_T(SUBJECT), parseSpecialContact, TRF_FIELD, Translate("Miranda Related\tretrieves the subject, depending on situation")); - registerIntToken(_T(TRANSLATE), parseTranslate, TRF_FUNCTION, Translate("Miranda Related\t(x)\ttranslates x")); - registerIntToken(_T(VERSIONSTRING), parseVersionString, TRF_FIELD, Translate("Miranda Related\tget the version of Miranda")); - registerIntToken(_T(CONTACT_NAME), parseContactNameString, TRF_FIELD, Translate("Miranda Related\tget the contact display name")); - registerIntToken(_T(MIR_DATE), parseMirDateString, TRF_FIELD, Translate("Miranda Related\tget the date and time (using Miranda format)")); - registerIntToken(_T(SRVEXISTS), parseMirSrvExists, TRF_FUNCTION, Translate("Miranda Related\t(x)\tTRUE if service function is exists")); + registerIntToken(_T(CODETOSTATUS), parseCodeToStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("translates status code x into a status description")); + registerIntToken(_T(CONTACT), parseContact, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z)\t"LPGEN("zth contact with property y described by x, example: (unregistered,nick) (z is optional)")); + registerIntToken(_T(CONTACTCOUNT), parseContactCount, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("number of contacts with property y described by x, example: (unregistered,nick)")); + registerIntToken(_T(CONTACTINFO), parseContactInfo, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("info property y of contact x")); + registerIntToken(_T(DBPROFILENAME), parseDBProfileName, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("db profile name")); + registerIntToken(_T(DBPROFILEPATH), parseDBProfilePath, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("db profile path")); + registerIntToken(_T(DBSETTING), parseDBSetting, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z,w)\t"LPGEN("db setting z of module y of contact x and return w if z isn't exist (w is optional)")); + registerIntToken(_T(DBEVENT), parseDbEvent, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z,w)\t"LPGEN("get event for contact x (optional), according to y,z,w, see documentation")); + registerIntToken(_T(LSTIME), parseLastSeenTime, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("get last seen time of contact x in format y (y is optional)")); + registerIntToken(_T(LSDATE), parseLastSeenDate, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("get last seen date of contact x in format y (y is optional)")); + registerIntToken(_T(LSSTATUS), parseLastSeenStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("get last seen status of contact x")); + registerIntToken(_T(MIRANDAPATH), parseMirandaPath, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("path to the Miranda NG executable")); + registerIntToken(_T(MYSTATUS), parseMyStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("current status description of protocol x (without x, the global status is retrieved)")); + registerIntToken(_T(PROTOINFO), parseProtoInfo, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("info property y of protocol id x")); + registerIntToken(_T(SUBJECT), parseSpecialContact, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("retrieves the subject, depending on situation")); + registerIntToken(_T(TRANSLATE), parseTranslate, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("translates x")); + registerIntToken(_T(VERSIONSTRING), parseVersionString, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("get the version of Miranda")); + registerIntToken(_T(CONTACT_NAME), parseContactNameString, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("get the contact display name")); + registerIntToken(_T(MIR_DATE), parseMirDateString, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("get the date and time (using Miranda format)")); + registerIntToken(_T(SRVEXISTS), parseMirSrvExists, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("TRUE if service function exists")); return 0; } diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index a973d4c0e0..774b64275a 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -27,12 +27,9 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) { const char *err; - int erroffset, nmat; - pcre_extra *extra; - pcre *ppat; + int erroffset; char szVal[34], *arg1, *arg2; int offsets[99]; - TCHAR *res; if (ai->argc != 3) { return NULL; @@ -42,21 +39,21 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) { arg1 = mir_t2a(ai->targv[1]); arg2 = mir_t2a(ai->targv[2]); - ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL); + pcre *ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL); if (ppat == NULL) { mir_free(arg1); mir_free(arg2); return NULL; } - extra = pcre_study(ppat, 0, &err); - nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99); + pcre_extra *extra = pcre_study(ppat, 0, &err); + int nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99); mir_free(arg1); mir_free(arg2); if (nmat > 0) { ai->flags &= ~AIF_FALSE; _ltoa(nmat, szVal, 10); - res = mir_a2t(szVal); + TCHAR *res = mir_a2t(szVal); return res; } @@ -71,9 +68,7 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) { const char *err, *substring; char *res, *arg1, *arg2, *arg3; - int erroffset, nmat, number; - pcre_extra *extra; - pcre *ppat; + int erroffset, number; int offsets[99]; TCHAR *tres; @@ -93,15 +88,15 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) { return NULL; } ai->flags = AIF_FALSE; - ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL); + pcre *ppat = pcre_compile(arg1, 0, &err, &erroffset, NULL); if (ppat == NULL) { mir_free(arg1); mir_free(arg2); mir_free(arg3); return NULL; } - extra = pcre_study(ppat, 0, &err); - nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99); + pcre_extra *extra = pcre_study(ppat, 0, &err); + int nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99); if (nmat >= 0) { ai->flags &= ~AIF_FALSE; } @@ -131,8 +126,8 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) { int registerRegExpTokens() { - registerIntToken(_T(REGEXPCHECK), parseRegExpCheck, TRF_FUNCTION, Translate("Regular Expressions\t(x,y)\t(ANSI input only) the number of substring matches found in y with pattern x")); - registerIntToken(_T(REGEXPSUBSTR), parseRegExpSubstr, TRF_FUNCTION, Translate("Regular Expressions\t(x,y,z)\t(ANSI input only) substring match number z found in subject y with pattern x")); + registerIntToken(_T(REGEXPCHECK), parseRegExpCheck, TRF_FUNCTION, LPGEN("Regular Expressions")"\t(x,y)\t"LPGEN("(ANSI input only) the number of substring matches found in y with pattern x")); + registerIntToken(_T(REGEXPSUBSTR), parseRegExpSubstr, TRF_FUNCTION, LPGEN("Regular Expressions")"\t(x,y,z)\t"LPGEN("(ANSI input only) substring match number z found in subject y with pattern x")); return 0; diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index d8490f6c82..3eb6314183 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -844,44 +844,44 @@ static TCHAR *parseExtratext(ARGUMENTSINFO *ai) int registerStrTokens() { - registerIntToken(_T(CAPS), parseCaps, TRF_FUNCTION, Translate("String Functions\t(x)\tconverts each first letter of a word to uppercase, all others to lowercase")); - registerIntToken(_T(CAPS2), parseCaps2, TRF_FUNCTION, Translate("String Functions\t(x)\tconverts each first letter of a word to uppercase")); - registerIntToken(_T(CRLF), parseCrlf, TRF_FUNCTION, Translate("String Functions\t()\tinserts 'end of line' character")); - registerIntToken(_T(EXTRATEXT), parseExtratext, TRF_FIELD, Translate("String Functions\tdepends on calling plugin")); - registerIntToken(_T(EOL2CRLF), parseEolToCrlf, TRF_FUNCTION, Translate("String Functions\t(x)\tReplace all occurrences of \\n (Unix) by \\r\\n (Windows)")); - registerIntToken(_T(FIXEOL), parseFixeol, TRF_FUNCTION, Translate("String Functions\t(x,y)\tcuts x after the first line and appends y (y is optional)")); - registerIntToken(_T(FIXEOL2), parseFixeol2, TRF_FUNCTION, Translate("String Functions\t(x,y)\treplaces all end of line characters by y (y is optional)")); - registerIntToken(_T(INSERT), parseInsert, TRF_FUNCTION, Translate("String Functions\t(x,y,z)\tinserts string y at position z in string x")); - registerIntToken(_T(LEFT), parseLeft, TRF_FUNCTION, Translate("String Functions\t(x,y)\ttrims x to length y, keeping first y characters")); - registerIntToken(_T(LEN), parseLen, TRF_FUNCTION, Translate("String Functions\t(x)\tlength of x")); - registerIntToken(_T(LINECOUNT), parseLineCount, TRF_FUNCTION, Translate("String Functions\t(x)\tthe number of lines in string x")); - registerIntToken(_T(LONGEST), parseLongest, TRF_FUNCTION, Translate("String Functions\t(x,y,...)\tthe longest string of the arguments")); - registerIntToken(_T(LOWER), parseLower, TRF_FUNCTION, Translate("String Functions\t(x)\tconverts x to lowercase")); - registerIntToken(_T(NOOP), parseNoOp, TRF_FUNCTION, Translate("String Functions\t(x)\tno operation, x as given")); - registerIntToken(_T(PAD), parsePad, TRF_FUNCTION, Translate("String Functions\t(x,y,z)\tpads x to length y prepending character z (z is optional)")); - registerIntToken(_T(PADRIGHT), parsePadright, TRF_FUNCTION, Translate("String Functions\t(x,y,z)\tpads x to length y appending character z (z is optional)")); - registerIntToken(_T(PADCUT), parsePadcut, TRF_FUNCTION, Translate("String Functions\t(x,y,z)\tpads x to length y prepending character z, or cut if x is longer (z is optional)")); - registerIntToken(_T(PADCUTRIGHT), parsePadcutright, TRF_FUNCTION, Translate("String Functions\t(x,y,z)\tpads x to length y appending character z, or cut if x is longer (z is optional)")); - registerIntToken(_T(REPEAT), parseRepeat, TRF_FUNCTION, Translate("String Functions\t(x,y)\trepeats x y times")); - registerIntToken(_T(REPLACE), parseReplace, TRF_FUNCTION, Translate("String Functions\t(x,y,z,...)\treplace all occurrences of y in x with z, multiple y and z arguments allowed")); - registerIntToken(_T(RIGHT), parseRight, TRF_FUNCTION, Translate("String Functions\t(x,y)\ttrims x to length y, keeping last y characters")); - registerIntToken(_T(SCROLL), parseScroll, TRF_FUNCTION, Translate("String Functions\t(x,y,z)\tmoves string x, z characters to the left and trims it to y characters")); - registerIntToken(_T(STRCMP), parseStrcmp, TRF_FUNCTION, Translate("String Functions\t(x,y)\tTRUE if x equals y")); - registerIntToken(_T(STRMCMP), parseStrmcmp, TRF_FUNCTION, Translate("String Functions\t(x,y,...)\tTRUE if x equals any of the following arguments")); - registerIntToken(_T(STRNCMP), parseStrncmp, TRF_FUNCTION, Translate("String Functions\t(x,y,z)\tTRUE if the first z characters of x equal y")); - registerIntToken(_T(STRICMP), parseStricmp, TRF_FUNCTION, Translate("String Functions\t(x,y)\tTRUE if x equals y, ignoring case")); - registerIntToken(_T(STRNICMP), parseStrnicmp, TRF_FUNCTION, Translate("String Functions\t(x,y)\tTRUE if the first z characters of x equal y, ignoring case")); - registerIntToken(_T(SHORTEST), parseShortest, TRF_FUNCTION, Translate("String Functions\t(x,y,...)\tthe shortest string of the arguments")); - registerIntToken(_T(STRCHR), parseStrchr, TRF_FUNCTION, Translate("String Functions\t(x,y)\tlocation of first occurrence of character y in string x")); - registerIntToken(_T(STRRCHR), parseStrrchr, TRF_FUNCTION, Translate("String Functions\t(x,y)\tlocation of last occurrence of character y in string x")); - registerIntToken(_T(STRSTR), parseStrstr, TRF_FUNCTION, Translate("String Functions\t(x,y)\tlocation of first occurrence of string y in x")); - registerIntToken(_T(SUBSTR), parseSubstr, TRF_FUNCTION, Translate("String Functions\t(x,y,z)\tsubstring of x starting from position y to z")); - registerIntToken(_T(SELECT), parseSelect, TRF_FUNCTION, Translate("String Functions\t(x,y,...)\tthe xth string of the arguments")); - registerIntToken(_T(SWITCH), parseSwitch, TRF_FUNCTION, Translate("String Functions\t(x,y,z,...)\tz if y equals x, multiple y and z arguments allowed")); - registerIntToken(_T(TRIM), parseTrim, TRF_FUNCTION, Translate("String Functions\t(x)\tremoves white spaces in before and after x")); - registerIntToken(_T(TAB), parseTab, TRF_FUNCTION, Translate("String Functions\t(x)\tinserts x tab characters (x is optional)")); - registerIntToken(_T(UPPER), parseUpper, TRF_FUNCTION, Translate("String Functions\t(x)\tconverts x to upper case")); - registerIntToken(_T(WORD), parseWord, TRF_FUNCTION, Translate("String Functions\t(x,y,z)\twords (separated by white spaces) number y to z from string x (z is optional)")); + registerIntToken(_T(CAPS), parseCaps, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase, all others to lowercase")); + registerIntToken(_T(CAPS2), parseCaps2, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase")); + registerIntToken(_T(CRLF), parseCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t()\t"LPGEN("inserts 'end of line' character")); + registerIntToken(_T(EXTRATEXT), parseExtratext, TRF_FIELD, LPGEN("String Functions")"\t"LPGEN("depends on calling plugin")); + registerIntToken(_T(EOL2CRLF), parseEolToCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("Replace all occurrences of \\n (Unix) by \\r\\n (Windows)")); + registerIntToken(_T(FIXEOL), parseFixeol, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("cuts x after the first line and appends y (y is optional)")); + registerIntToken(_T(FIXEOL2), parseFixeol2, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("replaces all end of line characters by y (y is optional)")); + registerIntToken(_T(INSERT), parseInsert, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("inserts string y at position z in string x")); + registerIntToken(_T(LEFT), parseLeft, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping first y characters")); + registerIntToken(_T(LEN), parseLen, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("length of x")); + registerIntToken(_T(LINECOUNT), parseLineCount, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("the number of lines in string x")); + registerIntToken(_T(LONGEST), parseLongest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the longest string of the arguments")); + registerIntToken(_T(LOWER), parseLower, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to lowercase")); + registerIntToken(_T(NOOP), parseNoOp, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("no operation, x as given")); + registerIntToken(_T(PAD), parsePad, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z (z is optional)")); + registerIntToken(_T(PADRIGHT), parsePadright, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y appending character z (z is optional)")); + registerIntToken(_T(PADCUT), parsePadcut, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z, or cut if x is longer (z is optional)")); + registerIntToken(_T(PADCUTRIGHT), parsePadcutright, TRF_FUNCTION, LPGEN("String Functions")"\t"LPGEN("(x,y,z)\tpads x to length y appending character z, or cut if x is longer (z is optional)")); + registerIntToken(_T(REPEAT), parseRepeat, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("repeats x y times")); + registerIntToken(_T(REPLACE), parseReplace, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("replace all occurrences of y in x with z, multiple y and z arguments allowed")); + registerIntToken(_T(RIGHT), parseRight, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping last y characters")); + registerIntToken(_T(SCROLL), parseScroll, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("moves string x, z characters to the left and trims it to y characters")); + registerIntToken(_T(STRCMP), parseStrcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y")); + registerIntToken(_T(STRMCMP), parseStrmcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("TRUE if x equals any of the following arguments")); + registerIntToken(_T(STRNCMP), parseStrncmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("TRUE if the first z characters of x equal y")); + registerIntToken(_T(STRICMP), parseStricmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y, ignoring case")); + registerIntToken(_T(STRNICMP), parseStrnicmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if the first z characters of x equal y, ignoring case")); + registerIntToken(_T(SHORTEST), parseShortest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the shortest string of the arguments")); + registerIntToken(_T(STRCHR), parseStrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of character y in string x")); + registerIntToken(_T(STRRCHR), parseStrrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of last occurrence of character y in string x")); + registerIntToken(_T(STRSTR), parseStrstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of string y in x")); + registerIntToken(_T(SUBSTR), parseSubstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("substring of x starting from position y to z")); + registerIntToken(_T(SELECT), parseSelect, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the xth string of the arguments")); + registerIntToken(_T(SWITCH), parseSwitch, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("z if y equals x, multiple y and z arguments allowed")); + registerIntToken(_T(TRIM), parseTrim, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("removes white spaces in before and after x")); + registerIntToken(_T(TAB), parseTab, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("inserts x tab characters (x is optional)")); + registerIntToken(_T(UPPER), parseUpper, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to upper case")); + registerIntToken(_T(WORD), parseWord, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("words (separated by white spaces) number y to z from string x (z is optional)")); return 0; } diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index 0eafd1b2b3..cd0d530c23 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -964,39 +964,39 @@ static TCHAR *parseClipboard(ARGUMENTSINFO *ai) { int registerSystemTokens() { - registerIntToken(_T(COMPUTERNAME), parseComputerName, TRF_FIELD, Translate("System Functions\tcomputer name")); + registerIntToken(_T(COMPUTERNAME), parseComputerName, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("computer name")); #if _WIN32_WINNT>=0x0500 - registerIntToken(_T(CPULOAD), parseCpuLoad, TRF_FUNCTION, Translate("System Functions\t(x)\tcpu load of process x (without extension) (x is optional)")); + registerIntToken(_T(CPULOAD), parseCpuLoad, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("cpu load of process x (without extension) (x is optional)")); #endif - registerIntToken(_T(CDATE), parseCurrentDate, TRF_FUNCTION, Translate("System Functions\t(x)\tcurrent date in format y (y is optional)")); - registerIntToken(_T(CTIME), parseCurrentTime, TRF_FUNCTION, Translate("System Functions\t(x)\tcurrent time in format y (y is optional)")); - registerIntToken(_T(DIRECTORY), parseDirectory, TRF_FUNCTION, Translate("System Functions\t(x,y)\tthe directory y directories above x")); - registerIntToken(_T(DIRECTORY2), parseDirectory2, TRF_FUNCTION, Translate("System Functions\t(x,y)\tstrips y directories from x")); - registerIntToken(_T(DIFFTIME), parseDiffTime, TRF_FUNCTION, Translate("System Functions\t(x,y)\tnumber of seconds between date x and y (x and y in format: M/d/yy H:m:s)")); - registerIntToken(_T(DIREXISTS), parseDirExists, TRF_FUNCTION, Translate("System Functions\t(x)\tTRUE if directory x exists")); - registerIntToken(_T(FILEEXISTS), parseFileExists, TRF_FUNCTION, Translate("System Functions\t(x)\tTRUE if file x exists")); - registerIntToken(_T(FINDWINDOW), parseFindWindow, TRF_FUNCTION, Translate("System Functions\t(x)\twindow title of first window of class x")); - registerIntToken(_T(LISTDIR), parseListDir, TRF_FUNCTION, Translate("System Functions\t(x,y,z)\tshows files and directories of directory z, with filter y, separated by z (y and z optional)")); + registerIntToken(_T(CDATE), parseCurrentDate, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("current date in format y (y is optional)")); + registerIntToken(_T(CTIME), parseCurrentTime, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("current time in format y (y is optional)")); + registerIntToken(_T(DIRECTORY), parseDirectory, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("the directory y directories above x")); + registerIntToken(_T(DIRECTORY2), parseDirectory2, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("strips y directories from x")); + registerIntToken(_T(DIFFTIME), parseDiffTime, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("number of seconds between date x and y (x and y in format: M/d/yy H:m:s)")); + registerIntToken(_T(DIREXISTS), parseDirExists, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("TRUE if directory x exists")); + registerIntToken(_T(FILEEXISTS), parseFileExists, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("TRUE if file x exists")); + registerIntToken(_T(FINDWINDOW), parseFindWindow, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("window title of first window of class x")); + registerIntToken(_T(LISTDIR), parseListDir, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y,z)\t"LPGEN("shows files and directories of directory z, with filter y, separated by z (y and z optional)")); #ifndef WINE - registerIntToken(_T(PROCESSRUNNING), parseProcessRunning, TRF_FUNCTION, Translate("System Functions\t(x)\tTRUE if process x is running")); + registerIntToken(_T(PROCESSRUNNING), parseProcessRunning, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("TRUE if process x is running")); #endif - registerIntToken(_T(REGISTRYVALUE), parseRegistryValue, TRF_FUNCTION, Translate("System Functions\t(x,y)\tvalue y from registry key x (REG_SZ (string) values only)")); - registerIntToken(_T(TIMESTAMP2DATE), parseTimestamp2Date, TRF_FUNCTION, Translate("System Functions\t(x,y)\tformats timestamp x (seconds since 1/1/1970) in date format y")); - registerIntToken(_T(TIMESTAMP2TIME), parseTimestamp2Time, TRF_FUNCTION, Translate("System Functions\t(x,y)\tformats timestamp x (seconds since 1/1/1970) in time format y")); - registerIntToken(_T(TXTFILE), parseTextFile, TRF_FUNCTION, Translate("System Functions\t(x,y)\ty > 0: line number y from file x, y = 0: the whole file, y < 0: line y counted from the end, y = r: random line")); + registerIntToken(_T(REGISTRYVALUE), parseRegistryValue, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("value y from registry key x (REG_SZ (string) values only)")); + registerIntToken(_T(TIMESTAMP2DATE), parseTimestamp2Date, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("formats timestamp x (seconds since 1/1/1970) in date format y")); + registerIntToken(_T(TIMESTAMP2TIME), parseTimestamp2Time, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("formats timestamp x (seconds since 1/1/1970) in time format y")); + registerIntToken(_T(TXTFILE), parseTextFile, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("y > 0: line number y from file x, y = 0: the whole file, y < 0: line y counted from the end, y = r: random line")); #if _WIN32_WINNT>=0x0500 - registerIntToken(_T(UPTIME), parseUpTime, TRF_FIELD, Translate("System Functions\tuptime in seconds")); + registerIntToken(_T(UPTIME), parseUpTime, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("uptime in seconds")); #endif if (!ServiceExists( MS_UTILS_REPLACEVARS )) - registerIntToken(_T(ENVIRONMENTVARIABLE), parseEnvironmentVariable, TRF_FUNCTION , Translate("Miranda Core OS\t(%xxxxxxx%)\tany environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)")); + registerIntToken(_T(ENVIRONMENTVARIABLE), parseEnvironmentVariable, TRF_FUNCTION , LPGEN("Miranda Core OS")"\t(%xxxxxxx%)\t"LPGEN("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)")); else { - registerIntToken(_T(ENVIRONMENTVARIABLE), parseEnvironmentVariable, TRF_FUNCTION , Translate("System Functions\t(x)\texpand environment variable x")); - registerIntToken(_T(USERNAME), parseUserName, TRF_FIELD , Translate("System Functions\tuser name")); + registerIntToken(_T(ENVIRONMENTVARIABLE), parseEnvironmentVariable, TRF_FUNCTION , LPGEN("System Functions")"\t(x)\t"LPGEN("expand environment variable x")); + registerIntToken(_T(USERNAME), parseUserName, TRF_FIELD , LPGEN("System Functions")"\t"LPGEN("user name")); } srand((unsigned int)GetTickCount()); - registerIntToken(_T(CLIPBOARD), parseClipboard, TRF_FIELD, Translate("System Functions\ttext from clipboard")); + registerIntToken(_T(CLIPBOARD), parseClipboard, TRF_FIELD, LPGEN("System Functions\ttext from clipboard")); return 0; } diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index 7c154bf693..8f311e1ab6 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -159,9 +159,9 @@ static TCHAR *parseGet(ARGUMENTSINFO *ai) { int registerVariablesTokens() { - registerIntToken(_T(GET), parseGet, TRF_FUNCTION, Translate("Variables\t(x)\tvariable set by put(s) with name x")); - registerIntToken(_T(PUT), parsePut, TRF_FUNCTION, Translate("Variables\t(x,y)\tx, and stores y as variable named x"));//TRF_UNPARSEDARGS); - registerIntToken(_T(PUTS), parsePuts, TRF_FUNCTION, Translate("Variables\t(x,y)\tonly stores y as variables x"));//TRF_UNPARSEDARGS); + registerIntToken(_T(GET), parseGet, TRF_FUNCTION, LPGEN("Variables")"\t(x)\t"LPGEN("variable set by put(s) with name x")); + registerIntToken(_T(PUT), parsePut, TRF_FUNCTION, LPGEN("Variables")"\t(x,y)\t"LPGEN("x, and stores y as variable named x"));//TRF_UNPARSEDARGS); + registerIntToken(_T(PUTS), parsePuts, TRF_FUNCTION, LPGEN("Variables")"\t(x,y)\t"LPGEN("only stores y as variables x"));//TRF_UNPARSEDARGS); InitializeCriticalSection(&csVarRegister); return 0; diff --git a/plugins/Variables/src/parse_xml.cpp b/plugins/Variables/src/parse_xml.cpp index c56e70e1c8..954252d1d4 100644 --- a/plugins/Variables/src/parse_xml.cpp +++ b/plugins/Variables/src/parse_xml.cpp @@ -52,10 +52,7 @@ void (*pXsltCleanupGlobals)(void); pattern, subject */ static TCHAR *parseXslts(ARGUMENTSINFO *ai) { - - char *szStyleSheet, *szDoc; TCHAR *tszRes; - xsltStylesheetPtr cur = NULL; xmlDocPtr doc, res, sdoc; xmlChar *xmlChRes = NULL; int resLen; @@ -64,8 +61,8 @@ static TCHAR *parseXslts(ARGUMENTSINFO *ai) { return NULL; } - szStyleSheet = mir_t2a(ai->targv[1]); - szDoc = mir_t2a(ai->targv[2]); + char *szStyleSheet = mir_t2a(ai->targv[1]); + char *szDoc = mir_t2a(ai->targv[2]); log_debugA("calling xsltParseMemory"); @@ -76,7 +73,7 @@ static TCHAR *parseXslts(ARGUMENTSINFO *ai) { } log_debugA("calling xsltParseStylesheetDoc"); - cur = pXsltParseStylesheetDoc(sdoc); + xsltStylesheetPtr cur = pXsltParseStylesheetDoc(sdoc); if (cur == NULL) { log_debugA("calling xsltFreeDoc"); pXmlFreeDoc(sdoc); @@ -133,10 +130,7 @@ static TCHAR *parseXslts(ARGUMENTSINFO *ai) { files */ static TCHAR *parseXsltf(ARGUMENTSINFO *ai) { - - char *szStyleSheet, *szDoc; TCHAR *tszRes; - xsltStylesheetPtr cur = NULL; xmlDocPtr doc, res; xmlChar *xmlChRes = NULL; int resLen; @@ -145,14 +139,14 @@ static TCHAR *parseXsltf(ARGUMENTSINFO *ai) { return NULL; } - szStyleSheet = mir_t2a(ai->targv[1]); - szDoc = mir_t2a(ai->targv[2]); + char *szStyleSheet = mir_t2a(ai->targv[1]); + char *szDoc = mir_t2a(ai->targv[2]); log_debugA("xslt with %s and %s", szStyleSheet, szDoc); log_debugA("calling xsltParseStylesheetFile"); - cur = pXsltParseStylesheetFile((const xmlChar *)szStyleSheet); + xsltStylesheetPtr cur = pXsltParseStylesheetFile((const xmlChar *)szStyleSheet); if (cur == NULL) { return NULL; @@ -208,21 +202,16 @@ static TCHAR *parseXsltf(ARGUMENTSINFO *ai) { } int initXslt() { - - HMODULE hModule; - - hModule = LoadLibraryA("libxml2.dll"); + HMODULE hModule = LoadLibrary(_T("libxml2.dll")); if (hModule == NULL) { - char path[MAX_PATH]; - char *cur; - - GetModuleFileNameA(NULL, path, sizeof(path)); - cur = strrchr(path, '\\'); + TCHAR path[MAX_PATH]; + GetModuleFileName(NULL, path, MAX_PATH); + TCHAR *cur = _tcsrchr(path, '\\'); if (cur != NULL) - strcpy(cur+1, "libxml2.dll"); + _tcscpy(cur+1, _T("libxml2.dll")); else - strcpy(path, "libxml2.dll"); - hModule = LoadLibraryA(path); + _tcscpy(path, _T("libxml2.dll")); + hModule = LoadLibrary(path); } if (hModule == NULL) { return -1; @@ -276,8 +265,8 @@ int registerXsltTokens() { return -1; } - registerIntToken(_T(XSLTF), parseXsltf, TRF_FUNCTION, Translate("XML\t(x,y)\tapply stylesheet file x to document file y")); - registerIntToken(_T(XSLTS), parseXslts, TRF_FUNCTION, Translate("XML\t(x,y)\tapply stylesheet x to document y")); + registerIntToken(_T(XSLTF), parseXsltf, TRF_FUNCTION, LPGEN("XML")"\t(x,y)\t"LPGEN("apply stylesheet file x to document file y")); + registerIntToken(_T(XSLTS), parseXslts, TRF_FUNCTION, LPGEN("XML")"\t(x,y)\t"LPGEN("apply stylesheet x to document y")); return 0; } -- cgit v1.2.3