Boilerplate rearrangement to move all the brother stuff into a directory of its

own. Prepare for writing.
This commit is contained in:
David Given
2018-12-23 21:24:48 +01:00
parent d60dc37bb8
commit 3e60d37c44
6 changed files with 36 additions and 11 deletions

21
lib/brother/brother.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef BROTHER_H
#define BROTHER_H
/* Brother word processor format (or at least, one of them) */
#define BROTHER_SECTOR_RECORD 0xFFFFFD57
#define BROTHER_DATA_RECORD 0xFFFFFDDB
#define BROTHER_DATA_RECORD_PAYLOAD 256
class Sector;
class Fluxmap;
extern std::vector<std::vector<uint8_t>> decodeBitsToRecordsBrother(const std::vector<bool>& bitmap);
extern std::vector<std::unique_ptr<Sector>> parseRecordsToSectorsBrother(const std::vector<std::vector<uint8_t>>& records);
extern std::vector<bool> encodeRecordsToBits(const std::vector<std::vector<uint8_t>>& records);
extern std::vector<std::vector<std::unique_ptr<uint8_t>>> unparseSectorsToRecordsBrother(const std::vector<std::unique_ptr<Sector>>& sectors);
#endif

View File

@@ -2,6 +2,7 @@
#include "sql.h"
#include "fluxmap.h"
#include "decoders.h"
#include "brother.h"
#include <ctype.h>
static std::vector<uint8_t> outputbuffer;

View File

@@ -1,6 +1,7 @@
#include "globals.h"
#include "decoders.h"
#include "image.h"
#include "brother.h"
#include "crc.h"
#include <string.h>

View File

@@ -23,21 +23,13 @@ struct IbmIdam
uint8_t crc[2];
};
/* Brother word processor format (or at least, one of them) */
#define BROTHER_SECTOR_RECORD 0xFFFFFD57
#define BROTHER_DATA_RECORD 0xFFFFFDDB
#define BROTHER_DATA_RECORD_PAYLOAD 256
class Sector;
class Fluxmap;
extern std::vector<bool> decodeFluxmapToBits(const Fluxmap& fluxmap, nanoseconds_t clock_period);
extern std::vector<std::vector<uint8_t>> decodeBitsToRecordsMfm(const std::vector<bool>& bitmap);
extern std::vector<std::vector<uint8_t>> decodeBitsToRecordsBrother(const std::vector<bool>& bitmap);
extern std::vector<std::unique_ptr<Sector>> parseRecordsToSectorsIbm(const std::vector<std::vector<uint8_t>>& records);
extern std::vector<std::unique_ptr<Sector>> parseRecordsToSectorsBrother(const std::vector<std::vector<uint8_t>>& records);
#endif

View File

@@ -55,18 +55,27 @@ decoderlib = shared_library('decoderlib',
'lib/decoders/decoders.cc',
'lib/decoders/mfmdecoder.cc',
'lib/decoders/ibmparser.cc',
'lib/brother/decoder.cc',
'lib/brother/parser.cc',
],
include_directories: [feinc, fmtinc],
link_with: [felib, fmtlib]
)
decoderinc = include_directories('lib/decoders')
brotherlib = shared_library('brotherlib',
[
'lib/brother/decoder.cc',
'lib/brother/parser.cc',
],
include_directories: [feinc, fmtinc, decoderinc],
link_with: [felib, fmtlib, decoderlib]
)
brotherinc = include_directories('lib/brother')
executable('fe-rpm', ['src/fe-rpm.cc'], include_directories: [feinc], link_with: [felib])
executable('fe-seek', ['src/fe-seek.cc'], include_directories: [feinc], link_with: [felib])
executable('fe-testbulktransport', ['src/fe-testbulktransport.cc'], include_directories: [feinc], link_with: [felib])
executable('fe-readibm', ['src/fe-readibm.cc'], include_directories: [feinc, fmtinc, decoderinc], link_with: [felib, readerlib, decoderlib, fmtlib])
executable('fe-readbrother', ['src/fe-readbrother.cc'], include_directories: [feinc, fmtinc, decoderinc], link_with: [felib, readerlib, decoderlib, fmtlib])
executable('fe-readbrother', ['src/fe-readbrother.cc'], include_directories: [feinc, fmtinc, decoderinc, brotherinc], link_with: [felib, readerlib, decoderlib, brotherlib, fmtlib])
executable('fe-writebrother', ['src/fe-writebrother.cc'], include_directories: [feinc, fmtinc, decoderinc, brotherinc], link_with: [felib, readerlib, decoderlib, brotherlib, fmtlib])
executable('fe-inspect', ['src/fe-inspect.cc'], include_directories: [feinc, fmtinc, decoderinc], link_with: [felib, readerlib, decoderlib, fmtlib])

View File

@@ -3,6 +3,7 @@
#include "reader.h"
#include "fluxmap.h"
#include "decoders.h"
#include "brother.h"
#include "image.h"
#include <fmt/format.h>
#include <fstream>