diff --git a/Activity/Observer.hpp b/Activity/Observer.hpp index 9ac8ae4df..9ed8f4583 100644 --- a/Activity/Observer.hpp +++ b/Activity/Observer.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef ActivityObserver_h -#define ActivityObserver_h +#pragma once #include #include @@ -58,5 +57,3 @@ class Observer { }; } - -#endif /* ActivityObserver_h */ diff --git a/Activity/Source.hpp b/Activity/Source.hpp index 853c99210..6f540cf33 100644 --- a/Activity/Source.hpp +++ b/Activity/Source.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef ActivitySource_h -#define ActivitySource_h +#pragma once #include "Observer.hpp" @@ -19,6 +18,3 @@ class Source { }; } - - -#endif /* ActivitySource_h */ diff --git a/Analyser/Dynamic/ConfidenceCounter.hpp b/Analyser/Dynamic/ConfidenceCounter.hpp index a625a9d55..8b8e80ea2 100644 --- a/Analyser/Dynamic/ConfidenceCounter.hpp +++ b/Analyser/Dynamic/ConfidenceCounter.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef ConfidenceCounter_hpp -#define ConfidenceCounter_hpp +#pragma once #include "ConfidenceSource.hpp" @@ -41,5 +40,3 @@ class ConfidenceCounter: public ConfidenceSource { }; } - -#endif /* ConfidenceCounter_hpp */ diff --git a/Analyser/Dynamic/ConfidenceSource.hpp b/Analyser/Dynamic/ConfidenceSource.hpp index fb2dd3518..708627f66 100644 --- a/Analyser/Dynamic/ConfidenceSource.hpp +++ b/Analyser/Dynamic/ConfidenceSource.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef ConfidenceSource_hpp -#define ConfidenceSource_hpp +#pragma once namespace Analyser::Dynamic { @@ -22,5 +21,3 @@ struct ConfidenceSource { }; } - -#endif /* ConfidenceSource_hpp */ diff --git a/Analyser/Dynamic/ConfidenceSummary.hpp b/Analyser/Dynamic/ConfidenceSummary.hpp index e49ad921d..880a9e8ea 100644 --- a/Analyser/Dynamic/ConfidenceSummary.hpp +++ b/Analyser/Dynamic/ConfidenceSummary.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef ConfidenceSummary_hpp -#define ConfidenceSummary_hpp +#pragma once #include "ConfidenceSource.hpp" @@ -40,5 +39,3 @@ class ConfidenceSummary: public ConfidenceSource { }; } - -#endif /* ConfidenceSummary_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp index 82838db84..c18e039f0 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef MultiConfigurable_hpp -#define MultiConfigurable_hpp +#pragma once #include "../../../../Machines/DynamicMachine.hpp" #include "../../../../Configurable/Configurable.hpp" @@ -36,5 +35,3 @@ class MultiConfigurable: public Configurable::Device { }; } - -#endif /* MultiConfigurable_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp index dfe12c8a4..85fe40091 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef MultiJoystickMachine_hpp -#define MultiJoystickMachine_hpp +#pragma once #include "../../../../Machines/DynamicMachine.hpp" @@ -34,5 +33,3 @@ class MultiJoystickMachine: public MachineTypes::JoystickMachine { }; } - -#endif /* MultiJoystickMachine_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp index c0bee0596..2bda83513 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef MultiKeyboardMachine_hpp -#define MultiKeyboardMachine_hpp +#pragma once #include "../../../../Machines/DynamicMachine.hpp" #include "../../../../Machines/KeyboardMachine.hpp" @@ -55,5 +54,3 @@ class MultiKeyboardMachine: public MachineTypes::KeyboardMachine { }; } - -#endif /* MultiKeyboardMachine_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiMediaTarget.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiMediaTarget.hpp index 0ec4ad1cf..09a1f39d6 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiMediaTarget.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiMediaTarget.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef MultiMediaTarget_hpp -#define MultiMediaTarget_hpp +#pragma once #include "../../../../Machines/MediaTarget.hpp" #include "../../../../Machines/DynamicMachine.hpp" @@ -35,5 +34,3 @@ struct MultiMediaTarget: public MachineTypes::MediaTarget { }; } - -#endif /* MultiMediaTarget_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiProducer.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiProducer.hpp index 3a850f709..35e153a84 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiProducer.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiProducer.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef MultiProducer_hpp -#define MultiProducer_hpp +#pragma once #include "../../../../Concurrency/AsyncTaskQueue.hpp" #include "../../../../Machines/MachineTypes.hpp" @@ -115,5 +114,3 @@ class MultiAudioProducer: public MultiInterface, pu */ } - -#endif /* MultiProducer_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp index def9feaba..0a1990157 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef MultiSpeaker_hpp -#define MultiSpeaker_hpp +#pragma once #include "../../../../Machines/DynamicMachine.hpp" #include "../../../../Outputs/Speaker/Speaker.hpp" @@ -55,5 +54,3 @@ class MultiSpeaker: public Outputs::Speaker::Speaker, Outputs::Speaker::Speaker: }; } - -#endif /* MultiSpeaker_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp index a31c2f119..2b42b4f97 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef MultiMachine_hpp -#define MultiMachine_hpp +#pragma once #include "../../../Machines/DynamicMachine.hpp" @@ -80,5 +79,3 @@ class MultiMachine: public ::Machine::DynamicMachine, public MultiTimedMachine:: }; } - -#endif /* MultiMachine_hpp */ diff --git a/Analyser/Machines.hpp b/Analyser/Machines.hpp index 0e801325f..280994c17 100644 --- a/Analyser/Machines.hpp +++ b/Analyser/Machines.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Machines_h -#define Machines_h +#pragma once namespace Analyser { @@ -32,5 +31,3 @@ enum class Machine { }; } - -#endif /* Machines_h */ diff --git a/Analyser/Static/Acorn/Disk.hpp b/Analyser/Static/Acorn/Disk.hpp index 87b11951c..f77a0fe47 100644 --- a/Analyser/Static/Acorn/Disk.hpp +++ b/Analyser/Static/Acorn/Disk.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef StaticAnalyser_Acorn_Disk_hpp -#define StaticAnalyser_Acorn_Disk_hpp +#pragma once #include "File.hpp" #include "../../../Storage/Disk/Disk.hpp" @@ -30,5 +29,3 @@ std::unique_ptr GetDFSCatalogue(const std::shared_ptr GetADFSCatalogue(const std::shared_ptr &disk); } - -#endif /* Disk_hpp */ diff --git a/Analyser/Static/Acorn/File.hpp b/Analyser/Static/Acorn/File.hpp index f268af247..00fc5a7b0 100644 --- a/Analyser/Static/Acorn/File.hpp +++ b/Analyser/Static/Acorn/File.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef StaticAnalyser_Acorn_File_hpp -#define StaticAnalyser_Acorn_File_hpp +#pragma once #include #include @@ -59,5 +58,3 @@ struct File { }; } - -#endif /* File_hpp */ diff --git a/Analyser/Static/Acorn/StaticAnalyser.hpp b/Analyser/Static/Acorn/StaticAnalyser.hpp index 079178c96..35331b65f 100644 --- a/Analyser/Static/Acorn/StaticAnalyser.hpp +++ b/Analyser/Static/Acorn/StaticAnalyser.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef StaticAnalyser_Acorn_StaticAnalyser_hpp -#define StaticAnalyser_Acorn_StaticAnalyser_hpp +#pragma once #include "../StaticAnalyser.hpp" #include "../../../Storage/TargetPlatforms.hpp" @@ -18,5 +17,3 @@ namespace Analyser::Static::Acorn { TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } - -#endif /* AcornAnalyser_hpp */ diff --git a/Analyser/Static/Acorn/Tape.hpp b/Analyser/Static/Acorn/Tape.hpp index f01216910..d6978ba61 100644 --- a/Analyser/Static/Acorn/Tape.hpp +++ b/Analyser/Static/Acorn/Tape.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef StaticAnalyser_Acorn_Tape_hpp -#define StaticAnalyser_Acorn_Tape_hpp +#pragma once #include @@ -19,5 +18,3 @@ namespace Analyser::Static::Acorn { std::vector GetFiles(const std::shared_ptr &tape); } - -#endif /* Tape_hpp */ diff --git a/Analyser/Static/Acorn/Target.hpp b/Analyser/Static/Acorn/Target.hpp index bf7f8ffc9..47aea1ca9 100644 --- a/Analyser/Static/Acorn/Target.hpp +++ b/Analyser/Static/Acorn/Target.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_Acorn_Target_h -#define Analyser_Static_Acorn_Target_h +#pragma once #include "../../../Reflection/Struct.hpp" #include "../StaticAnalyser.hpp" @@ -36,5 +35,3 @@ struct Target: public ::Analyser::Static::Target, public Reflection::StructImpl< }; } - -#endif /* Analyser_Static_Acorn_Target_h */ diff --git a/Analyser/Static/Amiga/StaticAnalyser.hpp b/Analyser/Static/Amiga/StaticAnalyser.hpp index fe9dc6b56..4e6fa7501 100644 --- a/Analyser/Static/Amiga/StaticAnalyser.hpp +++ b/Analyser/Static/Amiga/StaticAnalyser.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_Amiga_StaticAnalyser_hpp -#define Analyser_Static_Amiga_StaticAnalyser_hpp +#pragma once #include "../StaticAnalyser.hpp" #include "../../../Storage/TargetPlatforms.hpp" @@ -18,5 +17,3 @@ namespace Analyser::Static::Amiga { TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } - -#endif /* Analyser_Static_Amiga_StaticAnalyser_hpp */ diff --git a/Analyser/Static/Amiga/Target.hpp b/Analyser/Static/Amiga/Target.hpp index 9ff9e99a3..f3bead884 100644 --- a/Analyser/Static/Amiga/Target.hpp +++ b/Analyser/Static/Amiga/Target.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_Amiga_Target_h -#define Analyser_Static_Amiga_Target_h +#pragma once #include "../../../Reflection/Struct.hpp" #include "../StaticAnalyser.hpp" @@ -40,5 +39,3 @@ struct Target: public Analyser::Static::Target, public Reflection::StructImpl GetFiles(const std::shared_ptr &disk); } - -#endif /* Disk_hpp */ diff --git a/Analyser/Static/Commodore/File.hpp b/Analyser/Static/Commodore/File.hpp index 01c85824b..e84b00d50 100644 --- a/Analyser/Static/Commodore/File.hpp +++ b/Analyser/Static/Commodore/File.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef File_hpp -#define File_hpp +#pragma once #include #include @@ -35,5 +34,3 @@ struct File { }; } - -#endif /* File_hpp */ diff --git a/Analyser/Static/Commodore/StaticAnalyser.hpp b/Analyser/Static/Commodore/StaticAnalyser.hpp index 548020ae5..ed4091c83 100644 --- a/Analyser/Static/Commodore/StaticAnalyser.hpp +++ b/Analyser/Static/Commodore/StaticAnalyser.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef StaticAnalyser_Commodore_StaticAnalyser_hpp -#define StaticAnalyser_Commodore_StaticAnalyser_hpp +#pragma once #include "../StaticAnalyser.hpp" #include "../../../Storage/TargetPlatforms.hpp" @@ -18,5 +17,3 @@ namespace Analyser::Static::Commodore { TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } - -#endif /* CommodoreAnalyser_hpp */ diff --git a/Analyser/Static/Commodore/Tape.hpp b/Analyser/Static/Commodore/Tape.hpp index 2531bb89c..278924bf6 100644 --- a/Analyser/Static/Commodore/Tape.hpp +++ b/Analyser/Static/Commodore/Tape.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef StaticAnalyser_Commodore_Tape_hpp -#define StaticAnalyser_Commodore_Tape_hpp +#pragma once #include "../../../Storage/Tape/Tape.hpp" #include "File.hpp" @@ -17,5 +16,3 @@ namespace Analyser::Static::Commodore { std::vector GetFiles(const std::shared_ptr &tape); } - -#endif /* Tape_hpp */ diff --git a/Analyser/Static/Commodore/Target.hpp b/Analyser/Static/Commodore/Target.hpp index 4752544c0..78d4fdbfe 100644 --- a/Analyser/Static/Commodore/Target.hpp +++ b/Analyser/Static/Commodore/Target.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_Commodore_Target_h -#define Analyser_Static_Commodore_Target_h +#pragma once #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -70,5 +69,3 @@ struct Target: public Analyser::Static::Target, public Reflection::StructImpl #include @@ -93,5 +92,3 @@ Disassembly Disassemble( std::vector entry_points); } - -#endif /* Disassembler6502_hpp */ diff --git a/Analyser/Static/Disassembler/AddressMapper.hpp b/Analyser/Static/Disassembler/AddressMapper.hpp index debc18600..c3ddb02b6 100644 --- a/Analyser/Static/Disassembler/AddressMapper.hpp +++ b/Analyser/Static/Disassembler/AddressMapper.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef AddressMapper_hpp -#define AddressMapper_hpp +#pragma once #include @@ -24,5 +23,3 @@ template std::function OffsetMapper(T start_address } } - -#endif /* AddressMapper_hpp */ diff --git a/Analyser/Static/Disassembler/Kernel.hpp b/Analyser/Static/Disassembler/Kernel.hpp index 8c5406179..c4166521a 100644 --- a/Analyser/Static/Disassembler/Kernel.hpp +++ b/Analyser/Static/Disassembler/Kernel.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Kernel_hpp -#define Kernel_hpp +#pragma once namespace Analyser::Static::Disassembly { @@ -65,5 +64,3 @@ template D Disassemble( } } - -#endif /* Kernel_hpp */ diff --git a/Analyser/Static/Disassembler/Z80.hpp b/Analyser/Static/Disassembler/Z80.hpp index bc8b9818e..69b1e6994 100644 --- a/Analyser/Static/Disassembler/Z80.hpp +++ b/Analyser/Static/Disassembler/Z80.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef StaticAnalyser_Disassembler_Z80_hpp -#define StaticAnalyser_Disassembler_Z80_hpp +#pragma once #include #include @@ -91,5 +90,3 @@ Disassembly Disassemble( Approach approach); } - -#endif /* StaticAnalyser_Disassembler_Z80_hpp */ diff --git a/Analyser/Static/DiskII/StaticAnalyser.hpp b/Analyser/Static/DiskII/StaticAnalyser.hpp index 87ebc413b..9f1da10d8 100644 --- a/Analyser/Static/DiskII/StaticAnalyser.hpp +++ b/Analyser/Static/DiskII/StaticAnalyser.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_DiskII_StaticAnalyser_hpp -#define Analyser_Static_DiskII_StaticAnalyser_hpp +#pragma once #include "../StaticAnalyser.hpp" #include "../../../Storage/TargetPlatforms.hpp" @@ -18,5 +17,3 @@ namespace Analyser::Static::DiskII { TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } - -#endif /* Analyser_Static_DiskII_StaticAnalyser_hpp */ diff --git a/Analyser/Static/Enterprise/StaticAnalyser.hpp b/Analyser/Static/Enterprise/StaticAnalyser.hpp index ef03fc17f..c88aa43c3 100644 --- a/Analyser/Static/Enterprise/StaticAnalyser.hpp +++ b/Analyser/Static/Enterprise/StaticAnalyser.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_Enterprise_StaticAnalyser_hpp -#define Analyser_Static_Enterprise_StaticAnalyser_hpp +#pragma once #include "../StaticAnalyser.hpp" #include "../../../Storage/TargetPlatforms.hpp" @@ -18,5 +17,3 @@ namespace Analyser::Static::Enterprise { TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } - -#endif /* Analyser_Static_Enterprise_StaticAnalyser_hpp */ diff --git a/Analyser/Static/Enterprise/Target.hpp b/Analyser/Static/Enterprise/Target.hpp index c1428ae73..b6238bf92 100644 --- a/Analyser/Static/Enterprise/Target.hpp +++ b/Analyser/Static/Enterprise/Target.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_Enterprise_Target_h -#define Analyser_Static_Enterprise_Target_h +#pragma once #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -49,5 +48,3 @@ struct Target: public Analyser::Static::Target, public Reflection::StructImpl GetFiles(const std::shared_ptr &tape); } - -#endif /* StaticAnalyser_MSX_Tape_hpp */ diff --git a/Analyser/Static/MSX/Target.hpp b/Analyser/Static/MSX/Target.hpp index e34386eec..a322ce83c 100644 --- a/Analyser/Static/MSX/Target.hpp +++ b/Analyser/Static/MSX/Target.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_MSX_Target_h -#define Analyser_Static_MSX_Target_h +#pragma once #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -47,5 +46,3 @@ struct Target: public ::Analyser::Static::Target, public Reflection::StructImpl< }; } - -#endif /* Analyser_Static_MSX_Target_h */ diff --git a/Analyser/Static/Macintosh/StaticAnalyser.hpp b/Analyser/Static/Macintosh/StaticAnalyser.hpp index e9b165c74..bf8924246 100644 --- a/Analyser/Static/Macintosh/StaticAnalyser.hpp +++ b/Analyser/Static/Macintosh/StaticAnalyser.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_Macintosh_StaticAnalyser_hpp -#define Analyser_Static_Macintosh_StaticAnalyser_hpp +#pragma once #include "../StaticAnalyser.hpp" #include "../../../Storage/TargetPlatforms.hpp" @@ -18,5 +17,3 @@ namespace Analyser::Static::Macintosh { TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } - -#endif /* Analyser_Static_Macintosh_StaticAnalyser_hpp */ diff --git a/Analyser/Static/Macintosh/Target.hpp b/Analyser/Static/Macintosh/Target.hpp index 6a46ca1e0..372d212bf 100644 --- a/Analyser/Static/Macintosh/Target.hpp +++ b/Analyser/Static/Macintosh/Target.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_Macintosh_Target_h -#define Analyser_Static_Macintosh_Target_h +#pragma once #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -29,5 +28,3 @@ struct Target: public Analyser::Static::Target, public Reflection::StructImpl GetFiles(const std::shared_ptr &tape); } - -#endif /* Tape_hpp */ diff --git a/Analyser/Static/Oric/Target.hpp b/Analyser/Static/Oric/Target.hpp index 4b43c4aff..28bfcc598 100644 --- a/Analyser/Static/Oric/Target.hpp +++ b/Analyser/Static/Oric/Target.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_Oric_Target_h -#define Analyser_Static_Oric_Target_h +#pragma once #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -55,5 +54,3 @@ struct Target: public Analyser::Static::Target, public Reflection::StructImpl inline constexpr bool always_false_v = false; using namespace Analyser::Static; +using namespace Storage; namespace { @@ -101,46 +102,90 @@ std::string get_extension(const std::string &name) { return extension; } +class MediaAccumulator { + public: + MediaAccumulator(const std::string &file_name, TargetPlatform::IntType &potential_platforms) : + file_name_(file_name), potential_platforms_(potential_platforms), extension_(get_extension(file_name)) {} + + /// Adds @c instance to the media collection and adds @c platforms to the set of potentials. + /// If @c instance is an @c TargetPlatform::TypeDistinguisher then it is given an opportunity to restrict the set of potentials. + template + void insert(TargetPlatform::IntType platforms, InstanceT *instance) { + if constexpr (std::is_base_of_v) { + media.disks.emplace_back(instance); + } else if constexpr (std::is_base_of_v) { + media.tapes.emplace_back(instance); + } else if constexpr (std::is_base_of_v) { + media.cartridges.emplace_back(instance); + } else if constexpr (std::is_base_of_v) { + media.mass_storage_devices.emplace_back(instance); + } else { + static_assert(always_false_v, "Unexpected type encountered."); + } + + potential_platforms_ |= platforms; + + // Check whether the instance itself has any input on target platforms. + TargetPlatform::TypeDistinguisher *const distinguisher = + dynamic_cast(instance); + if(distinguisher) potential_platforms_ &= distinguisher->target_platform_type(); + } + + /// Concstructs a new instance of @c InstanceT supplying @c args and adds it to the back of @c list using @c insert_instance. + template + void insert(TargetPlatform::IntType platforms, Args &&... args) { + insert(platforms, new InstanceT(std::forward(args)...)); + } + + /// Calls @c insert with the specified parameters, ignoring any exceptions thrown. + template + void try_insert(TargetPlatform::IntType platforms, Args &&... args) { + try { + insert(platforms, std::forward(args)...); + } catch(...) {} + } + + /// Performs a @c try_insert for an object of @c InstanceT if @c extension matches that of the file name, + /// providing the file name as the only construction argument. + template + void try_standard(TargetPlatform::IntType platforms, const char *extension) { + if(name_matches(extension)) { + try_insert(platforms, file_name_); + } + } + + bool name_matches(const char *extension) { + return extension_ == extension; + } + + Media media; + + private: + const std::string &file_name_; + TargetPlatform::IntType &potential_platforms_; + const std::string extension_; +}; + } static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform::IntType &potential_platforms) { - Media result; - const std::string extension = get_extension(file_name); - -#define InsertInstance(list, instance, platforms) \ - list.emplace_back(instance);\ - potential_platforms |= platforms;\ - TargetPlatform::TypeDistinguisher *const distinguisher = dynamic_cast(list.back().get());\ - if(distinguisher) potential_platforms &= distinguisher->target_platform_type(); - -#define Insert(list, class, platforms, ...) \ - InsertInstance(list, new Storage::class(__VA_ARGS__), platforms); - -#define TryInsert(list, class, platforms, ...) \ - try {\ - Insert(list, class, platforms, __VA_ARGS__) \ - } catch(...) {} - -#define Format(ext, list, class, platforms) \ - if(extension == ext) { \ - TryInsert(list, class, platforms, file_name) \ - } + MediaAccumulator accumulator(file_name, potential_platforms); // 2MG - if(extension == "2mg") { + if(accumulator.name_matches("2mg")) { // 2MG uses a factory method; defer to it. try { - const auto media = Storage::Disk::Disk2MG::open(file_name); - std::visit([&result, &potential_platforms](auto &&arg) { + const auto media = Disk::Disk2MG::open(file_name); + std::visit([&](auto &&arg) { using Type = typename std::decay::type; if constexpr (std::is_same::value) { // It's valid for no media to be returned. - } else if constexpr (std::is_same::value) { - InsertInstance(result.disks, arg, TargetPlatform::DiskII); - } else if constexpr (std::is_same::value) { + } else if constexpr (std::is_same::value) { + accumulator.insert(TargetPlatform::DiskII, arg); + } else if constexpr (std::is_same::value) { // TODO: or is it Apple IIgs? - InsertInstance(result.mass_storage_devices, arg, TargetPlatform::AppleII); + accumulator.insert(TargetPlatform::AppleII, arg); } else { static_assert(always_false_v, "Unexpected type encountered."); } @@ -148,106 +193,108 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform:: } catch(...) {} } - Format("80", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 80 - Format("81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 81 - Format("a26", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // A26 - Format("adf", result.disks, Disk::DiskImageHolder, TargetPlatform::Acorn) // ADF (Acorn) - Format("adf", result.disks, Disk::DiskImageHolder, TargetPlatform::Amiga) // ADF (Amiga) - Format("adl", result.disks, Disk::DiskImageHolder, TargetPlatform::Acorn) // ADL - Format("bin", result.cartridges, Cartridge::BinaryDump, TargetPlatform::AllCartridge) // BIN (cartridge dump) - Format("cas", result.tapes, Tape::CAS, TargetPlatform::MSX) // CAS - Format("cdt", result.tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT - Format("col", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Coleco) // COL - Format("csw", result.tapes, Tape::CSW, TargetPlatform::AllTape) // CSW - Format("d64", result.disks, Disk::DiskImageHolder, TargetPlatform::Commodore) // D64 - Format("dat", result.mass_storage_devices, MassStorage::DAT, TargetPlatform::Acorn) // DAT - Format("dmk", result.disks, Disk::DiskImageHolder, TargetPlatform::MSX) // DMK - Format("do", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // DO - Format("dsd", result.disks, Disk::DiskImageHolder, TargetPlatform::Acorn) // DSD - Format( "dsk", - result.disks, - Disk::DiskImageHolder, - TargetPlatform::AmstradCPC | TargetPlatform::Oric | TargetPlatform::ZXSpectrum) // DSK (Amstrad CPC, etc) - Format("dsk", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // DSK (Apple II) - Format("dsk", result.disks, Disk::DiskImageHolder, TargetPlatform::Macintosh) // DSK (Macintosh, floppy disk) - Format("dsk", result.mass_storage_devices, MassStorage::HFV, TargetPlatform::Macintosh) // DSK (Macintosh, hard disk, single volume image) - Format("dsk", result.mass_storage_devices, MassStorage::DSK, TargetPlatform::Macintosh) // DSK (Macintosh, hard disk, full device image) - Format("dsk", result.disks, Disk::DiskImageHolder, TargetPlatform::MSX) // DSK (MSX) - Format("dsk", result.disks, Disk::DiskImageHolder, TargetPlatform::Oric) // DSK (Oric) - Format("g64", result.disks, Disk::DiskImageHolder, TargetPlatform::Commodore) // G64 - Format("hdv", result.mass_storage_devices, MassStorage::HDV, TargetPlatform::AppleII) // HDV (Apple II, hard disk, single volume image) - Format( "hfe", - result.disks, - Disk::DiskImageHolder, - TargetPlatform::Acorn | TargetPlatform::AmstradCPC | TargetPlatform::Commodore | TargetPlatform::Oric | TargetPlatform::ZXSpectrum) - // HFE (TODO: switch to AllDisk once the MSX stops being so greedy) - Format("ima", result.disks, Disk::DiskImageHolder, TargetPlatform::PCCompatible) // IMG (MS-DOS style) - Format("image", result.disks, Disk::DiskImageHolder, TargetPlatform::Macintosh) // IMG (DiskCopy 4.2) - Format("imd", result.disks, Disk::DiskImageHolder, TargetPlatform::PCCompatible) // IMD - Format("img", result.disks, Disk::DiskImageHolder, TargetPlatform::Macintosh) // IMG (DiskCopy 4.2) + accumulator.try_standard(TargetPlatform::ZX8081, "80"); + accumulator.try_standard(TargetPlatform::ZX8081, "81"); + + accumulator.try_standard(TargetPlatform::Atari2600, "a26"); + accumulator.try_standard>(TargetPlatform::Acorn, "adf"); + accumulator.try_standard>(TargetPlatform::Amiga, "adf"); + accumulator.try_standard>(TargetPlatform::Acorn, "adl"); + + accumulator.try_standard(TargetPlatform::AllCartridge, "bin"); + + accumulator.try_standard(TargetPlatform::MSX, "cas"); + accumulator.try_standard(TargetPlatform::AmstradCPC, "cdt"); + accumulator.try_standard(TargetPlatform::Coleco, "col"); + accumulator.try_standard(TargetPlatform::AllTape, "csw"); + + accumulator.try_standard>(TargetPlatform::Commodore, "d64"); + accumulator.try_standard(TargetPlatform::Acorn, "dat"); + accumulator.try_standard>(TargetPlatform::MSX, "dmk"); + accumulator.try_standard>(TargetPlatform::DiskII, "do"); + accumulator.try_standard>(TargetPlatform::Acorn, "dsd"); + accumulator.try_standard>( + TargetPlatform::AmstradCPC | TargetPlatform::Oric | TargetPlatform::ZXSpectrum, "dsk"); + accumulator.try_standard>(TargetPlatform::DiskII, "dsk"); + accumulator.try_standard>(TargetPlatform::Macintosh, "dsk"); + accumulator.try_standard(TargetPlatform::Macintosh, "dsk"); + accumulator.try_standard(TargetPlatform::Macintosh, "dsk"); + accumulator.try_standard>(TargetPlatform::MSX, "dsk"); + accumulator.try_standard>(TargetPlatform::Oric, "dsk"); + + accumulator.try_standard>(TargetPlatform::Commodore, "g64"); + + accumulator.try_standard(TargetPlatform::AppleII, "hdv"); + accumulator.try_standard>( + TargetPlatform::Acorn | TargetPlatform::AmstradCPC | TargetPlatform::Commodore | TargetPlatform::Oric | TargetPlatform::ZXSpectrum, + "hfe"); // TODO: switch to AllDisk once the MSX stops being so greedy. + + accumulator.try_standard>(TargetPlatform::PCCompatible, "ima"); + accumulator.try_standard>(TargetPlatform::Macintosh, "image"); + accumulator.try_standard>(TargetPlatform::PCCompatible, "imd"); + accumulator.try_standard>(TargetPlatform::Macintosh, "img"); // Treat PC booter as a potential backup only if this doesn't parse as a FAT12. - if(extension == "img") { + if(accumulator.name_matches("img")) { try { - Insert(result.disks, Disk::DiskImageHolder, TargetPlatform::FAT12, file_name) // IMG (Enterprise or MS-DOS style) + accumulator.insert>(TargetPlatform::FAT12, file_name); } catch(...) { - Format("img", result.disks, Disk::DiskImageHolder, TargetPlatform::PCCompatible) // IMG (PC raw booter) + accumulator.try_standard>(TargetPlatform::PCCompatible, "img"); } } - Format( "ipf", - result.disks, - Disk::DiskImageHolder, - TargetPlatform::Amiga | TargetPlatform::AtariST | TargetPlatform::AmstradCPC | TargetPlatform::ZXSpectrum) // IPF - Format("msa", result.disks, Disk::DiskImageHolder, TargetPlatform::AtariST) // MSA - Format("mx2", result.cartridges, Cartridge::BinaryDump, TargetPlatform::MSX) // MX2 - Format("nib", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // NIB - Format("o", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // O - Format("p", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P - Format("po", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // PO (original Apple II kind) + accumulator.try_standard>( + TargetPlatform::Amiga | TargetPlatform::AtariST | TargetPlatform::AmstradCPC | TargetPlatform::ZXSpectrum, + "ipf"); - // PO (Apple IIgs kind) - if(extension == "po") { - TryInsert(result.disks, Disk::DiskImageHolder, TargetPlatform::AppleIIgs, file_name, Storage::Disk::MacintoshIMG::FixedType::GCR) + accumulator.try_standard>(TargetPlatform::AtariST, "msa"); + accumulator.try_standard(TargetPlatform::MSX, "mx2"); + accumulator.try_standard>(TargetPlatform::DiskII, "nib"); + + accumulator.try_standard(TargetPlatform::ZX8081, "o"); + accumulator.try_standard(TargetPlatform::ZX8081, "p"); + accumulator.try_standard>(TargetPlatform::DiskII, "po"); + + if(accumulator.name_matches("po")) { + accumulator.try_insert>( + TargetPlatform::AppleIIgs, + file_name, Disk::MacintoshIMG::FixedType::GCR); } - Format("p81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P81 + accumulator.try_standard(TargetPlatform::ZX8081, "p81"); - // PRG - if(extension == "prg") { - // try instantiating as a ROM; failing that accept as a tape + if(accumulator.name_matches("prg")) { + // Try instantiating as a ROM; failing that accept as a tape. try { - Insert(result.cartridges, Cartridge::PRG, TargetPlatform::Commodore, file_name) + accumulator.insert(TargetPlatform::Commodore, file_name); } catch(...) { try { - Insert(result.tapes, Tape::PRG, TargetPlatform::Commodore, file_name) + accumulator.insert(TargetPlatform::Commodore, file_name); } catch(...) {} } } - Format( "rom", - result.cartridges, - Cartridge::BinaryDump, - TargetPlatform::AcornElectron | TargetPlatform::Coleco | TargetPlatform::MSX) // ROM - Format("sg", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Sega) // SG - Format("sms", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Sega) // SMS - Format("ssd", result.disks, Disk::DiskImageHolder, TargetPlatform::Acorn) // SSD - Format("st", result.disks, Disk::DiskImageHolder, TargetPlatform::AtariST) // ST - Format("stx", result.disks, Disk::DiskImageHolder, TargetPlatform::AtariST) // STX - Format("tap", result.tapes, Tape::CommodoreTAP, TargetPlatform::Commodore) // TAP (Commodore) - Format("tap", result.tapes, Tape::OricTAP, TargetPlatform::Oric) // TAP (Oric) - Format("tap", result.tapes, Tape::ZXSpectrumTAP, TargetPlatform::ZXSpectrum) // TAP (ZX Spectrum) - Format("tsx", result.tapes, Tape::TZX, TargetPlatform::MSX) // TSX - Format("tzx", result.tapes, Tape::TZX, TargetPlatform::ZX8081 | TargetPlatform::ZXSpectrum) // TZX - Format("uef", result.tapes, Tape::UEF, TargetPlatform::Acorn) // UEF (tape) - Format("woz", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // WOZ + accumulator.try_standard( + TargetPlatform::AcornElectron | TargetPlatform::Coleco | TargetPlatform::MSX, + "rom"); -#undef Format -#undef Insert -#undef TryInsert -#undef InsertInstance + accumulator.try_standard(TargetPlatform::Sega, "sg"); + accumulator.try_standard(TargetPlatform::Sega, "sms"); + accumulator.try_standard>(TargetPlatform::Acorn, "ssd"); + accumulator.try_standard>(TargetPlatform::AtariST, "st"); + accumulator.try_standard>(TargetPlatform::AtariST, "stx"); - return result; + accumulator.try_standard(TargetPlatform::Commodore, "tap"); + accumulator.try_standard(TargetPlatform::Oric, "tap"); + accumulator.try_standard(TargetPlatform::ZXSpectrum, "tap"); + accumulator.try_standard(TargetPlatform::MSX, "tsx"); + accumulator.try_standard(TargetPlatform::ZX8081 | TargetPlatform::ZXSpectrum, "tzx"); + + accumulator.try_standard(TargetPlatform::Acorn, "uef"); + + accumulator.try_standard>(TargetPlatform::DiskII, "woz"); + + return accumulator.media; } Media Analyser::Static::GetMedia(const std::string &file_name) { diff --git a/Analyser/Static/StaticAnalyser.hpp b/Analyser/Static/StaticAnalyser.hpp index f4e3fd317..63b9e8867 100644 --- a/Analyser/Static/StaticAnalyser.hpp +++ b/Analyser/Static/StaticAnalyser.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef StaticAnalyser_hpp -#define StaticAnalyser_hpp +#pragma once #include "../Machines.hpp" @@ -79,5 +78,3 @@ TargetList GetTargets(const std::string &file_name); Media GetMedia(const std::string &file_name); } - -#endif /* StaticAnalyser_hpp */ diff --git a/Analyser/Static/ZX8081/StaticAnalyser.hpp b/Analyser/Static/ZX8081/StaticAnalyser.hpp index 2fa1ce49e..bac9d9084 100644 --- a/Analyser/Static/ZX8081/StaticAnalyser.hpp +++ b/Analyser/Static/ZX8081/StaticAnalyser.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_ZX8081_StaticAnalyser_hpp -#define Analyser_Static_ZX8081_StaticAnalyser_hpp +#pragma once #include "../StaticAnalyser.hpp" #include "../../../Storage/TargetPlatforms.hpp" @@ -18,5 +17,3 @@ namespace Analyser::Static::ZX8081 { TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } - -#endif /* StaticAnalyser_hpp */ diff --git a/Analyser/Static/ZX8081/Target.hpp b/Analyser/Static/ZX8081/Target.hpp index f4a27c4ad..2f83bbdb1 100644 --- a/Analyser/Static/ZX8081/Target.hpp +++ b/Analyser/Static/ZX8081/Target.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_ZX8081_Target_h -#define Analyser_Static_ZX8081_Target_h +#pragma once #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -39,5 +38,3 @@ struct Target: public ::Analyser::Static::Target, public Reflection::StructImpl< }; } - -#endif /* Analyser_Static_ZX8081_Target_h */ diff --git a/Analyser/Static/ZXSpectrum/StaticAnalyser.hpp b/Analyser/Static/ZXSpectrum/StaticAnalyser.hpp index 7e5ef7945..3e48fe32b 100644 --- a/Analyser/Static/ZXSpectrum/StaticAnalyser.hpp +++ b/Analyser/Static/ZXSpectrum/StaticAnalyser.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_ZXSpectrum_StaticAnalyser_hpp -#define Analyser_Static_ZXSpectrum_StaticAnalyser_hpp +#pragma once #include "../StaticAnalyser.hpp" #include "../../../Storage/TargetPlatforms.hpp" @@ -18,5 +17,3 @@ namespace Analyser::Static::ZXSpectrum { TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } - -#endif /* StaticAnalyser_hpp */ diff --git a/Analyser/Static/ZXSpectrum/Target.hpp b/Analyser/Static/ZXSpectrum/Target.hpp index bd42dbd8d..72ee008d1 100644 --- a/Analyser/Static/ZXSpectrum/Target.hpp +++ b/Analyser/Static/ZXSpectrum/Target.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Analyser_Static_ZXSpectrum_Target_h -#define Analyser_Static_ZXSpectrum_Target_h +#pragma once #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -37,5 +36,3 @@ struct Target: public ::Analyser::Static::Target, public Reflection::StructImpl< }; } - -#endif /* Target_h */ diff --git a/ClockReceiver/ClockReceiver.hpp b/ClockReceiver/ClockReceiver.hpp index 907eef9fa..340341435 100644 --- a/ClockReceiver/ClockReceiver.hpp +++ b/ClockReceiver/ClockReceiver.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef ClockReceiver_hpp -#define ClockReceiver_hpp +#pragma once #include "ForceInline.hpp" @@ -277,5 +276,3 @@ template class HalfClockReceiver: public T { private: HalfCycles half_cycles_; }; - -#endif /* ClockReceiver_hpp */ diff --git a/ClockReceiver/ClockingHintSource.hpp b/ClockReceiver/ClockingHintSource.hpp index e5f775e0d..be88ba404 100644 --- a/ClockReceiver/ClockingHintSource.hpp +++ b/ClockReceiver/ClockingHintSource.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef ClockingHintSource_hpp -#define ClockingHintSource_hpp +#pragma once namespace ClockingHint { @@ -84,5 +83,3 @@ class Source { }; } - -#endif /* ClockingHintSource_h */ diff --git a/ClockReceiver/DeferredQueue.hpp b/ClockReceiver/DeferredQueue.hpp index a2015aea3..5dfbfd0ea 100644 --- a/ClockReceiver/DeferredQueue.hpp +++ b/ClockReceiver/DeferredQueue.hpp @@ -6,8 +6,7 @@ // Copyright © 2018 Thomas Harte. All rights reserved. // -#ifndef DeferredQueue_h -#define DeferredQueue_h +#pragma once #include #include @@ -120,5 +119,3 @@ template class DeferredQueuePerformer: public DeferredQueue< private: std::function target_; }; - -#endif /* DeferredQueue_h */ diff --git a/ClockReceiver/DeferredValue.hpp b/ClockReceiver/DeferredValue.hpp index 35fbdf974..359186c67 100644 --- a/ClockReceiver/DeferredValue.hpp +++ b/ClockReceiver/DeferredValue.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef DeferredValue_h -#define DeferredValue_h +#pragma once /*! Provides storage for a single deferred value: one with a current value and a certain number @@ -44,5 +43,3 @@ template class DeferredValue { (backlog[DeferredDepth / elements_per_uint32] & insert_mask) | (value << insert_shift); } }; - -#endif /* DeferredValue_h */ diff --git a/ClockReceiver/ForceInline.hpp b/ClockReceiver/ForceInline.hpp index d3c3dc512..7610f2604 100644 --- a/ClockReceiver/ForceInline.hpp +++ b/ClockReceiver/ForceInline.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef ForceInline_hpp -#define ForceInline_hpp +#pragma once #ifndef NDEBUG @@ -22,5 +21,3 @@ #endif #endif - -#endif /* ForceInline_h */ diff --git a/ClockReceiver/JustInTime.hpp b/ClockReceiver/JustInTime.hpp index c8ddf7221..a8482f237 100644 --- a/ClockReceiver/JustInTime.hpp +++ b/ClockReceiver/JustInTime.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef JustInTime_h -#define JustInTime_h +#pragma once #include "ClockReceiver.hpp" #include "../Concurrency/AsyncTaskQueue.hpp" @@ -335,5 +334,3 @@ template task_queue_; }; - -#endif /* JustInTime_h */ diff --git a/ClockReceiver/ScanSynchroniser.hpp b/ClockReceiver/ScanSynchroniser.hpp index be2682c44..c4f002d7b 100644 --- a/ClockReceiver/ScanSynchroniser.hpp +++ b/ClockReceiver/ScanSynchroniser.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef ScanSynchroniser_h -#define ScanSynchroniser_h +#pragma once #include "../Outputs/ScanTarget.hpp" @@ -84,5 +83,3 @@ class ScanSynchroniser { }; } - -#endif /* ScanSynchroniser_h */ diff --git a/ClockReceiver/TimeTypes.hpp b/ClockReceiver/TimeTypes.hpp index c697b274b..118649b51 100644 --- a/ClockReceiver/TimeTypes.hpp +++ b/ClockReceiver/TimeTypes.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef TimeTypes_h -#define TimeTypes_h +#pragma once #include @@ -25,6 +24,3 @@ inline Seconds seconds(Nanos nanos) { } } - -#endif /* TimeTypes_h */ - diff --git a/ClockReceiver/VSyncPredictor.hpp b/ClockReceiver/VSyncPredictor.hpp index f34ed55c5..e77639a76 100644 --- a/ClockReceiver/VSyncPredictor.hpp +++ b/ClockReceiver/VSyncPredictor.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef VSyncPredictor_hpp -#define VSyncPredictor_hpp +#pragma once #include "TimeTypes.hpp" #include @@ -151,5 +150,3 @@ class VSyncPredictor { }; } - -#endif /* VSyncPredictor_hpp */ diff --git a/Components/1770/1770.hpp b/Components/1770/1770.hpp index 0c25edeb2..6a6833f04 100644 --- a/Components/1770/1770.hpp +++ b/Components/1770/1770.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef _770_hpp -#define _770_hpp +#pragma once #include "../../Storage/Disk/Controller/MFMDiskController.hpp" @@ -141,5 +140,3 @@ class WD1770: public Storage::Disk::MFMController { }; } - -#endif /* _770_hpp */ diff --git a/Components/5380/ncr5380.hpp b/Components/5380/ncr5380.hpp index d58e75d0f..48a7d3e0a 100644 --- a/Components/5380/ncr5380.hpp +++ b/Components/5380/ncr5380.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef ncr5380_hpp -#define ncr5380_hpp +#pragma once #include @@ -86,5 +85,3 @@ class NCR5380 final: public SCSI::Bus::Observer { }; } - -#endif /* ncr5380_hpp */ diff --git a/Components/6522/6522.hpp b/Components/6522/6522.hpp index 20eaeaa3e..df8502f71 100644 --- a/Components/6522/6522.hpp +++ b/Components/6522/6522.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef _522_hpp -#define _522_hpp +#pragma once #include @@ -140,5 +139,3 @@ template class MOS6522: public MOS6522Storage { } #include "Implementation/6522Implementation.hpp" - -#endif /* _522_hpp */ diff --git a/Components/6522/Implementation/6522Storage.hpp b/Components/6522/Implementation/6522Storage.hpp index 1488954e2..330081e9a 100644 --- a/Components/6522/Implementation/6522Storage.hpp +++ b/Components/6522/Implementation/6522Storage.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef _522Storage_hpp -#define _522Storage_hpp +#pragma once #include @@ -107,5 +106,3 @@ class MOS6522Storage { }; } - -#endif /* _522Storage_hpp */ diff --git a/Components/6526/6526.hpp b/Components/6526/6526.hpp index 08c68cf6e..508994e46 100644 --- a/Components/6526/6526.hpp +++ b/Components/6526/6526.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef _526_h -#define _526_h +#pragma once #include @@ -88,5 +87,3 @@ template class MOS6526: } #include "Implementation/6526Implementation.hpp" - -#endif /* _526_h */ diff --git a/Components/6526/Implementation/6526Implementation.hpp b/Components/6526/Implementation/6526Implementation.hpp index dad339574..28889cb7f 100644 --- a/Components/6526/Implementation/6526Implementation.hpp +++ b/Components/6526/Implementation/6526Implementation.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef _526Implementation_h -#define _526Implementation_h +#pragma once #include #include @@ -238,5 +237,3 @@ bool MOS6526::serial_line_did_produce_bit(Serial::Line } } - -#endif /* _526Implementation_h */ diff --git a/Components/6526/Implementation/6526Storage.hpp b/Components/6526/Implementation/6526Storage.hpp index 9eb2c7ca5..0c3695eab 100644 --- a/Components/6526/Implementation/6526Storage.hpp +++ b/Components/6526/Implementation/6526Storage.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef _526Storage_h -#define _526Storage_h +#pragma once #include @@ -331,5 +330,3 @@ struct MOS6526Storage { }; } - -#endif /* _526Storage_h */ diff --git a/Components/6532/6532.hpp b/Components/6532/6532.hpp index 4607e1a8e..23a86769b 100644 --- a/Components/6532/6532.hpp +++ b/Components/6532/6532.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef _532_hpp -#define _532_hpp +#pragma once #include #include @@ -188,5 +187,3 @@ template class MOS6532 { }; } - -#endif /* _532_hpp */ diff --git a/Components/6560/6560.hpp b/Components/6560/6560.hpp index 4a40cf5ee..f8c570924 100644 --- a/Components/6560/6560.hpp +++ b/Components/6560/6560.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef _560_hpp -#define _560_hpp +#pragma once #include "../../ClockReceiver/ClockReceiver.hpp" #include "../../Concurrency/AsyncTaskQueue.hpp" @@ -515,5 +514,3 @@ template class MOS6560 { }; } - -#endif /* _560_hpp */ diff --git a/Components/6845/CRTC6845.hpp b/Components/6845/CRTC6845.hpp index 0dcf8e9c0..8f910a696 100644 --- a/Components/6845/CRTC6845.hpp +++ b/Components/6845/CRTC6845.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef CRTC6845_hpp -#define CRTC6845_hpp +#pragma once #include "../../ClockReceiver/ClockReceiver.hpp" @@ -414,5 +413,3 @@ template cl }; } - -#endif /* CRTC6845_hpp */ diff --git a/Components/6850/6850.hpp b/Components/6850/6850.hpp index 280723e0b..88fe92996 100644 --- a/Components/6850/6850.hpp +++ b/Components/6850/6850.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Motorola_ACIA_6850_hpp -#define Motorola_ACIA_6850_hpp +#pragma once #include #include "../../ClockReceiver/ClockReceiver.hpp" @@ -126,5 +125,3 @@ class ACIA: public ClockingHint::Source, private Serial::Line::ReadDelega }; } - -#endif /* Motorola_ACIA_6850_hpp */ diff --git a/Components/68901/MFP68901.hpp b/Components/68901/MFP68901.hpp index 5d268d93d..34f108d8c 100644 --- a/Components/68901/MFP68901.hpp +++ b/Components/68901/MFP68901.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef MFP68901_hpp -#define MFP68901_hpp +#pragma once #include "../../ClockReceiver/ClockReceiver.hpp" #include "../../ClockReceiver/ClockingHintSource.hpp" @@ -184,5 +183,3 @@ class MFP68901: public ClockingHint::Source { }; } - -#endif /* MFP68901_hpp */ diff --git a/Components/8255/i8255.hpp b/Components/8255/i8255.hpp index 2551c402e..8ea42f67b 100644 --- a/Components/8255/i8255.hpp +++ b/Components/8255/i8255.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef i8255_hpp -#define i8255_hpp +#pragma once #include @@ -88,5 +87,3 @@ template class i8255 { }; } - -#endif /* i8255_hpp */ diff --git a/Components/8272/CommandDecoder.hpp b/Components/8272/CommandDecoder.hpp index 362d210ed..e0386c2aa 100644 --- a/Components/8272/CommandDecoder.hpp +++ b/Components/8272/CommandDecoder.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef CommandDecoder_hpp -#define CommandDecoder_hpp +#pragma once #include #include @@ -217,5 +216,3 @@ class CommandDecoder { }; } - -#endif /* CommandDecoder_hpp */ diff --git a/Components/8272/Results.hpp b/Components/8272/Results.hpp index 0241b7e6d..13297afee 100644 --- a/Components/8272/Results.hpp +++ b/Components/8272/Results.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Results_hpp -#define Results_hpp +#pragma once #include "CommandDecoder.hpp" #include "Status.hpp" @@ -61,5 +60,3 @@ class Results { }; } - -#endif /* Results_hpp */ diff --git a/Components/8272/Status.hpp b/Components/8272/Status.hpp index c15a631d4..2b3f63be4 100644 --- a/Components/8272/Status.hpp +++ b/Components/8272/Status.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Status_hpp -#define Status_hpp +#pragma once namespace Intel::i8272 { @@ -130,5 +129,3 @@ class Status { }; } - -#endif /* Status_hpp */ diff --git a/Components/8272/i8272.hpp b/Components/8272/i8272.hpp index 55d381d20..314482895 100644 --- a/Components/8272/i8272.hpp +++ b/Components/8272/i8272.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef i8272_hpp -#define i8272_hpp +#pragma once #include "CommandDecoder.hpp" #include "Status.hpp" @@ -134,5 +133,3 @@ class i8272 : public Storage::Disk::MFMController { }; } - -#endif /* i8272_hpp */ diff --git a/Components/8530/z8530.hpp b/Components/8530/z8530.hpp index 099aa6e24..422074634 100644 --- a/Components/8530/z8530.hpp +++ b/Components/8530/z8530.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef z8530_hpp -#define z8530_hpp +#pragma once #include @@ -109,5 +108,3 @@ class z8530 { }; } - -#endif /* z8530_hpp */ diff --git a/Components/9918/9918.hpp b/Components/9918/9918.hpp index 6cec30c61..a8ae753e7 100644 --- a/Components/9918/9918.hpp +++ b/Components/9918/9918.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef TMS9918_hpp -#define TMS9918_hpp +#pragma once #include "../../Outputs/CRT/CRT.hpp" #include "../../ClockReceiver/ClockReceiver.hpp" @@ -127,5 +126,3 @@ template class TMS9918: private Base { }; } - -#endif /* TMS9918_hpp */ diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index 4b4085f45..ec63e267f 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef TMS9918Base_hpp -#define TMS9918Base_hpp +#pragma once #include "ClockConverter.hpp" @@ -624,5 +623,3 @@ template struct Base: public Storage { #include "Fetch.hpp" #include "Draw.hpp" - -#endif /* TMS9918Base_hpp */ diff --git a/Components/9918/Implementation/AccessEnums.hpp b/Components/9918/Implementation/AccessEnums.hpp index ea6b5e1a2..b6c104dc7 100644 --- a/Components/9918/Implementation/AccessEnums.hpp +++ b/Components/9918/Implementation/AccessEnums.hpp @@ -6,9 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef AccessEnums_hpp -#define AccessEnums_hpp - +#pragma once namespace TI::TMS { @@ -111,5 +109,3 @@ enum class SpriteMode { }; } - -#endif /* AccessEnums_hpp */ diff --git a/Components/9918/Implementation/ClockConverter.hpp b/Components/9918/Implementation/ClockConverter.hpp index 2aa9d840f..9d7699749 100644 --- a/Components/9918/Implementation/ClockConverter.hpp +++ b/Components/9918/Implementation/ClockConverter.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef ClockConverter_hpp -#define ClockConverter_hpp +#pragma once #include "../9918.hpp" #include "PersonalityTraits.hpp" @@ -164,5 +163,3 @@ template class ClockConverter { }; } - -#endif /* ClockConverter_hpp */ diff --git a/Components/9918/Implementation/Draw.hpp b/Components/9918/Implementation/Draw.hpp index 5bf4a5757..7204e8b28 100644 --- a/Components/9918/Implementation/Draw.hpp +++ b/Components/9918/Implementation/Draw.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Draw_hpp -#define Draw_hpp +#pragma once namespace TI::TMS { @@ -568,5 +567,3 @@ void Base::draw_yamaha(uint8_t y, int start, int end) { // TODO. } - -#endif /* Draw_hpp */ diff --git a/Components/9918/Implementation/Fetch.hpp b/Components/9918/Implementation/Fetch.hpp index 045770536..5d226bd1b 100644 --- a/Components/9918/Implementation/Fetch.hpp +++ b/Components/9918/Implementation/Fetch.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Fetch_hpp -#define Fetch_hpp +#pragma once namespace TI::TMS { @@ -792,5 +791,3 @@ template void Base::fetch_yamaha(uint8_t y, int, int // TODO. } - -#endif /* Fetch_hpp */ diff --git a/Components/9918/Implementation/LineBuffer.hpp b/Components/9918/Implementation/LineBuffer.hpp index 0c1e80f96..4a2b7aca1 100644 --- a/Components/9918/Implementation/LineBuffer.hpp +++ b/Components/9918/Implementation/LineBuffer.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef LineBuffer_hpp -#define LineBuffer_hpp +#pragma once #include "AccessEnums.hpp" @@ -128,5 +127,3 @@ struct LineBufferPointer { }; } - -#endif /* LineBuffer_hpp */ diff --git a/Components/9918/Implementation/LineLayout.hpp b/Components/9918/Implementation/LineLayout.hpp index 460ee9d70..d170f5c4b 100644 --- a/Components/9918/Implementation/LineLayout.hpp +++ b/Components/9918/Implementation/LineLayout.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef LineLayout_h -#define LineLayout_h +#pragma once namespace TI::TMS { @@ -76,5 +75,3 @@ template struct LineLayout struct Storage struct Fill: public Rectangle { } } - -#endif /* YamahaCommands_hpp */ diff --git a/Components/AY38910/AY38910.hpp b/Components/AY38910/AY38910.hpp index a42a51124..eee96c093 100644 --- a/Components/AY38910/AY38910.hpp +++ b/Components/AY38910/AY38910.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef AY_3_8910_hpp -#define AY_3_8910_hpp +#pragma once #include "../../Outputs/Speaker/Implementation/SampleSource.hpp" #include "../../Concurrency/AsyncTaskQueue.hpp" @@ -219,5 +218,3 @@ struct State: public Reflection::StructImpl { }; } - -#endif /* AY_3_8910_hpp */ diff --git a/Components/AppleClock/AppleClock.hpp b/Components/AppleClock/AppleClock.hpp index 4271a61fc..5a45d4179 100644 --- a/Components/AppleClock/AppleClock.hpp +++ b/Components/AppleClock/AppleClock.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Apple_RealTimeClock_hpp -#define Apple_RealTimeClock_hpp +#pragma once #include @@ -293,5 +292,3 @@ class ParallelClock: public ClockStorage { }; } - -#endif /* Apple_RealTimeClock_hpp */ diff --git a/Components/AudioToggle/AudioToggle.hpp b/Components/AudioToggle/AudioToggle.hpp index 4390361c6..8209b4653 100644 --- a/Components/AudioToggle/AudioToggle.hpp +++ b/Components/AudioToggle/AudioToggle.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef AudioToggle_hpp -#define AudioToggle_hpp +#pragma once #include "../../Outputs/Speaker/Implementation/SampleSource.hpp" #include "../../Concurrency/AsyncTaskQueue.hpp" @@ -38,5 +37,3 @@ class Toggle: public Outputs::Speaker::SampleSource { }; } - -#endif /* AudioToggle_hpp */ diff --git a/Components/DiskII/DiskII.hpp b/Components/DiskII/DiskII.hpp index 5afbf0169..68df92c26 100644 --- a/Components/DiskII/DiskII.hpp +++ b/Components/DiskII/DiskII.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef DiskII_hpp -#define DiskII_hpp +#pragma once #include "../../ClockReceiver/ClockReceiver.hpp" #include "../../ClockReceiver/ClockingHintSource.hpp" @@ -126,5 +125,3 @@ class DiskII : }; } - -#endif /* DiskII_hpp */ diff --git a/Components/DiskII/DiskIIDrive.hpp b/Components/DiskII/DiskIIDrive.hpp index 55e883e08..9de3523d4 100644 --- a/Components/DiskII/DiskIIDrive.hpp +++ b/Components/DiskII/DiskIIDrive.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef DiskIIDrive_hpp -#define DiskIIDrive_hpp +#pragma once #include "IWM.hpp" @@ -27,5 +26,3 @@ class DiskIIDrive: public IWMDrive { }; } - -#endif /* DiskIIDrive_hpp */ diff --git a/Components/DiskII/IWM.hpp b/Components/DiskII/IWM.hpp index ecb57f97a..347fa75bf 100644 --- a/Components/DiskII/IWM.hpp +++ b/Components/DiskII/IWM.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef IWM_hpp -#define IWM_hpp +#pragma once #include "../../Activity/Observer.hpp" @@ -119,7 +118,4 @@ class IWM: void select_shift_mode(); }; - } - -#endif /* IWM_hpp */ diff --git a/Components/DiskII/MacintoshDoubleDensityDrive.hpp b/Components/DiskII/MacintoshDoubleDensityDrive.hpp index 31ab1934e..be0f2cc6e 100644 --- a/Components/DiskII/MacintoshDoubleDensityDrive.hpp +++ b/Components/DiskII/MacintoshDoubleDensityDrive.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef MacintoshDoubleDensityDrive_hpp -#define MacintoshDoubleDensityDrive_hpp +#pragma once #include "IWM.hpp" @@ -47,5 +46,3 @@ class DoubleDensityDrive: public IWMDrive { }; } - -#endif /* MacintoshDoubleDensityDrive_hpp */ diff --git a/Components/KonamiSCC/KonamiSCC.hpp b/Components/KonamiSCC/KonamiSCC.hpp index b1db2b17d..9b16e8a1d 100644 --- a/Components/KonamiSCC/KonamiSCC.hpp +++ b/Components/KonamiSCC/KonamiSCC.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef KonamiSCC_hpp -#define KonamiSCC_hpp +#pragma once #include "../../Outputs/Speaker/Implementation/SampleSource.hpp" #include "../../Concurrency/AsyncTaskQueue.hpp" @@ -70,5 +69,3 @@ class SCC: public ::Outputs::Speaker::SampleSource { }; } - -#endif /* KonamiSCC_hpp */ diff --git a/Components/OPx/Implementation/EnvelopeGenerator.hpp b/Components/OPx/Implementation/EnvelopeGenerator.hpp index 06c7f2eb6..e9f592a5d 100644 --- a/Components/OPx/Implementation/EnvelopeGenerator.hpp +++ b/Components/OPx/Implementation/EnvelopeGenerator.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef EnvelopeGenerator_h -#define EnvelopeGenerator_h +#pragma once #include #include @@ -258,5 +257,3 @@ template class EnvelopeGenerator }; } - -#endif /* EnvelopeGenerator_h */ diff --git a/Components/OPx/Implementation/KeyLevelScaler.hpp b/Components/OPx/Implementation/KeyLevelScaler.hpp index e1dbc66fc..fe4e59243 100644 --- a/Components/OPx/Implementation/KeyLevelScaler.hpp +++ b/Components/OPx/Implementation/KeyLevelScaler.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef KeyLevelScaler_h -#define KeyLevelScaler_h +#pragma once namespace Yamaha::OPL { @@ -51,5 +50,3 @@ template class KeyLevelScaler { }; } - -#endif /* KeyLevelScaler_h */ diff --git a/Components/OPx/Implementation/LowFrequencyOscillator.hpp b/Components/OPx/Implementation/LowFrequencyOscillator.hpp index e79953b34..bc8877ef8 100644 --- a/Components/OPx/Implementation/LowFrequencyOscillator.hpp +++ b/Components/OPx/Implementation/LowFrequencyOscillator.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef LowFrequencyOscillator_hpp -#define LowFrequencyOscillator_hpp +#pragma once #include "../../../Numeric/LFSR.hpp" @@ -62,5 +61,3 @@ class LowFrequencyOscillator { }; } - -#endif /* LowFrequencyOscillator_hpp */ diff --git a/Components/OPx/Implementation/OPLBase.hpp b/Components/OPx/Implementation/OPLBase.hpp index 7ed6ca775..a3067395c 100644 --- a/Components/OPx/Implementation/OPLBase.hpp +++ b/Components/OPx/Implementation/OPLBase.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef OPLBase_h -#define OPLBase_h +#pragma once #include "../../../Outputs/Speaker/Implementation/SampleSource.hpp" #include "../../../Concurrency/AsyncTaskQueue.hpp" @@ -34,5 +33,3 @@ template class OPLBase: public ::Outputs::Speaker::SampleSource }; } - -#endif /* OPLBase_h */ diff --git a/Components/OPx/Implementation/PhaseGenerator.hpp b/Components/OPx/Implementation/PhaseGenerator.hpp index 948034336..f1a17f076 100644 --- a/Components/OPx/Implementation/PhaseGenerator.hpp +++ b/Components/OPx/Implementation/PhaseGenerator.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef PhaseGenerator_h -#define PhaseGenerator_h +#pragma once #include #include "LowFrequencyOscillator.hpp" @@ -119,5 +118,3 @@ template class PhaseGenerator { }; } - -#endif /* PhaseGenerator_h */ diff --git a/Components/OPx/Implementation/Tables.hpp b/Components/OPx/Implementation/Tables.hpp index fab014a2b..bcdbe6593 100644 --- a/Components/OPx/Implementation/Tables.hpp +++ b/Components/OPx/Implementation/Tables.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef Tables_hpp -#define Tables_hpp +#pragma once namespace Yamaha::OPL { @@ -221,5 +220,3 @@ inline int LogSign::level(int fractional) const { } } - -#endif /* Tables_hpp */ diff --git a/Components/OPx/Implementation/WaveformGenerator.hpp b/Components/OPx/Implementation/WaveformGenerator.hpp index f325b1012..8576e3c2c 100644 --- a/Components/OPx/Implementation/WaveformGenerator.hpp +++ b/Components/OPx/Implementation/WaveformGenerator.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef WaveformGenerator_h -#define WaveformGenerator_h +#pragma once #include "Tables.hpp" #include "LowFrequencyOscillator.hpp" @@ -86,5 +85,3 @@ template class WaveformGenerator { }; } - -#endif /* WaveformGenerator_h */ diff --git a/Components/OPx/OPLL.hpp b/Components/OPx/OPLL.hpp index 5341f40ca..36bb0b51d 100644 --- a/Components/OPx/OPLL.hpp +++ b/Components/OPx/OPLL.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef OPLL_hpp -#define OPLL_hpp +#pragma once #include "Implementation/OPLBase.hpp" #include "Implementation/EnvelopeGenerator.hpp" @@ -125,5 +124,3 @@ class OPLL: public OPLBase { }; } - -#endif /* OPLL_hpp */ diff --git a/Components/RP5C01/RP5C01.hpp b/Components/RP5C01/RP5C01.hpp index 5b6914d98..5d0574cf6 100644 --- a/Components/RP5C01/RP5C01.hpp +++ b/Components/RP5C01/RP5C01.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef RP5C01_hpp -#define RP5C01_hpp +#pragma once #include "../../ClockReceiver/ClockReceiver.hpp" @@ -55,5 +54,3 @@ class RP5C01 { }; } - -#endif /* RP5C01_hpp */ diff --git a/Components/SN76489/SN76489.hpp b/Components/SN76489/SN76489.hpp index 877c71354..d419692f8 100644 --- a/Components/SN76489/SN76489.hpp +++ b/Components/SN76489/SN76489.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef SN76489_hpp -#define SN76489_hpp +#pragma once #include "../../Outputs/Speaker/Implementation/SampleSource.hpp" #include "../../Concurrency/AsyncTaskQueue.hpp" @@ -65,5 +64,3 @@ class SN76489: public Outputs::Speaker::SampleSource { }; } - -#endif /* SN76489_hpp */ diff --git a/Components/Serial/Line.hpp b/Components/Serial/Line.hpp index bbd68f9ea..483815c29 100644 --- a/Components/Serial/Line.hpp +++ b/Components/Serial/Line.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef SerialPort_hpp -#define SerialPort_hpp +#pragma once #include #include "../../Storage/Storage.hpp" @@ -143,5 +142,3 @@ class Port { }; } - -#endif /* SerialPort_hpp */ diff --git a/Concurrency/AsyncTaskQueue.hpp b/Concurrency/AsyncTaskQueue.hpp index bf7bc078e..594438446 100644 --- a/Concurrency/AsyncTaskQueue.hpp +++ b/Concurrency/AsyncTaskQueue.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef AsyncTaskQueue_hpp -#define AsyncTaskQueue_hpp +#pragma once #include #include @@ -189,5 +188,3 @@ template class QuickbootOption { }; } - -#endif /* StandardOptions_hpp */ diff --git a/Inputs/Joystick.hpp b/Inputs/Joystick.hpp index 57ee46824..9460568d8 100644 --- a/Inputs/Joystick.hpp +++ b/Inputs/Joystick.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Joystick_hpp -#define Joystick_hpp +#pragma once #include #include @@ -234,5 +233,3 @@ class ConcreteJoystick: public Joystick { }; } - -#endif /* Joystick_hpp */ diff --git a/Inputs/Keyboard.hpp b/Inputs/Keyboard.hpp index 3dcbb5cc5..8b86fac7f 100644 --- a/Inputs/Keyboard.hpp +++ b/Inputs/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Inputs_Keyboard_hpp -#define Inputs_Keyboard_hpp +#pragma once #include #include @@ -90,5 +89,3 @@ class Keyboard { }; } - -#endif /* Inputs_Keyboard_hpp */ diff --git a/Inputs/Mouse.hpp b/Inputs/Mouse.hpp index 5ea3ec8b8..9772abfd3 100644 --- a/Inputs/Mouse.hpp +++ b/Inputs/Mouse.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Mouse_h -#define Mouse_h +#pragma once namespace Inputs { @@ -43,5 +42,3 @@ class Mouse { }; } - -#endif /* Mouse_h */ diff --git a/Inputs/QuadratureMouse/QuadratureMouse.hpp b/Inputs/QuadratureMouse/QuadratureMouse.hpp index b1b596a79..78d52420d 100644 --- a/Inputs/QuadratureMouse/QuadratureMouse.hpp +++ b/Inputs/QuadratureMouse/QuadratureMouse.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef QuadratureMouse_hpp -#define QuadratureMouse_hpp +#pragma once #include "../Mouse.hpp" #include @@ -119,5 +118,3 @@ class QuadratureMouse: public Mouse { }; } - -#endif /* QuadratureMouse_hpp */ diff --git a/InstructionSets/6809/OperationMapper.hpp b/InstructionSets/6809/OperationMapper.hpp index 284d8e071..362bd08f8 100644 --- a/InstructionSets/6809/OperationMapper.hpp +++ b/InstructionSets/6809/OperationMapper.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M6809_OperationMapper_hpp -#define InstructionSets_M6809_OperationMapper_hpp +#pragma once // Cf. https://techheap.packetizer.com/processors/6809/6809Instructions.html // @@ -239,5 +238,3 @@ template void OperationMapper::dispatc } } - -#endif /* InstructionSets_M6809_OperationMapper_hpp */ diff --git a/InstructionSets/AccessType.hpp b/InstructionSets/AccessType.hpp index 4b5635542..37fdd9c1f 100644 --- a/InstructionSets/AccessType.hpp +++ b/InstructionSets/AccessType.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef AccessType_h -#define AccessType_h +#pragma once namespace InstructionSet { @@ -19,5 +18,3 @@ enum class AccessType { }; } - -#endif /* AccessType_h */ diff --git a/InstructionSets/CachingExecutor.hpp b/InstructionSets/CachingExecutor.hpp index bc3204e2b..ac6f8b4e0 100644 --- a/InstructionSets/CachingExecutor.hpp +++ b/InstructionSets/CachingExecutor.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef CachingExecutor_hpp -#define CachingExecutor_hpp +#pragma once #include "../Numeric/Sizes.hpp" @@ -196,5 +195,3 @@ template < }; } - -#endif /* CachingExecutor_hpp */ diff --git a/InstructionSets/Disassembler.hpp b/InstructionSets/Disassembler.hpp index 71f88d59e..59cd9557f 100644 --- a/InstructionSets/Disassembler.hpp +++ b/InstructionSets/Disassembler.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Disassembler_hpp -#define Disassembler_hpp +#pragma once #include "../Numeric/Sizes.hpp" @@ -85,5 +84,3 @@ template < }; } - -#endif /* Disassembler_h */ diff --git a/InstructionSets/M50740/Decoder.hpp b/InstructionSets/M50740/Decoder.hpp index 409d5f535..b744cd63e 100644 --- a/InstructionSets/M50740/Decoder.hpp +++ b/InstructionSets/M50740/Decoder.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M50740_Decoder_hpp -#define InstructionSets_M50740_Decoder_hpp +#pragma once #include "Instruction.hpp" @@ -33,5 +32,3 @@ class Decoder { }; } - -#endif /* InstructionSets_M50740_Decoder_hpp */ diff --git a/InstructionSets/M50740/Executor.hpp b/InstructionSets/M50740/Executor.hpp index 193cae11c..88d1edf00 100644 --- a/InstructionSets/M50740/Executor.hpp +++ b/InstructionSets/M50740/Executor.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Executor_h -#define Executor_h +#pragma once #include "Instruction.hpp" #include "Parser.hpp" @@ -176,5 +175,3 @@ class Executor: public CachingExecutor { }; } - -#endif /* Executor_h */ diff --git a/InstructionSets/M50740/Instruction.hpp b/InstructionSets/M50740/Instruction.hpp index ea616b5fa..b61f2c17e 100644 --- a/InstructionSets/M50740/Instruction.hpp +++ b/InstructionSets/M50740/Instruction.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M50740_Instruction_h -#define InstructionSets_M50740_Instruction_h +#pragma once #include #include @@ -235,5 +234,3 @@ inline std::ostream &operator <<(std::ostream &stream, const Instruction &instru } } - -#endif /* InstructionSets_M50740_Instruction_h */ diff --git a/InstructionSets/M50740/Parser.hpp b/InstructionSets/M50740/Parser.hpp index dc739048a..e9350b6eb 100644 --- a/InstructionSets/M50740/Parser.hpp +++ b/InstructionSets/M50740/Parser.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M50740_Parser_hpp -#define InstructionSets_M50740_Parser_hpp +#pragma once #include #include "Decoder.hpp" @@ -119,5 +118,3 @@ template struct Parser { }; } - -#endif /* InstructionSets_M50740_Parser_hpp */ diff --git a/InstructionSets/M68k/Decoder.hpp b/InstructionSets/M68k/Decoder.hpp index 2f4413df8..5282b8181 100644 --- a/InstructionSets/M68k/Decoder.hpp +++ b/InstructionSets/M68k/Decoder.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M68k_Decoder_hpp -#define InstructionSets_M68k_Decoder_hpp +#pragma once #include "Instruction.hpp" #include "Model.hpp" @@ -115,5 +114,3 @@ template class Predecoder { }; } - -#endif /* InstructionSets_M68k_Decoder_hpp */ diff --git a/InstructionSets/M68k/ExceptionVectors.hpp b/InstructionSets/M68k/ExceptionVectors.hpp index 99bab495a..1acf79b52 100644 --- a/InstructionSets/M68k/ExceptionVectors.hpp +++ b/InstructionSets/M68k/ExceptionVectors.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M68k_ExceptionVectors_hpp -#define InstructionSets_M68k_ExceptionVectors_hpp +#pragma once namespace InstructionSet::M68k { @@ -44,5 +43,3 @@ enum Exception { }; } - -#endif /* InstructionSets_M68k_ExceptionVectors_hpp */ diff --git a/InstructionSets/M68k/Executor.hpp b/InstructionSets/M68k/Executor.hpp index 5db70ae75..7d0f58169 100644 --- a/InstructionSets/M68k/Executor.hpp +++ b/InstructionSets/M68k/Executor.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M68k_Executor_hpp -#define InstructionSets_M68k_Executor_hpp +#pragma once #include "Decoder.hpp" #include "Instruction.hpp" @@ -165,5 +164,3 @@ template class Executor { } #include "Implementation/ExecutorImplementation.hpp" - -#endif /* InstructionSets_M68k_Executor_hpp */ diff --git a/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp b/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp index 3f06e0a3a..ef65f232c 100644 --- a/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp +++ b/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp @@ -7,8 +7,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M68k_ExecutorImplementation_hpp -#define InstructionSets_M68k_ExecutorImplementation_hpp +#pragma once #include "../Perform.hpp" #include "../ExceptionVectors.hpp" @@ -749,5 +748,3 @@ void Executor::State::movem_toR(Preinstruction instruction, u #undef AccessException } - -#endif /* InstructionSets_M68k_ExecutorImplementation_hpp */ diff --git a/InstructionSets/M68k/Implementation/InstructionOperandFlags.hpp b/InstructionSets/M68k/Implementation/InstructionOperandFlags.hpp index f5250a31d..008982e18 100644 --- a/InstructionSets/M68k/Implementation/InstructionOperandFlags.hpp +++ b/InstructionSets/M68k/Implementation/InstructionOperandFlags.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_68k_InstructionOperandFlags_hpp -#define InstructionSets_68k_InstructionOperandFlags_hpp +#pragma once namespace InstructionSet::M68k { @@ -168,5 +167,3 @@ template constexpr uint8_t operand_flags(Op } } - -#endif /* InstructionSets_68k_InstructionOperandFlags_hpp */ diff --git a/InstructionSets/M68k/Implementation/InstructionOperandSize.hpp b/InstructionSets/M68k/Implementation/InstructionOperandSize.hpp index 3d6308dbc..63cb03548 100644 --- a/InstructionSets/M68k/Implementation/InstructionOperandSize.hpp +++ b/InstructionSets/M68k/Implementation/InstructionOperandSize.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_68k_InstructionOperandSize_hpp -#define InstructionSets_68k_InstructionOperandSize_hpp +#pragma once namespace InstructionSet::M68k { @@ -128,5 +127,3 @@ constexpr DataSize operand_size(Operation r_operation) { } } - -#endif /* InstructionSets_68k_InstructionOperandSize_hpp */ diff --git a/InstructionSets/M68k/Implementation/PerformImplementation.hpp b/InstructionSets/M68k/Implementation/PerformImplementation.hpp index 95a484e30..2c9143fa1 100644 --- a/InstructionSets/M68k/Implementation/PerformImplementation.hpp +++ b/InstructionSets/M68k/Implementation/PerformImplementation.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M68k_PerformImplementation_h -#define InstructionSets_M68k_PerformImplementation_h +#pragma once #include "../../../Numeric/Carry.hpp" #include "../ExceptionVectors.hpp" @@ -1004,5 +1003,3 @@ template < } } - -#endif /* InstructionSets_M68k_PerformImplementation_h */ diff --git a/InstructionSets/M68k/Instruction.hpp b/InstructionSets/M68k/Instruction.hpp index 97a2240a2..b5e601930 100644 --- a/InstructionSets/M68k/Instruction.hpp +++ b/InstructionSets/M68k/Instruction.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_68k_Instruction_hpp -#define InstructionSets_68k_Instruction_hpp +#pragma once #include "Model.hpp" @@ -497,5 +496,3 @@ class Preinstruction { #include "Implementation/InstructionOperandSize.hpp" #include "Implementation/InstructionOperandFlags.hpp" - -#endif /* InstructionSets_68k_Instruction_hpp */ diff --git a/InstructionSets/M68k/Model.hpp b/InstructionSets/M68k/Model.hpp index 65572331c..ef3444c2b 100644 --- a/InstructionSets/M68k/Model.hpp +++ b/InstructionSets/M68k/Model.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M68k_Model_hpp -#define InstructionSets_M68k_Model_hpp +#pragma once namespace InstructionSet::M68k { @@ -20,5 +19,3 @@ enum class Model { }; } - -#endif /* InstructionSets_M68k_Model_hpp */ diff --git a/InstructionSets/M68k/Perform.hpp b/InstructionSets/M68k/Perform.hpp index 7bba658b3..e32ea3ed3 100644 --- a/InstructionSets/M68k/Perform.hpp +++ b/InstructionSets/M68k/Perform.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M68k_Perform_h -#define InstructionSets_M68k_Perform_h +#pragma once #include "Model.hpp" #include "Instruction.hpp" @@ -169,5 +168,3 @@ template < } #include "Implementation/PerformImplementation.hpp" - -#endif /* InstructionSets_M68k_Perform_h */ diff --git a/InstructionSets/M68k/RegisterSet.hpp b/InstructionSets/M68k/RegisterSet.hpp index ee2a66f3b..984fcafed 100644 --- a/InstructionSets/M68k/RegisterSet.hpp +++ b/InstructionSets/M68k/RegisterSet.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M68k_RegisterSet_h -#define InstructionSets_M68k_RegisterSet_h +#pragma once namespace InstructionSet::M68k { @@ -25,5 +24,3 @@ struct RegisterSet { }; } - -#endif /* InstructionSets_M68k_RegisterSet_h */ diff --git a/InstructionSets/M68k/Status.hpp b/InstructionSets/M68k/Status.hpp index cfb831353..49ff17cc4 100644 --- a/InstructionSets/M68k/Status.hpp +++ b/InstructionSets/M68k/Status.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_M68k_Status_h -#define InstructionSets_M68k_Status_h +#pragma once #include "Instruction.hpp" @@ -159,5 +158,3 @@ struct Status { }; } - -#endif /* InstructionSets_M68k_Status_h */ diff --git a/InstructionSets/PowerPC/Decoder.hpp b/InstructionSets/PowerPC/Decoder.hpp index 9f2cb6e1d..7443f8ab0 100644 --- a/InstructionSets/PowerPC/Decoder.hpp +++ b/InstructionSets/PowerPC/Decoder.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_PowerPC_Decoder_hpp -#define InstructionSets_PowerPC_Decoder_hpp +#pragma once #include "Instruction.hpp" @@ -50,5 +49,3 @@ template struct Decoder { }; } - -#endif /* InstructionSets_PowerPC_Decoder_hpp */ diff --git a/InstructionSets/PowerPC/Instruction.hpp b/InstructionSets/PowerPC/Instruction.hpp index a55fb926c..7116d3a0b 100644 --- a/InstructionSets/PowerPC/Instruction.hpp +++ b/InstructionSets/PowerPC/Instruction.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_PowerPC_Instruction_h -#define InstructionSets_PowerPC_Instruction_h +#pragma once #include @@ -1530,5 +1529,3 @@ struct Instruction { static_assert(sizeof(Instruction) <= 8); } - -#endif /* InstructionSets_PowerPC_Instruction_h */ diff --git a/InstructionSets/x86/AccessType.hpp b/InstructionSets/x86/AccessType.hpp index 14ad92891..3142f7c4b 100644 --- a/InstructionSets/x86/AccessType.hpp +++ b/InstructionSets/x86/AccessType.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef AccessType_h -#define AccessType_h +#pragma once namespace InstructionSet::x86 { @@ -62,5 +61,3 @@ template using modify_t = typename Accessor using access_t = typename Accessor::type; } - -#endif /* AccessType_h */ diff --git a/InstructionSets/x86/Decoder.hpp b/InstructionSets/x86/Decoder.hpp index 7ca9bcc3e..ee3c7e736 100644 --- a/InstructionSets/x86/Decoder.hpp +++ b/InstructionSets/x86/Decoder.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_x86_Decoder_hpp -#define InstructionSets_x86_Decoder_hpp +#pragma once #include "Instruction.hpp" #include "Model.hpp" @@ -242,5 +241,3 @@ class Decoder8086 { }; } - -#endif /* InstructionSets_x86_Decoder_hpp */ diff --git a/InstructionSets/x86/Flags.hpp b/InstructionSets/x86/Flags.hpp index d91ad0017..8fd2f16ca 100644 --- a/InstructionSets/x86/Flags.hpp +++ b/InstructionSets/x86/Flags.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_x86_Flags_hpp -#define InstructionSets_x86_Flags_hpp +#pragma once #include "../../Numeric/Carry.hpp" @@ -229,5 +228,3 @@ class Flags { }; } - -#endif /* InstructionSets_x86_Flags_hpp */ diff --git a/InstructionSets/x86/Implementation/Arithmetic.hpp b/InstructionSets/x86/Implementation/Arithmetic.hpp index be3fbd42d..1066de82d 100644 --- a/InstructionSets/x86/Implementation/Arithmetic.hpp +++ b/InstructionSets/x86/Implementation/Arithmetic.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Arithmetic_hpp -#define Arithmetic_hpp +#pragma once #include "../AccessType.hpp" #include "../Interrupts.hpp" @@ -361,5 +360,3 @@ void neg( } } - -#endif /* Arithmetic_hpp */ diff --git a/InstructionSets/x86/Implementation/BCD.hpp b/InstructionSets/x86/Implementation/BCD.hpp index 2e6d77388..21212a8db 100644 --- a/InstructionSets/x86/Implementation/BCD.hpp +++ b/InstructionSets/x86/Implementation/BCD.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef BCD_h -#define BCD_h +#pragma once #include "../AccessType.hpp" @@ -112,5 +111,3 @@ void daas( } } - -#endif /* BCD_h */ diff --git a/InstructionSets/x86/Implementation/FlowControl.hpp b/InstructionSets/x86/Implementation/FlowControl.hpp index a8be5cb53..65af8a425 100644 --- a/InstructionSets/x86/Implementation/FlowControl.hpp +++ b/InstructionSets/x86/Implementation/FlowControl.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef FlowControl_hpp -#define FlowControl_hpp +#pragma once #include "Resolver.hpp" #include "Stack.hpp" @@ -244,5 +243,3 @@ void bound( } } - -#endif /* FlowControl_hpp */ diff --git a/InstructionSets/x86/Implementation/InOut.hpp b/InstructionSets/x86/Implementation/InOut.hpp index 21ed3aaa0..3f1b9d98f 100644 --- a/InstructionSets/x86/Implementation/InOut.hpp +++ b/InstructionSets/x86/Implementation/InOut.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef InOut_h -#define InOut_h +#pragma once #include "../AccessType.hpp" @@ -32,5 +31,3 @@ void in( } } - -#endif /* InOut_h */ diff --git a/InstructionSets/x86/Implementation/LoadStore.hpp b/InstructionSets/x86/Implementation/LoadStore.hpp index 6c916b759..e03c1e4ea 100644 --- a/InstructionSets/x86/Implementation/LoadStore.hpp +++ b/InstructionSets/x86/Implementation/LoadStore.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef LoadStore_h -#define LoadStore_h +#pragma once #include "../AccessType.hpp" @@ -79,5 +78,3 @@ void mov( } } - -#endif /* LoadStore_h */ diff --git a/InstructionSets/x86/Implementation/Logical.hpp b/InstructionSets/x86/Implementation/Logical.hpp index 3095ad61f..186b3963d 100644 --- a/InstructionSets/x86/Implementation/Logical.hpp +++ b/InstructionSets/x86/Implementation/Logical.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Logical_h -#define Logical_h +#pragma once #include "../AccessType.hpp" @@ -142,5 +141,3 @@ void setmo( } } - -#endif /* Logical_h */ diff --git a/InstructionSets/x86/Implementation/PerformImplementation.hpp b/InstructionSets/x86/Implementation/PerformImplementation.hpp index 6c65c7cae..7d9e1c9de 100644 --- a/InstructionSets/x86/Implementation/PerformImplementation.hpp +++ b/InstructionSets/x86/Implementation/PerformImplementation.hpp @@ -7,8 +7,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef PerformImplementation_h -#define PerformImplementation_h +#pragma once #include "Arithmetic.hpp" #include "BCD.hpp" @@ -532,5 +531,3 @@ template < } } - -#endif /* PerformImplementation_h */ diff --git a/InstructionSets/x86/Implementation/Repetition.hpp b/InstructionSets/x86/Implementation/Repetition.hpp index 65954c7fa..01e6c1d48 100644 --- a/InstructionSets/x86/Implementation/Repetition.hpp +++ b/InstructionSets/x86/Implementation/Repetition.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Repetition_h -#define Repetition_h +#pragma once #include "../AccessType.hpp" @@ -176,5 +175,3 @@ void ins( } } - -#endif /* Repetition_h */ diff --git a/InstructionSets/x86/Implementation/Resolver.hpp b/InstructionSets/x86/Implementation/Resolver.hpp index 23e23d9c2..4d71a881c 100644 --- a/InstructionSets/x86/Implementation/Resolver.hpp +++ b/InstructionSets/x86/Implementation/Resolver.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Resolver_h -#define Resolver_h +#pragma once #include "../AccessType.hpp" @@ -205,5 +204,3 @@ typename Accessor::type resolve( } } - -#endif /* Resolver_h */ diff --git a/InstructionSets/x86/Implementation/ShiftRoll.hpp b/InstructionSets/x86/Implementation/ShiftRoll.hpp index 578641a92..49ce02209 100644 --- a/InstructionSets/x86/Implementation/ShiftRoll.hpp +++ b/InstructionSets/x86/Implementation/ShiftRoll.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef ShiftRoll_hpp -#define ShiftRoll_hpp +#pragma once #include "../AccessType.hpp" @@ -361,5 +360,3 @@ void shr( } } - -#endif /* ShiftRoll_hpp */ diff --git a/InstructionSets/x86/Implementation/Stack.hpp b/InstructionSets/x86/Implementation/Stack.hpp index dfefb18d2..6568d2040 100644 --- a/InstructionSets/x86/Implementation/Stack.hpp +++ b/InstructionSets/x86/Implementation/Stack.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Stack_hpp -#define Stack_hpp +#pragma once #include "../AccessType.hpp" @@ -197,5 +196,3 @@ void leave( } } - -#endif /* Stack_hpp */ diff --git a/InstructionSets/x86/Instruction.hpp b/InstructionSets/x86/Instruction.hpp index baaf3ff6f..a1e475152 100644 --- a/InstructionSets/x86/Instruction.hpp +++ b/InstructionSets/x86/Instruction.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_x86_Instruction_h -#define InstructionSets_x86_Instruction_h +#pragma once #include "Model.hpp" @@ -965,5 +964,3 @@ std::string to_string( int immediate_length = 0); } - -#endif /* InstructionSets_x86_Instruction_h */ diff --git a/InstructionSets/x86/Interrupts.hpp b/InstructionSets/x86/Interrupts.hpp index f47db4acf..acefa35f9 100644 --- a/InstructionSets/x86/Interrupts.hpp +++ b/InstructionSets/x86/Interrupts.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef InstructionSets_x86_Interrupts_h -#define InstructionSets_x86_Interrupts_h +#pragma once namespace InstructionSet::x86 { @@ -35,5 +34,3 @@ enum Interrupt { }; } - -#endif /* InstructionSets_x86_Interrupts_h */ diff --git a/InstructionSets/x86/Model.hpp b/InstructionSets/x86/Model.hpp index e497cd5a6..8bd8ea8d8 100644 --- a/InstructionSets/x86/Model.hpp +++ b/InstructionSets/x86/Model.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef Model_h -#define Model_h +#pragma once #include @@ -26,5 +25,3 @@ template struct AddressT { using type = uint16_t; }; template <> struct AddressT { using type = uint32_t; }; } - -#endif /* Model_h */ diff --git a/InstructionSets/x86/Perform.hpp b/InstructionSets/x86/Perform.hpp index 918c289c4..46821aab7 100644 --- a/InstructionSets/x86/Perform.hpp +++ b/InstructionSets/x86/Perform.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Perform_h -#define Perform_h +#pragma once #include "Instruction.hpp" #include "Model.hpp" @@ -52,5 +51,3 @@ template < } #include "Implementation/PerformImplementation.hpp" - -#endif /* Perform_h */ diff --git a/Machines/Amiga/Amiga.hpp b/Machines/Amiga/Amiga.hpp index e820613d0..f0b6cd4d5 100644 --- a/Machines/Amiga/Amiga.hpp +++ b/Machines/Amiga/Amiga.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Amiga_hpp -#define Amiga_hpp +#pragma once #include "../../Analyser/Static/StaticAnalyser.hpp" #include "../ROMMachine.hpp" @@ -25,5 +24,3 @@ class Machine { }; } - -#endif /* Amiga_hpp */ diff --git a/Machines/Amiga/Audio.hpp b/Machines/Amiga/Audio.hpp index 78681d8e8..1f73faba8 100644 --- a/Machines/Amiga/Audio.hpp +++ b/Machines/Amiga/Audio.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Audio_hpp -#define Audio_hpp +#pragma once #include #include @@ -159,5 +158,3 @@ class Audio: public DMADevice<4> { }; } - -#endif /* Audio_hpp */ diff --git a/Machines/Amiga/Bitplanes.hpp b/Machines/Amiga/Bitplanes.hpp index 8926f9fc4..6c6fad3dc 100644 --- a/Machines/Amiga/Bitplanes.hpp +++ b/Machines/Amiga/Bitplanes.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Bitplanes_hpp -#define Bitplanes_hpp +#pragma once #include @@ -98,5 +97,3 @@ class BitplaneShifter { }; } - -#endif /* Bitplanes_hpp */ diff --git a/Machines/Amiga/Blitter.hpp b/Machines/Amiga/Blitter.hpp index 2a4ce8ae4..ecd934143 100644 --- a/Machines/Amiga/Blitter.hpp +++ b/Machines/Amiga/Blitter.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Blitter_hpp -#define Blitter_hpp +#pragma once #include #include @@ -129,6 +128,3 @@ template class Blitter: public DMADevice<4, 4> { }; } - - -#endif /* Blitter_hpp */ diff --git a/Machines/Amiga/BlitterSequencer.hpp b/Machines/Amiga/BlitterSequencer.hpp index c6f0ff642..e6acb0279 100644 --- a/Machines/Amiga/BlitterSequencer.hpp +++ b/Machines/Amiga/BlitterSequencer.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef BlitterSequencer_hpp -#define BlitterSequencer_hpp +#pragma once #include @@ -163,5 +162,3 @@ class BlitterSequencer { }; } - -#endif /* BlitterSequencer_hpp */ diff --git a/Machines/Amiga/Chipset.hpp b/Machines/Amiga/Chipset.hpp index 02146f2fd..6bc59f939 100644 --- a/Machines/Amiga/Chipset.hpp +++ b/Machines/Amiga/Chipset.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Chipset_hpp -#define Chipset_hpp +#pragma once #include #include @@ -376,5 +375,3 @@ class Chipset: private ClockingHint::Observer { }; } - -#endif /* Chipset_hpp */ diff --git a/Machines/Amiga/Copper.hpp b/Machines/Amiga/Copper.hpp index 761d2a6f6..5c16912b5 100644 --- a/Machines/Amiga/Copper.hpp +++ b/Machines/Amiga/Copper.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Copper_h -#define Copper_h +#pragma once #include "DMADevice.hpp" @@ -50,5 +49,3 @@ class Copper: public DMADevice<2> { }; } - -#endif /* Copper_h */ diff --git a/Machines/Amiga/DMADevice.hpp b/Machines/Amiga/DMADevice.hpp index c3d1d7e0b..a1ecf6426 100644 --- a/Machines/Amiga/DMADevice.hpp +++ b/Machines/Amiga/DMADevice.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef DMADevice_hpp -#define DMADevice_hpp +#pragma once #include #include @@ -70,5 +69,3 @@ template class DMADevice: public }; } - -#endif /* DMADevice_hpp */ diff --git a/Machines/Amiga/Flags.hpp b/Machines/Amiga/Flags.hpp index 029c1a1d8..280bf2512 100644 --- a/Machines/Amiga/Flags.hpp +++ b/Machines/Amiga/Flags.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Flags_hpp -#define Flags_hpp +#pragma once namespace Amiga { @@ -49,5 +48,3 @@ namespace DMAFlag { } } - -#endif /* Flags_hpp */ diff --git a/Machines/Amiga/Keyboard.hpp b/Machines/Amiga/Keyboard.hpp index 88a1f6aab..95a7aa786 100644 --- a/Machines/Amiga/Keyboard.hpp +++ b/Machines/Amiga/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Machines_Amiga_Keyboard_hpp -#define Machines_Amiga_Keyboard_hpp +#pragma once #include #include @@ -117,5 +116,3 @@ class Keyboard { }; } - -#endif /* Machines_Amiga_Keyboard_hpp */ diff --git a/Machines/Amiga/MemoryMap.hpp b/Machines/Amiga/MemoryMap.hpp index 91f2de5ff..d0d2d53bb 100644 --- a/Machines/Amiga/MemoryMap.hpp +++ b/Machines/Amiga/MemoryMap.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef MemoryMap_hpp -#define MemoryMap_hpp +#pragma once #include "../../Analyser/Static/Amiga/Target.hpp" @@ -193,4 +192,3 @@ class MemoryMap { }; } -#endif /* MemoryMap_hpp */ diff --git a/Machines/Amiga/Minterms.hpp b/Machines/Amiga/Minterms.hpp index bf92d0b0a..012c8cb01 100644 --- a/Machines/Amiga/Minterms.hpp +++ b/Machines/Amiga/Minterms.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Minterms_hpp -#define Minterms_hpp +#pragma once namespace Amiga { @@ -383,5 +382,3 @@ template IntT apply_minterm(IntT a, IntT b, IntT c, int minterm) } } - -#endif /* Minterms_hpp */ diff --git a/Machines/Amiga/MouseJoystick.hpp b/Machines/Amiga/MouseJoystick.hpp index 32037fc9c..3289c3764 100644 --- a/Machines/Amiga/MouseJoystick.hpp +++ b/Machines/Amiga/MouseJoystick.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef MouseJoystick_hpp -#define MouseJoystick_hpp +#pragma once #include #include @@ -53,5 +52,3 @@ class Joystick: public Inputs::ConcreteJoystick, public MouseJoystickInput { }; } - -#endif /* MouseJoystick_hpp */ diff --git a/Machines/Amiga/Sprites.hpp b/Machines/Amiga/Sprites.hpp index a2c05da4e..1ce95ed5d 100644 --- a/Machines/Amiga/Sprites.hpp +++ b/Machines/Amiga/Sprites.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Sprites_hpp -#define Sprites_hpp +#pragma once #include @@ -64,7 +63,4 @@ class TwoSpriteShifter { uint8_t overflow_; }; - } - -#endif /* Sprites_hpp */ diff --git a/Machines/AmstradCPC/AmstradCPC.hpp b/Machines/AmstradCPC/AmstradCPC.hpp index b6184dce8..75cf8af6c 100644 --- a/Machines/AmstradCPC/AmstradCPC.hpp +++ b/Machines/AmstradCPC/AmstradCPC.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef AmstradCPC_hpp -#define AmstradCPC_hpp +#pragma once #include "../../Configurable/Configurable.hpp" #include "../../Configurable/StandardOptions.hpp" @@ -51,5 +50,3 @@ class Machine { }; } - -#endif /* AmstradCPC_hpp */ diff --git a/Machines/AmstradCPC/FDC.hpp b/Machines/AmstradCPC/FDC.hpp index 46042e0f5..4cf2424c7 100644 --- a/Machines/AmstradCPC/FDC.hpp +++ b/Machines/AmstradCPC/FDC.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef FDC_h -#define FDC_h +#pragma once #include "../../Components/8272/i8272.hpp" @@ -47,5 +46,3 @@ class FDC: public Intel::i8272::i8272 { }; } - -#endif /* FDC_h */ diff --git a/Machines/AmstradCPC/Keyboard.hpp b/Machines/AmstradCPC/Keyboard.hpp index c5913637e..864f5e933 100644 --- a/Machines/AmstradCPC/Keyboard.hpp +++ b/Machines/AmstradCPC/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Machines_AmstradCPC_Keyboard_hpp -#define Machines_AmstradCPC_Keyboard_hpp +#pragma once #include "../KeyboardMachine.hpp" #include "../Utility/Typer.hpp" @@ -44,6 +43,4 @@ struct CharacterMapper: public ::Utility::CharacterMapper { bool needs_pause_after_key(uint16_t key) const override; }; -}; - -#endif /* KeyboardMapper_hpp */ +} diff --git a/Machines/Apple/ADB/Bus.hpp b/Machines/Apple/ADB/Bus.hpp index 16aa58847..89cc02c83 100644 --- a/Machines/Apple/ADB/Bus.hpp +++ b/Machines/Apple/ADB/Bus.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Bus_hpp -#define Bus_hpp +#pragma once #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -166,5 +165,3 @@ class Bus { }; } - -#endif /* Bus_hpp */ diff --git a/Machines/Apple/ADB/Keyboard.hpp b/Machines/Apple/ADB/Keyboard.hpp index e205d7bdf..97a50d35f 100644 --- a/Machines/Apple/ADB/Keyboard.hpp +++ b/Machines/Apple/ADB/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Keyboard_hpp -#define Keyboard_hpp +#pragma once #include "ReactiveDevice.hpp" #include "../../../Inputs/Keyboard.hpp" @@ -119,5 +118,3 @@ class KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper }; } - -#endif /* Keyboard_hpp */ diff --git a/Machines/Apple/ADB/Mouse.hpp b/Machines/Apple/ADB/Mouse.hpp index a085089e4..2835552d5 100644 --- a/Machines/Apple/ADB/Mouse.hpp +++ b/Machines/Apple/ADB/Mouse.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Mouse_hpp -#define Mouse_hpp +#pragma once #include "ReactiveDevice.hpp" #include "../../../Inputs/Mouse.hpp" @@ -32,5 +31,3 @@ class Mouse: public ReactiveDevice, public Inputs::Mouse { }; } - -#endif /* Mouse_hpp */ diff --git a/Machines/Apple/ADB/ReactiveDevice.hpp b/Machines/Apple/ADB/ReactiveDevice.hpp index 215a2123c..58b165163 100644 --- a/Machines/Apple/ADB/ReactiveDevice.hpp +++ b/Machines/Apple/ADB/ReactiveDevice.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef ReactiveDevice_hpp -#define ReactiveDevice_hpp +#pragma once #include "Bus.hpp" @@ -60,5 +59,3 @@ class ReactiveDevice: public Bus::Device { }; } - -#endif /* ReactiveDevice_hpp */ diff --git a/Machines/Apple/AppleII/AppleII.hpp b/Machines/Apple/AppleII/AppleII.hpp index 82feaff5b..047fa7552 100644 --- a/Machines/Apple/AppleII/AppleII.hpp +++ b/Machines/Apple/AppleII/AppleII.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef AppleII_hpp -#define AppleII_hpp +#pragma once #include "../../../Configurable/Configurable.hpp" #include "../../../Configurable/StandardOptions.hpp" @@ -42,5 +41,3 @@ class Machine { }; } - -#endif /* AppleII_hpp */ diff --git a/Machines/Apple/AppleII/AuxiliaryMemorySwitches.hpp b/Machines/Apple/AppleII/AuxiliaryMemorySwitches.hpp index 3c12a5e00..9c2e760ff 100644 --- a/Machines/Apple/AppleII/AuxiliaryMemorySwitches.hpp +++ b/Machines/Apple/AppleII/AuxiliaryMemorySwitches.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef AuxiliaryMemorySwitches_h -#define AuxiliaryMemorySwitches_h +#pragma once #include "MemorySwitches.hpp" @@ -271,5 +270,3 @@ template class AuxiliaryMemorySwitches { }; } - -#endif /* AuxiliaryMemorySwitches_h */ diff --git a/Machines/Apple/AppleII/Card.hpp b/Machines/Apple/AppleII/Card.hpp index 64f0e9c78..a5b6f0afa 100644 --- a/Machines/Apple/AppleII/Card.hpp +++ b/Machines/Apple/AppleII/Card.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Card_h -#define Card_h +#pragma once #include "../../../Processors/6502/6502.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -112,5 +111,3 @@ class Card { }; } - -#endif /* Card_h */ diff --git a/Machines/Apple/AppleII/DiskIICard.hpp b/Machines/Apple/AppleII/DiskIICard.hpp index 0d3803ba5..4048dc6b4 100644 --- a/Machines/Apple/AppleII/DiskIICard.hpp +++ b/Machines/Apple/AppleII/DiskIICard.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef DiskIICard_hpp -#define DiskIICard_hpp +#pragma once #include "Card.hpp" #include "../../ROMMachine.hpp" @@ -43,5 +42,3 @@ class DiskIICard: public Card, public ClockingHint::Observer { }; } - -#endif /* DiskIICard_hpp */ diff --git a/Machines/Apple/AppleII/Joystick.hpp b/Machines/Apple/AppleII/Joystick.hpp index d76e02f99..0f623377c 100644 --- a/Machines/Apple/AppleII/Joystick.hpp +++ b/Machines/Apple/AppleII/Joystick.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef AppleII_Joystick_hpp -#define AppleII_Joystick_hpp +#pragma once #include "../../../Inputs/Joystick.hpp" @@ -106,5 +105,3 @@ class JoystickPair { }; } - -#endif /* AppleII_Joystick_hpp */ diff --git a/Machines/Apple/AppleII/LanguageCardSwitches.hpp b/Machines/Apple/AppleII/LanguageCardSwitches.hpp index 5efddf526..12441d50f 100644 --- a/Machines/Apple/AppleII/LanguageCardSwitches.hpp +++ b/Machines/Apple/AppleII/LanguageCardSwitches.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef LanguageCardSwitches_h -#define LanguageCardSwitches_h +#pragma once #include "MemorySwitches.hpp" @@ -112,5 +111,3 @@ template class LanguageCardSwitches { }; } - -#endif /* LanguageCard_h */ diff --git a/Machines/Apple/AppleII/MemorySwitches.hpp b/Machines/Apple/AppleII/MemorySwitches.hpp index 5be77517a..4b192ddf0 100644 --- a/Machines/Apple/AppleII/MemorySwitches.hpp +++ b/Machines/Apple/AppleII/MemorySwitches.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef MemorySwitches_h -#define MemorySwitches_h +#pragma once namespace Apple::II { @@ -19,5 +18,3 @@ enum PagingType: int { }; } - -#endif /* MemorySwitches_h */ diff --git a/Machines/Apple/AppleII/SCSICard.hpp b/Machines/Apple/AppleII/SCSICard.hpp index d12d12918..40ce1a1b7 100644 --- a/Machines/Apple/AppleII/SCSICard.hpp +++ b/Machines/Apple/AppleII/SCSICard.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef SCSICard_hpp -#define SCSICard_hpp +#pragma once #include "Card.hpp" #include "../../ROMMachine.hpp" @@ -51,5 +50,3 @@ class SCSICard: public Card { }; } - -#endif /* SCSICard_hpp */ diff --git a/Machines/Apple/AppleII/Video.hpp b/Machines/Apple/AppleII/Video.hpp index ae3478928..26e230b1d 100644 --- a/Machines/Apple/AppleII/Video.hpp +++ b/Machines/Apple/AppleII/Video.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Apple_II_Video_hpp -#define Apple_II_Video_hpp +#pragma once #include "../../../Outputs/CRT/CRT.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -512,5 +511,3 @@ template class Video: public VideoBase { }; } - -#endif /* Apple_II_Video_hpp */ diff --git a/Machines/Apple/AppleII/VideoSwitches.hpp b/Machines/Apple/AppleII/VideoSwitches.hpp index c6ba9adb1..159cd0491 100644 --- a/Machines/Apple/AppleII/VideoSwitches.hpp +++ b/Machines/Apple/AppleII/VideoSwitches.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef VideoSwitches_h -#define VideoSwitches_h +#pragma once #include "../../../ClockReceiver/ClockReceiver.hpp" #include "../../../ClockReceiver/DeferredQueue.hpp" @@ -343,5 +342,3 @@ template class VideoSwitches { }; } - -#endif /* VideoSwitches_h */ diff --git a/Machines/Apple/AppleIIgs/ADB.hpp b/Machines/Apple/AppleIIgs/ADB.hpp index fb055da26..9669c0f19 100644 --- a/Machines/Apple/AppleIIgs/ADB.hpp +++ b/Machines/Apple/AppleIIgs/ADB.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef Apple_IIgs_ADB_hpp -#define Apple_IIgs_ADB_hpp +#pragma once #include #include @@ -84,5 +83,3 @@ class GLU: public InstructionSet::M50740::PortHandler { }; } - -#endif /* Apple_IIgs_ADB_hpp */ diff --git a/Machines/Apple/AppleIIgs/AppleIIgs.hpp b/Machines/Apple/AppleIIgs/AppleIIgs.hpp index 0ae1075eb..252ed1e1a 100644 --- a/Machines/Apple/AppleIIgs/AppleIIgs.hpp +++ b/Machines/Apple/AppleIIgs/AppleIIgs.hpp @@ -6,8 +6,7 @@ // Copyright 2020 Thomas Harte. All rights reserved. // -#ifndef Machines_Apple_AppleIIgs_hpp -#define Machines_Apple_AppleIIgs_hpp +#pragma once #include "../../../Configurable/Configurable.hpp" #include "../../../Configurable/StandardOptions.hpp" @@ -27,5 +26,3 @@ class Machine { }; } - -#endif /* Machines_Apple_AppleIIgs_hpp */ diff --git a/Machines/Apple/AppleIIgs/MemoryMap.hpp b/Machines/Apple/AppleIIgs/MemoryMap.hpp index 00c4a4355..795cc9e27 100644 --- a/Machines/Apple/AppleIIgs/MemoryMap.hpp +++ b/Machines/Apple/AppleIIgs/MemoryMap.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef Machines_Apple_AppleIIgs_MemoryMap_hpp -#define Machines_Apple_AppleIIgs_MemoryMap_hpp +#pragma once #include #include @@ -161,5 +160,3 @@ class MemoryMap { }; } - -#endif /* MemoryMap_h */ diff --git a/Machines/Apple/AppleIIgs/Sound.hpp b/Machines/Apple/AppleIIgs/Sound.hpp index 17d98d0e6..55c4f4c20 100644 --- a/Machines/Apple/AppleIIgs/Sound.hpp +++ b/Machines/Apple/AppleIIgs/Sound.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef Apple_IIgs_Sound_hpp -#define Apple_IIgs_Sound_hpp +#pragma once #include @@ -103,5 +102,3 @@ class GLU: public Outputs::Speaker::SampleSource { }; } - -#endif /* SoundGLU_hpp */ diff --git a/Machines/Apple/AppleIIgs/Video.cpp b/Machines/Apple/AppleIIgs/Video.cpp index 20f132f08..8602268e7 100644 --- a/Machines/Apple/AppleIIgs/Video.cpp +++ b/Machines/Apple/AppleIIgs/Video.cpp @@ -22,31 +22,31 @@ constexpr auto FinalColumn = CyclesPerLine / CyclesPerTick; // Converts from Apple's RGB ordering to this emulator's. #if TARGET_RT_BIG_ENDIAN -#define PaletteConvulve(x) uint16_t(x) +constexpr uint16_t convulve(uint16_t x) { return x; } #else -#define PaletteConvulve(x) uint16_t(((x&0xf00) >> 8) | ((x&0x0ff) << 8)) +constexpr uint16_t convulve(uint16_t x) { return uint16_t(((x&0xf00) >> 8) | ((x&0x0ff) << 8)); } #endif // The 12-bit values used by the Apple IIgs to approximate Apple II colours, // as implied by tech note #63's use of them as border colours. // http://www.1000bit.it/support/manuali/apple/technotes/iigs/tn.iigs.063.html constexpr uint16_t appleii_palette[16] = { - PaletteConvulve(0x0000), // Black. - PaletteConvulve(0x0d03), // Deep Red. - PaletteConvulve(0x0009), // Dark Blue. - PaletteConvulve(0x0d2d), // Purple. - PaletteConvulve(0x0072), // Dark Green. - PaletteConvulve(0x0555), // Dark Gray. - PaletteConvulve(0x022f), // Medium Blue. - PaletteConvulve(0x06af), // Light Blue. - PaletteConvulve(0x0850), // Brown. - PaletteConvulve(0x0f60), // Orange. - PaletteConvulve(0x0aaa), // Light Grey. - PaletteConvulve(0x0f98), // Pink. - PaletteConvulve(0x01d0), // Light Green. - PaletteConvulve(0x0ff0), // Yellow. - PaletteConvulve(0x04f9), // Aquamarine. - PaletteConvulve(0x0fff), // White. + convulve(0x0000), // Black. + convulve(0x0d03), // Deep Red. + convulve(0x0009), // Dark Blue. + convulve(0x0d2d), // Purple. + convulve(0x0072), // Dark Green. + convulve(0x0555), // Dark Gray. + convulve(0x022f), // Medium Blue. + convulve(0x06af), // Light Blue. + convulve(0x0850), // Brown. + convulve(0x0f60), // Orange. + convulve(0x0aaa), // Light Grey. + convulve(0x0f98), // Pink. + convulve(0x01d0), // Light Green. + convulve(0x0ff0), // Yellow. + convulve(0x04f9), // Aquamarine. + convulve(0x0fff), // White. }; // Reasoned guesswork ahoy! @@ -280,7 +280,7 @@ void Video::output_row(int row, int start, int end) { const int palette_base = (line_control_ & 15) * 32 + 0x19e00; for(int c = 0; c < 16; c++) { const int entry = ram_[palette_base + (c << 1)] | (ram_[palette_base + (c << 1) + 1] << 8); - palette_[c] = PaletteConvulve(entry); + palette_[c] = convulve(entry); } // Post an interrupt if requested. diff --git a/Machines/Apple/AppleIIgs/Video.hpp b/Machines/Apple/AppleIIgs/Video.hpp index 5933fa99f..5219cffaa 100644 --- a/Machines/Apple/AppleIIgs/Video.hpp +++ b/Machines/Apple/AppleIIgs/Video.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef Apple_IIgs_Video_hpp -#define Apple_IIgs_Video_hpp +#pragma once #include "../AppleII/VideoSwitches.hpp" #include "../../../Outputs/CRT/CRT.hpp" @@ -252,6 +251,3 @@ class Video: public Apple::II::VideoSwitches { }; } - -#endif /* Video_hpp */ - diff --git a/Machines/Apple/Macintosh/Audio.hpp b/Machines/Apple/Macintosh/Audio.hpp index 457bec6b0..e132015e0 100644 --- a/Machines/Apple/Macintosh/Audio.hpp +++ b/Machines/Apple/Macintosh/Audio.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Audio_hpp -#define Audio_hpp +#pragma once #include "../../../Concurrency/AsyncTaskQueue.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -83,5 +82,3 @@ class Audio: public ::Outputs::Speaker::SampleSource { }; } - -#endif /* Audio_hpp */ diff --git a/Machines/Apple/Macintosh/DeferredAudio.hpp b/Machines/Apple/Macintosh/DeferredAudio.hpp index 395632f14..95e13b3c1 100644 --- a/Machines/Apple/Macintosh/DeferredAudio.hpp +++ b/Machines/Apple/Macintosh/DeferredAudio.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef DeferredAudio_h -#define DeferredAudio_h +#pragma once #include "Audio.hpp" #include "../../../Outputs/Speaker/Implementation/LowpassSpeaker.hpp" @@ -28,5 +27,3 @@ struct DeferredAudio { }; } - -#endif /* DeferredAudio_h */ diff --git a/Machines/Apple/Macintosh/DriveSpeedAccumulator.hpp b/Machines/Apple/Macintosh/DriveSpeedAccumulator.hpp index 815e354f5..981f0b923 100644 --- a/Machines/Apple/Macintosh/DriveSpeedAccumulator.hpp +++ b/Machines/Apple/Macintosh/DriveSpeedAccumulator.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef DriveSpeedAccumulator_hpp -#define DriveSpeedAccumulator_hpp +#pragma once #include #include @@ -40,5 +39,3 @@ class DriveSpeedAccumulator { }; } - -#endif /* DriveSpeedAccumulator_hpp */ diff --git a/Machines/Apple/Macintosh/Keyboard.hpp b/Machines/Apple/Macintosh/Keyboard.hpp index 9f77eb348..2efd603c4 100644 --- a/Machines/Apple/Macintosh/Keyboard.hpp +++ b/Machines/Apple/Macintosh/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Apple_Macintosh_Keyboard_hpp -#define Apple_Macintosh_Keyboard_hpp +#pragma once #include "../../KeyboardMachine.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -294,5 +293,3 @@ class KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper }; } - -#endif /* Apple_Macintosh_Keyboard_hpp */ diff --git a/Machines/Apple/Macintosh/Macintosh.hpp b/Machines/Apple/Macintosh/Macintosh.hpp index 1676b1cd5..d2b654690 100644 --- a/Machines/Apple/Macintosh/Macintosh.hpp +++ b/Machines/Apple/Macintosh/Macintosh.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Macintosh_hpp -#define Macintosh_hpp +#pragma once #include "../../../Configurable/Configurable.hpp" #include "../../../Configurable/StandardOptions.hpp" @@ -36,5 +35,3 @@ class Machine { }; } - -#endif /* Macintosh_hpp */ diff --git a/Machines/Apple/Macintosh/Video.hpp b/Machines/Apple/Macintosh/Video.hpp index 6f60cbc1a..6f0ed7658 100644 --- a/Machines/Apple/Macintosh/Video.hpp +++ b/Machines/Apple/Macintosh/Video.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Video_hpp -#define Video_hpp +#pragma once #include "../../../Outputs/CRT/CRT.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -102,5 +101,3 @@ class Video { }; } - -#endif /* Video_hpp */ diff --git a/Machines/Atari/2600/Atari2600.hpp b/Machines/Atari/2600/Atari2600.hpp index 16fb6d2a5..4c39051a9 100644 --- a/Machines/Atari/2600/Atari2600.hpp +++ b/Machines/Atari/2600/Atari2600.hpp @@ -6,8 +6,7 @@ // Copyright 2015 Thomas Harte. All rights reserved. // -#ifndef Atari2600_cpp -#define Atari2600_cpp +#pragma once #include "../../../Configurable/Configurable.hpp" #include "../../../Analyser/Static/StaticAnalyser.hpp" @@ -40,5 +39,3 @@ class Machine { }; } - -#endif /* Atari2600_cpp */ diff --git a/Machines/Atari/2600/Atari2600Inputs.h b/Machines/Atari/2600/Atari2600Inputs.h index 84103cc39..b4fe86ccd 100644 --- a/Machines/Atari/2600/Atari2600Inputs.h +++ b/Machines/Atari/2600/Atari2600Inputs.h @@ -6,8 +6,7 @@ // Copyright 2015 Thomas Harte. All rights reserved. // -#ifndef Atari2600Inputs_h -#define Atari2600Inputs_h +#pragma once #ifdef __cplusplus extern "C" { @@ -38,5 +37,3 @@ typedef enum { #ifdef __cplusplus } #endif - -#endif /* Atari2600Inputs_h */ diff --git a/Machines/Atari/2600/Bus.hpp b/Machines/Atari/2600/Bus.hpp index 3fcc6f095..80e3f8354 100644 --- a/Machines/Atari/2600/Bus.hpp +++ b/Machines/Atari/2600/Bus.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_Bus_hpp -#define Atari2600_Bus_hpp +#pragma once #include "Atari2600.hpp" #include "PIA.hpp" @@ -67,5 +66,3 @@ class Bus { }; } - -#endif /* Atari2600_Bus_hpp */ diff --git a/Machines/Atari/2600/Cartridges/ActivisionStack.hpp b/Machines/Atari/2600/Cartridges/ActivisionStack.hpp index 6fcc46712..6eca92fb8 100644 --- a/Machines/Atari/2600/Cartridges/ActivisionStack.hpp +++ b/Machines/Atari/2600/Cartridges/ActivisionStack.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_ActivisionStack_hpp -#define Atari2600_ActivisionStack_hpp +#pragma once namespace Atari2600::Cartridge { @@ -45,5 +44,3 @@ class ActivisionStack: public BusExtender { }; } - -#endif /* Atari2600_CartridgeActivisionStack_hpp */ diff --git a/Machines/Atari/2600/Cartridges/Atari16k.hpp b/Machines/Atari/2600/Cartridges/Atari16k.hpp index b99381305..325e79efd 100644 --- a/Machines/Atari/2600/Cartridges/Atari16k.hpp +++ b/Machines/Atari/2600/Cartridges/Atari16k.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeAtari16k_hpp -#define Atari2600_CartridgeAtari16k_hpp +#pragma once #include "Cartridge.hpp" @@ -60,5 +59,3 @@ class Atari16kSuperChip: public BusExtender { }; } - -#endif /* Atari2600_CartridgeAtari16k_hpp */ diff --git a/Machines/Atari/2600/Cartridges/Atari32k.hpp b/Machines/Atari/2600/Cartridges/Atari32k.hpp index dba8c9a7b..e130f1a2c 100644 --- a/Machines/Atari/2600/Cartridges/Atari32k.hpp +++ b/Machines/Atari/2600/Cartridges/Atari32k.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeAtari32k_hpp -#define Atari2600_CartridgeAtari32k_hpp +#pragma once #include "Cartridge.hpp" @@ -56,5 +55,3 @@ class Atari32kSuperChip: public BusExtender { }; } - -#endif /* Atari2600_CartridgeAtari32k_hpp */ diff --git a/Machines/Atari/2600/Cartridges/Atari8k.hpp b/Machines/Atari/2600/Cartridges/Atari8k.hpp index 5fe346734..03987d022 100644 --- a/Machines/Atari/2600/Cartridges/Atari8k.hpp +++ b/Machines/Atari/2600/Cartridges/Atari8k.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeAtari8k_hpp -#define Atari2600_CartridgeAtari8k_hpp +#pragma once #include "Cartridge.hpp" @@ -58,5 +57,3 @@ class Atari8kSuperChip: public BusExtender { }; } - -#endif /* Atari2600_CartridgeAtari8k_hpp */ diff --git a/Machines/Atari/2600/Cartridges/CBSRAMPlus.hpp b/Machines/Atari/2600/Cartridges/CBSRAMPlus.hpp index 4c064f3ef..3fd9586b4 100644 --- a/Machines/Atari/2600/Cartridges/CBSRAMPlus.hpp +++ b/Machines/Atari/2600/Cartridges/CBSRAMPlus.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeCBSRAMPlus_hpp -#define Atari2600_CartridgeCBSRAMPlus_hpp +#pragma once #include "Cartridge.hpp" @@ -37,5 +36,3 @@ class CBSRAMPlus: public BusExtender { }; } - -#endif /* Atari2600_CartridgeCBSRAMPlus_hpp */ diff --git a/Machines/Atari/2600/Cartridges/Cartridge.hpp b/Machines/Atari/2600/Cartridges/Cartridge.hpp index a2c6538da..bec59ffaf 100644 --- a/Machines/Atari/2600/Cartridges/Cartridge.hpp +++ b/Machines/Atari/2600/Cartridges/Cartridge.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_Cartridge_hpp -#define Atari2600_Cartridge_hpp +#pragma once #include "../../../../Processors/6502/6502.hpp" #include "../Bus.hpp" @@ -214,5 +213,3 @@ template class Cartridge: }; } - -#endif /* Atari2600_Cartridge_hpp */ diff --git a/Machines/Atari/2600/Cartridges/CommaVid.hpp b/Machines/Atari/2600/Cartridges/CommaVid.hpp index d6c576387..0be7f5919 100644 --- a/Machines/Atari/2600/Cartridges/CommaVid.hpp +++ b/Machines/Atari/2600/Cartridges/CommaVid.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeCommaVid_hpp -#define Atari2600_CartridgeCommaVid_hpp +#pragma once #include "Cartridge.hpp" @@ -39,5 +38,3 @@ class CommaVid: public BusExtender { }; } - -#endif /* Atari2600_CartridgeCommaVid_hpp */ diff --git a/Machines/Atari/2600/Cartridges/MNetwork.hpp b/Machines/Atari/2600/Cartridges/MNetwork.hpp index c85b854a3..06a6972c0 100644 --- a/Machines/Atari/2600/Cartridges/MNetwork.hpp +++ b/Machines/Atari/2600/Cartridges/MNetwork.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeMNetwork_hpp -#define Atari2600_CartridgeMNetwork_hpp +#pragma once #include "Cartridge.hpp" @@ -63,5 +62,3 @@ class MNetwork: public BusExtender { }; } - -#endif /* Atari2600_CartridgeMNetwork_hpp */ diff --git a/Machines/Atari/2600/Cartridges/MegaBoy.hpp b/Machines/Atari/2600/Cartridges/MegaBoy.hpp index b00ab909d..fcc021980 100644 --- a/Machines/Atari/2600/Cartridges/MegaBoy.hpp +++ b/Machines/Atari/2600/Cartridges/MegaBoy.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeMegaBoy_hpp -#define Atari2600_CartridgeMegaBoy_hpp +#pragma once #include "Cartridge.hpp" @@ -41,5 +40,3 @@ class MegaBoy: public BusExtender { }; } - -#endif /* CartridgeMegaBoy_h */ diff --git a/Machines/Atari/2600/Cartridges/ParkerBros.hpp b/Machines/Atari/2600/Cartridges/ParkerBros.hpp index 9e3c9ee5d..39ce52893 100644 --- a/Machines/Atari/2600/Cartridges/ParkerBros.hpp +++ b/Machines/Atari/2600/Cartridges/ParkerBros.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeParkerBros_hpp -#define Atari2600_CartridgeParkerBros_hpp +#pragma once #include "Cartridge.hpp" @@ -42,5 +41,3 @@ class ParkerBros: public BusExtender { }; } - -#endif /* Atari2600_CartridgeParkerBros_hpp */ diff --git a/Machines/Atari/2600/Cartridges/Pitfall2.hpp b/Machines/Atari/2600/Cartridges/Pitfall2.hpp index 35e7236bf..c28da6433 100644 --- a/Machines/Atari/2600/Cartridges/Pitfall2.hpp +++ b/Machines/Atari/2600/Cartridges/Pitfall2.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgePitfall2_hpp -#define Atari2600_CartridgePitfall2_hpp +#pragma once namespace Atari2600::Cartridge { @@ -123,5 +122,3 @@ class Pitfall2: public BusExtender { }; } - -#endif /* Atari2600_CartridgePitfall2_hpp */ diff --git a/Machines/Atari/2600/Cartridges/Tigervision.hpp b/Machines/Atari/2600/Cartridges/Tigervision.hpp index c9fa9856e..ac21071e0 100644 --- a/Machines/Atari/2600/Cartridges/Tigervision.hpp +++ b/Machines/Atari/2600/Cartridges/Tigervision.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeTigervision_hpp -#define Atari2600_CartridgeTigervision_hpp +#pragma once #include "Cartridge.hpp" @@ -36,5 +35,3 @@ class Tigervision: public BusExtender { }; } - -#endif /* Atari2600_CartridgeTigervision_hpp */ diff --git a/Machines/Atari/2600/Cartridges/Unpaged.hpp b/Machines/Atari/2600/Cartridges/Unpaged.hpp index fbf192f78..f778d3f1b 100644 --- a/Machines/Atari/2600/Cartridges/Unpaged.hpp +++ b/Machines/Atari/2600/Cartridges/Unpaged.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Atari2600_CartridgeUnpaged_hpp -#define Atari2600_CartridgeUnpaged_hpp +#pragma once #include "Cartridge.hpp" @@ -25,5 +24,3 @@ class Unpaged: public BusExtender { }; } - -#endif /* Atari2600_CartridgeUnpaged_hpp */ diff --git a/Machines/Atari/2600/PIA.hpp b/Machines/Atari/2600/PIA.hpp index 61074eb0f..b25cf52d5 100644 --- a/Machines/Atari/2600/PIA.hpp +++ b/Machines/Atari/2600/PIA.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Atari2600_PIA_h -#define Atari2600_PIA_h +#pragma once #include @@ -36,5 +35,3 @@ class PIA: public MOS::MOS6532 { }; } - -#endif /* PIA_h */ diff --git a/Machines/Atari/2600/TIA.hpp b/Machines/Atari/2600/TIA.hpp index a17736a4d..71ba63286 100644 --- a/Machines/Atari/2600/TIA.hpp +++ b/Machines/Atari/2600/TIA.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef TIA_hpp -#define TIA_hpp +#pragma once #include #include @@ -313,5 +312,3 @@ class TIA { }; } - -#endif /* TIA_hpp */ diff --git a/Machines/Atari/2600/TIASound.hpp b/Machines/Atari/2600/TIASound.hpp index 9688e7310..67976be58 100644 --- a/Machines/Atari/2600/TIASound.hpp +++ b/Machines/Atari/2600/TIASound.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Atari2600_TIASound_hpp -#define Atari2600_TIASound_hpp +#pragma once #include "../../../Outputs/Speaker/Implementation/SampleSource.hpp" #include "../../../Concurrency/AsyncTaskQueue.hpp" @@ -48,5 +47,3 @@ class TIASound: public Outputs::Speaker::SampleSource { }; } - -#endif /* Speaker_hpp */ diff --git a/Machines/Atari/ST/AtariST.hpp b/Machines/Atari/ST/AtariST.hpp index 9ed5747b1..bdfff3bd2 100644 --- a/Machines/Atari/ST/AtariST.hpp +++ b/Machines/Atari/ST/AtariST.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef AtariST_hpp -#define AtariST_hpp +#pragma once #include "../../../Configurable/Configurable.hpp" #include "../../../Configurable/StandardOptions.hpp" @@ -38,5 +37,3 @@ class Machine { }; } - -#endif /* AtariST_hpp */ diff --git a/Machines/Atari/ST/DMAController.cpp b/Machines/Atari/ST/DMAController.cpp index 104d5efc5..e17618746 100644 --- a/Machines/Atari/ST/DMAController.cpp +++ b/Machines/Atari/ST/DMAController.cpp @@ -191,10 +191,10 @@ int DMAController::bus_grant(uint16_t *ram, size_t size) { // Check that the older buffer is full; stop if not. if(!buffer_[active_buffer_ ^ 1].is_full) return 0; -#define b(i, n) " " << PADHEX(2) << int(buffer_[i].contents[n]) -#define b2(i, n) b(i, n) << b(i, n+1) -#define b4(i, n) b2(i, n) << b2(i, n+2) -#define b16(i) b4(i, 0) << b4(i, 4) << b4(i, 8) << b4(i, 12) +//#define b(i, n) " " << PADHEX(2) << int(buffer_[i].contents[n]) +//#define b2(i, n) b(i, n) << b(i, n+1) +//#define b4(i, n) b2(i, n) << b2(i, n+2) +//#define b16(i) b4(i, 0) << b4(i, 4) << b4(i, 8) << b4(i, 12) // LOG("[1] to " << PADHEX(6) << address_ << b16(active_buffer_ ^ 1)); for(int c = 0; c < 8; ++c) { @@ -212,10 +212,10 @@ int DMAController::bus_grant(uint16_t *ram, size_t size) { if(!buffer_[active_buffer_ ].is_full) return 8; // LOG("[2] to " << PADHEX(6) << address_ << b16(active_buffer_)); -#undef b16 -#undef b4 -#undef b2 -#undef b +//#undef b16 +//#undef b4 +//#undef b2 +//#undef b for(int c = 0; c < 8; ++c) { if(size_t(address_) < size) { diff --git a/Machines/Atari/ST/DMAController.hpp b/Machines/Atari/ST/DMAController.hpp index 8eeb5f202..ab4280595 100644 --- a/Machines/Atari/ST/DMAController.hpp +++ b/Machines/Atari/ST/DMAController.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef DMAController_hpp -#define DMAController_hpp +#pragma once #include #include @@ -110,5 +109,3 @@ class DMAController: public WD::WD1770::Delegate, public ClockingHint::Source, p }; } - -#endif /* DMAController_hpp */ diff --git a/Machines/Atari/ST/IntelligentKeyboard.hpp b/Machines/Atari/ST/IntelligentKeyboard.hpp index 8599ecf19..440590229 100644 --- a/Machines/Atari/ST/IntelligentKeyboard.hpp +++ b/Machines/Atari/ST/IntelligentKeyboard.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef IntelligentKeyboard_hpp -#define IntelligentKeyboard_hpp +#pragma once #include "../../../ClockReceiver/ClockingHintSource.hpp" #include "../../../Components/Serial/Line.hpp" @@ -196,5 +195,3 @@ class IntelligentKeyboard: }; } - -#endif /* IntelligentKeyboard_hpp */ diff --git a/Machines/Atari/ST/Video.hpp b/Machines/Atari/ST/Video.hpp index 27b2e621f..dc3184073 100644 --- a/Machines/Atari/ST/Video.hpp +++ b/Machines/Atari/ST/Video.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Atari_ST_Video_hpp -#define Atari_ST_Video_hpp +#pragma once #include "../../../Outputs/CRT/CRT.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -249,5 +248,3 @@ class Video { }; } - -#endif /* Atari_ST_Video_hpp */ diff --git a/Machines/AudioProducer.hpp b/Machines/AudioProducer.hpp index 471275a74..0d5ad5dc3 100644 --- a/Machines/AudioProducer.hpp +++ b/Machines/AudioProducer.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef AudioProducer_h -#define AudioProducer_h +#pragma once #include "../Outputs/Speaker/Speaker.hpp" @@ -23,5 +22,3 @@ class AudioProducer { }; } - -#endif /* AudioProducer_h */ diff --git a/Machines/ColecoVision/ColecoVision.hpp b/Machines/ColecoVision/ColecoVision.hpp index 1ea2a208f..b8b8609b2 100644 --- a/Machines/ColecoVision/ColecoVision.hpp +++ b/Machines/ColecoVision/ColecoVision.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef ColecoVision_hpp -#define ColecoVision_hpp +#pragma once #include "../../Configurable/Configurable.hpp" #include "../../Configurable/StandardOptions.hpp" @@ -37,5 +36,3 @@ class Machine { }; } - -#endif /* ColecoVision_hpp */ diff --git a/Machines/Commodore/1540/C1540.hpp b/Machines/Commodore/1540/C1540.hpp index 52602f9da..47f8cf726 100644 --- a/Machines/Commodore/1540/C1540.hpp +++ b/Machines/Commodore/1540/C1540.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Commodore1540_hpp -#define Commodore1540_hpp +#pragma once namespace Commodore::C1540 { @@ -54,5 +53,3 @@ class Machine final: public MachineBase { }; } - -#endif /* Commodore1540_hpp */ diff --git a/Machines/Commodore/1540/Implementation/C1540Base.hpp b/Machines/Commodore/1540/Implementation/C1540Base.hpp index db295f499..ecb9c879a 100644 --- a/Machines/Commodore/1540/Implementation/C1540Base.hpp +++ b/Machines/Commodore/1540/Implementation/C1540Base.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef C1540Base_hpp -#define C1540Base_hpp +#pragma once #include "../../../../Processors/6502/6502.hpp" #include "../../../../Components/6522/6522.hpp" @@ -160,5 +159,3 @@ class MachineBase: }; } - -#endif /* C1540Base_hpp */ diff --git a/Machines/Commodore/SerialBus.hpp b/Machines/Commodore/SerialBus.hpp index f62cc0e75..2e7b1fd7e 100644 --- a/Machines/Commodore/SerialBus.hpp +++ b/Machines/Commodore/SerialBus.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef SerialBus_hpp -#define SerialBus_hpp +#pragma once #include #include @@ -127,5 +126,3 @@ namespace Commodore::Serial { }; } - -#endif /* SerialPort_hpp */ diff --git a/Machines/Commodore/Vic-20/Keyboard.hpp b/Machines/Commodore/Vic-20/Keyboard.hpp index 092267ebb..30432ae33 100644 --- a/Machines/Commodore/Vic-20/Keyboard.hpp +++ b/Machines/Commodore/Vic-20/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Machines_Commodore_Vic20_Keyboard_hpp -#define Machines_Commodore_Vic20_Keyboard_hpp +#pragma once #include "../../KeyboardMachine.hpp" #include "../../Utility/Typer.hpp" @@ -55,5 +54,3 @@ struct CharacterMapper: public ::Utility::CharacterMapper { }; } - -#endif /* Keyboard_hpp */ diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp index 59c5dec28..6a59ced92 100644 --- a/Machines/Commodore/Vic-20/Vic20.hpp +++ b/Machines/Commodore/Vic-20/Vic20.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Vic20_hpp -#define Vic20_hpp +#pragma once #include "../../../Configurable/Configurable.hpp" #include "../../../Configurable/StandardOptions.hpp" @@ -45,5 +44,3 @@ class Machine { }; } - -#endif /* Vic20_hpp */ diff --git a/Machines/DynamicMachine.hpp b/Machines/DynamicMachine.hpp index 6f347c570..cc9aa92c7 100644 --- a/Machines/DynamicMachine.hpp +++ b/Machines/DynamicMachine.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef DynamicMachine_h -#define DynamicMachine_h +#pragma once #include "../Configurable/Configurable.hpp" #include "../Activity/Source.hpp" @@ -70,5 +69,3 @@ SpecialisedGet(MachineTypes::MediaTarget, media_target) #undef SpecialisedGet } - -#endif /* DynamicMachine_h */ diff --git a/Machines/Electron/Electron.hpp b/Machines/Electron/Electron.hpp index 0996b1c83..7f4cb6735 100644 --- a/Machines/Electron/Electron.hpp +++ b/Machines/Electron/Electron.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Electron_hpp -#define Electron_hpp +#pragma once #include "../../Configurable/Configurable.hpp" #include "../../Configurable/StandardOptions.hpp" @@ -49,5 +48,3 @@ class Machine { }; } - -#endif /* Electron_hpp */ diff --git a/Machines/Electron/Interrupts.hpp b/Machines/Electron/Interrupts.hpp index ca016897b..ac491521b 100644 --- a/Machines/Electron/Interrupts.hpp +++ b/Machines/Electron/Interrupts.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Interrupts_h -#define Interrupts_h +#pragma once #include @@ -23,5 +22,3 @@ enum Interrupt: uint8_t { }; } - -#endif /* Interrupts_h */ diff --git a/Machines/Electron/Keyboard.hpp b/Machines/Electron/Keyboard.hpp index 3583bd55d..c2093d9d3 100644 --- a/Machines/Electron/Keyboard.hpp +++ b/Machines/Electron/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Machines_Electron_Keyboard_hpp -#define Machines_Electron_Keyboard_hpp +#pragma once #include "../KeyboardMachine.hpp" #include "../Utility/Typer.hpp" @@ -52,5 +51,3 @@ struct CharacterMapper: public ::Utility::CharacterMapper { }; }; - -#endif /* KeyboardMapper_hpp */ diff --git a/Machines/Electron/Plus3.hpp b/Machines/Electron/Plus3.hpp index 8f326c682..60cdd81dd 100644 --- a/Machines/Electron/Plus3.hpp +++ b/Machines/Electron/Plus3.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Plus3_hpp -#define Plus3_hpp +#pragma once #include "../../Components/1770/1770.hpp" #include "../../Activity/Observer.hpp" @@ -31,6 +30,3 @@ class Plus3 final : public WD::WD1770 { }; } - -#endif /* Plus3_hpp */ - diff --git a/Machines/Electron/SoundGenerator.hpp b/Machines/Electron/SoundGenerator.hpp index d924fdef1..32cd04074 100644 --- a/Machines/Electron/SoundGenerator.hpp +++ b/Machines/Electron/SoundGenerator.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Electron_SoundGenerator_hpp -#define Electron_SoundGenerator_hpp +#pragma once #include "../../Outputs/Speaker/Implementation/SampleSource.hpp" #include "../../Concurrency/AsyncTaskQueue.hpp" @@ -39,5 +38,3 @@ class SoundGenerator: public ::Outputs::Speaker::SampleSource { }; } - -#endif /* Speaker_hpp */ diff --git a/Machines/Electron/Tape.hpp b/Machines/Electron/Tape.hpp index 3dbc030bc..28bb80a73 100644 --- a/Machines/Electron/Tape.hpp +++ b/Machines/Electron/Tape.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Electron_Tape_h -#define Electron_Tape_h +#pragma once #include @@ -74,5 +73,3 @@ class Tape: }; } - -#endif /* Electron_Tape_h */ diff --git a/Machines/Electron/Video.hpp b/Machines/Electron/Video.hpp index baf2e02e1..e8f911fb4 100644 --- a/Machines/Electron/Video.hpp +++ b/Machines/Electron/Video.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Machines_Electron_Video_hpp -#define Machines_Electron_Video_hpp +#pragma once #include "../../Outputs/CRT/CRT.hpp" #include "../../ClockReceiver/ClockReceiver.hpp" @@ -137,5 +136,3 @@ class VideoOutput { }; } - -#endif /* Video_hpp */ diff --git a/Machines/Enterprise/Dave.hpp b/Machines/Enterprise/Dave.hpp index 69a1449a9..21c08cfe8 100644 --- a/Machines/Enterprise/Dave.hpp +++ b/Machines/Enterprise/Dave.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Dave_hpp -#define Dave_hpp +#pragma once #include @@ -182,5 +181,3 @@ class TimedInterruptSource { }; } - -#endif /* Dave_hpp */ diff --git a/Machines/Enterprise/EXDos.hpp b/Machines/Enterprise/EXDos.hpp index 33553be6a..165adfcb0 100644 --- a/Machines/Enterprise/EXDos.hpp +++ b/Machines/Enterprise/EXDos.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef EXDos_hpp -#define EXDos_hpp +#pragma once #include "../../Components/1770/1770.hpp" #include "../../Activity/Observer.hpp" @@ -32,5 +31,3 @@ class EXDos final : public WD::WD1770 { }; } - -#endif /* EXDos_hpp */ diff --git a/Machines/Enterprise/Enterprise.hpp b/Machines/Enterprise/Enterprise.hpp index 86d16f606..c7b7afb5a 100644 --- a/Machines/Enterprise/Enterprise.hpp +++ b/Machines/Enterprise/Enterprise.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Enterprise_hpp -#define Enterprise_hpp +#pragma once #include "../../Analyser/Static/StaticAnalyser.hpp" #include "../../Configurable/Configurable.hpp" @@ -44,5 +43,3 @@ class Machine { }; }; - -#endif /* Enterprise_hpp */ diff --git a/Machines/Enterprise/Keyboard.hpp b/Machines/Enterprise/Keyboard.hpp index 571f0a23c..6496e72be 100644 --- a/Machines/Enterprise/Keyboard.hpp +++ b/Machines/Enterprise/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Machines_Enterprise_Keyboard_hpp -#define Machines_Enterprise_Keyboard_hpp +#pragma once #include "../KeyboardMachine.hpp" #include "../Utility/Typer.hpp" @@ -62,5 +61,3 @@ struct CharacterMapper: public ::Utility::CharacterMapper { }; } - -#endif /* Keyboard_hpp */ diff --git a/Machines/Enterprise/Nick.hpp b/Machines/Enterprise/Nick.hpp index 393928abb..1d790c67d 100644 --- a/Machines/Enterprise/Nick.hpp +++ b/Machines/Enterprise/Nick.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Nick_hpp -#define Nick_hpp +#pragma once #include #include "../../ClockReceiver/ClockReceiver.hpp" @@ -120,7 +119,4 @@ class Nick { template void output_attributed(uint16_t *target, int columns) const; }; - } - -#endif /* Nick_hpp */ diff --git a/Machines/JoystickMachine.hpp b/Machines/JoystickMachine.hpp index 4a4c754dc..b7712b778 100644 --- a/Machines/JoystickMachine.hpp +++ b/Machines/JoystickMachine.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef JoystickMachine_hpp -#define JoystickMachine_hpp +#pragma once #include "../Inputs/Joystick.hpp" #include @@ -20,5 +19,3 @@ class JoystickMachine { }; } - -#endif /* JoystickMachine_hpp */ diff --git a/Machines/KeyboardMachine.hpp b/Machines/KeyboardMachine.hpp index 57e655112..ee313fc8e 100644 --- a/Machines/KeyboardMachine.hpp +++ b/Machines/KeyboardMachine.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef KeyboardMachine_h -#define KeyboardMachine_h +#pragma once #include #include @@ -153,5 +152,3 @@ class MappedKeyboardMachine: public Inputs::Keyboard::Delegate, public KeyboardM }; } - -#endif /* KeyboardMachine_h */ diff --git a/Machines/MSX/Cartridges/ASCII16kb.hpp b/Machines/MSX/Cartridges/ASCII16kb.hpp index 170cd3ac6..8eeb1e8dc 100644 --- a/Machines/MSX/Cartridges/ASCII16kb.hpp +++ b/Machines/MSX/Cartridges/ASCII16kb.hpp @@ -6,13 +6,11 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef ASCII16kb_hpp -#define ASCII16kb_hpp +#pragma once #include "../MemorySlotHandler.hpp" -namespace MSX { -namespace Cartridge { +namespace MSX::Cartridge { class ASCII16kbROMSlotHandler: public MemorySlotHandler { public: @@ -47,6 +45,3 @@ class ASCII16kbROMSlotHandler: public MemorySlotHandler { }; } -} - -#endif /* ASCII16kb_hpp */ diff --git a/Machines/MSX/Cartridges/ASCII8kb.hpp b/Machines/MSX/Cartridges/ASCII8kb.hpp index 16deddbe3..60b4d0d6d 100644 --- a/Machines/MSX/Cartridges/ASCII8kb.hpp +++ b/Machines/MSX/Cartridges/ASCII8kb.hpp @@ -6,13 +6,11 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef ASCII8kb_hpp -#define ASCII8kb_hpp +#pragma once #include "../MemorySlotHandler.hpp" -namespace MSX { -namespace Cartridge { +namespace MSX::Cartridge { class ASCII8kbROMSlotHandler: public MemorySlotHandler { public: @@ -59,6 +57,3 @@ class ASCII8kbROMSlotHandler: public MemorySlotHandler { }; } -} - -#endif /* ASCII8kb_hpp */ diff --git a/Machines/MSX/Cartridges/Konami.hpp b/Machines/MSX/Cartridges/Konami.hpp index 18837dc9e..fde8be9b9 100644 --- a/Machines/MSX/Cartridges/Konami.hpp +++ b/Machines/MSX/Cartridges/Konami.hpp @@ -6,13 +6,11 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Konami_hpp -#define Konami_hpp +#pragma once #include "../MemorySlotHandler.hpp" -namespace MSX { -namespace Cartridge { +namespace MSX::Cartridge { class KonamiROMSlotHandler: public MemorySlotHandler { public: @@ -52,6 +50,3 @@ class KonamiROMSlotHandler: public MemorySlotHandler { }; } -} - -#endif /* Konami_hpp */ diff --git a/Machines/MSX/Cartridges/KonamiWithSCC.hpp b/Machines/MSX/Cartridges/KonamiWithSCC.hpp index 7f1e8dc16..8fb22752f 100644 --- a/Machines/MSX/Cartridges/KonamiWithSCC.hpp +++ b/Machines/MSX/Cartridges/KonamiWithSCC.hpp @@ -6,14 +6,12 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef KonamiWithSCC_hpp -#define KonamiWithSCC_hpp +#pragma once #include "../MemorySlotHandler.hpp" #include "../../../Components/KonamiSCC/KonamiSCC.hpp" -namespace MSX { -namespace Cartridge { +namespace MSX::Cartridge { class KonamiWithSCCROMSlotHandler: public MemorySlotHandler { public: @@ -86,6 +84,3 @@ class KonamiWithSCCROMSlotHandler: public MemorySlotHandler { }; } -} - -#endif /* KonamiWithSCC_hpp */ diff --git a/Machines/MSX/DiskROM.hpp b/Machines/MSX/DiskROM.hpp index 7d776b83f..1738f24d2 100644 --- a/Machines/MSX/DiskROM.hpp +++ b/Machines/MSX/DiskROM.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef DiskROM_hpp -#define DiskROM_hpp +#pragma once #include "MemorySlotHandler.hpp" @@ -41,5 +40,3 @@ class DiskROM: public MemorySlotHandler, public WD::WD1770 { }; } - -#endif /* DiskROM_hpp */ diff --git a/Machines/MSX/Keyboard.hpp b/Machines/MSX/Keyboard.hpp index 445a1a1f0..6aef9a189 100644 --- a/Machines/MSX/Keyboard.hpp +++ b/Machines/MSX/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Machines_MSX_Keyboard_hpp -#define Machines_MSX_Keyboard_hpp +#pragma once #include "../KeyboardMachine.hpp" @@ -37,6 +36,4 @@ struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMappe uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const final; }; -}; - -#endif /* Machines_MSX_Keyboard_hpp */ +} diff --git a/Machines/MSX/MSX.hpp b/Machines/MSX/MSX.hpp index fe6507e15..55b29516b 100644 --- a/Machines/MSX/MSX.hpp +++ b/Machines/MSX/MSX.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef MSX_hpp -#define MSX_hpp +#pragma once #include "../../Configurable/Configurable.hpp" #include "../../Configurable/StandardOptions.hpp" @@ -39,5 +38,3 @@ class Machine { }; } - -#endif /* MSX_hpp */ diff --git a/Machines/MSX/MemorySlotHandler.hpp b/Machines/MSX/MemorySlotHandler.hpp index 49f58ab09..2b26ff646 100644 --- a/Machines/MSX/MemorySlotHandler.hpp +++ b/Machines/MSX/MemorySlotHandler.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef MemorySlotHandler_hpp -#define MemorySlotHandler_hpp +#pragma once #include "../../ClockReceiver/ClockReceiver.hpp" #include "../../Analyser/Dynamic/ConfidenceCounter.hpp" @@ -147,5 +146,3 @@ class MemorySlotHandler { }; } - -#endif /* MemorySlotHandler_hpp */ diff --git a/Machines/MachineTypes.hpp b/Machines/MachineTypes.hpp index f19e18d3a..fd7a8300a 100644 --- a/Machines/MachineTypes.hpp +++ b/Machines/MachineTypes.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef MachineTypes_h -#define MachineTypes_h +#pragma once // Rounds up everything in the MachineTypes namespace, all being // optional (at least, semantically) interfaces that machines @@ -22,5 +21,3 @@ #include "ScanProducer.hpp" #include "StateProducer.hpp" #include "TimedMachine.hpp" - -#endif /* MachineTypes_h */ diff --git a/Machines/MasterSystem/MasterSystem.hpp b/Machines/MasterSystem/MasterSystem.hpp index 34960578c..aa0309796 100644 --- a/Machines/MasterSystem/MasterSystem.hpp +++ b/Machines/MasterSystem/MasterSystem.hpp @@ -6,8 +6,7 @@ // Copyright © 2018 Thomas Harte. All rights reserved. // -#ifndef MasterSystem_hpp -#define MasterSystem_hpp +#pragma once #include "../../Configurable/Configurable.hpp" #include "../../Configurable/StandardOptions.hpp" @@ -36,5 +35,3 @@ class Machine { }; } - -#endif /* MasterSystem_hpp */ diff --git a/Machines/MediaTarget.hpp b/Machines/MediaTarget.hpp index 70471ce41..f10586c3a 100644 --- a/Machines/MediaTarget.hpp +++ b/Machines/MediaTarget.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef MediaTarget_hpp -#define MediaTarget_hpp +#pragma once #include "../Analyser/Static/StaticAnalyser.hpp" #include "../Configurable/Configurable.hpp" @@ -30,5 +29,3 @@ class MediaTarget { }; } - -#endif /* MediaTarget_hpp */ diff --git a/Machines/MouseMachine.hpp b/Machines/MouseMachine.hpp index 2c74599a1..10b6aa846 100644 --- a/Machines/MouseMachine.hpp +++ b/Machines/MouseMachine.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef MouseMachine_hpp -#define MouseMachine_hpp +#pragma once #include "../Inputs/Mouse.hpp" @@ -20,5 +19,3 @@ class MouseMachine { }; } - -#endif /* MouseMachine_hpp */ diff --git a/Machines/Oric/BD500.hpp b/Machines/Oric/BD500.hpp index 89d839db1..fe078f24c 100644 --- a/Machines/Oric/BD500.hpp +++ b/Machines/Oric/BD500.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef BD500_hpp -#define BD500_hpp +#pragma once #include "../../Components/1770/1770.hpp" #include "../../Activity/Observer.hpp" @@ -53,6 +52,4 @@ class BD500: public DiskController { } }; -}; - -#endif /* BD500_hpp */ +} diff --git a/Machines/Oric/DiskController.hpp b/Machines/Oric/DiskController.hpp index 91056a9c9..a8db77b4b 100644 --- a/Machines/Oric/DiskController.hpp +++ b/Machines/Oric/DiskController.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef DiskController_h -#define DiskController_h +#pragma once namespace Oric { @@ -58,8 +57,4 @@ class DiskController: public WD::WD1770 { Storage::Disk::Drive::ReadyType ready_type_; }; - -}; - - -#endif /* DiskController_h */ +} diff --git a/Machines/Oric/Jasmin.hpp b/Machines/Oric/Jasmin.hpp index 9793b92cf..636d63f69 100644 --- a/Machines/Oric/Jasmin.hpp +++ b/Machines/Oric/Jasmin.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef Jasmin_hpp -#define Jasmin_hpp +#pragma once #include "../../Components/1770/1770.hpp" #include "../../Activity/Observer.hpp" @@ -41,6 +40,4 @@ class Jasmin: public DiskController { } }; -}; - -#endif /* Jasmin_hpp */ +} diff --git a/Machines/Oric/Keyboard.hpp b/Machines/Oric/Keyboard.hpp index d40fd0abf..2929b4a3a 100644 --- a/Machines/Oric/Keyboard.hpp +++ b/Machines/Oric/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Machines_Oric_Keyboard_hpp -#define Machines_Oric_Keyboard_hpp +#pragma once #include "../KeyboardMachine.hpp" #include "../Utility/Typer.hpp" @@ -44,6 +43,4 @@ struct CharacterMapper: public ::Utility::CharacterMapper { const uint16_t *sequence_for_character(char character) const final; }; -}; - -#endif /* KeyboardMapper_hpp */ +} diff --git a/Machines/Oric/Microdisc.hpp b/Machines/Oric/Microdisc.hpp index ee80de1dc..02b0a370f 100644 --- a/Machines/Oric/Microdisc.hpp +++ b/Machines/Oric/Microdisc.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Microdisc_hpp -#define Microdisc_hpp +#pragma once #include "../../Components/1770/1770.hpp" #include "../../Activity/Observer.hpp" @@ -43,5 +42,3 @@ class Microdisc: public DiskController { }; } - -#endif /* Microdisc_hpp */ diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 037248b6d..af1bc2dd5 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Oric_hpp -#define Oric_hpp +#pragma once #include "../../Configurable/Configurable.hpp" #include "../../Configurable/StandardOptions.hpp" @@ -44,4 +43,3 @@ class Machine { }; } -#endif /* Oric_hpp */ diff --git a/Machines/Oric/Video.hpp b/Machines/Oric/Video.hpp index bfd4df537..165c10e83 100644 --- a/Machines/Oric/Video.hpp +++ b/Machines/Oric/Video.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Machines_Oric_Video_hpp -#define Machines_Oric_Video_hpp +#pragma once #include "../../Outputs/CRT/CRT.hpp" #include "../../ClockReceiver/ClockReceiver.hpp" @@ -65,5 +64,3 @@ class VideoOutput { }; } - -#endif /* Video_hpp */ diff --git a/Machines/PCCompatible/CGA.hpp b/Machines/PCCompatible/CGA.hpp index f2e82155f..c79f24360 100644 --- a/Machines/PCCompatible/CGA.hpp +++ b/Machines/PCCompatible/CGA.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef CGA_h -#define CGA_h +#pragma once #include "../../Components/6845/CRTC6845.hpp" #include "../../Outputs/CRT/CRT.hpp" @@ -449,5 +448,3 @@ class CGA { }; } - -#endif /* CGA_h */ diff --git a/Machines/PCCompatible/DMA.hpp b/Machines/PCCompatible/DMA.hpp index 875449843..c4f33c8ca 100644 --- a/Machines/PCCompatible/DMA.hpp +++ b/Machines/PCCompatible/DMA.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef DMA_hpp -#define DMA_hpp +#pragma once #include "../../Numeric/RegisterSizes.hpp" @@ -315,5 +314,3 @@ class DMA { }; } - -#endif /* DMA_hpp */ diff --git a/Machines/PCCompatible/KeyboardMapper.hpp b/Machines/PCCompatible/KeyboardMapper.hpp index d4765852e..f17233bd9 100644 --- a/Machines/PCCompatible/KeyboardMapper.hpp +++ b/Machines/PCCompatible/KeyboardMapper.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef KeyboardMapper_hpp -#define KeyboardMapper_hpp +#pragma once #include "../KeyboardMachine.hpp" @@ -136,5 +135,3 @@ class KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper }; } - -#endif /* KeyboardMapper_hpp */ diff --git a/Machines/PCCompatible/MDA.hpp b/Machines/PCCompatible/MDA.hpp index cc48d26c7..d38b7f924 100644 --- a/Machines/PCCompatible/MDA.hpp +++ b/Machines/PCCompatible/MDA.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef MDA_h -#define MDA_h +#pragma once #include "../../Components/6845/CRTC6845.hpp" #include "../../Outputs/CRT/CRT.hpp" @@ -235,5 +234,3 @@ class MDA { }; } - -#endif /* MDA_h */ diff --git a/Machines/PCCompatible/Memory.hpp b/Machines/PCCompatible/Memory.hpp index 7f9496774..ce2c5524f 100644 --- a/Machines/PCCompatible/Memory.hpp +++ b/Machines/PCCompatible/Memory.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Memory_hpp -#define Memory_hpp +#pragma once #include "Registers.hpp" #include "Segments.hpp" @@ -175,5 +174,3 @@ struct Memory { }; } - -#endif /* Memory_hpp */ diff --git a/Machines/PCCompatible/PCCompatible.hpp b/Machines/PCCompatible/PCCompatible.hpp index 74cacb829..8e715547c 100644 --- a/Machines/PCCompatible/PCCompatible.hpp +++ b/Machines/PCCompatible/PCCompatible.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef PCCompatible_hpp -#define PCCompatible_hpp +#pragma once #include "../../Configurable/Configurable.hpp" #include "../../Configurable/StandardOptions.hpp" @@ -48,5 +47,3 @@ class Machine { }; } - -#endif /* PCCompatible_hpp */ diff --git a/Machines/PCCompatible/PIC.hpp b/Machines/PCCompatible/PIC.hpp index 838cf949f..a27e44796 100644 --- a/Machines/PCCompatible/PIC.hpp +++ b/Machines/PCCompatible/PIC.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef PIC_hpp -#define PIC_hpp +#pragma once namespace PCCompatible { @@ -169,5 +168,3 @@ class PIC { }; } - -#endif /* PIC_hpp */ diff --git a/Machines/PCCompatible/PIT.hpp b/Machines/PCCompatible/PIT.hpp index 015dca604..f7b56edac 100644 --- a/Machines/PCCompatible/PIT.hpp +++ b/Machines/PCCompatible/PIT.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef PIT_hpp -#define PIT_hpp +#pragma once namespace PCCompatible { @@ -255,5 +254,3 @@ class i8253 { }; } - -#endif /* PIT_hpp */ diff --git a/Machines/PCCompatible/RTC.hpp b/Machines/PCCompatible/RTC.hpp index 15e84168b..73dba4676 100644 --- a/Machines/PCCompatible/RTC.hpp +++ b/Machines/PCCompatible/RTC.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef RTC_h -#define RTC_h +#pragma once #include @@ -121,5 +120,3 @@ class RTC { }; } - -#endif /* RTC_h */ diff --git a/Machines/PCCompatible/Registers.hpp b/Machines/PCCompatible/Registers.hpp index 61198fc89..7a5fd8718 100644 --- a/Machines/PCCompatible/Registers.hpp +++ b/Machines/PCCompatible/Registers.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Registers_hpp -#define Registers_hpp +#pragma once namespace PCCompatible { @@ -69,5 +68,3 @@ struct Registers { }; } - -#endif /* Registers_hpp */ diff --git a/Machines/PCCompatible/Segments.hpp b/Machines/PCCompatible/Segments.hpp index 2e69038ff..9ca6b1c2e 100644 --- a/Machines/PCCompatible/Segments.hpp +++ b/Machines/PCCompatible/Segments.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Segments_hpp -#define Segments_hpp +#pragma once #include "Registers.hpp" @@ -54,5 +53,3 @@ class Segments { }; } - -#endif /* Segments_hpp */ diff --git a/Machines/ROMMachine.hpp b/Machines/ROMMachine.hpp index f28d89268..232f3a548 100644 --- a/Machines/ROMMachine.hpp +++ b/Machines/ROMMachine.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef ROMMachine_hpp -#define ROMMachine_hpp +#pragma once #include #include @@ -35,5 +34,3 @@ enum class Error { }; } - -#endif /* ROMMachine_h */ diff --git a/Machines/ScanProducer.hpp b/Machines/ScanProducer.hpp index 785dfed56..b63649497 100644 --- a/Machines/ScanProducer.hpp +++ b/Machines/ScanProducer.hpp @@ -6,8 +6,7 @@ // Copyright 2020 Thomas Harte. All rights reserved. // -#ifndef ScanProducer_hpp -#define ScanProducer_hpp +#pragma once #include "../Outputs/ScanTarget.hpp" #include "../Configurable/StandardOptions.hpp" @@ -100,5 +99,3 @@ class ScanProducer { }; } - -#endif /* ScanProducer_hpp */ diff --git a/Machines/Sinclair/Keyboard/Keyboard.hpp b/Machines/Sinclair/Keyboard/Keyboard.hpp index 9ba4cfda4..292149934 100644 --- a/Machines/Sinclair/Keyboard/Keyboard.hpp +++ b/Machines/Sinclair/Keyboard/Keyboard.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Machines_ZX8081_Keyboard_hpp -#define Machines_ZX8081_Keyboard_hpp +#pragma once #include "../../KeyboardMachine.hpp" #include "../../Utility/Typer.hpp" @@ -73,5 +72,3 @@ class CharacterMapper: public ::Utility::CharacterMapper { }; } - -#endif /* KeyboardMapper_hpp */ diff --git a/Machines/Sinclair/ZX8081/Video.hpp b/Machines/Sinclair/ZX8081/Video.hpp index 1b867d06b..c73b317e2 100644 --- a/Machines/Sinclair/ZX8081/Video.hpp +++ b/Machines/Sinclair/ZX8081/Video.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Machines_ZX8081_Video_hpp -#define Machines_ZX8081_Video_hpp +#pragma once #include "../../../Outputs/CRT/CRT.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -58,5 +57,3 @@ class Video { }; } - -#endif /* Video_hpp */ diff --git a/Machines/Sinclair/ZX8081/ZX8081.hpp b/Machines/Sinclair/ZX8081/ZX8081.hpp index 4f0884a0b..abb56d72f 100644 --- a/Machines/Sinclair/ZX8081/ZX8081.hpp +++ b/Machines/Sinclair/ZX8081/ZX8081.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef ZX8081_hpp -#define ZX8081_hpp +#pragma once #include "../../../Configurable/Configurable.hpp" #include "../../../Configurable/StandardOptions.hpp" @@ -47,5 +46,3 @@ class Machine { }; } - -#endif /* ZX8081_hpp */ diff --git a/Machines/Sinclair/ZXSpectrum/State.hpp b/Machines/Sinclair/ZXSpectrum/State.hpp index a65077f9a..253f6a01e 100644 --- a/Machines/Sinclair/ZXSpectrum/State.hpp +++ b/Machines/Sinclair/ZXSpectrum/State.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef State_hpp -#define State_hpp +#pragma once #include "../../../Reflection/Struct.hpp" #include "../../../Processors/Z80/State/State.hpp" @@ -46,5 +45,3 @@ struct State: public Reflection::StructImpl { }; } - -#endif /* State_h */ diff --git a/Machines/Sinclair/ZXSpectrum/Video.hpp b/Machines/Sinclair/ZXSpectrum/Video.hpp index f62e67376..fc380b84a 100644 --- a/Machines/Sinclair/ZXSpectrum/Video.hpp +++ b/Machines/Sinclair/ZXSpectrum/Video.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Video_hpp -#define Video_hpp +#pragma once #include "../../../Outputs/CRT/CRT.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp" @@ -484,5 +483,3 @@ struct State: public Reflection::StructImpl { }; } - -#endif /* Video_hpp */ diff --git a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp index 049d31e82..eb8514d96 100644 --- a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp +++ b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp @@ -60,36 +60,37 @@ class Joystick: public Inputs::ConcreteJoystick { }) {} void did_set_input(const Input &digital_input, bool is_active) final { -#define APPLY_KEMPSTON(b) if(is_active) kempston_ |= b; else kempston_ &= ~b; -#define APPLY_SINCLAIR(b) if(is_active) sinclair_ &= ~b; else sinclair_ |= b; + const auto apply_kempston = [&](uint8_t mask) { + if(is_active) kempston_ |= mask; else kempston_ &= ~mask; + }; + const auto apply_sinclair = [&](uint16_t mask) { + if(is_active) sinclair_ &= ~mask; else sinclair_ |= mask; + }; switch(digital_input.type) { default: return; case Input::Right: - APPLY_KEMPSTON(0x01); - APPLY_SINCLAIR(0x0208); + apply_kempston(0x01); + apply_sinclair(0x0208); break; case Input::Left: - APPLY_KEMPSTON(0x02); - APPLY_SINCLAIR(0x0110); + apply_kempston(0x02); + apply_sinclair(0x0110); break; case Input::Down: - APPLY_KEMPSTON(0x04); - APPLY_SINCLAIR(0x0404); + apply_kempston(0x04); + apply_sinclair(0x0404); break; case Input::Up: - APPLY_KEMPSTON(0x08); - APPLY_SINCLAIR(0x0802); + apply_kempston(0x08); + apply_sinclair(0x0802); break; case Input::Fire: - APPLY_KEMPSTON(0x10); - APPLY_SINCLAIR(0x1001); + apply_kempston(0x10); + apply_sinclair(0x1001); break; } - -#undef APPLY_KEMPSTON -#undef APPLY_SINCLAIR } /// @returns The value that a Kempston joystick interface would report if this joystick @@ -757,11 +758,11 @@ template class ConcreteMachine: std::array ram_; std::array scratch_; - const uint8_t *read_pointers_[4]; - uint8_t *write_pointers_[4]; - uint8_t pages_[4]; - bool is_contended_[4]; - bool is_video_[4]; + std::array read_pointers_; + std::array write_pointers_; + std::array pages_; + std::array is_contended_; + std::array is_video_; uint8_t port1ffd_ = 0; uint8_t port7ffd_ = 0; diff --git a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp index d21017b80..3c3f8668e 100644 --- a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp +++ b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef ZXSpectrum_hpp -#define ZXSpectrum_hpp +#pragma once #include "../../../Configurable/Configurable.hpp" #include "../../../Configurable/StandardOptions.hpp" @@ -47,5 +46,3 @@ class Machine { }; } - -#endif /* ZXSpectrum_hpp */ diff --git a/Machines/StateProducer.hpp b/Machines/StateProducer.hpp index 3a27e3cd0..23b8de517 100644 --- a/Machines/StateProducer.hpp +++ b/Machines/StateProducer.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef State_h -#define State_h +#pragma once #include #include "../Analyser/Static/StaticAnalyser.hpp" @@ -22,5 +21,3 @@ struct StateProducer { }; }; - -#endif /* State_h */ diff --git a/Machines/TimedMachine.hpp b/Machines/TimedMachine.hpp index f634cccaa..815297e12 100644 --- a/Machines/TimedMachine.hpp +++ b/Machines/TimedMachine.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef TimedMachine_h -#define TimedMachine_h +#pragma once #include "../ClockReceiver/ClockReceiver.hpp" #include "../ClockReceiver/TimeTypes.hpp" @@ -98,5 +97,3 @@ class TimedMachine { }; } - -#endif /* TimedMachine_h */ diff --git a/Machines/Utility/MachineForTarget.hpp b/Machines/Utility/MachineForTarget.hpp index 8cf0e0b93..34a8559a8 100644 --- a/Machines/Utility/MachineForTarget.hpp +++ b/Machines/Utility/MachineForTarget.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef MachineForTarget_hpp -#define MachineForTarget_hpp +#pragma once #include "../../Analyser/Static/StaticAnalyser.hpp" #include "../../Reflection/Struct.hpp" @@ -94,5 +93,3 @@ std::map> AllOptionsByMachineNa std::map> TargetsByMachineName(bool meaningful_without_media_only); } - -#endif /* MachineForTarget_hpp */ diff --git a/Machines/Utility/MemoryFuzzer.hpp b/Machines/Utility/MemoryFuzzer.hpp index 9d5751679..93fea09c6 100644 --- a/Machines/Utility/MemoryFuzzer.hpp +++ b/Machines/Utility/MemoryFuzzer.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef MemoryFuzzer_hpp -#define MemoryFuzzer_hpp +#pragma once #include #include @@ -27,5 +26,3 @@ template void Fuzz(T &buffer) { } } - -#endif /* MemoryFuzzer_hpp */ diff --git a/Machines/Utility/MemoryPacker.hpp b/Machines/Utility/MemoryPacker.hpp index 3da4743d1..92d15ed93 100644 --- a/Machines/Utility/MemoryPacker.hpp +++ b/Machines/Utility/MemoryPacker.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef MemoryPacker_hpp -#define MemoryPacker_hpp +#pragma once #include #include @@ -43,4 +42,3 @@ void PackBigEndian16(const std::vector &source, std::vector & void PackBigEndian16(const std::vector &source, std::vector &target); } -#endif /* MemoryPacker_hpp */ diff --git a/Machines/Utility/ROMCatalogue.hpp b/Machines/Utility/ROMCatalogue.hpp index f82cb959d..972d75923 100644 --- a/Machines/Utility/ROMCatalogue.hpp +++ b/Machines/Utility/ROMCatalogue.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef ROMCatalogue_hpp -#define ROMCatalogue_hpp +#pragma once #include #include @@ -313,5 +312,3 @@ struct Request { }; } - -#endif /* ROMCatalogue_hpp */ diff --git a/Machines/Utility/StringSerialiser.hpp b/Machines/Utility/StringSerialiser.hpp index 4e194e680..135b6020b 100644 --- a/Machines/Utility/StringSerialiser.hpp +++ b/Machines/Utility/StringSerialiser.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef StringSerialiser_hpp -#define StringSerialiser_hpp +#pragma once #include #include @@ -27,5 +26,3 @@ class StringSerialiser { }; } - -#endif /* StringSerialiser_hpp */ diff --git a/Machines/Utility/TypedDynamicMachine.hpp b/Machines/Utility/TypedDynamicMachine.hpp index b6a9b699b..933e03192 100644 --- a/Machines/Utility/TypedDynamicMachine.hpp +++ b/Machines/Utility/TypedDynamicMachine.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef TypedDynamicMachine_h -#define TypedDynamicMachine_h +#pragma once #include "MachineForTarget.hpp" @@ -68,5 +67,3 @@ template class TypedDynamicMachine: public ::Machine::DynamicMachine }; } - -#endif /* TypedDynamicMachine_h */ diff --git a/Machines/Utility/Typer.hpp b/Machines/Utility/Typer.hpp index 79ac1b86a..5cfd1c8bd 100644 --- a/Machines/Utility/Typer.hpp +++ b/Machines/Utility/Typer.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Typer_hpp -#define Typer_hpp +#pragma once #include #include @@ -151,5 +150,3 @@ class TypeRecipient: public Typer::Delegate { }; } - -#endif /* Typer_hpp */ diff --git a/Numeric/BitReverse.hpp b/Numeric/BitReverse.hpp index af8350918..2836ecd63 100644 --- a/Numeric/BitReverse.hpp +++ b/Numeric/BitReverse.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef BitReverse_hpp -#define BitReverse_hpp +#pragma once #include @@ -58,5 +57,3 @@ template constexpr IntT bit_reverse(IntT source) { } } - -#endif /* BitReverse_hpp */ diff --git a/Numeric/BitSpread.hpp b/Numeric/BitSpread.hpp index ffd54a060..d7c0de92c 100644 --- a/Numeric/BitSpread.hpp +++ b/Numeric/BitSpread.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef BitSpread_hpp -#define BitSpread_hpp +#pragma once namespace Numeric { @@ -33,5 +32,3 @@ constexpr uint8_t unspread_bits(uint16_t input) { } } - -#endif /* BitSpread_hpp */ diff --git a/Numeric/CRC.hpp b/Numeric/CRC.hpp index 5861c56e1..9b99b5726 100644 --- a/Numeric/CRC.hpp +++ b/Numeric/CRC.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef CRC_hpp -#define CRC_hpp +#pragma once #include #include @@ -120,5 +119,3 @@ struct CRC32: public Generator { }; } - -#endif /* CRC_hpp */ diff --git a/Numeric/Carry.hpp b/Numeric/Carry.hpp index 0d4a235fa..52453537f 100644 --- a/Numeric/Carry.hpp +++ b/Numeric/Carry.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Carry_hpp -#define Carry_hpp +#pragma once #include @@ -79,5 +78,3 @@ IntT overflow(IntT lhs, IntT rhs, IntT result) { } } - -#endif /* Carry_hpp */ diff --git a/Numeric/LFSR.hpp b/Numeric/LFSR.hpp index b45eba802..ae9019efe 100644 --- a/Numeric/LFSR.hpp +++ b/Numeric/LFSR.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef LFSR_h -#define LFSR_h +#pragma once #include #include @@ -81,5 +80,3 @@ template class LFSRv: public LFSR::type, polynomial> {}; } - -#endif /* LFSR_h */ diff --git a/Numeric/NumericCoder.hpp b/Numeric/NumericCoder.hpp index 368838c39..d33280310 100644 --- a/Numeric/NumericCoder.hpp +++ b/Numeric/NumericCoder.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef NumericCoder_hpp -#define NumericCoder_hpp +#pragma once namespace Numeric { @@ -73,5 +72,3 @@ template class NumericCoder { }; } - -#endif /* NumericCoder_hpp */ diff --git a/Numeric/RegisterSizes.hpp b/Numeric/RegisterSizes.hpp index 669227e9c..b6e8dc928 100644 --- a/Numeric/RegisterSizes.hpp +++ b/Numeric/RegisterSizes.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef RegisterSizes_hpp -#define RegisterSizes_hpp +#pragma once #include @@ -88,5 +87,3 @@ using SlicedInt32 = SlicedInt; } #pragma pack(pop) - -#endif /* RegisterSizes_hpp */ diff --git a/Numeric/Sizes.hpp b/Numeric/Sizes.hpp index d9a56a40a..c78cc70d9 100644 --- a/Numeric/Sizes.hpp +++ b/Numeric/Sizes.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Sizes_h -#define Sizes_h +#pragma once #include #include @@ -33,5 +32,3 @@ template struct MinIntTypeValue { > >; }; - -#endif /* Sizes_h */ diff --git a/OSBindings/Mac/Clock Signal/CSApplication.h b/OSBindings/Mac/Clock Signal/CSApplication.h index 7e0b04a00..8fc598789 100644 --- a/OSBindings/Mac/Clock Signal/CSApplication.h +++ b/OSBindings/Mac/Clock Signal/CSApplication.h @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef CSApplication_h -#define CSApplication_h +#pragma once #import @@ -28,6 +27,3 @@ @interface CSApplication: NSApplication @property(nonatomic, weak, nullable) id eventDelegate; @end - - -#endif /* CSApplication_h */ diff --git a/OSBindings/Mac/Clock Signal/Machine/KeyCodes.h b/OSBindings/Mac/Clock Signal/Machine/KeyCodes.h index 9b7238c8d..43916a847 100644 --- a/OSBindings/Mac/Clock Signal/Machine/KeyCodes.h +++ b/OSBindings/Mac/Clock Signal/Machine/KeyCodes.h @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef KeyCodes_h -#define KeyCodes_h +#pragma once /* Carbon somehow still manages to get into the unit test target; I can't figure out how. So I've @@ -147,5 +146,3 @@ enum: uint16_t { VK_DownArrow = 0x7D, VK_UpArrow = 0x7E }; - -#endif /* KeyCodes_h */ diff --git a/OSBindings/Mac/Clock SignalTests/Comparative68000.hpp b/OSBindings/Mac/Clock SignalTests/Comparative68000.hpp index d9e265cdb..ae2258cc2 100644 --- a/OSBindings/Mac/Clock SignalTests/Comparative68000.hpp +++ b/OSBindings/Mac/Clock SignalTests/Comparative68000.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Comparative68000_hpp -#define Comparative68000_hpp +#pragma once #include @@ -55,5 +54,3 @@ class ComparativeBusHandler: public CPU::MC68000::BusHandler { int line_count = 0; gzFile trace; }; - -#endif /* Comparative68000_hpp */ diff --git a/OSBindings/Mac/Clock SignalTests/TestRunner68000.hpp b/OSBindings/Mac/Clock SignalTests/TestRunner68000.hpp index 74a0346d8..4250e56b3 100644 --- a/OSBindings/Mac/Clock SignalTests/TestRunner68000.hpp +++ b/OSBindings/Mac/Clock SignalTests/TestRunner68000.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef TestRunner68000_h -#define TestRunner68000_h +#pragma once #include #include @@ -135,5 +134,3 @@ class RAM68000: public CPU::MC68000::BusHandler { int instructions_remaining_; HalfCycles duration_; }; - -#endif /* TestRunner68000_h */ diff --git a/Outputs/CRT/CRT.hpp b/Outputs/CRT/CRT.hpp index 8db867bf4..d0d8ac7fc 100644 --- a/Outputs/CRT/CRT.hpp +++ b/Outputs/CRT/CRT.hpp @@ -6,8 +6,7 @@ // Copyright 2015 Thomas Harte. All rights reserved. // -#ifndef CRT_hpp -#define CRT_hpp +#pragma once #include #include @@ -366,5 +365,3 @@ template class CRTFrequencyMismatchWarner: public Outputs::C }; } - -#endif /* CRT_cpp */ diff --git a/Outputs/CRT/Internals/Flywheel.hpp b/Outputs/CRT/Internals/Flywheel.hpp index 04f0c8e49..b6914f197 100644 --- a/Outputs/CRT/Internals/Flywheel.hpp +++ b/Outputs/CRT/Internals/Flywheel.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Flywheel_hpp -#define Flywheel_hpp +#pragma once #include #include @@ -259,5 +258,3 @@ struct Flywheel { }; } - -#endif /* Flywheel_hpp */ diff --git a/Outputs/DisplayMetrics.hpp b/Outputs/DisplayMetrics.hpp index 792cbec68..a5eb0c059 100644 --- a/Outputs/DisplayMetrics.hpp +++ b/Outputs/DisplayMetrics.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef DisplayMetrics_hpp -#define DisplayMetrics_hpp +#pragma once #include "ScanTarget.hpp" @@ -56,5 +55,3 @@ class Metrics { }; } - -#endif /* DisplayMetrics_hpp */ diff --git a/Outputs/Log.hpp b/Outputs/Log.hpp index 0ff0b008b..012d94f94 100644 --- a/Outputs/Log.hpp +++ b/Outputs/Log.hpp @@ -6,8 +6,7 @@ // Copyright © 2018 Thomas Harte. All rights reserved. // -#ifndef Log_h -#define Log_h +#pragma once #ifdef NDEBUG @@ -45,6 +44,3 @@ #endif #endif - - -#endif /* Log_h */ diff --git a/Outputs/OpenGL/OpenGL.hpp b/Outputs/OpenGL/OpenGL.hpp index af18b144b..a320de1be 100644 --- a/Outputs/OpenGL/OpenGL.hpp +++ b/Outputs/OpenGL/OpenGL.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef OpenGL_h -#define OpenGL_h +#pragma once #include #include @@ -57,5 +56,3 @@ #else #define test_gl(command, ...) command(__VA_ARGS__) #endif - -#endif /* OpenGL_h */ diff --git a/Outputs/OpenGL/Primitives/Rectangle.hpp b/Outputs/OpenGL/Primitives/Rectangle.hpp index 6e02b60db..4895bb391 100644 --- a/Outputs/OpenGL/Primitives/Rectangle.hpp +++ b/Outputs/OpenGL/Primitives/Rectangle.hpp @@ -6,8 +6,7 @@ // Copyright © 2018 Thomas Harte. All rights reserved. // -#ifndef Rectangle_hpp -#define Rectangle_hpp +#pragma once #include "../OpenGL.hpp" #include "Shader.hpp" @@ -37,5 +36,3 @@ class Rectangle { }; } - -#endif /* Rectangle_hpp */ diff --git a/Outputs/OpenGL/Primitives/Shader.hpp b/Outputs/OpenGL/Primitives/Shader.hpp index d41f70eb2..d53a2ae36 100644 --- a/Outputs/OpenGL/Primitives/Shader.hpp +++ b/Outputs/OpenGL/Primitives/Shader.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Shader_hpp -#define Shader_hpp +#pragma once #include "../OpenGL.hpp" @@ -129,5 +128,3 @@ protected: }; } - -#endif /* Shader_hpp */ diff --git a/Outputs/OpenGL/Primitives/TextureTarget.hpp b/Outputs/OpenGL/Primitives/TextureTarget.hpp index 3a1e203b4..60292c621 100644 --- a/Outputs/OpenGL/Primitives/TextureTarget.hpp +++ b/Outputs/OpenGL/Primitives/TextureTarget.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef TextureTarget_hpp -#define TextureTarget_hpp +#pragma once #include "../OpenGL.hpp" #include "Shader.hpp" @@ -87,5 +86,3 @@ class TextureTarget { }; } - -#endif /* TextureTarget_hpp */ diff --git a/Outputs/OpenGL/ScanTarget.hpp b/Outputs/OpenGL/ScanTarget.hpp index 2feac17a6..7f847866d 100644 --- a/Outputs/OpenGL/ScanTarget.hpp +++ b/Outputs/OpenGL/ScanTarget.hpp @@ -6,8 +6,7 @@ // Copyright © 2018 Thomas Harte. All rights reserved. // -#ifndef ScanTarget_hpp -#define ScanTarget_hpp +#pragma once #include "../Log.hpp" #include "../DisplayMetrics.hpp" @@ -155,5 +154,3 @@ class ScanTarget: public Outputs::Display::BufferingScanTarget { // TODO: use pr }; } - -#endif /* ScanTarget_hpp */ diff --git a/Outputs/OpenGL/Screenshot.hpp b/Outputs/OpenGL/Screenshot.hpp index 7b70189ac..c0e5af299 100644 --- a/Outputs/OpenGL/Screenshot.hpp +++ b/Outputs/OpenGL/Screenshot.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef Screenshot_h -#define Screenshot_h +#pragma once #include "OpenGL.hpp" @@ -53,5 +52,3 @@ struct Screenshot { }; } - -#endif /* Screenshot_h */ diff --git a/Outputs/ScanTarget.hpp b/Outputs/ScanTarget.hpp index 487559d4f..c56d7beac 100644 --- a/Outputs/ScanTarget.hpp +++ b/Outputs/ScanTarget.hpp @@ -6,8 +6,7 @@ // Copyright © 2018 Thomas Harte. All rights reserved. // -#ifndef Outputs_Display_ScanTarget_h -#define Outputs_Display_ScanTarget_h +#pragma once #include #include @@ -451,5 +450,3 @@ struct NullScanTarget: public ScanTarget { }; } - -#endif /* Outputs_Display_ScanTarget_h */ diff --git a/Outputs/ScanTargets/BufferingScanTarget.hpp b/Outputs/ScanTargets/BufferingScanTarget.hpp index 1205aed23..896aa8286 100644 --- a/Outputs/ScanTargets/BufferingScanTarget.hpp +++ b/Outputs/ScanTargets/BufferingScanTarget.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef BufferingScanTarget_hpp -#define BufferingScanTarget_hpp +#pragma once #include "../ScanTarget.hpp" #include "../DisplayMetrics.hpp" @@ -273,5 +272,3 @@ class BufferingScanTarget: public Outputs::Display::ScanTarget { }; } - -#endif /* BufferingScanTarget_hpp */ diff --git a/Outputs/Speaker/Implementation/CompoundSource.hpp b/Outputs/Speaker/Implementation/CompoundSource.hpp index ade6c4e54..75f798e55 100644 --- a/Outputs/Speaker/Implementation/CompoundSource.hpp +++ b/Outputs/Speaker/Implementation/CompoundSource.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef CompoundSource_h -#define CompoundSource_h +#pragma once #include "SampleSource.hpp" @@ -174,5 +173,3 @@ template class CompoundSource: }; } - -#endif /* CompoundSource_h */ diff --git a/Outputs/Speaker/Implementation/LowpassSpeaker.hpp b/Outputs/Speaker/Implementation/LowpassSpeaker.hpp index 2f1961b65..294e19589 100644 --- a/Outputs/Speaker/Implementation/LowpassSpeaker.hpp +++ b/Outputs/Speaker/Implementation/LowpassSpeaker.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef LowpassSpeaker_hpp -#define LowpassSpeaker_hpp +#pragma once #include "../Speaker.hpp" #include "../../../SignalProcessing/FIRFilter.hpp" @@ -410,5 +409,3 @@ template class PullLowpass: public LowpassBase #include @@ -71,5 +70,3 @@ class SampleSource { }; } - -#endif /* SampleSource_hpp */ diff --git a/Outputs/Speaker/Speaker.hpp b/Outputs/Speaker/Speaker.hpp index 075dcd552..c35b182c1 100644 --- a/Outputs/Speaker/Speaker.hpp +++ b/Outputs/Speaker/Speaker.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Speaker_hpp -#define Speaker_hpp +#pragma once #include #include @@ -145,5 +144,3 @@ class Speaker { }; } - -#endif /* Speaker_hpp */ diff --git a/Processors/6502/6502.hpp b/Processors/6502/6502.hpp index f62e0e067..25855272a 100644 --- a/Processors/6502/6502.hpp +++ b/Processors/6502/6502.hpp @@ -6,8 +6,7 @@ // Copyright 2015 Thomas Harte. All rights reserved. // -#ifndef MOS6502_cpp -#define MOS6502_cpp +#pragma once #include #include @@ -39,10 +38,10 @@ enum Personality { PWDC65C02, // like the Rockwell, but with STP and WAI }; -#define has_decimal_mode(p) ((p) >= Personality::P6502) -#define is_65c02(p) ((p) >= Personality::PSynertek65C02) -#define has_bbrbbsrmbsmb(p) ((p) >= Personality::PRockwell65C02) -#define has_stpwai(p) ((p) >= Personality::PWDC65C02) +constexpr bool has_decimal_mode(Personality p) { return p >= Personality::P6502; } +constexpr bool is_65c02(Personality p) { return p >= Personality::PSynertek65C02; } +constexpr bool has_bbrbbsrmbsmb(Personality p) { return p >= Personality::PRockwell65C02; } +constexpr bool has_stpwai(Personality p) { return p >= Personality::PWDC65C02; } /*! An opcode that is guaranteed to cause a 6502 to jam. @@ -170,5 +169,3 @@ template cl #include "Implementation/6502Implementation.hpp" } - -#endif /* MOS6502_cpp */ diff --git a/Processors/6502/AllRAM/6502AllRAM.hpp b/Processors/6502/AllRAM/6502AllRAM.hpp index 420e2633c..7492f7441 100644 --- a/Processors/6502/AllRAM/6502AllRAM.hpp +++ b/Processors/6502/AllRAM/6502AllRAM.hpp @@ -6,8 +6,7 @@ // Copyright 2015 Thomas Harte. All rights reserved. // -#ifndef MOS6502AllRAM_cpp -#define MOS6502AllRAM_cpp +#pragma once #include "../../6502Esque/6502Selector.hpp" #include "../../AllRAMProcessor.hpp" @@ -33,5 +32,3 @@ class AllRAMProcessor: }; } - -#endif /* MOS6502AllRAM_cpp */ diff --git a/Processors/6502/Implementation/6502Implementation.hpp b/Processors/6502/Implementation/6502Implementation.hpp index 1c4bcbe5d..6b6eb267a 100644 --- a/Processors/6502/Implementation/6502Implementation.hpp +++ b/Processors/6502/Implementation/6502Implementation.hpp @@ -12,34 +12,86 @@ 6502.hpp, but it's implementation stuff. */ -template void Processor::run_for(const Cycles cycles) { -#define checkSchedule() \ - if(!scheduled_program_counter_) {\ - if(interrupt_requests_) {\ - if(interrupt_requests_ & (InterruptRequestFlags::Reset | InterruptRequestFlags::PowerOn)) {\ - interrupt_requests_ &= ~InterruptRequestFlags::PowerOn;\ - scheduled_program_counter_ = operations_[size_t(OperationsSlot::Reset)];\ - } else if(interrupt_requests_ & InterruptRequestFlags::NMI) {\ - interrupt_requests_ &= ~InterruptRequestFlags::NMI;\ - scheduled_program_counter_ = operations_[size_t(OperationsSlot::NMI)];\ - } else if(interrupt_requests_ & InterruptRequestFlags::IRQ) {\ - scheduled_program_counter_ = operations_[size_t(OperationsSlot::IRQ)];\ - } \ - } else {\ - scheduled_program_counter_ = operations_[size_t(OperationsSlot::FetchDecodeExecute)];\ - }\ - } +template +void Processor::run_for(const Cycles cycles) { -#define bus_access() \ - interrupt_requests_ = (interrupt_requests_ & ~InterruptRequestFlags::IRQ) | irq_request_history_; \ - irq_request_history_ = irq_line_ & flags_.inverse_interrupt; \ - number_of_cycles -= bus_handler_.perform_bus_operation(next_bus_operation_, bus_address_, bus_value_); \ - next_bus_operation_ = BusOperation::None; \ - if(number_of_cycles <= Cycles(0)) break; + const auto check_schedule = [&] { + if(!scheduled_program_counter_) { + if(interrupt_requests_) { + if(interrupt_requests_ & (InterruptRequestFlags::Reset | InterruptRequestFlags::PowerOn)) { + interrupt_requests_ &= ~InterruptRequestFlags::PowerOn; + scheduled_program_counter_ = operations_[size_t(OperationsSlot::Reset)]; + } else if(interrupt_requests_ & InterruptRequestFlags::NMI) { + interrupt_requests_ &= ~InterruptRequestFlags::NMI; + scheduled_program_counter_ = operations_[size_t(OperationsSlot::NMI)]; + } else if(interrupt_requests_ & InterruptRequestFlags::IRQ) { + scheduled_program_counter_ = operations_[size_t(OperationsSlot::IRQ)]; + } + } else { + scheduled_program_counter_ = operations_[size_t(OperationsSlot::FetchDecodeExecute)]; + } + } + }; - checkSchedule(); + check_schedule(); Cycles number_of_cycles = cycles + cycles_left_to_run_; + const auto bus_access = [&]() -> bool { + interrupt_requests_ = (interrupt_requests_ & ~InterruptRequestFlags::IRQ) | irq_request_history_; + irq_request_history_ = irq_line_ & flags_.inverse_interrupt; + number_of_cycles -= bus_handler_.perform_bus_operation(next_bus_operation_, bus_address_, bus_value_); + next_bus_operation_ = BusOperation::None; + return number_of_cycles <= Cycles(0); + }; + + const auto read_op = [&](uint8_t &val, uint16_t address) { + next_bus_operation_ = BusOperation::ReadOpcode; + bus_address_ = address; + bus_value_ = &val; + val = 0xff; + }; + + const auto read_mem = [&](uint8_t &val, uint16_t address) { + next_bus_operation_ = BusOperation::Read; + bus_address_ = address; + bus_value_ = &val; + val = 0xff; + }; + + const auto throwaway_read = [&](uint16_t address) { + next_bus_operation_ = BusOperation::Read; + bus_address_ = address; + bus_value_ = &bus_throwaway_; + bus_throwaway_ = 0xff; + }; + + const auto write_mem = [&](uint8_t &val, uint16_t address) { + next_bus_operation_ = BusOperation::Write; + bus_address_ = address; + bus_value_ = &val; + }; + + const auto push = [&](uint8_t &val) { + const uint16_t targetAddress = s_ | 0x100; + --s_; + write_mem(val, targetAddress); + }; + + const auto page_crossing_stall_read = [&] { + if(is_65c02(personality)) { + throwaway_read(pc_.full - 1); + } else { + throwaway_read(address_.full); + } + }; + + const auto bra = [&](bool condition) { + ++pc_.full; + if(condition) { + scheduled_program_counter_ = operations_[size_t(OperationsSlot::DoBRA)]; + } + }; + while(number_of_cycles > Cycles(0)) { // Deal with a potential RDY state, if this 6502 has anything connected to ready. @@ -52,7 +104,7 @@ template void Proces number_of_cycles -= bus_handler_.perform_bus_operation(BusOperation::Ready, bus_address_, bus_value_); if(interrupt_requests_ & InterruptRequestFlags::Reset) { stop_is_active_ = false; - checkSchedule(); + check_schedule(); break; } } @@ -63,14 +115,14 @@ template void Proces interrupt_requests_ |= (irq_line_ & flags_.inverse_interrupt); if(interrupt_requests_ & InterruptRequestFlags::NMI || irq_line_) { wait_is_active_ = false; - checkSchedule(); + check_schedule(); break; } } if((!uses_ready_line || !ready_is_active_) && (!has_stpwai(personality) || (!wait_is_active_ && !stop_is_active_))) { if(next_bus_operation_ != BusOperation::None) { - bus_access(); + if(bus_access()) break; } while(1) { @@ -78,11 +130,6 @@ template void Proces const MicroOp cycle = *scheduled_program_counter_; scheduled_program_counter_++; -#define read_op(val, addr) next_bus_operation_ = BusOperation::ReadOpcode; bus_address_ = addr; bus_value_ = &val; val = 0xff -#define read_mem(val, addr) next_bus_operation_ = BusOperation::Read; bus_address_ = addr; bus_value_ = &val; val = 0xff -#define throwaway_read(addr) next_bus_operation_ = BusOperation::Read; bus_address_ = addr; bus_value_ = &bus_throwaway_; bus_throwaway_ = 0xff -#define write_mem(val, addr) next_bus_operation_ = BusOperation::Write; bus_address_ = addr; bus_value_ = &val - switch(cycle) { // MARK: - Fetch/Decode @@ -117,14 +164,9 @@ template void Proces case OperationMoveToNextProgram: scheduled_program_counter_ = nullptr; - checkSchedule(); + check_schedule(); continue; -#define push(v) {\ - uint16_t targetAddress = s_ | 0x100; s_--;\ - write_mem(v, targetAddress);\ -} - case CycleIncPCPushPCH: pc_.full++; [[fallthrough]]; case CyclePushPCH: push(pc_.halves.high); break; case CyclePushPCL: push(pc_.halves.low); break; @@ -133,13 +175,12 @@ template void Proces case CyclePushX: push(x_); break; case CyclePushY: push(y_); break; case CycleNoWritePush: { - uint16_t targetAddress = s_ | 0x100; s_--; + uint16_t targetAddress = s_ | 0x100; + --s_; read_mem(operand_, targetAddress); } break; -#undef push - case CycleReadFromS: throwaway_read(s_ | 0x100); break; case CycleReadFromPC: throwaway_read(pc_.full); break; @@ -529,13 +570,6 @@ template void Proces // MARK: - Addressing Mode Work -#define page_crossing_stall_read() \ - if(is_65c02(personality)) { \ - throwaway_read(pc_.full - 1); \ - } else { \ - throwaway_read(address_.full); \ - } - case CycleAddXToAddressLow: next_address_.full = address_.full + x_; address_.halves.low = next_address_.halves.low; @@ -553,8 +587,6 @@ template void Proces } continue; -#undef page_crossing_stall_read - case CycleAddXToAddressLowRead: next_address_.full = address_.full + x_; address_.halves.low = next_address_.halves.low; @@ -649,23 +681,15 @@ template void Proces // MARK: - Branching -#define BRA(condition) \ - pc_.full++; \ - if(condition) { \ - scheduled_program_counter_ = operations_[size_t(OperationsSlot::DoBRA)]; \ - } - - case OperationBPL: BRA(!(flags_.negative_result&0x80)); continue; - case OperationBMI: BRA(flags_.negative_result&0x80); continue; - case OperationBVC: BRA(!flags_.overflow); continue; - case OperationBVS: BRA(flags_.overflow); continue; - case OperationBCC: BRA(!flags_.carry); continue; - case OperationBCS: BRA(flags_.carry); continue; - case OperationBNE: BRA(flags_.zero_result); continue; - case OperationBEQ: BRA(!flags_.zero_result); continue; - case OperationBRA: BRA(true); continue; - -#undef BRA + case OperationBPL: bra(!(flags_.negative_result&0x80)); continue; + case OperationBMI: bra(flags_.negative_result&0x80); continue; + case OperationBVC: bra(!flags_.overflow); continue; + case OperationBVS: bra(flags_.overflow); continue; + case OperationBCC: bra(!flags_.carry); continue; + case OperationBCS: bra(flags_.carry); continue; + case OperationBNE: bra(flags_.zero_result); continue; + case OperationBEQ: bra(!flags_.zero_result); continue; + case OperationBRA: bra(true); continue; case CycleAddSignedOperandToPC: next_address_.full = uint16_t(pc_.full + int8_t(operand_)); @@ -749,7 +773,7 @@ template void Proces ready_is_active_ = true; break; } - bus_access(); + if(bus_access()) break; } } } diff --git a/Processors/6502/State/State.hpp b/Processors/6502/State/State.hpp index 9d9e7185f..3af11f401 100644 --- a/Processors/6502/State/State.hpp +++ b/Processors/6502/State/State.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef MOS6502_State_hpp -#define MOS6502_State_hpp +#pragma once #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -89,5 +88,3 @@ struct State: public Reflection::StructImpl { }; } - -#endif /* MOS6502_State_hpp */ diff --git a/Processors/6502Esque/6502Esque.hpp b/Processors/6502Esque/6502Esque.hpp index 9c32d2148..429f0a2bb 100644 --- a/Processors/6502Esque/6502Esque.hpp +++ b/Processors/6502Esque/6502Esque.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef m6502Esque_h -#define m6502Esque_h +#pragma once #include "../../ClockReceiver/ClockReceiver.hpp" @@ -143,5 +142,3 @@ template class BusHandler { }; } - -#endif /* m6502Esque_h */ diff --git a/Processors/6502Esque/6502Selector.hpp b/Processors/6502Esque/6502Selector.hpp index 31bf93eaa..01cfe6049 100644 --- a/Processors/6502Esque/6502Selector.hpp +++ b/Processors/6502Esque/6502Selector.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef _502Selector_h -#define _502Selector_h +#pragma once #include "6502Esque.hpp" #include "../6502/6502.hpp" @@ -73,5 +72,3 @@ constexpr bool has_extended_bus_output(Type processor_type) { } } - -#endif /* _502Selector_h */ diff --git a/Processors/6502Esque/Implementation/LazyFlags.hpp b/Processors/6502Esque/Implementation/LazyFlags.hpp index 0466eb181..bc44dd299 100644 --- a/Processors/6502Esque/Implementation/LazyFlags.hpp +++ b/Processors/6502Esque/Implementation/LazyFlags.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef LazyFlags_h -#define LazyFlags_h +#pragma once #include "../6502Esque.hpp" @@ -76,5 +75,3 @@ struct LazyFlags { }; } - -#endif /* LazyFlags_h */ diff --git a/Processors/65816/65816.hpp b/Processors/65816/65816.hpp index a968b73a1..0e03845ba 100644 --- a/Processors/65816/65816.hpp +++ b/Processors/65816/65816.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef WDC65816_hpp -#define WDC65816_hpp +#pragma once #include #include @@ -92,5 +91,3 @@ template class Processor: public Pro #include "Implementation/65816Implementation.hpp" } - -#endif /* WDC65816_hpp */ diff --git a/Processors/68000/68000.hpp b/Processors/68000/68000.hpp index c6d1b1b54..0b271292b 100644 --- a/Processors/68000/68000.hpp +++ b/Processors/68000/68000.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef MC68000_h -#define MC68000_h +#pragma once #include "../../ClockReceiver/ClockReceiver.hpp" #include "../../Numeric/RegisterSizes.hpp" @@ -499,5 +498,3 @@ class Processor: private ProcessorBase { } #include "Implementation/68000Implementation.hpp" - -#endif /* MC68000_h */ diff --git a/Processors/68000/Implementation/68000Implementation.hpp b/Processors/68000/Implementation/68000Implementation.hpp index 6ae77f3b4..977f0cc11 100644 --- a/Processors/68000/Implementation/68000Implementation.hpp +++ b/Processors/68000/Implementation/68000Implementation.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef MC68000Implementation_h -#define MC68000Implementation_h +#pragma once #include #include @@ -3109,5 +3108,3 @@ void Processor #include @@ -47,5 +46,3 @@ class AllRAMProcessor { }; } - -#endif /* AllRAMProcessor_hpp */ diff --git a/Processors/Z80/AllRAM/Z80AllRAM.hpp b/Processors/Z80/AllRAM/Z80AllRAM.hpp index ee34a8db7..b410403a1 100644 --- a/Processors/Z80/AllRAM/Z80AllRAM.hpp +++ b/Processors/Z80/AllRAM/Z80AllRAM.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Z80AllRAM_hpp -#define Z80AllRAM_hpp +#pragma once #include "../Z80.hpp" #include "../../AllRAMProcessor.hpp" @@ -52,5 +51,3 @@ class AllRAMProcessor: }; } - -#endif /* Z80AllRAM_hpp */ diff --git a/Processors/Z80/Implementation/Z80Implementation.hpp b/Processors/Z80/Implementation/Z80Implementation.hpp index 12fb1ed70..463304e72 100644 --- a/Processors/Z80/Implementation/Z80Implementation.hpp +++ b/Processors/Z80/Implementation/Z80Implementation.hpp @@ -18,23 +18,211 @@ template < class T, bool uses_bus_request, bool uses_wait_line> void Processor ::run_for(const HalfCycles cycles) { -#define advance_operation() \ - pc_increment_ = 1; \ - if(last_request_status_) { \ - halt_mask_ = 0xff; \ - if(last_request_status_ & (Interrupt::PowerOn | Interrupt::Reset)) { \ - request_status_ &= ~Interrupt::PowerOn; \ - scheduled_program_counter_ = reset_program_.data(); \ - } else if(last_request_status_ & Interrupt::NMI) { \ - request_status_ &= ~Interrupt::NMI; \ - scheduled_program_counter_ = nmi_program_.data(); \ - } else if(last_request_status_ & Interrupt::IRQ) { \ - scheduled_program_counter_ = irq_program_[interrupt_mode_].data(); \ - } \ - } else { \ - current_instruction_page_ = &base_page_; \ - scheduled_program_counter_ = base_page_.fetch_decode_execute_data; \ - } + + /// Schedules the next concrete block of work for the CPU, whatever that may be: + /// performing the reset, NMI or IRQ sequences, or fetching a new instruction. + const auto advance_operation = [&] { + pc_increment_ = 1; + if(last_request_status_) { + halt_mask_ = 0xff; + if(last_request_status_ & (Interrupt::PowerOn | Interrupt::Reset)) { + request_status_ &= ~Interrupt::PowerOn; + scheduled_program_counter_ = reset_program_.data(); + } else if(last_request_status_ & Interrupt::NMI) { + request_status_ &= ~Interrupt::NMI; + scheduled_program_counter_ = nmi_program_.data(); + } else if(last_request_status_ & Interrupt::IRQ) { + scheduled_program_counter_ = irq_program_[interrupt_mode_].data(); + } + } else { + current_instruction_page_ = &base_page_; + scheduled_program_counter_ = base_page_.fetch_decode_execute_data; + } + }; + + /// Indicates that the ALU was used in this operation; this affects flag output in future SCF and CCFs. + const auto set_did_compute_flags = [&] { + flag_adjustment_history_ |= 1; + }; + + /// Computes parity for @c v, leaving it bit 2 of parity_overflow_result_; the other bits are undefined. + const auto set_parity = [&](uint8_t v) { + parity_overflow_result_ = uint8_t(v^1); + parity_overflow_result_ ^= parity_overflow_result_ >> 4; + parity_overflow_result_ ^= parity_overflow_result_ << 2; + parity_overflow_result_ ^= parity_overflow_result_ >> 1; + }; + + /// Sets flags as expected at the end of a logical operation — an AND, OR or XOR. + /// Specifically: + /// * S, Z, 5 and 3 are set according to the value in A; + /// * P/V is set according to the parity of A; + /// * N and C are cleared; and + /// * H is set to whatever value is supplied as an argument. + const auto set_logical_flags = [&](uint8_t half_carry) { + sign_result_ = zero_result_ = bit53_result_ = a_; + set_parity(a_); + half_carry_result_ = half_carry; + subtract_flag_ = 0; + carry_result_ = 0; + set_did_compute_flags(); + }; + + /// Sets flags as expected at the end of an arithmetic operation. + /// Specifically: + /// * S and Z are set according to result as trucated to 8 bits; + /// * C is set according to bit 8 of result; + /// * H is set according to whatever is supplied as half_result; + /// * V is set according to bit 7 of overflow; + /// * N is set to whatever is supplied as subtact; and + /// * 5 & 3 are set to the respective bits of bits53. + const auto set_arithmetic_flags = [&](int result, int half_result, int overflow, uint8_t subtract, uint8_t bits53) { + sign_result_ = zero_result_ = uint8_t(result); + carry_result_ = uint8_t(result >> 8); + half_carry_result_ = uint8_t(half_result); + parity_overflow_result_ = uint8_t(overflow >> 5); + subtract_flag_ = subtract; + bit53_result_ = bits53; + set_did_compute_flags(); + }; + + /// Sets flags as expected at the end of an 8080-style rotate operation (i.e. RRA, RRCA, RLA or RLCA). + /// Specifically: + /// * C is set to whatever is supplied as new_carry; + /// * 5 and 3 are set from the result now stored in A; and + /// * H and N are reset. + const auto set_rotate_flags = [&](uint8_t new_carry) { + bit53_result_ = a_; + carry_result_ = new_carry; + half_carry_result_ = subtract_flag_ = 0; + set_did_compute_flags(); + }; + + /// Sets flags as expected at the end of a decimal rotate, shift or post-8080-style rotate operation. + /// Specifically: + /// * S, Z, 5 and 3 are set according to the value of source; + /// * P is set according to the parity of the source; and + /// * H and N are reset. + const auto set_shift_flags = [&](uint8_t source) { + sign_result_ = zero_result_ = bit53_result_ = source; + set_parity(source); + half_carry_result_ = subtract_flag_ = 0; + set_did_compute_flags(); + }; + + /// Takes appropriate action for an untaken conditional branch; this might mean just skipping to the next instruction or it might mean taking + /// some other alternative follow-up action. + const auto decline_conditional = [&](const MicroOp *operation) { + if(operation->source) { + scheduled_program_counter_ = static_cast(operation->source); + } else { + advance_operation(); + } + }; + + /// Performs the repeat step of LDIR, LDDR, etc that either: + /// * repeats this instruction if test is true, updating MEMPTR appropriately; or + /// * moves to the next operation otherwise. + const auto repeat_mem = [&](bool test) { + if(test) { + pc_.full -= 2; + memptr_.full = pc_.full + 1; + } else { + advance_operation(); + } + }; + + /// Performs the repeat step of INIR, OTIR, etc that either: + /// * repeats this instruction if test is true; or + /// * moves to the next operation otherwise. + /// Unlike repeat_memptr, this does not affect MEMPTR. + const auto repeat_io = [&](bool test) { + if(test) { + pc_.full -= 2; + } else { + advance_operation(); + } + }; + + /// Performs a single instance of LDD/LDI/LDDR/LDIR, setting flags appropriately. + const auto LDxR = [&](int direction) { + --bc_.full; + de_.full += direction; + hl_.full += direction; + + const uint8_t sum = a_ + temp8_; + bit53_result_ = uint8_t((sum&0x8) | ((sum & 0x02) << 4)); + subtract_flag_ = 0; + half_carry_result_ = 0; + parity_overflow_result_ = bc_.full ? Flag::Parity : 0; + set_did_compute_flags(); + }; + + /// Performs a single instance of CPD/CPI/CPDR/CPIR, setting flags appropriately. + const auto CPxR = [&](int direction) { + --bc_.full; + hl_.full += direction; + memptr_.full += direction; + + uint8_t result = a_ - temp8_; + const uint8_t half_result = (a_&0xf) - (temp8_&0xf); + + parity_overflow_result_ = bc_.full ? Flag::Parity : 0; + half_carry_result_ = half_result; + subtract_flag_ = Flag::Subtract; + sign_result_ = zero_result_ = result; + + result -= (half_result >> 4)&1; + bit53_result_ = uint8_t((result&0x8) | ((result&0x2) << 4)); + set_did_compute_flags(); + }; + + /// Performs a single instance of IND/INI/INDR/INIR, setting flags appropriately. + const auto INxR = [&](int direction) { + memptr_.full = uint16_t(bc_.full + direction); + --bc_.halves.high; + hl_.full += direction; + + sign_result_ = zero_result_ = bit53_result_ = bc_.halves.high; + subtract_flag_ = (temp8_ >> 6) & Flag::Subtract; + + const int next_bc = bc_.halves.low + direction; + int summation = temp8_ + (next_bc&0xff); + + if(summation > 0xff) { + carry_result_ = Flag::Carry; + half_carry_result_ = Flag::HalfCarry; + } else { + carry_result_ = 0; + half_carry_result_ = 0; + } + + summation = (summation&7) ^ bc_.halves.high; + set_parity(uint8_t(summation)); + set_did_compute_flags(); + }; + + /// Performs a single instance of OTD/OTI/OTDR/OTIR, setting flags appropriately. + const auto OUTxR = [&](int direction) { + --bc_.halves.high; + memptr_.full = uint16_t(bc_.full + direction); + hl_.full += direction; + + sign_result_ = zero_result_ = bit53_result_ = bc_.halves.high; + subtract_flag_ = (temp8_ >> 6) & Flag::Subtract; + + int summation = temp8_ + hl_.halves.low; + if(summation > 0xff) { + carry_result_ = Flag::Carry; + half_carry_result_ = Flag::HalfCarry; + } else { + carry_result_ = half_carry_result_ = 0; + } + + summation = (summation&7) ^ bc_.halves.high; + set_parity(uint8_t(summation)); + set_did_compute_flags(); + }; number_of_cycles_ += cycles; if(!scheduled_program_counter_) { @@ -42,7 +230,6 @@ template < class T, } while(1) { - do_bus_acknowledge: while(uses_bus_request && bus_request_line_) { static PartialMachineCycle bus_acknowledge_cycle = {PartialMachineCycle::BusAcknowledge, HalfCycles(2), nullptr, nullptr, false}; @@ -56,15 +243,6 @@ template < class T, const MicroOp *const operation = scheduled_program_counter_; scheduled_program_counter_++; -#define set_did_compute_flags() \ - flag_adjustment_history_ |= 1; - -#define set_parity(v) \ - parity_overflow_result_ = uint8_t(v^1);\ - parity_overflow_result_ ^= parity_overflow_result_ >> 4;\ - parity_overflow_result_ ^= parity_overflow_result_ << 2;\ - parity_overflow_result_ ^= parity_overflow_result_ >> 1; - switch(operation->type) { case MicroOp::BusOperation: if(number_of_cycles_ < operation->machine_cycle.length) { @@ -118,14 +296,6 @@ template < class T, // MARK: - Logical -#define set_logical_flags(hf) \ - sign_result_ = zero_result_ = bit53_result_ = a_; \ - set_parity(a_); \ - half_carry_result_ = hf; \ - subtract_flag_ = 0; \ - carry_result_ = 0; \ - set_did_compute_flags(); - case MicroOp::And: a_ &= *static_cast(operation->source); set_logical_flags(Flag::HalfCarry); @@ -141,8 +311,6 @@ template < class T, set_logical_flags(0); break; -#undef set_logical_flags - case MicroOp::CPL: a_ ^= 0xff; subtract_flag_ = Flag::Subtract; @@ -190,26 +358,17 @@ template < class T, // MARK: - 8-bit arithmetic -#define set_arithmetic_flags(sub, b53) \ - sign_result_ = zero_result_ = uint8_t(result); \ - carry_result_ = uint8_t(result >> 8); \ - half_carry_result_ = uint8_t(half_result); \ - parity_overflow_result_ = uint8_t(overflow >> 5); \ - subtract_flag_ = sub; \ - bit53_result_ = uint8_t(b53); \ - set_did_compute_flags(); - case MicroOp::CP8: { const uint8_t value = *static_cast(operation->source); const int result = a_ - value; const int half_result = (a_&0xf) - (value&0xf); - // overflow for a subtraction is when the signs were originally - // different and the result is different again + // Overflow for a subtraction is when the signs were originally + // different and the result is different again. const int overflow = (value^a_) & (result^a_); - // the 5 and 3 flags come from the operand, atypically - set_arithmetic_flags(Flag::Subtract, value); + // The 5 and 3 flags come from the operand, atypically. + set_arithmetic_flags(result, half_result, overflow, Flag::Subtract, value); } break; case MicroOp::SUB8: { @@ -222,7 +381,7 @@ template < class T, const int overflow = (value^a_) & (result^a_); a_ = uint8_t(result); - set_arithmetic_flags(Flag::Subtract, result); + set_arithmetic_flags(result, half_result, overflow, Flag::Subtract, uint8_t(result)); } break; case MicroOp::SBC8: { @@ -235,7 +394,7 @@ template < class T, const int overflow = (value^a_) & (result^a_); a_ = uint8_t(result); - set_arithmetic_flags(Flag::Subtract, result); + set_arithmetic_flags(result, half_result, overflow, Flag::Subtract, uint8_t(result)); } break; case MicroOp::ADD8: { @@ -248,7 +407,7 @@ template < class T, const int overflow = ~(value^a_) & (result^a_); a_ = uint8_t(result); - set_arithmetic_flags(0, result); + set_arithmetic_flags(result, half_result, overflow, 0, uint8_t(result)); } break; case MicroOp::ADC8: { @@ -261,23 +420,16 @@ template < class T, const int overflow = ~(value^a_) & (result^a_); a_ = uint8_t(result); - set_arithmetic_flags(0, result); + set_arithmetic_flags(result, half_result, overflow, 0, uint8_t(result)); } break; -#undef set_arithmetic_flags - case MicroOp::NEG: { const int overflow = (a_ == 0x80); const int result = -a_; - const int halfResult = -(a_&0xf); + const int half_result = -(a_&0xf); a_ = uint8_t(result); - bit53_result_ = sign_result_ = zero_result_ = a_; - parity_overflow_result_ = overflow ? Flag::Overflow : 0; - subtract_flag_ = Flag::Subtract; - carry_result_ = uint8_t(result >> 8); - half_carry_result_ = uint8_t(halfResult); - set_did_compute_flags(); + set_arithmetic_flags(result, half_result, overflow ? 0xff : 0x00, Flag::Subtract, a_); } break; case MicroOp::Increment8: { @@ -368,11 +520,11 @@ template < class T, const uint16_t sourceValue = *static_cast(operation->source); const uint16_t destinationValue = memptr_.full; const int result = sourceValue + destinationValue; - const int halfResult = (sourceValue&0xfff) + (destinationValue&0xfff); + const int half_result = (sourceValue&0xfff) + (destinationValue&0xfff); bit53_result_ = uint8_t(result >> 8); carry_result_ = uint8_t(result >> 16); - half_carry_result_ = uint8_t(halfResult >> 8); + half_carry_result_ = uint8_t(half_result >> 8); subtract_flag_ = 0; set_did_compute_flags(); @@ -385,7 +537,7 @@ template < class T, const uint16_t sourceValue = *static_cast(operation->source); const uint16_t destinationValue = memptr_.full; const int result = sourceValue + destinationValue + (carry_result_ & Flag::Carry); - const int halfResult = (sourceValue&0xfff) + (destinationValue&0xfff) + (carry_result_ & Flag::Carry); + const int half_result = (sourceValue&0xfff) + (destinationValue&0xfff) + (carry_result_ & Flag::Carry); const int overflow = (result ^ destinationValue) & ~(destinationValue ^ sourceValue); @@ -394,7 +546,7 @@ template < class T, zero_result_ = uint8_t(result | sign_result_); subtract_flag_ = 0; carry_result_ = uint8_t(result >> 16); - half_carry_result_ = uint8_t(halfResult >> 8); + half_carry_result_ = uint8_t(half_result >> 8); parity_overflow_result_ = uint8_t(overflow >> 13); set_did_compute_flags(); @@ -407,7 +559,7 @@ template < class T, const uint16_t sourceValue = *static_cast(operation->source); const uint16_t destinationValue = memptr_.full; const int result = destinationValue - sourceValue - (carry_result_ & Flag::Carry); - const int halfResult = (destinationValue&0xfff) - (sourceValue&0xfff) - (carry_result_ & Flag::Carry); + const int half_result = (destinationValue&0xfff) - (sourceValue&0xfff) - (carry_result_ & Flag::Carry); // subtraction, so parity rules are: // signs of operands were different, @@ -419,7 +571,7 @@ template < class T, zero_result_ = uint8_t(result | sign_result_); subtract_flag_ = Flag::Subtract; carry_result_ = uint8_t(result >> 16); - half_carry_result_ = uint8_t(halfResult >> 8); + half_carry_result_ = uint8_t(half_result >> 8); parity_overflow_result_ = uint8_t(overflow >> 13); set_did_compute_flags(); @@ -429,32 +581,20 @@ template < class T, // MARK: - Conditionals -#define decline_conditional() \ - if(operation->source) { \ - scheduled_program_counter_ = (MicroOp *)operation->source; \ - } else { \ - advance_operation(); \ - } - - case MicroOp::TestNZ: if(!zero_result_) { decline_conditional(); } break; - case MicroOp::TestZ: if(zero_result_) { decline_conditional(); } break; - case MicroOp::TestNC: if(carry_result_ & Flag::Carry) { decline_conditional(); } break; - case MicroOp::TestC: if(!(carry_result_ & Flag::Carry)) { decline_conditional(); } break; - case MicroOp::TestPO: if(parity_overflow_result_ & Flag::Parity) { decline_conditional(); } break; - case MicroOp::TestPE: if(!(parity_overflow_result_ & Flag::Parity)) { decline_conditional(); } break; - case MicroOp::TestP: if(sign_result_ & Flag::Sign) { decline_conditional(); } break; - case MicroOp::TestM: if(!(sign_result_ & Flag::Sign)) { decline_conditional(); } break; - -#undef decline_conditional + case MicroOp::TestNZ: if(!zero_result_) { decline_conditional(operation); } break; + case MicroOp::TestZ: if(zero_result_) { decline_conditional(operation); } break; + case MicroOp::TestNC: if(carry_result_ & Flag::Carry) { decline_conditional(operation); } break; + case MicroOp::TestC: if(!(carry_result_ & Flag::Carry)) { decline_conditional(operation); } break; + case MicroOp::TestPO: if(parity_overflow_result_ & Flag::Parity) { decline_conditional(operation); } break; + case MicroOp::TestPE: if(!(parity_overflow_result_ & Flag::Parity)) { decline_conditional(operation); } break; + case MicroOp::TestP: if(sign_result_ & Flag::Sign) { decline_conditional(operation); } break; + case MicroOp::TestM: if(!(sign_result_ & Flag::Sign)) { decline_conditional(operation); } break; // MARK: - Exchange -#define swap(a, b) temp = a.full; a.full = b.full; b.full = temp; - - case MicroOp::ExDEHL: { - uint16_t temp; - swap(de_, hl_); - } break; + case MicroOp::ExDEHL: + std::swap(de_, hl_); + break; case MicroOp::ExAFAFDash: { const uint8_t a = a_; @@ -465,177 +605,56 @@ template < class T, af_dash_.halves.low = f; } break; - case MicroOp::EXX: { - uint16_t temp; - swap(de_, de_dash_); - swap(bc_, bc_dash_); - swap(hl_, hl_dash_); - } break; - -#undef swap + case MicroOp::EXX: + std::swap(de_, de_dash_); + std::swap(bc_, bc_dash_); + std::swap(hl_, hl_dash_); + break; // MARK: - Repetition -#define REPEAT(test) \ - if(test) { \ - pc_.full -= 2; \ - memptr_.full = pc_.full + 1; \ - } else { \ - advance_operation(); \ - } - -#define LDxR_STEP(dir) \ - bc_.full--; \ - de_.full += dir; \ - hl_.full += dir; \ - const uint8_t sum = a_ + temp8_; \ - bit53_result_ = uint8_t((sum&0x8) | ((sum & 0x02) << 4)); \ - subtract_flag_ = 0; \ - half_carry_result_ = 0; \ - parity_overflow_result_ = bc_.full ? Flag::Parity : 0; \ - set_did_compute_flags(); - - case MicroOp::LDDR: { - LDxR_STEP(-1); - REPEAT(bc_.full); - } break; - - case MicroOp::LDIR: { - LDxR_STEP(1); - REPEAT(bc_.full); - } break; - - case MicroOp::LDD: { - LDxR_STEP(-1); - } break; - - case MicroOp::LDI: { - LDxR_STEP(1); - } break; - -#undef LDxR_STEP - -#define CPxR_STEP(dir) \ - hl_.full += dir; \ - memptr_.full += dir; \ - bc_.full--; \ - \ - uint8_t result = a_ - temp8_; \ - const uint8_t halfResult = (a_&0xf) - (temp8_&0xf); \ - \ - parity_overflow_result_ = bc_.full ? Flag::Parity : 0; \ - half_carry_result_ = halfResult; \ - subtract_flag_ = Flag::Subtract; \ - sign_result_ = zero_result_ = result; \ - \ - result -= (halfResult >> 4)&1; \ - bit53_result_ = uint8_t((result&0x8) | ((result&0x2) << 4)); \ - set_did_compute_flags(); - - case MicroOp::CPDR: { - CPxR_STEP(-1); - REPEAT(bc_.full && sign_result_); - } break; - - case MicroOp::CPIR: { - CPxR_STEP(1); - REPEAT(bc_.full && sign_result_); - } break; - - case MicroOp::CPD: { - CPxR_STEP(-1); - } break; - - case MicroOp::CPI: { - CPxR_STEP(1); - } break; - -#undef CPxR_STEP - -#undef REPEAT -#define REPEAT(test) \ - if(test) { \ - pc_.full -= 2; \ - } else { \ - advance_operation(); \ - } - -#define INxR_STEP(dir) \ - memptr_.full = uint16_t(bc_.full + dir); \ - bc_.halves.high--; \ - hl_.full += dir; \ - \ - sign_result_ = zero_result_ = bit53_result_ = bc_.halves.high; \ - subtract_flag_ = (temp8_ >> 6) & Flag::Subtract; \ - \ - const int next_bc = bc_.halves.low + dir; \ - int summation = temp8_ + (next_bc&0xff); \ - \ - if(summation > 0xff) { \ - carry_result_ = Flag::Carry; \ - half_carry_result_ = Flag::HalfCarry; \ - } else { \ - carry_result_ = 0; \ - half_carry_result_ = 0; \ - } \ - \ - summation = (summation&7) ^ bc_.halves.high; \ - set_parity(summation); \ - set_did_compute_flags(); - - case MicroOp::INDR: { - INxR_STEP(-1); - REPEAT(bc_.halves.high); - } break; - - case MicroOp::INIR: { - INxR_STEP(1); - REPEAT(bc_.halves.high); - } break; - - case MicroOp::IND: { - INxR_STEP(-1); - } break; - - case MicroOp::INI: { - INxR_STEP(1); - } break; - -#undef INxR_STEP - -#define OUTxR_STEP(dir) \ - bc_.halves.high--; \ - memptr_.full = uint16_t(bc_.full + dir); \ - hl_.full += dir; \ - \ - sign_result_ = zero_result_ = bit53_result_ = bc_.halves.high; \ - subtract_flag_ = (temp8_ >> 6) & Flag::Subtract; \ - \ - int summation = temp8_ + hl_.halves.low; \ - if(summation > 0xff) { \ - carry_result_ = Flag::Carry; \ - half_carry_result_ = Flag::HalfCarry; \ - } else { \ - carry_result_ = half_carry_result_ = 0; \ - } \ - \ - summation = (summation&7) ^ bc_.halves.high; \ - set_parity(summation); \ - set_did_compute_flags(); - - case MicroOp::OUT_R: - REPEAT(bc_.halves.high); + case MicroOp::LDDR: + LDxR(-1); + repeat_mem(bc_.full); break; - case MicroOp::OUTD: { - OUTxR_STEP(-1); - } break; + case MicroOp::LDIR: + LDxR(1); + repeat_mem(bc_.full); + break; - case MicroOp::OUTI: { - OUTxR_STEP(1); - } break; + case MicroOp::CPDR: + CPxR(-1); + repeat_mem(bc_.full && sign_result_); + break; -#undef OUTxR_STEP + case MicroOp::CPIR: + CPxR(1); + repeat_mem(bc_.full && sign_result_); + break; + + case MicroOp::INDR: + INxR(-1); + repeat_io(bc_.halves.high); + break; + + case MicroOp::INIR: + INxR(1); + repeat_io(bc_.halves.high); + break; + + case MicroOp::OUT_R: + repeat_io(bc_.halves.high); + break; + + case MicroOp::LDD: LDxR(-1); break; + case MicroOp::CPD: CPxR(-1); break; + case MicroOp::IND: INxR(-1); break; + case MicroOp::OUTD: OUTxR(-1); break; + case MicroOp::LDI: LDxR(1); break; + case MicroOp::CPI: CPxR(1); break; + case MicroOp::INI: INxR(1); break; + case MicroOp::OUTI: OUTxR(1); break; // MARK: - Bit Manipulation @@ -666,110 +685,94 @@ template < class T, // MARK: - Rotation and shifting -#define set_rotate_flags() \ - bit53_result_ = a_; \ - carry_result_ = new_carry; \ - subtract_flag_ = half_carry_result_ = 0; \ - set_did_compute_flags(); - case MicroOp::RLA: { const uint8_t new_carry = a_ >> 7; a_ = uint8_t((a_ << 1) | (carry_result_ & Flag::Carry)); - set_rotate_flags(); + set_rotate_flags(new_carry); } break; case MicroOp::RRA: { const uint8_t new_carry = a_ & 1; a_ = uint8_t((a_ >> 1) | (carry_result_ << 7)); - set_rotate_flags(); + set_rotate_flags(new_carry); } break; case MicroOp::RLCA: { const uint8_t new_carry = a_ >> 7; a_ = uint8_t((a_ << 1) | new_carry); - set_rotate_flags(); + set_rotate_flags(new_carry); } break; case MicroOp::RRCA: { const uint8_t new_carry = a_ & 1; a_ = uint8_t((a_ >> 1) | (new_carry << 7)); - set_rotate_flags(); + set_rotate_flags(new_carry); } break; -#undef set_rotate_flags + case MicroOp::RLC: { + uint8_t &source = *static_cast(operation->source); + carry_result_ = source >> 7; + source = uint8_t((source << 1) | carry_result_); + set_shift_flags(source); + } break; -#define set_shift_flags() \ - sign_result_ = zero_result_ = bit53_result_ = *static_cast(operation->source); \ - set_parity(sign_result_); \ - half_carry_result_ = 0; \ - subtract_flag_ = 0; \ - set_did_compute_flags(); - - case MicroOp::RLC: - carry_result_ = *static_cast(operation->source) >> 7; - *static_cast(operation->source) = uint8_t((*static_cast(operation->source) << 1) | carry_result_); - set_shift_flags(); - break; - - case MicroOp::RRC: - carry_result_ = *static_cast(operation->source); - *static_cast(operation->source) = uint8_t((*static_cast(operation->source) >> 1) | (carry_result_ << 7)); - set_shift_flags(); - break; + case MicroOp::RRC: { + uint8_t &source = *static_cast(operation->source); + carry_result_ = source; + source = uint8_t((source >> 1) | (carry_result_ << 7)); + set_shift_flags(source); + } break; case MicroOp::RL: { - const uint8_t next_carry = *static_cast(operation->source) >> 7; - *static_cast(operation->source) = uint8_t((*static_cast(operation->source) << 1) | (carry_result_ & Flag::Carry)); + uint8_t &source = *static_cast(operation->source); + const uint8_t next_carry = source >> 7; + source = uint8_t((source << 1) | (carry_result_ & Flag::Carry)); carry_result_ = next_carry; - set_shift_flags(); + set_shift_flags(source); } break; case MicroOp::RR: { - const uint8_t next_carry = *static_cast(operation->source); - *static_cast(operation->source) = uint8_t((*static_cast(operation->source) >> 1) | (carry_result_ << 7)); + uint8_t &source = *static_cast(operation->source); + const uint8_t next_carry = source; + source = uint8_t((source >> 1) | (carry_result_ << 7)); carry_result_ = next_carry; - set_shift_flags(); + set_shift_flags(source); } break; - case MicroOp::SLA: - carry_result_ = *static_cast(operation->source) >> 7; - *static_cast(operation->source) = uint8_t(*static_cast(operation->source) << 1); - set_shift_flags(); - break; + case MicroOp::SLA: { + uint8_t &source = *static_cast(operation->source); + carry_result_ = source >> 7; + source <<= 1; + set_shift_flags(source); + } break; - case MicroOp::SRA: - carry_result_ = *static_cast(operation->source); - *static_cast(operation->source) = uint8_t((*static_cast(operation->source) >> 1) | (*static_cast(operation->source) & 0x80)); - set_shift_flags(); - break; + case MicroOp::SRA: { + uint8_t &source = *static_cast(operation->source); + carry_result_ = source; + source = uint8_t((source >> 1) | (source & 0x80)); + set_shift_flags(source); + } break; - case MicroOp::SLL: - carry_result_ = *static_cast(operation->source) >> 7; - *static_cast(operation->source) = uint8_t(*static_cast(operation->source) << 1) | 1; - set_shift_flags(); - break; + case MicroOp::SLL: { + uint8_t &source = *static_cast(operation->source); + carry_result_ = source >> 7; + source = uint8_t(source << 1) | 1; + set_shift_flags(source); + } break; - case MicroOp::SRL: - carry_result_ = *static_cast(operation->source); - *static_cast(operation->source) = uint8_t((*static_cast(operation->source) >> 1)); - set_shift_flags(); - break; - -#undef set_shift_flags - -#define set_decimal_rotate_flags() \ - subtract_flag_ = 0; \ - half_carry_result_ = 0; \ - set_parity(a_); \ - bit53_result_ = zero_result_ = sign_result_ = a_; \ - set_did_compute_flags(); + case MicroOp::SRL: { + uint8_t &source = *static_cast(operation->source); + carry_result_ = source; + source >>= 1; + set_shift_flags(source); + } break; case MicroOp::RRD: { memptr_.full = hl_.full + 1; const uint8_t low_nibble = a_ & 0xf; a_ = (a_ & 0xf0) | (temp8_ & 0xf); temp8_ = uint8_t((temp8_ >> 4) | (low_nibble << 4)); - set_decimal_rotate_flags(); + set_shift_flags(a_); } break; case MicroOp::RLD: { @@ -777,12 +780,9 @@ template < class T, const uint8_t low_nibble = a_ & 0xf; a_ = (a_ & 0xf0) | (temp8_ >> 4); temp8_ = uint8_t((temp8_ << 4) | low_nibble); - set_decimal_rotate_flags(); + set_shift_flags(a_); } break; -#undef set_decimal_rotate_flags - - // MARK: - Interrupt state case MicroOp::EI: @@ -875,7 +875,7 @@ template < class T, // MARK: - Internal bookkeeping case MicroOp::SetInstructionPage: - current_instruction_page_ = (InstructionPage *)operation->source; + current_instruction_page_ = static_cast(operation->source); scheduled_program_counter_ = current_instruction_page_->fetch_decode_execute_data; break; @@ -890,7 +890,6 @@ template < class T, case MicroOp::IndexedPlaceHolder: return; } -#undef set_parity } } @@ -926,8 +925,6 @@ template < class T, return wait_line_; } -#define isTerminal(n) (n == MicroOp::MoveToNextProgram || n == MicroOp::DecodeOperation) - template < class T, bool uses_bus_request, bool uses_wait_line> void Processor @@ -938,7 +935,7 @@ template < class T, // Count number of micro-ops required. for(int c = 0; c < 256; c++) { std::size_t length = 0; - while(!isTerminal(table[c][length].type)) length++; + while(!is_terminal(table[c][length].type)) length++; length++; lengths[c] = length; number_of_micro_ops += length; @@ -995,7 +992,7 @@ template < class T, bool uses_wait_line> void Processor ::copy_program(const MicroOp *source, std::vector &destination) { std::size_t length = 0; - while(!isTerminal(source[length].type)) length++; + while(!is_terminal(source[length].type)) length++; std::size_t pointer = 0; while(true) { // TODO: This test is duplicated from assemble_page; can a better factoring be found? @@ -1006,13 +1003,11 @@ template < class T, } destination.emplace_back(source[pointer]); - if(isTerminal(source[pointer].type)) break; + if(is_terminal(source[pointer].type)) break; pointer++; } } -#undef isTerminal - bool ProcessorBase::get_halt_line() const { return halt_mask_ == 0x00; } diff --git a/Processors/Z80/Implementation/Z80Storage.hpp b/Processors/Z80/Implementation/Z80Storage.hpp index b88bf2a84..aaf07e8c9 100644 --- a/Processors/Z80/Implementation/Z80Storage.hpp +++ b/Processors/Z80/Implementation/Z80Storage.hpp @@ -115,6 +115,9 @@ class ProcessorStorage { void *destination = nullptr; PartialMachineCycle machine_cycle{}; }; + static constexpr bool is_terminal(MicroOp::Type type) { + return type == MicroOp::MoveToNextProgram || type == MicroOp::DecodeOperation; + } struct InstructionPage { std::vector instructions; diff --git a/Processors/Z80/State/State.hpp b/Processors/Z80/State/State.hpp index b074e38bf..c7ff77e6b 100644 --- a/Processors/Z80/State/State.hpp +++ b/Processors/Z80/State/State.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef Z80_State_hpp -#define Z80_State_hpp +#pragma once #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -96,5 +95,3 @@ struct State: public Reflection::StructImpl { } } - -#endif /* Z80_State_hpp */ diff --git a/Processors/Z80/Z80.hpp b/Processors/Z80/Z80.hpp index b5a453640..6ff3543db 100644 --- a/Processors/Z80/Z80.hpp +++ b/Processors/Z80/Z80.hpp @@ -6,9 +6,9 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Z80_hpp -#define Z80_hpp +#pragma once +#include #include #include #include @@ -537,5 +537,3 @@ template class Processor: #include "Implementation/Z80Implementation.hpp" } - -#endif /* Z80_hpp */ diff --git a/Reflection/Dispatcher.hpp b/Reflection/Dispatcher.hpp index a3ac2bb13..8a59c0547 100644 --- a/Reflection/Dispatcher.hpp +++ b/Reflection/Dispatcher.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef Dispatcher_hpp -#define Dispatcher_hpp +#pragma once #include #include @@ -170,5 +169,3 @@ struct SubrangeDispatcher { #undef index2048 } - -#endif /* Dispatcher_hpp */ diff --git a/Reflection/Enum.hpp b/Reflection/Enum.hpp index 09fd48719..919daa80b 100644 --- a/Reflection/Enum.hpp +++ b/Reflection/Enum.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef Enum_hpp -#define Enum_hpp +#pragma once #include #include @@ -169,5 +168,3 @@ class Enum { }; } - -#endif /* Enum_hpp */ diff --git a/Reflection/Struct.hpp b/Reflection/Struct.hpp index c3be36f89..283ffcaba 100644 --- a/Reflection/Struct.hpp +++ b/Reflection/Struct.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef Struct_hpp -#define Struct_hpp +#pragma once #include #include @@ -428,5 +427,3 @@ template Type get(const Struct &target, const std::string &name, } } - -#endif /* Struct_hpp */ diff --git a/SignalProcessing/FIRFilter.cpp b/SignalProcessing/FIRFilter.cpp index 48bd3e5f1..382e11030 100644 --- a/SignalProcessing/FIRFilter.cpp +++ b/SignalProcessing/FIRFilter.cpp @@ -11,7 +11,7 @@ #include #ifndef M_PI -#define M_PI 3.1415926f +static constexpr float M_PI = 3.1415926f; #endif using namespace SignalProcessing; diff --git a/SignalProcessing/FIRFilter.hpp b/SignalProcessing/FIRFilter.hpp index d1899033a..4a5b62fc6 100644 --- a/SignalProcessing/FIRFilter.hpp +++ b/SignalProcessing/FIRFilter.hpp @@ -6,8 +6,7 @@ // Copyright 2011 Thomas Harte. All rights reserved. // -#ifndef FIRFilter_hpp -#define FIRFilter_hpp +#pragma once // Use the Accelerate framework to vectorise, unless this is a Qt build. // Primarily that avoids gymnastics in the QMake file; it also eliminates @@ -101,5 +100,3 @@ class FIRFilter { }; } - -#endif diff --git a/SignalProcessing/Stepper.hpp b/SignalProcessing/Stepper.hpp index cacaf753e..82ce1356b 100644 --- a/SignalProcessing/Stepper.hpp +++ b/SignalProcessing/Stepper.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Stepper_hpp -#define Stepper_hpp +#pragma once #include @@ -94,5 +93,3 @@ class Stepper { }; } - -#endif /* Stepper_hpp */ diff --git a/Storage/Cartridge/Cartridge.hpp b/Storage/Cartridge/Cartridge.hpp index 89784665d..140ee2d88 100644 --- a/Storage/Cartridge/Cartridge.hpp +++ b/Storage/Cartridge/Cartridge.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Cartridge_hpp -#define Storage_Cartridge_hpp +#pragma once #include #include @@ -81,5 +80,3 @@ class Cartridge { }; } - -#endif /* ROM_hpp */ diff --git a/Storage/Cartridge/Encodings/CommodoreROM.hpp b/Storage/Cartridge/Encodings/CommodoreROM.hpp index 21f0ccc14..518062dd3 100644 --- a/Storage/Cartridge/Encodings/CommodoreROM.hpp +++ b/Storage/Cartridge/Encodings/CommodoreROM.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef CommodoreROM_hpp -#define CommodoreROM_hpp +#pragma once #include #include @@ -17,5 +16,3 @@ namespace Storage::Cartridge::Encodings::CommodoreROM { bool isROM(const std::vector &); } - -#endif /* CommodoreROM_hpp */ diff --git a/Storage/Cartridge/Formats/BinaryDump.hpp b/Storage/Cartridge/Formats/BinaryDump.hpp index c1c0281da..0c45f6ac5 100644 --- a/Storage/Cartridge/Formats/BinaryDump.hpp +++ b/Storage/Cartridge/Formats/BinaryDump.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Cartridge_BinaryDump_hpp -#define Storage_Cartridge_BinaryDump_hpp +#pragma once #include "../Cartridge.hpp" @@ -25,5 +24,3 @@ class BinaryDump : public Cartridge { }; } - -#endif /* AcornROM_hpp */ diff --git a/Storage/Cartridge/Formats/PRG.hpp b/Storage/Cartridge/Formats/PRG.hpp index 8ca179eb7..0edb77a9b 100644 --- a/Storage/Cartridge/Formats/PRG.hpp +++ b/Storage/Cartridge/Formats/PRG.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Cartridge_PRG_hpp -#define Storage_Cartridge_PRG_hpp +#pragma once #include "../Cartridge.hpp" @@ -25,5 +24,3 @@ class PRG : public Cartridge { }; } - -#endif /* PRG_hpp */ diff --git a/Storage/Data/Commodore.hpp b/Storage/Data/Commodore.hpp index 4e8102640..fa8949013 100644 --- a/Storage/Data/Commodore.hpp +++ b/Storage/Data/Commodore.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Data_Commodore_hpp -#define Storage_Data_Commodore_hpp +#pragma once #include #include @@ -17,5 +16,3 @@ namespace Storage::Data::Commodore { std::wstring petscii_from_bytes(const uint8_t *string, int length, bool shifted); } - -#endif /* Commodore_hpp */ diff --git a/Storage/Data/ZX8081.hpp b/Storage/Data/ZX8081.hpp index f1a88ce2a..34c97f0c9 100644 --- a/Storage/Data/ZX8081.hpp +++ b/Storage/Data/ZX8081.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Storage_Data_ZX8081_hpp -#define Storage_Data_ZX8081_hpp +#pragma once #include #include @@ -28,5 +27,3 @@ std::wstring StringFromData(const std::vector &data, bool is_zx81); std::vector DataFromString(const std::wstring &string, bool is_zx81); } - -#endif /* ZX8081_hpp */ diff --git a/Storage/Disk/Controller/DiskController.hpp b/Storage/Disk/Controller/DiskController.hpp index aad387a16..dcf631978 100644 --- a/Storage/Disk/Controller/DiskController.hpp +++ b/Storage/Disk/Controller/DiskController.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Disk_Controller_hpp -#define Storage_Disk_Controller_hpp +#pragma once #include "../Drive.hpp" #include "../DPLL/DigitalPhaseLockedLoop.hpp" @@ -163,5 +162,3 @@ class Controller: }; } - -#endif /* DiskDrive_hpp */ diff --git a/Storage/Disk/Controller/MFMDiskController.hpp b/Storage/Disk/Controller/MFMDiskController.hpp index c802a5917..3cc449ef1 100644 --- a/Storage/Disk/Controller/MFMDiskController.hpp +++ b/Storage/Disk/Controller/MFMDiskController.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef MFMDiskController_hpp -#define MFMDiskController_hpp +#pragma once #include "DiskController.hpp" #include "../../../Numeric/CRC.hpp" @@ -166,5 +165,3 @@ class MFMController: public Controller { }; } - -#endif /* MFMDiskController_hpp */ diff --git a/Storage/Disk/DPLL/DigitalPhaseLockedLoop.hpp b/Storage/Disk/DPLL/DigitalPhaseLockedLoop.hpp index e6123fd23..1b053e5d6 100644 --- a/Storage/Disk/DPLL/DigitalPhaseLockedLoop.hpp +++ b/Storage/Disk/DPLL/DigitalPhaseLockedLoop.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef DigitalPhaseLockedLoop_hpp -#define DigitalPhaseLockedLoop_hpp +#pragma once #include #include @@ -132,5 +131,3 @@ template class DigitalPhaseL }; } - -#endif /* DigitalPhaseLockedLoop_hpp */ diff --git a/Storage/Disk/Disk.hpp b/Storage/Disk/Disk.hpp index 6677769ed..783502f49 100644 --- a/Storage/Disk/Disk.hpp +++ b/Storage/Disk/Disk.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Disk_hpp -#define Disk_hpp +#pragma once #include #include @@ -69,5 +68,3 @@ class Disk { }; } - -#endif /* Disk_hpp */ diff --git a/Storage/Disk/DiskImage/DiskImage.hpp b/Storage/Disk/DiskImage/DiskImage.hpp index 17405f807..fe46812b8 100644 --- a/Storage/Disk/DiskImage/DiskImage.hpp +++ b/Storage/Disk/DiskImage/DiskImage.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef DiskImage_hpp -#define DiskImage_hpp +#pragma once #include #include @@ -119,5 +118,3 @@ template class DiskImageHolder: public DiskImageHolderBase, public #include "DiskImageImplementation.hpp" } - -#endif /* DiskImage_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/2MG.hpp b/Storage/Disk/DiskImage/Formats/2MG.hpp index ca5c1973f..46a78ec3d 100644 --- a/Storage/Disk/DiskImage/Formats/2MG.hpp +++ b/Storage/Disk/DiskImage/Formats/2MG.hpp @@ -6,8 +6,7 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef _MG_hpp -#define _MG_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../MassStorage/MassStorageDevice.hpp" @@ -34,5 +33,3 @@ class Disk2MG { }; } - -#endif /* _MG_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/AcornADF.hpp b/Storage/Disk/DiskImage/Formats/AcornADF.hpp index ed4b529f4..54a8d12e7 100644 --- a/Storage/Disk/DiskImage/Formats/AcornADF.hpp +++ b/Storage/Disk/DiskImage/Formats/AcornADF.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef AcornADF_hpp -#define AcornADF_hpp +#pragma once #include "MFMSectorDump.hpp" @@ -37,5 +36,3 @@ class AcornADF: public MFMSectorDump { }; } - -#endif /* AcornADF_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/AmigaADF.hpp b/Storage/Disk/DiskImage/Formats/AmigaADF.hpp index 53ae21b4a..cfc85836c 100644 --- a/Storage/Disk/DiskImage/Formats/AmigaADF.hpp +++ b/Storage/Disk/DiskImage/Formats/AmigaADF.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef AmigaADF_hpp -#define AmigaADF_hpp +#pragma once #include "MFMSectorDump.hpp" @@ -41,5 +40,3 @@ class AmigaADF: public DiskImage { }; } - -#endif /* AmigaADF_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/AppleDSK.hpp b/Storage/Disk/DiskImage/Formats/AppleDSK.hpp index c3ca3992a..2dabc6915 100644 --- a/Storage/Disk/DiskImage/Formats/AppleDSK.hpp +++ b/Storage/Disk/DiskImage/Formats/AppleDSK.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef AppleDSK_hpp -#define AppleDSK_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -46,5 +45,3 @@ class AppleDSK: public DiskImage { }; } - -#endif /* AppleDSK_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/CPCDSK.hpp b/Storage/Disk/DiskImage/Formats/CPCDSK.hpp index ab4d333cb..d867f05a3 100644 --- a/Storage/Disk/DiskImage/Formats/CPCDSK.hpp +++ b/Storage/Disk/DiskImage/Formats/CPCDSK.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef CPCDSK_hpp -#define CPCDSK_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -70,5 +69,3 @@ class CPCDSK: public DiskImage { }; } - -#endif /* CPCDSK_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/D64.hpp b/Storage/Disk/DiskImage/Formats/D64.hpp index a3624709e..bed7273cb 100644 --- a/Storage/Disk/DiskImage/Formats/D64.hpp +++ b/Storage/Disk/DiskImage/Formats/D64.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef D64_hpp -#define D64_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -39,5 +38,3 @@ class D64: public DiskImage { }; } - -#endif /* D64_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/DMK.hpp b/Storage/Disk/DiskImage/Formats/DMK.hpp index e836148c9..dd2e29546 100644 --- a/Storage/Disk/DiskImage/Formats/DMK.hpp +++ b/Storage/Disk/DiskImage/Formats/DMK.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef DMK_hpp -#define DMK_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -49,5 +48,3 @@ class DMK: public DiskImage { }; } - -#endif /* DMK_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/FAT12.hpp b/Storage/Disk/DiskImage/Formats/FAT12.hpp index 66e9692c8..22683df94 100644 --- a/Storage/Disk/DiskImage/Formats/FAT12.hpp +++ b/Storage/Disk/DiskImage/Formats/FAT12.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef FAT12_hpp -#define FAT12_hpp +#pragma once #include "MFMSectorDump.hpp" @@ -35,5 +34,3 @@ class FAT12: public MFMSectorDump { }; } - -#endif /* FAT12_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/G64.hpp b/Storage/Disk/DiskImage/Formats/G64.hpp index e62a9c4ec..942f42096 100644 --- a/Storage/Disk/DiskImage/Formats/G64.hpp +++ b/Storage/Disk/DiskImage/Formats/G64.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef G64_hpp -#define G64_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -42,5 +41,3 @@ class G64: public DiskImage { }; } - -#endif /* G64_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/HFE.hpp b/Storage/Disk/DiskImage/Formats/HFE.hpp index ee0b503d9..127f8685d 100644 --- a/Storage/Disk/DiskImage/Formats/HFE.hpp +++ b/Storage/Disk/DiskImage/Formats/HFE.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef HFE_hpp -#define HFE_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -47,5 +46,3 @@ class HFE: public DiskImage { }; } - -#endif /* HFE_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/IMD.hpp b/Storage/Disk/DiskImage/Formats/IMD.hpp index 2ce703e7a..0614b9775 100644 --- a/Storage/Disk/DiskImage/Formats/IMD.hpp +++ b/Storage/Disk/DiskImage/Formats/IMD.hpp @@ -6,8 +6,7 @@ // Copyright © 2023 Thomas Harte. All rights reserved. // -#ifndef IMD_hpp -#define IMD_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -41,5 +40,3 @@ class IMD: public DiskImage { }; } - -#endif /* IMD_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/IPF.hpp b/Storage/Disk/DiskImage/Formats/IPF.hpp index 9aa06689b..597a8f8d3 100644 --- a/Storage/Disk/DiskImage/Formats/IPF.hpp +++ b/Storage/Disk/DiskImage/Formats/IPF.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef IPF_hpp -#define IPF_hpp +#pragma once #include "../DiskImage.hpp" #include "../../Track/PCMTrack.hpp" @@ -85,5 +84,3 @@ class IPF: public DiskImage, public TargetPlatform::TypeDistinguisher { }; } - -#endif /* IPF_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/MFMSectorDump.hpp b/Storage/Disk/DiskImage/Formats/MFMSectorDump.hpp index 21286d6ac..c58a5b237 100644 --- a/Storage/Disk/DiskImage/Formats/MFMSectorDump.hpp +++ b/Storage/Disk/DiskImage/Formats/MFMSectorDump.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef SectorDump_hpp -#define SectorDump_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -42,5 +41,3 @@ class MFMSectorDump: public DiskImage { }; } - -#endif /* SectorDump_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/MSA.hpp b/Storage/Disk/DiskImage/Formats/MSA.hpp index e78b912f7..c2e404f6b 100644 --- a/Storage/Disk/DiskImage/Formats/MSA.hpp +++ b/Storage/Disk/DiskImage/Formats/MSA.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef MSA_hpp -#define MSA_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -41,5 +40,3 @@ class MSA final: public DiskImage { }; } - -#endif /* MSA_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/MacintoshIMG.hpp b/Storage/Disk/DiskImage/Formats/MacintoshIMG.hpp index 54c71e8f7..1342f73ac 100644 --- a/Storage/Disk/DiskImage/Formats/MacintoshIMG.hpp +++ b/Storage/Disk/DiskImage/Formats/MacintoshIMG.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef MacintoshIMG_hpp -#define MacintoshIMG_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -73,5 +72,3 @@ class MacintoshIMG: public DiskImage { }; } - -#endif /* DiskCopy42_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/NIB.hpp b/Storage/Disk/DiskImage/Formats/NIB.hpp index 74129eae3..b4ff53b81 100644 --- a/Storage/Disk/DiskImage/Formats/NIB.hpp +++ b/Storage/Disk/DiskImage/Formats/NIB.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef NIB_hpp -#define NIB_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -45,5 +44,3 @@ class NIB: public DiskImage { }; } - -#endif /* NIB_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp b/Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp index 75ab277c0..51b37c2aa 100644 --- a/Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp +++ b/Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef OricMFMDSK_hpp -#define OricMFMDSK_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -46,5 +45,3 @@ class OricMFMDSK: public DiskImage { }; } - -#endif /* OricMFMDSK_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/PCBooter.hpp b/Storage/Disk/DiskImage/Formats/PCBooter.hpp index 1ca5a0e9c..d99dae690 100644 --- a/Storage/Disk/DiskImage/Formats/PCBooter.hpp +++ b/Storage/Disk/DiskImage/Formats/PCBooter.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef PCBooter_hpp -#define PCBooter_hpp +#pragma once #include "MFMSectorDump.hpp" @@ -34,5 +33,3 @@ class PCBooter: public MFMSectorDump { }; } - -#endif /* PCBooter_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/SSD.hpp b/Storage/Disk/DiskImage/Formats/SSD.hpp index 6158227cf..696dd59d9 100644 --- a/Storage/Disk/DiskImage/Formats/SSD.hpp +++ b/Storage/Disk/DiskImage/Formats/SSD.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef SSD_hpp -#define SSD_hpp +#pragma once #include "MFMSectorDump.hpp" @@ -37,5 +36,3 @@ class SSD: public MFMSectorDump { }; } - -#endif /* SSD_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/STX.hpp b/Storage/Disk/DiskImage/Formats/STX.hpp index 15e3bbc11..08854949e 100644 --- a/Storage/Disk/DiskImage/Formats/STX.hpp +++ b/Storage/Disk/DiskImage/Formats/STX.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef STX_hpp -#define STX_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -44,5 +43,3 @@ class STX: public DiskImage { }; } - -#endif /* STX_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.hpp b/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.hpp index d6db555c5..f681007da 100644 --- a/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.hpp +++ b/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef ImplicitSectors_hpp -#define ImplicitSectors_hpp +#pragma once #include "../../../Track/Track.hpp" #include @@ -22,5 +21,3 @@ std::shared_ptr track_for_sectors(const uint8_t *source, int number_of_se void decode_sectors(const Track &track, uint8_t *destination, uint8_t first_sector, uint8_t last_sector, uint8_t sector_size, Storage::Encodings::MFM::Density density); } - -#endif /* ImplicitSectors_hpp */ diff --git a/Storage/Disk/DiskImage/Formats/WOZ.hpp b/Storage/Disk/DiskImage/Formats/WOZ.hpp index ce091bc21..8f13d3632 100644 --- a/Storage/Disk/DiskImage/Formats/WOZ.hpp +++ b/Storage/Disk/DiskImage/Formats/WOZ.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef WOZ_hpp -#define WOZ_hpp +#pragma once #include "../DiskImage.hpp" #include "../../../FileHolder.hpp" @@ -56,5 +55,3 @@ class WOZ: public DiskImage { }; } - -#endif /* WOZ_hpp */ diff --git a/Storage/Disk/Drive.hpp b/Storage/Disk/Drive.hpp index 660544f69..1aef7e5a3 100644 --- a/Storage/Disk/Drive.hpp +++ b/Storage/Disk/Drive.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Drive_hpp -#define Drive_hpp +#pragma once #include "Disk.hpp" #include "Track/PCMSegment.hpp" @@ -296,5 +295,3 @@ class Drive: public ClockingHint::Source, public TimedEventLoop { }; } - -#endif /* Drive_hpp */ diff --git a/Storage/Disk/Encodings/AppleGCR/Encoder.hpp b/Storage/Disk/Encodings/AppleGCR/Encoder.hpp index 2f775967d..3106f6904 100644 --- a/Storage/Disk/Encodings/AppleGCR/Encoder.hpp +++ b/Storage/Disk/Encodings/AppleGCR/Encoder.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef AppleGCR_hpp -#define AppleGCR_hpp +#pragma once #include #include "../../../Disk/Track/PCMSegment.hpp" @@ -92,5 +91,3 @@ Storage::Disk::PCMSegment five_and_three_data(const uint8_t *source); Storage::Disk::PCMSegment five_and_three_sync(int length); } - -#endif /* AppleGCR_hpp */ diff --git a/Storage/Disk/Encodings/AppleGCR/Sector.hpp b/Storage/Disk/Encodings/AppleGCR/Sector.hpp index b096782b9..1299d6148 100644 --- a/Storage/Disk/Encodings/AppleGCR/Sector.hpp +++ b/Storage/Disk/Encodings/AppleGCR/Sector.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef Sector_h -#define Sector_h +#pragma once #include #include @@ -75,5 +74,3 @@ struct Sector { }; } - -#endif /* Sector_h */ diff --git a/Storage/Disk/Encodings/AppleGCR/SegmentParser.hpp b/Storage/Disk/Encodings/AppleGCR/SegmentParser.hpp index 4c4d0c06f..2f2a2bd0b 100644 --- a/Storage/Disk/Encodings/AppleGCR/SegmentParser.hpp +++ b/Storage/Disk/Encodings/AppleGCR/SegmentParser.hpp @@ -6,8 +6,7 @@ // Copyright 2018 Thomas Harte. All rights reserved. // -#ifndef TrackParser_hpp -#define TrackParser_hpp +#pragma once #include "Sector.hpp" #include "../../Track/PCMSegment.hpp" @@ -22,5 +21,3 @@ namespace Storage::Encodings::AppleGCR { std::map sectors_from_segment(const Disk::PCMSegment &segment); } - -#endif /* TrackParser_hpp */ diff --git a/Storage/Disk/Encodings/CommodoreGCR.hpp b/Storage/Disk/Encodings/CommodoreGCR.hpp index 7d1acc201..f55ef580d 100644 --- a/Storage/Disk/Encodings/CommodoreGCR.hpp +++ b/Storage/Disk/Encodings/CommodoreGCR.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Disk_Encodings_CommodoreGCR_hpp -#define Storage_Disk_Encodings_CommodoreGCR_hpp +#pragma once #include "../../Storage.hpp" #include @@ -48,5 +47,3 @@ namespace CommodoreGCR { } } - -#endif /* CommodoreGCR_hpp */ diff --git a/Storage/Disk/Encodings/MFM/Constants.hpp b/Storage/Disk/Encodings/MFM/Constants.hpp index ec8cea788..ec1be8775 100644 --- a/Storage/Disk/Encodings/MFM/Constants.hpp +++ b/Storage/Disk/Encodings/MFM/Constants.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Constants_h -#define Constants_h +#pragma once #include "../../../Storage.hpp" @@ -52,5 +51,3 @@ constexpr Time bit_length(Density density) { } } - -#endif /* Constants_h */ diff --git a/Storage/Disk/Encodings/MFM/Encoder.hpp b/Storage/Disk/Encodings/MFM/Encoder.hpp index 94ae4617f..b6ffbf71c 100644 --- a/Storage/Disk/Encodings/MFM/Encoder.hpp +++ b/Storage/Disk/Encodings/MFM/Encoder.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Disk_Encodings_MFM_hpp -#define Storage_Disk_Encodings_MFM_hpp +#pragma once #include #include @@ -79,5 +78,3 @@ std::unique_ptr GetMFMEncoder(std::vector &target, std::vector GetFMEncoder(std::vector &target, std::vector *fuzzy_target = nullptr); } - -#endif /* MFM_hpp */ diff --git a/Storage/Disk/Encodings/MFM/Parser.hpp b/Storage/Disk/Encodings/MFM/Parser.hpp index 8bbd91291..9430b1df3 100644 --- a/Storage/Disk/Encodings/MFM/Parser.hpp +++ b/Storage/Disk/Encodings/MFM/Parser.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Parser_hpp -#define Parser_hpp +#pragma once #include "Constants.hpp" #include "Sector.hpp" @@ -57,5 +56,3 @@ class Parser { }; } - -#endif /* Parser_hpp */ diff --git a/Storage/Disk/Encodings/MFM/Sector.hpp b/Storage/Disk/Encodings/MFM/Sector.hpp index ae4da862e..646b7d3ea 100644 --- a/Storage/Disk/Encodings/MFM/Sector.hpp +++ b/Storage/Disk/Encodings/MFM/Sector.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Sector_h -#define Sector_h +#pragma once #include #include @@ -53,5 +52,3 @@ struct Sector { }; } - -#endif /* Sector_h */ diff --git a/Storage/Disk/Encodings/MFM/SegmentParser.hpp b/Storage/Disk/Encodings/MFM/SegmentParser.hpp index 587aa45e4..45b96b6a7 100644 --- a/Storage/Disk/Encodings/MFM/SegmentParser.hpp +++ b/Storage/Disk/Encodings/MFM/SegmentParser.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef SegmentParser_hpp -#define SegmentParser_hpp +#pragma once #include "Constants.hpp" #include "Sector.hpp" @@ -26,5 +25,3 @@ using SectorMap = std::map; SectorMap sectors_from_segment(const Disk::PCMSegment &segment, Density density); } - -#endif /* SegmentParser_hpp */ diff --git a/Storage/Disk/Encodings/MFM/Shifter.hpp b/Storage/Disk/Encodings/MFM/Shifter.hpp index e5db207c1..63e3447f0 100644 --- a/Storage/Disk/Encodings/MFM/Shifter.hpp +++ b/Storage/Disk/Encodings/MFM/Shifter.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Shifter_hpp -#define Shifter_hpp +#pragma once #include #include @@ -79,5 +78,3 @@ class Shifter { }; } - -#endif /* Shifter_hpp */ diff --git a/Storage/Disk/Parsers/CPM.hpp b/Storage/Disk/Parsers/CPM.hpp index a34fea46f..31b08153f 100644 --- a/Storage/Disk/Parsers/CPM.hpp +++ b/Storage/Disk/Parsers/CPM.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Storage_Disk_Parsers_CPM_hpp -#define Storage_Disk_Parsers_CPM_hpp +#pragma once #include "../Disk.hpp" @@ -43,5 +42,3 @@ struct Catalogue { std::unique_ptr GetCatalogue(const std::shared_ptr &disk, const ParameterBlock ¶meters); } - -#endif /* Storage_Disk_Parsers_CPM_hpp */ diff --git a/Storage/Disk/Parsers/FAT.hpp b/Storage/Disk/Parsers/FAT.hpp index f9d1d4866..e7a4df4b7 100644 --- a/Storage/Disk/Parsers/FAT.hpp +++ b/Storage/Disk/Parsers/FAT.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Storage_Disk_Parsers_FAT_hpp -#define Storage_Disk_Parsers_FAT_hpp +#pragma once #include "../Disk.hpp" @@ -71,5 +70,3 @@ std::optional> GetFile(const std::shared_ptr GetDirectory(const std::shared_ptr &disk, const Volume &volume, const File &file); } - -#endif /* FAT_hpp */ diff --git a/Storage/Disk/Track/PCMSegment.hpp b/Storage/Disk/Track/PCMSegment.hpp index a53f72a79..9006b3634 100644 --- a/Storage/Disk/Track/PCMSegment.hpp +++ b/Storage/Disk/Track/PCMSegment.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef PCMSegment_hpp -#define PCMSegment_hpp +#pragma once #include #include @@ -203,5 +202,3 @@ class PCMSegmentEventSource { }; } - -#endif /* PCMSegment_hpp */ diff --git a/Storage/Disk/Track/PCMTrack.hpp b/Storage/Disk/Track/PCMTrack.hpp index 0fc26f0e2..d9159c30f 100644 --- a/Storage/Disk/Track/PCMTrack.hpp +++ b/Storage/Disk/Track/PCMTrack.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef PCMTrack_hpp -#define PCMTrack_hpp +#pragma once #include "Track.hpp" #include "PCMSegment.hpp" @@ -89,5 +88,3 @@ class PCMTrack: public Track { }; } - -#endif /* PCMTrack_hpp */ diff --git a/Storage/Disk/Track/Track.hpp b/Storage/Disk/Track/Track.hpp index c482a74c6..af62d8f5b 100644 --- a/Storage/Disk/Track/Track.hpp +++ b/Storage/Disk/Track/Track.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Track_h -#define Track_h +#pragma once #include "../../Storage.hpp" #include @@ -126,5 +125,3 @@ class Track { }; } - -#endif /* Track_h */ diff --git a/Storage/Disk/Track/TrackSerialiser.hpp b/Storage/Disk/Track/TrackSerialiser.hpp index 668a3498d..4135a5d91 100644 --- a/Storage/Disk/Track/TrackSerialiser.hpp +++ b/Storage/Disk/Track/TrackSerialiser.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef TrackSerialiser_h -#define TrackSerialiser_h +#pragma once #include "../DPLL/DigitalPhaseLockedLoop.hpp" #include "PCMSegment.hpp" @@ -32,5 +31,3 @@ namespace Storage::Disk { PCMSegment track_serialisation(const Track &track, Time length_of_a_bit); } - -#endif /* TrackSerialiser_h */ diff --git a/Storage/Disk/Track/UnformattedTrack.hpp b/Storage/Disk/Track/UnformattedTrack.hpp index 613f3fba9..2bb14f2d9 100644 --- a/Storage/Disk/Track/UnformattedTrack.hpp +++ b/Storage/Disk/Track/UnformattedTrack.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef UnformattedTrack_hpp -#define UnformattedTrack_hpp +#pragma once #include "Track.hpp" @@ -24,5 +23,3 @@ class UnformattedTrack: public Track { }; } - -#endif /* UnformattedTrack_hpp */ diff --git a/Storage/FileHolder.hpp b/Storage/FileHolder.hpp index dfcfb4d29..d5faf7cb9 100644 --- a/Storage/FileHolder.hpp +++ b/Storage/FileHolder.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef FileHolder_hpp -#define FileHolder_hpp +#pragma once #include #include @@ -249,5 +248,3 @@ class FileHolder final { }; } - -#endif /* FileHolder_hpp */ diff --git a/Storage/MassStorage/Encodings/AppleIIVolume.hpp b/Storage/MassStorage/Encodings/AppleIIVolume.hpp index ea82734c9..82ab2b0eb 100644 --- a/Storage/MassStorage/Encodings/AppleIIVolume.hpp +++ b/Storage/MassStorage/Encodings/AppleIIVolume.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef AppleIIVolume_h -#define AppleIIVolume_h +#pragma once #include "ApplePartitionMap.hpp" @@ -28,5 +27,3 @@ struct VolumeProvider { using Mapper = Storage::MassStorage::Encodings::Apple::PartitionMap; } - -#endif /* AppleIIVolume_h */ diff --git a/Storage/MassStorage/Encodings/ApplePartitionMap.hpp b/Storage/MassStorage/Encodings/ApplePartitionMap.hpp index a8acb2a33..65b337a8b 100644 --- a/Storage/MassStorage/Encodings/ApplePartitionMap.hpp +++ b/Storage/MassStorage/Encodings/ApplePartitionMap.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef ApplePartitionMap_hpp -#define ApplePartitionMap_hpp +#pragma once #include #include @@ -247,5 +246,3 @@ template class PartitionMap { }; } - -#endif /* ApplePartitionMap_hpp */ diff --git a/Storage/MassStorage/Encodings/MacintoshVolume.hpp b/Storage/MassStorage/Encodings/MacintoshVolume.hpp index 15bc77477..b53f8feab 100644 --- a/Storage/MassStorage/Encodings/MacintoshVolume.hpp +++ b/Storage/MassStorage/Encodings/MacintoshVolume.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef MacintoshVolume_hpp -#define MacintoshVolume_hpp +#pragma once #include #include @@ -54,5 +53,3 @@ struct VolumeProvider { using Mapper = Storage::MassStorage::Encodings::Apple::PartitionMap; } - -#endif /* MacintoshVolume_hpp */ diff --git a/Storage/MassStorage/Formats/DAT.hpp b/Storage/MassStorage/Formats/DAT.hpp index d5dfeb31d..a88cb9ab2 100644 --- a/Storage/MassStorage/Formats/DAT.hpp +++ b/Storage/MassStorage/Formats/DAT.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef MassStorage_DAT_hpp -#define MassStorage_DAT_hpp +#pragma once #include "RawSectorDump.hpp" @@ -24,5 +23,3 @@ class DAT: public RawSectorDump<256> { }; } - -#endif /* MassStorage_DAT_hpp */ diff --git a/Storage/MassStorage/Formats/DSK.hpp b/Storage/MassStorage/Formats/DSK.hpp index 507501e87..f0c182bc6 100644 --- a/Storage/MassStorage/Formats/DSK.hpp +++ b/Storage/MassStorage/Formats/DSK.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef MassStorage_DSK_hpp -#define MassStorage_DSK_hpp +#pragma once #include "RawSectorDump.hpp" @@ -24,5 +23,3 @@ class DSK: public RawSectorDump<512> { }; } - -#endif /* MassStorage_DSK_hpp */ diff --git a/Storage/MassStorage/Formats/HDV.hpp b/Storage/MassStorage/Formats/HDV.hpp index 8b9b059b1..0f02a9a79 100644 --- a/Storage/MassStorage/Formats/HDV.hpp +++ b/Storage/MassStorage/Formats/HDV.hpp @@ -6,8 +6,7 @@ // Copyright © 2022 Thomas Harte. All rights reserved. // -#ifndef HDV_hpp -#define HDV_hpp +#pragma once #include "../MassStorageDevice.hpp" #include "../../FileHolder.hpp" @@ -50,5 +49,3 @@ class HDV: public MassStorageDevice { }; } - -#endif /* HDV_hpp */ diff --git a/Storage/MassStorage/Formats/HFV.hpp b/Storage/MassStorage/Formats/HFV.hpp index 377385ad8..dea5886e6 100644 --- a/Storage/MassStorage/Formats/HFV.hpp +++ b/Storage/MassStorage/Formats/HFV.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef HFV_hpp -#define HFV_hpp +#pragma once #include "../MassStorageDevice.hpp" #include "../../FileHolder.hpp" @@ -48,5 +47,3 @@ class HFV: public MassStorageDevice, public Encodings::Macintosh::Volume { }; } - -#endif /* HFV_hpp */ diff --git a/Storage/MassStorage/Formats/RawSectorDump.hpp b/Storage/MassStorage/Formats/RawSectorDump.hpp index 107a9fa8a..463c65cb9 100644 --- a/Storage/MassStorage/Formats/RawSectorDump.hpp +++ b/Storage/MassStorage/Formats/RawSectorDump.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef RawSectorDump_h -#define RawSectorDump_h +#pragma once #include "../MassStorageDevice.hpp" #include "../../FileHolder.hpp" @@ -53,5 +52,3 @@ template class RawSectorDump: public MassStorageDevice { }; } - -#endif /* RawSectorDump_h */ diff --git a/Storage/MassStorage/MassStorageDevice.hpp b/Storage/MassStorage/MassStorageDevice.hpp index c0d7c1758..b1b9e97c7 100644 --- a/Storage/MassStorage/MassStorageDevice.hpp +++ b/Storage/MassStorage/MassStorageDevice.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef MassStorageDevice_hpp -#define MassStorageDevice_hpp +#pragma once #include #include @@ -55,5 +54,3 @@ class MassStorageDevice { }; } - -#endif /* MassStorageDevice_hpp */ diff --git a/Storage/MassStorage/SCSI/DirectAccessDevice.hpp b/Storage/MassStorage/SCSI/DirectAccessDevice.hpp index 5f96a5747..7b2f54c22 100644 --- a/Storage/MassStorage/SCSI/DirectAccessDevice.hpp +++ b/Storage/MassStorage/SCSI/DirectAccessDevice.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef SCSI_DirectAccessDevice_hpp -#define SCSI_DirectAccessDevice_hpp +#pragma once #include "Target.hpp" #include "../MassStorageDevice.hpp" @@ -36,5 +35,3 @@ class DirectAccessDevice: public Target::Executor { }; } - -#endif /* SCSI_DirectAccessDevice_hpp */ diff --git a/Storage/MassStorage/SCSI/SCSI.hpp b/Storage/MassStorage/SCSI/SCSI.hpp index c1ca512fc..de9336d5e 100644 --- a/Storage/MassStorage/SCSI/SCSI.hpp +++ b/Storage/MassStorage/SCSI/SCSI.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef SCSI_hpp -#define SCSI_hpp +#pragma once #include #include @@ -58,8 +57,8 @@ enum Line: BusState { Request = 1 << 17, }; -#define us(x) (x) / 1000000.0 -#define ns(x) (x) / 1000000000.0 +constexpr double us(double t) { return t / 1'000'000.0; } +constexpr double ns(double t) { return t / 1'000'000'000.0; } /// The minimum amount of time that reset must be held for. constexpr double ResetHoldTime = us(25.0); @@ -167,5 +166,3 @@ class Bus: public ClockingHint::Source, public Activity::Source { }; } - -#endif /* SCSI_hpp */ diff --git a/Storage/MassStorage/SCSI/Target.hpp b/Storage/MassStorage/SCSI/Target.hpp index 5eff599cc..75ff3d9b3 100644 --- a/Storage/MassStorage/SCSI/Target.hpp +++ b/Storage/MassStorage/SCSI/Target.hpp @@ -6,8 +6,7 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // -#ifndef SCSI_Target_hpp -#define SCSI_Target_hpp +#pragma once #include "SCSI.hpp" #include "../../../Outputs/Log.hpp" @@ -396,5 +395,3 @@ template class Target: public Bus::Observer, public Responde #include "TargetImplementation.hpp" } - -#endif /* SCSI_Target_hpp */ diff --git a/Storage/MassStorage/SCSI/TargetImplementation.hpp b/Storage/MassStorage/SCSI/TargetImplementation.hpp index 11a4b2904..06672e9fe 100644 --- a/Storage/MassStorage/SCSI/TargetImplementation.hpp +++ b/Storage/MassStorage/SCSI/TargetImplementation.hpp @@ -6,6 +6,8 @@ // Copyright © 2019 Thomas Harte. All rights reserved. // +#pragma once + template Target::Target(Bus &bus, int scsi_id) : bus_(bus), scsi_id_mask_(BusState(1 << scsi_id)), diff --git a/Storage/State/SNA.hpp b/Storage/State/SNA.hpp index d312e8701..e147759a0 100644 --- a/Storage/State/SNA.hpp +++ b/Storage/State/SNA.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Storage_State_SNA_hpp -#define Storage_State_SNA_hpp +#pragma once #include "../../Analyser/Static/StaticAnalyser.hpp" @@ -18,5 +17,3 @@ struct SNA { }; } - -#endif /* Storage_State_SNA_hpp */ diff --git a/Storage/State/SZX.cpp b/Storage/State/SZX.cpp index c734240de..064c82799 100644 --- a/Storage/State/SZX.cpp +++ b/Storage/State/SZX.cpp @@ -20,6 +20,14 @@ using namespace Storage::State; +namespace { + +constexpr uint32_t block(const char *str) { + return uint32_t(str[0] | (str[1] << 8) | (str[2] << 16) | (str[3] << 24)); +} + +} + std::unique_ptr SZX::load(const std::string &file_name) { FileHolder file(file_name); @@ -71,15 +79,13 @@ std::unique_ptr SZX::load(const std::string &file_name if(file.eof()) break; const auto location = file.tell(); -#define BLOCK(str) str[0] | (str[1] << 8) | (str[2] << 16) | (str[3] << 24) - switch(blockID) { default: LOG("Unhandled block " << char(blockID) << char(blockID >> 8) << char(blockID >> 16) << char(blockID >> 24)); break; // ZXSTZ80REGS - case BLOCK("Z80R"): { + case block("Z80R"): { state->z80.registers.flags = file.get8(); state->z80.registers.a = file.get8(); @@ -112,7 +118,6 @@ std::unique_ptr SZX::load(const std::string &file_name // This emulator doesn't, so this field can be ignored. [[maybe_unused]] uint8_t remaining_interrupt_cycles = file.get8(); - const uint8_t flags = file.get8(); state->z80.execution_state.is_halted = flags & 2; // TODO: bit 0 indicates that the last instruction was an EI, or an invalid @@ -124,7 +129,7 @@ std::unique_ptr SZX::load(const std::string &file_name } break; // ZXSTAYBLOCK - case BLOCK("AY\0\0"): { + case block("AY\0\0"): { // This applies to 48kb machines with AY boxes only. This emulator // doesn't currently support those. [[maybe_unused]] const uint8_t interface_type = file.get8(); @@ -134,7 +139,7 @@ std::unique_ptr SZX::load(const std::string &file_name } break; // ZXSTRAMPAGE - case BLOCK("RAMP"): { + case block("RAMP"): { const uint16_t flags = file.get16le(); const uint8_t page = file.get8(); @@ -177,7 +182,7 @@ std::unique_ptr SZX::load(const std::string &file_name } break; // ZXSTSPECREGS - case BLOCK("SPCR"): { + case block("SPCR"): { state->video.border_colour = file.get8(); state->last_7ffd = file.get8(); state->last_1ffd = file.get8(); @@ -186,8 +191,6 @@ std::unique_ptr SZX::load(const std::string &file_name } break; } -#undef BLOCK - // Advance to the next block. file.seek(location + size, SEEK_SET); } diff --git a/Storage/State/SZX.hpp b/Storage/State/SZX.hpp index a7b813f7e..9a974765f 100644 --- a/Storage/State/SZX.hpp +++ b/Storage/State/SZX.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Storage_State_SZX_hpp -#define Storage_State_SZX_hpp +#pragma once #include "../../Analyser/Static/StaticAnalyser.hpp" @@ -18,5 +17,3 @@ struct SZX { }; } - -#endif /* Storage_State_SZX_hpp */ diff --git a/Storage/State/Z80.hpp b/Storage/State/Z80.hpp index f37000669..a79bd57e4 100644 --- a/Storage/State/Z80.hpp +++ b/Storage/State/Z80.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef Storage_State_Z80_hpp -#define Storage_State_Z80_hpp +#pragma once #include "../../Analyser/Static/StaticAnalyser.hpp" @@ -18,5 +17,3 @@ struct Z80 { }; } - -#endif /* Storage_State_Z80_hpp */ diff --git a/Storage/Storage.hpp b/Storage/Storage.hpp index 90db2b5cd..26a397426 100644 --- a/Storage/Storage.hpp +++ b/Storage/Storage.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_hpp -#define Storage_hpp +#pragma once #include #include @@ -294,5 +293,3 @@ struct Time { }; } - -#endif /* Storage_h */ diff --git a/Storage/Tape/Formats/CAS.hpp b/Storage/Tape/Formats/CAS.hpp index d9c0c9106..37ae4a930 100644 --- a/Storage/Tape/Formats/CAS.hpp +++ b/Storage/Tape/Formats/CAS.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef CAS_hpp -#define CAS_hpp +#pragma once #include "../Tape.hpp" #include "../../FileHolder.hpp" @@ -67,5 +66,3 @@ class CAS: public Tape { }; } - -#endif /* CAS_hpp */ diff --git a/Storage/Tape/Formats/CSW.hpp b/Storage/Tape/Formats/CSW.hpp index aaa0d88d8..b3019a3d7 100644 --- a/Storage/Tape/Formats/CSW.hpp +++ b/Storage/Tape/Formats/CSW.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef CSW_hpp -#define CSW_hpp +#pragma once #include "../Tape.hpp" @@ -62,5 +61,3 @@ class CSW: public Tape { }; } - -#endif /* CSW_hpp */ diff --git a/Storage/Tape/Formats/CommodoreTAP.hpp b/Storage/Tape/Formats/CommodoreTAP.hpp index 8ed9ab6c8..ffe692295 100644 --- a/Storage/Tape/Formats/CommodoreTAP.hpp +++ b/Storage/Tape/Formats/CommodoreTAP.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef CommodoreTAP_hpp -#define CommodoreTAP_hpp +#pragma once #include "../Tape.hpp" #include "../../FileHolder.hpp" @@ -49,5 +48,3 @@ class CommodoreTAP: public Tape { }; } - -#endif /* CommodoreTAP_hpp */ diff --git a/Storage/Tape/Formats/OricTAP.hpp b/Storage/Tape/Formats/OricTAP.hpp index da5937705..3a9446768 100644 --- a/Storage/Tape/Formats/OricTAP.hpp +++ b/Storage/Tape/Formats/OricTAP.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef OricTAP_hpp -#define OricTAP_hpp +#pragma once #include "../Tape.hpp" #include "../../FileHolder.hpp" @@ -54,5 +53,3 @@ class OricTAP: public Tape { }; } - -#endif /* OricTAP_hpp */ diff --git a/Storage/Tape/Formats/TZX.hpp b/Storage/Tape/Formats/TZX.hpp index b036aee11..372fda876 100644 --- a/Storage/Tape/Formats/TZX.hpp +++ b/Storage/Tape/Formats/TZX.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef TZX_hpp -#define TZX_hpp +#pragma once #include "../PulseQueuedTape.hpp" #include "../../FileHolder.hpp" @@ -99,5 +98,3 @@ class TZX: public PulseQueuedTape { }; } - -#endif /* TZX_hpp */ diff --git a/Storage/Tape/Formats/TapePRG.hpp b/Storage/Tape/Formats/TapePRG.hpp index 18a1117ba..1df474fe5 100644 --- a/Storage/Tape/Formats/TapePRG.hpp +++ b/Storage/Tape/Formats/TapePRG.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Tape_PRG_hpp -#define Storage_Tape_PRG_hpp +#pragma once #include "../Tape.hpp" #include "../../FileHolder.hpp" @@ -70,5 +69,3 @@ class PRG: public Tape { }; } - -#endif /* T64_hpp */ diff --git a/Storage/Tape/Formats/TapeUEF.hpp b/Storage/Tape/Formats/TapeUEF.hpp index 29325271e..89e5e703d 100644 --- a/Storage/Tape/Formats/TapeUEF.hpp +++ b/Storage/Tape/Formats/TapeUEF.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef TapeUEF_hpp -#define TapeUEF_hpp +#pragma once #include "../PulseQueuedTape.hpp" @@ -73,5 +72,3 @@ class UEF : public PulseQueuedTape, public TargetPlatform::TypeDistinguisher { }; } - -#endif /* TapeUEF_hpp */ diff --git a/Storage/Tape/Formats/ZX80O81P.hpp b/Storage/Tape/Formats/ZX80O81P.hpp index e1033e402..7935a3d14 100644 --- a/Storage/Tape/Formats/ZX80O81P.hpp +++ b/Storage/Tape/Formats/ZX80O81P.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef ZX80O81P_hpp -#define ZX80O81P_hpp +#pragma once #include "../Tape.hpp" @@ -59,5 +58,3 @@ class ZX80O81P: public Tape, public TargetPlatform::TypeDistinguisher { }; } - -#endif /* ZX80O_hpp */ diff --git a/Storage/Tape/Formats/ZXSpectrumTAP.hpp b/Storage/Tape/Formats/ZXSpectrumTAP.hpp index cbb113178..50ddfc1fd 100644 --- a/Storage/Tape/Formats/ZXSpectrumTAP.hpp +++ b/Storage/Tape/Formats/ZXSpectrumTAP.hpp @@ -6,8 +6,7 @@ // Copyright © 2021 Thomas Harte. All rights reserved. // -#ifndef SpectrumTAP_hpp -#define SpectrumTAP_hpp +#pragma once #include "../Tape.hpp" #include "../../FileHolder.hpp" @@ -55,5 +54,3 @@ class ZXSpectrumTAP: public Tape { }; } - -#endif /* SpectrumTAP_hpp */ diff --git a/Storage/Tape/Parsers/Acorn.hpp b/Storage/Tape/Parsers/Acorn.hpp index 4b4a50790..1e33d831c 100644 --- a/Storage/Tape/Parsers/Acorn.hpp +++ b/Storage/Tape/Parsers/Acorn.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Tape_Parsers_Acorn_hpp -#define Storage_Tape_Parsers_Acorn_hpp +#pragma once #include "TapeParser.hpp" #include "../../../Numeric/CRC.hpp" @@ -65,5 +64,3 @@ class Parser: public Storage::Tape::Parser, public Shifter::Delegate }; } - -#endif /* Acorn_hpp */ diff --git a/Storage/Tape/Parsers/Commodore.hpp b/Storage/Tape/Parsers/Commodore.hpp index 6d49b1a8f..b5975502b 100644 --- a/Storage/Tape/Parsers/Commodore.hpp +++ b/Storage/Tape/Parsers/Commodore.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Storage_Tape_Parsers_Commodore_hpp -#define Storage_Tape_Parsers_Commodore_hpp +#pragma once #include "TapeParser.hpp" #include @@ -130,5 +129,3 @@ class Parser: public Storage::Tape::PulseClassificationParser class PulseClassificationParse }; } - -#endif /* TapeParser_hpp */ diff --git a/Storage/Tape/Parsers/ZX8081.hpp b/Storage/Tape/Parsers/ZX8081.hpp index 88a25cc1d..0e8ca6d6d 100644 --- a/Storage/Tape/Parsers/ZX8081.hpp +++ b/Storage/Tape/Parsers/ZX8081.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef Storage_Tape_Parsers_ZX8081_hpp -#define Storage_Tape_Parsers_ZX8081_hpp +#pragma once #include "TapeParser.hpp" @@ -56,5 +55,3 @@ class Parser: public Storage::Tape::PulseClassificationParser @@ -48,5 +47,3 @@ class PulseQueuedTape: public Tape { }; } - -#endif /* PulseQueuedTape_hpp */ diff --git a/Storage/Tape/Tape.hpp b/Storage/Tape/Tape.hpp index 2fd566bda..71299b7e0 100644 --- a/Storage/Tape/Tape.hpp +++ b/Storage/Tape/Tape.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef Tape_hpp -#define Tape_hpp +#pragma once #include @@ -164,5 +163,3 @@ class BinaryTapePlayer : public TapePlayer { }; } - -#endif /* Tape_hpp */ diff --git a/Storage/TargetPlatforms.hpp b/Storage/TargetPlatforms.hpp index 9351d034b..c352efe9f 100644 --- a/Storage/TargetPlatforms.hpp +++ b/Storage/TargetPlatforms.hpp @@ -6,8 +6,7 @@ // Copyright 2017 Thomas Harte. All rights reserved. // -#ifndef TargetPlatforms_hpp -#define TargetPlatforms_hpp +#pragma once namespace TargetPlatform { @@ -54,5 +53,3 @@ class TypeDistinguisher { }; } - -#endif /* TargetPlatforms_h */ diff --git a/Storage/TimedEventLoop.hpp b/Storage/TimedEventLoop.hpp index bc21e61ad..5dd083161 100644 --- a/Storage/TimedEventLoop.hpp +++ b/Storage/TimedEventLoop.hpp @@ -6,8 +6,7 @@ // Copyright 2016 Thomas Harte. All rights reserved. // -#ifndef TimedEventLoop_hpp -#define TimedEventLoop_hpp +#pragma once #include "Storage.hpp" #include "../ClockReceiver/ClockReceiver.hpp" @@ -107,5 +106,3 @@ namespace Storage { }; } - -#endif /* TimedEventLoop_hpp */