<commit_before>#pragma once

#include "SDL/SDL.h"
#include "Key.h"

/* SDL defines main to be SDL_main which is annoying */
#ifdef main
#undef main
#endif

inline bool _SDL_real(const char *file, const long line, const char *code) {
	const char *err = SDL_GetError();
	if(err[0] != '\0') {
		ENGINE_DEBUGERROR("SDL: " << err,
						  "    " << file << ' ' << line << '\n' <<
						  "    " << code);
	}
	return err[0] == '\0';
}

#define ENGINE_SDL(CODE) ((CODE), _SDL_real(BASEFILE, __LINE__, #CODE))
#define SDL ENGINE_SDL

#ifdef _DEBUG
#define IGNORE_SDL(CODE) ((CODE), SDL_ClearError())
#else
#define IGNORE_SDL(CODE) (CODE)
#endif

inline Key mkKeyFromSDL(SDL_Keycode k) {
	switch(k) {
	case SDLK_a:
		return Key::A;
	case SDLK_b:
		return Key::B;
	case SDLK_c:
		return Key::C;<commit_msg>Clear SDL error after querying<commit_after>#pragma once

#include "SDL/SDL.h"
#include "Key.h"

/* SDL defines main to be SDL_main which is annoying */
#ifdef main
#undef main
#endif

inline bool _SDL_real(const char *file, const long line, const char *code) {
	const char *err = SDL_GetError();
	SDL_ClearError();
	if(err[0] != '\0') {
		ENGINE_DEBUGERROR("SDL: " << err,
						  "    " << file << ' ' << line << '\n' <<
						  "    " << code);
	}
	return err[0] == '\0';
}

#define ENGINE_SDL(CODE) ((CODE), _SDL_real(BASEFILE, __LINE__, #CODE))
#define SDL ENGINE_SDL

#ifdef _DEBUG
#define IGNORE_SDL(CODE) ((CODE), SDL_ClearError())
#else
#define IGNORE_SDL(CODE) (CODE)
#endif

inline Key mkKeyFromSDL(SDL_Keycode k) {
	switch(k) {
	case SDLK_a:
		return Key::A;
	case SDLK_b:
		return Key::B;
	case SDLK_c:
		return Key::C;
{'fraction_non_alphanumeric': 0.16400491400491402, 'fraction_numerical': 0.004914004914004914, 'mean_word_length': 4.012307692307692, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4573648', 'n_tokens_mistral': 713, 'n_tokens_neox': 629, 'n_words': 170}