Use C++ style comments consistently in SDL source code
Implemented using this script: find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \; git checkout \ core/linux/SDL_evdev_kbd_default_keymap.h \ events/imKStoUCS.* \ hidapi \ joystick/controller_type.c \ joystick/controller_type.h \ joystick/hidapi/steam/controller_constants.h \ joystick/hidapi/steam/controller_structs.h \ joystick/SDL_gamepad_db.h \ libm \ render/*/*Shader*.h \ render/vitagxm/SDL_render_vita_gxm_shaders.h \ render/metal/SDL_shaders_metal_*.h \ stdlib/SDL_malloc.c \ stdlib/SDL_qsort.c \ stdlib/SDL_strtokr.c \ test/ \ video/directx/SDL_d3d12_xbox_cmacros.h \ video/directx/d3d12.h \ video/directx/d3d12sdklayers.h \ video/khronos \ video/x11/edid-parse.c \ video/x11/xsettings-client.* \ video/yuv2rgb sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
This commit is contained in:
parent
658fc3db0f
commit
6501e90018
743 changed files with 11882 additions and 11882 deletions
|
@ -35,11 +35,11 @@
|
|||
#endif
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#define SDL_MAIN_NOIMPL /* don't drag in header-only implementation of SDL_main */
|
||||
#define SDL_MAIN_NOIMPL // don't drag in header-only implementation of SDL_main
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
|
||||
/* These headers have system specific definitions, so aren't included above */
|
||||
// These headers have system specific definitions, so aren't included above
|
||||
#include <SDL3/SDL_vulkan.h>
|
||||
|
||||
/* This is the version of the dynamic API. This doesn't match the SDL version
|
||||
|
@ -62,9 +62,9 @@ static void SDL_InitDynamicAPI(void);
|
|||
/* BE CAREFUL CALLING ANY SDL CODE IN HERE, IT WILL BLOW UP.
|
||||
Even self-contained stuff might call SDL_SetError() and break everything. */
|
||||
|
||||
/* behold, the macro salsa! */
|
||||
// behold, the macro salsa!
|
||||
|
||||
/* Can't use the macro for varargs nonsense. This is atrocious. */
|
||||
// Can't use the macro for varargs nonsense. This is atrocious.
|
||||
#define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio) \
|
||||
_static void SDLCALL SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
|
||||
{ \
|
||||
|
@ -175,9 +175,9 @@ static void SDL_InitDynamicAPI(void);
|
|||
SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Error, ERROR) \
|
||||
SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Critical, CRITICAL)
|
||||
|
||||
/* Typedefs for function pointers for jump table, and predeclare funcs */
|
||||
/* The DEFAULT funcs will init jump table and then call real function. */
|
||||
/* The REAL funcs are the actual functions, name-mangled to not clash. */
|
||||
// Typedefs for function pointers for jump table, and predeclare funcs
|
||||
// The DEFAULT funcs will init jump table and then call real function.
|
||||
// The REAL funcs are the actual functions, name-mangled to not clash.
|
||||
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) \
|
||||
typedef rc (SDLCALL *SDL_DYNAPIFN_##fn) params;\
|
||||
static rc SDLCALL fn##_DEFAULT params; \
|
||||
|
@ -185,7 +185,7 @@ static void SDL_InitDynamicAPI(void);
|
|||
#include "SDL_dynapi_procs.h"
|
||||
#undef SDL_DYNAPI_PROC
|
||||
|
||||
/* The jump table! */
|
||||
// The jump table!
|
||||
typedef struct
|
||||
{
|
||||
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) SDL_DYNAPIFN_##fn fn;
|
||||
|
@ -193,19 +193,19 @@ typedef struct
|
|||
#undef SDL_DYNAPI_PROC
|
||||
} SDL_DYNAPI_jump_table;
|
||||
|
||||
/* Predeclare the default functions for initializing the jump table. */
|
||||
// Predeclare the default functions for initializing the jump table.
|
||||
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) static rc SDLCALL fn##_DEFAULT params;
|
||||
#include "SDL_dynapi_procs.h"
|
||||
#undef SDL_DYNAPI_PROC
|
||||
|
||||
/* The actual jump table. */
|
||||
// The actual jump table.
|
||||
static SDL_DYNAPI_jump_table jump_table = {
|
||||
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) fn##_DEFAULT,
|
||||
#include "SDL_dynapi_procs.h"
|
||||
#undef SDL_DYNAPI_PROC
|
||||
};
|
||||
|
||||
/* Default functions init the function table then call right thing. */
|
||||
// Default functions init the function table then call right thing.
|
||||
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) \
|
||||
static rc SDLCALL fn##_DEFAULT params \
|
||||
{ \
|
||||
|
@ -218,7 +218,7 @@ static SDL_DYNAPI_jump_table jump_table = {
|
|||
#undef SDL_DYNAPI_PROC_NO_VARARGS
|
||||
SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
|
||||
|
||||
/* Public API functions to jump into the jump table. */
|
||||
// Public API functions to jump into the jump table.
|
||||
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) \
|
||||
rc SDLCALL fn params \
|
||||
{ \
|
||||
|
@ -234,7 +234,7 @@ SDL_DYNAPI_VARARGS(, , )
|
|||
#if ENABLE_SDL_CALL_LOGGING
|
||||
static int SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
|
||||
{
|
||||
char buf[512]; /* !!! FIXME: dynamic allocation */
|
||||
char buf[512]; // !!! FIXME: dynamic allocation
|
||||
va_list ap;
|
||||
SDL_Log_REAL("SDL3CALL SDL_SetError");
|
||||
va_start(ap, fmt);
|
||||
|
@ -342,13 +342,13 @@ static Sint32 initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize)
|
|||
SDL_DYNAPI_jump_table *output_jump_table = (SDL_DYNAPI_jump_table *)table;
|
||||
|
||||
if (apiver != SDL_DYNAPI_VERSION) {
|
||||
/* !!! FIXME: can maybe handle older versions? */
|
||||
return -1; /* not compatible. */
|
||||
// !!! FIXME: can maybe handle older versions?
|
||||
return -1; // not compatible.
|
||||
} else if (tablesize > sizeof(jump_table)) {
|
||||
return -1; /* newer version of SDL with functions we can't provide. */
|
||||
return -1; // newer version of SDL with functions we can't provide.
|
||||
}
|
||||
|
||||
/* Init our jump table first. */
|
||||
// Init our jump table first.
|
||||
#if ENABLE_SDL_CALL_LOGGING
|
||||
{
|
||||
const char *env = SDL_getenv_REAL("SDL_DYNAPI_LOG_CALLS");
|
||||
|
@ -369,18 +369,18 @@ static Sint32 initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize)
|
|||
#undef SDL_DYNAPI_PROC
|
||||
#endif
|
||||
|
||||
/* Then the external table... */
|
||||
// Then the external table...
|
||||
if (output_jump_table != &jump_table) {
|
||||
jump_table.SDL_memcpy(output_jump_table, &jump_table, tablesize);
|
||||
}
|
||||
|
||||
/* Safe to call SDL functions now; jump table is initialized! */
|
||||
// Safe to call SDL functions now; jump table is initialized!
|
||||
|
||||
return 0; /* success! */
|
||||
return 0; // success!
|
||||
}
|
||||
|
||||
/* Here's the exported entry point that fills in the jump table. */
|
||||
/* Use specific types when an "int" might suffice to keep this sane. */
|
||||
// Here's the exported entry point that fills in the jump table.
|
||||
// Use specific types when an "int" might suffice to keep this sane.
|
||||
typedef Sint32 (SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize);
|
||||
extern SDL_DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32);
|
||||
|
||||
|
@ -393,8 +393,8 @@ Sint32 SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Obviously we can't use SDL_LoadObject() to load SDL. :) */
|
||||
/* Also obviously, we never close the loaded library. */
|
||||
// Obviously we can't use SDL_LoadObject() to load SDL. :)
|
||||
// Also obviously, we never close the loaded library.
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
|
@ -436,7 +436,7 @@ static void dynapi_warn(const char *msg)
|
|||
{
|
||||
const char *caption = "SDL Dynamic API Failure!";
|
||||
(void)caption;
|
||||
/* SDL_ShowSimpleMessageBox() is a too heavy for here. */
|
||||
// SDL_ShowSimpleMessageBox() is a too heavy for here.
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN)) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
||||
MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR);
|
||||
#elif defined(HAVE_STDIO_H)
|
||||
|
@ -462,7 +462,7 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
|
|||
static void SDL_InitDynamicAPILocked(void)
|
||||
{
|
||||
const char *libname = SDL_getenv_REAL(SDL_DYNAMIC_API_ENVVAR);
|
||||
SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */
|
||||
SDL_DYNAPI_ENTRYFN entry = NULL; // funcs from here by default.
|
||||
SDL_bool use_internal = SDL_TRUE;
|
||||
|
||||
if (libname) {
|
||||
|
@ -484,29 +484,29 @@ static void SDL_InitDynamicAPILocked(void)
|
|||
}
|
||||
if (!entry) {
|
||||
dynapi_warn("Couldn't load an overriding SDL library. Please fix or remove the " SDL_DYNAMIC_API_ENVVAR " environment variable. Using the default SDL.");
|
||||
/* Just fill in the function pointers from this library, later. */
|
||||
// Just fill in the function pointers from this library, later.
|
||||
}
|
||||
}
|
||||
|
||||
if (entry) {
|
||||
if (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof(jump_table)) < 0) {
|
||||
dynapi_warn("Couldn't override SDL library. Using a newer SDL build might help. Please fix or remove the " SDL_DYNAMIC_API_ENVVAR " environment variable. Using the default SDL.");
|
||||
/* Just fill in the function pointers from this library, later. */
|
||||
// Just fill in the function pointers from this library, later.
|
||||
} else {
|
||||
use_internal = SDL_FALSE; /* We overrode SDL! Don't use the internal version! */
|
||||
use_internal = SDL_FALSE; // We overrode SDL! Don't use the internal version!
|
||||
}
|
||||
}
|
||||
|
||||
/* Just fill in the function pointers from this library. */
|
||||
// Just fill in the function pointers from this library.
|
||||
if (use_internal) {
|
||||
if (initialize_jumptable(SDL_DYNAPI_VERSION, &jump_table, sizeof(jump_table)) < 0) {
|
||||
/* Now we're screwed. Should definitely abort now. */
|
||||
// Now we're screwed. Should definitely abort now.
|
||||
dynapi_warn("Failed to initialize internal SDL dynapi. As this would otherwise crash, we have to abort now.");
|
||||
SDL_ExitProcess(86);
|
||||
}
|
||||
}
|
||||
|
||||
/* we intentionally never close the newly-loaded lib, of course. */
|
||||
// we intentionally never close the newly-loaded lib, of course.
|
||||
}
|
||||
|
||||
static void SDL_InitDynamicAPI(void)
|
||||
|
@ -535,7 +535,7 @@ static void SDL_InitDynamicAPI(void)
|
|||
SDL_UnlockSpinlock_REAL(&lock);
|
||||
}
|
||||
|
||||
#else /* SDL_DYNAMIC_API */
|
||||
#else // SDL_DYNAMIC_API
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
|
@ -545,7 +545,7 @@ Sint32 SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
|
|||
(void)apiver;
|
||||
(void)table;
|
||||
(void)tablesize;
|
||||
return -1; /* not compatible. */
|
||||
return -1; // not compatible.
|
||||
}
|
||||
|
||||
#endif /* SDL_DYNAMIC_API */
|
||||
#endif // SDL_DYNAMIC_API
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue