libc8
CHIP-8 utility library
Loading...
Searching...
No Matches
exception.h File Reference
#include <stdio.h>

Go to the source code of this file.

Macros

#define EXCEPTION_MESSAGE_SIZE   BUFSIZ
 
#define C8_EXCEPTION(code, ...)
 

Enumerations

enum  exception_code_t {
  INVALID_INSTRUCTION_EXCEPTION = -3 , TOO_MANY_LABELS_EXCEPTION = -4 , STACK_OVERFLOW_EXCEPTION = -5 , INVALID_ARGUMENT_EXCEPTION = -6 ,
  DUPLICATE_LABEL_EXCEPTION = -7 , INVALID_SYMBOL_EXCEPTION = -8 , MEMORY_ALLOCATION_EXCEPTION = -9 , UNKNOWN_EXCEPTION = -10 ,
  TOO_MANY_SYMBOLS_EXCEPTION = -11 , LOAD_FILE_FAILURE_EXCEPTION = -12 , FILE_TOO_BIG_EXCEPTION = -13 , INVALID_COLOR_PALETTE_EXCEPTION = -14 ,
  INVALID_QUIRK_EXCEPTION = -15 , FAILED_GRAPHICS_INITIALIZATION_EXCEPTION = -16 , INVALID_FONT_EXCEPTION = -17 , INVALID_CLOCK_SPEED_EXCEPTION = -18 ,
  STACK_UNDERFLOW_EXCEPTION = -19
}
 

Functions

void handle_exception (int)
 

Variables

char c8_exception [BUFSIZ]
 

Detailed Description

Note
NOT EXPORTED

Stuff for handling exceptions.

Macro Definition Documentation

◆ C8_EXCEPTION

#define C8_EXCEPTION (   code,
  ... 
)
Value:
{ \
snprintf(c8_exception, EXCEPTION_MESSAGE_SIZE, __VA_ARGS__); \
handle_exception(code); \
}
#define EXCEPTION_MESSAGE_SIZE
Definition: exception.h:13
char c8_exception[BUFSIZ]
Definition: exception.c:60

◆ EXCEPTION_MESSAGE_SIZE

#define EXCEPTION_MESSAGE_SIZE   BUFSIZ

Enumeration Type Documentation

◆ exception_code_t

Enumerator
INVALID_INSTRUCTION_EXCEPTION 
TOO_MANY_LABELS_EXCEPTION 
STACK_OVERFLOW_EXCEPTION 
INVALID_ARGUMENT_EXCEPTION 
DUPLICATE_LABEL_EXCEPTION 
INVALID_SYMBOL_EXCEPTION 
MEMORY_ALLOCATION_EXCEPTION 
UNKNOWN_EXCEPTION 
TOO_MANY_SYMBOLS_EXCEPTION 
LOAD_FILE_FAILURE_EXCEPTION 
FILE_TOO_BIG_EXCEPTION 
INVALID_COLOR_PALETTE_EXCEPTION 
INVALID_QUIRK_EXCEPTION 
FAILED_GRAPHICS_INITIALIZATION_EXCEPTION 
INVALID_FONT_EXCEPTION 
INVALID_CLOCK_SPEED_EXCEPTION 
STACK_UNDERFLOW_EXCEPTION 

Function Documentation

◆ handle_exception()

void handle_exception ( int  code)

Variable Documentation

◆ c8_exception

char c8_exception[BUFSIZ]
extern

Message to print when calling handle_exception with a non-zero code