From cb015c83e115330dcec3f9a3cd905a67ab02d2a7 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 10 Nov 2017 19:14:19 -0500 Subject: [PATCH] Eliminated C99-style struct initialisations. --- Components/6532/6532.hpp | 25 +++++++++++-------------- Machines/Electron/Tape.hpp | 10 +++++----- Outputs/CRT/CRTTypes.hpp | 2 +- Storage/Tape/Parsers/Oric.cpp | 28 ++++++++++++++-------------- 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/Components/6532/6532.hpp b/Components/6532/6532.hpp index a2477c321..40b03a75b 100644 --- a/Components/6532/6532.hpp +++ b/Components/6532/6532.hpp @@ -121,12 +121,9 @@ template class MOS6532 { } } - MOS6532() : - interrupt_status_(0), - port_{{.output_mask = 0, .output = 0}, {.output_mask = 0, .output = 0}}, - a7_interrupt_({.last_port_value = 0, .enabled = false}), - interrupt_line_(false), - timer_{.value = static_cast((rand() & 0xff) << 10), .activeShift = 10, .writtenShift = 10, .interrupt_enabled = false} {} + MOS6532() { + timer_.value = static_cast((rand() & 0xff) << 10); + } inline void set_port_did_change(int port) { if(!port) { @@ -154,26 +151,26 @@ template class MOS6532 { struct { unsigned int value; - unsigned int activeShift, writtenShift; - bool interrupt_enabled; + unsigned int activeShift = 10, writtenShift = 10; + bool interrupt_enabled = false; } timer_; struct { - bool enabled; - bool active_on_positive; - uint8_t last_port_value; + bool enabled = false; + bool active_on_positive = false; + uint8_t last_port_value = 0; } a7_interrupt_; struct { - uint8_t output_mask, output; + uint8_t output_mask = 0, output = 0; } port_[2]; - uint8_t interrupt_status_; + uint8_t interrupt_status_ = 0; enum InterruptFlag: uint8_t { Timer = 0x80, PA7 = 0x40 }; - bool interrupt_line_; + bool interrupt_line_ = false; // expected to be overridden uint8_t get_port_input(int port) { return 0xff; } diff --git a/Machines/Electron/Tape.hpp b/Machines/Electron/Tape.hpp index 8456805da..93dad713b 100644 --- a/Machines/Electron/Tape.hpp +++ b/Machines/Electron/Tape.hpp @@ -52,12 +52,12 @@ class Tape: inline void get_next_tape_pulse(); struct { - int minimum_bits_until_full; - } input_ = {0}; + int minimum_bits_until_full = 0; + } input_; struct { - unsigned int cycles_into_pulse; - unsigned int bits_remaining_until_empty; - } output_ = {.bits_remaining_until_empty = 0, .cycles_into_pulse = 0}; + unsigned int cycles_into_pulse = 0; + unsigned int bits_remaining_until_empty = 0; + } output_; bool is_running_ = false; bool is_enabled_ = false; diff --git a/Outputs/CRT/CRTTypes.hpp b/Outputs/CRT/CRTTypes.hpp index 842c2f9f3..f983ed35b 100644 --- a/Outputs/CRT/CRTTypes.hpp +++ b/Outputs/CRT/CRTTypes.hpp @@ -23,7 +23,7 @@ struct Rect { Rect() {} Rect(float x, float y, float width, float height) : - origin({.x = x, .y = y}), size({.width = width, .height = height}) {} + origin({x, y}), size({width, height}) {} }; enum DisplayType { diff --git a/Storage/Tape/Parsers/Oric.cpp b/Storage/Tape/Parsers/Oric.cpp index ec448c624..65e3c49bc 100644 --- a/Storage/Tape/Parsers/Oric.cpp +++ b/Storage/Tape/Parsers/Oric.cpp @@ -125,23 +125,23 @@ void Parser::inspect_waves(const std::vector &waves) // Sync is 0x16, either encoded fast or slow; i.e. 0 0110 1000 1 Pattern slow_sync[] = { - {.type = WaveType::Long, 8}, - {.type = WaveType::Short, 16}, - {.type = WaveType::Long, 4}, - {.type = WaveType::Short, 8}, - {.type = WaveType::Long, 12}, - {.type = WaveType::Short, 8}, - {.type = WaveType::Unrecognised} + {WaveType::Long, 8}, + {WaveType::Short, 16}, + {WaveType::Long, 4}, + {WaveType::Short, 8}, + {WaveType::Long, 12}, + {WaveType::Short, 8}, + {WaveType::Unrecognised} }; Pattern fast_sync[] = { - {.type = WaveType::Medium, 2}, - {.type = WaveType::Short, 2}, - {.type = WaveType::Medium, 1}, - {.type = WaveType::Short, 1}, - {.type = WaveType::Medium, 3}, - {.type = WaveType::Short, 1}, - {.type = WaveType::Unrecognised} + {WaveType::Medium, 2}, + {WaveType::Short, 2}, + {WaveType::Medium, 1}, + {WaveType::Short, 1}, + {WaveType::Medium, 3}, + {WaveType::Short, 1}, + {WaveType::Unrecognised} }; size_t slow_sync_matching_depth = pattern_matching_depth(waves, slow_sync);