version 2.93 ready to master

remove PIString << operators
This commit is contained in:
2022-06-24 12:10:57 +03:00
parent b66272a68a
commit 1b04d7ecce
19 changed files with 119 additions and 183 deletions

View File

@@ -1050,7 +1050,7 @@ PIString PICodeParser::procMacros(PIString fc) {
if (ifcnt > 0) ifcnt--;
else {
//piCout << "main endif" << skip << grab;
if (grab) pfc << procMacros(nfc);
if (grab) pfc += procMacros(nfc);
skip = grab = false;
continue;
}
@@ -1059,7 +1059,7 @@ PIString PICodeParser::procMacros(PIString fc) {
//piCout << "main elif" << skip << grab << cond_ok;
if (cond_ok) {
if (grab) {
pfc << procMacros(nfc);
pfc += procMacros(nfc);
skip = true; grab = false;
}
continue;
@@ -1075,12 +1075,12 @@ PIString PICodeParser::procMacros(PIString fc) {
}
if (mif.left(4) == s_else && ifcnt == 0) {
//piCout << "main else" << skip << grab;
if (grab) pfc << procMacros(nfc);
if (grab) pfc += procMacros(nfc);
if (skip && !cond_ok) {skip = false; grab = true;}
else {skip = true; grab = false;}
continue;
}
if (grab) nfc << line << '\n';
if (grab) nfc += line + '\n';
continue;
}
if (mif.left(2) == s_if) {
@@ -1095,8 +1095,8 @@ PIString PICodeParser::procMacros(PIString fc) {
//return false; /// WARNING: now skip errors
}
} else {
if (grab) nfc << line << '\n';
else if (!skip) pfc << line << '\n';
if (grab) nfc += line + '\n';
else if (!skip) pfc += line + '\n';
}
}
return pfc;

View File

@@ -320,10 +320,10 @@ PICout PICout::operator <<(const PIFlags<PICoutManipulators::PICoutFormat> & v)
#define PICOUTTOTARGET(v) { \
if (buffer_) {\
(*buffer_) << (v);\
(*buffer_) += (v);\
} else {\
if (PICout::isOutputDeviceActive(PICout::StdOut)) std::cout << (v);\
if (PICout::isOutputDeviceActive(PICout::Buffer)) PICout::__string__() << (v);\
if (PICout::isOutputDeviceActive(PICout::Buffer)) PICout::__string__() += (v);\
}\
}
@@ -386,52 +386,52 @@ PICout PICout::operator <<(const PICoutSpecialChar v) {
switch (v) {
case Null:
if (buffer_) {
(*buffer_) << PIChar();
(*buffer_) += PIChar();
} else {
if (isOutputDeviceActive(StdOut)) std::cout << char(0);
if (isOutputDeviceActive(Buffer)) PICout::__string__() << PIChar();
if (isOutputDeviceActive(Buffer)) PICout::__string__() += PIChar();
}
break;
case NewLine:
if (buffer_) {
(*buffer_) << "\n";
(*buffer_) += "\n";
} else {
if (isOutputDeviceActive(StdOut)) std::cout << '\n';
if (isOutputDeviceActive(Buffer)) PICout::__string__() << "\n";
if (isOutputDeviceActive(Buffer)) PICout::__string__() += "\n";
}
fo_ = true;
break;
case Tab:
if (buffer_) {
(*buffer_) << "\t";
(*buffer_) += "\t";
} else {
if (isOutputDeviceActive(StdOut)) std::cout << '\t';
if (isOutputDeviceActive(Buffer)) PICout::__string__() << "\t";
if (isOutputDeviceActive(Buffer)) PICout::__string__() += "\t";
}
break;
case Esc:
#ifdef CC_VC
if (buffer_) {
(*buffer_) << PIChar(27);
(*buffer_) += PIChar(27);
} else {
if (isOutputDeviceActive(StdOut)) std::cout << char(27);
if (isOutputDeviceActive(Buffer)) PICout::__string__() << PIChar(27);
if (isOutputDeviceActive(Buffer)) PICout::__string__() += PIChar(27);
}
#else
if (buffer_) {
(*buffer_) << "\e";
(*buffer_) += "\e";
} else {
if (isOutputDeviceActive(StdOut)) std::cout << '\e';
if (isOutputDeviceActive(Buffer)) PICout::__string__() << "\e";
if (isOutputDeviceActive(Buffer)) PICout::__string__() += "\e";
}
#endif
break;
case Quote:
if (buffer_) {
(*buffer_) << "\"";
(*buffer_) += "\"";
} else {
if (isOutputDeviceActive(StdOut)) std::cout << '"';
if (isOutputDeviceActive(Buffer)) PICout::__string__() << "\"";
if (isOutputDeviceActive(Buffer)) PICout::__string__() += "\"";
}
break;
};
@@ -469,10 +469,10 @@ PICout & PICout::space() {
if (!act_) return *this;
if (!fo_ && co_[AddSpaces]) {
if (buffer_) {
(*buffer_) << " ";
(*buffer_) += " ";
} else {
if (isOutputDeviceActive(StdOut)) std::cout << ' ';
if (isOutputDeviceActive(Buffer)) PICout::__string__() << " ";
if (isOutputDeviceActive(Buffer)) PICout::__string__() += " ";
}
}
fo_ = false;
@@ -489,10 +489,10 @@ PICout & PICout::quote() {
if (!act_) return *this;
if (co_[AddQuotes]) {
if (buffer_) {
(*buffer_) << "\"";
(*buffer_) += "\"";
} else {
if (isOutputDeviceActive(StdOut)) std::cout << '"';
if (isOutputDeviceActive(Buffer)) PICout::__string__() << "\"";
if (isOutputDeviceActive(Buffer)) PICout::__string__() += "\"";
}
}
fo_ = false;
@@ -509,10 +509,10 @@ PICout & PICout::newLine() {
if (!act_) return *this;
if (co_[AddNewLine]) {
if (buffer_) {
(*buffer_) << "\n";
(*buffer_) += "\n";
} else {
if (isOutputDeviceActive(StdOut)) std::cout << std::endl;
if (isOutputDeviceActive(Buffer)) PICout::__string__() << "\n";
if (isOutputDeviceActive(Buffer)) PICout::__string__() += "\n";
}
}
fo_ = false;

View File

@@ -241,94 +241,6 @@ public:
//! \~russian Оператор сравнения.
bool operator >=(const char * str) const {return *this >= PIString(str);}
//! \~english Append string "str" at the end of string.
//! \~russian Добавляет в конец строку "str".
//! \~\details
//! \~\code
//! PIString s("this"), s1(" is"), s2(" string");
//! s << s1 << s2; // s = "this is string"
//! \endcode
PIString & operator <<(const PIString & str) {*this += str; return *this;}
//! \~english Append character "c" at the end of string.
//! \~russian Добавляет в конец символ "c".
//! \~\details
//! \~\code
//! PIString s("stri");
//! s << PIChar('n') << PIChar('g'); // s = "string"
//! \endcode
PIString & operator <<(const PIChar c) {d.append(c); return *this;}
//! \~english Append character `c` at the end of string.
//! \~russian Добавляет в конец символ `c`.
//! \~\details
//! \~\code
//! PIString s("stri");
//! s << 'n' << 'g'; // s = "string"
//! \endcode
PIString & operator <<(const char c) {d.append(PIChar(c)); return *this;}
//! \~english Append С-string "str" at the end of string.
//! \~russian Добавляет в конец C-строку "str".
//! \~\details
//! \~\code
//! PIString s("this");
//! s << " is" << " string"; // s = "this is string"
//! \endcode
PIString & operator <<(const char * str) {*this += str; return *this;}
//! \~english Append \c wchar_t C-string "str" at the end of string.
//! \~russian Добавляет в конец \c wchar_t C-строку "str".
//! \~\details
//! \~\code
//! PIString s;
//! s << L"№ -" << " number"; // s = "№ - number"
//! \endcode
PIString & operator <<(const wchar_t * str) {*this += str; return *this;}
PIString & operator <<(const PIConstChars & str) {*this += str; return *this;}
//! \~english Append string representation of "num" at the end of string.
//! \~russian Добавляет в конец строковое представление "num".
//! \~\details
//! \~\code
//! PIString s("ten - ");
//! s << 10; // s = "ten - 10"
//! \endcode
PIString & operator <<(const int & num) {*this += PIString::fromNumber(num); return *this;}
PIString & operator <<(const uint & num) {*this += PIString::fromNumber(num); return *this;}
//! \~english Append string representation of "num" at the end of string.
//! \~russian Добавляет в конец строковое представление "num".
//! \~\details
//! \~\code
//! PIString s("ten - ");
//! s << 10; // s = "ten - 10"
//! \endcode
PIString & operator <<(const long & num) {*this += PIString::fromNumber(num); return *this;}
PIString & operator <<(const ulong & num) {*this += PIString::fromNumber(num); return *this;}
PIString & operator <<(const llong & num) {*this += PIString::fromNumber(num); return *this;}
PIString & operator <<(const ullong & num) {*this += PIString::fromNumber(num); return *this;}
//! \~english Append string representation of "num" at the end of string.
//! \~russian Добавляет в конец строковое представление "num".
//! \~\details
//! \~\code
//! PIString s("1/10 - ");
//! s << 0.1; // s = "1/10 - 0.1"
//! \endcode
PIString & operator <<(const float & num) {*this += PIString::fromNumber(num); return *this;}
//! \~english Append string representation of "num" at the end of string.
//! \~russian Добавляет в конец строковое представление "num".
//! \~\details
//! \~\code
//! PIString s("1/10 - ");
//! s << 0.1; // s = "1/10 - 0.1"
//! \endcode
PIString & operator <<(const double & num) {*this += PIString::fromNumber(num); return *this;}
//! \~english Iterator to the first element.
//! \~russian Итератор на первый элемент.
//! \~\details

View File

@@ -110,25 +110,25 @@ PIPropertyStorage PIVariantTypes::IODevice::get() const {
PIString PIVariantTypes::IODevice::toPICout() const {
PIString s;
s << "IODevice(" << prefix << ", mode=";
s += "IODevice(" + prefix + ", mode=";
int rwc = 0;
if (mode & 1) {s << "r"; ++rwc;}
if (mode & 2) {s << "w"; ++rwc;}
if (rwc == 1) s << "o";
s << ", flags=";
if (mode & 1) {s += "r"; ++rwc;}
if (mode & 2) {s += "w"; ++rwc;}
if (rwc == 1) s += "o";
s += ", flags=";
#ifndef MICRO_PIP // TODO: PIIODevice for MICRO PIP
if (options != 0) {
if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingRead])
s << " br";
s += " br";
if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingWrite])
s << " bw";
s += " bw";
}
#endif // MICRO_PIP
PIPropertyStorage ps = get();
piForeachC (PIPropertyStorage::Property & p, ps) {
s << ", " << p.name << "=\"" << p.value.toString() << "\"";
s += ", " + p.name + "=\"" + p.value.toString() + "\"";
}
s << ")";
s += ")";
return s;
}

View File

@@ -728,19 +728,19 @@ bool PIBinaryLog::seek(llong filepos) {
PIString PIBinaryLog::constructFullPathDevice() const {
PIString ret;
ret << logDir() << ":" << filePrefix() << ":" << defaultID() << ":";
ret += logDir() + ":" + filePrefix() + ":" + defaultID() + ":";
switch (play_mode) {
case PlayRealTime:
ret << "RT";
ret += "RT";
break;
case PlayVariableSpeed:
ret << PIString::fromNumber(playSpeed()) << "X";
ret += PIString::fromNumber(playSpeed()) + "X";
break;
case PlayStaticDelay:
ret << PIString::fromNumber(playDelay().toMilliseconds()) << "M";
ret += PIString::fromNumber(playDelay().toMilliseconds()) + "M";
break;
default:
ret << "RT";
ret += "RT";
break;
}
return ret;

View File

@@ -148,7 +148,7 @@ int PICAN::readedCANID() const {
PIString PICAN::constructFullPathDevice() const {
PIString ret;
ret << path() << ":" << PIString::fromNumber(CANID(),16);
ret += path() + ":" + PIString::fromNumber(CANID(), 16);
return ret;
}

View File

@@ -116,9 +116,9 @@ PIEthernet::Address::Address(const PIString & _ip, ushort _port) {
PIString PIEthernet::Address::ipString() const {
PIString ret = PIString::fromNumber(ip_b[0]);
ret << "." << PIString::fromNumber(ip_b[1]);
ret << "." << PIString::fromNumber(ip_b[2]);
ret << "." << PIString::fromNumber(ip_b[3]);
ret += "." + PIString::fromNumber(ip_b[1]);
ret += "." + PIString::fromNumber(ip_b[2]);
ret += "." + PIString::fromNumber(ip_b[3]);
return ret;
}
@@ -930,11 +930,12 @@ void PIEthernet::propertyChanged(const char * name) {
PIString PIEthernet::constructFullPathDevice() const {
PIString ret;
ret << (type() == PIEthernet::UDP ? "UDP" : "TCP") << ":" << readIP() << ":" << readPort();
ret += (type() == PIEthernet::UDP ? "UDP" : "TCP");
ret += ":" + readIP() + ":" + PIString::fromNumber(readPort());
if (type() == PIEthernet::UDP) {
ret << ":" << sendIP() << ":" << sendPort();
ret += ":" + sendIP() + ":" + PIString::fromNumber(sendPort());
piForeachC (PIString & m, multicastGroups())
ret << ":mcast:" << m;
ret += ":mcast:" + m;
}
return ret;
}

View File

@@ -26,7 +26,7 @@
#ifndef PIIOSTREAM_H
#define PIIOSTREAM_H
#include "piiodevice.h"
#include "piiostring.h"
#include "pitextstream.h"
@@ -39,8 +39,10 @@ public:
//! \~english Contructs %PIIOBinaryStream for "device" device
//! \~russian Создает %PIIOBinaryStream для устройства "device"
PIIOBinaryStream(PIIODevice * device): dev(device) {}
PIIOBinaryStream(PIIODevice * device = nullptr): dev(device) {}
//! \~english Assign "device" device
//! \~russian Назначает устройство "device"
void setDevice(PIIODevice * device) {dev = device;}
bool binaryStreamAppendImp(const void * d, size_t s) {
@@ -68,7 +70,19 @@ public:
//! \~english Contructs %PIIOTextStream for "device" device
//! \~russian Создает %PIIOTextStream для устройства "device"
PIIOTextStream(PIIODevice * device): PITextStream<PIIOBinaryStream>(&bin_stream), bin_stream(device){}
PIIOTextStream(PIIODevice * device): PITextStream<PIIOBinaryStream>(&bin_stream), bin_stream(device) {}
//! \~english Contructs %PIIOTextStream for "string" string
//! \~russian Создает %PIIOTextStream для строки "string"
PIIOTextStream(PIString * string): PITextStream<PIIOBinaryStream>(&bin_stream) {
io_string = new PIIOString(string);
bin_stream.setDevice(io_string);
}
~PIIOTextStream() {
if (io_string)
delete io_string;
}
void setDevice(PIIODevice * device) {
bin_stream = PIIOBinaryStream(device);
@@ -76,6 +90,7 @@ public:
}
private:
PIIOString * io_string = nullptr;
PIIOBinaryStream bin_stream;
};

View File

@@ -968,7 +968,7 @@ void PIPeer::newTcpClient(PIEthernet *client) {
PIString PIPeer::constructFullPathDevice() const {
PIString ret;
ret << self_info.name << ":" << trustPeerName();
ret += self_info.name + ":" + trustPeerName();
return ret;
}

View File

@@ -516,14 +516,14 @@ PIString PISerial::readString(int size, double timeout_ms) {
while (tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, 1024);
if (ret <= 0) piMinSleep();
else str << PIString((char*)td, ret);
else str += PIString((char*)td, ret);
}
} else {
while (all < size && tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, size - all);
if (ret <= 0) piMinSleep();
else {
str << PIString((char*)td, ret);
str += PIString((char*)td, ret);
all += ret;
}
}
@@ -532,12 +532,12 @@ PIString PISerial::readString(int size, double timeout_ms) {
} else {
bool br = setOption(BlockingRead, true);
all = readDevice(td, 1);
str << PIString((char*)td, all);
str += PIString((char*)td, all);
while (all < size) {
ret = readDevice(td, size - all);
if (ret <= 0) piMinSleep();
else {
str << PIString((char*)td, ret);
str += PIString((char*)td, ret);
all += ret;
}
}
@@ -857,13 +857,13 @@ bool PISerial::configureDevice(const void * e_main, const void * e_parent) {
PIString PISerial::constructFullPathDevice() const {
PIString ret;
ret << path() << ":" << int(inSpeed()) << ":" << dataBitsCount();
ret += path() + ":" + PIString::fromNumber(int(inSpeed())) + ":" + PIString::fromNumber(dataBitsCount());
if (parameters()[ParityControl]) {
if (parameters()[ParityOdd]) ret << ":O";
else ret << ":E";
} else ret << ":N";
if (parameters()[TwoStopBits]) ret << ":2";
else ret << ":1";
if (parameters()[ParityOdd]) ret += ":O";
else ret += ":E";
} else ret += ":N";
if (parameters()[TwoStopBits]) ret += ":2";
else ret += ":1";
return ret;
}

View File

@@ -170,7 +170,7 @@ bool PISharedMemory::closeDevice() {
PIString PISharedMemory::constructFullPathDevice() const {
PIString ret;
ret << path() << ":" << dsize;
ret += path() + ":" + PIString::fromNumber(dsize);
return ret;
}

View File

@@ -157,7 +157,7 @@ int PISPI::writeDevice(const void * data, int max_size) {
PIString PISPI::constructFullPathDevice() const {
PIString ret;
ret << path() << ":" << int(speed()) << ":" << int(bits()) << ":" << (int)parameters();
ret += path() + ":" + PIString::fromNumber((int)speed()) + ":" + PIString::fromNumber((int)bits()) + ":" + PIString::fromNumber((int)parameters());
return ret;
}

View File

@@ -19,6 +19,7 @@
#include "piconnection.h"
#include "piconfig.h"
#include "piiostream.h"
/** \class PIConnection
* \brief Complex Input/Output point
@@ -259,18 +260,19 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) {
PIString PIConnection::makeConfig() const {
PIString ret;
ret << "[" << name() << "]\n";
PIIOTextStream ts(&ret);
ts << "[" << name() << "]\n";
PIVector<PIIODevice * > devs(boundedDevices());
int dn(-1);
piForeachC (PIIODevice * d, devs) {
PIStringList dnl(deviceNames(d));
if (dnl.isEmpty()) dnl << PIString::fromNumber(++dn);
piForeachC (PIString & dname, dnl) {
ret << "device." << dname << " = " << d->constructFullPath() << " #s\n";
ret << "device." << dname << ".bufferSize = " << d->threadedReadBufferSize() << " #n\n";
ts << "device." << dname << " = " << d->constructFullPath() << " #s\n";
ts << "device." << dname << ".bufferSize = " << d->threadedReadBufferSize() << " #n\n";
PIDiagnostics * diag = diags_.value(const_cast<PIIODevice * >(d), 0);
if (diag != 0)
ret << "device." << dname << ".disconnectTimeout = " << diag->disconnectTimeout() << " #f\n";
ts << "device." << dname << ".disconnectTimeout = " << diag->disconnectTimeout() << " #f\n";
}
}
piForeachC (PEPair & f, extractors) {
@@ -280,27 +282,27 @@ PIString PIConnection::makeConfig() const {
for (int i = 0; i < f.second->devices.size_s(); ++i) {
PIString dname = device_names.key(f.second->devices[i]);
if (dname.isEmpty()) dname = devPath(f.second->devices[i]);
ret << prefix << ".device." << i << " = " << dname << " #s\n";
ts << prefix << ".device." << i << " = " << dname << " #s\n";
}
PIDiagnostics * diag = diags_.value(f.second->extractor, 0);
ret << prefix << ".bufferSize = " << f.second->extractor->bufferSize() << " #n\n";
ts << prefix << ".bufferSize = " << f.second->extractor->bufferSize() << " #n\n";
if (diag != 0)
ret << prefix << ".disconnectTimeout = " << diag->disconnectTimeout() << " #f\n";
ret << prefix << ".splitMode = ";
ts << prefix << ".disconnectTimeout = " << diag->disconnectTimeout() << " #f\n";
ts << prefix << ".splitMode = ";
switch (f.second->extractor->splitMode()) {
case PIPacketExtractor::None: ret << "none"; break;
case PIPacketExtractor::Header: ret << "header"; break;
case PIPacketExtractor::Footer: ret << "footer"; break;
case PIPacketExtractor::HeaderAndFooter: ret << "header & footer"; break;
case PIPacketExtractor::Size: ret << "size"; break;
case PIPacketExtractor::Timeout: ret << "timeout"; break;
case PIPacketExtractor::None: ts << "none"; break;
case PIPacketExtractor::Header: ts << "header"; break;
case PIPacketExtractor::Footer: ts << "footer"; break;
case PIPacketExtractor::HeaderAndFooter: ts << "header & footer"; break;
case PIPacketExtractor::Size: ts << "size"; break;
case PIPacketExtractor::Timeout: ts << "timeout"; break;
}
ret << " #s\n";
ret << prefix << ".payloadSize = " << f.second->extractor->payloadSize() << " #n\n";
ret << prefix << ".packetSize = " << f.second->extractor->packetSize() << " #n\n";
ret << prefix << ".timeout = " << f.second->extractor->timeout() << " #f\n";
ret << prefix << ".header = " << f.second->extractor->header().toString() << " #s\n";
ret << prefix << ".footer = " << f.second->extractor->footer().toString() << " #s\n";
ts << " #s\n";
ts << prefix << ".payloadSize = " << f.second->extractor->payloadSize() << " #n\n";
ts << prefix << ".packetSize = " << f.second->extractor->packetSize() << " #n\n";
ts << prefix << ".timeout = " << f.second->extractor->timeout() << " #f\n";
ts << prefix << ".header = " << f.second->extractor->header().toString() << " #s\n";
ts << prefix << ".footer = " << f.second->extractor->footer().toString() << " #s\n";
}
dn = 0;
piForeachC (CPair & c, channels_) {
@@ -308,10 +310,10 @@ PIString PIConnection::makeConfig() const {
PIString prefix = "channel." + PIString::fromNumber(dn); ++dn;
PIString dname = device_names.key(c.first);
if (dname.isEmpty()) dname = devPath(c.first);
ret << prefix << ".from = " << dname << " #s\n";
ts << prefix << ".from = " << dname << " #s\n";
dname = device_names.key(const_cast<PIIODevice *>(d));
if (dname.isEmpty()) dname = devPath(d);
ret << prefix << ".to = " << dname << " #s\n";
ts << prefix << ".to = " << dname << " #s\n";
}
}
piForeachC (SPair & s, senders) {
@@ -320,15 +322,15 @@ PIString PIConnection::makeConfig() const {
for (int i = 0; i < s.second->devices.size_s(); ++i) {
PIString dname = device_names.key(s.second->devices[i]);
if (dname.isEmpty()) dname = devPath(s.second->devices[i]);
ret << prefix << ".device." << i << " = " << dname << " #s\n";
ts << prefix << ".device." << i << " = " << dname << " #s\n";
}
double int_ = s.second->int_;
if (int_ > 0.)
ret << prefix << ".frequency = " << (1000. / int_) << " #f\n";
ts << prefix << ".frequency = " << (1000. / int_) << " #f\n";
if (!s.second->sdata.isEmpty())
ret << prefix << ".fixedData = " << s.second->sdata.toString() << " #s\n";
ts << prefix << ".fixedData = " << s.second->sdata.toString() << " #s\n";
}
ret << "[]\n";
ts << "[]\n";
return ret;
}

View File

@@ -43,7 +43,7 @@ void PIResources::dump() {
auto fi = si.value()->entries.makeIterator();
while (fi.next()) {
PIString s = fi.key() + ": ";
s << (fi.value() ? fi.value()->size_s() : 0) << " b";
s += PIString::fromNumber(fi.value() ? fi.value()->size_s() : 0) + " b";
piCout << " " << s;
}
}

View File

@@ -468,7 +468,7 @@ PIStringList PIPluginLoader::pluginsDirectories(const PIString & name) {
piForeachC (PIString d, dl) {
PIString dp = d + "/" + name;
if (PIDir::isExists(dp))
ret << dp;
ret += dp;
}
return ret;
}

View File

@@ -250,7 +250,7 @@ PIOpenCL::Program * PIOpenCL::Context::createProgram(const PIString & source, co
cl_program prog = clCreateProgramWithSource(PRIVATE->context, 1, &csrc, &src_size, &ret);
if (ret != 0) {
piCout << "[PIOpenCL::Context]" << "clCreateProgramWithSource error" << ret;
if (error) (*error) << "clCreateProgramWithSource error " << ret;
if (error) (*error) += "clCreateProgramWithSource error " + PIString::fromNumber(ret);
return 0;
}
PIString carg = (PIStringList(args) << "-cl-kernel-arg-info").join(' ');
@@ -286,7 +286,7 @@ PIOpenCL::Program * PIOpenCL::Context::createProgram(const PIString & source, co
cl_kernel kern = clCreateKernel(prog, k.dataAscii(), &ret);
if (ret != 0) {
piCout << "[PIOpenCL::Context]" << "clCreateKernel" << k << "error" << ret;
if (error) (*error) << "clCreateKernel(\"" << k << "\") error " << ret;
if (error) (*error) += "clCreateKernel(\"" + k + "\") error " + ret;
piForeach (void* _k, kerns)
clReleaseKernel((cl_kernel)_k);
clReleaseProgram(prog);