mirror of
https://github.com/wfjm/w11.git
synced 2026-01-13 15:37:43 +00:00
use c++ style casts
This commit is contained in:
parent
674762d6d8
commit
93bf5ce03b
@ -110,6 +110,7 @@ The full set of tests is only run for tagged releases.
|
||||
- use auto, emplace() and range loops
|
||||
- use unique_ptr instead of free pointers, avoid explicit `delete`
|
||||
- add and use move semantic in RlinkCommandExpect
|
||||
- use c++ style casts (gcc/clang -Wold-style-cast)
|
||||
- completely replace boost with std
|
||||
- use std::unique_ptr instead of boost::scoped_ptr
|
||||
- use std::shared_ptr instead of boost
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: ReventFd.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: ReventFd.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.1 use c++ style casts
|
||||
// 2013-01-14 475 1.0 Initial version
|
||||
// 2013-01-11 473 0.5 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -75,7 +76,7 @@ int ReventFd::WaitFd(int fd)
|
||||
{
|
||||
uint64_t buf;
|
||||
int irc = ::read(fd, &buf, sizeof(buf));
|
||||
return (irc <= 0) ? irc : (int)buf;
|
||||
return (irc <= 0) ? irc : int(buf);
|
||||
}
|
||||
|
||||
} // end namespace Retro
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: ReventLoop.cpp 1085 2018-12-16 14:11:16Z mueller $
|
||||
// $Id: ReventLoop.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.2.5 use c++ style casts
|
||||
// 2018-12-17 1085 1.2.4 use std::lock_guard instead of boost
|
||||
// 2018-12-15 1083 1.2.3 AddPollHandler(): use rval ref and move
|
||||
// 2018-11-09 1066 1.2.2 use emplace_back
|
||||
@ -193,7 +194,7 @@ void ReventLoop::Dump(std::ostream& os, int ind, const char* text,
|
||||
os << bl << " fStopPending: " << fStopPending << endl;
|
||||
os << bl << " fUpdatePoll: " << fUpdatePoll << endl;
|
||||
{
|
||||
lock_guard<mutex> lock(((ReventLoop*)this)->fPollDscMutex);
|
||||
lock_guard<mutex> lock(const_cast<ReventLoop*>(this)->fPollDscMutex);
|
||||
os << bl << " fPollDsc.size: " << fPollDsc.size() << endl;
|
||||
os << bl << " fPollFd.size: " << fPollFd.size() << endl;
|
||||
os << bl << " fPollHdl.size: " << fPollHdl.size() << endl;
|
||||
@ -201,7 +202,7 @@ void ReventLoop::Dump(std::ostream& os, int ind, const char* text,
|
||||
os << bl << " [" << RosPrintf(i,"d",3) << "]:"
|
||||
<< " fd:" << RosPrintf(fPollDsc[i].fFd,"d",3)
|
||||
<< " evt:" << RosPrintf(fPollDsc[i].fEvents,"x",2)
|
||||
<< " hdl:" << (bool)fPollDsc[i].fHandler
|
||||
<< " hdl:" << bool(fPollDsc[i].fHandler)
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RlinkCommandExpect.cpp 1049 2018-09-22 13:56:52Z mueller $
|
||||
// $Id: RlinkCommandExpect.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.1.2 use c++ style casts
|
||||
// 2017-04-07 868 1.1.1 Dump(): add detail arg
|
||||
// 2015-04-02 661 1.1 expect logic: remove stat from Expect, invert mask
|
||||
// 2011-11-28 434 1.0.1 Dump(): use proper cast for lp64 compatibility
|
||||
@ -146,7 +147,7 @@ void RlinkCommandExpect::Dump(std::ostream& os, int ind, const char* text,
|
||||
if (fBlockVal.size() > 0) {
|
||||
os << bl << " fBlockVal & Msk data: ";
|
||||
size_t width = (fBlockMsk.size()>0) ? 9 : 4;
|
||||
size_t ncol = max(((size_t) 1), (80-ind-4-5)/(width+1));
|
||||
size_t ncol = max(size_t(1), (80-ind-4-5)/(width+1));
|
||||
for (size_t i=0; i< fBlockVal.size(); i++) {
|
||||
if (i%ncol == 0) os << "\n" << bl << " " << RosPrintf(i,"d",3) << ": ";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RlinkConnect.cpp 1085 2018-12-16 14:11:16Z mueller $
|
||||
// $Id: RlinkConnect.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 2.8.2 use c++ style casts
|
||||
// 2018-12-17 1085 2.8.1 use std::lock_guard instead of boost
|
||||
// 2018-12-08 1079 2.8 add HasPort(); return ref for Port()
|
||||
// 2018-12-01 1076 2.7 use unique_ptr instead of scoped_ptr
|
||||
@ -814,10 +815,10 @@ void RlinkConnect::EncodeRequest(RlinkCommandList& clist, size_t ibeg,
|
||||
|
||||
case RlinkCommand::kCmdRblk: // rblk command ---------------
|
||||
fStats.Inc(kStatNRblk);
|
||||
fStats.Inc(kStatNRblkWord, (double) ndata);
|
||||
fStats.Inc(kStatNRblkWord, double(ndata));
|
||||
cmd.SetRcvSize(1+2+2*ndata+2+1+2); // rcv: cmd+cnt+n*data+dcnt+stat+crc
|
||||
fSndPkt.PutWithCrc(cmd.Address());
|
||||
fSndPkt.PutWithCrc((uint16_t)ndata);
|
||||
fSndPkt.PutWithCrc(uint16_t(ndata));
|
||||
break;
|
||||
|
||||
case RlinkCommand::kCmdWreg: // wreg command ---------------
|
||||
@ -829,10 +830,10 @@ void RlinkConnect::EncodeRequest(RlinkCommandList& clist, size_t ibeg,
|
||||
|
||||
case RlinkCommand::kCmdWblk: // wblk command ---------------
|
||||
fStats.Inc(kStatNWblk);
|
||||
fStats.Inc(kStatNWblkWord, (double) ndata);
|
||||
fStats.Inc(kStatNWblkWord, double(ndata));
|
||||
cmd.SetRcvSize(1+2+1+2); // rcv: cmd+dcnt+stat+crc
|
||||
fSndPkt.PutWithCrc(cmd.Address());
|
||||
fSndPkt.PutWithCrc((uint16_t)ndata);
|
||||
fSndPkt.PutWithCrc(uint16_t(ndata));
|
||||
fSndPkt.PutCrc();
|
||||
fSndPkt.PutWithCrc(pdata, ndata);
|
||||
break;
|
||||
@ -916,7 +917,7 @@ int RlinkConnect::DecodeResponse(RlinkCommandList& clist, size_t ibeg,
|
||||
|
||||
case RlinkCommand::kCmdRblk: // rblk command ---------------
|
||||
fRcvPkt.GetWithCrc(rdata);
|
||||
if (rdata != (uint16_t)cmd.BlockSize()) { // length mismatch
|
||||
if (rdata != uint16_t(cmd.BlockSize())) { // length mismatch
|
||||
cmd.SetFlagBit(RlinkCommand::kFlagErrDec);
|
||||
fStats.Inc(kStatNErrLen);
|
||||
RlogMsg lmsg(*fspLog, 'E');
|
||||
@ -938,7 +939,7 @@ int RlinkConnect::DecodeResponse(RlinkCommandList& clist, size_t ibeg,
|
||||
|
||||
case RlinkCommand::kCmdLabo: // labo command ---------------
|
||||
fRcvPkt.GetWithCrc(rdata8);
|
||||
cmd.SetData((uint16_t)rdata8);
|
||||
cmd.SetData(uint16_t(rdata8));
|
||||
break;
|
||||
|
||||
case RlinkCommand::kCmdAttn: // attn command ---------------
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RlinkContext.cpp 1049 2018-09-22 13:56:52Z mueller $
|
||||
// $Id: RlinkContext.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.2 use c++ style casts
|
||||
// 2017-04-07 868 1.0.1 Dump(): add detail arg
|
||||
// 2013-02-23 492 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -64,7 +65,7 @@ void RlinkContext::Dump(std::ostream& os, int ind, const char* text,
|
||||
|
||||
os << bl << " fStatusVal: " << RosPrintBvi(fStatusVal,0) << endl;
|
||||
os << bl << " fStatusMsk: " << RosPrintBvi(fStatusMsk,0) << endl;
|
||||
os << bl << " fErrCnt: " << RosPrintf((int)fErrCnt,"d") << endl;
|
||||
os << bl << " fErrCnt: " << RosPrintf(int(fErrCnt),"d") << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: RlinkCrc16.ipp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RlinkCrc16.ipp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2014- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.1 use c++ style casts
|
||||
// 2014-11-08 602 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@ -51,7 +52,7 @@ inline void RlinkCrc16::Clear()
|
||||
|
||||
inline void RlinkCrc16::AddData(uint8_t data)
|
||||
{
|
||||
uint8_t tmp = ((uint8_t)(fCrc>>8)) ^ data;
|
||||
uint8_t tmp = uint8_t(fCrc>>8) ^ data;
|
||||
fCrc = (fCrc<<8) ^ fCrc16Table[tmp];
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RlinkPacketBufSnd.cpp 1079 2018-12-09 10:56:59Z mueller $
|
||||
// $Id: RlinkPacketBufSnd.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.2.1 use c++ style casts
|
||||
// 2018-12-08 1079 1.2 use ref not ptr for RlinkPort
|
||||
// 2017-04-07 868 1.1.1 Dump(): add detail arg
|
||||
// 2015-04-11 666 1.1 handle xon/xoff escaping, add (Set)XonEscape()
|
||||
@ -245,7 +246,7 @@ bool RlinkPacketBufSnd::SndRaw(RlinkPort& port, RerrMsg& emsg)
|
||||
size_t rawbufsize = fRawBuf.size();
|
||||
int irc = port.Write(fRawBuf.data(), rawbufsize, emsg);
|
||||
if (irc < 0) return false;
|
||||
if ((size_t)irc != rawbufsize) {
|
||||
if (size_t(irc) != rawbufsize) {
|
||||
emsg.Init("RlinkPacketBufSnd::SndRaw()", "failed to write all data");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: RlinkPort.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RlinkPort.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.4.3 use c++ style casts
|
||||
// 2017-04-29 888 1.4.2 BUGFIX: RawRead(): proper irc for exactsize=false
|
||||
// 2017-04-07 868 1.4.1 Dump(): add detail arg
|
||||
// 2017-02-19 853 1.4 use Rtime, drop TimeOfDayAsDouble
|
||||
@ -137,7 +138,7 @@ int RlinkPort::Read(uint8_t* buf, size_t size, const Rtime& timeout,
|
||||
|
||||
int irc = -1;
|
||||
while (irc < 0) {
|
||||
irc = ::read(fFdRead, (void*) buf, size);
|
||||
irc = ::read(fFdRead, buf, size);
|
||||
if (irc < 0 && errno != EINTR) {
|
||||
emsg.InitErrno("RlinkPort::Read()", "read() failed : ", errno);
|
||||
if (fspLog && fTraceLevel>0) fspLog->Write(emsg.Message(), 'E');
|
||||
@ -204,7 +205,7 @@ int RlinkPort::Write(const uint8_t* buf, size_t size, RerrMsg& emsg)
|
||||
while (ndone < size) {
|
||||
int irc = -1;
|
||||
while (irc < 0) {
|
||||
irc = ::write(fFdWrite, (void*) (buf+ndone), size-ndone);
|
||||
irc = ::write(fFdWrite, buf+ndone, size-ndone);
|
||||
if (irc < 0 && errno != EINTR) {
|
||||
emsg.InitErrno("RlinkPort::Write()", "write() failed : ", errno);
|
||||
if (fspLog && fTraceLevel>0) fspLog->Write(emsg.Message(), 'E');
|
||||
@ -279,7 +280,7 @@ int RlinkPort::RawRead(uint8_t* buf, size_t size, bool exactsize,
|
||||
if (!exactsize) break;
|
||||
}
|
||||
|
||||
return (int)ndone;
|
||||
return int(ndone);
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -299,7 +300,7 @@ void RlinkPort::Dump(std::ostream& os, int ind, const char* text,
|
||||
RosFill bl(ind);
|
||||
os << bl << (text?text:"--") << "RlinkPort @ " << this << endl;
|
||||
|
||||
os << bl << " fIsOpen: " << (int)fIsOpen << endl;
|
||||
os << bl << " fIsOpen: " << int(fIsOpen) << endl;
|
||||
fUrl.Dump(os, ind+2, "fUrl: ");
|
||||
os << bl << " fXon: " << fXon << endl;
|
||||
os << bl << " fFdRead: " << fFdRead << endl;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RlinkPortCuff.cpp 1088 2018-12-17 17:37:00Z mueller $
|
||||
// $Id: RlinkPortCuff.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2012-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.1.10 use c++ style casts
|
||||
// 2018-12-17 1088 1.1.9 use std::thread instead of boost
|
||||
// 2018-12-14 1081 1.1.8 use std::bind instead of boost
|
||||
// 2018-11-09 1066 1.1.7 use auto
|
||||
@ -338,11 +339,11 @@ void RlinkPortCuff::Driver()
|
||||
|
||||
t->dev_handle = fpUsbDevHdl;
|
||||
t->flags = LIBUSB_TRANSFER_FREE_BUFFER;
|
||||
t->endpoint = (unsigned char) (kUSBReadEP|0x80);
|
||||
t->endpoint = static_cast<unsigned char>(kUSBReadEP|0x80);
|
||||
t->type = LIBUSB_TRANSFER_TYPE_BULK;
|
||||
t->timeout = 0;
|
||||
t->status = LIBUSB_TRANSFER_COMPLETED;
|
||||
t->buffer = (unsigned char*) ::malloc(kUSBBufferSize);
|
||||
t->buffer = reinterpret_cast<unsigned char*>(::malloc(kUSBBufferSize));
|
||||
t->length = kUSBBufferSize;
|
||||
t->actual_length = 0;
|
||||
t->callback = ThunkUSBReadDone;
|
||||
@ -432,7 +433,7 @@ void RlinkPortCuff::DriverEventWritePipe()
|
||||
return;
|
||||
}
|
||||
|
||||
t->length = (int) ircs;
|
||||
t->length = int(ircs);
|
||||
int irc = libusb_submit_transfer(t);
|
||||
if (irc) BadUSBCall("RlinkPortCuff::DriverEventWritePipe()",
|
||||
"libusb_submit_transfer()", irc);
|
||||
@ -470,10 +471,10 @@ libusb_transfer* RlinkPortCuff::NewWriteTransfer()
|
||||
t = libusb_alloc_transfer(0);
|
||||
t->dev_handle = fpUsbDevHdl;
|
||||
t->flags = LIBUSB_TRANSFER_FREE_BUFFER;
|
||||
t->endpoint = (unsigned char) (kUSBWriteEP);
|
||||
t->endpoint = static_cast<unsigned char>(kUSBWriteEP);
|
||||
t->type = LIBUSB_TRANSFER_TYPE_BULK;
|
||||
t->timeout = 1000;
|
||||
t->buffer = (unsigned char*) ::malloc(kUSBBufferSize);
|
||||
t->buffer = reinterpret_cast<unsigned char*>(::malloc(kUSBBufferSize));
|
||||
t->callback = ThunkUSBWriteDone;
|
||||
t->user_data = this;
|
||||
}
|
||||
@ -498,7 +499,7 @@ bool RlinkPortCuff::TraceOn()
|
||||
::localtime_r(&ts.tv_sec, &tmval);
|
||||
char buf[20];
|
||||
::snprintf(buf, 20, "%02d:%02d:%02d.%06d: ",
|
||||
tmval.tm_hour, tmval.tm_min, tmval.tm_sec, (int) ts.tv_nsec/1000);
|
||||
tmval.tm_hour, tmval.tm_min, tmval.tm_sec, int(ts.tv_nsec)/1000);
|
||||
cout << buf;
|
||||
return true;
|
||||
}
|
||||
@ -543,7 +544,7 @@ void RlinkPortCuff::CheckUSBTransfer(const char* meth, libusb_transfer *t)
|
||||
|
||||
char buf[1024];
|
||||
::snprintf(buf, 1024, "%s : transfer failure on ep=%d: %s",
|
||||
meth, (int)(t->endpoint&(~0x80)), etext);
|
||||
meth, int(t->endpoint&(~0x80)), etext);
|
||||
throw Rexception(meth, buf);
|
||||
}
|
||||
|
||||
@ -660,8 +661,8 @@ void RlinkPortCuff::USBReadDone(libusb_transfer* t)
|
||||
CheckUSBTransfer("RlinkPortCuff::USBReadDone()", t);
|
||||
fStats.Inc(kStatNUSBRead);
|
||||
if (t->actual_length>0) {
|
||||
ssize_t ircs = ::write(fFdReadDriver, t->buffer,
|
||||
(size_t) t->actual_length);
|
||||
ssize_t ircs = ::write(fFdReadDriver, t->buffer,
|
||||
size_t(t->actual_length));
|
||||
if (ircs < 0) BadSysCall("RlinkPortCuff::USBReadDone()",
|
||||
"write()", ircs);
|
||||
}
|
||||
@ -685,7 +686,7 @@ void RlinkPortCuff::USBReadDone(libusb_transfer* t)
|
||||
|
||||
void RlinkPortCuff::ThunkPollfdAdd(int fd, short events, void* udata)
|
||||
{
|
||||
RlinkPortCuff* pcntx = (RlinkPortCuff*) udata;
|
||||
RlinkPortCuff* pcntx = reinterpret_cast<RlinkPortCuff*>(udata);
|
||||
pcntx->PollfdAdd(fd, events);
|
||||
return;
|
||||
}
|
||||
@ -695,7 +696,7 @@ void RlinkPortCuff::ThunkPollfdAdd(int fd, short events, void* udata)
|
||||
|
||||
void RlinkPortCuff::ThunkPollfdRemove(int fd, void* udata)
|
||||
{
|
||||
RlinkPortCuff* pcntx = (RlinkPortCuff*) udata;
|
||||
RlinkPortCuff* pcntx = reinterpret_cast<RlinkPortCuff*>(udata);
|
||||
pcntx->PollfdRemove(fd);
|
||||
return;
|
||||
}
|
||||
@ -705,7 +706,7 @@ void RlinkPortCuff::ThunkPollfdRemove(int fd, void* udata)
|
||||
|
||||
void RlinkPortCuff::ThunkUSBWriteDone(libusb_transfer* t)
|
||||
{
|
||||
RlinkPortCuff* pcntx = (RlinkPortCuff*) t->user_data;
|
||||
RlinkPortCuff* pcntx = reinterpret_cast<RlinkPortCuff*>(t->user_data);
|
||||
pcntx->USBWriteDone(t);
|
||||
return;
|
||||
}
|
||||
@ -715,7 +716,7 @@ void RlinkPortCuff::ThunkUSBWriteDone(libusb_transfer* t)
|
||||
|
||||
void RlinkPortCuff::ThunkUSBReadDone(libusb_transfer* t)
|
||||
{
|
||||
RlinkPortCuff* pcntx = (RlinkPortCuff*) t->user_data;
|
||||
RlinkPortCuff* pcntx = reinterpret_cast<RlinkPortCuff*>(t->user_data);
|
||||
pcntx->USBReadDone(t);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclAttnShuttle.cpp 1088 2018-12-17 17:37:00Z mueller $
|
||||
// $Id: RtclAttnShuttle.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.1.3 use c++ style casts
|
||||
// 2018-12-15 1082 1.1.2 use lambda instead of bind
|
||||
// 2018-10-27 1059 1.1.1 coverity fixup (uncaught exception in dtor)
|
||||
// 2014-12-30 625 1.1 adopt to Rlink V4 attn logic
|
||||
@ -84,12 +85,12 @@ void RtclAttnShuttle::Add(RlinkServer* pserv, Tcl_Interp* interp)
|
||||
// connect to RlinkServer
|
||||
pserv->AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
fMask, (void*)this);
|
||||
fMask, this);
|
||||
fpServ = pserv;
|
||||
|
||||
// connect to Tcl
|
||||
// cast first to ptrdiff_t to promote to proper int size
|
||||
fShuttleChn = Tcl_MakeFileChannel((ClientData)(ptrdiff_t)fFdPipeRead,
|
||||
fShuttleChn = Tcl_MakeFileChannel(reinterpret_cast<ClientData>(fFdPipeRead),
|
||||
TCL_READABLE);
|
||||
|
||||
Tcl_SetChannelOption(nullptr, fShuttleChn, "-buffersize", "64");
|
||||
@ -97,8 +98,8 @@ void RtclAttnShuttle::Add(RlinkServer* pserv, Tcl_Interp* interp)
|
||||
Tcl_SetChannelOption(nullptr, fShuttleChn, "-translation", "binary");
|
||||
|
||||
Tcl_CreateChannelHandler(fShuttleChn, TCL_READABLE,
|
||||
(Tcl_FileProc*) ThunkTclChannelHandler,
|
||||
(ClientData) this);
|
||||
reinterpret_cast<Tcl_FileProc*>(ThunkTclChannelHandler),
|
||||
reinterpret_cast<ClientData>(this));
|
||||
|
||||
fpInterp = interp;
|
||||
return;
|
||||
@ -111,14 +112,14 @@ void RtclAttnShuttle::Remove()
|
||||
{
|
||||
// disconnect from RlinkServer
|
||||
if (fpServ) {
|
||||
fpServ->RemoveAttnHandler(fMask, (void*)this);
|
||||
fpServ->RemoveAttnHandler(fMask, this);
|
||||
fpServ = nullptr;
|
||||
}
|
||||
// disconnect from Tcl
|
||||
if (fpInterp) {
|
||||
Tcl_DeleteChannelHandler(fShuttleChn,
|
||||
(Tcl_FileProc*) ThunkTclChannelHandler,
|
||||
(ClientData) this);
|
||||
reinterpret_cast<Tcl_FileProc*>(ThunkTclChannelHandler),
|
||||
reinterpret_cast<ClientData>(this));
|
||||
Tcl_Close(fpInterp, fShuttleChn);
|
||||
fpInterp = nullptr;
|
||||
}
|
||||
@ -134,7 +135,7 @@ int RtclAttnShuttle::AttnHandler(RlinkServer::AttnArgs& args)
|
||||
fpServ->GetAttnInfo(args);
|
||||
|
||||
uint16_t apat = args.fAttnPatt & args.fAttnMask;
|
||||
int irc = ::write(fFdPipeWrite, (void*) &apat, sizeof(apat));
|
||||
int irc = ::write(fFdPipeWrite, &apat, sizeof(apat));
|
||||
if (irc < 0)
|
||||
throw Rexception("RtclAttnShuttle::AttnHandler()",
|
||||
"write() failed: ", errno);
|
||||
@ -148,11 +149,11 @@ int RtclAttnShuttle::AttnHandler(RlinkServer::AttnArgs& args)
|
||||
void RtclAttnShuttle::TclChannelHandler(int /*mask*/)
|
||||
{
|
||||
uint16_t apat;
|
||||
Tcl_ReadRaw(fShuttleChn, (char*) &apat, sizeof(apat));
|
||||
Tcl_ReadRaw(fShuttleChn, reinterpret_cast<char*>(&apat), sizeof(apat));
|
||||
// FIXME_code: handle return code
|
||||
|
||||
Tcl_SetVar2Ex(fpInterp, "Rlink_attnbits", nullptr,
|
||||
Tcl_NewIntObj((int)apat), 0);
|
||||
Tcl_NewIntObj(int(apat)), 0);
|
||||
// FIXME_code: handle return code
|
||||
|
||||
Tcl_EvalObjEx(fpInterp, fpScript, TCL_EVAL_GLOBAL);
|
||||
@ -165,7 +166,7 @@ void RtclAttnShuttle::TclChannelHandler(int /*mask*/)
|
||||
|
||||
void RtclAttnShuttle::ThunkTclChannelHandler(ClientData cdata, int mask)
|
||||
{
|
||||
((RtclAttnShuttle*) cdata)->TclChannelHandler(mask);
|
||||
reinterpret_cast<RtclAttnShuttle*>(cdata)->TclChannelHandler(mask);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclRlinkConnect.cpp 1085 2018-12-16 14:11:16Z mueller $
|
||||
// $Id: RtclRlinkConnect.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.6.7 use c++ style casts
|
||||
// 2018-12-17 1085 1.6.6 use std::lock_guard instead of boost
|
||||
// 2018-12-15 1082 1.6.5 use lambda instead of bind
|
||||
// 2018-12-08 1079 1.6.4 use HasPort(); Port() returns now ref
|
||||
@ -250,7 +251,7 @@ int RtclRlinkConnect::M_exec(RtclArgs& args)
|
||||
if (!args.GetArg("bsize", bsize, 1, Obj().BlockSizeMax())) return kERR;
|
||||
if (!GetVarName(args, "??varData", lsize, vardata)) return kERR;
|
||||
if (!GetVarName(args, "??varStat", lsize, varstat)) return kERR;
|
||||
clist.AddRblk(addr, (size_t) bsize);
|
||||
clist.AddRblk(addr, size_t(bsize));
|
||||
|
||||
} else if (opt == "-wreg") { // -wreg addr data ?varStat -------
|
||||
uint16_t data=0;
|
||||
@ -372,7 +373,7 @@ int RtclRlinkConnect::M_exec(RtclArgs& args)
|
||||
case RlinkCommand::kCmdRreg:
|
||||
case RlinkCommand::kCmdAttn:
|
||||
case RlinkCommand::kCmdLabo:
|
||||
pres = Tcl_NewIntObj((int)cmd.Data());
|
||||
pres = Tcl_NewIntObj(int(cmd.Data()));
|
||||
break;
|
||||
case RlinkCommand::kCmdRblk:
|
||||
pres = Rtcl::NewListIntObj(cmd.Block());
|
||||
@ -382,7 +383,7 @@ int RtclRlinkConnect::M_exec(RtclArgs& args)
|
||||
}
|
||||
|
||||
if (icmd<varstat.size() && !varstat[icmd].empty()) {
|
||||
RtclOPtr pres(Tcl_NewIntObj((int)cmd.Status()));
|
||||
RtclOPtr pres(Tcl_NewIntObj(int(cmd.Status())));
|
||||
if (!Rtcl::SetVar(interp, varstat[icmd], pres)) return kERR;
|
||||
}
|
||||
}
|
||||
@ -410,16 +411,16 @@ int RtclRlinkConnect::M_exec(RtclArgs& args)
|
||||
RtclOPtr pres(Tcl_NewListObj(0, nullptr));
|
||||
Tcl_ListObjAppendElement(nullptr, pres, fCmdnameObj[cmd.Command()]);
|
||||
Tcl_ListObjAppendElement(nullptr, pres,
|
||||
Tcl_NewIntObj((int)cmd.Request()));
|
||||
Tcl_ListObjAppendElement(nullptr, pres, Tcl_NewIntObj((int)cmd.Flags()));
|
||||
Tcl_ListObjAppendElement(nullptr, pres, Tcl_NewIntObj((int)cmd.Status()));
|
||||
Tcl_NewIntObj(int(cmd.Request())));
|
||||
Tcl_ListObjAppendElement(nullptr, pres, Tcl_NewIntObj(int(cmd.Flags())));
|
||||
Tcl_ListObjAppendElement(nullptr, pres, Tcl_NewIntObj(int(cmd.Status())));
|
||||
|
||||
switch (cmd.Command()) {
|
||||
case RlinkCommand::kCmdRreg:
|
||||
case RlinkCommand::kCmdAttn:
|
||||
case RlinkCommand::kCmdLabo:
|
||||
Tcl_ListObjAppendElement(nullptr, pres,
|
||||
Tcl_NewIntObj((int)cmd.Data()));
|
||||
Tcl_NewIntObj(int(cmd.Data())));
|
||||
break;
|
||||
|
||||
case RlinkCommand::kCmdRblk:
|
||||
@ -582,7 +583,7 @@ int RtclRlinkConnect::M_wtlam(RtclArgs& args)
|
||||
|
||||
if (rvn_apat.length()) {
|
||||
if(!Rtcl::SetVar(args.Interp(), rvn_apat,
|
||||
Tcl_NewIntObj((int)apat))) return kERR;
|
||||
Tcl_NewIntObj(int(apat)))) return kERR;
|
||||
}
|
||||
|
||||
if (irc == -2) { // IO error
|
||||
@ -825,7 +826,7 @@ bool RtclRlinkConnect::GetAddr(RtclArgs& args, uint16_t& addr)
|
||||
// if a number is given..
|
||||
if (Tcl_GetIntFromObj(nullptr, pobj, &tstint) == kOK) {
|
||||
if (tstint >= 0 && tstint <= 0xffff) {
|
||||
addr = (uint16_t)tstint;
|
||||
addr = uint16_t(tstint);
|
||||
} else {
|
||||
args.AppendResult("-E: value '", Tcl_GetString(pobj),
|
||||
"' for 'addr' out of range 0...0xffff", nullptr);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclRlinkPort.cpp 1083 2018-12-15 19:19:16Z mueller $
|
||||
// $Id: RtclRlinkPort.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.4.2 use c++ style casts
|
||||
// 2018-12-15 1082 1.4.1 use lambda instead of bind
|
||||
// 2018-12-08 1079 1.4 use ref not ptr for RlinkPort
|
||||
// 2018-12-01 1076 1.3 use unique_ptr
|
||||
@ -405,7 +406,7 @@ int RtclRlinkPort::DoRawWblk(RtclArgs& args, RlinkPort& port)
|
||||
|
||||
RerrMsg emsg;
|
||||
int irc = port.RawWrite(wdata.data(), wdata.size(), emsg);
|
||||
if (irc != (int)wdata.size()) return args.Quit(emsg);
|
||||
if (irc != int(wdata.size())) return args.Quit(emsg);
|
||||
|
||||
return kOK;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: Rtcl.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: Rtcl.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2014 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.6 use c++ style casts
|
||||
// 2014-08-22 584 1.0.5 use nullptr
|
||||
// 2013-01-06 473 1.0.4 add NewListIntObj(const uint(8|16)_t, ...)
|
||||
// 2011-03-13 369 1.0.2 add NewListIntObj(vector<uint8_t>)
|
||||
@ -60,7 +61,7 @@ Tcl_Obj* Rtcl::NewListIntObj(const uint8_t* data, size_t size)
|
||||
vobj.reserve(size);
|
||||
|
||||
for (size_t i=0; i<size; i++) {
|
||||
vobj.push_back(Tcl_NewIntObj((int)data[i]));
|
||||
vobj.push_back(Tcl_NewIntObj(int(data[i])));
|
||||
}
|
||||
return Tcl_NewListObj(vobj.size(), vobj.data());
|
||||
}
|
||||
@ -76,7 +77,7 @@ Tcl_Obj* Rtcl::NewListIntObj(const uint16_t* data, size_t size)
|
||||
vobj.reserve(size);
|
||||
|
||||
for (size_t i=0; i<size; i++) {
|
||||
vobj.push_back(Tcl_NewIntObj((int)data[i]));
|
||||
vobj.push_back(Tcl_NewIntObj(int(data[i])));
|
||||
}
|
||||
return Tcl_NewListObj(vobj.size(), vobj.data());
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclArgs.cpp 1048 2018-09-22 07:41:46Z mueller $
|
||||
// $Id: RtclArgs.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.11 use c++ style casts
|
||||
// 2018-09-22 1048 1.0.10 BUFFIX: GetArg(): coverity (argument in wrong order)
|
||||
// 2018-09-16 1047 1.0.9 coverity fixup (uninitialized scalar)
|
||||
// 2014-08-22 584 1.0.8 use nullptr
|
||||
@ -74,9 +75,9 @@ RtclArgs::RtclArgs()
|
||||
RtclArgs::RtclArgs(Tcl_Interp* interp, int objc, Tcl_Obj* const objv[],
|
||||
size_t nskip)
|
||||
: fpInterp(interp),
|
||||
fObjc((size_t)objc),
|
||||
fObjc(size_t(objc)),
|
||||
fObjv(objv),
|
||||
fNDone((nskip<=(size_t)objc) ? nskip : (size_t)objc),
|
||||
fNDone((nskip<=size_t(objc)) ? nskip : size_t(objc)),
|
||||
fNOptMiss(0),
|
||||
fNConfigRead(0),
|
||||
fOptErr(false),
|
||||
@ -111,7 +112,7 @@ RtclArgs::~RtclArgs()
|
||||
|
||||
Tcl_Obj* RtclArgs::Objv(size_t ind) const
|
||||
{
|
||||
if (ind >= (size_t)fObjc)
|
||||
if (ind >= size_t(fObjc))
|
||||
throw Rexception("RtclArgs::Objv()","Bad args: index out-of-range");
|
||||
return fObjv[ind];
|
||||
}
|
||||
@ -157,9 +158,9 @@ bool RtclArgs::GetArg(const char* name, std::string& val)
|
||||
|
||||
bool RtclArgs::GetArg(const char* name, int8_t& val, int8_t min, int8_t max)
|
||||
{
|
||||
int32_t val32 = (int32_t)val;
|
||||
bool ret = GetArg(name, val32, (int32_t)min, (int32_t)max);
|
||||
val = (int8_t) val32;
|
||||
int32_t val32 = int32_t(val);
|
||||
bool ret = GetArg(name, val32, int32_t(min), int32_t(max));
|
||||
val = int8_t(val32);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -168,9 +169,9 @@ bool RtclArgs::GetArg(const char* name, int8_t& val, int8_t min, int8_t max)
|
||||
|
||||
bool RtclArgs::GetArg(const char* name, uint8_t& val, uint8_t max, uint8_t min)
|
||||
{
|
||||
uint32_t val32 = (uint32_t)val;
|
||||
bool ret = GetArg(name, val32, (uint32_t)max, (uint32_t)min);
|
||||
val = (uint8_t) val32;
|
||||
uint32_t val32 = uint32_t(val);
|
||||
bool ret = GetArg(name, val32, uint32_t(max), uint32_t(min));
|
||||
val = uint8_t(val32);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -179,9 +180,9 @@ bool RtclArgs::GetArg(const char* name, uint8_t& val, uint8_t max, uint8_t min)
|
||||
|
||||
bool RtclArgs::GetArg(const char* name, int16_t& val, int16_t min, int16_t max)
|
||||
{
|
||||
int32_t val32 = (int32_t)val;
|
||||
bool ret = GetArg(name, val32, (int32_t)min, (int32_t)max);
|
||||
val = (int16_t) val32;
|
||||
int32_t val32 = int32_t(val);
|
||||
bool ret = GetArg(name, val32, int32_t(min), int32_t(max));
|
||||
val = int16_t(val32);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -191,9 +192,9 @@ bool RtclArgs::GetArg(const char* name, int16_t& val, int16_t min, int16_t max)
|
||||
bool RtclArgs::GetArg(const char* name, uint16_t& val, uint16_t max,
|
||||
uint16_t min)
|
||||
{
|
||||
uint32_t val32 = (uint32_t)val;
|
||||
bool ret = GetArg(name, val32, (uint32_t)max, (uint32_t)min);
|
||||
val = (uint16_t) val32;
|
||||
uint32_t val32 = uint32_t(val);
|
||||
bool ret = GetArg(name, val32, uint32_t(max), uint32_t(min));
|
||||
val = uint16_t(val32);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -214,7 +215,7 @@ bool RtclArgs::GetArg(const char* name, int32_t& val, int32_t min, int32_t max)
|
||||
AppendResult(sos);
|
||||
return false;
|
||||
}
|
||||
val = (int32_t) objval;
|
||||
val = int32_t(objval);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -237,7 +238,7 @@ bool RtclArgs::GetArg(const char* name, uint32_t& val, uint32_t max,
|
||||
AppendResult(sos);
|
||||
return false;
|
||||
}
|
||||
val = (uint32_t) objval;
|
||||
val = uint32_t(objval);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -246,9 +247,9 @@ bool RtclArgs::GetArg(const char* name, uint32_t& val, uint32_t max,
|
||||
|
||||
bool RtclArgs::GetArg(const char* name, float& val, float min, float max)
|
||||
{
|
||||
double vald = (double)val;
|
||||
bool ret = GetArg(name, vald, (double)min, (double)max);
|
||||
val = (float) vald;
|
||||
double vald = val;
|
||||
bool ret = GetArg(name, vald, double(min), double(max));
|
||||
val = float(vald);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -299,7 +300,7 @@ bool RtclArgs::GetArg(const char* name, std::vector<uint8_t>& val,
|
||||
AppendResult(sos);
|
||||
return false;
|
||||
}
|
||||
val.push_back((uint8_t)ival);
|
||||
val.push_back(uint8_t(ival));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -330,7 +331,7 @@ bool RtclArgs::GetArg(const char* name, std::vector<uint16_t>& val,
|
||||
AppendResult(sos);
|
||||
return false;
|
||||
}
|
||||
val.push_back((uint16_t)ival);
|
||||
val.push_back(uint16_t(ival));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -365,7 +366,7 @@ bool RtclArgs::Config(const char* name, uint32_t& val, uint32_t max,
|
||||
val = tmp;
|
||||
} else { // config read
|
||||
if (!ConfigReadCheck()) return false;
|
||||
SetResult(Tcl_NewIntObj((int)val));
|
||||
SetResult(Tcl_NewIntObj(int(val)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -469,7 +470,7 @@ bool RtclArgs::AllDone()
|
||||
const char* RtclArgs::PeekArgString(int rind) const
|
||||
{
|
||||
int ind = fNDone + rind;
|
||||
if (ind < 0 || ind >= (int)fObjc) return "";
|
||||
if (ind < 0 || ind >= int(fObjc)) return "";
|
||||
return Tcl_GetString(fObjv[ind]);
|
||||
}
|
||||
|
||||
@ -553,7 +554,7 @@ bool RtclArgs::NextArgList(const char* name, int& objc, Tcl_Obj**& objv,
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((size_t)objc < lmin || (size_t)objc > lmax) {
|
||||
if (size_t(objc) < lmin || size_t(objc) > lmax) {
|
||||
ostringstream sos;
|
||||
sos << "-E: list length '" << objc << "' for '" << name << "' out of range "
|
||||
<< lmin << "..." << lmax;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclClassBase.cpp 1047 2018-09-16 11:08:41Z mueller $
|
||||
// $Id: RtclClassBase.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.6 use c++ style casts
|
||||
// 2018-09-16 1047 1.0.5 coverity fixup (uninitialized pointer)
|
||||
// 2014-08-22 584 1.0.4 use nullptr
|
||||
// 2013-02-10 485 1.0.3 add static const defs
|
||||
@ -76,10 +77,12 @@ void RtclClassBase::CreateClassCmd(Tcl_Interp* interp, const char* name)
|
||||
{
|
||||
fInterp = interp;
|
||||
fCmdToken =
|
||||
Tcl_CreateObjCommand(interp, name, ThunkTclClassCmd, (ClientData) this,
|
||||
(Tcl_CmdDeleteProc *) ThunkTclCmdDeleteProc);
|
||||
Tcl_CreateObjCommand(interp, name, ThunkTclClassCmd,
|
||||
reinterpret_cast<ClientData>(this),
|
||||
reinterpret_cast<Tcl_CmdDeleteProc*>(ThunkTclCmdDeleteProc));
|
||||
RtclContext::Find(interp).RegisterClass(this);
|
||||
Tcl_CreateExitHandler((Tcl_ExitProc*) ThunkTclExitProc, (ClientData) this);
|
||||
Tcl_CreateExitHandler(reinterpret_cast<Tcl_ExitProc*>(ThunkTclExitProc),
|
||||
reinterpret_cast<ClientData>(this));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -146,12 +149,13 @@ int RtclClassBase::ClassCmdDelete(Tcl_Interp* interp, const char* name)
|
||||
}
|
||||
|
||||
RtclContext& cntx = RtclContext::Find(interp);
|
||||
if (!cntx.CheckProxy((RtclProxyBase*) cinfo.objClientData)) {
|
||||
if (!cntx.CheckProxy(reinterpret_cast<RtclProxyBase*>(cinfo.objClientData))) {
|
||||
Tcl_AppendResult(interp, "-E: command '", name, "' is not a RtclProxy",
|
||||
nullptr);
|
||||
return kERR;
|
||||
}
|
||||
if (!cntx.CheckProxy((RtclProxyBase*) cinfo.objClientData, Type())) {
|
||||
if (!cntx.CheckProxy(reinterpret_cast<RtclProxyBase*>(cinfo.objClientData),
|
||||
Type())) {
|
||||
Tcl_AppendResult(interp, "-E: command '", name,
|
||||
"' is not a RtclProxy of type '",
|
||||
Type().c_str(), "'", nullptr);
|
||||
@ -177,7 +181,8 @@ int RtclClassBase::ThunkTclClassCmd(ClientData cdata, Tcl_Interp* interp,
|
||||
}
|
||||
|
||||
try {
|
||||
return ((RtclClassBase*) cdata)->TclClassCmd(interp, objc, objv);
|
||||
return reinterpret_cast<RtclClassBase*>(cdata)->TclClassCmd(interp,
|
||||
objc, objv);
|
||||
} catch (exception& e) {
|
||||
Rtcl::AppendResultNewLines(interp);
|
||||
Tcl_AppendResult(interp, "-E: exception caught in ThunkTclClassCmd: '",
|
||||
@ -191,8 +196,9 @@ int RtclClassBase::ThunkTclClassCmd(ClientData cdata, Tcl_Interp* interp,
|
||||
|
||||
void RtclClassBase::ThunkTclCmdDeleteProc(ClientData cdata)
|
||||
{
|
||||
Tcl_DeleteExitHandler((Tcl_ExitProc*) ThunkTclExitProc, cdata);
|
||||
delete ((RtclClassBase*) cdata);
|
||||
Tcl_DeleteExitHandler(reinterpret_cast<Tcl_ExitProc*>(ThunkTclExitProc),
|
||||
cdata);
|
||||
delete (reinterpret_cast<RtclClassBase*>(cdata));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -201,7 +207,7 @@ void RtclClassBase::ThunkTclCmdDeleteProc(ClientData cdata)
|
||||
|
||||
void RtclClassBase::ThunkTclExitProc(ClientData cdata)
|
||||
{
|
||||
delete ((RtclClassBase*) cdata);
|
||||
delete (reinterpret_cast<RtclClassBase*>(cdata));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclContext.cpp 1076 2018-12-02 12:45:49Z mueller $
|
||||
// $Id: RtclContext.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.7 use c++ style casts
|
||||
// 2018-12-02 1076 1.0.6 use nullptr
|
||||
// 2018-11-16 1070 1.0.5 use auto; use emplace,make_pair; use range loop
|
||||
// 2017-02-04 866 1.0.4 rename fMapContext -> fContextMap
|
||||
@ -164,7 +165,8 @@ RtclContext& RtclContext::Find(Tcl_Interp* interp)
|
||||
} else {
|
||||
pcntx = new RtclContext(interp);
|
||||
fContextMap.emplace(make_pair(interp, pcntx));
|
||||
Tcl_CreateExitHandler((Tcl_ExitProc*) ThunkTclExitProc, (ClientData) pcntx);
|
||||
Tcl_CreateExitHandler(reinterpret_cast<Tcl_ExitProc*>(ThunkTclExitProc),
|
||||
reinterpret_cast<ClientData>(pcntx));
|
||||
|
||||
}
|
||||
return *pcntx;
|
||||
@ -180,7 +182,7 @@ RtclContext& RtclContext::Find(Tcl_Interp* interp)
|
||||
|
||||
void RtclContext::ThunkTclExitProc(ClientData cdata)
|
||||
{
|
||||
RtclContext* pcntx = (RtclContext*) cdata;
|
||||
RtclContext* pcntx = reinterpret_cast<RtclContext*>(cdata);
|
||||
if (pcntx->fSetClass.empty() && pcntx->fSetProxy.empty()) {
|
||||
delete pcntx;
|
||||
} else {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclGet.ipp 1083 2018-12-15 19:19:16Z mueller $
|
||||
// $Id: RtclGet.ipp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.2.3 use c++ style casts
|
||||
// 2018-12-15 1083 1.2.2 ctor: use rval ref and move semantics
|
||||
// 2018-12-14 1081 1.2.1 use std::function instead of boost
|
||||
// 2017-04-16 876 1.2 add Tcl_Obj*
|
||||
@ -57,7 +58,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<bool>::operator()() const
|
||||
{
|
||||
bool val = fGet();
|
||||
return Tcl_NewBooleanObj((int)val);
|
||||
return Tcl_NewBooleanObj(int(val));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -67,7 +68,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<char>::operator()() const
|
||||
{
|
||||
char val = fGet();
|
||||
return Tcl_NewIntObj((int)val);
|
||||
return Tcl_NewIntObj(int(val));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -77,7 +78,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<signed char>::operator()() const
|
||||
{
|
||||
signed char val = fGet();
|
||||
return Tcl_NewIntObj((int)val);
|
||||
return Tcl_NewIntObj(int(val));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -87,7 +88,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<unsigned char>::operator()() const
|
||||
{
|
||||
unsigned char val = fGet();
|
||||
return Tcl_NewIntObj((int)val);
|
||||
return Tcl_NewIntObj(int(val));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -97,7 +98,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<short>::operator()() const
|
||||
{
|
||||
short val = fGet();
|
||||
return Tcl_NewIntObj((int)val);
|
||||
return Tcl_NewIntObj(int(val));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -107,7 +108,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<unsigned short>::operator()() const
|
||||
{
|
||||
unsigned short val = fGet();
|
||||
return Tcl_NewIntObj((int)val);
|
||||
return Tcl_NewIntObj(int(val));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -127,7 +128,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<unsigned int>::operator()() const
|
||||
{
|
||||
unsigned int val = fGet();
|
||||
return Tcl_NewIntObj((int)val);
|
||||
return Tcl_NewIntObj(int(val));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -147,7 +148,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<unsigned long>::operator()() const
|
||||
{
|
||||
unsigned long val = fGet();
|
||||
return Tcl_NewLongObj((long)val);
|
||||
return Tcl_NewLongObj(long(val));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -177,7 +178,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<std::string>::operator()() const
|
||||
{
|
||||
std::string val = fGet();
|
||||
return Tcl_NewStringObj((char*) val.data(), val.length());
|
||||
return Tcl_NewStringObj(val.data(), val.length());
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -187,7 +188,7 @@ template <>
|
||||
inline Tcl_Obj* RtclGet<const std::string&>::operator()() const
|
||||
{
|
||||
std::string val = fGet();
|
||||
return Tcl_NewStringObj((char*) val.data(), val.length());
|
||||
return Tcl_NewStringObj(val.data(), val.length());
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclProxyBase.cpp 1066 2018-11-10 11:21:53Z mueller $
|
||||
// $Id: RtclProxyBase.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.5.2 use c++ style casts
|
||||
// 2018-09-16 1047 1.5.1 coverity fixup (uninitialized pointer)
|
||||
// 2017-03-11 859 1.5 adopt new DispatchCmd() logic
|
||||
// 2014-08-22 584 1.4.3 use nullptr
|
||||
@ -101,10 +102,12 @@ void RtclProxyBase::CreateObjectCmd(Tcl_Interp* interp, const char* name)
|
||||
{
|
||||
fInterp = interp;
|
||||
fCmdToken =
|
||||
Tcl_CreateObjCommand(interp, name, ThunkTclObjectCmd, (ClientData) this,
|
||||
(Tcl_CmdDeleteProc *) ThunkTclCmdDeleteProc);
|
||||
Tcl_CreateObjCommand(interp, name, ThunkTclObjectCmd,
|
||||
reinterpret_cast<ClientData>(this),
|
||||
reinterpret_cast<Tcl_CmdDeleteProc*>(ThunkTclCmdDeleteProc));
|
||||
RtclContext::Find(interp).RegisterProxy(this);
|
||||
Tcl_CreateExitHandler((Tcl_ExitProc*) ThunkTclExitProc, (ClientData) this);
|
||||
Tcl_CreateExitHandler(reinterpret_cast<Tcl_ExitProc*>(ThunkTclExitProc),
|
||||
reinterpret_cast<ClientData>(this));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -131,7 +134,8 @@ int RtclProxyBase::ThunkTclObjectCmd(ClientData cdata, Tcl_Interp* interp,
|
||||
}
|
||||
|
||||
try {
|
||||
return ((RtclProxyBase*) cdata)->TclObjectCmd(interp, objc, objv);
|
||||
return (reinterpret_cast<RtclProxyBase*>(cdata))->TclObjectCmd(interp,
|
||||
objc, objv);
|
||||
} catch (exception& e) {
|
||||
Rtcl::AppendResultNewLines(interp);
|
||||
Tcl_AppendResult(interp, "-E: exception caught '", e.what(), "'", nullptr);
|
||||
@ -144,8 +148,9 @@ int RtclProxyBase::ThunkTclObjectCmd(ClientData cdata, Tcl_Interp* interp,
|
||||
|
||||
void RtclProxyBase::ThunkTclCmdDeleteProc(ClientData cdata)
|
||||
{
|
||||
Tcl_DeleteExitHandler((Tcl_ExitProc*) ThunkTclExitProc, cdata);
|
||||
delete ((RtclProxyBase*) cdata);
|
||||
Tcl_DeleteExitHandler(reinterpret_cast<Tcl_ExitProc*>(ThunkTclExitProc),
|
||||
cdata);
|
||||
delete (reinterpret_cast<RtclProxyBase*>(cdata));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -154,7 +159,7 @@ void RtclProxyBase::ThunkTclCmdDeleteProc(ClientData cdata)
|
||||
|
||||
void RtclProxyBase::ThunkTclExitProc(ClientData cdata)
|
||||
{
|
||||
delete ((RtclProxyBase*) cdata);
|
||||
delete (reinterpret_cast<RtclProxyBase*>(cdata));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclSet.ipp 1083 2018-12-15 19:19:16Z mueller $
|
||||
// $Id: RtclSet.ipp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.1.3 use c++ style casts
|
||||
// 2018-12-15 1083 1.1.2 ctor: use rval ref and move semantics
|
||||
// 2018-12-14 1081 1.1.1 use std::function instead of boost
|
||||
// 2017-02-20 854 1.1 add Rtime
|
||||
@ -62,7 +63,7 @@ inline void RtclSet<bool>::operator()(RtclArgs& args) const
|
||||
if(Tcl_GetBooleanFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
|
||||
throw Rexception("RtclSet<>::oper()", "conversion error");
|
||||
|
||||
fSet((bool)val);
|
||||
fSet(bool(val));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -79,7 +80,7 @@ inline void RtclSet<char>::operator()(RtclArgs& args) const
|
||||
throw Rexception("RtclSet<>::oper()",
|
||||
"out of range for type 'char'");
|
||||
|
||||
fSet((char)val);
|
||||
fSet(char(val));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -96,7 +97,7 @@ inline void RtclSet<signed char>::operator()(RtclArgs& args) const
|
||||
throw Rexception("RtclSet<>::oper()",
|
||||
"out of range for type 'signed char'");
|
||||
|
||||
fSet((signed char)val);
|
||||
fSet(static_cast<signed char>(val));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -109,11 +110,11 @@ inline void RtclSet<unsigned char>::operator()(RtclArgs& args) const
|
||||
int val;
|
||||
if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
|
||||
throw Rexception("RtclSet<>::oper()", "conversion error");
|
||||
if ((unsigned int)val > UCHAR_MAX)
|
||||
if (static_cast<unsigned int>(val) > UCHAR_MAX)
|
||||
throw Rexception("RtclSet<>::oper()",
|
||||
"out of range for type 'unsigned char'");
|
||||
|
||||
fSet((unsigned char)val);
|
||||
fSet(static_cast<unsigned char>(val));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -130,7 +131,7 @@ inline void RtclSet<short>::operator()(RtclArgs& args) const
|
||||
throw Rexception("RtclSet<>::oper()",
|
||||
"out of range for type 'short'");
|
||||
|
||||
fSet((short)val);
|
||||
fSet(short(val));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -143,11 +144,11 @@ inline void RtclSet<unsigned short>::operator()(RtclArgs& args) const
|
||||
int val;
|
||||
if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
|
||||
throw Rexception("RtclSet<>::oper()", "conversion error");
|
||||
if ((unsigned int)val > USHRT_MAX)
|
||||
if (static_cast<unsigned int>(val) > USHRT_MAX)
|
||||
throw Rexception("RtclSet<>::oper()",
|
||||
"out of range for type 'unsigned short'");
|
||||
|
||||
fSet((unsigned short)val);
|
||||
fSet(static_cast<unsigned short>(val));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -175,7 +176,7 @@ inline void RtclSet<unsigned int>::operator()(RtclArgs& args) const
|
||||
if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
|
||||
throw Rexception("RtclSet<>::oper()", "conversion error");
|
||||
|
||||
fSet((unsigned int) val);
|
||||
fSet(static_cast<unsigned int>(val));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -203,7 +204,7 @@ inline void RtclSet<unsigned long>::operator()(RtclArgs& args) const
|
||||
if(Tcl_GetLongFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
|
||||
throw Rexception("RtclSet<>::oper()", "conversion error");
|
||||
|
||||
fSet((unsigned long) val);
|
||||
fSet(static_cast<unsigned long>(val));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -220,7 +221,7 @@ inline void RtclSet<float>::operator()(RtclArgs& args) const
|
||||
throw Rexception("RtclSet<>::oper()",
|
||||
"out of range for type 'float'");
|
||||
|
||||
fSet((float)val);
|
||||
fSet(float(val));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RlogFile.cpp 1085 2018-12-16 14:11:16Z mueller $
|
||||
// $Id: RlogFile.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.2.3 use c++ style casts
|
||||
// 2018-12-17 1085 1.2.2 use std::lock_guard instead of boost
|
||||
// 2017-03-04 858 2.2.1 use clock_gettime instead of gettimeofday
|
||||
// 2015-01-08 631 2.2 Open(): now with RerrMsg and cout/cerr support
|
||||
@ -161,7 +162,7 @@ void RlogFile::Write(const std::string& str, char tag)
|
||||
<< RosPrintf(tymd.tm_hour,"d0",2) << ":"
|
||||
<< RosPrintf(tymd.tm_min,"d0",2) << ":"
|
||||
<< RosPrintf(tymd.tm_sec,"d0",2) << "."
|
||||
<< RosPrintf((int)ts.tv_nsec/1000,"d0",6) << " : ";
|
||||
<< RosPrintf(int(ts.tv_nsec)/1000,"d0",6) << " : ";
|
||||
}
|
||||
|
||||
os << str;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: RosPrintBvi.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RosPrintBvi.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.3 use c++ style casts
|
||||
// 2013-02-03 481 1.0.2 use Rexception
|
||||
// 2011-03-12 368 1.0.1 allow base=0, will print in hex,oct and bin
|
||||
// 2011-03-05 366 1.0 Initial version
|
||||
@ -41,7 +42,7 @@ namespace Retro {
|
||||
//! Constructor. FIXME_docs
|
||||
|
||||
RosPrintBvi::RosPrintBvi(uint8_t val, size_t base, size_t nbit)
|
||||
: fVal((uint8_t)val),
|
||||
: fVal(val),
|
||||
fBase(base),
|
||||
fNbit(nbit)
|
||||
{
|
||||
@ -57,7 +58,7 @@ RosPrintBvi::RosPrintBvi(uint8_t val, size_t base, size_t nbit)
|
||||
//! Constructor. FIXME_docs
|
||||
|
||||
RosPrintBvi::RosPrintBvi(uint16_t val, size_t base, size_t nbit)
|
||||
: fVal((uint16_t)val),
|
||||
: fVal(val),
|
||||
fBase(base),
|
||||
fNbit(nbit)
|
||||
{
|
||||
@ -139,7 +140,7 @@ void RosPrintBvi::Convert(char* pbuf) const
|
||||
for (size_t i=ndig; i>0; i--) {
|
||||
uint32_t nibble = ((fVal)>>((i-1)*nwidth)) & nmask;
|
||||
nibble += (nibble <= 9) ? '0' : ('a'-10);
|
||||
*pbuf++ = (char) nibble;
|
||||
*pbuf++ = char(nibble);
|
||||
}
|
||||
|
||||
*pbuf++ = '\0';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rstats.cpp 1060 2018-10-27 11:32:39Z mueller $
|
||||
// $Id: Rstats.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.5 use c++ style casts
|
||||
// 2017-02-04 865 1.0.4 add NameMaxLength(); Print(): add counter name
|
||||
// 2017-02-18 851 1.0.3 add IncLogHist; fix + and * operator definition
|
||||
// 2013-02-03 481 1.0.2 use Rexception
|
||||
@ -82,9 +83,9 @@ void Rstats::Define(size_t ind, const std::string& name,
|
||||
{
|
||||
// update hash
|
||||
for (size_t i=0; i<name.length(); i++)
|
||||
fHash = 69069*fHash + (uint32_t) name[i];
|
||||
fHash = 69069*fHash + uint32_t(name[i]);
|
||||
for (size_t i=0; i<text.length(); i++)
|
||||
fHash = 69069*fHash + (uint32_t) text[i];
|
||||
fHash = 69069*fHash + uint32_t(text[i]);
|
||||
|
||||
// in case it's the 'next' counter use push_back
|
||||
if (ind == Size()) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rtools.cpp 1088 2018-12-17 17:37:00Z mueller $
|
||||
// $Id: Rtools.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.9 use c++ style casts
|
||||
// 2018-10-26 1059 1.0.8 add Catch2Cerr()
|
||||
// 2017-02-18 852 1.0.7 remove TimeOfDayAsDouble()
|
||||
// 2014-11-23 606 1.0.6 add TimeOfDayAsDouble()
|
||||
@ -122,7 +123,7 @@ bool CreateBackupFile(const std::string& fname, size_t nbackup, RerrMsg& emsg)
|
||||
fnames.push_back(fname);
|
||||
for (size_t i=1; i<=nbackup; i++) {
|
||||
char fnum[4];
|
||||
::snprintf(fnum, sizeof(fnum), "%d", (int)i);
|
||||
::snprintf(fnum, sizeof(fnum), "%d", int(i));
|
||||
fnames.push_back(fbase + "_" + fnum + fext);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: RtclBvi.cpp 1076 2018-12-02 12:45:49Z mueller $
|
||||
// $Id: RtclBvi.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2011-2014 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.3 use c++ style casts
|
||||
// 2018-12-02 1076 1.0.2 use nullptr
|
||||
// 2011-11-28 434 1.0.1 DoCmd(): use intptr_t cast for lp64 compatibility
|
||||
// 2011-03-27 374 1.0 Initial version
|
||||
@ -51,8 +52,10 @@ static const int kERR = TCL_ERROR;
|
||||
|
||||
void RtclBvi::CreateCmds(Tcl_Interp* interp)
|
||||
{
|
||||
Tcl_CreateObjCommand(interp, "bvi", DoCmd, (ClientData) kStr2Int, nullptr);
|
||||
Tcl_CreateObjCommand(interp, "pbvi", DoCmd, (ClientData) kInt2Str, nullptr);
|
||||
Tcl_CreateObjCommand(interp, "bvi", DoCmd,
|
||||
reinterpret_cast<ClientData>(kStr2Int), nullptr);
|
||||
Tcl_CreateObjCommand(interp, "pbvi", DoCmd,
|
||||
reinterpret_cast<ClientData>(kInt2Str), nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -68,7 +71,7 @@ int RtclBvi::DoCmd(ClientData cdata, Tcl_Interp* interp, int objc,
|
||||
if (!CheckFormat(interp, objc, objv, list, form, nbit)) return kERR;
|
||||
|
||||
//ConvMode mode = (ConvMode)((int) cdata);
|
||||
ConvMode mode = (ConvMode)((intptr_t) cdata);
|
||||
ConvMode mode = static_cast<ConvMode>(intptr_t(cdata));
|
||||
|
||||
if (list) {
|
||||
int lobjc = 0;
|
||||
@ -145,7 +148,7 @@ Tcl_Obj* RtclBvi::DoConv(Tcl_Interp* interp, ConvMode mode, Tcl_Obj* val,
|
||||
char* eptr=0;
|
||||
|
||||
if (base==10 && pval[0]=='-') {
|
||||
lres = (unsigned long) ::strtol(pval, &eptr, base);
|
||||
lres = static_cast<unsigned long>(::strtol(pval, &eptr, base));
|
||||
if (nbit<32) lres &= (1ul<<nbit)-1;
|
||||
} else {
|
||||
lres = ::strtoul(pval, &eptr, base);
|
||||
@ -163,12 +166,12 @@ Tcl_Obj* RtclBvi::DoConv(Tcl_Interp* interp, ConvMode mode, Tcl_Obj* val,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Tcl_NewIntObj((int)lres);
|
||||
return Tcl_NewIntObj(int(lres));
|
||||
|
||||
} else if (mode == kInt2Str) {
|
||||
int val_int;
|
||||
if (Tcl_GetIntFromObj(interp, val, &val_int) != kOK) return nullptr;
|
||||
int val_uint = (unsigned int) val_int;
|
||||
unsigned int val_uint = val_int;
|
||||
|
||||
int nwidth = 1;
|
||||
if (form=='o' || form=='O') nwidth = 3;
|
||||
@ -186,7 +189,7 @@ Tcl_Obj* RtclBvi::DoConv(Tcl_Interp* interp, ConvMode mode, Tcl_Obj* val,
|
||||
for (int i=ndig-1; i>=0; i--) {
|
||||
unsigned int nibble = ((val_uint)>>(i*nwidth)) & nmask;
|
||||
nibble += (nibble <= 9) ? '0' : ('a'-10);
|
||||
*pbuf++ = (char) nibble;
|
||||
*pbuf++ = char(nibble);
|
||||
}
|
||||
|
||||
if (form=='B' || form=='O' || form=='X') {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclSignalAction.cpp 1075 2018-12-01 11:55:07Z mueller $
|
||||
// $Id: RtclSignalAction.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.5 use c++ style casts
|
||||
// 2018-11-30 1075 1.0.4 use list-init
|
||||
// 2014-11-08 602 1.0.3 cast int first to ptrdiff_t, than to ClientData
|
||||
// 2014-08-22 584 1.0.2 use nullptr
|
||||
@ -63,7 +64,8 @@ bool RtclSignalAction::Init(Tcl_Interp* interp, RerrMsg& emsg)
|
||||
return false;
|
||||
}
|
||||
|
||||
Tcl_CreateExitHandler((Tcl_ExitProc*) ThunkTclExitProc, (ClientData) fpObj);
|
||||
Tcl_CreateExitHandler(reinterpret_cast<Tcl_ExitProc*>(ThunkTclExitProc),
|
||||
reinterpret_cast<ClientData>(fpObj));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -162,15 +164,15 @@ bool RtclSignalAction::ValidSignal(int signum, RerrMsg& emsg)
|
||||
void RtclSignalAction::TclChannelHandler(int /*mask*/)
|
||||
{
|
||||
char signum;
|
||||
Tcl_Read(fShuttleChn, (char*) &signum, sizeof(signum));
|
||||
Tcl_Read(fShuttleChn, reinterpret_cast<char*>(&signum), sizeof(signum));
|
||||
// FIXME_code: handle return code
|
||||
|
||||
Tcl_SetVar2Ex(fpInterp, "Rutil_signum", nullptr,
|
||||
Tcl_NewIntObj((int)signum), 0);
|
||||
Tcl_NewIntObj(int(signum)), 0);
|
||||
// FIXME_code: handle return code
|
||||
|
||||
if ((Tcl_Obj*)fpScript[(int)signum]) {
|
||||
Tcl_EvalObjEx(fpInterp, fpScript[(int)signum], TCL_EVAL_GLOBAL);
|
||||
if (!!fpScript[int(signum)]) {
|
||||
Tcl_EvalObjEx(fpInterp, fpScript[int(signum)], TCL_EVAL_GLOBAL);
|
||||
// FIXME_code: handle return code
|
||||
}
|
||||
|
||||
@ -184,7 +186,7 @@ void RtclSignalAction::SignalHandler(int signum)
|
||||
{
|
||||
if (fpObj && fpObj->fFdPipeWrite>0) {
|
||||
char signum_c = signum;
|
||||
int irc = ::write(fpObj->fFdPipeWrite, (void*) &signum_c, sizeof(signum_c));
|
||||
int irc = ::write(fpObj->fFdPipeWrite, &signum_c, sizeof(signum_c));
|
||||
if (irc < 0)
|
||||
cerr << "RtclSignalAction::SignalHandler-E: write() failed, errno="
|
||||
<< errno << endl;
|
||||
@ -233,7 +235,7 @@ RtclSignalAction::RtclSignalAction(Tcl_Interp* interp)
|
||||
fFdPipeWrite = pipefd[1];
|
||||
|
||||
// cast first to ptrdiff_t to promote to proper int size
|
||||
fShuttleChn = Tcl_MakeFileChannel((ClientData)(ptrdiff_t)fFdPipeRead,
|
||||
fShuttleChn = Tcl_MakeFileChannel(reinterpret_cast<ClientData>(fFdPipeRead),
|
||||
TCL_READABLE);
|
||||
|
||||
Tcl_SetChannelOption(nullptr, fShuttleChn, "-buffersize", "64");
|
||||
@ -241,8 +243,8 @@ RtclSignalAction::RtclSignalAction(Tcl_Interp* interp)
|
||||
Tcl_SetChannelOption(nullptr, fShuttleChn, "-translation", "binary");
|
||||
|
||||
Tcl_CreateChannelHandler(fShuttleChn, TCL_READABLE,
|
||||
(Tcl_FileProc*) ThunkTclChannelHandler,
|
||||
(ClientData) this);
|
||||
reinterpret_cast<Tcl_FileProc*>(ThunkTclChannelHandler),
|
||||
reinterpret_cast<ClientData>(this));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclSystem.cpp 1049 2018-09-22 13:56:52Z mueller $
|
||||
// $Id: RtclSystem.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.2 use c++ style casts
|
||||
// 2014-08-22 584 1.0.1 use nullptr
|
||||
// 2013-05-17 521 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -58,11 +59,11 @@ static const int kERR = TCL_ERROR;
|
||||
void RtclSystem::CreateCmds(Tcl_Interp* interp)
|
||||
{
|
||||
Tcl_CreateObjCommand(interp, "rutil::isatty", Isatty,
|
||||
(ClientData) 0, nullptr);
|
||||
nullptr, nullptr);
|
||||
Tcl_CreateObjCommand(interp, "rutil::sigaction", SignalAction,
|
||||
(ClientData) 0, nullptr);
|
||||
nullptr, nullptr);
|
||||
Tcl_CreateObjCommand(interp, "rutil::waitpid", WaitPid,
|
||||
(ClientData) 0, nullptr);
|
||||
nullptr, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: RethBuf.ipp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RethBuf.ipp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2017-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.1 use c++ style casts
|
||||
// 2017-02-25 856 1.0 Initial version
|
||||
// 2017-02-12 850 0.1 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -92,7 +93,7 @@ inline const uint8_t* RethBuf::Buf8() const
|
||||
|
||||
inline const uint16_t* RethBuf::Buf16() const
|
||||
{
|
||||
return (uint16_t*) fBuf;
|
||||
return reinterpret_cast<uint16_t*>(const_cast<uint8_t*>(fBuf));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -100,7 +101,7 @@ inline const uint16_t* RethBuf::Buf16() const
|
||||
|
||||
inline const uint32_t* RethBuf::Buf32() const
|
||||
{
|
||||
return (uint32_t*) fBuf;
|
||||
return reinterpret_cast<uint32_t*>(const_cast<uint8_t*>(fBuf));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -116,7 +117,7 @@ inline uint8_t* RethBuf::Buf8()
|
||||
|
||||
inline uint16_t* RethBuf::Buf16()
|
||||
{
|
||||
return (uint16_t*) fBuf;
|
||||
return reinterpret_cast<uint16_t*>(fBuf);
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -124,7 +125,7 @@ inline uint16_t* RethBuf::Buf16()
|
||||
|
||||
inline uint32_t* RethBuf::Buf32()
|
||||
{
|
||||
return (uint32_t*) fBuf;
|
||||
return reinterpret_cast<uint32_t*>(fBuf);
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11.cpp 1082 2018-12-15 13:56:20Z mueller $
|
||||
// $Id: Rw11.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -71,7 +71,7 @@ void Rw11::SetServer(const std::shared_ptr<RlinkServer>& spserv)
|
||||
fspServ = spserv;
|
||||
fspServ->AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
uint16_t(1)<<kLam, (void*)this);
|
||||
uint16_t(1)<<kLam, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11CntlDEUNA.cpp 1087 2018-12-17 08:25:37Z mueller $
|
||||
// $Id: Rw11CntlDEUNA.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -355,7 +355,7 @@ void Rw11CntlDEUNA::Start()
|
||||
// add attn handler
|
||||
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
uint16_t(1)<<fLam, (void*)this);
|
||||
uint16_t(1)<<fLam, this);
|
||||
fStarted = true;
|
||||
|
||||
return;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11CntlDL11.cpp 1082 2018-12-15 13:56:20Z mueller $
|
||||
// $Id: Rw11CntlDL11.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -124,7 +124,7 @@ void Rw11CntlDL11::Start()
|
||||
// add attn handler
|
||||
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
uint16_t(1)<<fLam, (void*)this);
|
||||
uint16_t(1)<<fLam, this);
|
||||
fStarted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11CntlLP11.cpp 1082 2018-12-15 13:56:20Z mueller $
|
||||
// $Id: Rw11CntlLP11.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -112,7 +112,7 @@ void Rw11CntlLP11::Start()
|
||||
// add attn handler
|
||||
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
uint16_t(1)<<fLam, (void*)this);
|
||||
uint16_t(1)<<fLam, this);
|
||||
|
||||
fStarted = true;
|
||||
return;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11CntlPC11.cpp 1082 2018-12-15 13:56:20Z mueller $
|
||||
// $Id: Rw11CntlPC11.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -123,7 +123,7 @@ void Rw11CntlPC11::Start()
|
||||
// add attn handler
|
||||
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
uint16_t(1)<<fLam, (void*)this);
|
||||
uint16_t(1)<<fLam, this);
|
||||
|
||||
fStarted = true;
|
||||
return;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11CntlRHRP.cpp 1083 2018-12-15 19:19:16Z mueller $
|
||||
// $Id: Rw11CntlRHRP.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Other credits:
|
||||
@ -276,7 +276,7 @@ void Rw11CntlRHRP::Start()
|
||||
// add attn handler
|
||||
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
uint16_t(1)<<fLam, (void*)this);
|
||||
uint16_t(1)<<fLam, this);
|
||||
|
||||
fStarted = true;
|
||||
return;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11CntlRK11.cpp 1083 2018-12-15 19:19:16Z mueller $
|
||||
// $Id: Rw11CntlRK11.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Other credits:
|
||||
@ -221,7 +221,7 @@ void Rw11CntlRK11::Start()
|
||||
// add attn handler
|
||||
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
uint16_t(1)<<fLam, (void*)this);
|
||||
uint16_t(1)<<fLam, this);
|
||||
|
||||
fStarted = true;
|
||||
return;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11CntlRL11.cpp 1083 2018-12-15 19:19:16Z mueller $
|
||||
// $Id: Rw11CntlRL11.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Other credits:
|
||||
@ -261,7 +261,7 @@ void Rw11CntlRL11::Start()
|
||||
// add attn handler
|
||||
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
uint16_t(1)<<fLam, (void*)this);
|
||||
uint16_t(1)<<fLam, this);
|
||||
|
||||
fStarted = true;
|
||||
return;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11CntlTM11.cpp 1083 2018-12-15 19:19:16Z mueller $
|
||||
// $Id: Rw11CntlTM11.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Other credits:
|
||||
@ -205,7 +205,7 @@ void Rw11CntlTM11::Start()
|
||||
// add attn handler
|
||||
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
|
||||
{ return AttnHandler(args); },
|
||||
uint16_t(1)<<fLam, (void*)this);
|
||||
uint16_t(1)<<fLam, this);
|
||||
|
||||
fStarted = true;
|
||||
return;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11VirtTermTcp.cpp 1088 2018-12-17 17:37:00Z mueller $
|
||||
// $Id: Rw11VirtTermTcp.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.0.11 use c++ style casts
|
||||
// 2018-12-15 1082 1.0.10 use lambda instead of bind
|
||||
// 2018-11-30 1075 1.0.9 use list-init
|
||||
// 2018-11-11 1066 1.0.8 coverity fixup (unchecked return value)
|
||||
@ -159,11 +160,11 @@ bool Rw11VirtTermTcp::Open(const std::string& url, RerrMsg& emsg)
|
||||
|
||||
sockaddr_in sa = {};
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons((unsigned short) portno);
|
||||
sa.sin_port = htons(static_cast<unsigned short>(portno));
|
||||
sa.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
// Note: ::bind needed below to avoid collision with std::bind...
|
||||
if (::bind(fd, (sockaddr*) &sa, sizeof(sa)) < 0) {
|
||||
if (::bind(fd, reinterpret_cast<sockaddr*>(&sa), sizeof(sa)) < 0) {
|
||||
emsg.InitErrno("Rw11VirtTermTcp::Open","bind() failed: ", errno);
|
||||
::close(fd);
|
||||
return false;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclRw11CntlBase.ipp 1082 2018-12-15 13:56:20Z mueller $
|
||||
// $Id: RtclRw11CntlBase.ipp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.2.3 use c++ style casts
|
||||
// 2018-12-15 1082 1.2.2 use lambda instead of bind
|
||||
// 2018-12-07 1078 1.2.1 use std::shared_ptr instead of boost
|
||||
// 2017-04-16 877 1.2 add class in ctor
|
||||
@ -104,8 +105,8 @@ int RtclRw11CntlBase<TC>::M_bootcode(RtclArgs& args)
|
||||
uint16_t astart;
|
||||
if (Obj().BootCode(unit, code, aload, astart)) {
|
||||
RtclOPtr pres(Tcl_NewListObj(0, NULL));
|
||||
Tcl_ListObjAppendElement(NULL, pres, Tcl_NewIntObj((int)aload));
|
||||
Tcl_ListObjAppendElement(NULL, pres, Tcl_NewIntObj((int)astart));
|
||||
Tcl_ListObjAppendElement(NULL, pres, Tcl_NewIntObj(int(aload)));
|
||||
Tcl_ListObjAppendElement(NULL, pres, Tcl_NewIntObj(int(astart)));
|
||||
Tcl_ListObjAppendElement(NULL, pres, Rtcl::NewListIntObj(code));
|
||||
args.SetResult(pres);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclRw11Cpu.cpp 1085 2018-12-16 14:11:16Z mueller $
|
||||
// $Id: RtclRw11Cpu.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.2.23 use c++ style casts
|
||||
// 2018-12-17 1085 1.2.22 use std::lock_guard instead of boost
|
||||
// 2018-12-15 1082 1.2.21 use lambda instead of bind
|
||||
// 2018-12-07 1077 1.2.20 use SetLastExpectBlock move semantics
|
||||
@ -409,7 +410,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args)
|
||||
if (!args.GetArg("bsize", bsize, 1, Connect().BlockSizeMax())) return kERR;
|
||||
if (!GetVarName(args, "??varData", lsize, vardata)) return kERR;
|
||||
if (!GetVarName(args, "??varStat", lsize, varstat)) return kERR;
|
||||
clist.AddRblk(addr, (size_t) bsize);
|
||||
clist.AddRblk(addr, size_t(bsize));
|
||||
|
||||
} else if (opt == "-wreg") { // -wreg addr data ?varStat -------
|
||||
uint16_t addr=0;
|
||||
@ -549,7 +550,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args)
|
||||
if (!args.GetArg("bsize", bsize, 1, Connect().BlockSizeMax())) return kERR;
|
||||
if (!GetVarName(args, "??varData", lsize, vardata)) return kERR;
|
||||
if (!GetVarName(args, "??varStat", lsize, varstat)) return kERR;
|
||||
clist.AddRblk(base + Rw11Cpu::kCPMEMI, (size_t) bsize);
|
||||
clist.AddRblk(base + Rw11Cpu::kCPMEMI, size_t(bsize));
|
||||
|
||||
} else if (opt == "-bwm") { // -bwm block ?varStat -----------
|
||||
vector<uint16_t> block;
|
||||
@ -632,7 +633,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args)
|
||||
if (!args.GetArg("bsize", bsize, 1, Connect().BlockSizeMax())) return kERR;
|
||||
if (!GetVarName(args, "??varData", lsize, vardata)) return kERR;
|
||||
if (!GetVarName(args, "??varStat", lsize, varstat)) return kERR;
|
||||
Obj().AddRbibr(clist, ibaddr, (size_t) bsize);
|
||||
Obj().AddRbibr(clist, ibaddr, size_t(bsize));
|
||||
|
||||
} else if (opt == "-wibr") { // -wibr iba data ?varStat --------
|
||||
uint16_t ibaddr=0;
|
||||
@ -756,7 +757,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args)
|
||||
case RlinkCommand::kCmdRreg:
|
||||
case RlinkCommand::kCmdAttn:
|
||||
case RlinkCommand::kCmdLabo:
|
||||
pres = Tcl_NewIntObj((int)cmd.Data());
|
||||
pres = Tcl_NewIntObj(int(cmd.Data()));
|
||||
break;
|
||||
|
||||
case RlinkCommand::kCmdRblk:
|
||||
@ -767,7 +768,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args)
|
||||
}
|
||||
|
||||
if (icmd<varstat.size() && !varstat[icmd].empty()) {
|
||||
RtclOPtr pres(Tcl_NewIntObj((int)cmd.Status()));
|
||||
RtclOPtr pres(Tcl_NewIntObj(int(cmd.Status())));
|
||||
if (!Rtcl::SetVar(interp, varstat[icmd], pres)) return kERR;
|
||||
}
|
||||
}
|
||||
@ -982,7 +983,7 @@ int RtclRw11Cpu::M_ldasm(RtclArgs& args)
|
||||
"2nd pipe() failed: ", errno));
|
||||
|
||||
pid_t pid = ::fork();
|
||||
if (pid == (pid_t) 0) { // in child here
|
||||
if (pid == pid_t(0)) { // in child here
|
||||
vector<const char*> argv;
|
||||
vector<string> opts;
|
||||
|
||||
@ -1009,14 +1010,14 @@ int RtclRw11Cpu::M_ldasm(RtclArgs& args)
|
||||
::dup2(STDOUT_FILENO, STDERR_FILENO);
|
||||
::close(pipe_tcl2asm[1]);
|
||||
::close(pipe_asm2tcl[0]);
|
||||
::execvp("asm-11", (char* const*) argv.data());
|
||||
::execvp("asm-11", const_cast<char* const*>(argv.data()));
|
||||
::perror("execvp() for asm-11 failed");
|
||||
::exit(EXIT_FAILURE);
|
||||
|
||||
} else { // in parent here
|
||||
::close(pipe_tcl2asm[0]);
|
||||
::close(pipe_asm2tcl[1]);
|
||||
if (pid < (pid_t) 0)
|
||||
if (pid < pid_t(0))
|
||||
return args.Quit(RerrMsg("RtclRw11Cpu::M_ldasm" ,
|
||||
"fork() failed: ", errno));
|
||||
}
|
||||
@ -1095,7 +1096,7 @@ int RtclRw11Cpu::M_ldasm(RtclArgs& args)
|
||||
string key = line.substr(0,dpos);
|
||||
string val= line.substr(dpos+4);
|
||||
if (!Tcl_SetVar2Ex(interp, varsym.c_str(), key.c_str(),
|
||||
Tcl_NewIntObj((int)::strtol(val.c_str(),nullptr,8)),
|
||||
Tcl_NewIntObj(int(::strtol(val.c_str(),nullptr,8))),
|
||||
TCL_LEAVE_ERR_MSG)) return kERR;
|
||||
} else {
|
||||
return args.Quit(string("bad sym spec: ") + line);
|
||||
@ -1107,7 +1108,7 @@ int RtclRw11Cpu::M_ldasm(RtclArgs& args)
|
||||
if (line.length() != 10)
|
||||
return args.Quit(string("bad dat spec: ") + line);
|
||||
dtyp = line[0];
|
||||
dot = (uint16_t)::strtol(line.c_str()+2,nullptr,8);
|
||||
dot = uint16_t(::strtol(line.c_str()+2,nullptr,8));
|
||||
} else if (line[0] == '}') {
|
||||
dtyp = ' ';
|
||||
} else {
|
||||
@ -1115,7 +1116,7 @@ int RtclRw11Cpu::M_ldasm(RtclArgs& args)
|
||||
string dat;
|
||||
while (datstream >> dat) {
|
||||
//cout << "+++1 " << dtyp << ":" << dat << endl;
|
||||
uint16_t val = (uint16_t)::strtol(dat.c_str(),nullptr,8);
|
||||
uint16_t val = uint16_t(::strtol(dat.c_str(),nullptr,8));
|
||||
if (dtyp == 'w') {
|
||||
cmap[dot] = val;
|
||||
dot += 2;
|
||||
@ -1505,7 +1506,7 @@ bool RtclRw11Cpu::GetIAddr(RtclArgs& args, uint16_t& ibaddr)
|
||||
// if a number is given..
|
||||
if (Tcl_GetIntFromObj(nullptr, pobj, &tstint) == kOK) {
|
||||
if (tstint >= 0 && tstint <= 0xffff && (tstint & 0x1) == 0) {
|
||||
ibaddr = (uint16_t)tstint;
|
||||
ibaddr = uint16_t(tstint);
|
||||
} else {
|
||||
args.AppendResult("-E: value '", Tcl_GetString(pobj),
|
||||
"' for 'addr' odd number or out of range 0...0xffff",
|
||||
@ -1540,7 +1541,7 @@ bool RtclRw11Cpu::GetRAddr(RtclArgs& args, uint16_t& rbaddr)
|
||||
// if a number is given..
|
||||
if (Tcl_GetIntFromObj(nullptr, pobj, &tstint) == kOK) {
|
||||
if (tstint >= 0 && tstint <= 0xffff) {
|
||||
rbaddr = (uint16_t)tstint;
|
||||
rbaddr = uint16_t(tstint);
|
||||
} else {
|
||||
args.AppendResult("-E: value '", Tcl_GetString(pobj),
|
||||
"' for 'addr' out of range 0...0xffff",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclRw11UnitTerm.cpp 1082 2018-12-15 13:56:20Z mueller $
|
||||
// $Id: RtclRw11UnitTerm.cpp 1089 2018-12-19 10:45:41Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-18 1089 1.1.3 use c++ style casts
|
||||
// 2018-12-15 1082 1.1.2 use lambda instead of bind
|
||||
// 2018-10-06 1053 1.1.1 move using after includes (clang warning)
|
||||
// 2017-04-08 870 1.1 use Rw11UnitTerm& ObjUV(); inherit from RtclRw11Unit
|
||||
@ -62,7 +63,8 @@ int RtclRw11UnitTerm::M_type(RtclArgs& args)
|
||||
if (!args.GetArg("text", text)) return TCL_ERROR;
|
||||
if (!args.AllDone()) return TCL_ERROR;
|
||||
|
||||
ObjUV().RcvCallback((const uint8_t*)text.data(), text.size());
|
||||
ObjUV().RcvCallback(reinterpret_cast<const uint8_t*>(text.data()),
|
||||
text.size());
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user