main: Main callback docs recommend returning the symbols instead of -1, 0, 1.

Reference #9901.
This commit is contained in:
Ryan C. Gordon 2024-05-27 12:58:22 -04:00
parent 06aa02453a
commit 0fe9900429
No known key found for this signature in database
GPG key ID: FA148B892AB48044

View file

@ -277,20 +277,23 @@ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
* to use a global variable. If this isn't set, the pointer will be NULL in * to use a global variable. If this isn't set, the pointer will be NULL in
* future entry points. * future entry points.
* *
* If this function returns 0, the app will proceed to normal operation, and * If this function returns SDL_MAIN_CALLBACK_CONTINUE, the app will proceed
* will begin receiving repeated calls to SDL_AppIterate and SDL_AppEvent for * to normal operation, and will begin receiving repeated calls to
* the life of the program. If this function returns < 0, SDL will call * SDL_AppIterate and SDL_AppEvent for the life of the program. If this
* function returns SDL_MAIN_CALLBACK_EXIT_FAILURE, SDL will call
* SDL_AppQuit and terminate the process with an exit code that reports an * SDL_AppQuit and terminate the process with an exit code that reports an
* error to the platform. If it returns > 0, the SDL calls SDL_AppQuit and * error to the platform. If it returns SDL_MAIN_CALLBACK_EXIT_SUCCESS, SDL
* terminates with an exit code that reports success to the platform. * calls SDL_AppQuit and terminates with an exit code that reports success to
* the platform.
* *
* \param appstate a place where the app can optionally store a pointer for * \param appstate a place where the app can optionally store a pointer for
* future use. * future use.
* \param argc The standard ANSI C main's argc; number of elements in `argv` * \param argc The standard ANSI C main's argc; number of elements in `argv`
* \param argv The standard ANSI C main's argv; array of command line * \param argv The standard ANSI C main's argv; array of command line
* arguments. * arguments.
* \returns -1 to terminate with an error, 1 to terminate with success, 0 to * \returns SDL_MAIN_CALLBACK_EXIT_FAILURE to terminate with an error,
* continue. * SDL_MAIN_CALLBACK_EXIT_SUCCESS to terminate with success,
* SDL_MAIN_CALLBACK_CONTINUE to continue.
* *
* \threadsafety This function is not thread safe. * \threadsafety This function is not thread safe.
* *
@ -329,16 +332,20 @@ extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppInit(void **appstate, int argc, char
* The `appstate` parameter is an optional pointer provided by the app during * The `appstate` parameter is an optional pointer provided by the app during
* SDL_AppInit(). If the app never provided a pointer, this will be NULL. * SDL_AppInit(). If the app never provided a pointer, this will be NULL.
* *
* If this function returns 0, the app will continue normal operation, * If this function returns SDL_MAIN_CALLBACK_CONTINUE, the app will continue
* receiving repeated calls to SDL_AppIterate and SDL_AppEvent for the life of * normal operation, receiving repeated calls to SDL_AppIterate and
* the program. If this function returns < 0, SDL will call SDL_AppQuit and * SDL_AppEvent for the life of the program. If this function returns
* SDL_MAIN_CALLBACK_EXIT_FAILURE, SDL will call SDL_AppQuit and
* terminate the process with an exit code that reports an error to the * terminate the process with an exit code that reports an error to the
* platform. If it returns > 0, the SDL calls SDL_AppQuit and terminates with * platform. If it returns SDL_MAIN_CALLBACK_EXIT_SUCCESS, SDL calls
* an exit code that reports success to the platform. * SDL_AppQuit and terminates with an exit code that reports success to the
* platform.
* *
* \param appstate an optional pointer, provided by the app in SDL_AppInit. * \param appstate an optional pointer, provided by the app in SDL_AppInit.
* \returns -1 to terminate with an error, 1 to terminate with success, 0 to * \returns SDL_MAIN_CALLBACK_EXIT_FAILURE to terminate with an error,
* continue. * SDL_MAIN_CALLBACK_EXIT_SUCCESS to terminate with success,
* SDL_MAIN_CALLBACK_CONTINUE to continue.
*
* *
* \threadsafety This function is not thread safe. * \threadsafety This function is not thread safe.
* *
@ -374,17 +381,19 @@ extern SDLMAIN_DECLSPEC int SDLCALL SDL_AppIterate(void *appstate);
* The `appstate` parameter is an optional pointer provided by the app during * The `appstate` parameter is an optional pointer provided by the app during
* SDL_AppInit(). If the app never provided a pointer, this will be NULL. * SDL_AppInit(). If the app never provided a pointer, this will be NULL.
* *
* If this function returns 0, the app will continue normal operation, * If this function returns SDL_MAIN_CALLBACK_CONTINUE, the app will continue
* receiving repeated calls to SDL_AppIterate and SDL_AppEvent for the life of * normal operation, receiving repeated calls to SDL_AppIterate and
* the program. If this function returns < 0, SDL will call SDL_AppQuit and * SDL_AppEvent for the life of the program. If this function returns
* terminate the process with an exit code that reports an error to the * SDL_MAIN_CALLBACK_EXIT_FAILURE, SDL will call SDL_AppQuit and terminate the
* platform. If it returns > 0, the SDL calls SDL_AppQuit and terminates with * process with an exit code that reports an error to the platform. If it
* an exit code that reports success to the platform. * returns SDL_MAIN_CALLBACK_EXIT_SUCCESS, SDL calls SDL_AppQuit and
* terminates with an exit code that reports success to the platform.
* *
* \param appstate an optional pointer, provided by the app in SDL_AppInit. * \param appstate an optional pointer, provided by the app in SDL_AppInit.
* \param event the new event for the app to examine. * \param event the new event for the app to examine.
* \returns -1 to terminate with an error, 1 to terminate with success, 0 to * \returns SDL_MAIN_CALLBACK_EXIT_FAILURE to terminate with an error,
* continue. * SDL_MAIN_CALLBACK_EXIT_SUCCESS to terminate with success,
* SDL_MAIN_CALLBACK_CONTINUE to continue.
* *
* \threadsafety This function is not thread safe. * \threadsafety This function is not thread safe.
* *