113static bool g_has_tty =
false;
124static atomic_bool g_is_first_frame_of_connection =
true;
149static tty_info_t display_get_current_tty(
void) {
172static void full_terminal_reset(
int fd) {
204static void write_frame_to_output(
const char *frame_data,
bool use_direct_tty) {
212 size_t frame_len = strnlen(frame_data, 1024 * 1024);
213 if (frame_len == 0) {
218 if (use_direct_tty) {
237 (void)fflush(stdout);
316 atomic_store(&g_is_first_frame_of_connection,
true);
329 if (atomic_load(&g_is_first_frame_of_connection)) {
331 atomic_store(&g_is_first_frame_of_connection,
false);
361 if (g_has_tty || (!g_has_tty &&
GET_OPTION(snapshot_mode) && is_snapshot_frame)) {
362 if (is_snapshot_frame) {
364 write_frame_to_output(frame_data,
true);
368 write_frame_to_output(frame_data, g_has_tty && !is_snapshot_frame);
370 if (
GET_OPTION(snapshot_mode) && is_snapshot_frame) {
🔌 Cross-platform abstraction layer umbrella header for ascii-chat
🖼️ ASCII Art Conversion and Output Interface
bool should_exit()
Check if client should exit.
ascii-chat Client Display Management Interface
bool display_has_tty()
Check if display has TTY capability.
int display_init()
Initialize what is necessary to display ascii frames.
void display_full_reset()
Perform full display reset.
tty_info_t g_tty_info
Global TTY information structure.
void display_cleanup()
Cleanup display subsystem.
void display_disable_logging_for_first_frame()
Disable terminal logging for first frame.
void display_render_frame(const char *frame_data, bool is_snapshot_frame)
Render ASCII frame to display.
void display_reset_for_new_connection()
Reset display state for new connection.
#define SET_ERRNO(code, context_msg,...)
Set error code with custom context message and log it.
#define log_error(...)
Log an ERROR message.
void log_set_terminal_output(bool enabled)
Control stderr output to terminal.
#define GET_OPTION(field)
Safely get a specific option field (lock-free read)
asciichat_error_t ascii_write_init(int fd, bool reset_terminal)
Initialize ASCII write subsystem.
void ascii_write_destroy(int fd, bool reset_terminal)
Destroy ASCII write subsystem.
#define console_clear(fd)
Clear console and move cursor to home position.
#define cursor_reset(fd)
Reset cursor to home position.
⚙️ Command-line options parsing and configuration management for ascii-chat
ascii-chat Server Mode Entry Point Header
TTY detection and management structure.
bool owns_fd
True if we opened the FD and should close it, false otherwise.
int fd
File descriptor for TTY access.
const char * path
Path to TTY device (e.g., "/dev/tty", "CON", etc.)