mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 22:35:59 +00:00
Add convenience functions to get process IOStreams
This commit is contained in:
@@ -431,6 +431,8 @@ SDL3_0.0.0 {
|
||||
SDL_GetPreferredLocales;
|
||||
SDL_GetPrimaryDisplay;
|
||||
SDL_GetPrimarySelectionText;
|
||||
SDL_GetProcessInputStream;
|
||||
SDL_GetProcessOutputStream;
|
||||
SDL_GetProcessProperties;
|
||||
SDL_GetPropertyType;
|
||||
SDL_GetRGB;
|
||||
|
@@ -456,6 +456,8 @@
|
||||
#define SDL_GetPreferredLocales SDL_GetPreferredLocales_REAL
|
||||
#define SDL_GetPrimaryDisplay SDL_GetPrimaryDisplay_REAL
|
||||
#define SDL_GetPrimarySelectionText SDL_GetPrimarySelectionText_REAL
|
||||
#define SDL_GetProcessInputStream SDL_GetProcessInputStream_REAL
|
||||
#define SDL_GetProcessOutputStream SDL_GetProcessOutputStream_REAL
|
||||
#define SDL_GetProcessProperties SDL_GetProcessProperties_REAL
|
||||
#define SDL_GetPropertyType SDL_GetPropertyType_REAL
|
||||
#define SDL_GetRGB SDL_GetRGB_REAL
|
||||
|
@@ -476,6 +476,8 @@ SDL_DYNAPI_PROC(char*,SDL_GetPrefPath,(const char *a, const char *b),(a,b),retur
|
||||
SDL_DYNAPI_PROC(SDL_Locale**,SDL_GetPreferredLocales,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_DisplayID,SDL_GetPrimaryDisplay,(void),(),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetPrimarySelectionText,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_IOStream*,SDL_GetProcessInputStream,(SDL_Process *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_IOStream*,SDL_GetProcessOutputStream,(SDL_Process *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetProcessProperties,(SDL_Process *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertyType,SDL_GetPropertyType,(SDL_PropertiesID a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormatDetails *b, const SDL_Palette *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),)
|
||||
|
@@ -153,6 +153,38 @@ done:
|
||||
return result;
|
||||
}
|
||||
|
||||
SDL_IOStream *SDL_GetProcessOutputStream(SDL_Process *process)
|
||||
{
|
||||
if (!process) {
|
||||
SDL_InvalidParamError("process");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_IOStream *io = (SDL_IOStream *)SDL_GetPointerProperty(process->props, SDL_PROP_PROCESS_STDOUT_POINTER, NULL);
|
||||
if (!io) {
|
||||
SDL_SetError("Process not created with I/O enabled");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return io;
|
||||
}
|
||||
|
||||
SDL_IOStream *SDL_GetProcessInputStream(SDL_Process *process)
|
||||
{
|
||||
if (!process) {
|
||||
SDL_InvalidParamError("process");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_IOStream *io = (SDL_IOStream *)SDL_GetPointerProperty(process->props, SDL_PROP_PROCESS_STDIN_POINTER, NULL);
|
||||
if (!io) {
|
||||
SDL_SetError("Process not created with I/O enabled");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return io;
|
||||
}
|
||||
|
||||
SDL_bool SDL_KillProcess(SDL_Process *process, SDL_bool force)
|
||||
{
|
||||
if (!process) {
|
||||
|
Reference in New Issue
Block a user