libghostty
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
6
7#ifndef GHOSTTY_VT_TYPES_H
8#define GHOSTTY_VT_TYPES_H
9
10#include <limits.h>
11#include <stddef.h>
12#include <stdint.h>
13
14// Symbol visibility for shared library builds. On Windows, functions
15// are exported from the DLL when building and imported when consuming.
16// On other platforms with GCC/Clang, functions are marked with default
17// visibility so they remain accessible when the library is built with
18// -fvisibility=hidden. For static library builds, define GHOSTTY_STATIC
19// before including this header to make this a no-op.
20#ifndef GHOSTTY_API
21#if defined(GHOSTTY_STATIC)
22 #define GHOSTTY_API
23#elif defined(_WIN32) || defined(_WIN64)
24 #ifdef GHOSTTY_BUILD_SHARED
25 #define GHOSTTY_API __declspec(dllexport)
26 #else
27 #define GHOSTTY_API __declspec(dllimport)
28 #endif
29#elif defined(__GNUC__) && __GNUC__ >= 4
30 #define GHOSTTY_API __attribute__((visibility("default")))
31#else
32 #define GHOSTTY_API
33#endif
34#endif
35
64#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
65#define GHOSTTY_ENUM_TYPED : int
66#else
67#define GHOSTTY_ENUM_TYPED
68#endif
69#define GHOSTTY_ENUM_MAX_VALUE INT_MAX
70
74typedef enum GHOSTTY_ENUM_TYPED {
89 GHOSTTY_RESULT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
91
92/* ---- Opaque handles ---- */
93
99typedef struct GhosttyTerminalImpl* GhosttyTerminal;
100
106typedef struct GhosttySnapshotDecoderImpl* GhosttySnapshotDecoder;
107
118typedef struct GhosttyTrackedGridRefImpl* GhosttyTrackedGridRef;
119
130typedef struct GhosttyKittyGraphicsImpl* GhosttyKittyGraphics;
131
141typedef const struct GhosttyKittyGraphicsImageImpl* GhosttyKittyGraphicsImage;
142
148typedef struct GhosttyKittyGraphicsPlacementIteratorImpl* GhosttyKittyGraphicsPlacementIterator;
149
155typedef struct GhosttyRenderStateImpl* GhosttyRenderState;
156
162typedef struct GhosttyRenderStateRowIteratorImpl* GhosttyRenderStateRowIterator;
163
169typedef struct GhosttyRenderStateRowCellsImpl* GhosttyRenderStateRowCells;
170
179typedef struct GhosttySgrParserImpl* GhosttySgrParser;
180
186typedef struct GhosttyFormatterImpl* GhosttyFormatter;
187
196typedef struct GhosttyOscParserImpl* GhosttyOscParser;
197
206typedef struct GhosttyOscCommandImpl* GhosttyOscCommand;
207
208/* ---- Common value types ---- */
209
215typedef enum GHOSTTY_ENUM_TYPED {
218
221
224 GHOSTTY_FORMATTER_FORMAT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
226
233typedef struct {
235 const uint8_t* ptr;
236
238 size_t len;
240
247typedef struct {
249 uint8_t* ptr;
250
252 size_t cap;
253
255 size_t len;
257
265typedef struct {
267 double x;
268
270 double y;
272
282typedef struct {
284 const uint32_t* ptr;
285
287 size_t len;
289
308#define GHOSTTY_INIT_SIZED(type) \
309 ((type){ .size = sizeof(type) })
310
344GHOSTTY_API const char *ghostty_type_json(void);
345
346#endif /* GHOSTTY_VT_TYPES_H */
GhosttyFormatterFormat
Definition types.h:215
struct GhosttyFormatterImpl * GhosttyFormatter
Definition types.h:186
@ GHOSTTY_FORMATTER_FORMAT_PLAIN
Definition types.h:217
@ GHOSTTY_FORMATTER_FORMAT_HTML
Definition types.h:223
@ GHOSTTY_FORMATTER_FORMAT_VT
Definition types.h:220
struct GhosttyTrackedGridRefImpl * GhosttyTrackedGridRef
Definition types.h:118
struct GhosttyKittyGraphicsImpl * GhosttyKittyGraphics
Definition types.h:130
struct GhosttyKittyGraphicsPlacementIteratorImpl * GhosttyKittyGraphicsPlacementIterator
Definition types.h:148
const struct GhosttyKittyGraphicsImageImpl * GhosttyKittyGraphicsImage
Definition types.h:141
struct GhosttyOscParserImpl * GhosttyOscParser
Definition types.h:196
struct GhosttyOscCommandImpl * GhosttyOscCommand
Definition types.h:206
struct GhosttyRenderStateRowIteratorImpl * GhosttyRenderStateRowIterator
Definition types.h:162
struct GhosttyRenderStateImpl * GhosttyRenderState
Definition types.h:155
struct GhosttyRenderStateRowCellsImpl * GhosttyRenderStateRowCells
Definition types.h:169
struct GhosttySgrParserImpl * GhosttySgrParser
Definition types.h:179
struct GhosttySnapshotDecoderImpl * GhosttySnapshotDecoder
Definition types.h:106
struct GhosttyTerminalImpl * GhosttyTerminal
Definition types.h:99
size_t len
Definition types.h:255
size_t cap
Definition types.h:252
uint8_t * ptr
Definition types.h:249
const uint32_t * ptr
Definition types.h:284
size_t len
Definition types.h:238
const uint8_t * ptr
Definition types.h:235
GhosttyResult
Definition types.h:74
@ GHOSTTY_OUT_OF_SPACE
Definition types.h:82
@ GHOSTTY_INVALID_VALUE
Definition types.h:80
@ GHOSTTY_OUT_OF_MEMORY
Definition types.h:78
@ GHOSTTY_NO_VALUE
Definition types.h:84
@ GHOSTTY_LIMIT_EXCEEDED
Definition types.h:88
@ GHOSTTY_IO_ERROR
Definition types.h:86
@ GHOSTTY_SUCCESS
Definition types.h:76
GHOSTTY_API const char * ghostty_type_json(void)
#define GHOSTTY_ENUM_TYPED
Definition types.h:67