summaryrefslogtreecommitdiff
path: root/plugins/Boltun/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-25 10:31:04 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-25 10:31:04 +0000
commit8ae3679aa1339ce9abee53adb69902bd6b7513dc (patch)
tree94ef8927e12043ed6dcc15e1e640d68a8add520e /plugins/Boltun/src
parent1e273e28d89b5838e3d0f0cafac9676577cb71ce (diff)
hello, Unix.
phase 1: removing _T() git-svn-id: http://svn.miranda-ng.org/main/trunk@17127 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Boltun/src')
-rw-r--r--plugins/Boltun/src/Engine/Mind.cpp36
-rw-r--r--plugins/Boltun/src/Engine/TalkEngine.cpp68
-rw-r--r--plugins/Boltun/src/Engine/UnrecentChooser.cpp2
-rw-r--r--plugins/Boltun/src/Engine/ValueChooser.h2
-rw-r--r--plugins/Boltun/src/Engine/WordsList.cpp6
-rw-r--r--plugins/Boltun/src/boltun.cpp4
-rw-r--r--plugins/Boltun/src/stdafx.h2
7 files changed, 60 insertions, 60 deletions
diff --git a/plugins/Boltun/src/Engine/Mind.cpp b/plugins/Boltun/src/Engine/Mind.cpp
index 8181bcec2a..f9a46df967 100644
--- a/plugins/Boltun/src/Engine/Mind.cpp
+++ b/plugins/Boltun/src/Engine/Mind.cpp
@@ -209,25 +209,25 @@ void Mind::Load(tstring filename)
++c;
count -= 2;
c[count] = '\0';
- if (mir_tstrcmp(c, _T("QUESTION")) == 0) {
+ if (mir_tstrcmp(c, L"QUESTION") == 0) {
toLowerStr(c);
data->question.insert(s1);
}
- else if (mir_tstrcmp(c, _T("IGNORED")) == 0) {
+ else if (mir_tstrcmp(c, L"IGNORED") == 0) {
toLowerStr(c);
data->special.insert(s1);
}
- else if (mir_tstrcmp(c, _T("ESCAPE")) == 0) {
+ else if (mir_tstrcmp(c, L"ESCAPE") == 0) {
data->escape.push_back(s1);
}
- else if (mir_tstrcmp(c, _T("FAILURE")) == 0) {
+ else if (mir_tstrcmp(c, L"FAILURE") == 0) {
data->failure.push_back(s1);
}
- else if (mir_tstrcmp(c, _T("REPEAT")) == 0) {
+ else if (mir_tstrcmp(c, L"REPEAT") == 0) {
data->repeats.push_back(s1);
}
else {
- if (mir_tstrcmp(c, _T("INITIAL")) != 0)
+ if (mir_tstrcmp(c, L"INITIAL") != 0)
throw error;
data->initial.push_back(s1);
}
@@ -298,47 +298,47 @@ void Mind::Save(tstring filename) const
file << (*it).second << _T('\r') << endl;
}
for (multimap<WordsList, tstring>::iterator it = data->keywords.begin(); it != data->keywords.end(); ++it) {
- file << _T(" (") << (tstring)(*it).first << _T(")") << _T('\r') << endl;
+ file << L" (" << (tstring)(*it).first << L")" << _T('\r') << endl;
file << (*it).second << _T('\r') << endl;
}
for (multimap<WordsList, tstring>::iterator it = data->qkeywords.begin(); it != data->qkeywords.end(); ++it) {
- file << _T(" (") << (tstring)(*it).first << _T(")") << _T('\r') << endl;
+ file << L" (" << (tstring)(*it).first << L")" << _T('\r') << endl;
file << (*it).second << _T('\r') << endl;
}
for (multimap<WordsList, tstring>::iterator it = data->specialEscapes.begin(); it != data->specialEscapes.end(); ++it) {
- file << _T(" {") << (tstring)(*it).first << _T("}") << _T('\r') << endl;
+ file << L" {" << (tstring)(*it).first << L"}" << _T('\r') << endl;
file << (*it).second << _T('\r') << endl;
}
for (multimap<WordsList, tstring>::iterator it = data->qspecialEscapes.begin(); it != data->qspecialEscapes.end(); ++it) {
- file << _T(" {") << (tstring)(*it).first << _T("}") << _T('\r') << endl;
+ file << L" {" << (tstring)(*it).first << L"}" << _T('\r') << endl;
file << (*it).second << _T('\r') << endl;
}
for (string_mmap::iterator it = data->widelyUsed.begin(); it != data->widelyUsed.end(); ++it) {
- file << _T(" [") << (*it).first << _T("]") << _T('\r') << endl;
+ file << L" [" << (*it).first << L"]" << _T('\r') << endl;
file << (*it).second << _T('\r') << endl;
}
for (set<tstring>::iterator it = data->question.begin(); it != data->question.end(); ++it) {
- file << _T(" <QUESTION>") << _T('\r') << endl;
+ file << L" <QUESTION>" << _T('\r') << endl;
file << (*it) << _T('\r') << endl;
}
for (set<tstring>::iterator it = data->special.begin(); it != data->special.end(); ++it) {
- file << _T(" <IGNORED>") << _T('\r') << endl;
+ file << L" <IGNORED>" << _T('\r') << endl;
file << (*it) << _T('\r') << endl;
}
for (string_vec::iterator it = data->escape.begin(); it != data->escape.end(); ++it) {
- file << _T(" <ESCAPE>") << _T('\r') << endl;
+ file << L" <ESCAPE>" << _T('\r') << endl;
file << (*it) << _T('\r') << endl;
}
for (string_vec::iterator it = data->initial.begin(); it != data->initial.end(); ++it) {
- file << _T(" <INITIAL>") << _T('\r') << endl;
+ file << L" <INITIAL>" << _T('\r') << endl;
file << (*it) << _T('\r') << endl;
}
for (string_vec::iterator it = data->failure.begin(); it != data->failure.end(); ++it) {
- file << _T(" <FAILURE>") << _T('\r') << endl;
+ file << L" <FAILURE>" << _T('\r') << endl;
file << (*it) << _T('\r') << endl;
}
for (string_vec::iterator it = data->repeats.begin(); it != data->repeats.end(); ++it) {
- file << _T(" <REPEAT>") << _T('\r') << endl;
+ file << L" <REPEAT>" << _T('\r') << endl;
file << (*it) << _T('\r') << endl;
}
for (map<tstring, vector<tstring>>::const_iterator it = data->raliases.begin(); it != data->raliases.end(); ++it) {
@@ -351,7 +351,7 @@ void Mind::Save(tstring filename) const
s = *it1;
}
else {
- s += _T(" ") + *it1;
+ s += L" " + *it1;
}
}
file << _T('@') << (*it).first << _T('\r') << endl;
diff --git a/plugins/Boltun/src/Engine/TalkEngine.cpp b/plugins/Boltun/src/Engine/TalkEngine.cpp
index 59cf0512b1..c5cc859bb3 100644
--- a/plugins/Boltun/src/Engine/TalkEngine.cpp
+++ b/plugins/Boltun/src/Engine/TalkEngine.cpp
@@ -94,7 +94,7 @@ tstring TalkBot::GetInitMessage(MCONTACT contact)
tstring TalkBot::ReplaceAliases(const tstring &message)
{
- const TCHAR dividers[] = _T(" \t\n\r,./?\\|;:'\"~!#^&*()_-+=[{]}—\1");
+ const TCHAR dividers[] = L" \t\n\r,./?\\|;:'\"~!#^&*()_-+=[{]}—\1";
tstring sentence = message;
tstring result;
map<size_t, tstring> sm;
@@ -107,7 +107,7 @@ tstring TalkBot::ReplaceAliases(const tstring &message)
tstring item = sentence.substr(i, j);
if (mind.GetData()->smiles.find(item) != mind.GetData()->smiles.end()) {
sm[i] = item;
- sentence.replace(i, j, _T("\1"));
+ sentence.replace(i, j, L"\1");
break;
}
}
@@ -163,7 +163,7 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact
if (FindExact(contactData, incomingMessage, mind.GetData()->study, res)) //study
{
#ifdef DEBUG_PREFIXES
- mm.insert(make_pair(LOOKSLIKE, _T("(study_all) ") + res));
+ mm.insert(make_pair(LOOKSLIKE, L"(study_all) " + res));
#else
mm.insert(make_pair(LOOKSLIKE, res));
#endif
@@ -173,12 +173,12 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact
vector<tstring> sentences;
SplitSectences(incomingMessage, sentences);
ValueChooser<> ch(sentences, true); //Using random order of sentences.
- while ((res = ch.GetString()) != _T("")) {
+ while ((res = ch.GetString()) != L"") {
//Part 4
if (FindExact(contactData, res, mind.GetData()->widelyUsed, res)) //widelyUsed
{
#ifdef DEBUG_PREFIXES
- mm.insert(make_pair(BEST, _T("(widelyused_sent) ") + res));
+ mm.insert(make_pair(BEST, L"(widelyused_sent) " + res));
#else
mm.insert(make_pair(BEST, res));
#endif
@@ -189,7 +189,7 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact
if (FindExact(contactData, res, mind.GetData()->study, res)) //study
{
#ifdef DEBUG_PREFIXES
- mm.insert(make_pair(LOOKSLIKE, _T("(study_sent) ") + res));
+ mm.insert(make_pair(LOOKSLIKE, L"(study_sent) " + res));
#else
mm.insert(make_pair(LOOKSLIKE, res));
#endif
@@ -201,21 +201,21 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact
bool isQuestion;
SplitAndSortWords(res, keywords, otherwords, isQuestion);
//Part 7, 8
- res = _T("");
+ res = L"";
FindByKeywords(contactData, keywords, res/*, ures*/, isQuestion); //keywords
- if (res != _T("")) {
+ if (res != L"") {
#ifdef DEBUG_PREFIXES
- mm.insert(make_pair(LOOKSLIKE, _T("(keywords) ") + res));
+ mm.insert(make_pair(LOOKSLIKE, L"(keywords) " + res));
#else
mm.insert(make_pair(LOOKSLIKE, res));
#endif
if (maxValue > LOOKSLIKE)
maxValue = LOOKSLIKE;
}
- /* if (ures != _T(""))
+ /* if (ures != L"")
{
#ifdef DEBUG_PREFIXES
- mm.insert(make_pair(LOOKSLIKE2, _T("(keywords_unstrict) ")+ures));
+ mm.insert(make_pair(LOOKSLIKE2, L"(keywords_unstrict) "+ures));
#else
mm.insert(make_pair(LOOKSLIKE2, ures));
#endif
@@ -226,7 +226,7 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact
if (FindByOthers(contactData, otherwords, res, isQuestion)) //specialEscapes
{
#ifdef DEBUG_PREFIXES
- mm.insert(make_pair(BAD, _T("(otherwords) ") + res));
+ mm.insert(make_pair(BAD, L"(otherwords) " + res));
#else
mm.insert(make_pair(BAD, res));
#endif
@@ -239,7 +239,7 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact
if (FindAny(contactData->escape, res)) //escape
{
#ifdef DEBUG_PREFIXES
- mm.insert(make_pair(FAIL, _T("(escape) ") + res));
+ mm.insert(make_pair(FAIL, L"(escape) " + res));
#else
mm.insert(make_pair(FAIL, res));
#endif
@@ -250,7 +250,7 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact
if (!understandAlways && FindAny(contactData->failure, res)) //failure
{
#ifdef DEBUG_PREFIXES
- mm.insert(make_pair(FAIL, _T("(failure) ") + res));
+ mm.insert(make_pair(FAIL, L"(failure) " + res));
#else
mm.insert(make_pair(FAIL, res));
#endif
@@ -277,16 +277,16 @@ TalkBot::MessageInfo* TalkBot::Reply(MCONTACT contact, tstring incomingMessage,
const vector<tstring>& v = mind.GetData()->repeats;
tstring res = v[rand() % v.size()];
#ifdef DEBUG_PREFIXES
- info = new MessageInfo(incomingMessage, _T("(repeat_norm) ") + res);
+ info = new MessageInfo(incomingMessage, L"(repeat_norm) " + res);
#else
info = new MessageInfo(incomingMessage, res);
#endif
}
else
#ifdef DEBUG_PREFIXES
- info = new MessageInfo(incomingMessage, _T("(repeat_silence)"));
+ info = new MessageInfo(incomingMessage, L"(repeat_silence)");
#else
- info = new MessageInfo(incomingMessage, _T(""));
+ info = new MessageInfo(incomingMessage, L"");
#endif
if (saveChoice)
RecordAnswer(contactData, *info);
@@ -301,7 +301,7 @@ TalkBot::MessageInfo* TalkBot::Reply(MCONTACT contact, tstring incomingMessage,
if (!res.empty()) {
UpdateStartChar(res);
#ifdef DEBUG_PREFIXES
- MessageInfo *info = new MessageInfo(incomingMessage, _T("(widelyused_all) ") + res);
+ MessageInfo *info = new MessageInfo(incomingMessage, L"(widelyused_all) " + res);
#else
MessageInfo *info = new MessageInfo(incomingMessage, res);
#endif
@@ -317,7 +317,7 @@ TalkBot::MessageInfo* TalkBot::Reply(MCONTACT contact, tstring incomingMessage,
if (!res.empty()) {
UpdateStartChar(res);
#ifdef DEBUG_PREFIXES
- MessageInfo *info = new MessageInfo(incomingMessage, _T("(widelyused_all) ") + res);
+ MessageInfo *info = new MessageInfo(incomingMessage, L"(widelyused_all) " + res);
#else
MessageInfo *info = new MessageInfo(incomingMessage, res);
#endif
@@ -383,7 +383,7 @@ bool TalkBot::FindAny(ValueChooser<> &ch, tstring& res)
void TalkBot::SplitSectences(const tstring &incomingMessage, vector<tstring>& vec)
{
//FIXME: (THINK ABOUT IT:-))these chars not always mark the end of sentence.
- const TCHAR symbols[] = _T(".?!");
+ const TCHAR symbols[] = L".?!";
int it = 0, len = (int)incomingMessage.length();
while (it != len) {
while (it != len && _istspace(incomingMessage[it]))
@@ -410,11 +410,11 @@ tstring LevelToStr(TalkBot::Level target)
{
tstring lev;
switch (target) {
- case TalkBot::BEST: lev = _T("BEST(0)"); break;
- case TalkBot::LOOKSLIKE: lev = _T("LOOKSLIKE(1)"); break;
- case TalkBot::BAD: lev = _T("BAD(2)"); break;
- case TalkBot::FAIL: lev = _T("FAIL(3)"); break;
- case TalkBot::NOTHING: lev = _T("NOTHING(4)"); break;
+ case TalkBot::BEST: lev = L"BEST(0)"; break;
+ case TalkBot::LOOKSLIKE: lev = L"LOOKSLIKE(1)"; break;
+ case TalkBot::BAD: lev = L"BAD(2)"; break;
+ case TalkBot::FAIL: lev = L"FAIL(3)"; break;
+ case TalkBot::NOTHING: lev = L"NOTHING(4)"; break;
}
return lev;
}
@@ -423,13 +423,13 @@ tstring LevelToStr(TalkBot::Level target)
tstring TalkBot::ChooseResult(ContactData *contactData, Level maxValue, const multimap<Level, tstring> &mm)
{
#ifdef DEBUG_SHOW_VARIANTS
- AddBotMessage(_T(">>Availabe:"));
+ AddBotMessage(L">>Availabe:");
for (multimap<Level, tstring>::iterator it = mm.begin(); it != mm.end(); it++)
- AddBotMessage(LevelToStr((*it).first) + _T(": ") + (*it).second);
- AddBotMessage(_T(">>Result:"));
+ AddBotMessage(LevelToStr((*it).first) + L": " + (*it).second);
+ AddBotMessage(L">>Result:");
#endif
if (maxValue == NOTHING)
- return _T("");
+ return L"";
Level target = maxValue;
typedef multimap<Level, tstring>::const_iterator lt_cit;
pair<lt_cit, lt_cit> range = mm.equal_range(target);
@@ -437,7 +437,7 @@ tstring TalkBot::ChooseResult(ContactData *contactData, Level maxValue, const mu
contactData->chooser.AddChoice((*it).second);
#ifdef DEBUG_SHOW_LEVEL
tstring lev = LevelToStr(target);
- return lev + _T(": ") + contactData->chooser.Choose();
+ return lev + L": " + contactData->chooser.Choose();
#else
return contactData->chooser.Choose();
#endif
@@ -454,7 +454,7 @@ void TalkBot::FindByKeywords(ContactData *contactData, const vector<tstring> &ke
float prio;
if ((*it).first.MatchesAll(keywords/*, strict*/, prio))
#ifdef DEBUG_SHOW_SOLUTION_REASON
- contactData->chooser.AddChoice((tstring)(*it).first + _T(": - ") + (*it).second, prio);
+ contactData->chooser.AddChoice((tstring)(*it).first + L": - " + (*it).second, prio);
#else
contactData->chooser.AddChoice((*it).second, prio);
#endif
@@ -471,7 +471,7 @@ bool TalkBot::FindByOthers(ContactData *contactData, const vector<tstring> &othe
it != specs.end(); ++it)
if ((*it).first.MatchesAny(otherwords)) {
#ifdef DEBUG_SHOW_SOLUTION_REASON
- contactData->chooser.AddChoice((tstring)(*it).first + _T(": - ") + (*it).second);
+ contactData->chooser.AddChoice((tstring)(*it).first + L": - " + (*it).second);
#else
contactData->chooser.AddChoice((*it).second);
#endif
@@ -490,7 +490,7 @@ const Mind& TalkBot::GetMind() const
void TalkBot::SplitAndSortWords(tstring sentence, vector<tstring>& keywords,
vector<tstring>& otherwords, bool& isQuestion)
{
- const TCHAR dividers[] = _T(" \t\n\r,./?\\|;:'\"~!#^&*()_-+=[{]}—");
+ const TCHAR dividers[] = L" \t\n\r,./?\\|;:'\"~!#^&*()_-+=[{]}—";
int len = (int)sentence.length();
vector<tstring> words;
map<size_t, tstring> sm;
@@ -504,7 +504,7 @@ void TalkBot::SplitAndSortWords(tstring sentence, vector<tstring>& keywords,
if (mind.GetData()->smiles.find(item)
!= mind.GetData()->smiles.end()) {
sm[i] = item;
- sentence.replace(i, j, _T(" "));
+ sentence.replace(i, j, L" ");
break;
}
}
diff --git a/plugins/Boltun/src/Engine/UnrecentChooser.cpp b/plugins/Boltun/src/Engine/UnrecentChooser.cpp
index 3775c7a2e5..b0b5e1460e 100644
--- a/plugins/Boltun/src/Engine/UnrecentChooser.cpp
+++ b/plugins/Boltun/src/Engine/UnrecentChooser.cpp
@@ -60,7 +60,7 @@ tstring UnRecentChooser::Choose()
}
else
if (minimum == -1)
- res = _T("");
+ res = L"";
else
{
float minprio = maxOldPrio / 1.5F;
diff --git a/plugins/Boltun/src/Engine/ValueChooser.h b/plugins/Boltun/src/Engine/ValueChooser.h
index 0018ac8ff2..f82ceecbea 100644
--- a/plugins/Boltun/src/Engine/ValueChooser.h
+++ b/plugins/Boltun/src/Engine/ValueChooser.h
@@ -66,7 +66,7 @@ public:
{
Reset();
if (notifyOnReset)
- return _T("");
+ return L"";
}
int result;
while (numbers[result = rand() % data.size()])
diff --git a/plugins/Boltun/src/Engine/WordsList.cpp b/plugins/Boltun/src/Engine/WordsList.cpp
index 6593d28b3e..b111cc3414 100644
--- a/plugins/Boltun/src/Engine/WordsList.cpp
+++ b/plugins/Boltun/src/Engine/WordsList.cpp
@@ -31,7 +31,7 @@ WordsList::operator tstring() const
{
tstring res;
//if (unstrict)
- // res = _T("~");
+ // res = L"~";
set<tstring>::const_iterator it = words.begin();
if (!words.empty())
while (true)
@@ -39,11 +39,11 @@ WordsList::operator tstring() const
res += *it;
++it;
if (it != words.end())
- res += _T(" ");
+ res += L" ";
else
break;
}
- res += isQuestion ? _T("?") : _T(".");
+ res += isQuestion ? L"?" : L".";
return res;
}
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp
index 23f15ef080..8fb65dd806 100644
--- a/plugins/Boltun/src/boltun.cpp
+++ b/plugins/Boltun/src/boltun.cpp
@@ -48,7 +48,7 @@ PLUGININFOEX pluginInfo = {
static HGENMENU hMenuItemAutoChat, hMenuItemNotToChat, hMenuItemStartChatting;
-#define MIND_DIALOG_FILTER _T("%s (*.mindw)\1*.mindw\1%s (*.*)\1*.*\1")
+#define MIND_DIALOG_FILTER L"%s (*.mindw)\1*.mindw\1%s (*.*)\1*.*\1"
#ifdef DEBUG_LOAD_TIME
#include <intrin.h>
@@ -116,7 +116,7 @@ static bool LoadMind(const TCHAR* filename, int &line)
//exit(0);
#endif
SetCursor(oldCur);
- HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(IDR_SMILES), _T("SMILES"));
+ HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(IDR_SMILES), L"SMILES");
if (!hRes) {
delete mind;
return false;
diff --git a/plugins/Boltun/src/stdafx.h b/plugins/Boltun/src/stdafx.h
index 635d36b2d0..77b9614042 100644
--- a/plugins/Boltun/src/stdafx.h
+++ b/plugins/Boltun/src/stdafx.h
@@ -65,7 +65,7 @@
#define BOLTUN_GROUP LPGEN("Message sessions")
//Filename depends on UNICODE
-#define DEFAULT_MIND_FILE _T("boltun.mindw")
+#define DEFAULT_MIND_FILE L"boltun.mindw"
//===============================================
// These are strings for translation: