ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
platform/wasm/stubs/terminal.c
Go to the documentation of this file.
1
14
16 (void)size;
17 return SET_ERRNO(ERROR_NOT_SUPPORTED, "Terminal operations not supported in WASM");
18}
19
23
27
28// Effective terminal width with fallback to option or default
29unsigned short int terminal_get_effective_width(void) {
30 int width = GET_OPTION(width);
31 if (width > 0) {
32 return (unsigned short int)width;
33 }
34 // For WASM, use default since terminal detection is stubbed
35 return OPT_WIDTH_DEFAULT;
36}
37
38// Effective terminal height with fallback to option or default
39unsigned short int terminal_get_effective_height(void) {
40 int height = GET_OPTION(height);
41 if (height > 0) {
42 return (unsigned short int)height;
43 }
44 // For WASM, use default since terminal detection is stubbed
45 return OPT_HEIGHT_DEFAULT;
46}
47
48// Terminal reader stubs
50
52 (void)fd;
53 (void)frame_height;
54 if (out)
55 *out = NULL;
56 return ASCIICHAT_OK; // Stub - no stdin available in WASM
57}
58
60 (void)reader;
61 // No-op
62}
63
65 (void)reader;
66 if (out_frame)
67 *out_frame = NULL; // Signal EOF immediately
68 return ASCIICHAT_OK;
69}
⚠️‼️ Comprehensive thread-local error context system for ascii-chat
#define SET_ERRNO(code, context_msg,...)
Set error code with custom context message and log it, returning the error code.
asciichat_error_t
Error and exit codes - unified status values (0-255)
Definition error_codes.h:49
@ ASCIICHAT_OK
Definition error_codes.h:51
@ ERROR_NOT_SUPPORTED
Definition error_codes.h:74
#define GET_OPTION(field)
Safely get a specific option field (lock-free read)
#define OPT_HEIGHT_DEFAULT
Default terminal height in characters.
#define OPT_WIDTH_DEFAULT
Default terminal width in characters.
asciichat_error_t terminal_cursor_hide(void)
Hide terminal cursor.
asciichat_error_t terminal_get_size(terminal_size_t *size)
Get terminal size.
asciichat_error_t terminal_cursor_show(void)
Show terminal cursor.
⚙️ Unified options parsing system for ascii-chat with builder pattern and lock-free access
unsigned short int terminal_get_effective_width(void)
Get effective terminal width with fallback priority.
void terminal_fd_reader_destroy(terminal_fd_reader_t *reader)
Destroy terminal FD reader.
asciichat_error_t terminal_fd_reader_next(terminal_fd_reader_t *reader, char **out_frame)
Read next frame from file descriptor.
asciichat_error_t terminal_fd_reader_create(int fd, int frame_height, terminal_fd_reader_t **out)
Create a terminal FD reader from a file descriptor.
unsigned short int terminal_get_effective_height(void)
Get effective terminal height with fallback priority.
Read ANSI ASCII frames from file descriptor, chunked by height.
Terminal size structure.
Definition terminal.h:163
🖥️ Cross-platform terminal interface for ascii-chat