Skip to content

Commit d258c46

Browse files
authored
Add files via upload
1 parent f4fcafd commit d258c46

File tree

4 files changed

+47
-25
lines changed

4 files changed

+47
-25
lines changed

source/ClauText.cpp

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ namespace wiz {
6666
wiz::ClauText clautext;
6767
wiz::ExecuteData executeData;
6868
executeData.pEvents = eventUT;
69+
executeData.noUseInput = true;
70+
executeData.noUseOutput = true;
6971
wiz::Option option;
7072

7173
std::string statements;
@@ -441,6 +443,8 @@ namespace wiz {
441443
wiz::ClauText clautext;
442444
wiz::ExecuteData executeData;
443445
executeData.pEvents = insert_ut->GetParent();
446+
executeData.noUseInput = true;
447+
executeData.noUseOutput = true;
444448
wiz::Option option;
445449

446450
std::string statements;
@@ -471,6 +475,8 @@ namespace wiz {
471475
wiz::ClauText clautext;
472476
wiz::ExecuteData executeData;
473477
executeData.pEvents = insert_ut->GetParent();
478+
executeData.noUseInput = true;
479+
executeData.noUseOutput = true;
474480
wiz::Option option;
475481

476482
std::string statements;
@@ -588,6 +594,8 @@ namespace wiz {
588594
wiz::ClauText clautext;
589595
wiz::ExecuteData executeData;
590596
executeData.pEvents = insert_ut->GetParent();
597+
executeData.noUseInput = true;
598+
executeData.noUseOutput = true;
591599
wiz::Option option;
592600

593601
wiz::load_data::UserType callUT;
@@ -643,6 +651,8 @@ namespace wiz {
643651
wiz::ClauText clautext;
644652
wiz::ExecuteData executeData;
645653
executeData.pEvents = insert_ut->GetParent();
654+
executeData.noUseInput = true;
655+
executeData.noUseOutput = true;
646656
wiz::Option option;
647657
wiz::load_data::UserType callUT;
648658
std::string statements;
@@ -819,6 +829,8 @@ namespace wiz {
819829
wiz::ClauText clautext;
820830
wiz::ExecuteData executeData;
821831
executeData.pEvents = insert_ut->GetParent();
832+
executeData.noUseInput = true;
833+
executeData.noUseOutput = true;
822834
wiz::Option option;
823835

824836
wiz::load_data::UserType callUT;
@@ -1015,7 +1027,9 @@ std::string ClauText::execute_module(const std::string& MainStr, wiz::load_data:
10151027
if (executeData.chkInfo == false) { /// chk smartpointer.
10161028
if (global.GetUserTypeItem("Main").empty() && MainStr.empty())
10171029
{
1018-
wiz::Out << "do not exist Main" << ENTER;
1030+
if (!executeData.noUseOutput) {
1031+
wiz::Out << "do not exist Main" << ENTER;
1032+
}
10191033
return "ERROR -1";
10201034
}
10211035

@@ -2276,7 +2290,7 @@ std::string ClauText::execute_module(const std::string& MainStr, wiz::load_data:
22762290
}
22772291
else //
22782292
{
2279-
// std::cout << val->GetUserTypeList(0)->ToString() << "\n";
2293+
// wiz::Out << val->GetUserTypeList(0)->ToString() << "\n";
22802294
dir = wiz::load_data::LoadData::ToBool4(nullptr, global, *val->GetUserTypeList(0), _executeData).ToString();
22812295
is2 = true;
22822296
}
@@ -2530,7 +2544,7 @@ std::string ClauText::execute_module(const std::string& MainStr, wiz::load_data:
25302544
wiz::Out << temp;
25312545
}
25322546
else {
2533-
//std::cout << global.ToString() << "\n";
2547+
//wiz::Out << global.ToString() << "\n";
25342548
wiz::load_data::UserType* ut = wiz::load_data::UserType::Find(&global, listName).second[0];
25352549
if (ut->GetItemListSize() == 0 && wiz::ToString(ut->GetItemList(0).GetName()).empty()) {
25362550
wiz::Out << wiz::ToString(ut->GetItemList(0).Get(0));
@@ -2633,7 +2647,7 @@ std::string ClauText::execute_module(const std::string& MainStr, wiz::load_data:
26332647
//int a = clock();
26342648
if (wiz::load_data::LoadData::LoadDataFromFile(fileName, ut)) {
26352649
//int b = clock();
2636-
//std::cout << b - a << "ms\n";
2650+
//wiz::Out << b - a << "ms\n";
26372651
{
26382652

26392653
int item_count = 0;
@@ -2656,8 +2670,9 @@ std::string ClauText::execute_module(const std::string& MainStr, wiz::load_data:
26562670
if (!_Main.empty())
26572671
{
26582672
// error!
2659-
wiz::Out << "err" << ENTER;
2660-
2673+
if (executeData.noUseOutput) {
2674+
wiz::Out << "err" << ENTER;
2675+
}
26612676
return "ERROR -2"; /// exit?
26622677
}
26632678
}
@@ -2795,7 +2810,7 @@ std::string ClauText::execute_module(const std::string& MainStr, wiz::load_data:
27952810
//int a = clock();
27962811
if (wiz::load_data::LoadData::LoadDataFromFileWithJson(fileName, ut)) {
27972812
//int b = clock();
2798-
//std::cout << b - a << "ms\n";
2813+
//wiz::Out << b - a << "ms\n";
27992814
{
28002815
//for (int i = 0; i < ut.GetCommentListSize(); ++i) {
28012816
// utTemp->PushComment(std::move(ut.GetCommentList(i)));
@@ -3357,7 +3372,9 @@ std::string ClauText::execute_module(const std::string& MainStr, wiz::load_data:
33573372
else
33583373
{
33593374
// debug..
3360-
wiz::Out << "Error Debug : " << cond << ENTER;
3375+
if (!executeData.noUseOutput) {
3376+
wiz::Out << "Error Debug : " << cond << ENTER;
3377+
}
33613378
return "ERROR -3";
33623379
}
33633380
}
@@ -3381,8 +3398,9 @@ std::string ClauText::execute_module(const std::string& MainStr, wiz::load_data:
33813398
}
33823399
}
33833400
else { //
3384-
wiz::Out << "it does not work. : " << wiz::ToString(val->GetName()) << ENTER;
3385-
3401+
if (!executeData.noUseOutput) {
3402+
wiz::Out << "it does not work. : " << wiz::ToString(val->GetName()) << ENTER;
3403+
}
33863404
eventStack.top().userType_idx.top()++;
33873405
break;
33883406
}
@@ -3507,7 +3525,7 @@ void ClauText::ShellMode(wiz::load_data::UserType& global, const ExecuteData& ex
35073525
if ("$print" == command) {
35083526
wiz::Out << ">> : global" << ENTER;
35093527
//cout << global.ToString() << endl;
3510-
global.Save1(std::cout);
3528+
global.Save1(std::cout); /// todo - change cout?
35113529
wiz::Out << ENTER;
35123530
}
35133531
else if ("$print_data_only" == command) {

source/global.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ namespace wiz {
124124
:str_value(cstr, len)
125125
{
126126
if (len < 0) {
127-
std::cout << "chk\n";
127+
wiz::Out << "chk\n";
128128
}
129129

130130
if (USE_REMOVE_IN_DATATYPE) {
@@ -152,7 +152,7 @@ namespace wiz {
152152
DataType::DataType(const char* cstr, size_t len, const LineInfo& opt)
153153
{
154154
if (len < 0) {
155-
std::cout << "chk\n";
155+
wiz::Out << "chk\n";
156156
}
157157
this->str_value = std::string(cstr, len);
158158

source/load_data.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ namespace wiz {
537537

538538
if ('/' == x[0])
539539
{
540-
// std::cout << global.ToString();
540+
// wiz::Out << global.ToString();
541541

542542
wiz::load_data::UserType* ut = wiz::load_data::UserType::Find(&global, x).second[0];
543543
x = wiz::toStr(ut->GetItemListSize());
@@ -1050,7 +1050,9 @@ namespace wiz {
10501050

10511051
else {
10521052
if (wiz::String::startsWith(str.ToString(), "$") && str.ToString().size() >= 2) {
1053-
wiz::Out << "no exist in load-data " << str.ToString() << ENTER;
1053+
if (!executeData.noUseOutput) {
1054+
wiz::Out << "no exist in load-data " << str.ToString() << ENTER;
1055+
}
10541056
return false;
10551057
}
10561058
return true;
@@ -1140,11 +1142,11 @@ namespace wiz {
11401142
}
11411143
}
11421144

1143-
//std::cout << temp.GetName() << " ";
1145+
//wiz::Out << temp.GetName() << " ";
11441146
//for (int i = 0; i < operandStack.size(); ++i) {
1145-
//std::cout << operandStack[i] << " ";
1147+
//wiz::Out << operandStack[i] << " ";
11461148
//}
1147-
//std::cout << "\n";
1149+
//wiz::Out << "\n";
11481150
if (String::startsWith(temp.GetName(), "$") && temp.GetName().size() > 1) {
11491151
wiz::ArrayStack<WIZ_STRING_TYPE> _stack;
11501152

@@ -1153,12 +1155,14 @@ namespace wiz {
11531155
}
11541156

11551157
if (!operation(now, global, temp.GetName(), _stack, executeData)) {
1156-
wiz::Out << "operation ERROR";
1158+
if (!executeData.noUseOutput) {
1159+
wiz::Out << "operation ERROR";
1160+
}
11571161
}
11581162

11591163
result = _stack.top();
11601164
}
1161-
//std::cout << "result is " << result << "\n";
1165+
//wiz::Out << "result is " << result << "\n";
11621166
return result;
11631167
}
11641168

@@ -1179,14 +1183,14 @@ namespace wiz {
11791183

11801184
for (int i = 0; i < tokens.size(); ++i) {
11811185
WIZ_STRING_TYPE _temp = ToBool4(now, global, tokens[i], executeData);
1182-
//std::cout << "chk " << _temp << " ";
1186+
//wiz::Out << "chk " << _temp << " ";
11831187
_result += _temp;
11841188

11851189
if (i < tokens.size() - 1) {
11861190
_result += "/";
11871191
}
11881192
}
1189-
//std::cout << "\n";
1193+
//wiz::Out << "\n";
11901194

11911195
return result + ToBool4(now, global, _result.ToString(), executeData);
11921196
}

source/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int main(int argc, char* argv[])
3232

3333

3434
if (argc == 1) {
35-
std::cout << "FileName: ";
35+
wiz::Out << "FileName: ";
3636
std::getline(std::cin, fileName);
3737
}
3838
else
@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
5858
a = clock();
5959
{
6060

61-
wiz::load_data::LoadData::LoadDataFromFile(fileName, global, 1, 1);
61+
wiz::load_data::LoadData::LoadDataFromFile(fileName, global, 1, 1); // only 1 1 // 0 or > 1 -> different work..
6262

6363
}
6464
b = clock();
@@ -76,7 +76,7 @@ int main(int argc, char* argv[])
7676
wiz::Out << "fileName is " << fileName << ENTER;
7777

7878
//wiz::load_data::LoadData::SaveWizDB(global, "test2.eu4", "3"); // 3 : JSON
79-
//std::cout << global.ToString() << "\n";
79+
//wiz::Out << global.ToString() << "\n";
8080

8181
wiz::Option opt;
8282
{

0 commit comments

Comments
 (0)