From d0fb85e7128491f0f69547c8106b74a5bfbc4343 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 16 Sep 2022 00:20:54 +0200 Subject: [PATCH] Rename all the remaining layout and location variables to trackInfo (where appropriate). --- arch/amiga/encoder.cc | 2 +- arch/apple2/encoder.cc | 2 +- arch/brother/encoder.cc | 2 +- arch/c64/encoder.cc | 4 ++-- arch/ibm/encoder.cc | 6 +++--- arch/macintosh/encoder.cc | 4 ++-- arch/micropolis/encoder.cc | 2 +- arch/northstar/encoder.cc | 2 +- arch/tids990/encoder.cc | 2 +- arch/victor9k/encoder.cc | 4 ++-- lib/decoders/decoders.cc | 10 +++++----- lib/decoders/decoders.h | 4 ++-- lib/encoders/encoders.cc | 4 ++-- lib/encoders/encoders.h | 2 +- lib/flux.h | 4 ++-- lib/fluxsource/memoryfluxsource.cc | 2 +- lib/readerwriter.cc | 12 ++++++------ lib/vfs/fluxsectorinterface.cc | 4 ++-- src/gui/fluxviewercontrol.cc | 2 +- src/gui/fluxviewerwindow.cc | 4 ++-- src/gui/visualisationcontrol.cc | 8 ++++---- 21 files changed, 43 insertions(+), 43 deletions(-) diff --git a/arch/amiga/encoder.cc b/arch/amiga/encoder.cc index 5743de13..0756238f 100644 --- a/arch/amiga/encoder.cc +++ b/arch/amiga/encoder.cc @@ -110,7 +110,7 @@ public: } public: - std::unique_ptr encode(std::shared_ptr& layout, + std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { diff --git a/arch/apple2/encoder.cc b/arch/apple2/encoder.cc index 5d0e27d4..7af72c95 100644 --- a/arch/apple2/encoder.cc +++ b/arch/apple2/encoder.cc @@ -36,7 +36,7 @@ private: const Apple2EncoderProto& _config; public: - std::unique_ptr encode(std::shared_ptr& layout, + std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { diff --git a/arch/brother/encoder.cc b/arch/brother/encoder.cc index aa0dd3b4..a01e0a56 100644 --- a/arch/brother/encoder.cc +++ b/arch/brother/encoder.cc @@ -108,7 +108,7 @@ public: public: std::unique_ptr encode( - std::shared_ptr& layout, + std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { diff --git a/arch/c64/encoder.cc b/arch/c64/encoder.cc index 82d02821..c7697e88 100644 --- a/arch/c64/encoder.cc +++ b/arch/c64/encoder.cc @@ -175,7 +175,7 @@ public: } public: - std::unique_ptr encode(std::shared_ptr& layout, + std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { @@ -198,7 +198,7 @@ public: else _formatByte1 = _formatByte2 = 0; - double clockRateUs = clockPeriodForC64Track(layout->logicalTrack); + double clockRateUs = clockPeriodForC64Track(trackInfo->logicalTrack); int bitsPerRevolution = 200000.0 / clockRateUs; std::vector bits(bitsPerRevolution); diff --git a/arch/ibm/encoder.cc b/arch/ibm/encoder.cc index 1b796838..f04cc5fd 100644 --- a/arch/ibm/encoder.cc +++ b/arch/ibm/encoder.cc @@ -107,15 +107,15 @@ private: } public: - std::unique_ptr encode(std::shared_ptr& layout, + std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { IbmEncoderProto::TrackdataProto trackdata; - getEncoderTrackData(trackdata, layout->logicalTrack, layout->logicalSide); + getEncoderTrackData(trackdata, trackInfo->logicalTrack, trackInfo->logicalSide); auto trackLayout = - Layout::getLayoutOfTrack(layout->logicalTrack, layout->logicalSide); + Layout::getLayoutOfTrack(trackInfo->logicalTrack, trackInfo->logicalSide); auto writeBytes = [&](const Bytes& bytes) { diff --git a/arch/macintosh/encoder.cc b/arch/macintosh/encoder.cc index f3519a83..cea0ef6d 100644 --- a/arch/macintosh/encoder.cc +++ b/arch/macintosh/encoder.cc @@ -220,11 +220,11 @@ public: } public: - std::unique_ptr encode(std::shared_ptr& layout, + std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { - double clockRateUs = clockRateUsForTrack(layout->logicalTrack); + double clockRateUs = clockRateUsForTrack(trackInfo->logicalTrack); int bitsPerRevolution = 200000.0 / clockRateUs; std::vector bits(bitsPerRevolution); unsigned cursor = 0; diff --git a/arch/micropolis/encoder.cc b/arch/micropolis/encoder.cc index 1b8b820c..186d06c4 100644 --- a/arch/micropolis/encoder.cc +++ b/arch/micropolis/encoder.cc @@ -77,7 +77,7 @@ public: { } - std::unique_ptr encode(std::shared_ptr& layout, + std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { diff --git a/arch/northstar/encoder.cc b/arch/northstar/encoder.cc index dbb9dfde..4b08a8f0 100644 --- a/arch/northstar/encoder.cc +++ b/arch/northstar/encoder.cc @@ -128,7 +128,7 @@ public: { } - std::unique_ptr encode(std::shared_ptr& layout, + std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { diff --git a/arch/tids990/encoder.cc b/arch/tids990/encoder.cc index 2e2226d6..a69c7cce 100644 --- a/arch/tids990/encoder.cc +++ b/arch/tids990/encoder.cc @@ -60,7 +60,7 @@ private: } public: - std::unique_ptr encode(std::shared_ptr& layout, + std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { diff --git a/arch/victor9k/encoder.cc b/arch/victor9k/encoder.cc index a5f91681..4bde505f 100644 --- a/arch/victor9k/encoder.cc +++ b/arch/victor9k/encoder.cc @@ -164,12 +164,12 @@ private: } public: - std::unique_ptr encode(std::shared_ptr& layout, + std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) override { Victor9kEncoderProto::TrackdataProto trackdata; - getTrackFormat(trackdata, layout->logicalTrack, layout->logicalSide); + getTrackFormat(trackdata, trackInfo->logicalTrack, trackInfo->logicalSide); unsigned bitsPerRevolution = (trackdata.rotational_period_ms() * 1e3) / trackdata.clock_period_us(); diff --git a/lib/decoders/decoders.cc b/lib/decoders/decoders.cc index db47103a..f4f1962a 100644 --- a/lib/decoders/decoders.cc +++ b/lib/decoders/decoders.cc @@ -61,18 +61,18 @@ std::unique_ptr Decoder::create(const DecoderProto& config) } std::shared_ptr Decoder::decodeToSectors( - std::shared_ptr fluxmap, std::shared_ptr& layout) + std::shared_ptr fluxmap, std::shared_ptr& trackInfo) { _trackdata = std::make_shared(); _trackdata->fluxmap = fluxmap; - _trackdata->layout = layout; + _trackdata->trackInfo = trackInfo; FluxmapReader fmr(*fluxmap); _fmr = &fmr; auto newSector = [&] { - _sector = std::make_shared(layout, 0); + _sector = std::make_shared(trackInfo, 0); _sector->status = Sector::MISSING; }; @@ -222,10 +222,10 @@ uint64_t Decoder::readRaw64() } std::set Decoder::requiredSectors( - std::shared_ptr& layout) const + std::shared_ptr& trackInfo) const { const auto trackLayout = - Layout::getLayoutOfTrackPhysical(layout->physicalTrack, layout->physicalSide); + Layout::getLayoutOfTrackPhysical(trackInfo->physicalTrack, trackInfo->physicalSide); std::set results; for (unsigned sectorId : trackLayout->logicalSectorOrder) diff --git a/lib/decoders/decoders.h b/lib/decoders/decoders.h index a50430d2..e2798e5c 100644 --- a/lib/decoders/decoders.h +++ b/lib/decoders/decoders.h @@ -51,7 +51,7 @@ public: public: std::shared_ptr decodeToSectors( std::shared_ptr fluxmap, - std::shared_ptr& location); + std::shared_ptr& trackInfo); void pushRecord( const Fluxmap::Position& start, const Fluxmap::Position& end); @@ -90,7 +90,7 @@ public: } virtual std::set requiredSectors( - std::shared_ptr& location) const; + std::shared_ptr& trackInfo) const; protected: virtual void beginTrack(){}; diff --git a/lib/encoders/encoders.cc b/lib/encoders/encoders.cc index 0584bd74..002f482a 100644 --- a/lib/encoders/encoders.cc +++ b/lib/encoders/encoders.cc @@ -57,9 +57,9 @@ nanoseconds_t Encoder::calculatePhysicalClockPeriod( } std::shared_ptr Encoder::getSector( - std::shared_ptr& layout, const Image& image, unsigned sectorId) + std::shared_ptr& trackInfo, const Image& image, unsigned sectorId) { - return image.get(layout->logicalTrack, layout->logicalSide, sectorId); + return image.get(trackInfo->logicalTrack, trackInfo->logicalSide, sectorId); } std::vector> Encoder::collectSectors( diff --git a/lib/encoders/encoders.h b/lib/encoders/encoders.h index 6e5d9b04..02292063 100644 --- a/lib/encoders/encoders.h +++ b/lib/encoders/encoders.h @@ -22,7 +22,7 @@ public: virtual std::vector> collectSectors( std::shared_ptr&, const Image& image); - virtual std::unique_ptr encode(std::shared_ptr& layout, + virtual std::unique_ptr encode(std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) = 0; diff --git a/lib/flux.h b/lib/flux.h index dafd664d..ad355154 100644 --- a/lib/flux.h +++ b/lib/flux.h @@ -18,7 +18,7 @@ struct Record struct TrackDataFlux { - std::shared_ptr layout; + std::shared_ptr trackInfo; std::shared_ptr fluxmap; std::vector> records; std::vector> sectors; @@ -26,7 +26,7 @@ struct TrackDataFlux struct TrackFlux { - std::shared_ptr layout; + std::shared_ptr trackInfo; std::vector> trackDatas; std::set> sectors; }; diff --git a/lib/fluxsource/memoryfluxsource.cc b/lib/fluxsource/memoryfluxsource.cc index e4d4848f..b7aa930f 100644 --- a/lib/fluxsource/memoryfluxsource.cc +++ b/lib/fluxsource/memoryfluxsource.cc @@ -57,7 +57,7 @@ public: { for (const auto& trackFlux : _flux.tracks) { - if ((trackFlux->layout->physicalTrack == physicalTrack) && (trackFlux->layout->physicalSide == physicalSide)) + if ((trackFlux->trackInfo->physicalTrack == physicalTrack) && (trackFlux->trackInfo->physicalSide == physicalSide)) return std::make_unique(*trackFlux); } diff --git a/lib/readerwriter.cc b/lib/readerwriter.cc index b751a598..298a0339 100644 --- a/lib/readerwriter.cc +++ b/lib/readerwriter.cc @@ -164,7 +164,7 @@ BadSectorsState combineRecordAndSectors(TrackFlux& trackFlux, track_sectors.insert( trackdataflux->sectors.begin(), trackdataflux->sectors.end()); - for (auto& logicalLocation : decoder.requiredSectors(trackFlux.layout)) + for (auto& logicalLocation : decoder.requiredSectors(trackFlux.trackInfo)) { auto sector = std::make_shared(logicalLocation); sector->status = Sector::MISSING; @@ -324,13 +324,13 @@ void writeTracksAndVerify(FluxSink& fluxSink, auto sectors = encoder.collectSectors(layout, image); return encoder.encode(layout, sectors, image); }, - [&](std::shared_ptr& layout) + [&](std::shared_ptr& trackInfo) { auto trackFlux = std::make_shared(); - trackFlux->layout = layout; + trackFlux->trackInfo = trackInfo; FluxSourceIteratorHolder fluxSourceIteratorHolder(fluxSource); auto result = readGroup( - fluxSourceIteratorHolder, layout, *trackFlux, decoder); + fluxSourceIteratorHolder, trackInfo, *trackFlux, decoder); Logger() << TrackReadLogMessage{trackFlux}; if (result != GOOD_READ) @@ -340,7 +340,7 @@ void writeTracksAndVerify(FluxSink& fluxSink, } Image wanted; - for (const auto& sector : encoder.collectSectors(layout, image)) + for (const auto& sector : encoder.collectSectors(trackInfo, image)) wanted .put(sector->logicalTrack, sector->logicalSide, @@ -423,7 +423,7 @@ std::shared_ptr readAndDecodeTrack(FluxSource& fluxSource, std::shared_ptr& layout) { auto trackFlux = std::make_shared(); - trackFlux->layout = layout; + trackFlux->trackInfo = layout; FluxSourceIteratorHolder fluxSourceIteratorHolder(fluxSource); int retriesRemaining = config.decoder().retries(); diff --git a/lib/vfs/fluxsectorinterface.cc b/lib/vfs/fluxsectorinterface.cc index 3e4ef294..43a46463 100644 --- a/lib/vfs/fluxsectorinterface.cc +++ b/lib/vfs/fluxsectorinterface.cc @@ -128,8 +128,8 @@ private: void populateSectors(unsigned track, unsigned side) { - auto layout = Layout::getLayoutOfTrack(track, side); - auto trackdata = readAndDecodeTrack(*_fluxSource, *_decoder, layout); + auto trackInfo = Layout::getLayoutOfTrack(track, side); + auto trackdata = readAndDecodeTrack(*_fluxSource, *_decoder, trackInfo); for (const auto& sector : trackdata->sectors) *_loadedSectors.put(track, side, sector->logicalSector) = *sector; diff --git a/src/gui/fluxviewercontrol.cc b/src/gui/fluxviewercontrol.cc index 047ad74b..9927ad18 100644 --- a/src/gui/fluxviewercontrol.cc +++ b/src/gui/fluxviewercontrol.cc @@ -286,7 +286,7 @@ void FluxViewerControl::OnPaint(wxPaintEvent&) text, {x + rp + BORDER, t2y - size.GetHeight() / 2}); if (_rightClicked && hovered) - ShowRecordMenu(trackdata->layout, record); + ShowRecordMenu(trackdata->trackInfo, record); } /* Flux chart. */ diff --git a/src/gui/fluxviewerwindow.cc b/src/gui/fluxviewerwindow.cc index b8a12648..18887881 100644 --- a/src/gui/fluxviewerwindow.cc +++ b/src/gui/fluxviewerwindow.cc @@ -15,8 +15,8 @@ FluxViewerWindow::FluxViewerWindow( fluxviewer->SetScrollbar(scrollbar); fluxviewer->SetFlux(flux); SetTitle(fmt::format("Flux for c{} h{}", - flux->layout->physicalTrack, - flux->layout->physicalSide)); + flux->trackInfo->physicalTrack, + flux->trackInfo->physicalSide)); } void FluxViewerWindow::OnExit(wxCommandEvent& event) diff --git a/src/gui/visualisationcontrol.cc b/src/gui/visualisationcontrol.cc index ac20dc53..ed7ffa0c 100644 --- a/src/gui/visualisationcontrol.cc +++ b/src/gui/visualisationcontrol.cc @@ -195,8 +195,8 @@ void VisualisationControl::OnPaint(wxPaintEvent&) std::string logicalText = "logical: (none)"; if (it != _tracks.end()) logicalText = fmt::format("logical: {}.{}", - it->second->layout->logicalTrack, - it->second->layout->logicalSide); + it->second->trackInfo->logicalTrack, + it->second->trackInfo->logicalSide); centreText(logicalText, h - 35); } @@ -272,7 +272,7 @@ void VisualisationControl::Clear() void VisualisationControl::SetTrackData(std::shared_ptr track) { - key_t key = {track->layout->physicalTrack, track->layout->physicalSide}; + key_t key = {track->trackInfo->physicalTrack, track->trackInfo->physicalSide}; _tracks[key] = track; _sectors.erase(key); for (auto& sector : track->sectors) @@ -286,7 +286,7 @@ void VisualisationControl::SetDiskData(std::shared_ptr disk) _sectors.clear(); for (const auto& track : disk->tracks) { - key_t key = {track->layout->physicalTrack, track->layout->physicalSide}; + key_t key = {track->trackInfo->physicalTrack, track->trackInfo->physicalSide}; _tracks[key] = track; }