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 --- tests/api_args_test.c | 98 +++++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'tests/api_args_test.c') diff --git a/tests/api_args_test.c b/tests/api_args_test.c index 6c7dfc7..309ee6e 100644 --- a/tests/api_args_test.c +++ b/tests/api_args_test.c @@ -4,7 +4,7 @@ #include /* A feed that returns false must not move the cursor or change a cell. */ -static void expect_unchanged(struct term *t, int x, int y, uint32_t cp) +static void expect_unchanged(struct wsap_vtcore *t, int x, int y, uint32_t cp) { assert(tt_cursor_x(t) == x); assert(tt_cursor_y(t) == y); @@ -13,117 +13,117 @@ static void expect_unchanged(struct term *t, int x, int y, uint32_t cp) static void test_feed_unknown_flag(void) { - struct term *t = tt_new(10, 3); + struct wsap_vtcore *t = tt_new(10, 3); assert(t); - assert(term_feed(t, "abc", 3, 0)); + assert(wsap_vtcore_feed(t, "abc", 3, 0)); expect_unchanged(t, 3, 0, 'a'); - assert(!term_feed(t, "xy", 2, 1u << 1)); + assert(!wsap_vtcore_feed(t, "xy", 2, 1u << 1)); expect_unchanged(t, 3, 0, 'a'); - assert(!term_feed(t, "xy", 2, TERM_FEED_ONLCR | (1u << 4))); + assert(!wsap_vtcore_feed(t, "xy", 2, WSAP_VTCORE_FEED_ONLCR | (1u << 4))); expect_unchanged(t, 3, 0, 'a'); - assert(!term_feed(t, "xy", 2, 1u << 31)); + assert(!wsap_vtcore_feed(t, "xy", 2, 1u << 31)); expect_unchanged(t, 3, 0, 'a'); /* Unknown bits are rejected even when there are no bytes. */ - assert(!term_feed(t, "", 0, 1u << 1)); + assert(!wsap_vtcore_feed(t, "", 0, 1u << 1)); - assert(term_feed(t, "\nz", 2, TERM_FEED_ONLCR)); + assert(wsap_vtcore_feed(t, "\nz", 2, WSAP_VTCORE_FEED_ONLCR)); assert(tt_cursor_x(t) == 1); assert(tt_cursor_y(t) == 1); - term_free(t); + wsap_vtcore_free(t); } static void test_feed_null_buffer(void) { - struct term *t = tt_new(10, 3); + struct wsap_vtcore *t = tt_new(10, 3); assert(t); - assert(term_feed(t, "abc", 3, 0)); + assert(wsap_vtcore_feed(t, "abc", 3, 0)); - assert(!term_feed(t, NULL, 1, 0)); + assert(!wsap_vtcore_feed(t, NULL, 1, 0)); expect_unchanged(t, 3, 0, 'a'); - assert(!term_feed(t, NULL, 4096, TERM_FEED_ONLCR)); + assert(!wsap_vtcore_feed(t, NULL, 4096, WSAP_VTCORE_FEED_ONLCR)); expect_unchanged(t, 3, 0, 'a'); /* A zero length is a no-op, so a NULL buffer is fine. */ - assert(term_feed(t, NULL, 0, 0)); - assert(term_feed(t, "", 0, TERM_FEED_ONLCR)); + assert(wsap_vtcore_feed(t, NULL, 0, 0)); + assert(wsap_vtcore_feed(t, "", 0, WSAP_VTCORE_FEED_ONLCR)); expect_unchanged(t, 3, 0, 'a'); - assert(!term_feed(NULL, "a", 1, 0)); - assert(!term_feed(NULL, NULL, 0, 0)); - term_free(t); + assert(!wsap_vtcore_feed(NULL, "a", 1, 0)); + assert(!wsap_vtcore_feed(NULL, NULL, 0, 0)); + wsap_vtcore_free(t); } static void test_new_rejects_bad_options(void) { - struct term_options opt; + struct wsap_vtcore_options opt; memset(&opt, 0, sizeof(opt)); opt.size.x = -1; - assert(!term_new(&opt)); + assert(!wsap_vtcore_new(&opt)); memset(&opt, 0, sizeof(opt)); opt.size.y = -1; - assert(!term_new(&opt)); + assert(!wsap_vtcore_new(&opt)); memset(&opt, 0, sizeof(opt)); - opt.size.x = TERM_MAX_COLS + 1; - assert(!term_new(&opt)); + opt.size.x = WSAP_VTCORE_MAX_COLS + 1; + assert(!wsap_vtcore_new(&opt)); memset(&opt, 0, sizeof(opt)); opt.scrollback = -1; - assert(!term_new(&opt)); + assert(!wsap_vtcore_new(&opt)); memset(&opt, 0, sizeof(opt)); - opt.scrollback = TERM_SCROLLBACK_MAX + 1; - assert(!term_new(&opt)); + opt.scrollback = WSAP_VTCORE_SCROLLBACK_MAX + 1; + assert(!wsap_vtcore_new(&opt)); memset(&opt, 0, sizeof(opt)); - opt.scrollback = TERM_SCROLLBACK_MAX; - struct term *max = term_new(&opt); + opt.scrollback = WSAP_VTCORE_SCROLLBACK_MAX; + struct wsap_vtcore *max = wsap_vtcore_new(&opt); assert(max); - term_free(max); + wsap_vtcore_free(max); memset(&opt, 0, sizeof(opt)); - opt.cursor_style = (enum term_cursor_style)3; - assert(!term_new(&opt)); + opt.cursor_style = (enum wsap_vtcore_cursor_style)3; + assert(!wsap_vtcore_new(&opt)); memset(&opt, 0, sizeof(opt)); - opt.cursor_style = (enum term_cursor_style)-1; - assert(!term_new(&opt)); + opt.cursor_style = (enum wsap_vtcore_cursor_style)-1; + assert(!wsap_vtcore_new(&opt)); } static void test_new_accepts_defaults(void) { - struct term_options opt; + struct wsap_vtcore_options opt; memset(&opt, 0, sizeof(opt)); - struct term *t = term_new(&opt); + struct wsap_vtcore *t = wsap_vtcore_new(&opt); assert(t); assert(tt_cols(t) == 80); assert(tt_rows(t) == 24); - assert(term_cursor(t).style == TERM_CURSOR_BLOCK); - term_free(t); + assert(wsap_vtcore_cursor(t).style == WSAP_VTCORE_CURSOR_BLOCK); + wsap_vtcore_free(t); memset(&opt, 0, sizeof(opt)); - opt.size.x = TERM_MAX_COLS; + opt.size.x = WSAP_VTCORE_MAX_COLS; opt.size.y = 1; - opt.cursor_style = TERM_CURSOR_BAR; - t = term_new(&opt); + opt.cursor_style = WSAP_VTCORE_CURSOR_BAR; + t = wsap_vtcore_new(&opt); assert(t); - assert(tt_cols(t) == TERM_MAX_COLS); + assert(tt_cols(t) == WSAP_VTCORE_MAX_COLS); assert(tt_rows(t) == 1); - assert(term_cursor(t).style == TERM_CURSOR_BAR); - term_free(t); + assert(wsap_vtcore_cursor(t).style == WSAP_VTCORE_CURSOR_BAR); + wsap_vtcore_free(t); } static void test_resize_rejects_too_wide(void) { - struct term *t = tt_new(10, 3); + struct wsap_vtcore *t = tt_new(10, 3); assert(t); - assert(term_feed(t, "abc", 3, 0)); + assert(wsap_vtcore_feed(t, "abc", 3, 0)); - assert(!tt_resize(t, TERM_MAX_COLS + 1, 3)); + assert(!tt_resize(t, WSAP_VTCORE_MAX_COLS + 1, 3)); assert(tt_cols(t) == 10); assert(tt_rows(t) == 3); expect_unchanged(t, 3, 0, 'a'); @@ -133,10 +133,10 @@ static void test_resize_rejects_too_wide(void) assert(tt_cols(t) == 10); assert(tt_rows(t) == 3); - assert(tt_resize(t, TERM_MAX_COLS, 3)); - assert(tt_cols(t) == TERM_MAX_COLS); + assert(tt_resize(t, WSAP_VTCORE_MAX_COLS, 3)); + assert(tt_cols(t) == WSAP_VTCORE_MAX_COLS); assert(tt_rows(t) == 3); - term_free(t); + wsap_vtcore_free(t); } int main(void) -- cgit v1.2.3