libghostty
Loading...
Searching...
No Matches
sys.h
Go to the documentation of this file.
1
6
7#ifndef GHOSTTY_VT_SYS_H
8#define GHOSTTY_VT_SYS_H
9
10#include <stdbool.h>
11#include <stddef.h>
12#include <stdint.h>
13#include <ghostty/vt/types.h>
15
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
58typedef struct {
60 uint32_t width;
61
63 uint32_t height;
64
69 uint8_t* data;
70
76 size_t data_len;
78
82typedef enum GHOSTTY_ENUM_TYPED {
83 GHOSTTY_SYS_LOG_LEVEL_ERROR = 0,
84 GHOSTTY_SYS_LOG_LEVEL_WARNING = 1,
85 GHOSTTY_SYS_LOG_LEVEL_INFO = 2,
86 GHOSTTY_SYS_LOG_LEVEL_DEBUG = 3,
87 GHOSTTY_SYS_LOG_LEVEL_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
89
110typedef void (*GhosttySysLogFn)(
111 void* userdata,
112 GhosttySysLogLevel level,
113 const uint8_t* scope,
114 size_t scope_len,
115 const uint8_t* message,
116 size_t message_len);
117
168typedef bool (*GhosttySysDecodePngFn)(
169 void* userdata,
170 const GhosttyAllocator* allocator,
171 const uint8_t* data,
172 size_t data_len,
173 GhosttySysImage* out);
174
189 void* userdata,
190 uint8_t* buf,
191 size_t len);
192
196typedef enum GHOSTTY_ENUM_TYPED {
203
214
234
249 GHOSTTY_SYS_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
251
266 const void* value);
267
278GHOSTTY_API void ghostty_sys_log_stderr(void* userdata,
279 GhosttySysLogLevel level,
280 const uint8_t* scope,
281 size_t scope_len,
282 const uint8_t* message,
283 size_t message_len);
284
285#ifdef __cplusplus
286}
287#endif
288
290
291#endif /* GHOSTTY_VT_SYS_H */
GHOSTTY_API GhosttyResult ghostty_sys_set(GhosttySysOption option, const void *value)
void(*) GhosttySysLogFn(void *userdata, GhosttySysLogLevel level, const uint8_t *scope, size_t scope_len, const uint8_t *message, size_t message_len)
Definition sys.h:110
GhosttySysLogLevel
Definition sys.h:82
GHOSTTY_API void ghostty_sys_log_stderr(void *userdata, GhosttySysLogLevel level, const uint8_t *scope, size_t scope_len, const uint8_t *message, size_t message_len)
bool(*) GhosttySysDecodePngFn(void *userdata, const GhosttyAllocator *allocator, const uint8_t *data, size_t data_len, GhosttySysImage *out)
Definition sys.h:168
bool(*) GhosttySysRandomSecureFn(void *userdata, uint8_t *buf, size_t len)
Definition sys.h:188
GhosttySysOption
Definition sys.h:196
@ GHOSTTY_SYS_OPT_DECODE_PNG
Definition sys.h:213
@ GHOSTTY_SYS_OPT_LOG
Definition sys.h:233
@ GHOSTTY_SYS_OPT_RANDOM_SECURE
Definition sys.h:248
@ GHOSTTY_SYS_OPT_USERDATA
Definition sys.h:202
uint32_t width
Definition sys.h:60
uint32_t height
Definition sys.h:63
uint8_t * data
Definition sys.h:69
size_t data_len
Definition sys.h:76
GhosttyResult
Definition types.h:88
#define GHOSTTY_ENUM_TYPED
Definition types.h:81