From dcebf9c7f954a55350b68d0ead1935612c4e2e05 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 15 Oct 2026 13:04:01 +0300 Subject: Rename the library to wsap_vtcore ncurses installs and defines struct term. In a file that includes both headers, an ncurses TERMINAL * and this library's terminal are silently the same type. The name wsap_vtcore avoids the clash. The public header is now . Every global symbol uses the wsap_vtcore_ prefix, every macro uses WSAP_VTCORE_, and the shared library is libwsap_vtcore.so.0. The default terminal name is now "wsap_vtcore". The ISA override variable is WSAP_VTCORE_ISA. No other behavior changes. The amalgamation writes wsap_vtcore.c and wsap_vtcore.h. Co-Authored-By: Claude Haiku 5.5 --- src/term.c | 96 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'src/term.c') diff --git a/src/term.c b/src/term.c index 5839da3..3b920ea 100644 --- a/src/term.c +++ b/src/term.c @@ -1,47 +1,47 @@ #include "internal.h" #include "screen.h" -_Thread_local char term_thread_anchor; +_Thread_local char wsap_vtcore_thread_anchor; -const char *term_unicode_version(void) +const char *wsap_vtcore_unicode_version(void) { - return TERM_UNICODE_DATA_VERSION; + return WSAP_VTCORE_UNICODE_DATA_VERSION; } -unsigned term_version(void) +unsigned wsap_vtcore_version(void) { - return TERM_VERSION_CODE; + return WSAP_VTCORE_VERSION_CODE; } -void term_lock(struct term *t) +void wsap_vtcore_lock(struct wsap_vtcore *t) { - term_write_begin(t); + wsap_vtcore_write_begin(t); } -void term_unlock(struct term *t) +void wsap_vtcore_unlock(struct wsap_vtcore *t) { - term_write_end(t); + wsap_vtcore_write_end(t); } -struct term_vector2i term_size(const struct term *t) +struct wsap_vtcore_vector2i wsap_vtcore_size(const struct wsap_vtcore *t) { if (!t) - return (struct term_vector2i){ 0 }; - term_write_begin((struct term *)t); - struct term_vector2i size = { .x = t->cols, .y = t->rows }; - term_write_end((struct term *)t); + return (struct wsap_vtcore_vector2i){ 0 }; + wsap_vtcore_write_begin((struct wsap_vtcore *)t); + struct wsap_vtcore_vector2i size = { .x = t->cols, .y = t->rows }; + wsap_vtcore_write_end((struct wsap_vtcore *)t); return size; } -struct term_modes term_modes(const struct term *t) +struct wsap_vtcore_modes wsap_vtcore_modes(const struct wsap_vtcore *t) { if (!t) - return (struct term_modes){ 0 }; - term_write_begin((struct term *)t); - struct term_modes m = { + return (struct wsap_vtcore_modes){ 0 }; + wsap_vtcore_write_begin((struct wsap_vtcore *)t); + struct wsap_vtcore_modes m = { .keyboard = t->keyboard[t->alternate].flags, - .mouse = (enum term_mouse)t->mouse_mode, - .mouse_encoding = (enum term_mouse_encoding)t->mouse_encoding, + .mouse = (enum wsap_vtcore_mouse)t->mouse_mode, + .mouse_encoding = (enum wsap_vtcore_mouse_encoding)t->mouse_encoding, .grid = { .x = t->cols, .y = t->rows }, .app_cursor = t->application_cursor, .app_keypad = t->application_keypad, @@ -52,82 +52,82 @@ struct term_modes term_modes(const struct term *t) .reverse_video = t->reverse_video, .synchronized = t->synchronized_output, }; - term_write_end((struct term *)t); + wsap_vtcore_write_end((struct wsap_vtcore *)t); return m; } -struct term_cursor term_cursor(const struct term *t) +struct wsap_vtcore_cursor wsap_vtcore_cursor(const struct wsap_vtcore *t) { if (!t) - return (struct term_cursor){ .visible = true }; - term_write_begin((struct term *)t); - struct term_cursor c = { + return (struct wsap_vtcore_cursor){ .visible = true }; + wsap_vtcore_write_begin((struct wsap_vtcore *)t); + struct wsap_vtcore_cursor c = { .pos = { .x = t->cursor_x, .y = t->cursor_y }, .style = t->cursor_style, .visible = t->cursor_visible, .blink = t->cursor_blink, }; - term_write_end((struct term *)t); + wsap_vtcore_write_end((struct wsap_vtcore *)t); return c; } -void term_set_cursor_default(struct term *t, enum term_cursor_style style, bool steady) +void wsap_vtcore_set_cursor_default(struct wsap_vtcore *t, enum wsap_vtcore_cursor_style style, bool steady) { if (!t) return; - term_write_begin(t); - if (style > TERM_CURSOR_BAR) - style = TERM_CURSOR_BLOCK; + wsap_vtcore_write_begin(t); + if (style > WSAP_VTCORE_CURSOR_BAR) + style = WSAP_VTCORE_CURSOR_BLOCK; if (t->cursor_style != style || t->cursor_blink == steady) { - struct srow *cur = term_row(t, t->cursor_y); + struct srow *cur = wsap_vtcore_row(t, t->cursor_y); if (cur) cur->version++; } t->default_cursor_style = t->cursor_style = style; t->default_cursor_blink = t->cursor_blink = !steady; - term_write_end(t); + wsap_vtcore_write_end(t); } -void term_set_theme(struct term *t, const struct term_theme *theme) +void wsap_vtcore_set_theme(struct wsap_vtcore *t, const struct wsap_vtcore_theme *theme) { if (!t) return; - term_write_begin(t); + wsap_vtcore_write_begin(t); struct palette next = { .version = t->palette.version }; - term_palette_init(&next, theme); + wsap_vtcore_palette_init(&next, theme); if (memcmp(&next.theme, &t->palette.theme, sizeof(next.theme))) t->palette = next; - term_write_end(t); + wsap_vtcore_write_end(t); } -void term_focus(struct term *t, bool focused) +void wsap_vtcore_focus(struct wsap_vtcore *t, bool focused) { if (!t) return; - term_write_begin(t); + wsap_vtcore_write_begin(t); if (t->focus_events) send_response(t, focused ? "\033[I" : "\033[O"); - term_write_end(t); + wsap_vtcore_write_end(t); } -char *term_cwd(const struct term *t) +char *wsap_vtcore_cwd(const struct wsap_vtcore *t) { if (!t) return NULL; - term_write_begin((struct term *)t); - char *text = t->cwd ? term_strdup(t->cwd) : NULL; - term_write_end((struct term *)t); + wsap_vtcore_write_begin((struct wsap_vtcore *)t); + char *text = t->cwd ? wsap_vtcore_strdup(t->cwd) : NULL; + wsap_vtcore_write_end((struct wsap_vtcore *)t); return text; } -char *term_pointer_shape(const struct term *t) +char *wsap_vtcore_pointer_shape(const struct wsap_vtcore *t) { if (!t) return NULL; - term_write_begin((struct term *)t); - char *text = t->pointer_shape ? term_strdup(t->pointer_shape) : NULL; - term_write_end((struct term *)t); + wsap_vtcore_write_begin((struct wsap_vtcore *)t); + char *text = t->pointer_shape ? wsap_vtcore_strdup(t->pointer_shape) : NULL; + wsap_vtcore_write_end((struct wsap_vtcore *)t); return text; } -void term_text_free(char *text) +void wsap_vtcore_text_free(char *text) { free(text); } -- cgit v1.2.3