Skip to content

Commit

Permalink
Add a new SDL_Process bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
hwsmm committed Sep 15, 2024
1 parent d04f71c commit 4792b46
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
118 changes: 118 additions & 0 deletions SDL3-CS/SDL3/ClangSharp/SDL_process.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
<auto-generated/>
C# bindings for Simple DirectMedia Layer.
Original copyright notice of input files:
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <[email protected]>
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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> 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<byte> SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN => "SDL.process.create.background"u8;

[NativeTypeName("#define SDL_PROP_PROCESS_PID_NUMBER \"SDL.process.pid\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_PID_NUMBER => "SDL.process.pid"u8;

[NativeTypeName("#define SDL_PROP_PROCESS_STDIN_POINTER \"SDL.process.stdin\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_STDIN_POINTER => "SDL.process.stdin"u8;

[NativeTypeName("#define SDL_PROP_PROCESS_STDOUT_POINTER \"SDL.process.stdout\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_STDOUT_POINTER => "SDL.process.stdout"u8;

[NativeTypeName("#define SDL_PROP_PROCESS_STDERR_POINTER \"SDL.process.stderr\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_STDERR_POINTER => "SDL.process.stderr"u8;

[NativeTypeName("#define SDL_PROP_PROCESS_BACKGROUND_BOOLEAN \"SDL.process.background\"")]
public static ReadOnlySpan<byte> SDL_PROP_PROCESS_BACKGROUND_BOOLEAN => "SDL.process.background"u8;
}
}
1 change: 1 addition & 0 deletions SDL3-CS/generate_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def add(s: str):
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"),
Expand Down

0 comments on commit 4792b46

Please sign in to comment.