libghostty-vt
0.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
formatter.h
Go to the documentation of this file.
1
6
7
#ifndef GHOSTTY_VT_FORMATTER_H
8
#define GHOSTTY_VT_FORMATTER_H
9
10
#include <stdbool.h>
11
#include <stddef.h>
12
#include <stdint.h>
13
#include <
ghostty/vt/allocator.h
>
14
#include <
ghostty/vt/io.h
>
15
#include <
ghostty/vt/selection.h
>
16
#include <
ghostty/vt/types.h
>
17
#include <
ghostty/vt/terminal.h
>
18
19
#ifdef __cplusplus
20
extern
"C"
{
21
#endif
22
43
75
typedef
uint32_t
GhosttyFormatterExtras
;
76
78
#define GHOSTTY_FORMATTER_EXTRA_PALETTE (1u << 0)
80
#define GHOSTTY_FORMATTER_EXTRA_MODES (1u << 1)
82
#define GHOSTTY_FORMATTER_EXTRA_SCROLLING_REGION (1u << 2)
84
#define GHOSTTY_FORMATTER_EXTRA_TABSTOPS (1u << 3)
86
#define GHOSTTY_FORMATTER_EXTRA_PWD (1u << 4)
88
#define GHOSTTY_FORMATTER_EXTRA_KEYBOARD (1u << 5)
90
#define GHOSTTY_FORMATTER_EXTRA_CURSOR (1u << 6)
92
#define GHOSTTY_FORMATTER_EXTRA_STYLE (1u << 7)
94
#define GHOSTTY_FORMATTER_EXTRA_HYPERLINK (1u << 8)
96
#define GHOSTTY_FORMATTER_EXTRA_PROTECTION (1u << 9)
98
#define GHOSTTY_FORMATTER_EXTRA_KITTY_KEYBOARD (1u << 10)
100
#define GHOSTTY_FORMATTER_EXTRA_CHARSETS (1u << 11)
101
103
#define GHOSTTY_FORMATTER_EXTRAS_NONE 0u
104
106
#define GHOSTTY_FORMATTER_EXTRAS_ALL 0xFFFu
107
113
#define GHOSTTY_FORMATTER_EXTRAS_DEFAULT \
114
(GHOSTTY_FORMATTER_EXTRA_PALETTE | GHOSTTY_FORMATTER_EXTRA_STYLE | \
115
GHOSTTY_FORMATTER_EXTRA_HYPERLINK)
116
141
typedef
enum
GHOSTTY_ENUM_TYPED
{
143
GHOSTTY_FORMATTER_OPT_INVALID
= 0,
144
151
GHOSTTY_FORMATTER_OPT_EMIT
= 1,
152
162
GHOSTTY_FORMATTER_OPT_UNWRAP
= 2,
163
173
GHOSTTY_FORMATTER_OPT_TRIM
= 3,
174
204
GHOSTTY_FORMATTER_OPT_SELECTION
= 4,
205
212
GHOSTTY_FORMATTER_OPT_EXTRAS
= 5,
213
214
GHOSTTY_FORMATTER_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
215
}
GhosttyFormatterOption
;
216
233
GHOSTTY_API
GhosttyResult
ghostty_formatter_terminal_new
(
234
const
GhosttyAllocator
* allocator,
235
GhosttyFormatter
* formatter,
236
GhosttyTerminal
terminal);
237
271
GHOSTTY_API
GhosttyResult
ghostty_formatter_set
(
GhosttyFormatter
formatter,
272
GhosttyFormatterOption
option,
273
const
void
* value);
274
297
GHOSTTY_API
GhosttyResult
ghostty_formatter_get
(
GhosttyFormatter
formatter,
298
GhosttyFormatterOption
option,
299
void
* out);
300
321
GHOSTTY_API
GhosttyResult
ghostty_formatter_format
(
322
GhosttyFormatter
formatter,
323
GhosttyWriter
writer);
324
346
GHOSTTY_API
GhosttyResult
ghostty_formatter_format_buf
(
GhosttyFormatter
formatter,
347
uint8_t* buf,
348
size_t
buf_len,
349
size_t
* out_written);
350
371
GHOSTTY_API
GhosttyResult
ghostty_formatter_format_alloc
(
GhosttyFormatter
formatter,
372
const
GhosttyAllocator
* allocator,
373
uint8_t** out_ptr,
374
size_t
* out_len);
375
386
GHOSTTY_API
void
ghostty_formatter_free
(
GhosttyFormatter
formatter);
387
389
390
#ifdef __cplusplus
391
}
392
#endif
393
394
#endif
/* GHOSTTY_VT_FORMATTER_H */
allocator.h
GhosttyResult
GhosttyResult
Definition
types.h:143
GHOSTTY_ENUM_TYPED
#define GHOSTTY_ENUM_TYPED
Definition
types.h:124
ghostty_formatter_format_alloc
GHOSTTY_API GhosttyResult ghostty_formatter_format_alloc(GhosttyFormatter formatter, const GhosttyAllocator *allocator, uint8_t **out_ptr, size_t *out_len)
GhosttyFormatterOption
GhosttyFormatterOption
Definition
formatter.h:141
ghostty_formatter_terminal_new
GHOSTTY_API GhosttyResult ghostty_formatter_terminal_new(const GhosttyAllocator *allocator, GhosttyFormatter *formatter, GhosttyTerminal terminal)
ghostty_formatter_set
GHOSTTY_API GhosttyResult ghostty_formatter_set(GhosttyFormatter formatter, GhosttyFormatterOption option, const void *value)
GhosttyFormatterExtras
uint32_t GhosttyFormatterExtras
Definition
formatter.h:75
ghostty_formatter_free
GHOSTTY_API void ghostty_formatter_free(GhosttyFormatter formatter)
ghostty_formatter_get
GHOSTTY_API GhosttyResult ghostty_formatter_get(GhosttyFormatter formatter, GhosttyFormatterOption option, void *out)
ghostty_formatter_format
GHOSTTY_API GhosttyResult ghostty_formatter_format(GhosttyFormatter formatter, GhosttyWriter writer)
ghostty_formatter_format_buf
GHOSTTY_API GhosttyResult ghostty_formatter_format_buf(GhosttyFormatter formatter, uint8_t *buf, size_t buf_len, size_t *out_written)
GhosttyFormatter
struct GhosttyFormatterImpl * GhosttyFormatter
Definition
types.h:304
GHOSTTY_FORMATTER_OPT_TRIM
@ GHOSTTY_FORMATTER_OPT_TRIM
Definition
formatter.h:173
GHOSTTY_FORMATTER_OPT_EMIT
@ GHOSTTY_FORMATTER_OPT_EMIT
Definition
formatter.h:151
GHOSTTY_FORMATTER_OPT_UNWRAP
@ GHOSTTY_FORMATTER_OPT_UNWRAP
Definition
formatter.h:162
GHOSTTY_FORMATTER_OPT_EXTRAS
@ GHOSTTY_FORMATTER_OPT_EXTRAS
Definition
formatter.h:212
GHOSTTY_FORMATTER_OPT_SELECTION
@ GHOSTTY_FORMATTER_OPT_SELECTION
Definition
formatter.h:204
GHOSTTY_FORMATTER_OPT_INVALID
@ GHOSTTY_FORMATTER_OPT_INVALID
Definition
formatter.h:143
GhosttyTerminal
struct GhosttyTerminalImpl * GhosttyTerminal
Definition
types.h:196
io.h
selection.h
GhosttyAllocator
Definition
allocator.h:164
GhosttyWriter
Definition
io.h:113
terminal.h
types.h
include
ghostty
vt
formatter.h
Generated by
1.17.0