libghostty-vt 0.0.0
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
72#ifndef GHOSTTY_DEPRECATED
73#if defined(__GNUC__) || defined(__clang__)
74 #define GHOSTTY_DEPRECATED(msg) __attribute__((deprecated(msg)))
75#elif defined(_MSC_VER)
76 #define GHOSTTY_DEPRECATED(msg) __declspec(deprecated(msg))
77#else
78 #define GHOSTTY_DEPRECATED(msg)
79#endif
80#endif
81
118#if defined(__cplusplus) && \
119 (__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700))
120#define GHOSTTY_ENUM_TYPED : int
121#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
122#define GHOSTTY_ENUM_TYPED : int
123#else
124#define GHOSTTY_ENUM_TYPED
125#endif
126#define GHOSTTY_ENUM_MAX_VALUE INT_MAX
127
143typedef enum GHOSTTY_ENUM_TYPED {
186 GHOSTTY_RESULT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
188
189/* ---- Opaque handles ---- */
190
196typedef struct GhosttyTerminalImpl* GhosttyTerminal;
197
203typedef struct GhosttySnapshotDecoderImpl* GhosttySnapshotDecoder;
204
215typedef struct GhosttyTrackedGridRefImpl* GhosttyTrackedGridRef;
216
227typedef struct GhosttyKittyGraphicsImpl* GhosttyKittyGraphics;
228
238typedef const struct GhosttyKittyGraphicsImageImpl* GhosttyKittyGraphicsImage;
239
245typedef struct GhosttyKittyGraphicsPlacementIteratorImpl* GhosttyKittyGraphicsPlacementIterator;
246
252typedef struct GhosttyRenderStateImpl* GhosttyRenderState;
253
259typedef struct GhosttyRenderStateRowIteratorImpl* GhosttyRenderStateRowIterator;
260
266typedef struct GhosttyRenderStateRowCellsImpl* GhosttyRenderStateRowCells;
267
274typedef struct GhosttyRenderStateImageIteratorImpl* GhosttyRenderStateImageIterator;
275
287typedef struct GhosttySearchImpl* GhosttySearch;
288
297typedef struct GhosttySgrParserImpl* GhosttySgrParser;
298
304typedef struct GhosttyFormatterImpl* GhosttyFormatter;
305
314typedef struct GhosttyOscParserImpl* GhosttyOscParser;
315
324typedef struct GhosttyOscCommandImpl* GhosttyOscCommand;
325
326/* ---- Common value types ---- */
327
333typedef enum GHOSTTY_ENUM_TYPED {
336
339
342 GHOSTTY_FORMATTER_FORMAT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
344
355typedef enum GHOSTTY_ENUM_TYPED {
358
361
364
367 GHOSTTY_CURSOR_STYLE_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
369
395typedef enum GHOSTTY_ENUM_TYPED {
399
403
406 GHOSTTY_IMAGE_LAYER_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
408
418#define GHOSTTY_IMAGE_LAYER_MASK_BELOW_BACKGROUND \
419 (1u << GHOSTTY_IMAGE_LAYER_BELOW_BACKGROUND)
420
422#define GHOSTTY_IMAGE_LAYER_MASK_BELOW_TEXT \
423 (1u << GHOSTTY_IMAGE_LAYER_BELOW_TEXT)
424
426#define GHOSTTY_IMAGE_LAYER_MASK_ABOVE_TEXT \
427 (1u << GHOSTTY_IMAGE_LAYER_ABOVE_TEXT)
428
439typedef struct {
441 const uint8_t* ptr;
442
444 size_t len;
446
455typedef struct {
457 uint8_t* ptr;
458
460 size_t cap;
461
463 size_t len;
465
475typedef struct {
477 double x;
478
480 double y;
482
494typedef struct {
496 const uint32_t* ptr;
497
499 size_t len;
501
518typedef struct {
520 uint32_t* ptr;
521
523 size_t cap;
524
527 size_t len;
529
550#ifdef __cplusplus
551#define GHOSTTY_INIT_SIZED(type) \
552 ([]() noexcept { \
553 type value{}; \
554 value.size = sizeof(value); \
555 return value; \
556 }())
557#else
558#define GHOSTTY_INIT_SIZED(type) \
559 ((type){ .size = sizeof(type) })
560#endif
561
584GHOSTTY_API void ghostty_sized_init(void* ptr, size_t size);
585
674GHOSTTY_API const char *ghostty_type_json(void);
675
676#endif /* GHOSTTY_VT_TYPES_H */
GhosttyResult
Definition types.h:143
GHOSTTY_API const char * ghostty_type_json(void)
GHOSTTY_API void ghostty_sized_init(void *ptr, size_t size)
#define GHOSTTY_ENUM_TYPED
Definition types.h:124
@ GHOSTTY_OUT_OF_SPACE
Definition types.h:158
@ GHOSTTY_REJECTED
Definition types.h:170
@ GHOSTTY_INVALID_VALUE
Definition types.h:156
@ GHOSTTY_OUT_OF_MEMORY
Definition types.h:147
@ GHOSTTY_NO_VALUE
Definition types.h:160
@ GHOSTTY_LIMIT_EXCEEDED
Definition types.h:164
@ GHOSTTY_IO_ERROR
Definition types.h:162
@ GHOSTTY_SUCCESS
Definition types.h:145
@ GHOSTTY_UNSUPPORTED
Definition types.h:185
GhosttyFormatterFormat
Definition types.h:333
struct GhosttyFormatterImpl * GhosttyFormatter
Definition types.h:304
@ GHOSTTY_FORMATTER_FORMAT_PLAIN
Definition types.h:335
@ GHOSTTY_FORMATTER_FORMAT_HTML
Definition types.h:341
@ GHOSTTY_FORMATTER_FORMAT_VT
Definition types.h:338
struct GhosttyTrackedGridRefImpl * GhosttyTrackedGridRef
Definition types.h:215
struct GhosttyKittyGraphicsImpl * GhosttyKittyGraphics
Definition types.h:227
struct GhosttyKittyGraphicsPlacementIteratorImpl * GhosttyKittyGraphicsPlacementIterator
Definition types.h:245
const struct GhosttyKittyGraphicsImageImpl * GhosttyKittyGraphicsImage
Definition types.h:238
struct GhosttyOscParserImpl * GhosttyOscParser
Definition types.h:314
struct GhosttyOscCommandImpl * GhosttyOscCommand
Definition types.h:324
GhosttyImageLayer
Definition types.h:395
struct GhosttyRenderStateRowIteratorImpl * GhosttyRenderStateRowIterator
Definition types.h:259
struct GhosttyRenderStateImpl * GhosttyRenderState
Definition types.h:252
struct GhosttyRenderStateImageIteratorImpl * GhosttyRenderStateImageIterator
Definition types.h:274
struct GhosttyRenderStateRowCellsImpl * GhosttyRenderStateRowCells
Definition types.h:266
@ GHOSTTY_IMAGE_LAYER_ABOVE_TEXT
Definition types.h:405
@ GHOSTTY_IMAGE_LAYER_BELOW_BACKGROUND
Definition types.h:398
@ GHOSTTY_IMAGE_LAYER_BELOW_TEXT
Definition types.h:402
struct GhosttySearchImpl * GhosttySearch
Definition types.h:287
struct GhosttySgrParserImpl * GhosttySgrParser
Definition types.h:297
struct GhosttySnapshotDecoderImpl * GhosttySnapshotDecoder
Definition types.h:203
struct GhosttyTerminalImpl * GhosttyTerminal
Definition types.h:196
GhosttyCursorStyle
Definition types.h:355
@ GHOSTTY_CURSOR_STYLE_BAR
Definition types.h:357
@ GHOSTTY_CURSOR_STYLE_UNDERLINE
Definition types.h:363
@ GHOSTTY_CURSOR_STYLE_BLOCK_HOLLOW
Definition types.h:366
@ GHOSTTY_CURSOR_STYLE_BLOCK
Definition types.h:360
size_t len
Definition types.h:463
size_t cap
Definition types.h:460
uint8_t * ptr
Definition types.h:457
const uint32_t * ptr
Definition types.h:496
size_t len
Definition types.h:444
const uint8_t * ptr
Definition types.h:441