From 6024dce2092192d096aa507b3e46be9e8bbd2f9b Mon Sep 17 00:00:00 2001 From: wfjm Date: Sun, 3 Mar 2019 09:40:56 +0100 Subject: [PATCH] use std::bind instead of lambda - automatic return type detection for lambda's can be error prone - it is safer and more compact to use std:bind as method forwarder - closes issue #19 --- tools/src/librlink/RlinkServer.cpp | 14 ++- tools/src/librlinktpp/RtclAttnShuttle.cpp | 13 ++- tools/src/librlinktpp/RtclRlinkConnect.cpp | 105 +++++++++--------- tools/src/librlinktpp/RtclRlinkPort.cpp | 47 ++++---- tools/src/librlinktpp/RtclRlinkServer.cpp | 46 ++++---- tools/src/librw11/Rw11.cpp | 10 +- tools/src/librw11/Rw11CntlDEUNA.cpp | 12 +- tools/src/librw11/Rw11CntlDL11.cpp | 13 ++- tools/src/librw11/Rw11CntlLP11.cpp | 13 ++- tools/src/librw11/Rw11CntlPC11.cpp | 13 ++- tools/src/librw11/Rw11CntlRHRP.cpp | 21 ++-- tools/src/librw11/Rw11CntlRK11.cpp | 21 ++-- tools/src/librw11/Rw11CntlRL11.cpp | 21 ++-- tools/src/librw11/Rw11CntlTM11.cpp | 21 ++-- tools/src/librw11/Rw11Rdma.cpp | 12 +- tools/src/librw11/Rw11UnitDEUNA.cpp | 12 +- tools/src/librw11/Rw11UnitTerm.cpp | 8 +- tools/src/librw11/Rw11VirtEthTap.cpp | 13 ++- tools/src/librw11/Rw11VirtTermPty.cpp | 13 ++- tools/src/librw11/Rw11VirtTermTcp.cpp | 18 +-- tools/src/librwxxtpp/RtclRw11.cpp | 33 +++--- tools/src/librwxxtpp/RtclRw11Cntl.cpp | 30 +++-- tools/src/librwxxtpp/RtclRw11CntlBase.ipp | 37 +++--- tools/src/librwxxtpp/RtclRw11CntlDEUNA.cpp | 34 +++--- tools/src/librwxxtpp/RtclRw11CntlDL11.cpp | 14 ++- tools/src/librwxxtpp/RtclRw11CntlRdmaBase.ipp | 14 ++- tools/src/librwxxtpp/RtclRw11Cpu.cpp | 71 ++++++------ tools/src/librwxxtpp/RtclRw11Unit.cpp | 22 ++-- tools/src/librwxxtpp/RtclRw11UnitBase.ipp | 27 +++-- tools/src/librwxxtpp/RtclRw11UnitDisk.cpp | 28 +++-- tools/src/librwxxtpp/RtclRw11UnitStream.cpp | 13 ++- tools/src/librwxxtpp/RtclRw11UnitTape.cpp | 44 ++++---- tools/src/librwxxtpp/RtclRw11UnitTerm.cpp | 32 +++--- tools/src/librwxxtpp/RtclRw11Virt.cpp | 18 +-- tools/src/librwxxtpp/RtclRw11VirtDiskOver.cpp | 14 ++- tools/src/librwxxtpp/RtclRw11VirtDiskRam.cpp | 12 +- 36 files changed, 491 insertions(+), 398 deletions(-) diff --git a/tools/src/librlink/RlinkServer.cpp b/tools/src/librlink/RlinkServer.cpp index cf954e8c..b38bd6f9 100644 --- a/tools/src/librlink/RlinkServer.cpp +++ b/tools/src/librlink/RlinkServer.cpp @@ -1,6 +1,6 @@ -// $Id: RlinkServer.cpp 1088 2018-12-17 17:37:00Z mueller $ +// $Id: RlinkServer.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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 +// 2019-02-23 1114 2.2.9 use std::bind instead of lambda // 2018-12-17 1088 2.2.8 use std::lock_guard, std::thread instead of boost // 2018-12-15 1083 2.2.7 for std::function setups: use rval ref and move // 2018-12-14 1081 2.2.6 use std::bind instead of boost @@ -38,6 +39,8 @@ #include +#include + #include "librtools/Rexception.hpp" #include "librtools/RosFill.hpp" #include "librtools/RosPrintf.hpp" @@ -49,6 +52,7 @@ #include "RlinkServer.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RlinkServer @@ -78,8 +82,7 @@ RlinkServer::RlinkServer() RlinkCommand::kStat_M_RbNak | RlinkCommand::kStat_M_RbErr); - fELoop.AddPollHandler([this](const pollfd& pfd) - { return WakeupHandler(pfd); }, + fELoop.AddPollHandler(bind(&RlinkServer::WakeupHandler, this, _1), fWakeupEvent, POLLIN); // Statistic setup @@ -418,8 +421,7 @@ void RlinkServer::StartOrResume(bool resume) // setup poll handler for Rlink traffic int rlinkfd = fspConn->Port().FdRead(); if (!fELoop.TestPollHandler(rlinkfd, POLLIN)) - fELoop.AddPollHandler([this](const pollfd& pfd) - { return RlinkHandler(pfd); }, + fELoop.AddPollHandler(bind(&RlinkServer::RlinkHandler, this, _1), rlinkfd, POLLIN); // and start server thread diff --git a/tools/src/librlinktpp/RtclAttnShuttle.cpp b/tools/src/librlinktpp/RtclAttnShuttle.cpp index ff3b8f0f..e656156a 100644 --- a/tools/src/librlinktpp/RtclAttnShuttle.cpp +++ b/tools/src/librlinktpp/RtclAttnShuttle.cpp @@ -1,6 +1,6 @@ -// $Id: RtclAttnShuttle.cpp 1089 2018-12-19 10:45:41Z mueller $ +// $Id: RtclAttnShuttle.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,8 +13,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.1.4 use std::bind instead of lambda // 2018-12-18 1089 1.1.3 use c++ style casts -// 2018-12-15 1082 1.1.2 use lambda instead of bind +// 2018-12-15 1082 1.1.2 use lambda instead of boost::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 // 2014-11-08 602 1.0.3 cast int first to ptrdiff_t, than to ClientData @@ -32,12 +33,15 @@ #include #include +#include + #include "librtools/Rexception.hpp" #include "librtools/Rtools.hpp" #include "RtclAttnShuttle.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclAttnShuttle @@ -83,8 +87,7 @@ RtclAttnShuttle::~RtclAttnShuttle() void RtclAttnShuttle::Add(RlinkServer* pserv, Tcl_Interp* interp) { // connect to RlinkServer - pserv->AddAttnHandler([this](RlinkServer::AttnArgs& args) - { return AttnHandler(args); }, + pserv->AddAttnHandler(bind(&RtclAttnShuttle::AttnHandler, this, _1), fMask, this); fpServ = pserv; diff --git a/tools/src/librlinktpp/RtclRlinkConnect.cpp b/tools/src/librlinktpp/RtclRlinkConnect.cpp index f5ccdfdb..41b0be5a 100644 --- a/tools/src/librlinktpp/RtclRlinkConnect.cpp +++ b/tools/src/librlinktpp/RtclRlinkConnect.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRlinkConnect.cpp 1091 2018-12-23 12:38:29Z mueller $ +// $Id: RtclRlinkConnect.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2011-2018 by Walter F.J. Mueller +// Copyright 2011-2019 by Walter F.J. Mueller // // 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,10 +13,11 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.6.9 use std::bind instead of lambda // 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 +// 2018-12-15 1082 1.6.5 use lambda instead of boost::bind // 2018-12-08 1079 1.6.4 use HasPort(); Port() returns now ref // 2018-12-07 1077 1.6.3 use SetLastExpectBlock move semantics // 2018-11-16 1070 1.6.2 use auto; use range loop @@ -58,6 +59,7 @@ #include #include +#include #include "librtcltools/Rtcl.hpp" #include "librtcltools/RtclOPtr.hpp" @@ -71,6 +73,7 @@ #include "RtclRlinkConnect.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRlinkConnect @@ -89,25 +92,25 @@ RtclRlinkConnect::RtclRlinkConnect(Tcl_Interp* interp, const char* name) fGets(), fSets() { - AddMeth("open", [this](RtclArgs& args){ return M_open(args); }); - AddMeth("close", [this](RtclArgs& args){ return M_close(args); }); - AddMeth("init", [this](RtclArgs& args){ return M_init(args); }); - AddMeth("exec", [this](RtclArgs& args){ return M_exec(args); }); - AddMeth("amap", [this](RtclArgs& args){ return M_amap(args); }); - AddMeth("errcnt", [this](RtclArgs& args){ return M_errcnt(args); }); - AddMeth("wtlam", [this](RtclArgs& args){ return M_wtlam(args); }); - AddMeth("oob", [this](RtclArgs& args){ return M_oob(args); }); - AddMeth("rawread", [this](RtclArgs& args){ return M_rawread(args); }); - AddMeth("rawrblk", [this](RtclArgs& args){ return M_rawrblk(args); }); - AddMeth("rawwblk", [this](RtclArgs& args){ return M_rawwblk(args); }); - AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); - AddMeth("log", [this](RtclArgs& args){ return M_log(args); }); - AddMeth("print", [this](RtclArgs& args){ return M_print(args); }); - AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); - AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); - AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); - AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); - + AddMeth("open", bind(&RtclRlinkConnect::M_open, this, _1)); + AddMeth("close", bind(&RtclRlinkConnect::M_close, this, _1)); + AddMeth("init", bind(&RtclRlinkConnect::M_init, this, _1)); + AddMeth("exec", bind(&RtclRlinkConnect::M_exec, this, _1)); + AddMeth("amap", bind(&RtclRlinkConnect::M_amap, this, _1)); + AddMeth("errcnt", bind(&RtclRlinkConnect::M_errcnt, this, _1)); + AddMeth("wtlam", bind(&RtclRlinkConnect::M_wtlam, this, _1)); + AddMeth("oob", bind(&RtclRlinkConnect::M_oob, this, _1)); + AddMeth("rawread", bind(&RtclRlinkConnect::M_rawread, this, _1)); + AddMeth("rawrblk", bind(&RtclRlinkConnect::M_rawrblk, this, _1)); + AddMeth("rawwblk", bind(&RtclRlinkConnect::M_rawwblk, this, _1)); + AddMeth("stats", bind(&RtclRlinkConnect::M_stats, this, _1)); + AddMeth("log", bind(&RtclRlinkConnect::M_log, this, _1)); + AddMeth("print", bind(&RtclRlinkConnect::M_print, this, _1)); + AddMeth("dump", bind(&RtclRlinkConnect::M_dump, this, _1)); + AddMeth("get", bind(&RtclRlinkConnect::M_get, this, _1)); + AddMeth("set", bind(&RtclRlinkConnect::M_set, this, _1)); + AddMeth("$default", bind(&RtclRlinkConnect::M_default, this, _1)); + for (size_t i=0; i<8; i++) { fCmdnameObj[i] = Tcl_NewStringObj(RlinkCommand::CommandName(i), -1); } @@ -115,54 +118,54 @@ RtclRlinkConnect::RtclRlinkConnect(Tcl_Interp* interp, const char* name) // attributes of RlinkConnect RlinkConnect* pobj = &Obj(); - fGets.Add ("baseaddr", [pobj](){ return pobj->LogBaseAddr(); }); - fGets.Add ("basedata", [pobj](){ return pobj->LogBaseData(); }); - fGets.Add ("basestat", [pobj](){ return pobj->LogBaseStat(); }); - fGets.Add ("printlevel", [pobj](){ return pobj->PrintLevel(); }); - fGets.Add ("dumplevel", [pobj](){ return pobj->DumpLevel(); }); - fGets.Add ("tracelevel", [pobj](){ return pobj->TraceLevel(); }); - fGets.Add ("timeout", [pobj](){ return pobj->Timeout(); }); - fGets.Add("logfile", [pobj](){ return pobj->LogFileName(); }); + fGets.Add ("baseaddr", bind(&RlinkConnect::LogBaseAddr, pobj)); + fGets.Add ("basedata", bind(&RlinkConnect::LogBaseData, pobj)); + fGets.Add ("basestat", bind(&RlinkConnect::LogBaseStat, pobj)); + fGets.Add ("printlevel", bind(&RlinkConnect::PrintLevel, pobj)); + fGets.Add ("dumplevel", bind(&RlinkConnect::DumpLevel, pobj)); + fGets.Add ("tracelevel", bind(&RlinkConnect::TraceLevel, pobj)); + fGets.Add ("timeout", bind(&RlinkConnect::Timeout, pobj)); + fGets.Add ("logfile",bind(&RlinkConnect::LogFileName, pobj)); - fGets.Add ("initdone", [pobj](){ return pobj->LinkInitDone(); }); - fGets.Add ("sysid", [pobj](){ return pobj->SysId(); }); - fGets.Add ("usracc", [pobj](){ return pobj->UsrAcc(); }); - fGets.Add ("rbufsize", [pobj](){ return pobj->RbufSize(); }); - fGets.Add ("bsizemax", [pobj](){ return pobj->BlockSizeMax(); }); + fGets.Add ("initdone", bind(&RlinkConnect::LinkInitDone, pobj)); + fGets.Add ("sysid", bind(&RlinkConnect::SysId, pobj)); + fGets.Add ("usracc", bind(&RlinkConnect::UsrAcc, pobj)); + fGets.Add ("rbufsize", bind(&RlinkConnect::RbufSize, pobj)); + fGets.Add ("bsizemax", bind(&RlinkConnect::BlockSizeMax, pobj)); fGets.Add ("bsizeprudent", - [pobj](){ return pobj->BlockSizePrudent(); }); - fGets.Add ("hasrbmon", [pobj](){ return pobj->HasRbmon(); }); + bind(&RlinkConnect::BlockSizePrudent, pobj)); + fGets.Add ("hasrbmon", bind(&RlinkConnect::HasRbmon, pobj)); fSets.Add ("baseaddr", - [pobj](uint32_t v){ pobj->SetLogBaseAddr(v); }); + bind(&RlinkConnect::SetLogBaseAddr, pobj, _1)); fSets.Add ("basedata", - [pobj](uint32_t v){ pobj->SetLogBaseData(v); }); + bind(&RlinkConnect::SetLogBaseData, pobj, _1)); fSets.Add ("basestat", - [pobj](uint32_t v){ pobj->SetLogBaseStat(v); }); + bind(&RlinkConnect::SetLogBaseStat, pobj, _1)); fSets.Add ("printlevel", - [pobj](uint32_t v){ pobj->SetPrintLevel(v); }); + bind(&RlinkConnect::SetPrintLevel, pobj, _1)); fSets.Add ("dumplevel", - [pobj](uint32_t v){ pobj->SetDumpLevel(v); }); + bind(&RlinkConnect::SetDumpLevel, pobj, _1)); fSets.Add ("tracelevel", - [pobj](uint32_t v){ pobj->SetTraceLevel(v); }); + bind(&RlinkConnect::SetTraceLevel, pobj, _1)); fSets.Add ("timeout", - [pobj](const Rtime& v){ pobj->SetTimeout(v); }); + bind(&RlinkConnect::SetTimeout, pobj, _1)); fSets.Add ("logfile", - [pobj](const string& v){ pobj->SetLogFileName(v); }); + bind(&RlinkConnect::SetLogFileName, pobj, _1)); // attributes of buildin RlinkContext RlinkContext* pcntx = &Obj().Context(); - fGets.Add ("statchecked", - [pcntx](){ return pcntx->StatusIsChecked(); }); + fGets.Add ("statchecked", + bind(&RlinkContext::StatusIsChecked, pcntx)); fGets.Add ("statvalue", - [pcntx](){ return pcntx->StatusValue(); }); + bind(&RlinkContext::StatusValue, pcntx)); fGets.Add ("statmask", - [pcntx](){ return pcntx->StatusMask(); }); + bind(&RlinkContext::StatusMask, pcntx)); fSets.Add ("statvalue", - [pcntx](uint8_t v){ pcntx->SetStatusValue(v); }); + bind(&RlinkContext::SetStatusValue, pcntx, _1)); fSets.Add ("statmask", - [pcntx](uint8_t v){ pcntx->SetStatusMask(v); }); + bind(&RlinkContext::SetStatusMask, pcntx, _1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librlinktpp/RtclRlinkPort.cpp b/tools/src/librlinktpp/RtclRlinkPort.cpp index a0d8999c..dcd222c9 100644 --- a/tools/src/librlinktpp/RtclRlinkPort.cpp +++ b/tools/src/librlinktpp/RtclRlinkPort.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRlinkPort.cpp 1091 2018-12-23 12:38:29Z mueller $ +// $Id: RtclRlinkPort.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,9 +13,10 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.4.4 use std::bind instead of lambda // 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-15 1082 1.4.1 use lambda instead of boost::bind // 2018-12-08 1079 1.4 use ref not ptr for RlinkPort // 2018-12-01 1076 1.3 use unique_ptr // 2017-04-29 888 1.2 LogFileName(): returns now const std::string& @@ -37,6 +38,7 @@ #include #include +#include #include "librtcltools/Rtcl.hpp" #include "librtcltools/RtclOPtr.hpp" @@ -49,6 +51,7 @@ #include "RtclRlinkPort.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRlinkPort @@ -71,18 +74,18 @@ RtclRlinkPort::RtclRlinkPort(Tcl_Interp* interp, const char* name) fSets() { CreateObjectCmd(interp, name); - AddMeth("open", [this](RtclArgs& args){ return M_open(args); }); - AddMeth("close", [this](RtclArgs& args){ return M_close(args); }); - AddMeth("errcnt", [this](RtclArgs& args){ return M_errcnt(args); }); - AddMeth("rawread", [this](RtclArgs& args){ return M_rawread(args); }); - AddMeth("rawrblk", [this](RtclArgs& args){ return M_rawrblk(args); }); - AddMeth("rawwblk", [this](RtclArgs& args){ return M_rawwblk(args); }); - AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); - AddMeth("log", [this](RtclArgs& args){ return M_log(args); }); - AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); - AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); - AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); - AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); + AddMeth("open", bind(&RtclRlinkPort::M_open, this, _1)); + AddMeth("close", bind(&RtclRlinkPort::M_close, this, _1)); + AddMeth("errcnt", bind(&RtclRlinkPort::M_errcnt, this, _1)); + AddMeth("rawread", bind(&RtclRlinkPort::M_rawread, this, _1)); + AddMeth("rawrblk", bind(&RtclRlinkPort::M_rawrblk, this, _1)); + AddMeth("rawwblk", bind(&RtclRlinkPort::M_rawwblk, this, _1)); + AddMeth("stats", bind(&RtclRlinkPort::M_stats, this, _1)); + AddMeth("log", bind(&RtclRlinkPort::M_log, this, _1)); + AddMeth("dump", bind(&RtclRlinkPort::M_dump, this, _1)); + AddMeth("get", bind(&RtclRlinkPort::M_get, this, _1)); + AddMeth("set", bind(&RtclRlinkPort::M_set, this, _1)); + AddMeth("$default", bind(&RtclRlinkPort::M_default, this, _1)); SetupGetSet(); } @@ -255,17 +258,17 @@ void RtclRlinkPort::SetupGetSet() { fGets.Clear(); fSets.Clear(); - - fGets.Add ("logfile", [this](){ return LogFileName(); }); + + fGets.Add ("logfile", + bind(&RtclRlinkPort::LogFileName, this)); fSets.Add ("logfile", - [this](const string& v){ SetLogFileName(v); }); + bind(&RtclRlinkPort::SetLogFileName, this, _1)); if (!fupObj) return; - RlinkPort* pobj = fupObj.get(); - - fGets.Add ("tracelevel", [pobj](){ return pobj->TraceLevel(); }); + fGets.Add ("tracelevel", + bind(&RlinkPort::TraceLevel, fupObj.get())); fSets.Add ("tracelevel", - [pobj](uint32_t v){pobj->SetTraceLevel(v); }); + bind(&RlinkPort::SetTraceLevel, fupObj.get(), _1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librlinktpp/RtclRlinkServer.cpp b/tools/src/librlinktpp/RtclRlinkServer.cpp index 8197abb1..29b05a41 100644 --- a/tools/src/librlinktpp/RtclRlinkServer.cpp +++ b/tools/src/librlinktpp/RtclRlinkServer.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRlinkServer.cpp 1088 2018-12-17 17:37:00Z mueller $ +// $Id: RtclRlinkServer.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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 +// 2019-02-23 1114 1.2.3 use std::bind instead of lambda // 2018-12-17 1087 1.2.2 use std::lock_guard instead of boost // 2018-12-14 1081 1.2.1 use std::bind instead of boost // 2018-12-01 1076 1.2 use unique_ptr @@ -40,6 +41,7 @@ #include #include #include +#include #include "librtools/RosPrintBvi.hpp" #include "librtcltools/Rtcl.hpp" @@ -51,6 +53,7 @@ #include "RtclRlinkServer.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRlinkServer @@ -70,35 +73,36 @@ RtclRlinkServer::RtclRlinkServer(Tcl_Interp* interp, const char* name) fGets(), fSets() { - AddMeth("server", [this](RtclArgs& args){ return M_server(args); }); - AddMeth("attn", [this](RtclArgs& args){ return M_attn(args); }); - AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); - AddMeth("print", [this](RtclArgs& args){ return M_print(args); }); - AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); - AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); - AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); - AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); + AddMeth("server", bind(&RtclRlinkServer::M_server, this, _1)); + AddMeth("attn", bind(&RtclRlinkServer::M_attn, this, _1)); + AddMeth("stats", bind(&RtclRlinkServer::M_stats, this, _1)); + AddMeth("print", bind(&RtclRlinkServer::M_print, this, _1)); + AddMeth("dump", bind(&RtclRlinkServer::M_dump, this, _1)); + AddMeth("get", bind(&RtclRlinkServer::M_get, this, _1)); + AddMeth("set", bind(&RtclRlinkServer::M_set, this, _1)); + AddMeth("$default", bind(&RtclRlinkServer::M_default, this, _1)); // attributes of RlinkConnect RlinkServer* pobj = &Obj(); - fGets.Add ("tracelevel", [pobj](){ return pobj->TraceLevel(); }); + fGets.Add ("tracelevel", + bind(&RlinkServer::TraceLevel, pobj)); - fSets.Add ("tracelevel", - [pobj](uint32_t v){ pobj->SetTraceLevel(v); }); + fSets.Add ("tracelevel", + bind(&RlinkServer::SetTraceLevel, pobj, _1)); // attributes of buildin RlinkContext RlinkContext* pcntx = &Obj().Context(); - fGets.Add ("statchecked", - [pcntx](){ return pcntx->StatusIsChecked(); }); - fGets.Add ("statvalue", - [pcntx](){ return pcntx->StatusValue(); }); - fGets.Add ("statmask", - [pcntx](){ return pcntx->StatusMask(); }); + fGets.Add ("statchecked", + bind(&RlinkContext::StatusIsChecked, pcntx)); + fGets.Add ("statvalue", + bind(&RlinkContext::StatusValue, pcntx)); + fGets.Add ("statmask", + bind(&RlinkContext::StatusMask, pcntx)); fSets.Add ("statvalue", - [pcntx](uint8_t v){ pcntx->SetStatusValue(v); }); + bind(&RlinkContext::SetStatusValue, pcntx, _1)); fSets.Add ("statmask", - [pcntx](uint8_t v){ pcntx->SetStatusMask(v); }); + bind(&RlinkContext::SetStatusMask, pcntx, _1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librw11/Rw11.cpp b/tools/src/librw11/Rw11.cpp index 72aaf53e..a09d3410 100644 --- a/tools/src/librw11/Rw11.cpp +++ b/tools/src/librw11/Rw11.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11.cpp 1090 2018-12-21 12:17:35Z mueller $ +// $Id: Rw11.cpp 1114 2019-02-23 18:01:55Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -14,7 +14,7 @@ // Revision History: // Date Rev Version Comment // 2018-12-19 1090 1.1.4 use RosPrintf(bool) -// 2018-12-15 1082 1.1.3 use lambda instead of bind +// 2018-12-15 1082 1.1.3 use lambda instead of boost::bind // 2018-12-09 1080 1.1.2 use std::shared_ptr instead of boost and range loop // 2017-04-07 868 1.1.1 Dump(): add detail arg // 2014-12-30 625 1.1 adopt to Rlink V4 attn logic @@ -27,6 +27,8 @@ \brief Implemenation of Rw11. */ +#include + #include "librtools/Rexception.hpp" #include "librtools/RosFill.hpp" #include "librtools/RosPrintf.hpp" @@ -35,6 +37,7 @@ #include "Rw11.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11 @@ -70,8 +73,7 @@ Rw11::~Rw11() void Rw11::SetServer(const std::shared_ptr& spserv) { fspServ = spserv; - fspServ->AddAttnHandler([this](RlinkServer::AttnArgs& args) - { return AttnHandler(args); }, + fspServ->AddAttnHandler(bind(&Rw11::AttnHandler, this, _1), uint16_t(1)< +// Copyright 2014-2019 by Walter F.J. Mueller // // 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,9 +13,10 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 0.5.8 use std::bind instead of lambda // 2018-12-19 1090 0.5.7 use RosPrintf(bool) // 2018-12-17 1087 0.5.6 use std::lock_guard instead of boost -// 2018-12-15 1082 0.5.5 use lambda instead of bind +// 2018-12-15 1082 0.5.5 use lambda instead of boost::bind // 2018-12-09 1080 0.5.4 use HasVirt(); Virt() returns ref // 2018-12-08 1078 0.5.3 BUGFIX: Start(Tx|Rx)Ring, was broken in r1049 // when fixing -Wunused-variable warnings @@ -35,6 +36,7 @@ #include #include +#include #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" @@ -48,6 +50,7 @@ #include "Rw11CntlDEUNA.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11CntlDEUNA @@ -354,8 +357,7 @@ void Rw11CntlDEUNA::Start() UnitSetup(0); // add attn handler - Server().AddAttnHandler([this](RlinkServer::AttnArgs& args) - { return AttnHandler(args); }, + Server().AddAttnHandler(bind(&Rw11CntlDEUNA::AttnHandler, this, _1), uint16_t(1)< +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.3.2 use lambda instead of bind +// 2019-02-23 1114 1.3.2 use std::bind instead of lambda +// 2018-12-15 1082 1.3.1 use lambda instead of boost::bind // 2017-05-14 897 1.3 add RcvChar(),TraceChar(); trace received chars // 2017-04-02 865 1.2.3 Dump(): add detail arg // 2017-03-03 858 1.2.2 use cntl name as message prefix @@ -31,6 +32,8 @@ \brief Implemenation of Rw11CntlDL11. */ +#include + #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -40,6 +43,7 @@ #include "Rw11CntlDL11.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11CntlDL11 @@ -122,8 +126,7 @@ void Rw11CntlDL11::Start() fPC_xbuf = Cpu().AddRibr(fPrimClist, fBase+kXBUF); // add attn handler - Server().AddAttnHandler([this](RlinkServer::AttnArgs& args) - { return AttnHandler(args); }, + Server().AddAttnHandler(bind(&Rw11CntlDL11::AttnHandler, this, _1), uint16_t(1)< +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.2.5 use lambda instead of bind +// 2019-02-23 1114 1.2.6 use std::bind instead of lambda +// 2018-12-15 1082 1.2.5 use lambda instead of boost::bind // 2018-12-09 1080 1.2.4 use HasVirt() // 2017-04-02 865 1.2.3 Dump(): add detail arg // 2017-03-03 858 1.2.2 use cntl name as message prefix @@ -29,6 +30,8 @@ \brief Implemenation of Rw11CntlLP11. */ +#include + #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -38,6 +41,7 @@ #include "Rw11CntlLP11.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11CntlLP11 @@ -110,8 +114,7 @@ void Rw11CntlLP11::Start() fPC_buf = Cpu().AddRibr(fPrimClist, fBase+kBUF); // add attn handler - Server().AddAttnHandler([this](RlinkServer::AttnArgs& args) - { return AttnHandler(args); }, + Server().AddAttnHandler(bind(&Rw11CntlLP11::AttnHandler, this, _1), uint16_t(1)< +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.3.3 use lambda instead of bind +// 2019-02-23 1114 1.3.4 use std::bind instead of lambda +// 2018-12-15 1082 1.3.3 use lambda instead of boost::bind // 2018-12-09 1080 1.3.2 use HasVirt(); Virt() returns ref // 2018-10-28 1062 1.3.1 replace boost/foreach // 2017-05-14 897 1.3 trace received chars @@ -29,6 +30,8 @@ \brief Implemenation of Rw11CntlPC11. */ +#include + #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -38,6 +41,7 @@ #include "Rw11CntlPC11.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11CntlPC11 @@ -121,8 +125,7 @@ void Rw11CntlPC11::Start() fPC_pbuf = Cpu().AddRibr(fPrimClist, fBase+kPBUF); // add attn handler - Server().AddAttnHandler([this](RlinkServer::AttnArgs& args) - { return AttnHandler(args); }, + Server().AddAttnHandler(bind(&Rw11CntlPC11::AttnHandler, this, _1), uint16_t(1)< +// Copyright 2015-2019 by Walter F.J. Mueller // Other credits: // the boot code is from the simh project and Copyright Robert M Supnik // @@ -15,8 +15,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.0.10 use std::bind instead of lambda // 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-15 1082 1.0.8 use std::bind or lambda instead of boost::bind // 2018-12-09 1080 1.0.7 use HasVirt(); Virt() returns ref // 2018-10-28 1062 1.0.6 replace boost/foreach // 2017-04-02 865 1.0.5 Dump(): add detail arg @@ -33,6 +34,8 @@ \brief Implemenation of Rw11CntlRHRP. */ +#include + #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -42,6 +45,7 @@ #include "Rw11CntlRHRP.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11CntlRHRP @@ -187,12 +191,8 @@ Rw11CntlRHRP::Rw11CntlRHRP() fRd_fu(0), fRd_ovr(false), fRdma(this, - std::bind(&Rw11CntlRHRP::RdmaPreExecCB, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4), - std::bind(&Rw11CntlRHRP::RdmaPostExecCB, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4)) + std::bind(&Rw11CntlRHRP::RdmaPreExecCB, this, _1, _2, _3, _4), + std::bind(&Rw11CntlRHRP::RdmaPostExecCB, this, _1, _2, _3, _4)) { // must be here because Units have a back-ptr (not available at Rw11CntlBase) for (size_t i=0; i +// Copyright 2013-2019 by Walter F.J. Mueller // Other credits: // the boot code is from the simh project and Copyright Robert M Supnik // @@ -15,8 +15,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 2.0.10 use std::bind instead of lambda // 2018-12-19 1090 2.0.9 use RosPrintf(bool) -// 2018-12-15 1082 2.0.8 use std::bind or lambda instead of boost +// 2018-12-15 1082 2.0.8 use std::bind or lambda instead of boost::bind // 2018-12-09 1080 2.0.7 use HasVirt(); Virt() returns ref // 2018-10-28 1062 2.0.6 replace boost/foreach // 2017-04-02 865 2.0.5 Dump(): add detail arg @@ -37,6 +38,8 @@ \brief Implemenation of Rw11CntlRK11. */ +#include + #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -44,6 +47,7 @@ #include "librtools/RlogMsg.hpp" #include "Rw11CntlRK11.hpp" +using namespace std::placeholders; using namespace std; @@ -154,12 +158,8 @@ Rw11CntlRK11::Rw11CntlRK11() fRd_fu(0), fRd_ovr(false), fRdma(this, - std::bind(&Rw11CntlRK11::RdmaPreExecCB, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4), - std::bind(&Rw11CntlRK11::RdmaPostExecCB, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4)) + std::bind(&Rw11CntlRK11::RdmaPreExecCB, this, _1, _2, _3, _4), + std::bind(&Rw11CntlRK11::RdmaPostExecCB, this, _1, _2, _3, _4)) { // must be here because Units have a back-ptr (not available at Rw11CntlBase) for (size_t i=0; i +// Copyright 2014-2019 by Walter F.J. Mueller // Other credits: // the boot code is from the simh project and Copyright Robert M Supnik // CalcCrc() is adopted from the simh project and Copyright Robert M Supnik @@ -16,9 +16,10 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.0.11 use std::bind instead of lambda // 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-15 1082 1.0.8 use std::bind or lambda instead of boost::bind // 2018-12-09 1080 1.0.7 use HasVirt(); Virt() returns ref // 2018-10-28 1062 1.0.6 replace boost/foreach // 2017-04-02 865 1.0.5 Dump(): add detail arg @@ -35,6 +36,8 @@ \brief Implemenation of Rw11CntlRL11. */ +#include + #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -44,6 +47,7 @@ #include "Rw11CntlRL11.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11CntlRL11 @@ -196,12 +200,8 @@ Rw11CntlRL11::Rw11CntlRL11() fRd_fu(0), fRd_ovr(false), fRdma(this, - std::bind(&Rw11CntlRL11::RdmaPreExecCB, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4), - std::bind(&Rw11CntlRL11::RdmaPostExecCB, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4)) + std::bind(&Rw11CntlRL11::RdmaPreExecCB, this, _1, _2, _3, _4), + std::bind(&Rw11CntlRL11::RdmaPostExecCB, this, _1, _2, _3, _4)) { // must be here because Units have a back-ptr (not available at Rw11CntlBase) for (size_t i=0; i +// Copyright 2015-2019 by Walter F.J. Mueller // Other credits: // the boot code is from the simh project and Copyright Robert M Supnik // @@ -15,7 +15,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.0.7 use std::bind or lambda instead of boost +// 2019-02-23 1114 1.0.8 use std::bind instead of lambda +// 2018-12-15 1082 1.0.7 use std::bind or lambda instead of boost::bind // 2018-12-09 1080 1.0.6 use HasVirt(); Virt() returns ref // 2018-10-28 1062 1.0.5 replace boost/foreach // 2017-04-02 865 1.0.4 Dump(): add detail arg @@ -31,6 +32,8 @@ \brief Implemenation of Rw11CntlTM11. */ +#include + #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -40,6 +43,7 @@ #include "Rw11CntlTM11.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11CntlTM11 @@ -139,12 +143,8 @@ Rw11CntlTM11::Rw11CntlTM11() fRd_opcode(0), fBuf(), fRdma(this, - std::bind(&Rw11CntlTM11::RdmaPreExecCB, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4), - std::bind(&Rw11CntlTM11::RdmaPostExecCB, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4)) + std::bind(&Rw11CntlTM11::RdmaPreExecCB, this, _1, _2, _3, _4), + std::bind(&Rw11CntlTM11::RdmaPostExecCB, this, _1, _2, _3, _4)) { // must be here because Units have a back-ptr (not available at Rw11CntlBase) for (size_t i=0; i +// Copyright 2015-2019 by Walter F.J. Mueller // // 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,9 +13,10 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.1.5 use std::bind instead of lambda // 2018-12-19 1090 1.1.4 use RosPrintf(bool) // 2018-12-15 1083 1.1.3 for std::function setups: use rval ref and move -// 2018-12-15 1082 1.1.2 use lambda instead of bind +// 2018-12-15 1082 1.1.2 use lambda instead of boost::bind // 2017-04-02 865 1.1.1 Dump(): add detail arg // 2015-02-17 647 1.1 PreExecCB with nwdone and nwnext // 2015-01-04 627 1.0 Initial version @@ -27,6 +28,7 @@ */ #include +#include #include "librtools/Rexception.hpp" #include "librtools/RosFill.hpp" @@ -96,7 +98,7 @@ void Rw11Rdma::QueueRMem(uint32_t addr, uint16_t* block, size_t size, { fStats.Inc(kStatNQueRMem); SetupRdma(false, addr, block, size, mode); - Server().QueueAction([this](){ return RdmaHandler(); }); + Server().QueueAction(bind(&Rw11Rdma::RdmaHandler, this)); return; } @@ -108,7 +110,7 @@ void Rw11Rdma::QueueWMem(uint32_t addr, const uint16_t* block, size_t size, { fStats.Inc(kStatNQueWMem); SetupRdma(true, addr, const_cast(block), size, mode); - Server().QueueAction([this](){ return RdmaHandler(); }); + Server().QueueAction(bind(&Rw11Rdma::RdmaHandler, this)); return; } diff --git a/tools/src/librw11/Rw11UnitDEUNA.cpp b/tools/src/librw11/Rw11UnitDEUNA.cpp index c6b1b4d4..4a4046bb 100644 --- a/tools/src/librw11/Rw11UnitDEUNA.cpp +++ b/tools/src/librw11/Rw11UnitDEUNA.cpp @@ -1,6 +1,6 @@ -// $Id: Rw11UnitDEUNA.cpp 1083 2018-12-15 19:19:16Z mueller $ +// $Id: Rw11UnitDEUNA.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2014-2018 by Walter F.J. Mueller +// Copyright 2014-2019 by Walter F.J. Mueller // // 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,7 +13,7 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-14 1081 1.0.3 use std::bind instead of boost +// 2018-12-14 1081 1.0.3 use std::bind instead of boost::bind // 2018-12-09 1080 1.0.2 use HasVirt(); Virt() returns ref // 2018-12-01 1076 1.0.1 use unique_ptr // 2017-01-29 847 1.0 Initial version @@ -25,12 +25,15 @@ \brief Implemenation of Rw11UnitDEUNA. */ +#include + #include "librtools/RosFill.hpp" #include "Rw11CntlDEUNA.hpp" #include "Rw11UnitDEUNA.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11UnitDEUNA @@ -72,8 +75,7 @@ void Rw11UnitDEUNA::Dump(std::ostream& os, int ind, const char* text, void Rw11UnitDEUNA::AttachDone() { - Virt().SetupRcvCallback(std::bind(&Rw11CntlDEUNA::RcvCallback, - &Cntl(), placeholders::_1)); + Virt().SetupRcvCallback(bind(&Rw11CntlDEUNA::RcvCallback, &Cntl(), _1)); Cntl().UnitSetup(0); return; } diff --git a/tools/src/librw11/Rw11UnitTerm.cpp b/tools/src/librw11/Rw11UnitTerm.cpp index 345590c9..42e04ee9 100644 --- a/tools/src/librw11/Rw11UnitTerm.cpp +++ b/tools/src/librw11/Rw11UnitTerm.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitTerm.cpp 1090 2018-12-21 12:17:35Z mueller $ +// $Id: Rw11UnitTerm.cpp 1114 2019-02-23 18:01:55Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -30,6 +30,8 @@ \brief Implemenation of Rw11UnitTerm. */ +#include + #include "librtools/RparseUrl.hpp" #include "librtools/RosFill.hpp" #include "librtools/RosPrintf.hpp" @@ -38,6 +40,7 @@ #include "Rw11UnitTerm.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11UnitTerm @@ -295,8 +298,7 @@ void Rw11UnitTerm::Dump(std::ostream& os, int ind, const char* text, void Rw11UnitTerm::AttachDone() { - Virt().SetupRcvCallback(std::bind(&Rw11UnitTerm::RcvCallback, - this, placeholders::_1, placeholders::_2)); + Virt().SetupRcvCallback(std::bind(&Rw11UnitTerm::RcvCallback, this, _1, _2)); return; } diff --git a/tools/src/librw11/Rw11VirtEthTap.cpp b/tools/src/librw11/Rw11VirtEthTap.cpp index cc907dca..7590bd86 100644 --- a/tools/src/librw11/Rw11VirtEthTap.cpp +++ b/tools/src/librw11/Rw11VirtEthTap.cpp @@ -1,6 +1,6 @@ -// $Id: Rw11VirtEthTap.cpp 1088 2018-12-17 17:37:00Z mueller $ +// $Id: Rw11VirtEthTap.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2014-2018 by Walter F.J. Mueller +// Copyright 2014-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.0.3 use lambda instead of bind +// 2019-02-23 1114 1.0.4 use std::bind instead of lambda +// 2018-12-15 1082 1.0.3 use lambda instead of boost::bind // 2018-11-30 1075 1.0.2 use list-init // 2018-10-27 1059 1.0.1 coverity fixup (uncaught exception in dtor) // BUGFIX: coverity (buffer not null terminated) @@ -37,12 +38,15 @@ #include #include +#include + #include "librtools/RosFill.hpp" #include "librtools/Rtools.hpp" #include "Rw11VirtEthTap.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11VirtEthTap @@ -105,8 +109,7 @@ bool Rw11VirtEthTap::Open(const std::string& url, RerrMsg& emsg) fFd = fd; - Server().AddPollHandler([this](const pollfd& pfd) - { return RcvPollHandler(pfd); }, + Server().AddPollHandler(bind(&Rw11VirtEthTap::RcvPollHandler, this, _1), fFd, POLLIN); return true; } diff --git a/tools/src/librw11/Rw11VirtTermPty.cpp b/tools/src/librw11/Rw11VirtTermPty.cpp index 3b1965d9..4a494f4f 100644 --- a/tools/src/librw11/Rw11VirtTermPty.cpp +++ b/tools/src/librw11/Rw11VirtTermPty.cpp @@ -1,6 +1,6 @@ -// $Id: Rw11VirtTermPty.cpp 1082 2018-12-15 13:56:20Z mueller $ +// $Id: Rw11VirtTermPty.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.0.4 use lambda instead of bind +// 2019-02-23 1114 1.0.5 use std::bind instead of lambda +// 2018-12-15 1082 1.0.4 use lambda instead of boost::bind // 2018-10-27 1059 1.0.3 coverity fixup (uncaught exception in dtor) // 2017-04-15 875 1.0.2 Open(): set default scheme // 2017-04-07 868 1.0.1 Dump(): add detail arg @@ -32,10 +33,13 @@ #include #include +#include + #include "librtools/RosFill.hpp" #include "Rw11VirtTermPty.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11VirtTermPty @@ -102,8 +106,7 @@ bool Rw11VirtTermPty::Open(const std::string& url, RerrMsg& emsg) fFd = fd; fChannelId = pname; - Server().AddPollHandler([this](const pollfd& pfd) - { return RcvPollHandler(pfd); }, + Server().AddPollHandler(bind(&Rw11VirtTermPty::RcvPollHandler, this, _1), fFd, POLLIN); return true; diff --git a/tools/src/librw11/Rw11VirtTermTcp.cpp b/tools/src/librw11/Rw11VirtTermTcp.cpp index 19c2c155..6734d474 100644 --- a/tools/src/librw11/Rw11VirtTermTcp.cpp +++ b/tools/src/librw11/Rw11VirtTermTcp.cpp @@ -1,6 +1,6 @@ -// $Id: Rw11VirtTermTcp.cpp 1091 2018-12-23 12:38:29Z mueller $ +// $Id: Rw11VirtTermTcp.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,10 +13,11 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.0.14 use std::bind instead of lambda // 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 +// 2018-12-15 1082 1.0.10 use lambda instead of boost::bind // 2018-11-30 1075 1.0.9 use list-init // 2018-11-11 1066 1.0.8 coverity fixup (unchecked return value) // 2018-10-27 1059 1.0.7 coverity fixup (uncaught exception in dtor) @@ -41,6 +42,7 @@ #include #include +#include #include "librtools/RosFill.hpp" #include "librtools/RosPrintf.hpp" @@ -50,6 +52,7 @@ #include "Rw11VirtTermTcp.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::Rw11VirtTermTcp @@ -188,8 +191,7 @@ bool Rw11VirtTermTcp::Open(const std::string& url, RerrMsg& emsg) lmsg << "TermTcp: listen on " << fChannelId << " for " << Unit().Name(); } - Server().AddPollHandler([this](const pollfd& pfd) - { return ListenPollHandler(pfd); }, + Server().AddPollHandler(bind(&Rw11VirtTermTcp::ListenPollHandler, this, _1), fFdListen, POLLIN); return true; @@ -345,8 +347,7 @@ int Rw11VirtTermTcp::ListenPollHandler(const pollfd& pfd) fState = ts_Stream; Server().RemovePollHandler(fFdListen); - Server().AddPollHandler([this](const pollfd& pfd1) - { return RcvPollHandler(pfd1); }, + Server().AddPollHandler(bind(&Rw11VirtTermTcp::RcvPollHandler, this, _1), fFd, POLLIN); return 0; } @@ -432,8 +433,7 @@ int Rw11VirtTermTcp::RcvPollHandler(const pollfd& pfd) } ::close(fFd); fFd = -1; - Server().AddPollHandler([this](const pollfd& pfd1) - { return ListenPollHandler(pfd1); }, + Server().AddPollHandler(bind(&Rw11VirtTermTcp::ListenPollHandler, this, _1), fFdListen, POLLIN); fState = ts_Listen; return -1; diff --git a/tools/src/librwxxtpp/RtclRw11.cpp b/tools/src/librwxxtpp/RtclRw11.cpp index 0289a9cb..62734bbe 100644 --- a/tools/src/librwxxtpp/RtclRw11.cpp +++ b/tools/src/librwxxtpp/RtclRw11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11.cpp 1087 2018-12-17 08:25:37Z mueller $ +// $Id: RtclRw11.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,8 +13,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.0.7 use std::bind instead of lambda // 2018-12-17 1087 1.0.6 use std::lock_guard instead of boost -// 2018-12-15 1082 1.0.5 use lambda instead of bind +// 2018-12-15 1082 1.0.5 use lambda instead of boost::bind // 2017-04-16 876 1.0.4 add CpuCommands() // 2017-04-07 868 1.0.3 M_dump: use GetArgsDump and Dump detail // 2017-04-02 866 1.0.2 add M_set; handle default disk scheme @@ -33,6 +34,7 @@ #include #include +#include #include "librtools/RosPrintf.hpp" #include "librtcltools/RtclContext.hpp" @@ -45,6 +47,7 @@ #include "RtclRw11.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11 @@ -63,22 +66,20 @@ RtclRw11::RtclRw11(Tcl_Interp* interp, const char* name) fGets(), fSets() { - AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); - AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); - AddMeth("start", [this](RtclArgs& args){ return M_start(args); }); - AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); - AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); + AddMeth("get", bind(&RtclRw11::M_get, this, _1)); + AddMeth("set", bind(&RtclRw11::M_set, this, _1)); + AddMeth("start", bind(&RtclRw11::M_start, this, _1)); + AddMeth("dump", bind(&RtclRw11::M_dump, this, _1)); + AddMeth("$default", bind(&RtclRw11::M_default, this, _1)); Rw11* pobj = &Obj(); - fGets.Add ("started", [pobj](){ return pobj->IsStarted(); }); - fGets.Add ("diskscheme", - [](){ return Rw11VirtDisk::DefaultScheme(); }); - fGets.Add ("cpus", [this](){ return CpuCommands(); }); + fGets.Add ("started", bind(&Rw11::IsStarted, pobj)); + fGets.Add ("diskscheme", bind(&Rw11VirtDisk::DefaultScheme)); - fSets.Add ("diskscheme", - [](const string& v) - { Rw11VirtDisk::SetDefaultScheme(v);} ); - + fSets.Add ("diskscheme", + bind(&Rw11VirtDisk::SetDefaultScheme, _1)); + fGets.Add ("cpus", + bind(&RtclRw11::CpuCommands, this)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11Cntl.cpp b/tools/src/librwxxtpp/RtclRw11Cntl.cpp index cc46d064..c800d6bf 100644 --- a/tools/src/librwxxtpp/RtclRw11Cntl.cpp +++ b/tools/src/librwxxtpp/RtclRw11Cntl.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11Cntl.cpp 1085 2018-12-16 14:11:16Z mueller $ +// $Id: RtclRw11Cntl.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,8 +13,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.1.5 use std::bind instead of lambda // 2018-12-17 1085 1.1.4 use std::lock_guard instead of boost -// 2018-12-15 1082 1.1.3 use lambda instead of bind +// 2018-12-15 1082 1.1.3 use lambda instead of boost::bind // 2017-04-16 877 1.1.2 add UnitCommands(); add Class() // 2017-04-02 865 1.0.2 M_dump: use GetArgsDump and Dump detail // 2015-03-27 660 1.0.1 add M_start @@ -27,12 +28,15 @@ \brief Implemenation of RtclRw11Cntl. */ +#include + #include "librtcltools/RtclStats.hpp" #include "librtcltools/RtclOPtr.hpp" #include "RtclRw11Cntl.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11Cntl @@ -52,16 +56,18 @@ RtclRw11Cntl::RtclRw11Cntl(const std::string& type, fGets(), fSets() { - AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); - AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); - AddMeth("probe", [this](RtclArgs& args){ return M_probe(args); }); - AddMeth("start", [this](RtclArgs& args){ return M_start(args); }); - AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); - AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); - AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); + AddMeth("get", bind(&RtclRw11Cntl::M_get, this, _1)); + AddMeth("set", bind(&RtclRw11Cntl::M_set, this, _1)); + AddMeth("probe", bind(&RtclRw11Cntl::M_probe, this, _1)); + AddMeth("start", bind(&RtclRw11Cntl::M_start, this, _1)); + AddMeth("stats", bind(&RtclRw11Cntl::M_stats, this, _1)); + AddMeth("dump", bind(&RtclRw11Cntl::M_dump, this, _1)); + AddMeth("$default", bind(&RtclRw11Cntl::M_default, this, _1)); - fGets.Add ("units", [this](){ return UnitCommands(); }); - fGets.Add ("class", [this](){ return Class(); }); + fGets.Add ("units", + bind(&RtclRw11Cntl::UnitCommands, this)); + fGets.Add ("class", + bind(&RtclRw11Cntl::Class, this)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11CntlBase.ipp b/tools/src/librwxxtpp/RtclRw11CntlBase.ipp index 960a08e8..eccb6eff 100644 --- a/tools/src/librwxxtpp/RtclRw11CntlBase.ipp +++ b/tools/src/librwxxtpp/RtclRw11CntlBase.ipp @@ -1,6 +1,6 @@ -// $Id: RtclRw11CntlBase.ipp 1089 2018-12-19 10:45:41Z mueller $ +// $Id: RtclRw11CntlBase.ipp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,8 +13,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.2.4 use std::bind instead of lambda // 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-15 1082 1.2.2 use lambda instead of boost::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 // 2017-02-04 848 1.1 add in fGets: found,pdataint,pdatarem @@ -32,6 +33,8 @@ \brief FIXME_docs */ +#include + #include "librtcltools/Rtcl.hpp" #include "librtcltools/RtclOPtr.hpp" @@ -50,19 +53,21 @@ inline RtclRw11CntlBase::RtclRw11CntlBase(const std::string& type, AddMeth("bootcode", [this](RtclArgs& args){ return M_bootcode(args); }); TC* pobj = fspObj.get(); - fGets.Add("type", [pobj](){ return pobj->Type(); }); - fGets.Add("name", [pobj](){ return pobj->Name(); }); - fGets.Add ("base", [pobj](){ return pobj->Base(); }); - fGets.Add ("lam", [pobj](){ return pobj->Lam(); }); - fGets.Add ("found", [pobj](){ return pobj->ProbeFound(); }); - fGets.Add ("pdataint", [pobj](){ return pobj->ProbeDataInt(); }); - fGets.Add ("pdatarem", [pobj](){ return pobj->ProbeDataRem(); }); - fGets.Add ("enable", [pobj](){ return pobj->Enable(); }); - fGets.Add ("started", [pobj](){ return pobj->IsStarted(); }); - fGets.Add ("trace", [pobj](){ return pobj->TraceLevel(); }); - - fSets.Add ("enable", [pobj](bool v){ pobj->SetEnable(v); }); - fSets.Add ("trace", [pobj](uint32_t v){ pobj->SetTraceLevel(v); }); + fGets.Add("type", std::bind(&TC::Type, pobj)); + fGets.Add("name", std::bind(&TC::Name, pobj)); + fGets.Add ("base", std::bind(&TC::Base, pobj)); + fGets.Add ("lam", std::bind(&TC::Lam, pobj)); + fGets.Add ("found", std::bind(&TC::ProbeFound, pobj)); + fGets.Add ("pdataint", std::bind(&TC::ProbeDataInt, pobj)); + fGets.Add ("pdatarem", std::bind(&TC::ProbeDataRem, pobj)); + fGets.Add ("enable", std::bind(&TC::Enable, pobj)); + fGets.Add ("started", std::bind(&TC::IsStarted, pobj)); + fGets.Add ("trace", std::bind(&TC::TraceLevel,pobj)); + + fSets.Add ("enable", std::bind(&TC::SetEnable,pobj, + std::placeholders::_1)); + fSets.Add ("trace", std::bind(&TC::SetTraceLevel,pobj, + std::placeholders::_1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11CntlDEUNA.cpp b/tools/src/librwxxtpp/RtclRw11CntlDEUNA.cpp index 87c4b1a9..c6ecc59e 100644 --- a/tools/src/librwxxtpp/RtclRw11CntlDEUNA.cpp +++ b/tools/src/librwxxtpp/RtclRw11CntlDEUNA.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11CntlDEUNA.cpp 1082 2018-12-15 13:56:20Z mueller $ +// $Id: RtclRw11CntlDEUNA.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2014-2018 by Walter F.J. Mueller +// Copyright 2014-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.0.1 use lambda instead of bind +// 2019-02-23 1114 1.0.2 use std::bind instead of lambda +// 2018-12-15 1082 1.0.1 use lambda instead of boost::bind // 2017-04-16 878 1.0 Initial version // 2014-06-09 561 0.1 First draft // --------------------------------------------------------------------------- @@ -24,6 +25,7 @@ */ #include +#include #include "librtcltools/RtclNameSet.hpp" @@ -31,6 +33,7 @@ #include "RtclRw11UnitDEUNA.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11CntlDEUNA @@ -47,19 +50,20 @@ RtclRw11CntlDEUNA::RtclRw11CntlDEUNA() : RtclRw11CntlBase("Rw11CntlDEUNA","ether") { Rw11CntlDEUNA* pobj = &Obj(); - fGets.Add ("dpa", [pobj](){ return pobj->MacDefault(); }); - fGets.Add ("rxpoll", [pobj](){ return pobj->RxPollTime(); }); - fGets.Add ("rxqlim", [pobj](){ return pobj->RxQueLimit(); }); - fGets.Add ("run", [pobj](){ return pobj->Running(); }); - fSets.Add ("type", - [pobj](const string& v){ pobj->SetType(v); }); - fSets.Add ("dpa", - [pobj](const string& v){ pobj->SetMacDefault(v); }); - fSets.Add ("rxpoll", - [pobj](const Rtime& v){ pobj->SetRxPollTime(v); }); - fSets.Add ("rxqlim", - [pobj](size_t v){ pobj->SetRxQueLimit(v); }); + fGets.Add ("dpa", bind(&Rw11CntlDEUNA::MacDefault, pobj)); + fGets.Add ("rxpoll", bind(&Rw11CntlDEUNA::RxPollTime, pobj)); + fGets.Add ("rxqlim", bind(&Rw11CntlDEUNA::RxQueLimit, pobj)); + fGets.Add ("run", bind(&Rw11CntlDEUNA::Running, pobj)); + + fSets.Add ("type", + bind(&Rw11CntlDEUNA::SetType,pobj, _1)); + fSets.Add ("dpa", + bind(&Rw11CntlDEUNA::SetMacDefault,pobj, _1)); + fSets.Add ("rxpoll", + bind(&Rw11CntlDEUNA::SetRxPollTime,pobj, _1)); + fSets.Add ("rxqlim", + bind(&Rw11CntlDEUNA::SetRxQueLimit,pobj, _1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11CntlDL11.cpp b/tools/src/librwxxtpp/RtclRw11CntlDL11.cpp index 1601e8d6..89b459fc 100644 --- a/tools/src/librwxxtpp/RtclRw11CntlDL11.cpp +++ b/tools/src/librwxxtpp/RtclRw11CntlDL11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11CntlDL11.cpp 1082 2018-12-15 13:56:20Z mueller $ +// $Id: RtclRw11CntlDL11.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.1.1 use lambda instead of bind +// 2019-02-23 1114 1.1.2 use std::bind instead of lambda +// 2018-12-15 1082 1.1.1 use lambda instead of boost::bind // 2017-04-16 878 1.1 add class in ctor; derive from RtclRw11CntlTermBase // 2013-05-04 516 1.0.1 add RxRlim support (receive interrupt rate limit) // 2013-03-06 495 1.0 Initial version @@ -25,12 +26,15 @@ \brief Implemenation of RtclRw11CntlDL11. */ +#include + #include "librtcltools/RtclNameSet.hpp" #include "RtclRw11CntlDL11.hpp" #include "RtclRw11UnitDL11.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11CntlDL11 @@ -47,8 +51,8 @@ RtclRw11CntlDL11::RtclRw11CntlDL11() : RtclRw11CntlTermBase("Rw11CntlDL11","term") { Rw11CntlDL11* pobj = &Obj(); - fGets.Add ("rxrlim", [pobj](){ return pobj->RxRlim(); }); - fSets.Add ("rxrlim", [pobj](uint16_t v){ pobj->SetRxRlim(v); }); + fGets.Add ("rxrlim", bind(&Rw11CntlDL11::RxRlim, pobj)); + fSets.Add ("rxrlim", bind(&Rw11CntlDL11::SetRxRlim,pobj, _1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11CntlRdmaBase.ipp b/tools/src/librwxxtpp/RtclRw11CntlRdmaBase.ipp index 2d528f58..c36011f2 100644 --- a/tools/src/librwxxtpp/RtclRw11CntlRdmaBase.ipp +++ b/tools/src/librwxxtpp/RtclRw11CntlRdmaBase.ipp @@ -1,6 +1,6 @@ -// $Id: RtclRw11CntlRdmaBase.ipp 1082 2018-12-15 13:56:20Z mueller $ +// $Id: RtclRw11CntlRdmaBase.ipp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2017-2018 by Walter F.J. Mueller +// Copyright 2017-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.2.1 use lambda instead of bind +// 2019-02-23 1114 1.2.2 use std::bind instead of lambda +// 2018-12-15 1082 1.2.1 use lambda instead of boost::bind // 2017-04-16 877 1.2 add class in ctor // 2017-02-04 848 1.1 add in fGets: found,pdataint,pdatarem // 2013-03-06 495 1.0 Initial version @@ -30,6 +31,8 @@ \brief FIXME_docs */ +#include + #include "librtcltools/Rtcl.hpp" #include "librtcltools/RtclOPtr.hpp" @@ -47,8 +50,9 @@ inline RtclRw11CntlRdmaBase::RtclRw11CntlRdmaBase(const std::string& type, TC* pobj = &this->Obj(); RtclGetList& gets = this->fGets; RtclSetList& sets = this->fSets; - gets.Add ("chunksize", [pobj](){ return pobj->ChunkSize(); }); - sets.Add ("chunksize", [pobj](size_t v){ pobj->SetChunkSize(v); }); + gets.Add ("chunksize", std::bind(&TC::ChunkSize, pobj)); + sets.Add ("chunksize", std::bind(&TC::SetChunkSize, pobj, + std::placeholders::_1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11Cpu.cpp b/tools/src/librwxxtpp/RtclRw11Cpu.cpp index 4af9c706..66d0079e 100644 --- a/tools/src/librwxxtpp/RtclRw11Cpu.cpp +++ b/tools/src/librwxxtpp/RtclRw11Cpu.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11Cpu.cpp 1112 2019-02-17 11:10:04Z mueller $ +// $Id: RtclRw11Cpu.cpp 1114 2019-02-23 18:01:55Z mueller $ // // Copyright 2013-2019 by Walter F.J. Mueller // @@ -13,12 +13,12 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.2.26 use std::bind instead of lambda // 2019-02-15 1112 1.2.25 add HasIbtst() getter -// add return type for lambdas with const type& // 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 +// 2018-12-15 1082 1.2.21 use lambda instead of boost::bind // 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() @@ -68,6 +68,7 @@ #include #include #include +#include #include "librtools/RerrMsg.hpp" #include "librtools/RlogMsg.hpp" @@ -89,6 +90,7 @@ #include "RtclRw11Cpu.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11Cpu @@ -106,25 +108,25 @@ RtclRw11Cpu::RtclRw11Cpu(const std::string& type) fGets(), fSets() { - AddMeth("add", [this](RtclArgs& args){ return M_add(args); }); - AddMeth("imap", [this](RtclArgs& args){ return M_imap(args); }); - AddMeth("rmap", [this](RtclArgs& args){ return M_rmap(args); }); - AddMeth("cp", [this](RtclArgs& args){ return M_cp(args); }); - AddMeth("wtcpu", [this](RtclArgs& args){ return M_wtcpu(args); }); - AddMeth("deposit", [this](RtclArgs& args){ return M_deposit(args); }); - AddMeth("examine", [this](RtclArgs& args){ return M_examine(args); }); - AddMeth("lsmem", [this](RtclArgs& args){ return M_lsmem(args); }); - AddMeth("ldabs", [this](RtclArgs& args){ return M_ldabs(args); }); - AddMeth("ldasm", [this](RtclArgs& args){ return M_ldasm(args); }); - AddMeth("boot", [this](RtclArgs& args){ return M_boot(args); }); - AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); - AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); - AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); - AddMeth("show", [this](RtclArgs& args){ return M_show(args); }); - AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); - AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); + AddMeth("add", bind(&RtclRw11Cpu::M_add, this, _1)); + AddMeth("imap", bind(&RtclRw11Cpu::M_imap, this, _1)); + AddMeth("rmap", bind(&RtclRw11Cpu::M_rmap, this, _1)); + AddMeth("cp", bind(&RtclRw11Cpu::M_cp, this, _1)); + AddMeth("wtcpu", bind(&RtclRw11Cpu::M_wtcpu, this, _1)); + AddMeth("deposit", bind(&RtclRw11Cpu::M_deposit, this, _1)); + AddMeth("examine", bind(&RtclRw11Cpu::M_examine, this, _1)); + AddMeth("lsmem", bind(&RtclRw11Cpu::M_lsmem, this, _1)); + AddMeth("ldabs", bind(&RtclRw11Cpu::M_ldabs, this, _1)); + AddMeth("ldasm", bind(&RtclRw11Cpu::M_ldasm, this, _1)); + AddMeth("boot", bind(&RtclRw11Cpu::M_boot, this, _1)); + AddMeth("get", bind(&RtclRw11Cpu::M_get, this, _1)); + AddMeth("set", bind(&RtclRw11Cpu::M_set, this, _1)); + AddMeth("stats", bind(&RtclRw11Cpu::M_stats, this, _1)); + AddMeth("show", bind(&RtclRw11Cpu::M_show, this, _1)); + AddMeth("dump", bind(&RtclRw11Cpu::M_dump, this, _1)); + AddMeth("$default", bind(&RtclRw11Cpu::M_default, this, _1)); - fGets.Add ("cntls", [this](){ return ControllerCommands(); }); + fGets.Add ("cntls", bind(&RtclRw11Cpu::ControllerCommands, this)); } //------------------------------------------+----------------------------------- @@ -1482,20 +1484,19 @@ int RtclRw11Cpu::M_default(RtclArgs& args) void RtclRw11Cpu::SetupGetSet() { Rw11Cpu* pobj = &Obj(); - fGets.Add("type", [pobj]() -> const string& - { return pobj->Type(); }); - fGets.Add ("index", [pobj](){ return pobj->Index(); }); - fGets.Add ("base", [pobj](){ return pobj->Base(); }); - fGets.Add ("ibase", [pobj](){ return pobj->IBase(); }); - fGets.Add ("hasscnt", [pobj](){ return pobj->HasScnt(); }); - fGets.Add ("haspcnt", [pobj](){ return pobj->HasPcnt(); }); - fGets.Add ("hascmon", [pobj](){ return pobj->HasCmon(); }); - fGets.Add ("hashbpt", [pobj](){ return pobj->HasHbpt(); }); - fGets.Add ("hasibmon", [pobj](){ return pobj->HasIbmon(); }); - fGets.Add ("hasibtst", [pobj](){ return pobj->HasIbtst(); }); - fGets.Add ("haskw11l", [pobj](){ return pobj->HasKw11l(); }); - fGets.Add ("haskw11p", [pobj](){ return pobj->HasKw11p(); }); - fGets.Add ("hasiist", [pobj](){ return pobj->HasIist(); }); + fGets.Add("type", bind(&Rw11Cpu::Type, pobj)); + fGets.Add ("index", bind(&Rw11Cpu::Index, pobj)); + fGets.Add ("base", bind(&Rw11Cpu::Base, pobj)); + fGets.Add ("ibase", bind(&Rw11Cpu::IBase, pobj)); + fGets.Add ("hasscnt", bind(&Rw11Cpu::HasScnt, pobj)); + fGets.Add ("haspcnt", bind(&Rw11Cpu::HasPcnt, pobj)); + fGets.Add ("hascmon", bind(&Rw11Cpu::HasCmon, pobj)); + fGets.Add ("hashbpt", bind(&Rw11Cpu::HasHbpt, pobj)); + fGets.Add ("hasibmon", bind(&Rw11Cpu::HasIbmon, pobj)); + fGets.Add ("hasibtst", bind(&Rw11Cpu::HasIbtst, pobj)); + fGets.Add ("haskw11l", bind(&Rw11Cpu::HasKw11l, pobj)); + fGets.Add ("haskw11p", bind(&Rw11Cpu::HasKw11p, pobj)); + fGets.Add ("hasiist", bind(&Rw11Cpu::HasIist, pobj)); return; } diff --git a/tools/src/librwxxtpp/RtclRw11Unit.cpp b/tools/src/librwxxtpp/RtclRw11Unit.cpp index 46698a0c..252ff0be 100644 --- a/tools/src/librwxxtpp/RtclRw11Unit.cpp +++ b/tools/src/librwxxtpp/RtclRw11Unit.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11Unit.cpp 1085 2018-12-16 14:11:16Z mueller $ +// $Id: RtclRw11Unit.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,8 +13,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.3.3 use std::bind instead of lambda // 2018-12-17 1085 1.3.2 use std::lock_guard instead of boost -// 2018-12-15 1082 1.3.1 use lambda instead of bind +// 2018-12-15 1082 1.3.1 use lambda instead of boost::bind // 2018-12-01 1076 1.3 use unique_ptr instead of scoped_ptr // 2017-04-08 870 1.2 drop fpCpu, use added Cpu()=0 instead // 2017-04-07 868 1.1.1 M_dump: use GetArgsDump and Dump detail @@ -28,12 +29,15 @@ \brief Implemenation of RtclRw11Unit. */ +#include + #include "librtools/Rexception.hpp" #include "librtcltools/RtclStats.hpp" #include "RtclRw11Unit.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11Unit @@ -52,12 +56,12 @@ RtclRw11Unit::RtclRw11Unit(const std::string& type) fSets(), fupVirt() { - AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); - AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); - AddMeth("attach", [this](RtclArgs& args){ return M_attach(args); }); - AddMeth("detach", [this](RtclArgs& args){ return M_detach(args); }); - AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); - AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); + AddMeth("get", bind(&RtclRw11Unit::M_get, this, _1)); + AddMeth("set", bind(&RtclRw11Unit::M_set, this, _1)); + AddMeth("attach", bind(&RtclRw11Unit::M_attach, this, _1)); + AddMeth("detach", bind(&RtclRw11Unit::M_detach, this, _1)); + AddMeth("dump", bind(&RtclRw11Unit::M_dump, this, _1)); + AddMeth("$default", bind(&RtclRw11Unit::M_default, this, _1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11UnitBase.ipp b/tools/src/librwxxtpp/RtclRw11UnitBase.ipp index efad75a0..7fcbf373 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitBase.ipp +++ b/tools/src/librwxxtpp/RtclRw11UnitBase.ipp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitBase.ipp 1082 2018-12-15 13:56:20Z mueller $ +// $Id: RtclRw11UnitBase.ipp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.3.5 use lambda instead of bind +// 2019-02-23 1114 1.3.6 use std::bind instead of lambda +// 2018-12-15 1082 1.3.5 use lambda instead of boost::bind // 2018-12-09 1080 1.3.4 use HasVirt(); Virt() returns ref // 2018-12-07 1078 1.3.3 use std::shared_ptr instead of boost // 2018-12-01 1076 1.3.2 use unique_ptr @@ -30,6 +31,8 @@ \brief Implemenation (all inline) of RtclRw11UnitBase. */ +#include + #include "librtcltools/RtclStats.hpp" #include "RtclRw11VirtFactory.hpp" @@ -62,7 +65,8 @@ inline RtclRw11UnitBase::RtclRw11UnitBase(const std::string& type, : TB(type), fspObj(spunit) { - this->AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); + this->AddMeth("stats", std::bind(&RtclRw11UnitBase::M_stats, + this, std::placeholders::_1)); TU* pobj = fspObj.get(); @@ -73,13 +77,11 @@ inline RtclRw11UnitBase::RtclRw11UnitBase(const std::string& type, // error messages. Simply too much nested templating... RtclGetList& gets = this->fGets; - gets.Add ("index", [pobj](){ return pobj->Index(); }); - gets.Add ("name", [pobj](){ return pobj->Name(); }); - gets.Add ("enabled", [pobj](){ return pobj->Enabled(); }); - gets.Add ("attached", - [pobj](){ return pobj->IsAttached(); }); - gets.Add ("attachurl", - [pobj](){ return pobj->AttachUrl(); }); + gets.Add ("index", std::bind(&TU::Index, pobj)); + gets.Add ("name", std::bind(&TU::Name, pobj)); + gets.Add ("enabled", std::bind(&TU::Enabled, pobj)); + gets.Add ("attached", std::bind(&TU::IsAttached, pobj)); + gets.Add ("attachurl",std::bind(&TU::AttachUrl,pobj)); } //------------------------------------------+----------------------------------- @@ -135,7 +137,8 @@ void RtclRw11UnitBase::AttachDone() std::unique_ptr pvirt(RtclRw11VirtFactory(&Obj().Virt())); if (!pvirt) return; this->fupVirt = move(pvirt); - this->AddMeth("virt", [this](RtclArgs& args){ return this->M_virt(args); }); + this->AddMeth("virt", std::bind(&RtclRw11Unit::M_virt, this, + std::placeholders::_1)); return; } diff --git a/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp b/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp index 1a4d6c15..ffa19952 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitDisk.cpp 1082 2018-12-15 13:56:20Z mueller $ +// $Id: RtclRw11UnitDisk.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.2.2 use lambda instead of bind +// 2019-02-23 1114 1.2.3 use std::bind instead of lambda +// 2018-12-15 1082 1.2.2 use lambda instead of boost::bind // 2018-10-06 1053 1.2.1 move using after includes (clang warning) // 2017-04-08 870 1.2 use Rw11UnitDisk& ObjUV(); inherit from RtclRw11Unit // 2015-05-14 680 1.1.1 fGets: remove enabled, now in RtclRw11UnitBase @@ -27,9 +28,12 @@ \brief Implemenation of RtclRw11UnitDisk. */ +#include + #include "RtclRw11UnitDisk.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11UnitDisk @@ -63,16 +67,16 @@ void RtclRw11UnitDisk::SetupGetSet() Rw11UnitDisk* pobj = &ObjUV(); - fGets.Add ("type", [pobj](){ return pobj->Type(); }); - fGets.Add ("ncylinder", [pobj](){ return pobj->NCylinder(); }); - fGets.Add ("nhead", [pobj](){ return pobj->NHead(); }); - fGets.Add ("nsector", [pobj](){ return pobj->NSector(); }); - fGets.Add ("blocksize", [pobj](){ return pobj->BlockSize(); }); - fGets.Add ("nblock", [pobj](){ return pobj->NBlock(); }); - fGets.Add ("wprot", [pobj](){ return pobj->WProt(); }); + fGets.Add ("type", bind(&Rw11UnitDisk::Type, pobj)); + fGets.Add ("ncylinder", bind(&Rw11UnitDisk::NCylinder, pobj)); + fGets.Add ("nhead", bind(&Rw11UnitDisk::NHead, pobj)); + fGets.Add ("nsector", bind(&Rw11UnitDisk::NSector, pobj)); + fGets.Add ("blocksize", bind(&Rw11UnitDisk::BlockSize, pobj)); + fGets.Add ("nblock", bind(&Rw11UnitDisk::NBlock, pobj)); + fGets.Add ("wprot", bind(&Rw11UnitDisk::WProt, pobj)); - fSets.Add ("type", - [pobj](const string& v){ pobj->SetType(v); }); + fSets.Add ("type", bind(&Rw11UnitDisk::SetType,pobj, _1)); + return; } diff --git a/tools/src/librwxxtpp/RtclRw11UnitStream.cpp b/tools/src/librwxxtpp/RtclRw11UnitStream.cpp index 502565aa..7904f0e4 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitStream.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitStream.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitStream.cpp 1082 2018-12-15 13:56:20Z mueller $ +// $Id: RtclRw11UnitStream.cpp 1114 2019-02-23 18:01:55Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.1.2 use lambda instead of bind +// 2019-02-23 1114 1.1.3 use std::bind instead of lambda +// 2018-12-15 1082 1.1.2 use lambda instead of boost::bind // 2018-10-06 1053 1.1.1 move using after includes (clang warning) // 2017-04-08 870 1.1 use Rw11UnitStream& ObjUV(); inh from RtclRw11Unit // 2013-05-01 513 1.0 Initial version @@ -24,9 +25,12 @@ \brief Implemenation of RtclRw11UnitStream. */ +#include + #include "RtclRw11UnitStream.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11UnitStream @@ -61,9 +65,10 @@ void RtclRw11UnitStream::SetupGetSet() Rw11UnitStream* pobj = &ObjUV(); - fGets.Add ("pos", [pobj](){ return pobj->Pos(); }); + fGets.Add ("pos", bind(&Rw11UnitStream::Pos, pobj)); + + fSets.Add ("pos", bind(&Rw11UnitStream::SetPos,pobj, _1)); - fSets.Add ("pos", [pobj](int v){ pobj->SetPos(v); }); return; } } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitTape.cpp b/tools/src/librwxxtpp/RtclRw11UnitTape.cpp index 981d3bb6..d71a1ae8 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTape.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTape.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitTape.cpp 1082 2018-12-15 13:56:20Z mueller $ +// $Id: RtclRw11UnitTape.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2015-2018 by Walter F.J. Mueller +// Copyright 2015-2019 by Walter F.J. Mueller // // 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,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-15 1082 1.1.2 use lambda instead of bind +// 2019-02-23 1114 1.1.3 use std::bind instead of lambda +// 2018-12-15 1082 1.1.2 use lambda instead of boost::bind // 2018-10-06 1053 1.1.1 move using after includes (clang warning) // 2017-04-08 870 1.1 use Rw11UnitTape& ObjUV(); inherit from RtclRw11Unit // 2015-06-04 686 1.0 Initial version @@ -25,9 +26,12 @@ \brief Implemenation of RtclRw11UnitTape. */ +#include + #include "RtclRw11UnitTape.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11UnitTape @@ -60,26 +64,22 @@ void RtclRw11UnitTape::SetupGetSet() // called in ctor of a more derived class. Rw11UnitTape* pobj = &ObjUV(); + + fGets.Add ("type", bind(&Rw11UnitTape::Type, pobj)); + fGets.Add ("wprot", bind(&Rw11UnitTape::WProt, pobj)); + fGets.Add ("capacity", bind(&Rw11UnitTape::Capacity, pobj)); + fGets.Add ("bot", bind(&Rw11UnitTape::Bot, pobj)); + fGets.Add ("eot", bind(&Rw11UnitTape::Eot, pobj)); + fGets.Add ("eom", bind(&Rw11UnitTape::Eom, pobj)); + fGets.Add ("posfile", bind(&Rw11UnitTape::PosFile, pobj)); + fGets.Add ("posrecord",bind(&Rw11UnitTape::PosRecord, pobj)); - fGets.Add ("type", [pobj](){ return pobj->Type(); }); - fGets.Add ("wprot", [pobj](){ return pobj->WProt(); }); - fGets.Add ("capacity", [pobj](){ return pobj->Capacity(); }); - fGets.Add ("bot", [pobj](){ return pobj->Bot(); }); - fGets.Add ("eot", [pobj](){ return pobj->Eot(); }); - fGets.Add ("eom", [pobj](){ return pobj->Eom(); }); - fGets.Add ("posfile", [pobj](){ return pobj->PosFile(); }); - fGets.Add ("posrecord", [pobj](){ return pobj->PosRecord(); }); - - fSets.Add ("type", - [pobj](const string& v){ pobj->SetType(v); }); - fSets.Add ("wprot", - [pobj](bool v){ pobj->SetWProt(v); }); - fSets.Add ("capacity", - [pobj](size_t v){ pobj->SetCapacity(v); }); - fSets.Add ("posfile", - [pobj](int v){ pobj->SetPosFile(v); }); - fSets.Add ("posrecord", - [pobj](int v){ pobj->SetPosRecord(v); }); + fSets.Add ("type", bind(&Rw11UnitTape::SetType,pobj, _1)); + fSets.Add ("wprot", bind(&Rw11UnitTape::SetWProt,pobj, _1)); + fSets.Add ("capacity", bind(&Rw11UnitTape::SetCapacity,pobj, _1)); + fSets.Add ("posfile", bind(&Rw11UnitTape::SetPosFile,pobj, _1)); + fSets.Add ("posrecord", bind(&Rw11UnitTape::SetPosRecord,pobj, _1)); + return; } diff --git a/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp b/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp index 483f5405..2a4a7dcb 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitTerm.cpp 1089 2018-12-19 10:45:41Z mueller $ +// $Id: RtclRw11UnitTerm.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,8 +13,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.1.4 use std::bind instead of lambda // 2018-12-18 1089 1.1.3 use c++ style casts -// 2018-12-15 1082 1.1.2 use lambda instead of bind +// 2018-12-15 1082 1.1.2 use lambda instead of boost::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 // 2013-04-26 511 1.0.1 add M_type @@ -27,9 +28,12 @@ \brief Implemenation of RtclRw11UnitTerm. */ +#include + #include "RtclRw11UnitTerm.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11UnitTerm @@ -45,7 +49,7 @@ namespace Retro { RtclRw11UnitTerm::RtclRw11UnitTerm(const std::string& type) : RtclRw11Unit(type) { - AddMeth("type", [this](RtclArgs& args){ return M_type(args); }); + AddMeth("type", bind(&RtclRw11UnitTerm::M_type, this, _1)); } //------------------------------------------+----------------------------------- @@ -80,17 +84,17 @@ void RtclRw11UnitTerm::SetupGetSet() Rw11UnitTerm* pobj = &ObjUV(); - fGets.Add ("channelid", [pobj](){ return pobj->ChannelId(); }); - fGets.Add ("to7bit", [pobj](){ return pobj->To7bit(); }); - fGets.Add ("toenpc", [pobj](){ return pobj->ToEnpc(); }); - fGets.Add ("ti7bit", [pobj](){ return pobj->Ti7bit(); }); - fGets.Add ("log", [pobj](){ return pobj->Log(); }); + fGets.Add ("channelid", bind(&Rw11UnitTerm::ChannelId, pobj)); + fGets.Add ("to7bit", bind(&Rw11UnitTerm::To7bit, pobj)); + fGets.Add ("toenpc", bind(&Rw11UnitTerm::ToEnpc, pobj)); + fGets.Add ("ti7bit", bind(&Rw11UnitTerm::Ti7bit, pobj)); + fGets.Add ("log", bind(&Rw11UnitTerm::Log, pobj)); + + fSets.Add ("to7bit", bind(&Rw11UnitTerm::SetTo7bit,pobj, _1)); + fSets.Add ("toenpc", bind(&Rw11UnitTerm::SetToEnpc,pobj, _1)); + fSets.Add ("ti7bit", bind(&Rw11UnitTerm::SetTi7bit,pobj, _1)); + fSets.Add ("log", bind(&Rw11UnitTerm::SetLog,pobj, _1)); - fSets.Add ("to7bit", [pobj](bool v){ pobj->SetTo7bit(v); }); - fSets.Add ("toenpc", [pobj](bool v){ pobj->SetToEnpc(v); }); - fSets.Add ("ti7bit", [pobj](bool v){ pobj->SetTi7bit(v); }); - fSets.Add ("log", - [pobj](const string& v){ pobj->SetLog(v); }); return; } diff --git a/tools/src/librwxxtpp/RtclRw11Virt.cpp b/tools/src/librwxxtpp/RtclRw11Virt.cpp index def05455..0c06d230 100644 --- a/tools/src/librwxxtpp/RtclRw11Virt.cpp +++ b/tools/src/librwxxtpp/RtclRw11Virt.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11Virt.cpp 1087 2018-12-17 08:25:37Z mueller $ +// $Id: RtclRw11Virt.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2017-2018 by Walter F.J. Mueller +// Copyright 2017-2019 by Walter F.J. Mueller // // 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,8 +13,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.0.4 use std::bind instead of lambda // 2018-12-17 1087 1.0.3 use std::lock_guard instead of boost -// 2018-12-15 1082 1.0.2 use lambda instead of bind +// 2018-12-15 1082 1.0.2 use lambda instead of boost::bind // 2017-04-07 868 1.0.1 M_dump: use GetArgsDump and Dump detail // 2017-03-11 859 1.0 Initial version // --------------------------------------------------------------------------- @@ -24,11 +25,14 @@ \brief Implemenation of RtclRw11Virt. */ +#include + #include "librtcltools/RtclStats.hpp" #include "RtclRw11Virt.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11Virt @@ -48,10 +52,10 @@ RtclRw11Virt::RtclRw11Virt(Rw11Virt* pvirt) fGets(), fSets() { - AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); - AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); - AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); - AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); + AddMeth("get", bind(&RtclRw11Virt::M_get, this, _1)); + AddMeth("set", bind(&RtclRw11Virt::M_set, this, _1)); + AddMeth("stats", bind(&RtclRw11Virt::M_stats, this, _1)); + AddMeth("dump", bind(&RtclRw11Virt::M_dump, this, _1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11VirtDiskOver.cpp b/tools/src/librwxxtpp/RtclRw11VirtDiskOver.cpp index 71b90618..f8495de8 100644 --- a/tools/src/librwxxtpp/RtclRw11VirtDiskOver.cpp +++ b/tools/src/librwxxtpp/RtclRw11VirtDiskOver.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11VirtDiskOver.cpp 1087 2018-12-17 08:25:37Z mueller $ +// $Id: RtclRw11VirtDiskOver.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2013-2018 by Walter F.J. Mueller +// Copyright 2013-2019 by Walter F.J. Mueller // // 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,8 +13,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.0.3 use std::bind instead of lambda // 2018-12-17 1087 1.0.2 use std::lock_guard instead of boost -// 2018-12-15 1082 1.0.1 use lambda instead of bind +// 2018-12-15 1082 1.0.1 use lambda instead of boost::bind // 2017-03-11 859 1.0 Initial version // --------------------------------------------------------------------------- @@ -23,9 +24,12 @@ \brief Implemenation of RtclRw11VirtDiskOver. */ +#include + #include "RtclRw11VirtDiskOver.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11VirtDiskOver @@ -41,8 +45,8 @@ namespace Retro { RtclRw11VirtDiskOver::RtclRw11VirtDiskOver(Rw11VirtDiskOver* pobj) : RtclRw11VirtBase(pobj) { - AddMeth("flush", [this](RtclArgs& args){ return M_flush(args); }); - AddMeth("list", [this](RtclArgs& args){ return M_list(args); }); + AddMeth("flush", bind(&RtclRw11VirtDiskOver::M_flush, this, _1)); + AddMeth("list", bind(&RtclRw11VirtDiskOver::M_list, this, _1)); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11VirtDiskRam.cpp b/tools/src/librwxxtpp/RtclRw11VirtDiskRam.cpp index 0c772284..dbcf7ed5 100644 --- a/tools/src/librwxxtpp/RtclRw11VirtDiskRam.cpp +++ b/tools/src/librwxxtpp/RtclRw11VirtDiskRam.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11VirtDiskRam.cpp 1087 2018-12-17 08:25:37Z mueller $ +// $Id: RtclRw11VirtDiskRam.cpp 1114 2019-02-23 18:01:55Z mueller $ // -// Copyright 2018- by Walter F.J. Mueller +// Copyright 2018-2019 by Walter F.J. Mueller // // 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,8 +13,9 @@ // // Revision History: // Date Rev Version Comment +// 2019-02-23 1114 1.0.3 use std::bind instead of lambda // 2018-12-17 1087 1.0.2 use std::lock_guard instead of boost -// 2018-12-15 1082 1.0.1 use lambda instead of bind +// 2018-12-15 1082 1.0.1 use lambda instead of boost::bind // 2018-10-28 1063 1.0 Initial version // --------------------------------------------------------------------------- @@ -23,9 +24,12 @@ \brief Implemenation of RtclRw11VirtDiskRam. */ +#include + #include "RtclRw11VirtDiskRam.hpp" using namespace std; +using namespace std::placeholders; /*! \class Retro::RtclRw11VirtDiskRam @@ -41,7 +45,7 @@ namespace Retro { RtclRw11VirtDiskRam::RtclRw11VirtDiskRam(Rw11VirtDiskRam* pobj) : RtclRw11VirtBase(pobj) { - AddMeth("list", [this](RtclArgs& args){ return M_list(args); }); + AddMeth("list", bind(&RtclRw11VirtDiskRam::M_list, this, _1)); } //------------------------------------------+-----------------------------------