1 /* 2 * Copyright (c) 2011-2016 Ryan Prichard 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a copy 5 * of this software and associated documentation files (the "Software"), to 6 * deal in the Software without restriction, including without limitation the 7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 * sell copies of the Software, and to permit persons to whom the Software is 9 * furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 * IN THE SOFTWARE. 21 */ 22 23 #ifndef WINPTY_H 24 #define WINPTY_H 25 26 #include <windows.h> 27 28 #include "winpty_constants.h" 29 30 /* On 32-bit Windows, winpty functions have the default __cdecl (not __stdcall) 31 * calling convention. (64-bit Windows has only a single calling convention.) 32 * When compiled with __declspec(dllexport), with either MinGW or MSVC, the 33 * winpty functions are unadorned--no underscore prefix or '@nn' suffix--so 34 * GetProcAddress can be used easily. */ 35 36 #define WINPTY_API __cdecl 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /* The winpty API uses wide characters, instead of UTF-8, to avoid conversion 43 * complications related to surrogates. Windows generally tolerates unpaired 44 * surrogates in text, which makes conversion to and from UTF-8 ambiguous and 45 * complicated. (There are different UTF-8 variants that deal with UTF-16 46 * surrogates differently.) */ 47 48 49 50 /***************************************************************************** 51 * Error handling. */ 52 53 /* All the APIs have an optional winpty_error_t output parameter. If a 54 * non-NULL argument is specified, then either the API writes NULL to the 55 * value (on success) or writes a newly allocated winpty_error_t object. The 56 * object must be freed using winpty_error_free. */ 57 58 /* An error object. */ 59 typedef struct winpty_error_s winpty_error_t; 60 typedef winpty_error_t *winpty_error_ptr_t; 61 62 /* An error code -- one of WINPTY_ERROR_xxx. */ 63 typedef DWORD winpty_result_t; 64 65 /* The winpty_config_t object is not thread-safe. */ 66 typedef struct winpty_config_s winpty_config_t; 67 /* The winpty_t object is thread-safe. */ 68 typedef struct winpty_s winpty_t; 69 /* The winpty_spawn_config_t object is not thread-safe. */ 70 typedef struct winpty_spawn_config_s winpty_spawn_config_t; 71 72 73 74 /****************************************************************************/ 75 76 #ifdef __cplusplus 77 } 78 #endif 79 80 #endif /* WINPTY_H */ 81