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 GhosttyKittyGraphicsImpl* GhosttyKittyGraphics;
108
118typedef const struct GhosttyKittyGraphicsImageImpl* GhosttyKittyGraphicsImage;
119
125typedef struct GhosttyKittyGraphicsPlacementIteratorImpl* GhosttyKittyGraphicsPlacementIterator;
126
132typedef struct GhosttyRenderStateImpl* GhosttyRenderState;
133
139typedef struct GhosttyRenderStateRowIteratorImpl* GhosttyRenderStateRowIterator;
140
146typedef struct GhosttyRenderStateRowCellsImpl* GhosttyRenderStateRowCells;
147
156typedef struct GhosttySgrParserImpl* GhosttySgrParser;
157
163typedef struct GhosttyFormatterImpl* GhosttyFormatter;
164
173typedef struct GhosttyOscParserImpl* GhosttyOscParser;
174
183typedef struct GhosttyOscCommandImpl* GhosttyOscCommand;
184
185/* ---- Common value types ---- */
186
193typedef struct {
195 const uint8_t* ptr;
196
198 size_t len;
200
219#define GHOSTTY_INIT_SIZED(type) \
220 ((type){ .size = sizeof(type) })
221
255GHOSTTY_API const char *ghostty_type_json(void);
256
257#endif /* GHOSTTY_VT_TYPES_H */
struct GhosttyFormatterImpl * GhosttyFormatter
Definition types.h:163
struct GhosttyKittyGraphicsImpl * GhosttyKittyGraphics
Definition types.h:107
struct GhosttyKittyGraphicsPlacementIteratorImpl * GhosttyKittyGraphicsPlacementIterator
Definition types.h:125
const struct GhosttyKittyGraphicsImageImpl * GhosttyKittyGraphicsImage
Definition types.h:118
struct GhosttyOscParserImpl * GhosttyOscParser
Definition types.h:173
struct GhosttyOscCommandImpl * GhosttyOscCommand
Definition types.h:183
struct GhosttyRenderStateRowIteratorImpl * GhosttyRenderStateRowIterator
Definition types.h:139
struct GhosttyRenderStateImpl * GhosttyRenderState
Definition types.h:132
struct GhosttyRenderStateRowCellsImpl * GhosttyRenderStateRowCells
Definition types.h:146
struct GhosttySgrParserImpl * GhosttySgrParser
Definition types.h:156
struct GhosttyTerminalImpl * GhosttyTerminal
Definition types.h:95
size_t len
Definition types.h:198
const uint8_t * ptr
Definition types.h:195
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