mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-26 09:29:45 +00:00
Merge pull request #265 from TomHarte/Whitespace
Eliminates a large number of instance of end-of-line white space.
This commit is contained in:
commit
9fd33bdfde
@ -26,7 +26,7 @@ class PortHandler {
|
||||
public:
|
||||
/*!
|
||||
Requests the current input on an AY port.
|
||||
|
||||
|
||||
@param port_b @c true if the input being queried is Port B. @c false if it is Port A.
|
||||
*/
|
||||
virtual uint8_t get_port_input(bool port_b) {
|
||||
@ -35,7 +35,7 @@ class PortHandler {
|
||||
|
||||
/*!
|
||||
Requests the current input on an AY port.
|
||||
|
||||
|
||||
@param port_b @c true if the input being queried is Port B. @c false if it is Port A.
|
||||
*/
|
||||
virtual void set_port_output(bool port_b, uint8_t value) {}
|
||||
|
@ -20,7 +20,7 @@ namespace Inputs {
|
||||
class Joystick {
|
||||
public:
|
||||
virtual ~Joystick() {}
|
||||
|
||||
|
||||
enum class DigitalInput {
|
||||
Up, Down, Left, Right, Fire
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ namespace Inputs {
|
||||
class Keyboard {
|
||||
public:
|
||||
Keyboard();
|
||||
|
||||
|
||||
enum class Key {
|
||||
Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PrintScreen, ScrollLock, Pause,
|
||||
BackTick, k1, k2, k3, k4, k5, k6, k7, k8, k9, k0, Hyphen, Equals, BackSpace,
|
||||
@ -55,7 +55,7 @@ class Keyboard {
|
||||
std::vector<bool> key_states_;
|
||||
Delegate *delegate_ = nullptr;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif /* Keyboard_hpp */
|
||||
|
@ -36,7 +36,7 @@ class Machine: public ROMMachine::Machine {
|
||||
OpenGL context is bound.
|
||||
*/
|
||||
virtual void close_output() = 0;
|
||||
|
||||
|
||||
/// @returns The CRT this machine is drawing to. Should not be @c nullptr.
|
||||
virtual std::shared_ptr<Outputs::CRT::CRT> get_crt() = 0;
|
||||
|
||||
|
@ -27,7 +27,7 @@ class Machine: public MachineBase, public ROMMachine::Machine {
|
||||
C1541
|
||||
};
|
||||
Machine(Personality p);
|
||||
|
||||
|
||||
/*!
|
||||
Sets the source for this drive's ROM image.
|
||||
*/
|
||||
|
@ -60,7 +60,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
||||
BIND(Enter, KeyReturn);
|
||||
BIND(Space, KeySpace);
|
||||
BIND(BackSpace, KeyDelete);
|
||||
|
||||
|
||||
BIND(Escape, KeyRunStop);
|
||||
BIND(F1, KeyF1);
|
||||
BIND(F3, KeyF3);
|
||||
|
@ -237,7 +237,7 @@ class Joystick: public Inputs::Joystick {
|
||||
Joystick(UserPortVIA &user_port_via_port_handler, KeyboardVIA &keyboard_via_port_handler) :
|
||||
user_port_via_port_handler_(user_port_via_port_handler),
|
||||
keyboard_via_port_handler_(keyboard_via_port_handler) {}
|
||||
|
||||
|
||||
void set_digital_input(DigitalInput digital_input, bool is_active) override {
|
||||
JoystickInput mapped_input;
|
||||
switch (digital_input) {
|
||||
@ -444,7 +444,7 @@ class ConcreteMachine:
|
||||
write_to_map(processor_read_memory_map_, user_basic_memory_, 0x0000, sizeof(user_basic_memory_));
|
||||
write_to_map(processor_read_memory_map_, screen_memory_, 0x1000, sizeof(screen_memory_));
|
||||
write_to_map(processor_read_memory_map_, colour_memory_, 0x9400, sizeof(colour_memory_));
|
||||
|
||||
|
||||
write_to_map(processor_write_memory_map_, user_basic_memory_, 0x0000, sizeof(user_basic_memory_));
|
||||
write_to_map(processor_write_memory_map_, screen_memory_, 0x1000, sizeof(screen_memory_));
|
||||
write_to_map(processor_write_memory_map_, colour_memory_, 0x9400, sizeof(colour_memory_));
|
||||
|
@ -34,7 +34,7 @@ enum ROMSlot: uint8_t {
|
||||
|
||||
/*!
|
||||
@abstract Represents an Acorn Electron.
|
||||
|
||||
|
||||
@discussion An instance of Electron::Machine represents the current state of an
|
||||
Acorn Electron.
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ namespace KeyboardMachine {
|
||||
class Machine: public Inputs::Keyboard::Delegate {
|
||||
public:
|
||||
Machine();
|
||||
|
||||
|
||||
/*!
|
||||
Indicates that the key @c key has been either pressed or released, according to
|
||||
the state of @c isPressed.
|
||||
|
@ -21,7 +21,7 @@
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
/*!
|
||||
Initialises an instance of CSMachine.
|
||||
|
||||
|
||||
@param machine The pointer to an instance of @c CRTMachine::Machine* . C++ type is omitted because
|
||||
this header is visible to Swift, and the designated initialiser cannot be placed into a category.
|
||||
*/
|
||||
|
@ -249,7 +249,7 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg
|
||||
BIND(VK_ANSI_KeypadMultiply, KeyPadAsterisk); BIND(VK_ANSI_KeypadDivide, KeyPadSlash);
|
||||
BIND(VK_ANSI_KeypadPlus, KeyPadPlus); BIND(VK_ANSI_KeypadMinus, KeyPadMinus);
|
||||
BIND(VK_ANSI_KeypadClear, KeyPadDelete); BIND(VK_ANSI_KeypadEnter, KeyPadEnter);
|
||||
|
||||
|
||||
BIND(VK_Return, Enter); BIND(VK_Tab, Tab);
|
||||
BIND(VK_Space, Space); BIND(VK_Delete, BackSpace);
|
||||
BIND(VK_Control, LeftControl); BIND(VK_Option, LeftOption);
|
||||
|
@ -17,7 +17,7 @@
|
||||
/*
|
||||
* Summary:
|
||||
* Virtual keycodes
|
||||
*
|
||||
*
|
||||
* Discussion:
|
||||
* These constants are the virtual keycodes defined originally in
|
||||
* Inside Mac Volume V, pg. V-191. They identify physical keys on a
|
||||
|
@ -10,7 +10,7 @@ import XCTest
|
||||
import Foundation
|
||||
|
||||
class WolfgangLorenzTests: XCTestCase, CSTestMachineTrapHandler {
|
||||
|
||||
|
||||
func testWolfgangLorenzStart() {
|
||||
self.runWolfgangLorenzTest(" start")
|
||||
}
|
||||
|
@ -282,15 +282,15 @@ class Z80MemptrTests: XCTestCase {
|
||||
CPIR
|
||||
when BC=1 or A=(HL): exactly as CPI
|
||||
In other cases MEMPTR = PC + 1 on each step, where PC = instruction address.
|
||||
Note* since at the last execution BC=1 or A=(HL), resulting MEMPTR = PC + 1 + 1
|
||||
(if there were not interrupts during the execution)
|
||||
Note* since at the last execution BC=1 or A=(HL), resulting MEMPTR = PC + 1 + 1
|
||||
(if there were not interrupts during the execution)
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
CPDR
|
||||
when BC=1 or A=(HL): exactly as CPD
|
||||
In other cases MEMPTR = PC + 1 on each step, where PC = instruction address.
|
||||
Note* since at the last execution BC=1 or A=(HL), resulting MEMPTR = PC + 1 - 1
|
||||
Note* since at the last execution BC=1 or A=(HL), resulting MEMPTR = PC + 1 - 1
|
||||
(if there were not interrupts during the execution)
|
||||
*/
|
||||
|
||||
@ -307,13 +307,13 @@ class Z80MemptrTests: XCTestCase {
|
||||
/* TODO:
|
||||
INIR
|
||||
exactly as INI on each execution.
|
||||
I.e. resulting MEMPTR = ((1 << 8) + C) + 1
|
||||
I.e. resulting MEMPTR = ((1 << 8) + C) + 1
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
INDR
|
||||
exactly as IND on each execution.
|
||||
I.e. resulting MEMPTR = ((1 << 8) + C) - 1
|
||||
I.e. resulting MEMPTR = ((1 << 8) + C) - 1
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
@ -328,7 +328,7 @@ class Z80MemptrTests: XCTestCase {
|
||||
|
||||
/* TODO:
|
||||
OTIR
|
||||
exactly as OUTI on each execution. I.e. resulting MEMPTR = C + 1
|
||||
exactly as OUTI on each execution. I.e. resulting MEMPTR = C + 1
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
|
@ -87,7 +87,7 @@ bool KeyboardKeyForSDLScancode(SDL_Keycode scancode, Inputs::Keyboard::Key &key)
|
||||
BIND(TAB, Tab)
|
||||
BIND(LEFTBRACKET, OpenSquareBracket) BIND(RIGHTBRACKET, CloseSquareBracket)
|
||||
BIND(BACKSLASH, BackSlash)
|
||||
|
||||
|
||||
BIND(CAPSLOCK, CapsLock) BIND(SEMICOLON, Semicolon)
|
||||
BIND(APOSTROPHE, Quote) BIND(RETURN, Enter)
|
||||
|
||||
@ -193,7 +193,7 @@ int main(int argc, char *argv[]) {
|
||||
results.emplace_back(nullptr);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<std::vector<uint8_t>> data(new std::vector<uint8_t>);
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
@ -207,7 +207,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
return results;
|
||||
});
|
||||
|
||||
|
||||
if(!roms_loaded) {
|
||||
std::cerr << "Could not find system ROMs; please install to /usr/local/share/CLK/ or /usr/share/CLK/" << std::endl;
|
||||
return -1;
|
||||
@ -225,13 +225,13 @@ int main(int argc, char *argv[]) {
|
||||
// Create an audio pipe.
|
||||
SDL_AudioSpec desired_audio_spec;
|
||||
SDL_AudioSpec obtained_audio_spec;
|
||||
|
||||
|
||||
SDL_zero(desired_audio_spec);
|
||||
desired_audio_spec.freq = 48000; // TODO: how can I get SDL to reveal the output rate of this machine?
|
||||
desired_audio_spec.format = AUDIO_S16;
|
||||
desired_audio_spec.channels = 1;
|
||||
desired_audio_spec.samples = AudioBufferSize;
|
||||
|
||||
|
||||
speaker_delegate.audio_device = SDL_OpenAudioDevice(nullptr, 0, &desired_audio_spec, &obtained_audio_spec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE);
|
||||
|
||||
speaker->set_output_rate(obtained_audio_spec.freq, obtained_audio_spec.samples);
|
||||
|
@ -250,7 +250,7 @@ class CRT {
|
||||
/*! Tells the CRT that the next call to draw_frame will occur on a different OpenGL context than
|
||||
the previous.
|
||||
|
||||
@param should_delete_resources If @c true then all resources — textures, vertex arrays, etc —
|
||||
@param should_delete_resources If @c true then all resources — textures, vertex arrays, etc —
|
||||
currently held by the CRT will be deleted now via calls to glDeleteTexture and equivalent. If
|
||||
@c false then the references are simply marked as invalid.
|
||||
*/
|
||||
@ -263,7 +263,7 @@ class CRT {
|
||||
/*! Sets a function that will map from whatever data the machine provided to a composite signal.
|
||||
|
||||
@param shader A GLSL fragment including a function with the signature
|
||||
`float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)`
|
||||
`float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)`
|
||||
that evaluates to the composite signal level as a function of a source buffer, sampling location, colour
|
||||
carrier phase and amplitude.
|
||||
*/
|
||||
@ -299,7 +299,7 @@ class CRT {
|
||||
format will be applied.
|
||||
|
||||
@param shader A GLSL fragent including a function with the signature
|
||||
`vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)` that evaluates to an RGB colour
|
||||
`vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)` that evaluates to an RGB colour
|
||||
as a function of:
|
||||
|
||||
* `usampler2D sampler` representing the source buffer;
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
|
||||
/*!
|
||||
Performs an @c glUseProgram to make this the active shader unless:
|
||||
(i) it was the previous shader bound; and
|
||||
(i) it was the previous shader bound; and
|
||||
(ii) no calls have been received to unbind in the interim.
|
||||
|
||||
Subsequently performs all work queued up for the next bind irrespective of whether a @c glUseProgram call occurred.
|
||||
|
@ -33,17 +33,17 @@ namespace CRT {
|
||||
|
||||
(i) allocate a write area with allocate_write_area, supplying a maximum size.
|
||||
(ii) call reduce_previous_allocation_to to announce the actual size written.
|
||||
|
||||
|
||||
This will cause you to have added source data to the target texture. You can then either use that data
|
||||
or allow it to expire.
|
||||
|
||||
|
||||
(iii) call retain_latest to add the most recently written write area to the flush queue.
|
||||
|
||||
The flush queue contains provisional data, that can sit in the CPU's memory space indefinitely. This facility
|
||||
is provided because it is expected that a texture will be built alontside some other collection of data —
|
||||
that data in the flush queue is expected to become useful in coordination with something else but should
|
||||
be retained at least until then.
|
||||
|
||||
|
||||
(iv) call flush to move data to the submit queue.
|
||||
|
||||
When you flush, you'll receive a record of the bounds of all newly-flushed areas of source data. That gives
|
||||
|
@ -400,7 +400,7 @@ template < class T,
|
||||
int halfResult = (destinationValue&0xfff) - (sourceValue&0xfff) - (carry_result_ & Flag::Carry);
|
||||
|
||||
// subtraction, so parity rules are:
|
||||
// signs of operands were different,
|
||||
// signs of operands were different,
|
||||
// sign of result is different
|
||||
int overflow = (result ^ destinationValue) & (sourceValue ^ destinationValue);
|
||||
|
||||
|
@ -203,7 +203,7 @@ class ProcessorBase: public ProcessorStorage {
|
||||
|
||||
/*!
|
||||
Sets the logical value of the non-maskable interrupt line.
|
||||
|
||||
|
||||
@param offset See discussion in set_interrupt_line.
|
||||
*/
|
||||
inline void set_non_maskable_interrupt_line(bool value, int offset = 0);
|
||||
|
@ -71,8 +71,8 @@ void FIRFilter::coefficients_for_idealised_filter_response(short *filterCoeffici
|
||||
float I0 = ino(a);
|
||||
float NpSquared = static_cast<float>(Np * Np);
|
||||
for(unsigned int i = 0; i <= Np; i++) {
|
||||
filterCoefficientsFloat[Np + i] =
|
||||
A[i] *
|
||||
filterCoefficientsFloat[Np + i] =
|
||||
A[i] *
|
||||
ino(a * sqrtf(1.0f - (static_cast<float>(i * i) / NpSquared) )) /
|
||||
I0;
|
||||
}
|
||||
@ -81,7 +81,7 @@ void FIRFilter::coefficients_for_idealised_filter_response(short *filterCoeffici
|
||||
for(unsigned int i = 0; i < Np; i++) {
|
||||
filterCoefficientsFloat[i] = filterCoefficientsFloat[numberOfTaps - 1 - i];
|
||||
}
|
||||
|
||||
|
||||
/* scale back up so that we retain 100% of input volume */
|
||||
float coefficientTotal = 0.0f;
|
||||
for(unsigned int i = 0; i < numberOfTaps; i++) {
|
||||
@ -124,7 +124,7 @@ FIRFilter::FIRFilter(unsigned int number_of_taps, float input_sample_rate, float
|
||||
A[0] = 2.0f * (high_frequency - low_frequency) / input_sample_rate;
|
||||
for(unsigned int i = 1; i <= Np; i++) {
|
||||
float iPi = static_cast<float>(i) * static_cast<float>(M_PI);
|
||||
A[i] =
|
||||
A[i] =
|
||||
(
|
||||
sinf(twoOverSampleRate * iPi * high_frequency) -
|
||||
sinf(twoOverSampleRate * iPi * low_frequency)
|
||||
|
@ -37,7 +37,7 @@ class FIRFilter {
|
||||
public:
|
||||
/*!
|
||||
Creates an instance of @c FIRFilter.
|
||||
|
||||
|
||||
@param number_of_taps The size of window for input data.
|
||||
@param input_sample_rate The sampling rate of the input signal.
|
||||
@param low_frequency The lowest frequency of signal to retain in the output.
|
||||
@ -53,7 +53,7 @@ class FIRFilter {
|
||||
|
||||
/*!
|
||||
Applies the filter to one batch of input samples, returning the net result.
|
||||
|
||||
|
||||
@param src The source buffer to apply the filter to.
|
||||
@returns The result of applying the filter.
|
||||
*/
|
||||
|
@ -116,7 +116,7 @@ struct Target {
|
||||
|
||||
/*!
|
||||
Attempts, through any available means, to return a list of potential targets for the file with the given name.
|
||||
|
||||
|
||||
@returns The list of potential targets, sorted from most to least probable.
|
||||
*/
|
||||
std::list<Target> GetTargets(const char *file_name);
|
||||
|
@ -12,7 +12,7 @@ std::wstring Storage::Data::Commodore::petscii_from_bytes(const uint8_t *string,
|
||||
std::wstring result;
|
||||
|
||||
wchar_t unshifted_characters[256] = {
|
||||
L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\r', L'\0', L'\0',
|
||||
L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\r', L'\0', L'\0',
|
||||
L'\0', L'\0', L'\0', L'\0', L'\b', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0',
|
||||
L' ', L'!', L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', L',', L'-', L'.', L'/',
|
||||
L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9', L'"', L';', L'<', L'=', L'>', L'?',
|
||||
@ -31,7 +31,7 @@ std::wstring Storage::Data::Commodore::petscii_from_bytes(const uint8_t *string,
|
||||
};
|
||||
|
||||
wchar_t shifted_characters[256] = {
|
||||
L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\r', L'\0', L'\0',
|
||||
L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\r', L'\0', L'\0',
|
||||
L'\0', L'\0', L'\0', L'\0', L'\b', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0', L'\0',
|
||||
L' ', L'!', L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+', L',', L'-', L'.', L'/',
|
||||
L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9', L'"', L';', L'<', L'=', L'>', L'?',
|
||||
|
@ -63,7 +63,7 @@ CPCDSK::CPCDSK(const char *file_name) :
|
||||
// Track and side are stored, being a byte each.
|
||||
track->track = file.get8();
|
||||
track->side = file.get8();
|
||||
|
||||
|
||||
// If this is an extended disk image then John Elliott's extension provides some greater
|
||||
// data rate and encoding context. Otherwise the next two bytes have no defined meaning.
|
||||
if(is_extended_) {
|
||||
@ -83,7 +83,7 @@ CPCDSK::CPCDSK(const char *file_name) :
|
||||
track->data_encoding = Track::DataEncoding::Unknown;
|
||||
file.seek(2, SEEK_CUR);
|
||||
}
|
||||
|
||||
|
||||
// Sector size, number of sectors, gap 3 length and the filler byte are then common
|
||||
// between both variants of DSK.
|
||||
track->sector_length = file.get8();
|
||||
@ -204,7 +204,7 @@ std::shared_ptr<Track> CPCDSK::get_track_at_position(::Storage::Disk::Track::Add
|
||||
|
||||
// Return a nullptr if out of range or not provided.
|
||||
if(chronological_track >= tracks_.size()) return nullptr;
|
||||
|
||||
|
||||
Track *track = tracks_[chronological_track].get();
|
||||
if(!track) return nullptr;
|
||||
|
||||
@ -270,7 +270,7 @@ void CPCDSK::set_tracks(const std::map<::Storage::Disk::Track::Address, std::sha
|
||||
if(source_sector.second.is_deleted) sector.fdc_status2 |= 0x40;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Rewrite the entire disk image, in extended form.
|
||||
Storage::FileHolder output(file_name_, Storage::FileHolder::FileMode::Rewrite);
|
||||
output.write(reinterpret_cast<const uint8_t *>("EXTENDED CPC DSK File\r\nDisk-Info\r\n"), 34);
|
||||
@ -290,7 +290,7 @@ void CPCDSK::set_tracks(const std::map<::Storage::Disk::Track::Address, std::sha
|
||||
output.put8(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Calculate size of track.
|
||||
size_t track_size = 256;
|
||||
for(auto §or: track->sectors) {
|
||||
@ -303,7 +303,7 @@ void CPCDSK::set_tracks(const std::map<::Storage::Disk::Track::Address, std::sha
|
||||
track_size += (256 - (track_size & 255)) & 255;
|
||||
output.put8(static_cast<uint8_t>(track_size >> 8));
|
||||
}
|
||||
|
||||
|
||||
// Advance to offset 256.
|
||||
output.putn(static_cast<size_t>(256 - output.tell()), 0);
|
||||
|
||||
@ -363,7 +363,7 @@ void CPCDSK::set_tracks(const std::map<::Storage::Disk::Track::Address, std::sha
|
||||
}
|
||||
output.put16le(static_cast<uint16_t>(data_size));
|
||||
}
|
||||
|
||||
|
||||
// Move to next 256-byte boundary.
|
||||
long distance = (256 - output.tell()&255)&255;
|
||||
output.putn(static_cast<size_t>(distance), 0);
|
||||
|
@ -34,7 +34,7 @@ class PCMPatchedTrack: public Track {
|
||||
/*!
|
||||
Replaces whatever is currently on the track from @c start_position to @c start_position + segment length
|
||||
with the contents of @c segment.
|
||||
|
||||
|
||||
@param start_time The time at which this segment begins. Must be in the range [0, 1).
|
||||
@param segment The PCM segment to add.
|
||||
@param clamp_to_index_hole If @c true then the new segment will be truncated if it overruns the index hole;
|
||||
|
@ -31,7 +31,7 @@ FileHolder::FileHolder(const std::string &file_name, FileMode ideal_mode)
|
||||
case FileMode::Read:
|
||||
file_ = fopen(file_name.c_str(), "rb");
|
||||
break;
|
||||
|
||||
|
||||
case FileMode::Rewrite:
|
||||
file_ = fopen(file_name.c_str(), "w");
|
||||
break;
|
||||
|
@ -23,7 +23,7 @@ class FileHolder final {
|
||||
enum {
|
||||
ErrorCantOpen = -1
|
||||
};
|
||||
|
||||
|
||||
enum class FileMode {
|
||||
ReadWrite,
|
||||
Read,
|
||||
@ -168,7 +168,7 @@ class FileHolder final {
|
||||
return bit;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
Obtains a BitStream for reading from the file from the current reading cursor.
|
||||
*/
|
||||
@ -204,7 +204,7 @@ class FileHolder final {
|
||||
@returns the stat struct describing this file.
|
||||
*/
|
||||
struct stat &stats();
|
||||
|
||||
|
||||
/*!
|
||||
@returns a mutex owned by the file that can be used to serialise file access.
|
||||
*/
|
||||
|
@ -221,7 +221,7 @@ uint8_t Parser::get_next_byte(const std::shared_ptr<Storage::Tape::Tape> &tape)
|
||||
}
|
||||
|
||||
/*!
|
||||
Reads the next nine symbols and applies a binary test to each to differentiate between ::One and not-::One.
|
||||
Reads the next nine symbols and applies a binary test to each to differentiate between ::One and not-::One.
|
||||
Returns a byte composed of the first eight of those as bits; sets the error flag if any symbol is not
|
||||
::One and not ::Zero, or if the ninth bit is not equal to the odd parity of the other eight.
|
||||
*/
|
||||
@ -285,7 +285,7 @@ void Parser::process_pulse(const Storage::Tape::Tape::Pulse &pulse)
|
||||
}
|
||||
|
||||
/*!
|
||||
Per the contract with StaticAnalyser::TapeParser; produces any of a word marker, an end-of-block marker,
|
||||
Per the contract with StaticAnalyser::TapeParser; produces any of a word marker, an end-of-block marker,
|
||||
a zero, a one or a lead-in symbol based on the currently captured waves.
|
||||
*/
|
||||
void Parser::inspect_waves(const std::vector<WaveType> &waves)
|
||||
|
@ -110,7 +110,7 @@ class Parser: public Storage::Tape::PulseClassificationParser<WaveType, SymbolTy
|
||||
uint8_t get_next_byte(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||
|
||||
/*!
|
||||
Reads the next nine symbols and applies a binary test to each to differentiate between ::One and not-::One.
|
||||
Reads the next nine symbols and applies a binary test to each to differentiate between ::One and not-::One.
|
||||
Returns a byte composed of the first eight of those as bits; sets the error flag if any symbol is not
|
||||
::One and not ::Zero, or if the ninth bit is not equal to the odd parity of the other eight.
|
||||
*/
|
||||
@ -131,7 +131,7 @@ class Parser: public Storage::Tape::PulseClassificationParser<WaveType, SymbolTy
|
||||
float wave_period_;
|
||||
|
||||
/*!
|
||||
Per the contract with StaticAnalyser::TapeParser; produces any of a word marker, an end-of-block marker,
|
||||
Per the contract with StaticAnalyser::TapeParser; produces any of a word marker, an end-of-block marker,
|
||||
a zero, a one or a lead-in symbol based on the currently captured waves.
|
||||
*/
|
||||
void inspect_waves(const std::vector<WaveType> &waves);
|
||||
|
@ -105,7 +105,7 @@ template <typename WaveType, typename SymbolType> class PulseClassificationParse
|
||||
protected:
|
||||
/*!
|
||||
Sets @c symbol as the newly-recognised symbol and removes @c nunber_of_waves waves from the front of the list.
|
||||
|
||||
|
||||
Expected to be called by subclasses from @c process_pulse when it recognises that the first @c number_of_waves
|
||||
waves together represent @c symbol.
|
||||
*/
|
||||
@ -116,7 +116,7 @@ template <typename WaveType, typename SymbolType> class PulseClassificationParse
|
||||
|
||||
/*!
|
||||
Adds @c wave to the back of the list of recognised waves and calls @c inspect_waves to check for a new symbol.
|
||||
|
||||
|
||||
Expected to be called by subclasses from @c process_pulse as and when recognised waves arise.
|
||||
*/
|
||||
void push_wave(WaveType wave) {
|
||||
@ -126,7 +126,7 @@ template <typename WaveType, typename SymbolType> class PulseClassificationParse
|
||||
|
||||
/*!
|
||||
Removes @c nunber_of_waves waves from the front of the list.
|
||||
|
||||
|
||||
Expected to be called by subclasses from @c process_pulse if it is recognised that the first set of waves
|
||||
do not form a valid symbol.
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ namespace Tape {
|
||||
|
||||
If is-at-end is set then get_next_pulse() returns a second of silence and
|
||||
is_at_end() returns true.
|
||||
|
||||
|
||||
Otherwise get_next_pulse() returns something from the pulse queue if there is
|
||||
anything there, and otherwise calls get_next_pulses(). get_next_pulses() is
|
||||
virtual, giving subclasses a chance to provide the next batch of pulses.
|
||||
|
@ -25,7 +25,7 @@ namespace Tape {
|
||||
- high pulses exit from zero upward before returning to it;
|
||||
- low pulses exit from zero downward before returning to it;
|
||||
- zero pulses run along zero.
|
||||
|
||||
|
||||
Subclasses should implement at least @c get_next_pulse and @c reset to provide a serial feeding
|
||||
of pulses and the ability to return to the start of the feed. They may also implement @c seek if
|
||||
a better implementation than a linear search from the @c reset time can be implemented.
|
||||
|
@ -88,7 +88,7 @@ void TimedEventLoop::set_next_event_time_interval(Time interval) {
|
||||
}
|
||||
|
||||
Time TimedEventLoop::get_time_into_next_event() {
|
||||
// TODO: calculate, presumably as [length of interval] - ([cycles left] + [subcycles left])
|
||||
// TODO: calculate, presumably as [length of interval] - ([cycles left] + [subcycles left])
|
||||
Time zero;
|
||||
return zero;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user