git-svn-id: svn://db.shs.com.ru/pip@283 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-11-23 15:10:40 +00:00
parent 8f6e7d2cae
commit e66e78ac16
29 changed files with 973 additions and 973 deletions

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
C++ code parser C++ code parser
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "picodeparser.h" #include "picodeparser.h"
@@ -42,7 +42,7 @@ PIString PICodeParser::Macro::expand(PIString args_, bool * ok) const {
} }
if (args.size() != arg_vals.size()) { if (args.size() != arg_vals.size()) {
piCout << ("Error: in expansion of macro \"" + name + "(" + args.join(", ") + ")\": expect") piCout << ("Error: in expansion of macro \"" + name + "(" + args.join(", ") + ")\": expect")
<< args.size() << "arguments but takes" << arg_vals.size() << "!"; << args.size() << "arguments but takes" << arg_vals.size() << "!";
if (ok != 0) *ok = false; if (ok != 0) *ok = false;
return PIString(); return PIString();
} }
@@ -54,7 +54,7 @@ PIString PICodeParser::Macro::expand(PIString args_, bool * ok) const {
PIChar ppc(0), pc(0), nc(0); PIChar ppc(0), pc(0), nc(0);
if (ind > 1) ppc = ret[ind - 2]; if (ind > 1) ppc = ret[ind - 2];
if (ind > 0) pc = ret[ind - 1]; if (ind > 0) pc = ret[ind - 1];
if (ind + an.size_s() < ret.size_s()) nc = ret.mid(ind + an.size_s(),1)[0]; if (ind + an.size_s() < ret.size_s()) nc = ret.mid(ind + an.size_s(),1)[0];
if (ppc != '#' && pc == '#' && !_isCChar(nc)) { // to chars if (ppc != '#' && pc == '#' && !_isCChar(nc)) { // to chars
ind--; ind--;
ret.replace(ind, an.size_s() + 1, "\"" + av + "\""); ret.replace(ind, an.size_s() + 1, "\"" + av + "\"");
@@ -105,7 +105,7 @@ void PICodeParser::parseFile(const PIString & file, bool follow_includes) {
void PICodeParser::parseFiles(const PIStringList & files, bool follow_includes) { void PICodeParser::parseFiles(const PIStringList & files, bool follow_includes) {
clear(); clear();
piForeachC (PIString & f, files) piForeachC (PIString & f, files)
parseFileInternal(f, follow_includes); parseFileInternal(f, follow_includes);
/*piCout << "\n\nDefines:"; /*piCout << "\n\nDefines:";
piForeachC (Define & m, defines) piForeachC (Define & m, defines)
piCout << "define" << m.first << m.second; piCout << "define" << m.first << m.second;
@@ -126,7 +126,7 @@ void PICodeParser::parseFiles(const PIStringList & files, bool follow_includes)
bool PICodeParser::isEnum(const PIString & name) { bool PICodeParser::isEnum(const PIString & name) {
piForeachC (Enum & e, enums) piForeachC (Enum & e, enums)
if (e.name == name) if (e.name == name)
return true; return true;
return false; return false;
} }
@@ -170,7 +170,7 @@ void PICodeParser::clear() {
cur_namespace.clear(); cur_namespace.clear();
main_file.clear(); main_file.clear();
evaluator.clearCustomVariables(); evaluator.clearCustomVariables();
cur_def_vis = Global; cur_def_vis = Global;
defines << Define("PICODE", "") << custom_defines; defines << Define("PICODE", "") << custom_defines;
} }
@@ -231,7 +231,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
while ((ind = pfc.find(d.first, ind + 1)) >= 0) { while ((ind = pfc.find(d.first, ind + 1)) >= 0) {
PIChar pc(0), nc(0); PIChar pc(0), nc(0);
if (ind > 0) pc = pfc[ind - 1]; if (ind > 0) pc = pfc[ind - 1];
if (ind + d.first.size_s() < pfc.size_s()) nc = pfc.mid(ind + d.first.size_s(),1)[0]; if (ind + d.first.size_s() < pfc.size_s()) nc = pfc.mid(ind + d.first.size_s(),1)[0];
if (_isCChar(pc) || _isCChar(nc) || nc.isDigit()) continue; if (_isCChar(pc) || _isCChar(nc) || nc.isDigit()) continue;
pfc.replace(ind, d.first.size_s(), d.second); pfc.replace(ind, d.first.size_s(), d.second);
ind -= d.first.size_s() - d.second.size_s(); ind -= d.first.size_s() - d.second.size_s();
@@ -243,7 +243,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
while ((ind = pfc.find(m.name, ind + 1)) >= 0) { while ((ind = pfc.find(m.name, ind + 1)) >= 0) {
PIChar pc(0), nc(0); PIChar pc(0), nc(0);
if (ind > 0) pc = pfc[ind - 1]; if (ind > 0) pc = pfc[ind - 1];
if (ind + m.name.size_s() < pfc.size_s()) nc = pfc.mid(ind + m.name.size_s(),1)[0]; if (ind + m.name.size_s() < pfc.size_s()) nc = pfc.mid(ind + m.name.size_s(),1)[0];
if (_isCChar(pc) || _isCChar(nc) || nc.isDigit()) continue; if (_isCChar(pc) || _isCChar(nc) || nc.isDigit()) continue;
PIString ret, range; bool ok(false); PIString ret, range; bool ok(false);
range = pfc.mid(ind + m.name.size_s()).takeRange("(", ")"); range = pfc.mid(ind + m.name.size_s()).takeRange("(", ")");
@@ -483,7 +483,7 @@ bool PICodeParser::parseMember(Entity * parent, PIString & fc) {
int i = 0; int i = 0;
//piCout << me.arguments_full; //piCout << me.arguments_full;
piForeach (PIString & a, me.arguments_full) piForeach (PIString & a, me.arguments_full)
if ((i = a.find("=")) > 0) if ((i = a.find("=")) > 0)
a.cutRight(a.size_s() - i).trim(); a.cutRight(a.size_s() - i).trim();
for (int j = 0; j < me.arguments_full.size_s(); ++j) for (int j = 0; j < me.arguments_full.size_s(); ++j)
if (me.arguments_full[j] == "void") { if (me.arguments_full[j] == "void") {
@@ -596,21 +596,21 @@ void PICodeParser::normalizeEntityNamespace(PIString & n) {
} }
} }
piForeachC (Enum & e, enums) piForeachC (Enum & e, enums)
if ((f = e.name.find(n)) >= 0) if ((f = e.name.find(n)) >= 0)
if (e.name.mid(f - 1, 1) == ":") if (e.name.mid(f - 1, 1) == ":")
if (e.name.find(cur_namespace) >= 0) { if (e.name.find(cur_namespace) >= 0) {
//piCout << "change" << n << "to" << e.name + suff; //piCout << "change" << n << "to" << e.name + suff;
n = pref + e.name + suff; n = pref + e.name + suff;
return; return;
} }
piForeachC (Typedef & e, typedefs) piForeachC (Typedef & e, typedefs)
if ((f = e.first.find(n)) >= 0) if ((f = e.first.find(n)) >= 0)
if (e.first.mid(f - 1, 1) == ":") if (e.first.mid(f - 1, 1) == ":")
if (e.first.find(cur_namespace) >= 0) { if (e.first.find(cur_namespace) >= 0) {
//piCout << "change" << n << "to" << e.name + suff; //piCout << "change" << n << "to" << e.name + suff;
n = pref + e.first + suff; n = pref + e.first + suff;
return; return;
} }
n = (pref + n + suff).trim(); n = (pref + n + suff).trim();
} }
@@ -669,8 +669,8 @@ double PICodeParser::procMacrosCond(PIString fc) {
//piCout << "oper" << oper << "with" << ce; //piCout << "oper" << oper << "with" << ce;
if (!br) brv = defineValue(ce); if (!br) brv = defineValue(ce);
switch (oper) { switch (oper) {
case 1: ret = ret && (neg ? -brv : brv); break; case 1: ret = ret && (neg ? -brv : brv); break;
case 2: ret = ret || (neg ? -brv : brv); break; case 2: ret = ret || (neg ? -brv : brv); break;
} }
} }
if (ps == fc.size_s()) fc.cutLeft(1); if (ps == fc.size_s()) fc.cutLeft(1);
@@ -702,7 +702,7 @@ double PICodeParser::defineValue(const PIString & dn) {
PICodeParser::Entity * PICodeParser::findEntityByName(const PIString & en) { PICodeParser::Entity * PICodeParser::findEntityByName(const PIString & en) {
piForeach (Entity * e, entities) piForeach (Entity * e, entities)
if (e->name == en) if (e->name == en)
return e; return e;
return 0; return 0;
} }

View File

@@ -2,22 +2,22 @@
* \brief C++ code parser * \brief C++ code parser
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
C++ code parser C++ code parser
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Console output/input Console output/input
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "piconsole.h" #include "piconsole.h"
@@ -62,14 +62,14 @@ extern PIMutex __PICout_mutex__;
PRIVATE_DEFINITION_START(PIConsole) PRIVATE_DEFINITION_START(PIConsole)
#ifdef WINDOWS #ifdef WINDOWS
void getWinCurCoord() {GetConsoleScreenBufferInfo(hOut, &csbi); ccoord = csbi.dwCursorPosition;} void getWinCurCoord() {GetConsoleScreenBufferInfo(hOut, &csbi); ccoord = csbi.dwCursorPosition;}
COORD & getWinCoord(int dx = 0, int dy = 0) {getWinCurCoord(); ccoord.X += dx; ccoord.Y += dy; return ccoord;} COORD & getWinCoord(int dx = 0, int dy = 0) {getWinCurCoord(); ccoord.X += dx; ccoord.Y += dy; return ccoord;}
void * hOut; void * hOut;
CONSOLE_SCREEN_BUFFER_INFO sbi, csbi; CONSOLE_SCREEN_BUFFER_INFO sbi, csbi;
CONSOLE_CURSOR_INFO curinfo; CONSOLE_CURSOR_INFO curinfo;
COORD ccoord, ulcoord; COORD ccoord, ulcoord;
WORD dattr; WORD dattr;
DWORD smode, written; DWORD smode, written;
#endif #endif
PRIVATE_DEFINITION_END(PIConsole) PRIVATE_DEFINITION_END(PIConsole)
@@ -416,7 +416,7 @@ inline int PIConsole::couts(const double v) {
} }
inline int PIConsole::couts(const PISystemTime & v) { inline int PIConsole::couts(const PISystemTime & v) {
switch (systime_format) {case (1): return printf("%.6lg", v.toSeconds()); break; switch (systime_format) {case (1): return printf("%.6lg", v.toSeconds()); break;
default: return couts(v.seconds) + printf(" s, ") + couts(v.nanoseconds) + printf(" ns"); break;} default: return couts(v.seconds) + printf(" s, ") + couts(v.nanoseconds) + printf(" ns"); break;}
} }
@@ -426,7 +426,7 @@ void PIConsole::moveRight(int n) {SetConsoleCursorPosition(PRIVATE->hOut, PRIVAT
void PIConsole::moveLeft(int n) {SetConsoleCursorPosition(PRIVATE->hOut, PRIVATE->getWinCoord(-n));} void PIConsole::moveLeft(int n) {SetConsoleCursorPosition(PRIVATE->hOut, PRIVATE->getWinCoord(-n));}
void PIConsole::moveTo(int x, int y) {PRIVATE->ccoord.X = x; PRIVATE->ccoord.Y = PRIVATE->ulcoord.Y + y; SetConsoleCursorPosition(PRIVATE->hOut, PRIVATE->ccoord);} void PIConsole::moveTo(int x, int y) {PRIVATE->ccoord.X = x; PRIVATE->ccoord.Y = PRIVATE->ulcoord.Y + y; SetConsoleCursorPosition(PRIVATE->hOut, PRIVATE->ccoord);}
void PIConsole::clearScreen() {couts(fstr(Normal)); toUpperLeft(); FillConsoleOutputAttribute(PRIVATE->hOut, PRIVATE->dattr, width * (height + 1), PRIVATE->ulcoord, &PRIVATE->written); void PIConsole::clearScreen() {couts(fstr(Normal)); toUpperLeft(); FillConsoleOutputAttribute(PRIVATE->hOut, PRIVATE->dattr, width * (height + 1), PRIVATE->ulcoord, &PRIVATE->written);
FillConsoleOutputCharacter(PRIVATE->hOut, ' ', width * (height + 1), PRIVATE->ulcoord, &PRIVATE->written);} FillConsoleOutputCharacter(PRIVATE->hOut, ' ', width * (height + 1), PRIVATE->ulcoord, &PRIVATE->written);}
void PIConsole::clearScreenLower() {couts(fstr(Normal)); PRIVATE->getWinCurCoord(); FillConsoleOutputAttribute(PRIVATE->hOut, PRIVATE->dattr, width * height - width * PRIVATE->ccoord.Y + PRIVATE->ccoord.X, PRIVATE->ccoord, &PRIVATE->written); void PIConsole::clearScreenLower() {couts(fstr(Normal)); PRIVATE->getWinCurCoord(); FillConsoleOutputAttribute(PRIVATE->hOut, PRIVATE->dattr, width * height - width * PRIVATE->ccoord.Y + PRIVATE->ccoord.X, PRIVATE->ccoord, &PRIVATE->written);
FillConsoleOutputCharacter(PRIVATE->hOut, ' ', width * height - width * PRIVATE->ccoord.Y + PRIVATE->ccoord.X, PRIVATE->ccoord, &PRIVATE->written);} FillConsoleOutputCharacter(PRIVATE->hOut, ' ', width * height - width * PRIVATE->ccoord.Y + PRIVATE->ccoord.X, PRIVATE->ccoord, &PRIVATE->written);}
void PIConsole::clearLine() {PRIVATE->getWinCurCoord(); FillConsoleOutputAttribute(PRIVATE->hOut, PRIVATE->dattr, width - PRIVATE->ccoord.X, PRIVATE->ccoord, &PRIVATE->written); void PIConsole::clearLine() {PRIVATE->getWinCurCoord(); FillConsoleOutputAttribute(PRIVATE->hOut, PRIVATE->dattr, width - PRIVATE->ccoord.X, PRIVATE->ccoord, &PRIVATE->written);
@@ -480,51 +480,51 @@ void PIConsole::run() {
toUpperLeft(); toUpperLeft();
if (max_y < cvars.size()) max_y = cvars.size(); if (max_y < cvars.size()) max_y = cvars.size();
j = 0; j = 0;
piForeachC (Variable & tv_, cvars) { piForeachC (Variable & tv_, cvars) {
if (j > height - 3) continue; if (j > height - 3) continue;
j++; j++;
moveRight(cx); moveRight(cx);
if (tv_.type == 15) { if (tv_.type == 15) {
newLine(); newLine();
continue; continue;
} }
moveRight(tv_.offset); moveRight(tv_.offset);
const void * ptr = 0; const void * ptr = 0;
if (tv_.remote) { if (tv_.remote) {
if (tv_.type == 0) { if (tv_.type == 0) {
rstr.clear(); rstr.clear();
rba = tv_.rdata; rba = tv_.rdata;
rba >> rstr; rba >> rstr;
rstr.trim(); rstr.trim();
ptr = &rstr; ptr = &rstr;
} else } else
ptr = tv_.rdata.data(); ptr = tv_.rdata.data();
} else } else
ptr = tv_.ptr; ptr = tv_.ptr;
switch (tv_.type) { switch (tv_.type) {
case 0: clen = printValue(ptr != 0 ? *(const PIString*)ptr : PIString(), tv_.format); break; case 0: clen = printValue(ptr != 0 ? *(const PIString*)ptr : PIString(), tv_.format); break;
case 1: clen = printValue(ptr != 0 ? *(const bool*)ptr : false, tv_.format); break; case 1: clen = printValue(ptr != 0 ? *(const bool*)ptr : false, tv_.format); break;
case 2: clen = printValue(ptr != 0 ? *(const int*)ptr : 0, tv_.format); break; case 2: clen = printValue(ptr != 0 ? *(const int*)ptr : 0, tv_.format); break;
case 3: clen = printValue(ptr != 0 ? *(const long*)ptr : 0l, tv_.format); break; case 3: clen = printValue(ptr != 0 ? *(const long*)ptr : 0l, tv_.format); break;
case 4: clen = printValue(ptr != 0 ? *(const char*)ptr : char(0), tv_.format); break; case 4: clen = printValue(ptr != 0 ? *(const char*)ptr : char(0), tv_.format); break;
case 5: clen = printValue(ptr != 0 ? *(const float*)ptr : 0.f, tv_.format); break; case 5: clen = printValue(ptr != 0 ? *(const float*)ptr : 0.f, tv_.format); break;
case 6: clen = printValue(ptr != 0 ? *(const double*)ptr : 0., tv_.format); break; case 6: clen = printValue(ptr != 0 ? *(const double*)ptr : 0., tv_.format); break;
case 7: clen = printValue(ptr != 0 ? *(const short*)ptr : short(0), tv_.format); break; case 7: clen = printValue(ptr != 0 ? *(const short*)ptr : short(0), tv_.format); break;
case 8: clen = printValue(ptr != 0 ? *(const uint*)ptr : 0u, tv_.format); break; case 8: clen = printValue(ptr != 0 ? *(const uint*)ptr : 0u, tv_.format); break;
case 9: clen = printValue(ptr != 0 ? *(const ulong*)ptr : 0ul, tv_.format); break; case 9: clen = printValue(ptr != 0 ? *(const ulong*)ptr : 0ul, tv_.format); break;
case 10: clen = printValue(ptr != 0 ? *(const ushort*)ptr : ushort(0), tv_.format); break; case 10: clen = printValue(ptr != 0 ? *(const ushort*)ptr : ushort(0), tv_.format); break;
case 11: clen = printValue(ptr != 0 ? *(const uchar*)ptr : uchar(0), tv_.format); break; case 11: clen = printValue(ptr != 0 ? *(const uchar*)ptr : uchar(0), tv_.format); break;
case 12: clen = printValue(ptr != 0 ? *(const llong*)ptr : 0l, tv_.format); break; case 12: clen = printValue(ptr != 0 ? *(const llong*)ptr : 0l, tv_.format); break;
case 13: clen = printValue(ptr != 0 ? *(const ullong*)ptr: 0ull, tv_.format); break; case 13: clen = printValue(ptr != 0 ? *(const ullong*)ptr: 0ull, tv_.format); break;
case 20: clen = printValue(ptr != 0 ? *(const PISystemTime*)ptr: PISystemTime(), tv_.format); break; case 20: clen = printValue(ptr != 0 ? *(const PISystemTime*)ptr: PISystemTime(), tv_.format); break;
case 14: clen = printValue(bitsValue(ptr, tv_.bitFrom, tv_.bitCount), tv_.format); break; case 14: clen = printValue(bitsValue(ptr, tv_.bitFrom, tv_.bitCount), tv_.format); break;
} }
if (clen + tv_.offset < (uint)col_wid) { if (clen + tv_.offset < (uint)col_wid) {
PIString ts = PIString( PIString ts = PIString(
#if defined(QNX) || defined(FREE_BSD) #if defined(QNX) || defined(FREE_BSD)
col_wid - clen - tv_.offset - 1, ' '); col_wid - clen - tv_.offset - 1, ' ');
#else #else
col_wid - clen - tv_.offset, ' '); col_wid - clen - tv_.offset, ' ');
#endif #endif
printf("%s", ts.data()); printf("%s", ts.data());
} }
@@ -563,9 +563,9 @@ void PIConsole::fillLabels() {
if (ccol.alignment != Nothing) { if (ccol.alignment != Nothing) {
mx = 0; mx = 0;
piForeachC (Variable & j, cvars) piForeachC (Variable & j, cvars)
if (!j.isEmpty()) if (!j.isEmpty())
if (mx < j.name.size()) if (mx < j.name.size())
mx = j.name.size(); mx = j.name.size();
mx += 2; mx += 2;
} }
cx = col_wid * i; cx = col_wid * i;
@@ -575,10 +575,10 @@ void PIConsole::fillLabels() {
if (int(j) > height - 3) continue; if (int(j) > height - 3) continue;
if (max_y < j) max_y = j; if (max_y < j) max_y = j;
moveRight(cx); moveRight(cx);
Variable & tv_(cvars[j]); Variable & tv_(cvars[j]);
cvars[j].nx = cx; cvars[j].nx = cx;
cvars[j].ny = cy; cvars[j].ny = cy;
if (tv_.name.isEmpty()) { if (tv_.name.isEmpty()) {
cvars[j].offset = 0; cvars[j].offset = 0;
clearLine(); clearLine();
newLine(); newLine();
@@ -586,34 +586,34 @@ void PIConsole::fillLabels() {
continue; continue;
} }
clearLine(); clearLine();
//piCout << tv_.name << tv_.type << tv_.ptr; //piCout << tv_.name << tv_.type << tv_.ptr;
if (tv_.type == 15) { if (tv_.type == 15) {
cvars[j].offset = cvars[j].name.length(); cvars[j].offset = cvars[j].name.length();
cvars[j].nx += cvars[j].offset; cvars[j].nx += cvars[j].offset;
printLine(tv_.name, cx, tv_.format); printLine(tv_.name, cx, tv_.format);
newLine(); newLine();
cy++; cy++;
continue; continue;
} }
if (!tv_.isEmpty()) { if (!tv_.isEmpty()) {
switch (ccol.alignment) { switch (ccol.alignment) {
case Nothing: case Nothing:
cvars[j].offset = (tv_.name + ": ").length(); cvars[j].offset = (tv_.name + ": ").length();
cvars[j].nx += cvars[j].offset; cvars[j].nx += cvars[j].offset;
printValue(tv_.name + ": ", tv_.format); printValue(tv_.name + ": ", tv_.format);
break; break;
case Left: case Left:
cvars[j].offset = mx; cvars[j].offset = mx;
cvars[j].nx += cvars[j].offset; cvars[j].nx += cvars[j].offset;
printValue(tv_.name + ": ", tv_.format); printValue(tv_.name + ": ", tv_.format);
break; break;
case Right: case Right:
cvars[j].offset = mx; cvars[j].offset = mx;
cvars[j].nx += cvars[j].offset; cvars[j].nx += cvars[j].offset;
dx = mx - (tv_.name + ": ").length(); dx = mx - (tv_.name + ": ").length();
moveRight(dx); moveRight(dx);
printValue(tv_.name + ": ", tv_.format); printValue(tv_.name + ": ", tv_.format);
moveLeft(dx); moveLeft(dx);
break; break;
} }
} }
@@ -827,9 +827,9 @@ PIString PIConsole::getString(int x, int y) {
PIString PIConsole::getString(const PIString & name) { PIString PIConsole::getString(const PIString & name) {
piForeachC (Column & i, tabs[cur_tab].columns) piForeachC (Column & i, tabs[cur_tab].columns)
piForeachC (Variable & j, i.variables) piForeachC (Variable & j, i.variables)
if (j.name == name) if (j.name == name)
return getString(j.nx + 1, j.ny); return getString(j.nx + 1, j.ny);
return PIString(); return PIString();
} }
@@ -949,29 +949,29 @@ void PIConsole::serverSendData() {
PIByteArray ba; PIByteArray ba;
PIVector<VariableContent> content; PIVector<VariableContent> content;
piForeach (Tab & t, tabs) piForeach (Tab & t, tabs)
piForeach (Column & c, t.columns) piForeach (Column & c, t.columns)
piForeach (Variable & v, c.variables) piForeach (Variable & v, c.variables)
if (!v.isEmpty() && v.id > 0) { if (!v.isEmpty() && v.id > 0) {
VariableContent vc; VariableContent vc;
vc.id = v.id; vc.id = v.id;
v.writeData(vc.rdata); v.writeData(vc.rdata);
content << vc; content << vc;
} }
piForeach (RemoteClient & rc, remote_clients) { piForeach (RemoteClient & rc, remote_clients) {
ba.clear(); ba.clear();
switch (rc.state) { switch (rc.state) {
case FetchingData: case FetchingData:
ba << int(0xCC) << tabs; ba << int(0xCC) << tabs;
//piCout << "server send const data" << rc.name << ba.size_s(); //piCout << "server send const data" << rc.name << ba.size_s();
break; break;
case Committing: case Committing:
ba << int(0xDD); ba << int(0xDD);
break; break;
case Connected: case Connected:
ba << int(0xEE) << content; ba << int(0xEE) << content;
//piCout << "send data" << ba.size(); //piCout << "send data" << ba.size();
break; break;
default: break; default: break;
} }
if (!ba.isEmpty()) if (!ba.isEmpty())
peer->send(rc.name, ba); peer->send(rc.name, ba);
@@ -981,7 +981,7 @@ void PIConsole::serverSendData() {
PIConsole::RemoteClient & PIConsole::remoteClient(const PIString & fname) { PIConsole::RemoteClient & PIConsole::remoteClient(const PIString & fname) {
piForeach (RemoteClient & i, remote_clients) piForeach (RemoteClient & i, remote_clients)
if (i.name == fname) if (i.name == fname)
return i; return i;
remote_clients << RemoteClient(fname); remote_clients << RemoteClient(fname);
return remote_clients.back(); return remote_clients.back();
@@ -998,17 +998,17 @@ void PIConsole::peerReceived(const PIString & from, const PIByteArray & data) {
//PIString rcn = from.right(from.length() - 6); //PIString rcn = from.right(from.length() - 6);
RemoteClient & rc(remoteClient(from)); RemoteClient & rc(remoteClient(from));
switch (type) { switch (type) {
case 0xBB: // fetch const data request case 0xBB: // fetch const data request
//piCout << "fetch data request from" << from << rc.state; //piCout << "fetch data request from" << from << rc.state;
if (rc.state != Connected) if (rc.state != Connected)
rc.state = FetchingData; rc.state = FetchingData;
break; break;
case 0xCC: // const data commit case 0xCC: // const data commit
//piCout << "commit from" << from; //piCout << "commit from" << from;
if (rc.state != Connected) if (rc.state != Connected)
rc.state = Connected; rc.state = Connected;
break; break;
default: break; default: break;
} }
} else { } else {
PIVector<VariableContent> content; PIVector<VariableContent> content;
@@ -1016,40 +1016,40 @@ void PIConsole::peerReceived(const PIString & from, const PIByteArray & data) {
if (from.left(5) != "_rcs_") return; if (from.left(5) != "_rcs_") return;
//PIString rcn = from.right(from.length() - 6); //PIString rcn = from.right(from.length() - 6);
switch (type) { switch (type) {
case 0xAA: // new server case 0xAA: // new server
//piCout << "new server" << rcn; //piCout << "new server" << rcn;
break; break;
case 0xCC: // const data case 0xCC: // const data
//piCout << "received const data"; //piCout << "received const data";
state = Committing; state = Committing;
ba >> tabs; ba >> tabs;
cur_tab = tabs.isEmpty() ? -1 : 0; cur_tab = tabs.isEmpty() ? -1 : 0;
piForeach (Tab & t, tabs) piForeach (Tab & t, tabs)
piForeach (Column & c, t.columns) piForeach (Column & c, t.columns)
piForeach (Variable & v, c.variables) piForeach (Variable & v, c.variables)
v.remote = true; v.remote = true;
break; break;
case 0xDD: // const data commit case 0xDD: // const data commit
//piCout << "received commit"; //piCout << "received commit";
state = Connected; state = Connected;
break; break;
case 0xEE: // dynamic data case 0xEE: // dynamic data
//piCout << "received data" << ba.size_s(); //piCout << "received data" << ba.size_s();
piForeach (Tab & t, tabs) piForeach (Tab & t, tabs)
piForeach (Column & c, t.columns) piForeach (Column & c, t.columns)
piForeach (Variable & v, c.variables) piForeach (Variable & v, c.variables)
if (!v.isEmpty() && v.id > 0) if (!v.isEmpty() && v.id > 0)
vids[v.id] = &v; vids[v.id] = &v;
ba >> content; ba >> content;
piForeach (VariableContent & vc, content) { piForeach (VariableContent & vc, content) {
if (vc.id <= 0) continue; if (vc.id <= 0) continue;
Variable * v = vids.at(vc.id); Variable * v = vids.at(vc.id);
if (v == 0) continue; if (v == 0) continue;
//piCout << "read" << v->name << vc.rdata.size_s(); //piCout << "read" << v->name << vc.rdata.size_s();
v->rdata = vc.rdata; v->rdata = vc.rdata;
} }
break; break;
default: break; default: break;
} }
} }
} }
@@ -1069,29 +1069,29 @@ void PIConsole::peerTimer(void * data, int delim) {
if (p == 0) return; if (p == 0) return;
PIByteArray ba; PIByteArray ba;
switch (state) { switch (state) {
case Disconnected: case Disconnected:
peer_tm.reset(); peer_tm.reset();
ba << int(0xBB); ba << int(0xBB);
//piCout << "send to" << server_name << "fetch request disc"; //piCout << "send to" << server_name << "fetch request disc";
peer->send(p, ba); peer->send(p, ba);
state = FetchingData; state = FetchingData;
break; break;
case FetchingData: case FetchingData:
if (peer_tm.elapsed_s() < 3.) if (peer_tm.elapsed_s() < 3.)
return; return;
peer_tm.reset(); peer_tm.reset();
ba << int(0xBB); ba << int(0xBB);
//piCout << "send to" << server_name << "fetch request fd"; //piCout << "send to" << server_name << "fetch request fd";
peer->send(p, ba); peer->send(p, ba);
break; break;
case Committing: case Committing:
peer_tm.reset(); peer_tm.reset();
ba << int(0xCC); ba << int(0xCC);
//piCout << "send to" << server_name << "committing"; //piCout << "send to" << server_name << "committing";
state = Connected; state = Connected;
peer->send(p, ba); peer->send(p, ba);
break; break;
default: break; default: break;
}; };
} }
} }

View File

@@ -2,22 +2,22 @@
* \brief Console output class * \brief Console output class
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Console output/input Console output/input
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PICONSOLE_H #ifndef PICONSOLE_H
@@ -36,8 +36,8 @@ class PIP_EXPORT PIConsole: public PIThread
PIOBJECT_SUBCLASS(PIConsole, PIThread) PIOBJECT_SUBCLASS(PIConsole, PIThread)
public: public:
//! Constructs %PIConsole with key handler "slot" and if "startNow" start it //! Constructs %PIConsole with key handler "slot" and if "startNow" start it
explicit PIConsole(bool startNow = true, PIKbdListener::KBFunc slot = 0); explicit PIConsole(bool startNow = true, PIKbdListener::KBFunc slot = 0);
~PIConsole(); ~PIConsole();
@@ -283,8 +283,8 @@ public:
EVENT2(keyPressed, PIKbdListener::KeyEvent, key, void * , data) EVENT2(keyPressed, PIKbdListener::KeyEvent, key, void * , data)
//! \handlers //! \handlers
//! \{ //! \{
//! \fn void waitForFinish() //! \fn void waitForFinish()
//! \brief block until finished (exit key will be pressed) //! \brief block until finished (exit key will be pressed)
@@ -298,17 +298,17 @@ public:
//! \fn void stop(bool clear = false) //! \fn void stop(bool clear = false)
//! \brief Stop console output and if "clear" clear the screen //! \brief Stop console output and if "clear" clear the screen
//! \} //! \}
//! \events //! \events
//! \{ //! \{
//! \fn void keyPressed(PIKbdListener::KeyEvent key, void * data) //! \fn void keyPressed(PIKbdListener::KeyEvent key, void * data)
//! \brief Raise on key "key" pressed, "data" is pointer to %PIConsole object //! \brief Raise on key "key" pressed, "data" is pointer to %PIConsole object
//! \} //! \}
private: private:
void begin(); void begin();
void run(); void run();
void fillLabels(); void fillLabels();
void status(); void status();
@@ -336,8 +336,8 @@ private:
struct Variable { struct Variable {
Variable() {nx = ny = type = offset = bitFrom = bitCount = size = 0; format = Normal; remote = false; ptr = 0; id = 1;} Variable() {nx = ny = type = offset = bitFrom = bitCount = size = 0; format = Normal; remote = false; ptr = 0; id = 1;}
Variable(const Variable & src) {remote = src.remote; name = src.name; format = src.format; type = src.type; offset = src.offset; size = src.size; Variable(const Variable & src) {remote = src.remote; name = src.name; format = src.format; type = src.type; offset = src.offset; size = src.size;
bitFrom = src.bitFrom; bitCount = src.bitCount; ptr = src.ptr; nx = src.nx; ny = src.ny; rdata = src.rdata; id = src.id;} bitFrom = src.bitFrom; bitCount = src.bitCount; ptr = src.ptr; nx = src.nx; ny = src.ny; rdata = src.rdata; id = src.id;}
bool isEmpty() const {return (remote ? false : ptr == 0);} bool isEmpty() const {return (remote ? false : ptr == 0);}
const void * data() {return (remote ? rdata.data() : ptr);} const void * data() {return (remote ? rdata.data() : ptr);}
void writeData(PIByteArray & ba) { void writeData(PIByteArray & ba) {

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Keyboard grabber for console Keyboard grabber for console
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "pikbdlistener.h" #include "pikbdlistener.h"
@@ -142,7 +142,7 @@ PIKbdListener::PIKbdListener(KBFunc slot, void * _d, bool startNow): PIThread()
#endif #endif
is_active = true; is_active = true;
ret_func = slot; ret_func = slot;
kbddata_ = _d; kbddata_ = _d;
PIKbdListener::exiting = exit_enabled = false; PIKbdListener::exiting = exit_enabled = false;
if (startNow) start(); if (startNow) start();
} }
@@ -317,8 +317,8 @@ void PIKbdListener::readKeyboard() {
return; return;
} }
if (ret > 0) { if (ret > 0) {
keyPressed(ke, kbddata_); keyPressed(ke, kbddata_);
if (ret_func != 0) ret_func(ke, kbddata_); if (ret_func != 0) ret_func(ke, kbddata_);
} }
} }

View File

@@ -2,22 +2,22 @@
* \brief Keyboard console input listener * \brief Keyboard console input listener
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Keyboard grabber for console Keyboard grabber for console
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIKBDLISTENER_H #ifndef PIKBDLISTENER_H
@@ -97,10 +97,10 @@ public:
//! Returns custom data //! Returns custom data
void * data() {return kbddata_;} void * data() {return kbddata_;}
//! Set custom data to "_data" //! Set custom data to "_data"
void setData(void * _data) {kbddata_ = _data;} void setData(void * _data) {kbddata_ = _data;}
//! Set external function to "slot" //! Set external function to "slot"
void setSlot(KBFunc slot) {ret_func = slot;} void setSlot(KBFunc slot) {ret_func = slot;}
@@ -185,7 +185,7 @@ private:
KBFunc ret_func; KBFunc ret_func;
int exit_key; int exit_key;
bool exit_enabled, is_active; bool exit_enabled, is_active;
void * kbddata_; void * kbddata_;
char rc[8]; char rc[8];
KeyEvent ke; KeyEvent ke;
static PIKbdListener * _object; static PIKbdListener * _object;

View File

@@ -4,22 +4,22 @@
* This file declares PIDeque * This file declares PIDeque
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Dynamic array of any type Dynamic array of any type
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIDEQUE_H #ifndef PIDEQUE_H

View File

@@ -4,22 +4,22 @@
* This file declares PIVector * This file declares PIVector
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Dynamic array of any type Dynamic array of any type
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIVECTOR_H #ifndef PIVECTOR_H

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Byte array Byte array
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "pibytearray.h" #include "pibytearray.h"

View File

@@ -2,22 +2,22 @@
* \brief Byte array * \brief Byte array
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Byte array Byte array
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIBYTEARRAY_H #ifndef PIBYTEARRAY_H
@@ -55,8 +55,8 @@ public:
public: public:
//! Constructs data block //! Constructs data block
RawData(void * data = 0, int size = 0) {d = data; s = size;} RawData(void * data = 0, int size = 0) {d = data; s = size;}
RawData(const RawData & o) {d = o.d; s = o.s;} RawData(const RawData & o) {d = o.d; s = o.s;}
//! Constructs data block //! Constructs data block
RawData(const void * data, const int size) {d = const_cast<void * >(data); s = size;} RawData(const void * data, const int size) {d = const_cast<void * >(data); s = size;}
RawData & operator =(const RawData & o) {d = o.d; s = o.s; return *this;} RawData & operator =(const RawData & o) {d = o.d; s = o.s; return *this;}
private: private:

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Universal output to console class Universal output to console class
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "picout.h" #include "picout.h"

View File

@@ -2,22 +2,22 @@
* \brief Universal output to console class * \brief Universal output to console class
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Universal output to console class Universal output to console class
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PICOUT_H #ifndef PICOUT_H

View File

@@ -2,22 +2,22 @@
* \brief Base class for custom state machine * \brief Base class for custom state machine
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
State machine State machine
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PISTATEMACHINE_H #ifndef PISTATEMACHINE_H
@@ -87,7 +87,7 @@ public:
//! %Rule of transition between states of machine //! %Rule of transition between states of machine
struct Rule { struct Rule {
//! Constuctor //! Constuctor
Rule() {handler = 0; from = to = Type(); autoTransition = resetAllConditions = false;} Rule() {handler = 0; from = to = Type(); autoTransition = resetAllConditions = false;}
//! Constuctor //! Constuctor
Rule(Type f, Type t, const PIStringList & c = PIStringList(), Handler h = 0, bool at = false, bool rac = false) { Rule(Type f, Type t, const PIStringList & c = PIStringList(), Handler h = 0, bool at = false, bool rac = false) {
from = f; from = f;
@@ -119,7 +119,7 @@ public:
//! %State of machine //! %State of machine
struct State { struct State {
//! Constuctor //! Constuctor
State() {handler = 0; value = Type();} State() {handler = 0; value = Type();}
//! Constuctor //! Constuctor
State(Type v, const PIString & n = "", Handler h = 0) {value = v; name = n; handler = h;} State(Type v, const PIString & n = "", Handler h = 0) {value = v; name = n; handler = h;}
//! %State value //! %State value

View File

@@ -54,16 +54,16 @@ PIMap<PIString, __PIVariantInfo__ * > * __PIVariantInfoStorage__::map = 0;
PIVariant::PIVariant() { PIVariant::PIVariant() {
_type = PIVariant::pivInvalid; _type = PIVariant::pivInvalid;
_info = 0; _info = 0;
} }
PIVariant::PIVariant(const PIVariant &v) { PIVariant::PIVariant(const PIVariant &v) {
_type = v._type; _type = v._type;
_content = v._content; _content = v._content;
#ifdef CUSTOM_PIVARIANT #ifdef CUSTOM_PIVARIANT
_info = v._info; _info = v._info;
#endif #endif
} }

View File

@@ -162,7 +162,7 @@ public:
//! Empty constructor, \a type() will be set to \a Invalid //! Empty constructor, \a type() will be set to \a Invalid
PIVariant(); PIVariant();
PIVariant(const PIVariant & v); PIVariant(const PIVariant & v);
//! Constructs variant from string //! Constructs variant from string
PIVariant(const char * v) {initType(PIString(v));} PIVariant(const char * v) {initType(PIString(v));}

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Config parser Config parser
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "piconfig.h" #include "piconfig.h"

View File

@@ -2,22 +2,22 @@
* \brief Configuration parser and writer * \brief Configuration parser and writer
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Configuration parser and writer Configuration parser and writer
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PICONFIG_H #ifndef PICONFIG_H
@@ -110,7 +110,7 @@ public:
friend class PIConfig; friend class PIConfig;
friend class Branch; friend class Branch;
public: public:
Entry() {_parent = 0; _line = -1;} Entry() {_parent = 0; _line = -1;}
//! Returns parent entry, or 0 if there is no parent (root of default value) //! Returns parent entry, or 0 if there is no parent (root of default value)
Entry * parent() const {return _parent;} Entry * parent() const {return _parent;}

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
File File
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "pifile.h" #include "pifile.h"
@@ -82,7 +82,7 @@
* *
*/ */
REGISTER_DEVICE(PIFile); REGISTER_DEVICE(PIFile)
PIString PIFile::FileInfo::name() const { PIString PIFile::FileInfo::name() const {
@@ -122,14 +122,14 @@ PIString PIFile::FileInfo::dir() const {
PIFile::PIFile(): PIIODevice() { PIFile::PIFile(): PIIODevice() {
fd = 0; fd = 0;
fdi = -1; fdi = -1;
setPrecision(5); setPrecision(5);
} }
PIFile::PIFile(const PIString & path, PIIODevice::DeviceMode mode): PIIODevice(path, mode) { PIFile::PIFile(const PIString & path, PIIODevice::DeviceMode mode): PIIODevice(path, mode) {
fd = 0; fd = 0;
fdi = -1; fdi = -1;
setPrecision(5); setPrecision(5);
if (!path.isEmpty()) if (!path.isEmpty())
@@ -138,8 +138,8 @@ PIFile::PIFile(const PIString & path, PIIODevice::DeviceMode mode): PIIODevice(p
PIFile::PIFile(const PIFile & other) { PIFile::PIFile(const PIFile & other) {
fd = 0; fd = 0;
fdi = -1; fdi = -1;
setPrecision(other.prec_); setPrecision(other.prec_);
setPath(other.path()); setPath(other.path());
mode_ = other.mode_; mode_ = other.mode_;
@@ -477,7 +477,7 @@ PIFile::FileInfo PIFile::fileInfo(const PIString & path) {
_stat_call_(path.data(), &fs); _stat_call_(path.data(), &fs);
int mode = fs.st_mode; int mode = fs.st_mode;
ret.size = fs.st_size; ret.size = fs.st_size;
ret.id_user = fs.st_uid; ret.id_user = fs.st_uid;
ret.id_group = fs.st_gid; ret.id_group = fs.st_gid;
#ifdef ANDROID #ifdef ANDROID
ret.time_access = PIDateTime::fromSystemTime(PISystemTime(fs.st_atime, fs.st_atime_nsec)); ret.time_access = PIDateTime::fromSystemTime(PISystemTime(fs.st_atime, fs.st_atime_nsec));

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Packets extractor Packets extractor
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "pipacketextractor.h" #include "pipacketextractor.h"
@@ -80,7 +80,7 @@
* *
* */ * */
REGISTER_DEVICE(PIPacketExtractor); REGISTER_DEVICE(PIPacketExtractor)
PIPacketExtractor::PIPacketExtractor(PIIODevice * device_, PIPacketExtractor::SplitMode mode) { PIPacketExtractor::PIPacketExtractor(PIIODevice * device_, PIPacketExtractor::SplitMode mode) {

View File

@@ -2,22 +2,22 @@
* \brief Packets extractor * \brief Packets extractor
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Packets extractor Packets extractor
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */

View File

@@ -124,7 +124,7 @@
* *
*/ */
REGISTER_DEVICE(PISerial); REGISTER_DEVICE(PISerial)
PRIVATE_DEFINITION_START(PISerial) PRIVATE_DEFINITION_START(PISerial)

View File

@@ -2,14 +2,14 @@
#include "piconfig.h" #include "piconfig.h"
#ifdef PIP_USB #ifdef PIP_USB
# ifdef WINDOWS # ifdef WINDOWS
# include <lusb0_usb.h> # include <lusb0_usb.h>
# else # else
# include <usb.h> # include <usb.h>
# endif # endif
#endif #endif
REGISTER_DEVICE(PIUSB); REGISTER_DEVICE(PIUSB)
PIUSB::PIUSB(ushort vid, ushort pid): PIIODevice("", ReadWrite) { PIUSB::PIUSB(ushort vid, ushort pid): PIIODevice("", ReadWrite) {

View File

@@ -2,22 +2,22 @@
* \brief USB device * \brief USB device
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
USB, based on libusb USB, based on libusb
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIUSB_H #ifndef PIUSB_H

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Evaluator designed for stream computing Evaluator designed for stream computing
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "pievaluator.h" #include "pievaluator.h"

View File

@@ -2,22 +2,22 @@
* \brief Mathematic expressions calculator * \brief Mathematic expressions calculator
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Evaluator designed for stream calculations Evaluator designed for stream calculations
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIEVALUATOR_H #ifndef PIEVALUATOR_H
@@ -49,7 +49,7 @@ namespace PIEvaluatorTypes {
}; };
struct Instruction { struct Instruction {
Instruction() {out = -1; function = -1; operation = oNone;} Instruction() {out = -1; function = -1; operation = oNone;}
Instruction(Operation oper, PIVector<int> opers, int out_ind, int func = -1) { Instruction(Operation oper, PIVector<int> opers, int out_ind, int func = -1) {
operation = oper; operators = opers; out = out_ind; function = func;} operation = oper; operators = opers; out = out_ind; function = func;}
Operation operation; Operation operation;
@@ -58,7 +58,7 @@ namespace PIEvaluatorTypes {
int function; int function;
}; };
struct Element { struct Element {
Element() {num = 0; var_num = -1; type = etNumber;} Element() {num = 0; var_num = -1; type = etNumber;}
Element(eType new_type, int new_num, int new_var_num = -1) {set(new_type, new_num, new_var_num);} Element(eType new_type, int new_num, int new_var_num = -1) {set(new_type, new_num, new_var_num);}
void set(eType new_type, int new_num, int new_var_num = -1) {type = new_type; num = new_num; var_num = new_var_num;} void set(eType new_type, int new_num, int new_var_num = -1) {type = new_type; num = new_num; var_num = new_var_num;}
eType type; eType type;

View File

@@ -41,7 +41,7 @@ public:
fp & operator =(const float &v) {val = PIFixedPoint(v).val; return *this;} fp & operator =(const float &v) {val = PIFixedPoint(v).val; return *this;}
fp & operator =(const double &v) {val = PIFixedPoint(v).val; return *this;} fp & operator =(const double &v) {val = PIFixedPoint(v).val; return *this;}
fp & operator =(const long double &v) {val = PIFixedPoint(v).val; return *this;} fp & operator =(const long double &v) {val = PIFixedPoint(v).val; return *this;}
fp operator -() {fp p = fp(*this); p.val = -val; return p;} fp operator -() {fp p = fp(*this); p.val = -val; return p;}
bool operator ==(const fp & v) const {return val == v.val;} bool operator ==(const fp & v) const {return val == v.val;}
bool operator !=(const fp & v) const {return val != v.val;} bool operator !=(const fp & v) const {return val != v.val;}

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Process Process
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "piprocess.h" #include "piprocess.h"
@@ -39,7 +39,7 @@ PIProcess::PIProcess(): PIThread() {
is_exec = false; is_exec = false;
g_in = g_out = g_err = false; g_in = g_out = g_err = false;
t_in = t_out = t_err = false; t_in = t_out = t_err = false;
tf_in = tf_out = tf_err = 0; tf_in = tf_out = tf_err = 0;
env = PIProcess::currentEnvironment(); env = PIProcess::currentEnvironment();
} }
@@ -181,7 +181,7 @@ void PIProcess::startProc(bool detached) {
is_exec = false; is_exec = false;
for (int i = 0; i < env.size_s(); ++i) for (int i = 0; i < env.size_s(); ++i)
delete e[i]; delete e[i];
delete[] e; delete[] e;
#ifdef WINDOWS #ifdef WINDOWS
delete a; delete a;
#else #else

View File

@@ -1,20 +1,20 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Code model generator Code model generator
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "picli.h" #include "picli.h"
@@ -331,7 +331,7 @@ int main(int argc, char * argv[]) {
piDebug = true; piDebug = true;
PIStringList pf(parser.parsedFiles()); PIStringList pf(parser.parsedFiles());
piForeachC (PIString & f, pf) { piForeachC (PIString & f, pf) {
if (!womain || (f != parser.mainFile())) if (!womain || (f != parser.mainFile()))
piCout << f; piCout << f;
} }
} }