Use exceptions instead of panic
This commit is contained in:
parent
a0377959dc
commit
66c19caaee
8 changed files with 134 additions and 68 deletions
6
misc/exception.h
Normal file
6
misc/exception.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <stdexcept>
|
||||
|
||||
class EmulatorException : public std::runtime_error {
|
||||
using std::runtime_error::runtime_error;
|
||||
using std::runtime_error::what;
|
||||
};
|
|
@ -1,9 +0,0 @@
|
|||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
template <typename... Args>
|
||||
inline void panic [[noreturn]] (Args... args)
|
||||
{
|
||||
printf(args...);
|
||||
exit(1);
|
||||
}
|
14
misc/types.h
14
misc/types.h
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue