Use exceptions instead of panic

This commit is contained in:
madmaurice 2023-09-01 15:11:27 +02:00
parent a0377959dc
commit 66c19caaee
8 changed files with 134 additions and 68 deletions

6
misc/exception.h Normal file
View file

@ -0,0 +1,6 @@
#include <stdexcept>
class EmulatorException : public std::runtime_error {
using std::runtime_error::runtime_error;
using std::runtime_error::what;
};

View file

@ -1,9 +0,0 @@
#include <cstdio>
#include <cstdlib>
template <typename... Args>
inline void panic [[noreturn]] (Args... args)
{
printf(args...);
exit(1);
}

View file

@ -1,9 +1,11 @@
#pragma once
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#include <cstdint>
typedef signed char s8;
typedef signed short s16;
typedef signed int s32;
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;