diff --git a/tools/src/librw11/Rw11VirtDisk.cpp b/tools/src/librw11/Rw11VirtDisk.cpp index 264b65cc..c5118f48 100644 --- a/tools/src/librw11/Rw11VirtDisk.cpp +++ b/tools/src/librw11/Rw11VirtDisk.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11VirtDisk.cpp 864 2017-04-02 13:20:18Z mueller $ +// $Id: Rw11VirtDisk.cpp 867 2017-04-02 18:16:33Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-02 866 1.2 add default scheme handling // 2017-04-02 864 1.1 add Rw11VirtDiskOver // 2013-03-03 494 1.0 Initial version // 2013-02-13 488 0.1 First draft @@ -20,13 +21,14 @@ /*! \file - \version $Id: Rw11VirtDisk.cpp 864 2017-04-02 13:20:18Z mueller $ + \version $Id: Rw11VirtDisk.cpp 867 2017-04-02 18:16:33Z mueller $ \brief Implemenation of Rw11VirtDisk. */ #include #include "librtools/RosFill.hpp" #include "librtools/RparseUrl.hpp" +#include "librtools/Rexception.hpp" #include "Rw11VirtDiskFile.hpp" #include "Rw11VirtDiskOver.hpp" @@ -42,6 +44,11 @@ using namespace std; // all method definitions in namespace Retro namespace Retro { +//------------------------------------------+----------------------------------- +// static definitions + +std::string Rw11VirtDisk::sDefaultScheme("file"); + //------------------------------------------+----------------------------------- //! Default constructor @@ -65,10 +72,24 @@ Rw11VirtDisk::~Rw11VirtDisk() //------------------------------------------+----------------------------------- //! FIXME_docs +void Rw11VirtDisk::Dump(std::ostream& os, int ind, const char* text) const +{ + RosFill bl(ind); + os << bl << (text?text:"--") << "Rw11VirtDisk @ " << this << endl; + + os << bl << " fBlkSize: " << fBlkSize << endl; + os << bl << " fNBlock: " << fNBlock << endl; + Rw11Virt::Dump(os, ind, " ^"); + return; +} + +//------------------------------------------+----------------------------------- +//! FIXME_docs + Rw11VirtDisk* Rw11VirtDisk::New(const std::string& url, Rw11Unit* punit, RerrMsg& emsg) { - string scheme = RparseUrl::FindScheme(url, "file"); + string scheme = RparseUrl::FindScheme(url, sDefaultScheme); unique_ptr p; if (scheme == "file") { // scheme -> file: @@ -90,16 +111,21 @@ Rw11VirtDisk* Rw11VirtDisk::New(const std::string& url, Rw11Unit* punit, //------------------------------------------+----------------------------------- //! FIXME_docs -void Rw11VirtDisk::Dump(std::ostream& os, int ind, const char* text) const +const std::string& Rw11VirtDisk::DefaultScheme() { - RosFill bl(ind); - os << bl << (text?text:"--") << "Rw11VirtDisk @ " << this << endl; + return sDefaultScheme; +} +//------------------------------------------+----------------------------------- +//! FIXME_docs - os << bl << " fBlkSize: " << fBlkSize << endl; - os << bl << " fNBlock: " << fNBlock << endl; - Rw11Virt::Dump(os, ind, " ^"); +void Rw11VirtDisk::SetDefaultScheme(const std::string& scheme) +{ + if (scheme != "file" && scheme != "over") + throw Rexception("Rw11VirtDisk::SetDefaultScheme", + "only 'file' or 'over' allowed"); + + sDefaultScheme = scheme; return; } - - + } // end namespace Retro diff --git a/tools/src/librw11/Rw11VirtDisk.hpp b/tools/src/librw11/Rw11VirtDisk.hpp index 16c3c531..e5c247f6 100644 --- a/tools/src/librw11/Rw11VirtDisk.hpp +++ b/tools/src/librw11/Rw11VirtDisk.hpp @@ -1,4 +1,4 @@ -// $Id: Rw11VirtDisk.hpp 864 2017-04-02 13:20:18Z mueller $ +// $Id: Rw11VirtDisk.hpp 867 2017-04-02 18:16:33Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-02 866 1.1 add default scheme handling // 2013-03-03 494 1.0 Initial version // 2013-02-13 488 0.1 First draft // --------------------------------------------------------------------------- @@ -20,13 +21,15 @@ /*! \file - \version $Id: Rw11VirtDisk.hpp 864 2017-04-02 13:20:18Z mueller $ + \version $Id: Rw11VirtDisk.hpp 867 2017-04-02 18:16:33Z mueller $ \brief Declaration of class Rw11VirtDisk. */ #ifndef included_Retro_Rw11VirtDisk #define included_Retro_Rw11VirtDisk 1 +#include + #include "Rw11Virt.hpp" namespace Retro { @@ -50,6 +53,9 @@ namespace Retro { static Rw11VirtDisk* New(const std::string& url, Rw11Unit* punit, RerrMsg& emsg); + static const std::string& DefaultScheme(); + static void SetDefaultScheme(const std::string& scheme); + // statistics counter indices enum stats { kStatNVDRead = Rw11Virt::kDimStat, @@ -62,6 +68,9 @@ namespace Retro { protected: size_t fBlkSize; // +// Copyright 2013-2017 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 +// 2017-04-02 866 1.0.2 add M_set; handle default disk scheme // 2015-03-28 660 1.0.1 add M_get // 2014-12-25 621 1.1 adopt to 4k word ibus window // 2013-03-06 495 1.0 Initial version @@ -21,7 +22,7 @@ /*! \file - \version $Id: RtclRw11.cpp 858 2017-03-05 17:41:37Z mueller $ + \version $Id: RtclRw11.cpp 867 2017-04-02 18:16:33Z mueller $ \brief Implemenation of class RtclRw11. */ @@ -38,6 +39,7 @@ #include "RtclRw11CpuW11a.hpp" #include "librw11/Rw11Cpu.hpp" #include "librw11/Rw11Cntl.hpp" +#include "librw11/Rw11VirtDisk.hpp" #include "RtclRw11.hpp" @@ -57,16 +59,22 @@ namespace Retro { RtclRw11::RtclRw11(Tcl_Interp* interp, const char* name) : RtclProxyOwned("Rw11", interp, name, new Rw11()), fspServ(), - fGets() + fGets(), + fSets() { AddMeth("get", boost::bind(&RtclRw11::M_get, this, _1)); + AddMeth("set", boost::bind(&RtclRw11::M_set, this, _1)); AddMeth("start", boost::bind(&RtclRw11::M_start, this, _1)); AddMeth("dump", boost::bind(&RtclRw11::M_dump, this, _1)); AddMeth("$default", boost::bind(&RtclRw11::M_default, this, _1)); Rw11* pobj = &Obj(); - fGets.Add ("started",boost::bind(&Rw11::IsStarted, pobj)); + fGets.Add ("started",boost::bind(&Rw11::IsStarted, pobj)); + fGets.Add ("diskscheme", + boost::bind(&Rw11VirtDisk::DefaultScheme)); + fSets.Add ("diskscheme", + boost::bind(&Rw11VirtDisk::SetDefaultScheme, _1)); } //------------------------------------------+----------------------------------- @@ -132,6 +140,16 @@ int RtclRw11::M_get(RtclArgs& args) //------------------------------------------+----------------------------------- //! FIXME_docs +int RtclRw11::M_set(RtclArgs& args) +{ + // synchronize with server thread + boost::lock_guard lock(Obj().Connect()); + return fSets.M_set(args); +} + +//------------------------------------------+----------------------------------- +//! FIXME_docs + int RtclRw11::M_start(RtclArgs& args) { if (!args.AllDone()) return kERR; diff --git a/tools/src/librwxxtpp/RtclRw11.hpp b/tools/src/librwxxtpp/RtclRw11.hpp index 33e999ba..7a92e7f1 100644 --- a/tools/src/librwxxtpp/RtclRw11.hpp +++ b/tools/src/librwxxtpp/RtclRw11.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11.hpp 660 2015-03-29 22:10:16Z mueller $ +// $Id: RtclRw11.hpp 867 2017-04-02 18:16:33Z mueller $ // -// Copyright 2013-2015 by Walter F.J. Mueller +// Copyright 2013-2017 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 +// 2017-04-02 866 1.0.2 add M_set // 2015-03-28 660 1.0.1 add M_get // 2013-03-06 495 1.0 Initial version // 2013-01-27 478 0.1 First draft @@ -20,7 +21,7 @@ /*! \file - \version $Id: RtclRw11.hpp 660 2015-03-29 22:10:16Z mueller $ + \version $Id: RtclRw11.hpp 867 2017-04-02 18:16:33Z mueller $ \brief Declaration of class RtclRw11. */ @@ -34,6 +35,7 @@ #include "librtcltools/RtclProxyOwned.hpp" #include "librtcltools/RtclGetList.hpp" +#include "librtcltools/RtclSetList.hpp" #include "librlink/RlinkServer.hpp" #include "librw11/Rw11.hpp" @@ -49,6 +51,7 @@ namespace Retro { protected: int M_get(RtclArgs& args); + int M_set(RtclArgs& args); int M_start(RtclArgs& args); int M_dump(RtclArgs& args); int M_default(RtclArgs& args); @@ -56,6 +59,7 @@ namespace Retro { protected: boost::shared_ptr fspServ; RtclGetList fGets; + RtclSetList fSets; }; } // end namespace Retro