mirror of
https://github.com/wfjm/w11.git
synced 2026-02-08 01:21:59 +00:00
add and use move semantic in RlinkCommandExpect
This commit is contained in:
@@ -100,7 +100,10 @@ The full set of tests is only run for tagged releases.
|
||||
- some selected clang -Weverything aspects
|
||||
- now -Wdocumentation clean (some wrong doxygen trailing comments)
|
||||
- use auto, emplace() and range loops
|
||||
- use unique_ptr (also replace boost::scoped_ptr)
|
||||
- use unique_ptr instead of free pointers, avoid explicit `delete`
|
||||
- add and use move semantic in RlinkCommandExpect
|
||||
- replace boost with std
|
||||
- use std::unique_ptr instead of boost::scoped_ptr
|
||||
- rw11/shell.tcl: add workaround for tclreadline and `after` interference
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// $Id: RlinkCommandExpect.hpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RlinkCommandExpect.hpp 1077 2018-12-07 19:37:03Z 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-07 1077 1.2.2 SetBlock: add move versions
|
||||
// 2017-04-07 868 1.2.1 Dump(): add detail arg
|
||||
// 2015-04-02 661 1.2 expect logic: remove stat from Expect, invert mask
|
||||
// 2014-12-20 616 1.1 add Done count methods (for rblk/wblk)
|
||||
@@ -47,8 +48,11 @@ namespace Retro {
|
||||
void SetData(uint16_t data, uint16_t datamsk=0);
|
||||
void SetDone(uint16_t done, bool check=true);
|
||||
void SetBlock(const std::vector<uint16_t>& block);
|
||||
void SetBlock(std::vector<uint16_t>&& block);
|
||||
void SetBlock(const std::vector<uint16_t>& block,
|
||||
const std::vector<uint16_t>& blockmsk);
|
||||
void SetBlock(std::vector<uint16_t>&& block,
|
||||
std::vector<uint16_t>&& blockmsk);
|
||||
|
||||
uint16_t DataValue() const;
|
||||
uint16_t DataMask() const;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $Id: RlinkCommandExpect.ipp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RlinkCommandExpect.ipp 1077 2018-12-07 19:37:03Z mueller $
|
||||
//
|
||||
// Copyright 2011-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-12-07 1077 1.2.1 SetBlock: add move versions
|
||||
// 2015-04-02 661 1.2 expect logic: remove stat from Expect, invert mask
|
||||
// 2014-12-20 616 1.1 add Done count methods (for rblk/wblk)
|
||||
// 2011-03-12 368 1.0 Initial version
|
||||
@@ -53,6 +54,17 @@ inline void RlinkCommandExpect::SetDone(uint16_t done, bool check)
|
||||
inline void RlinkCommandExpect::SetBlock(const std::vector<uint16_t>& block)
|
||||
{
|
||||
fBlockVal = block;
|
||||
fBlockMsk.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline void RlinkCommandExpect::SetBlock(std::vector<uint16_t>&& block)
|
||||
{
|
||||
fBlockVal = move(block);
|
||||
fBlockMsk.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,6 +83,17 @@ inline void RlinkCommandExpect::SetBlock(
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline void RlinkCommandExpect::SetBlock(std::vector<uint16_t>&& block,
|
||||
std::vector<uint16_t>&& blockmsk)
|
||||
{
|
||||
fBlockVal = move(block);
|
||||
fBlockMsk = move(blockmsk);
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline uint16_t RlinkCommandExpect::DataValue() const
|
||||
{
|
||||
return fDataVal;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $Id: RlinkCommandList.cpp 1076 2018-12-02 12:45:49Z mueller $
|
||||
// $Id: RlinkCommandList.cpp 1077 2018-12-07 19:37:03Z 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-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
|
||||
// 2018-09-16 1047 1.3.2 coverity fixup (uninitialized scalar)
|
||||
@@ -249,8 +250,21 @@ void RlinkCommandList::SetLastExpectBlock(const std::vector<uint16_t>& block)
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void RlinkCommandList::SetLastExpectBlock(const std::vector<uint16_t>& block,
|
||||
const std::vector<uint16_t>& blockmsk)
|
||||
void RlinkCommandList::SetLastExpectBlock(std::vector<uint16_t>&& block)
|
||||
{
|
||||
if (fList.empty())
|
||||
throw Rexception("RlinkCommandList::SetLastExpectBlock()",
|
||||
"Bad state: list empty");
|
||||
RlinkCommand& cmd = *fList.back();
|
||||
cmd.EnsureExpect().SetBlock(move(block));
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void RlinkCommandList::SetLastExpectBlock(const std::vector<uint16_t>& block,
|
||||
const std::vector<uint16_t>& blockmsk)
|
||||
{
|
||||
if (fList.empty())
|
||||
throw Rexception("RlinkCommandList::SetLastExpectBlock()",
|
||||
@@ -263,6 +277,20 @@ void RlinkCommandList::SetLastExpectBlock(const std::vector<uint16_t>& block)
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void RlinkCommandList::SetLastExpectBlock(std::vector<uint16_t>&& block,
|
||||
std::vector<uint16_t>&& blockmsk)
|
||||
{
|
||||
if (fList.empty())
|
||||
throw Rexception("RlinkCommandList::SetLastExpectBlock()",
|
||||
"Bad state: list empty");
|
||||
RlinkCommand& cmd = *fList.back();
|
||||
cmd.EnsureExpect().SetBlock(move(block), move(blockmsk));
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void RlinkCommandList::SetLastExpect(exp_uptr_t&& upexp)
|
||||
{
|
||||
if (fList.empty())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $Id: RlinkCommandList.hpp 1076 2018-12-02 12:45:49Z mueller $
|
||||
// $Id: RlinkCommandList.hpp 1077 2018-12-07 19:37:03Z 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-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
|
||||
// 2015-04-02 661 1.3 expect logic: add SetLastExpect methods
|
||||
@@ -71,8 +72,11 @@ namespace Retro {
|
||||
void SetLastExpectData(uint16_t data, uint16_t datamsk=0xffff);
|
||||
void SetLastExpectDone(uint16_t done);
|
||||
void SetLastExpectBlock(const std::vector<uint16_t>& block);
|
||||
void SetLastExpectBlock(std::vector<uint16_t>&& block);
|
||||
void SetLastExpectBlock(const std::vector<uint16_t>& block,
|
||||
const std::vector<uint16_t>& blockmsk);
|
||||
void SetLastExpectBlock(std::vector<uint16_t>&& block,
|
||||
std::vector<uint16_t>&& blockmsk);
|
||||
void SetLastExpect(exp_uptr_t&& upexp);
|
||||
|
||||
void ClearLaboIndex();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $Id: RtclRlinkConnect.cpp 1070 2018-11-17 09:48:04Z mueller $
|
||||
// $Id: RtclRlinkConnect.cpp 1077 2018-12-07 19:37:03Z 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-07 1077 1.6.3 use SetLastExpectBlock move semantics
|
||||
// 2018-11-16 1070 1.6.2 use auto; use range loop
|
||||
// 2018-09-16 1047 1.6.1 coverity fixup (uninitialized scalar)
|
||||
// 2017-04-29 888 1.6 drop M_rawio; add M_rawread,M_rawrblk,M_rawwblk
|
||||
@@ -304,7 +305,7 @@ int RtclRlinkConnect::M_exec(RtclArgs& args)
|
||||
size_t bsize = clist[lsize-1].BlockSize();
|
||||
if (!args.GetArg("data", data, 0, bsize)) return kERR;
|
||||
if (!args.GetArg("??mask", mask, 0, bsize)) return kERR;
|
||||
clist.SetLastExpectBlock(data, mask);
|
||||
clist.SetLastExpectBlock(move(data), move(mask));
|
||||
} else {
|
||||
uint16_t data=0;
|
||||
uint16_t mask=0xffff;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $Id: RtclRw11Cpu.cpp 1070 2018-11-17 09:48:04Z mueller $
|
||||
// $Id: RtclRw11Cpu.cpp 1077 2018-12-07 19:37:03Z 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-07 1077 1.2.20 use SetLastExpectBlock move semantics
|
||||
// 2018-11-16 1070 1.2.19 use auto; use emplace_back; use range loop
|
||||
// 2018-09-23 1050 1.2.18 add HasPcnt()
|
||||
// 2018-09-21 1048 1.2.18 coverity fixup (uninitialized scalar)
|
||||
@@ -669,7 +670,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args)
|
||||
size_t bsize = clist[lsize-1].BlockSize();
|
||||
if (!args.GetArg("data", data, 0, bsize)) return kERR;
|
||||
if (!args.GetArg("??mask", mask, 0, bsize)) return kERR;
|
||||
clist.SetLastExpectBlock(data, mask);
|
||||
clist.SetLastExpectBlock(move(data), move(mask));
|
||||
} else {
|
||||
uint16_t data=0;
|
||||
uint16_t mask=0xffff;
|
||||
|
||||
Reference in New Issue
Block a user