mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Remove reader flags.
This commit is contained in:
@@ -42,5 +42,16 @@ message DecoderProto {
|
||||
Victor9kDecoderProto victor9k = 17;
|
||||
ZilogMczDecoderProto zilogmcz = 18;
|
||||
}
|
||||
|
||||
optional string copy_flux_to = 19
|
||||
[(help) = "while decoding, write a copy of the flux to this file"];
|
||||
optional bool dump_records = 20 [default = false,
|
||||
(help) = "if set, then dump the parsed but undecoded disk records"];
|
||||
optional bool dump_sectors = 21 [default = false,
|
||||
(help) = "if set, then dump the decoded sectors to this file"];
|
||||
optional int32 retries = 22 [default = 5,
|
||||
(help) = "how many times to retry each track in the event of a read failure"];
|
||||
optional string write_csv_to = 23
|
||||
[(help) = "if set, write a CSV report of the disk state"];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,38 +17,10 @@
|
||||
#include "imagewriter/imagewriter.h"
|
||||
#include "fmt/format.h"
|
||||
#include "proto.h"
|
||||
#include "lib/decoders/decoders.pb.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
FlagGroup readerFlags;
|
||||
|
||||
static StringFlag destination(
|
||||
{ "--write-flux", "-f" },
|
||||
"write the raw magnetic flux to this file",
|
||||
"");
|
||||
|
||||
static SettableFlag justRead(
|
||||
{ "--just-read" },
|
||||
"just read the disk and do no further processing");
|
||||
|
||||
static SettableFlag dumpRecords(
|
||||
{ "--dump-records" },
|
||||
"Dump the parsed but undecoded records.");
|
||||
|
||||
static SettableFlag dumpSectors(
|
||||
{ "--dump-sectors" },
|
||||
"Dump the decoded sectors.");
|
||||
|
||||
static IntFlag retries(
|
||||
{ "--retries" },
|
||||
"How many times to retry each track in the event of a read failure.",
|
||||
5);
|
||||
|
||||
static StringFlag csvFile(
|
||||
{ "--write-csv" },
|
||||
"write a CSV report of the disk state",
|
||||
"");
|
||||
|
||||
static std::unique_ptr<FluxSink> outputFluxSink;
|
||||
|
||||
void Track::readFluxmap()
|
||||
@@ -137,7 +109,7 @@ void readDiskCommand(FluxSource& fluxsource, AbstractDecoder& decoder, ImageWrit
|
||||
track->fluxsource = &fluxsource;
|
||||
|
||||
std::map<int, std::unique_ptr<Sector>> readSectors;
|
||||
for (int retry = ::retries; retry >= 0; retry--)
|
||||
for (int retry = config.decoder().retries(); retry >= 0; retry--)
|
||||
{
|
||||
track->readFluxmap();
|
||||
decoder.decodeToSectors(*track);
|
||||
@@ -197,7 +169,7 @@ void readDiskCommand(FluxSource& fluxsource, AbstractDecoder& decoder, ImageWrit
|
||||
std::cout << retry << " retries remaining" << std::endl;
|
||||
}
|
||||
|
||||
if (dumpRecords)
|
||||
if (config.decoder().dump_records())
|
||||
{
|
||||
std::cout << "\nRaw (undecoded) records follow:\n\n";
|
||||
for (auto& record : track->rawrecords)
|
||||
@@ -209,7 +181,7 @@ void readDiskCommand(FluxSource& fluxsource, AbstractDecoder& decoder, ImageWrit
|
||||
}
|
||||
}
|
||||
|
||||
if (dumpSectors)
|
||||
if (config.decoder().dump_sectors())
|
||||
{
|
||||
std::cout << "\nDecoded sectors follow:\n\n";
|
||||
for (auto& sector : track->sectors)
|
||||
@@ -247,8 +219,8 @@ void readDiskCommand(FluxSource& fluxsource, AbstractDecoder& decoder, ImageWrit
|
||||
}
|
||||
|
||||
writer.printMap(allSectors);
|
||||
if (!csvFile.get().empty())
|
||||
writer.writeCsv(allSectors, csvFile.get());
|
||||
if (!config.decoder().has_write_csv_to())
|
||||
writer.writeCsv(allSectors, config.decoder().write_csv_to());
|
||||
writer.writeImage(allSectors);
|
||||
|
||||
if (failures)
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
#ifndef READER_H
|
||||
#define READER_H
|
||||
|
||||
#include "flags.h"
|
||||
|
||||
class AbstractDecoder;
|
||||
class FluxSource;
|
||||
class Fluxmap;
|
||||
class ImageWriter;
|
||||
class Track;
|
||||
|
||||
extern FlagGroup readerFlags;
|
||||
|
||||
extern void setReaderDefaultSource(const std::string& source);
|
||||
extern void setReaderDefaultOutput(const std::string& output);
|
||||
extern void setReaderRevolutions(int revolutions);
|
||||
extern void setReaderHardSectorCount(int sectorCount);
|
||||
|
||||
extern std::vector<std::unique_ptr<Track>> readTracks();
|
||||
|
||||
extern void readDiskCommand(FluxSource& source, AbstractDecoder& decoder, ImageWriter& writer);
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#include "lib/config.pb.h"
|
||||
#include "proto.h"
|
||||
|
||||
FlagGroup writerFlags;
|
||||
|
||||
static sqlite3* outdb;
|
||||
|
||||
void writeTracks(
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
#ifndef WRITER_H
|
||||
#define WRITER_H
|
||||
|
||||
#include "flags.h"
|
||||
|
||||
extern FlagGroup writerFlags;
|
||||
|
||||
class Fluxmap;
|
||||
class AbstractEncoder;
|
||||
class Geometry;
|
||||
class ImageReader;
|
||||
class FluxSink;
|
||||
|
||||
extern void setWriterDefaultDest(const std::string& dest);
|
||||
extern void setWriterDefaultInput(const std::string& input);
|
||||
extern void setWriterHardSectorCount(int sectorCount);
|
||||
|
||||
extern void writeTracks(FluxSink& fluxSink, const std::function<std::unique_ptr<Fluxmap>(int track, int side)> producer);
|
||||
|
||||
extern void fillBitmapTo(std::vector<bool>& bitmap,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "fluxmap.h"
|
||||
#include "writer.h"
|
||||
|
||||
static FlagGroup flags { &writerFlags };
|
||||
static FlagGroup flags;
|
||||
|
||||
int mainErase(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "track.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
static FlagGroup flags { &readerFlags };
|
||||
static FlagGroup flags;
|
||||
|
||||
static SettableFlag dumpFluxFlag(
|
||||
{ "--dump-flux", "-F" },
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include <fstream>
|
||||
|
||||
static FlagGroup flags { &readerFlags };
|
||||
static FlagGroup flags;
|
||||
|
||||
extern const std::map<std::string, std::string> readables;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include <fstream>
|
||||
|
||||
static FlagGroup flags { &writerFlags };
|
||||
static FlagGroup flags;
|
||||
|
||||
extern const std::map<std::string, std::string> writables;
|
||||
|
||||
@@ -28,10 +28,6 @@ int mainWrite(int argc, const char* argv[])
|
||||
if (!config.has_input() || !config.has_output())
|
||||
Error() << "incomplete config (did you remember to specify the format?)";
|
||||
|
||||
std::string s;
|
||||
google::protobuf::TextFormat::PrintToString(config, &s);
|
||||
std::cout << s << '\n';
|
||||
|
||||
std::unique_ptr<ImageReader> reader(ImageReader::create(config.input().file()));
|
||||
std::unique_ptr<AbstractEncoder> encoder(AbstractEncoder::create(config.encoder()));
|
||||
std::unique_ptr<FluxSink> fluxSink(FluxSink::create(config.output().disk()));
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
#include <fstream>
|
||||
#include <ctype.h>
|
||||
|
||||
static FlagGroup flags { &writerFlags };
|
||||
static FlagGroup flags;
|
||||
|
||||
int mainWriteFlux(int argc, const char* argv[])
|
||||
{
|
||||
Error() << "TODO";
|
||||
#if 0
|
||||
setReaderDefaultSource(":t=0-81:h=0-1");
|
||||
setWriterDefaultDest(":t=0-81:s=0-1");
|
||||
|
||||
Reference in New Issue
Block a user