Skip to content

Commit

Permalink
Renamed namespace util to vc64::util
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Jun 3, 2024
1 parent 26935b6 commit 486f582
Show file tree
Hide file tree
Showing 26 changed files with 93 additions and 72 deletions.
24 changes: 14 additions & 10 deletions Emulator/Cartridges/CartridgeTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "Aliases.h"
#include "Reflection.h"

namespace vc64 {

//
// Enumerations
//
Expand Down Expand Up @@ -98,7 +100,7 @@ enum_long(CRT_TYPE)
CRT_LT_KERNAL = 72,
CRT_RAMLINK = 73,
CRT_HERO = 74,

// Cartridges with no CRT ID (values can be arbitrary)
CRT_ISEPIC,
CRT_GEO_RAM,
Expand All @@ -108,16 +110,16 @@ enum_long(CRT_TYPE)
typedef CRT_TYPE CartridgeType;

struct CartridgeTypeEnum : util::Reflection<CartridgeTypeEnum, CartridgeType> {
static constexpr long minVal = 0;

static constexpr long minVal = 0;
static constexpr long maxVal = CRT_NONE;
static bool isValid(auto value) { return value >= minVal && value <= maxVal; }

static const char *prefix() { return "CRT"; }
static const char *key(long value)
{
switch (value) {

case CRT_NORMAL: return "NORMAL";
case CRT_ACTION_REPLAY: return "ACTION_REPLAY";
case CRT_KCS_POWER: return "KCS_POWER";
Expand Down Expand Up @@ -221,16 +223,16 @@ enum_long(FLASH_STATE)
typedef FLASH_STATE FlashState;

struct FlashStateEnum : util::Reflection<FlashStateEnum, FlashState> {
static constexpr long minVal = 0;

static constexpr long minVal = 0;
static constexpr long maxVal = FLASH_SECTOR_ERASE_SUSPEND;
static bool isValid(auto value) { return value >= minVal && value <= maxVal; }
static bool isValid(auto value) { return value >= minVal && value <= maxVal; }

static const char *prefix() { return "FLASH"; }
static const char *key(long value)
{
switch (value) {

case FLASH_READ: return "READ";
case FLASH_MAGIC_1: return "MAGIC_1";
case FLASH_MAGIC_2: return "MAGIC_2";
Expand Down Expand Up @@ -292,3 +294,5 @@ typedef struct
u16 loadAddress;
}
CartridgeRomInfo;

}
12 changes: 8 additions & 4 deletions Emulator/Components/VICII/BusTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "Aliases.h"
#include "Reflection.h"

namespace vc64 {

enum_long(MEMACCESS)
{
MEMACCESS_R, // Memory Refresh
Expand All @@ -29,16 +31,16 @@ enum_long(MEMACCESS)
typedef MEMACCESS MemAccess;

struct MemAccessEnum : util::Reflection<MemAccessEnum, MemAccess> {
static constexpr long minVal = 0;

static constexpr long minVal = 0;
static constexpr long maxVal = MEMACCESS_S;
static bool isValid(auto value) { return value >= minVal && value <= maxVal; }

static const char *prefix() { return "MEMACCESS"; }
static const char *key(long value)
{
switch (value) {

case MEMACCESS_R: return "R";
case MEMACCESS_I: return "I";
case MEMACCESS_C: return "C";
Expand All @@ -50,3 +52,5 @@ struct MemAccessEnum : util::Reflection<MemAccessEnum, MemAccess> {
return "???";
}
};

}
4 changes: 4 additions & 0 deletions Emulator/Components/VICII/DmaDebuggerTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "Reflection.h"
#include "BusTypes.h"

namespace vc64 {

//
// Enumerations
//
Expand Down Expand Up @@ -68,3 +70,5 @@ typedef struct
u8 cutOpacity;
}
DmaDebuggerConfig;

}
2 changes: 0 additions & 2 deletions Emulator/FileSystems/FSBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "CoreObject.h"
#include "PETName.h"

using util::Buffer;

namespace vc64 {

class FSBlock : CoreObject {
Expand Down
2 changes: 1 addition & 1 deletion Emulator/FileSystems/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ FileSystem::importDirectory(const fs::directory_entry &dir)
if (entry.is_regular_file()) {

// Read file
Buffer<u8> buffer(path);
util::Buffer<u8> buffer(path);
if (buffer) {

// Add file
Expand Down
11 changes: 9 additions & 2 deletions Emulator/Misc/Recorder/RecorderTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
#include "Aliases.h"
#include "Reflection.h"

/// Color palette
namespace vc64 {

//
// Enumerations
//

enum_long(REC_STATE)
{
REC_STATE_WAIT, ///< The recorder is ready
Expand Down Expand Up @@ -69,11 +74,13 @@ typedef struct
{
// Indicates if FFmpeg is availabe
bool available;

// The current recorder state
RecState state;

// Duration of the recorded Video
double duration;
}
RecorderInfo;

}
72 changes: 38 additions & 34 deletions Emulator/Misc/RetroShell/RetroShellTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,58 @@
#include "Aliases.h"
#include "Reflection.h"

namespace vc64 {

//
// Enumerations
//

/// RetroShell special key
enum_long(RSKEY_KEY)
{
RSKEY_UP,
RSKEY_DOWN,
RSKEY_LEFT,
RSKEY_RIGHT,
RSKEY_DEL,
RSKEY_UP,
RSKEY_DOWN,
RSKEY_LEFT,
RSKEY_RIGHT,
RSKEY_DEL,
RSKEY_CUT,
RSKEY_BACKSPACE,
RSKEY_HOME,
RSKEY_END,
RSKEY_TAB,
RSKEY_RETURN,
RSKEY_BACKSPACE,
RSKEY_HOME,
RSKEY_END,
RSKEY_TAB,
RSKEY_RETURN,
RSKEY_SHIFT_RETURN,
RSKEY_CR
RSKEY_CR
};
typedef RSKEY_KEY RetroShellKey;

struct RetroShellKeyEnum : util::Reflection<RetroShellKeyEnum, RetroShellKey>
{
static constexpr long minVal = 0;
static constexpr long maxVal = RSKEY_CR;
static bool isValid(auto val) { return val >= minVal && val <= maxVal; }
static const char *prefix() { return "RSKEY"; }
static const char *key(long value)
{
switch (value) {
case RSKEY_UP: return "UP";
case RSKEY_DOWN: return "DOWN";
case RSKEY_LEFT: return "LEFT";
case RSKEY_RIGHT: return "RIGHT";
case RSKEY_DEL: return "DEL";
static constexpr long minVal = 0;
static constexpr long maxVal = RSKEY_CR;
static bool isValid(auto val) { return val >= minVal && val <= maxVal; }

static const char *prefix() { return "RSKEY"; }
static const char *key(long value)
{
switch (value) {

case RSKEY_UP: return "UP";
case RSKEY_DOWN: return "DOWN";
case RSKEY_LEFT: return "LEFT";
case RSKEY_RIGHT: return "RIGHT";
case RSKEY_DEL: return "DEL";
case RSKEY_CUT: return "CUT";
case RSKEY_BACKSPACE: return "BACKSPACE";
case RSKEY_HOME: return "HOME";
case RSKEY_END: return "END";
case RSKEY_TAB: return "TAB";
case RSKEY_RETURN: return "RETURN";
case RSKEY_BACKSPACE: return "BACKSPACE";
case RSKEY_HOME: return "HOME";
case RSKEY_END: return "END";
case RSKEY_TAB: return "TAB";
case RSKEY_RETURN: return "RETURN";
case RSKEY_SHIFT_RETURN: return "SHIFT_RETURN";
case RSKEY_CR: return "CR";
}
return "???";
}
case RSKEY_CR: return "CR";
}
return "???";
}
};

}
2 changes: 1 addition & 1 deletion Emulator/Utilities/Buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "MemUtils.h"
#include <fstream>

namespace util {
namespace vc64::util {

template <class T> void
Allocator<T>::alloc(isize elements)
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "Types.h"
#include "Checksum.h"

namespace util {
namespace vc64::util {

template <class T> struct Allocator {

Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/Checksum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "Checksum.h"
#include "Macros.h"

namespace util {
namespace vc64::util {

u32
NO_SANITIZE("unsigned-integer-overflow")
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/Checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "Types.h"

namespace util {
namespace vc64::util {

// Returns the FNV-1a seed value
inline u32 fnvInit32() { return 0x811c9dc5; }
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/Chrono.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#endif


namespace util {
namespace vc64::util {

#if defined(__MACH__)

Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/Chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "Types.h"
#include <ctime>

namespace util {
namespace vc64::util {

class Time {

Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/Concurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
#include "config.h"
#include "Concurrency.h"

namespace util {
namespace vc64::util {

}
2 changes: 1 addition & 1 deletion Emulator/Utilities/Concurrency.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <thread>
#include <future>

namespace util {
namespace vc64::util {

class Mutex
{
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "Types.h"
#include <exception>

namespace util {
namespace vc64::util {

struct Exception : public std::exception {

Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/IOUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <iomanip>
#include <vector>

namespace util {
namespace vc64::util {

string
extractPath(const string &s)
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/IOUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

namespace fs = std::filesystem;

namespace util {
namespace vc64::util {

//
// Handling file names
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/MemUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "string.h"
#include "IOUtils.h"

namespace util {
namespace vc64::util {

bool isZero(const u8 *ptr, isize size)
{
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/MemUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "Checksum.h"
#include <bit>

namespace util {
namespace vc64::util {

// Reverses the byte ordering in an integer value
#ifdef _MSC_VER
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "config.h"
#include "Parser.h"

namespace util {
namespace vc64::util {

bool isBool(const string& token)
{
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Utilities/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "Exception.h"
#include <functional>

namespace util {
namespace vc64::util {

struct ParseError : public std::exception {

Expand Down
Loading

0 comments on commit 486f582

Please sign in to comment.