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 {
85 GHOSTTY_RESULT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
87
88/* ---- Opaque handles ---- */
89
95typedef struct GhosttyTerminalImpl* GhosttyTerminal;
96
107typedef struct GhosttyTrackedGridRefImpl* GhosttyTrackedGridRef;
108
119typedef struct GhosttyKittyGraphicsImpl* GhosttyKittyGraphics;
120
130typedef const struct GhosttyKittyGraphicsImageImpl* GhosttyKittyGraphicsImage;
131
137typedef struct GhosttyKittyGraphicsPlacementIteratorImpl* GhosttyKittyGraphicsPlacementIterator;
138
144typedef struct GhosttyRenderStateImpl* GhosttyRenderState;
145
151typedef struct GhosttyRenderStateRowIteratorImpl* GhosttyRenderStateRowIterator;
152
158typedef struct GhosttyRenderStateRowCellsImpl* GhosttyRenderStateRowCells;
159
168typedef struct GhosttySgrParserImpl* GhosttySgrParser;
169
175typedef struct GhosttyFormatterImpl* GhosttyFormatter;
176
185typedef struct GhosttyOscParserImpl* GhosttyOscParser;
186
195typedef struct GhosttyOscCommandImpl* GhosttyOscCommand;
196
197/* ---- Common value types ---- */
198
204typedef enum GHOSTTY_ENUM_TYPED {
207
210
213 GHOSTTY_FORMATTER_FORMAT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
215
222typedef struct {
224 const uint8_t* ptr;
225
227 size_t len;
229
237typedef struct {
239 double x;
240
242 double y;
244
254typedef struct {
256 const uint32_t* ptr;
257
259 size_t len;
261
280#define GHOSTTY_INIT_SIZED(type) \
281 ((type){ .size = sizeof(type) })
282
316GHOSTTY_API const char *ghostty_type_json(void);
317
318#endif /* GHOSTTY_VT_TYPES_H */
GhosttyFormatterFormat
Definition types.h:204
struct GhosttyFormatterImpl * GhosttyFormatter
Definition types.h:175
@ GHOSTTY_FORMATTER_FORMAT_PLAIN
Definition types.h:206
@ GHOSTTY_FORMATTER_FORMAT_HTML
Definition types.h:212
@ GHOSTTY_FORMATTER_FORMAT_VT
Definition types.h:209
struct GhosttyTrackedGridRefImpl * GhosttyTrackedGridRef
Definition types.h:107
struct GhosttyKittyGraphicsImpl * GhosttyKittyGraphics
Definition types.h:119
struct GhosttyKittyGraphicsPlacementIteratorImpl * GhosttyKittyGraphicsPlacementIterator
Definition types.h:137
const struct GhosttyKittyGraphicsImageImpl * GhosttyKittyGraphicsImage
Definition types.h:130
struct GhosttyOscParserImpl * GhosttyOscParser
Definition types.h:185
struct GhosttyOscCommandImpl * GhosttyOscCommand
Definition types.h:195
struct GhosttyRenderStateRowIteratorImpl * GhosttyRenderStateRowIterator
Definition types.h:151
struct GhosttyRenderStateImpl * GhosttyRenderState
Definition types.h:144
struct GhosttyRenderStateRowCellsImpl * GhosttyRenderStateRowCells
Definition types.h:158
struct GhosttySgrParserImpl * GhosttySgrParser
Definition types.h:168
struct GhosttyTerminalImpl * GhosttyTerminal
Definition types.h:95
const uint32_t * ptr
Definition types.h:256
size_t len
Definition types.h:227
const uint8_t * ptr
Definition types.h:224
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_SUCCESS
Definition types.h:76
GHOSTTY_API const char * ghostty_type_json(void)
#define GHOSTTY_ENUM_TYPED
Definition types.h:67