From 4792b4667b00ed1ea3ff90cc2634c4d41922ecb9 Mon Sep 17 00:00:00 2001
From: hwsmm <9151706+hwsmm@users.noreply.github.com>
Date: Sun, 15 Sep 2024 11:06:03 +0900
Subject: [PATCH] Add a new SDL_Process bindings
---
SDL3-CS/SDL3/ClangSharp/SDL_process.g.cs | 118 +++++++++++++++++++++++
SDL3-CS/generate_bindings.py | 1 +
2 files changed, 119 insertions(+)
create mode 100644 SDL3-CS/SDL3/ClangSharp/SDL_process.g.cs
diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_process.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_process.g.cs
new file mode 100644
index 0000000..01d7c5d
--- /dev/null
+++ b/SDL3-CS/SDL3/ClangSharp/SDL_process.g.cs
@@ -0,0 +1,118 @@
+/*
+
+ C# bindings for Simple DirectMedia Layer.
+ Original copyright notice of input files:
+
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2024 Sam Lantinga
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace SDL
+{
+ public partial struct SDL_Process
+ {
+ }
+
+ public enum SDL_ProcessIO
+ {
+ SDL_PROCESS_STDIO_INHERITED,
+ SDL_PROCESS_STDIO_NULL,
+ SDL_PROCESS_STDIO_APP,
+ SDL_PROCESS_STDIO_REDIRECT,
+ }
+
+ public static unsafe partial class SDL3
+ {
+ [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ public static extern SDL_Process* SDL_CreateProcess([NativeTypeName("const char *const *")] byte** args, SDL_bool pipe_stdio);
+
+ [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ public static extern SDL_Process* SDL_CreateProcessWithProperties(SDL_PropertiesID props);
+
+ [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ public static extern SDL_PropertiesID SDL_GetProcessProperties(SDL_Process* process);
+
+ [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ [return: NativeTypeName("void*")]
+ public static extern IntPtr SDL_ReadProcess(SDL_Process* process, [NativeTypeName("size_t *")] nuint* datasize, int* exitcode);
+
+ [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ public static extern SDL_IOStream* SDL_GetProcessInput(SDL_Process* process);
+
+ [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ public static extern SDL_IOStream* SDL_GetProcessOutput(SDL_Process* process);
+
+ [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ public static extern SDL_bool SDL_KillProcess(SDL_Process* process, SDL_bool force);
+
+ [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ public static extern SDL_bool SDL_WaitProcess(SDL_Process* process, SDL_bool block, int* exitcode);
+
+ [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ public static extern void SDL_DestroyProcess(SDL_Process* process);
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_ARGS_POINTER \"SDL.process.create.args\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_ARGS_POINTER => "SDL.process.create.args"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER \"SDL.process.create.environment\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER => "SDL.process.create.environment"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_STDIN_NUMBER \"SDL.process.create.stdin_option\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_STDIN_NUMBER => "SDL.process.create.stdin_option"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_STDIN_POINTER \"SDL.process.create.stdin_source\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_STDIN_POINTER => "SDL.process.create.stdin_source"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER \"SDL.process.create.stdout_option\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER => "SDL.process.create.stdout_option"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_STDOUT_POINTER \"SDL.process.create.stdout_source\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_STDOUT_POINTER => "SDL.process.create.stdout_source"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_STDERR_NUMBER \"SDL.process.create.stderr_option\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_STDERR_NUMBER => "SDL.process.create.stderr_option"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_STDERR_POINTER \"SDL.process.create.stderr_source\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_STDERR_POINTER => "SDL.process.create.stderr_source"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN \"SDL.process.create.stderr_to_stdout\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN => "SDL.process.create.stderr_to_stdout"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN \"SDL.process.create.background\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN => "SDL.process.create.background"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_PID_NUMBER \"SDL.process.pid\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_PID_NUMBER => "SDL.process.pid"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_STDIN_POINTER \"SDL.process.stdin\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_STDIN_POINTER => "SDL.process.stdin"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_STDOUT_POINTER \"SDL.process.stdout\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_STDOUT_POINTER => "SDL.process.stdout"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_STDERR_POINTER \"SDL.process.stderr\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_STDERR_POINTER => "SDL.process.stderr"u8;
+
+ [NativeTypeName("#define SDL_PROP_PROCESS_BACKGROUND_BOOLEAN \"SDL.process.background\"")]
+ public static ReadOnlySpan SDL_PROP_PROCESS_BACKGROUND_BOOLEAN => "SDL.process.background"u8;
+ }
+}
diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py
index be9a477..b2afd3f 100644
--- a/SDL3-CS/generate_bindings.py
+++ b/SDL3-CS/generate_bindings.py
@@ -112,6 +112,7 @@ headers = [
add("SDL3/SDL_pixels.h"),
add("SDL3/SDL_platform.h"),
add("SDL3/SDL_power.h"),
+ add("SDL3/SDL_process.h"),
add("SDL3/SDL_properties.h"),
add("SDL3/SDL_rect.h"),
add("SDL3/SDL_render.h"),