1
0
mirror of https://github.com/wfjm/w11.git synced 2026-01-20 10:24:25 +00:00

mixed bag of small backend code updates

- RlinkCommand,RlinkCommandList: add move version of methods
- use constructor delegation
- use nullptr
- drop empty destructors for pod-only classes
- RlinkCommand: rename IsBlockExt -> HasBlockExt
- RlinkConnect: add BadPort(); used on all hard port checks
- remove contraproductive moves (-Wpessimizing-move)
- add casts (-Wfloat-conversion, -Wdouble-promotion)
- virtual dtor now outlined to streamline vtable
- make Dump non virtual in some cases (-Wnon-virtual-dtor)
- rename variables in shadow situations (-Wshadow)
This commit is contained in:
wfjm 2018-12-27 09:04:19 +01:00
parent 89732fe3e0
commit 0fe9cd8acc
39 changed files with 234 additions and 157 deletions

View File

@ -101,7 +101,6 @@ The full set of tests is only run for tagged releases.
- use for C++ compiles `-Wpedantic` (in addition to `-Wall` and `-Wextra`)
- fixes for uninitialized variables (coverity, all uncritical)
- catch exceptions in dtors (coverity, use Catch2Cerr)
- use `nullptr` instead of plain '0'
- use `[[noreturn]]` (clang -Wmissing-noreturn)
- drop never reached returns (clang -Wunreachable-code-return)
- drop `throw()` lists, use `noexcept` (clang -Wdeprecated)
@ -110,12 +109,19 @@ The full set of tests is only run for tagged releases.
- now -Wunused-variable clean (comment out so far unused code)
- move `using namespace std` after includes (clang warning)
- some selected clang -Weverything aspects
- now -Wdocumentation clean (some wrong doxygen trailing comments)
- 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)
- use std::boolalpha; add and use Rprintf(bool);
- use c++ style casts (gcc/clang -Wold-style-cast)
- now -Wdocumentation clean (some wrong doxygen trailing comments)
- rename variables in shadow situations (-Wshadow)
- add casts (-Wfloat-conversion, -Wdouble-promotion)
- make Dump non virtual in some cases (-Wnon-virtual-dtor)
- use c++11 language features
- use `nullptr` instead of plain '0'
- use auto, emplace() and range loops
- use unique_ptr instead of free pointers, avoid explicit `delete`
- add and use move semantic
- use constructor delegation
- use range loops
- use std::boolalpha; add and use Rprintf(bool);
- completely replace boost with std
- use std::unique_ptr instead of boost::scoped_ptr
- use std::shared_ptr instead of boost

View File

@ -1,4 +1,4 @@
// $Id: RlinkCommand.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: RlinkCommand.cpp 1091 2018-12-23 12:38:29Z 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-23 1091 1.4.2 CmdWblk(),SetBlockWrite(): add move version
// 2018-12-19 1090 1.4.1 use RosPrintf(bool)
// 2018-12-01 1076 1.4 use unique_ptr
// 2017-04-07 868 1.3.2 Dump(): add detail arg
@ -167,6 +168,16 @@ void RlinkCommand::CmdWblk(uint16_t addr, const std::vector<uint16_t>& block)
//------------------------------------------+-----------------------------------
//! FIXME_docs
void RlinkCommand::CmdWblk(uint16_t addr, std::vector<uint16_t>&& block)
{
SetCommand(kCmdWblk, addr);
SetBlockWrite(move(block));
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
void RlinkCommand::CmdWblk(uint16_t addr, const uint16_t* pblock, size_t size)
{
SetCommand(kCmdWblk, addr);
@ -211,7 +222,22 @@ void RlinkCommand::SetBlockWrite(const std::vector<uint16_t>& block)
if (block.size() == 0 || block.size() > 65535)
throw Rexception("RlinkCommand::SetBlockWrite()",
"Bad args: invalid block size");
fBlock = block;
fBlock = block;
fpBlockExt = nullptr;
fBlockExtSize = 0;
fBlockDone = 0;
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
void RlinkCommand::SetBlockWrite(std::vector<uint16_t>&& block)
{
if (block.size() == 0 || block.size() > 65535)
throw Rexception("RlinkCommand::SetBlockWrite()",
"Bad args: invalid block size");
fBlock = move(block);
fpBlockExt = nullptr;
fBlockExtSize = 0;
fBlockDone = 0;

View File

@ -1,4 +1,4 @@
// $Id: RlinkCommand.hpp 1076 2018-12-02 12:45:49Z mueller $
// $Id: RlinkCommand.hpp 1092 2018-12-24 08:01:50Z mueller $
//
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -13,6 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-24 1092 1.4.2 rename IsBlockExt -> HasBlockExt
// 2018-12-23 1091 1.4.1 CmdWblk(),SetBlockWrite(): add move version
// 2018-12-01 1076 1.4 use unique_ptr
// 2017-04-07 868 1.3.2 Dump(): add detail arg
// 2017-03-11 859 1.3.1 add CommandInfo()
@ -64,6 +66,7 @@ namespace Retro {
void CmdRblk(uint16_t addr, uint16_t* pblock, size_t size);
void CmdWreg(uint16_t addr, uint16_t data);
void CmdWblk(uint16_t addr, const std::vector<uint16_t>& block);
void CmdWblk(uint16_t addr, std::vector<uint16_t>&& block);
void CmdWblk(uint16_t addr, const uint16_t* pblock, size_t size);
void CmdLabo();
void CmdAttn();
@ -74,6 +77,7 @@ namespace Retro {
void SetAddress(uint16_t addr);
void SetData(uint16_t data);
void SetBlockWrite(const std::vector<uint16_t>& block);
void SetBlockWrite(std::vector<uint16_t>&& block);
void SetBlockRead(size_t size) ;
void SetBlockExt(uint16_t* pblock, size_t size);
void SetBlockDone(uint16_t dcnt);
@ -93,7 +97,7 @@ namespace Retro {
uint16_t Address() const;
uint16_t Data() const;
const std::vector<uint16_t>& Block() const;
bool IsBlockExt() const;
bool HasBlockExt() const;
uint16_t* BlockPointer();
const uint16_t* BlockPointer() const;
size_t BlockSize() const;

View File

@ -1,4 +1,4 @@
// $Id: RlinkCommand.ipp 1076 2018-12-02 12:45:49Z mueller $
// $Id: RlinkCommand.ipp 1092 2018-12-24 08:01:50Z 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-24 1092 1.4.1 rename IsBlockExt -> HasBlockExt
// 2018-12-01 1076 1.4 use unique_ptr
// 2015-04-02 661 1.3 expect logic: add stat check, Print() without cntx
// 2014-11-02 600 1.2 new rlink v4 iface
@ -219,9 +220,9 @@ inline const std::vector<uint16_t>& RlinkCommand::Block() const
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline bool RlinkCommand::IsBlockExt() const
inline bool RlinkCommand::HasBlockExt() const
{
return fpBlockExt != 0;
return bool(fpBlockExt);
}
//------------------------------------------+-----------------------------------
@ -229,7 +230,7 @@ inline bool RlinkCommand::IsBlockExt() const
inline uint16_t* RlinkCommand::BlockPointer()
{
return IsBlockExt() ? fpBlockExt : (fBlock.size() ? &fBlock[0] : 0);
return HasBlockExt() ? fpBlockExt : (fBlock.size() ? &fBlock[0] : nullptr);
}
//------------------------------------------+-----------------------------------
@ -237,7 +238,7 @@ inline uint16_t* RlinkCommand::BlockPointer()
inline const uint16_t* RlinkCommand::BlockPointer() const
{
return IsBlockExt() ? fpBlockExt : (fBlock.size() ? &fBlock[0] : 0);
return HasBlockExt() ? fpBlockExt : (fBlock.size() ? &fBlock[0] : nullptr);
}
//------------------------------------------+-----------------------------------
@ -245,7 +246,7 @@ inline const uint16_t* RlinkCommand::BlockPointer() const
inline size_t RlinkCommand::BlockSize() const
{
return IsBlockExt() ? fBlockExtSize : fBlock.size();
return HasBlockExt() ? fBlockExtSize : fBlock.size();
}
//------------------------------------------+-----------------------------------

View File

@ -1,4 +1,4 @@
// $Id: RlinkCommandExpect.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RlinkCommandExpect.cpp 1090 2018-12-21 12:17:35Z 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-21 1090 1.1.3 use constructor delegation
// 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
@ -51,10 +52,7 @@ namespace Retro {
//! Default constructor
RlinkCommandExpect::RlinkCommandExpect()
: fDataVal(0),
fDataMsk(0x0),
fBlockVal(),
fBlockMsk()
: RlinkCommandExpect(0,0x0)
{}
//------------------------------------------+-----------------------------------

View File

@ -1,4 +1,4 @@
// $Id: RlinkCommandList.cpp 1077 2018-12-07 19:37:03Z mueller $
// $Id: RlinkCommandList.cpp 1091 2018-12-23 12:38:29Z 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-23 1091 1.4.2 AddWblk(): add move version
// 2018-12-07 1077 1.4.1 SetLastExpectBlock: add move versions
// 2018-12-01 1076 1.4 use unique_ptr
// 2018-10-28 1062 1.3.3 replace boost/foreach
@ -148,7 +149,8 @@ size_t RlinkCommandList::AddWreg(uint16_t addr, uint16_t data)
//------------------------------------------+-----------------------------------
//! FIXME_docs
size_t RlinkCommandList::AddWblk(uint16_t addr, std::vector<uint16_t> block)
size_t RlinkCommandList::AddWblk(uint16_t addr,
const std::vector<uint16_t>& block)
{
cmd_uptr_t upcmd(new RlinkCommand());
upcmd->CmdWblk(addr, block);
@ -158,6 +160,16 @@ size_t RlinkCommandList::AddWblk(uint16_t addr, std::vector<uint16_t> block)
//------------------------------------------+-----------------------------------
//! FIXME_docs
size_t RlinkCommandList::AddWblk(uint16_t addr, std::vector<uint16_t>&& block)
{
cmd_uptr_t upcmd(new RlinkCommand());
upcmd->CmdWblk(addr, move(block));
return AddCommand(move(upcmd));
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
size_t RlinkCommandList::AddWblk(uint16_t addr, const uint16_t* block,
size_t size)
{

View File

@ -1,4 +1,4 @@
// $Id: RlinkCommandList.hpp 1077 2018-12-07 19:37:03Z mueller $
// $Id: RlinkCommandList.hpp 1091 2018-12-23 12:38:29Z 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-23 1091 1.4.2 AddWblk(): add move version
// 2018-12-07 1077 1.4.1 SetLastExpectBlock: add move versions
// 2018-12-01 1076 1.4 use unique_ptr
// 2017-04-02 865 1.3.1 Dump(): add detail arg
@ -62,7 +63,8 @@ namespace Retro {
size_t AddRblk(uint16_t addr, size_t size);
size_t AddRblk(uint16_t addr, uint16_t* block, size_t size);
size_t AddWreg(uint16_t addr, uint16_t data);
size_t AddWblk(uint16_t addr, std::vector<uint16_t> block);
size_t AddWblk(uint16_t addr, const std::vector<uint16_t>& block);
size_t AddWblk(uint16_t addr, std::vector<uint16_t>&& block);
size_t AddWblk(uint16_t addr, const uint16_t* block, size_t size);
size_t AddLabo();
size_t AddAttn();

View File

@ -1,4 +1,4 @@
// $Id: RlinkConnect.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: RlinkConnect.cpp 1091 2018-12-23 12:38:29Z 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-22 1091 2.8.4 Open(): (-Wpessimizing-move fix); add BadPort()
// 2018-12-19 1090 2.8.3 use RosPrintf(bool)
// 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
@ -177,7 +178,7 @@ bool RlinkConnect::Open(const std::string& name, RerrMsg& emsg)
{
Close();
fupPort = move(RlinkPortFactory::Open(name, emsg));
fupPort = RlinkPortFactory::Open(name, emsg);
if (!HasPort()) return false;
fSndPkt.SetXonEscape(Port().XonEnable()); // transfer XON enable
@ -209,7 +210,7 @@ void RlinkConnect::Close()
if (fpServ) fpServ->Stop(); // stop server in case still running
if (Port().Url().FindOpt("keep")) {
if (IsOpen() && Port().Url().FindOpt("keep")) {
RerrMsg emsg;
fSndPkt.SndKeep(Port(), emsg);
}
@ -515,12 +516,13 @@ int RlinkConnect::WaitAttn(const Rtime& timeout, Rtime& twait,
Rtime tbeg = tnow;
while (tnow < tend) {
if (!IsOpen()) BadPort("RlinkConnect::WaitAttn");
int irc = fRcvPkt.ReadData(Port(), tend-tnow, emsg);
if (irc == RlinkPort::kTout) return -1;
if (irc == RlinkPort::kErr) return -2;
tnow.GetClock(CLOCK_MONOTONIC);
while (fRcvPkt.ProcessData()) {
int irc = fRcvPkt.PacketState();
irc = fRcvPkt.PacketState();
if (irc == RlinkPacketBufRcv::kPktPend) break;
if (irc == RlinkPacketBufRcv::kPktAttn) {
ProcessAttnNotify();
@ -547,6 +549,7 @@ int RlinkConnect::WaitAttn(const Rtime& timeout, Rtime& twait,
bool RlinkConnect::SndOob(uint16_t addr, uint16_t data, RerrMsg& emsg)
{
if (!IsOpen()) BadPort("RlinkConnect::SndOob");
lock_guard<RlinkConnect> lock(*this);
fStats.Inc(kStatNSndOob);
return fSndPkt.SndOob(Port(), addr, data, emsg);
@ -557,6 +560,7 @@ bool RlinkConnect::SndOob(uint16_t addr, uint16_t data, RerrMsg& emsg)
bool RlinkConnect::SndAttn(RerrMsg& emsg)
{
if (!IsOpen()) BadPort("RlinkConnect::SndAttn");
lock_guard<RlinkConnect> lock(*this);
return fSndPkt.SndAttn(Port(), emsg);
}
@ -743,6 +747,7 @@ void RlinkConnect::HandleUnsolicitedData()
lock_guard<RlinkConnect> lock(*this);
RerrMsg emsg;
if (!IsOpen()) BadPort("RlinkConnect::HandleUnsolicitedData");
int irc = fRcvPkt.ReadData(Port(), Rtime(), emsg);
if (irc == 0) return;
if (irc < 0) {
@ -1087,6 +1092,7 @@ bool RlinkConnect::ReadResponse(const Rtime& timeout, RerrMsg& emsg)
Rtime tend = tnow + timeout;
while (tnow < tend) {
if (!IsOpen()) BadPort("RlinkConnect::ReadResponse");
int irc = fRcvPkt.ReadData(Port(), tend-tnow, emsg);
if (irc <= 0) {
RlogMsg lmsg(*fspLog, 'E');
@ -1095,7 +1101,7 @@ bool RlinkConnect::ReadResponse(const Rtime& timeout, RerrMsg& emsg)
}
while (fRcvPkt.ProcessData()) {
int irc = fRcvPkt.PacketState();
irc = fRcvPkt.PacketState();
if (irc == RlinkPacketBufRcv::kPktPend) break;
if (irc == RlinkPacketBufRcv::kPktAttn) {
ProcessAttnNotify();
@ -1211,4 +1217,14 @@ void RlinkConnect::ProcessAttnNotify()
return;
}
//------------------------------------------+-----------------------------------
//! Port not connected or not open abort.
[[noreturn]]
void RlinkConnect::BadPort(const char* meth)
{
throw Rexception(meth, "Bad state: port not open");
}
} // end namespace Retro

View File

@ -1,4 +1,4 @@
// $Id: RlinkConnect.hpp 1088 2018-12-17 17:37:00Z mueller $
// $Id: RlinkConnect.hpp 1091 2018-12-23 12:38:29Z 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-23 1091 2.8.3 add BadPort()
// 2018-12-17 1085 2.8.2 use std::recursive_mutex instead of boost
// 2018-12-16 1084 2.8.1 use =delete for noncopyable instead of boost
// 2018-12-08 1079 2.8 add HasPort(); return ref for Port()
@ -65,6 +66,7 @@
#include "librtools/Rtime.hpp"
#include "librtools/Rstats.hpp"
#include "librtools/RlogFile.hpp"
#include "librtools/Rexception.hpp"
#include "RlinkPort.hpp"
#include "RlinkCommandList.hpp"
@ -240,6 +242,7 @@ namespace Retro {
void AcceptResponse();
void ProcessUnsolicitedData();
void ProcessAttnNotify();
[[noreturn]] void BadPort(const char* meth);
protected:
RlinkPort::port_uptr_t fupPort; //!< uptr to port

View File

@ -1,6 +1,6 @@
// $Id: RlinkCrc16.hpp 983 2018-01-02 20:35:59Z mueller $
// $Id: RlinkCrc16.hpp 1091 2018-12-23 12:38:29Z 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-22 1091 1.0.1 Drop empty dtors for pod-only classes
// 2014-11-08 602 1.0 Initial version
// ---------------------------------------------------------------------------
@ -33,7 +34,6 @@ namespace Retro {
class RlinkCrc16 {
public:
RlinkCrc16();
~RlinkCrc16();
void Clear();
void AddData(uint8_t data);

View File

@ -1,4 +1,4 @@
// $Id: RlinkCrc16.ipp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RlinkCrc16.ipp 1091 2018-12-23 12:38:29Z 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-22 1091 1.0.2 Drop empty dtors for pod-only classes
// 2018-12-18 1089 1.0.1 use c++ style casts
// 2014-11-08 602 1.0 Initial version
// ---------------------------------------------------------------------------
@ -32,12 +33,6 @@ inline RlinkCrc16::RlinkCrc16()
: fCrc(0)
{}
//------------------------------------------+-----------------------------------
//! Destructor
inline RlinkCrc16::~RlinkCrc16()
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs

View File

@ -1,4 +1,4 @@
// $Id: RlinkPacketBufRcv.cpp 1079 2018-12-09 10:56:59Z mueller $
// $Id: RlinkPacketBufRcv.cpp 1091 2018-12-23 12:38:29Z 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-23 1091 1.2.1 ReadData(): remove port open check, done at caller
// 2018-12-08 1079 1.2 use ref not ptr for RlinkPort
// 2017-04-07 868 1.1.1 Dump(): add detail arg
// 2017-02-19 853 1.1 use Rtime
@ -80,9 +81,6 @@ RlinkPacketBufRcv::~RlinkPacketBufRcv()
int RlinkPacketBufRcv::ReadData(RlinkPort& port, const Rtime& timeout,
RerrMsg& emsg)
{
if (&port==nullptr || !port.IsOpen())
throw Rexception("RlinkPacketBufRcv::ReadData()",
"Bad state: port not open");
if (fRawBufDone != fRawBufSize)
throw Rexception("RlinkPacketBufRcv::ReadData()",
"Bad state: called while data pending in buffer");

View File

@ -1,4 +1,4 @@
// $Id: RlinkPacketBufSnd.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: RlinkPacketBufSnd.cpp 1091 2018-12-23 12:38:29Z 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-23 1091 1.2.3 SndRaw(): remove port open check, done at caller
// 2018-12-19 1090 1.2.2 use RosPrintf(bool)
// 2018-12-18 1089 1.2.1 use c++ style casts
// 2018-12-08 1079 1.2 use ref not ptr for RlinkPort
@ -35,7 +36,6 @@
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintf.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/Rexception.hpp"
using namespace std;
@ -241,9 +241,6 @@ void RlinkPacketBufSnd::Dump(std::ostream& os, int ind, const char* text,
bool RlinkPacketBufSnd::SndRaw(RlinkPort& port, RerrMsg& emsg)
{
if (&port==nullptr || !port.IsOpen())
throw Rexception("RlinkPacketBufSnd::SndRaw()", "Bad state: port not open");
size_t rawbufsize = fRawBuf.size();
int irc = port.Write(fRawBuf.data(), rawbufsize, emsg);
if (irc < 0) return false;

View File

@ -1,4 +1,4 @@
// $Id: RlinkPortTerm.cpp 1075 2018-12-01 11:55:07Z mueller $
// $Id: RlinkPortTerm.cpp 1091 2018-12-23 12:38:29Z 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-22 1091 1.3.5 Open(): add time_t cast (-Wfloat-conversion fix)
// 2018-11-30 1075 1.3.4 use list-init
// 2018-09-21 1048 1.3.3 coverity fixup (uninitialized field)
// 2017-04-15 875 1.3.2 Open(): set default scheme
@ -172,7 +173,7 @@ bool RlinkPortTerm::Open(const std::string& url, RerrMsg& emsg)
return false;
}
double fcdivisor = double(sioctl.baud_base) / double(nsbaud);
cdivisor = fcdivisor + 0.5;
cdivisor = int(fcdivisor + 0.5);
speed = B38400;
}

View File

@ -1,4 +1,4 @@
// $Id: RtclRlinkConnect.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclRlinkConnect.cpp 1091 2018-12-23 12:38:29Z 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-23 1091 1.6.8 use AddWblk(move)
// 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
@ -265,7 +266,7 @@ int RtclRlinkConnect::M_exec(RtclArgs& args)
if (!GetAddr(args, addr)) return kERR;
if (!args.GetArg("data", block, 1, Obj().BlockSizeMax())) return kERR;
if (!GetVarName(args, "??varStat", lsize, varstat)) return kERR;
clist.AddWblk(addr, block);
clist.AddWblk(addr, move(block));
} else if (opt == "-labo") { // -labo varData ?varStat ---------
if (!GetVarName(args, "??varData", lsize, vardata)) return kERR;

View File

@ -1,4 +1,4 @@
// $Id: RtclRlinkPort.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclRlinkPort.cpp 1091 2018-12-23 12:38:29Z 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-22 1091 1.4.3 M_Open(): drop move() (-Wpessimizing-move fix)
// 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
@ -104,7 +105,7 @@ int RtclRlinkPort::M_open(RtclArgs& args)
RerrMsg emsg;
if (args.NOptMiss() == 0) { // open path
fupObj = move(RlinkPortFactory::Open(path, emsg));
fupObj = RlinkPortFactory::Open(path, emsg);
SetupGetSet();
if (!fupObj) return args.Quit(emsg);
fupObj->SetLogFile(fspLog);
@ -294,7 +295,7 @@ void RtclRlinkPort::SetLogFileName(const std::string& name)
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline const std::string& RtclRlinkPort::LogFileName() const
const std::string& RtclRlinkPort::LogFileName() const
{
return fspLog->Name();
}

View File

@ -1,4 +1,4 @@
// $Id: RtclArgs.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclArgs.cpp 1091 2018-12-23 12:38:29Z 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-22 1091 1.0.12 GetArg(float): float cast (-Wdouble-promotion fix)
// 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)
@ -61,7 +62,7 @@ namespace Retro {
RtclArgs::RtclArgs()
: fpInterp(nullptr),
fObjc(0),
fObjv(0),
fObjv(nullptr),
fNDone(0),
fNOptMiss(0),
fNConfigRead(0),
@ -247,7 +248,7 @@ 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 = val;
double vald = double(val);
bool ret = GetArg(name, vald, double(min), double(max));
val = float(vald);
return ret;

View File

@ -1,4 +1,4 @@
// $Id: RtclGet.ipp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclGet.ipp 1091 2018-12-23 12:38:29Z 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-22 1091 1.2.4 <float> add float cast (-Wdouble-promotion fix)
// 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
@ -158,7 +159,7 @@ template <>
inline Tcl_Obj* RtclGet<float>::operator()() const
{
float val = fGet();
return Tcl_NewDoubleObj(val);
return Tcl_NewDoubleObj(double(val));
}
//------------------------------------------+-----------------------------------

View File

@ -1,4 +1,4 @@
// $Id: RtclOPtr.ipp 983 2018-01-02 20:35:59Z mueller $
// $Id: RtclOPtr.ipp 1090 2018-12-21 12:17:35Z mueller $
//
// Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -33,7 +33,7 @@ namespace Retro {
//! Default constructor
inline RtclOPtr::RtclOPtr()
: fpObj(0)
: fpObj(nullptr)
{}
//------------------------------------------+-----------------------------------
@ -75,7 +75,7 @@ inline RtclOPtr::operator Tcl_Obj*() const
inline bool RtclOPtr::operator !() const
{
return fpObj==0;
return fpObj==nullptr;
}
//------------------------------------------+-----------------------------------

View File

@ -1,4 +1,4 @@
// $Id: RtclProxyBase.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclProxyBase.cpp 1090 2018-12-21 12:17:35Z mueller $
//
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -54,7 +54,7 @@ namespace Retro {
RtclProxyBase::RtclProxyBase(const std::string& type)
: RtclCmdBase(),
fType(type),
fInterp(0),
fInterp(nullptr),
fCmdToken(0)
{}
@ -65,7 +65,7 @@ RtclProxyBase::RtclProxyBase(const std::string& type, Tcl_Interp* interp,
const char* name)
: RtclCmdBase(),
fType(type),
fInterp(0)
fInterp(nullptr)
{
CreateObjectCmd(interp, name);
}

View File

@ -1,4 +1,4 @@
// $Id: RtclProxyOwned.hpp 1078 2018-12-08 14:19:03Z mueller $
// $Id: RtclProxyOwned.hpp 1090 2018-12-21 12:17:35Z mueller $
//
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -39,7 +39,7 @@ namespace Retro {
RtclProxyOwned();
RtclProxyOwned(const std::string& type);
RtclProxyOwned(const std::string& type, Tcl_Interp* interp,
const char* name, TO* pobj=0);
const char* name, TO* pobj=nullptr);
~RtclProxyOwned();
TO& Obj();

View File

@ -1,4 +1,4 @@
// $Id: RtclSet.ipp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclSet.ipp 1091 2018-12-23 12:38:29Z 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-22 1091 1.1.4 <float> add float cast (-Wdouble-promotion fix)
// 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
@ -217,7 +218,7 @@ inline void RtclSet<float>::operator()(RtclArgs& args) const
double val;
if(Tcl_GetDoubleFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
throw Rexception("RtclSet<>::oper()", "conversion error");
if (val < -FLT_MAX || val > FLT_MAX)
if (val < -double(FLT_MAX) || val > double(FLT_MAX))
throw Rexception("RtclSet<>::oper()",
"out of range for type 'float'");

View File

@ -1,6 +1,6 @@
// $Id: RerrMsg.cpp 983 2018-01-02 20:35:59Z mueller $
// $Id: RerrMsg.cpp 1090 2018-12-21 12:17:35Z 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-21 1090 1.2.1 use constructor delegation
// 2013-01-12 474 1.2 add meth+text and meth+text+errnum ctors
// 2011-02-06 359 1.1 use references in interface, fix printf usage
// 2011-01-15 356 1.0 Initial version
@ -51,8 +52,7 @@ RerrMsg::RerrMsg()
//! Copy constructor
RerrMsg::RerrMsg(const RerrMsg& rhs)
: fMeth(rhs.fMeth),
fText(rhs.fText)
: RerrMsg(rhs.fMeth, rhs.fText)
{}
//------------------------------------------+-----------------------------------
@ -67,8 +67,7 @@ RerrMsg::RerrMsg(const std::string& meth, const std::string& text)
//! Construct from method and message text and errno
RerrMsg::RerrMsg(const std::string& meth, const std::string& text, int errnum)
: fMeth(meth),
fText(text)
: RerrMsg(meth, text)
{
AppendErrno(errnum);
}

View File

@ -1,4 +1,4 @@
// $Id: RiosState.cpp 1060 2018-10-27 11:32:39Z mueller $
// $Id: RiosState.cpp 1090 2018-12-21 12:17:35Z mueller $
//
// Copyright 2006-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-21 1090 1.0.1 use constructor delegation
// 2011-01-30 357 1.0 Adopted from CTBioState
// 2006-04-16 - - Last change on CTBioState
// ---------------------------------------------------------------------------
@ -38,23 +39,19 @@ namespace Retro {
//! Construct with stream.
RiosState::RiosState(ios& stream)
: fStream(stream)
{
fOldFlags = fStream.flags();
fOldPrecision = -1;
fOldFill = 0;
fCtype = 0;
}
: fStream(stream),
fOldFlags(fStream.flags()),
fOldPrecision(-1),
fOldFill(0),
fCtype(0)
{}
//------------------------------------------+-----------------------------------
//! Construct from stream and format.
RiosState::RiosState(ios& stream, const char* form, int prec)
: fStream(stream)
: RiosState(stream)
{
fOldFlags = fStream.flags();
fOldPrecision = -1;
fOldFill = 0;
SetFormat(form, prec);
}

View File

@ -1,4 +1,4 @@
// $Id: RiosState.hpp 983 2018-01-02 20:35:59Z mueller $
// $Id: RiosState.hpp 1091 2018-12-23 12:38:29Z mueller $
//
// Copyright 2006-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -34,7 +34,7 @@ namespace Retro {
public:
RiosState(std::ios& stream);
RiosState(std::ios& stream, const char* form, int prec=-1);
~RiosState();
~RiosState();
void SetFormat(const char* form, int prec=-1);
char Ctype();

View File

@ -1,6 +1,6 @@
// $Id: RosPrintfBase.cpp 983 2018-01-02 20:35:59Z mueller $
// $Id: RosPrintfBase.cpp 1091 2018-12-23 12:38:29Z mueller $
//
// Copyright 2011- 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-22 1091 1.0.1 virtual dtor now outlined to streamline vtable
// 2011-02-25 364 1.0 Initial version
// ---------------------------------------------------------------------------
@ -30,6 +31,14 @@ using namespace std;
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
/*!
\brief Destructor.
*/
RosPrintfBase::~RosPrintfBase()
{}
//------------------------------------------+-----------------------------------
/*!
\relates RosPrintfBase

View File

@ -1,4 +1,4 @@
// $Id: RosPrintfBase.hpp 983 2018-01-02 20:35:59Z mueller $
// $Id: RosPrintfBase.hpp 1091 2018-12-23 12:38:29Z mueller $
//
// Copyright 2006-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -34,7 +34,7 @@ namespace Retro {
class RosPrintfBase {
public:
RosPrintfBase(const char* form, int width, int prec);
virtual ~RosPrintfBase();
virtual ~RosPrintfBase();
virtual void ToStream(std::ostream& os) const = 0;

View File

@ -1,6 +1,6 @@
// $Id: RosPrintfBase.ipp 983 2018-01-02 20:35:59Z mueller $
// $Id: RosPrintfBase.ipp 1091 2018-12-23 12:38:29Z mueller $
//
// Copyright 2006-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2006-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-22 1091 1.0.1 virtual dtor now outlined to streamline vtable
// 2011-01-30 357 1.0 Adopted from RosPrintfBase
// 2006-04-16 - - Last change on RosPrintfBase
// ---------------------------------------------------------------------------
@ -50,14 +51,6 @@ inline RosPrintfBase::RosPrintfBase(const char* form, int width, int prec)
fPrec(prec)
{}
//------------------------------------------+-----------------------------------
/*!
\brief Destructor.
*/
inline RosPrintfBase::~RosPrintfBase()
{}
//------------------------------------------+-----------------------------------
/*!
\relates RosPrintfBase

View File

@ -1,6 +1,6 @@
// $Id: Rtime.hpp 983 2018-01-02 20:35:59Z mueller $
// $Id: Rtime.hpp 1091 2018-12-23 12:38:29Z 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-22 1091 1.0.1 Drop empty dtors for pod-only classes
// 2017-02-19 853 1.0 Initial version
// ---------------------------------------------------------------------------
@ -36,7 +37,6 @@ namespace Retro {
Rtime();
explicit Rtime(clockid_t clkid);
explicit Rtime(double dt);
~Rtime();
void GetClock(clockid_t clkid);
void SetSec(time_t sec);

View File

@ -1,6 +1,6 @@
// $Id: Rtime.ipp 983 2018-01-02 20:35:59Z mueller $
// $Id: Rtime.ipp 1091 2018-12-23 12:38:29Z 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,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-22 1091 1.0.2 Drop empty dtors for pod-only classes
// Set(): add time_t cast (-Wfloat-conversion fix)
// 2018-12-21 1090 1.0.1 use list-init
// 2017-02-20 854 1.0 Initial version
// ---------------------------------------------------------------------------
@ -30,10 +33,8 @@ namespace Retro {
//! Default constructor
inline Rtime::Rtime()
{
fTime.tv_sec = 0;
fTime.tv_nsec = 0;
}
: fTime{}
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
@ -51,12 +52,6 @@ inline Rtime::Rtime(double dt)
Set(dt);
}
//------------------------------------------+-----------------------------------
//! Destructor
inline Rtime::~Rtime()
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
@ -80,8 +75,8 @@ inline void Rtime::Set(double dt)
{
double nsec = floor(1.e9*dt);
double sec = floor(dt);
fTime.tv_sec = sec;
fTime.tv_nsec = nsec - 1.e9*sec;
fTime.tv_sec = time_t(sec);
fTime.tv_nsec = long(nsec - 1.e9*sec);
return;
}

View File

@ -1,4 +1,4 @@
// $Id: RtclSystem.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclSystem.cpp 1091 2018-12-23 12:38:29Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -13,7 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-18 1089 1.0.2 use c++ style casts
// 2018-12-23 1091 1.0.2 use c++ style casts; use range loop
// 2014-08-22 584 1.0.1 use nullptr
// 2013-05-17 521 1.0 Initial version
// ---------------------------------------------------------------------------
@ -125,7 +125,6 @@ int RtclSystem::SignalAction(ClientData /*cdata*/, Tcl_Interp* interp,
// check if initialized, if not, do it
if (!RtclSignalAction::Obj()) {
RerrMsg emsg;
if (!RtclSignalAction::Init(interp, emsg)) return args.Quit(emsg);
}
RtclSignalAction* pact = RtclSignalAction::Obj();
@ -147,12 +146,12 @@ int RtclSystem::SignalAction(ClientData /*cdata*/, Tcl_Interp* interp,
} else if (opt == "-info") { // -info
RtclOPtr pres(Tcl_NewListObj(0,nullptr));
int siglist[] = {SIGHUP,SIGINT,SIGTERM,SIGUSR1,SIGUSR2};
for (size_t i=0; i<sizeof(siglist)/sizeof(int); i++) {
for (auto& sig : siglist) {
Tcl_Obj* pobj;
if (pact->GetAction(siglist[i], pobj, emsg)) {
if (pact->GetAction(sig, pobj, emsg)) {
RtclOPtr pele(Tcl_NewListObj(0,0));
Tcl_ListObjAppendElement(nullptr, pele,
Tcl_NewStringObj(signum2nam(siglist[i]),-1));
Tcl_NewStringObj(signum2nam(sig),-1));
if (pobj) {
Tcl_ListObjAppendElement(nullptr, pele, pobj);
} else {

View File

@ -1,6 +1,6 @@
// $Id: RethBuf.hpp 983 2018-01-02 20:35:59Z mueller $
// $Id: RethBuf.hpp 1091 2018-12-23 12:38:29Z 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-22 1091 1.0.1 Dump() not longer virtual (-Wnon-virtual-dtor fix)
// 2017-04-17 880 1.0 Initial version
// 2017-02-12 850 0.1 First draft
// ---------------------------------------------------------------------------
@ -70,7 +71,7 @@ namespace Retro {
std::string FrameInfo() const;
virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
void Dump(std::ostream& os, int ind=0, const char* text=0,
int detail=0) const;
// some constants

View File

@ -1,4 +1,4 @@
// $Id: Rw11CntlRL11.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: Rw11CntlRL11.cpp 1091 2018-12-23 12:38:29Z mueller $
//
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Other credits:
@ -16,6 +16,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-22 1091 1.0.10 AttnHandler(): sa->san (-Wshadow fix)
// 2018-12-19 1090 1.0.9 use RosPrintf(bool)
// 2018-12-15 1082 1.0.8 use std::bind or lambda instead of bind
// 2018-12-09 1080 1.0.7 use HasVirt(); Virt() returns ref
@ -500,9 +501,9 @@ int Rw11CntlRL11::AttnHandler(RlinkServer::AttnArgs& args)
cpu.AddWibr(clist, fBase+kRLMP, crc);
// simulate rotation, inc sector number, wrap at end of track
uint16_t sa = (pos & kRLDA_RW_B_SA) + 1;
if (sa >= unit.NSector()) sa = 0; // wrap to begin of track
uint16_t posn = (pos & (kRLDA_RW_M_CA|kRLDA_RW_M_HS)) + sa;
uint16_t san = (pos & kRLDA_RW_B_SA) + 1;
if (san >= unit.NSector()) san = 0; // wrap to begin of track
uint16_t posn = (pos & (kRLDA_RW_M_CA|kRLDA_RW_M_HS)) + san;
AddSetPosition(clist, ds, posn);
uint16_t cs = kRLCS_M_CRDY | // signal command done

View File

@ -1,4 +1,4 @@
// $Id: Rw11Cpu.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: Rw11Cpu.cpp 1091 2018-12-23 12:38:29Z 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-23 1091 1.2.19 AddWbibr(): add move version
// 2018-12-19 1090 1.2.18 use RosPrintf(bool)
// 2018-12-17 1085 1.2.17 use std::mutex,condition_variable instead of boost
// 2018-12-07 1078 1.2.16 use std::shared_ptr instead of boost
@ -347,7 +348,7 @@ int Rw11Cpu::AddRbibr(RlinkCommandList& clist, uint16_t ibaddr, size_t size)
//------------------------------------------+-----------------------------------
//! FIXME_docs
int Rw11Cpu::AddWbibr(RlinkCommandList& clist, uint16_t ibaddr,
std::vector<uint16_t> block)
const std::vector<uint16_t>& block)
{
if ((ibaddr & 0160001) != 0160000)
throw Rexception("Rw11Cpu::AddWbibr", "ibaddr out of IO page or odd");
@ -355,6 +356,17 @@ int Rw11Cpu::AddWbibr(RlinkCommandList& clist, uint16_t ibaddr,
return clist.AddWblk(IbusRemoteAddr(ibaddr), block);
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
int Rw11Cpu::AddWbibr(RlinkCommandList& clist, uint16_t ibaddr,
std::vector<uint16_t>&& block)
{
if ((ibaddr & 0160001) != 0160000)
throw Rexception("Rw11Cpu::AddWbibr", "ibaddr out of IO page or odd");
return clist.AddWblk(IbusRemoteAddr(ibaddr), move(block));
}
//------------------------------------------+-----------------------------------
//! FIXME_docs

View File

@ -1,4 +1,4 @@
// $Id: Rw11Cpu.hpp 1085 2018-12-16 14:11:16Z mueller $
// $Id: Rw11Cpu.hpp 1091 2018-12-23 12:38:29Z 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-23 1091 1.2.15 AddWbibr(): add move version
// 2018-12-17 1085 1.2.14 use std::mutex,condition_variable instead of boost
// 2018-12-16 1084 1.2.13 use =delete for noncopyable instead of boost
// 2018-12-07 1078 1.2.12 use std::shared_ptr instead of boost
@ -113,7 +114,9 @@ namespace Retro {
int AddRbibr(RlinkCommandList& clist, uint16_t ibaddr,
size_t size);
int AddWbibr(RlinkCommandList& clist, uint16_t ibaddr,
std::vector<uint16_t> block);
const std::vector<uint16_t>& block);
int AddWbibr(RlinkCommandList& clist, uint16_t ibaddr,
std::vector<uint16_t>&& block);
int AddLalh(RlinkCommandList& clist, uint32_t addr,
uint16_t mode=kCPAH_M_22BIT);

View File

@ -1,6 +1,6 @@
// $Id: Rw11Probe.hpp 983 2018-01-02 20:35:59Z mueller $
// $Id: Rw11Probe.hpp 1091 2018-12-23 12:38:29Z mueller $
//
// Copyright 2013-2017 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-22 1091 1.1.2 Dump() not longer virtual (-Wnon-virtual-dtor fix)
// 2017-04-07 868 1.1.1 Dump(): add detail arg
// 2017-02-04 848 1.1 Keep probe data; add DataInt(), DataRem()
// 2013-03-05 495 1.0 Initial version
@ -49,7 +50,7 @@ namespace Retro {
uint16_t DataInt() const;
uint16_t DataRem() const;
virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
void Dump(std::ostream& os, int ind=0, const char* text=0,
int detail=0) const;
};

View File

@ -1,4 +1,4 @@
// $Id: Rw11VirtDiskOver.cpp 1049 2018-09-22 13:56:52Z mueller $
// $Id: Rw11VirtDiskOver.cpp 1091 2018-12-23 12:38:29Z mueller $
//
// Copyright 2017-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-22 1091 1.0.6 Read(): it->it1 (-Wshadow fix)
// 2017-06-05 907 1.0.5 more detailed stats
// 2017-06-03 903 1.0.4 Read(): BUGFIX: fix index error in blockwise read
// 2017-05-07 896 1.0.3 List(): BUGFIX: correct write count accumulation
@ -98,14 +99,14 @@ bool Rw11VirtDiskOver::Read(size_t lba, size_t nblk, uint8_t* data,
} else { // match
for (size_t i=0; i<nblk; i++) { // get it blockwise
auto it = fBlkMap.find(lba+i);
if (it == fBlkMap.end()) {
auto it1 = fBlkMap.find(lba+i);
if (it1 == fBlkMap.end()) {
fStats.Inc(kStatNVDOReadBlkFP);
bool rc = Rw11VirtDiskFile::Read(lba+i, 1, data+i*fBlkSize, emsg);
if (!rc) return rc;
} else {
fStats.Inc(kStatNVDOReadBlkO);
(it->second).Read(data+i*fBlkSize);
(it1->second).Read(data+i*fBlkSize);
}
}
}

View File

@ -1,4 +1,4 @@
// $Id: Rw11VirtTermTcp.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: Rw11VirtTermTcp.cpp 1091 2018-12-23 12:38:29Z 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-22 1091 1.0.13 pfd->pfd1 (-Wshadow fix)
// 2018-12-19 1090 1.0.12 use RosPrintf(bool)
// 2018-12-18 1089 1.0.11 use c++ style casts
// 2018-12-15 1082 1.0.10 use lambda instead of bind
@ -344,8 +345,8 @@ int Rw11VirtTermTcp::ListenPollHandler(const pollfd& pfd)
fState = ts_Stream;
Server().RemovePollHandler(fFdListen);
Server().AddPollHandler([this](const pollfd& pfd)
{ return RcvPollHandler(pfd); },
Server().AddPollHandler([this](const pollfd& pfd1)
{ return RcvPollHandler(pfd1); },
fFd, POLLIN);
return 0;
}
@ -431,8 +432,8 @@ int Rw11VirtTermTcp::RcvPollHandler(const pollfd& pfd)
}
::close(fFd);
fFd = -1;
Server().AddPollHandler([this](const pollfd& pfd)
{ return ListenPollHandler(pfd); },
Server().AddPollHandler([this](const pollfd& pfd1)
{ return ListenPollHandler(pfd1); },
fFdListen, POLLIN);
fState = ts_Listen;
return -1;

View File

@ -1,4 +1,4 @@
// $Id: RtclRw11Cpu.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclRw11Cpu.cpp 1091 2018-12-23 12:38:29Z 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-23 1091 1.2.24 use AddWbibr(move),AddWblk(move)
// 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
@ -426,7 +427,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args)
if (!GetRAddr(args, addr)) return kERR;
if (!args.GetArg("data", block, 1, Connect().BlockSizeMax())) return kERR;
if (!GetVarName(args, "??varStat", lsize, varstat)) return kERR;
clist.AddWblk(addr, block);
clist.AddWblk(addr, move(block));
} else if (opt == "-labo") { // -labo varData ?varStat ---------
if (!GetVarName(args, "??varData", lsize, vardata)) return kERR;
@ -556,7 +557,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args)
vector<uint16_t> block;
if (!args.GetArg("data", block, 1, Connect().BlockSizeMax())) return kERR;
if (!GetVarName(args, "??varStat", lsize, varstat)) return kERR;
clist.AddWblk(base + Rw11Cpu::kCPMEMI, block);
clist.AddWblk(base + Rw11Cpu::kCPMEMI, move(block));
} else if (opt == "-start") { // -start ?varStat ---------------
if (!GetVarName(args, "??varStat", lsize, varstat)) return kERR;
@ -649,7 +650,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args)
if (!GetIAddr(args, ibaddr)) return kERR;
if (!args.GetArg("data", block, 1, Connect().BlockSizeMax())) return kERR;
if (!GetVarName(args, "??varStat", lsize, varstat)) return kERR;
Obj().AddWbibr(clist, ibaddr, block);
Obj().AddWbibr(clist, ibaddr, move(block));
} else if (opt == "-rconf") { // -rconf ?varData ?varStat ------
if (!GetVarName(args, "??varData", lsize, vardata)) return kERR;