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 --- benchmarks/term_write_bench.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'benchmarks/term_write_bench.c') diff --git a/benchmarks/term_write_bench.c b/benchmarks/term_write_bench.c index 7649ed8..f393b4c 100644 --- a/benchmarks/term_write_bench.c +++ b/benchmarks/term_write_bench.c @@ -1,4 +1,4 @@ -#include "term/term.h" +#include "wsap_vtcore/wsap_vtcore.h" #include #include #include @@ -20,13 +20,13 @@ static int cmp_double(const void *a, const void *b) /* Timed sample: iterations full-buffer writes split at raw byte offsets, so a * chunk smaller than len cuts UTF-8/CSI sequences mid-stream and exercises the * parser's save-and-resume path, like real PTY reads do. */ -static double run_sample(struct term *t, const char *buf, size_t len, +static double run_sample(struct wsap_vtcore *t, const char *buf, size_t len, size_t chunk, int iterations, unsigned flags) { double start = now(); for (int i = 0; i < iterations; i++) { for (size_t pos = 0; pos < len; pos += chunk) - term_feed(t, buf + pos, len - pos < chunk ? len - pos : chunk, flags); + wsap_vtcore_feed(t, buf + pos, len - pos < chunk ? len - pos : chunk, flags); } return now() - start; } @@ -146,25 +146,25 @@ int main(int argc, char **argv) } for (int k = 0; k < nchunks; k++) { size_t ck = chunks[k]; - const char *env_cols = getenv("TERM_COLS"); + const char *env_cols = getenv("WSAP_VTCORE_COLS"); int cols_val = env_cols ? atoi(env_cols) : 120; - struct term *t = term_new(&(struct term_options){ + struct wsap_vtcore *t = wsap_vtcore_new(&(struct wsap_vtcore_options){ .size = { .x = cols_val, .y = 40 }, .scrollback = BENCH_SCROLLBACK, }); if (!t) { - fprintf(stderr, "term_new failed: TERM_COLS must be 0 to %d\n", TERM_MAX_COLS); + fprintf(stderr, "wsap_vtcore_new failed: WSAP_VTCORE_COLS must be 0 to %d\n", WSAP_VTCORE_MAX_COLS); return EXIT_FAILURE; } /* manyline has bare LFs: each one also returns the cursor to * column 0, as a tty with ONLCR does. */ - unsigned flags = !strcmp(cases[c].name, "manyline") ? TERM_FEED_ONLCR : 0; + unsigned flags = !strcmp(cases[c].name, "manyline") ? WSAP_VTCORE_FEED_ONLCR : 0; if (!strncmp(cases[c].name, "margin-", 7)) { const char setup[] = "\033[5;36r\033[36;1H"; - term_feed(t, setup, sizeof(setup) - 1, 0); + wsap_vtcore_feed(t, setup, sizeof(setup) - 1, 0); } else if (strstr(cases[c].name, "-burst")) { const char setup[] = "\033[40;1H"; - term_feed(t, setup, sizeof(setup) - 1, 0); + wsap_vtcore_feed(t, setup, sizeof(setup) - 1, 0); } /* Untimed warmup reaches steady-state scroll so rep 1 isn't a * cold outlier. */ @@ -179,7 +179,7 @@ int main(int argc, char **argv) printf("%-9s %6zu %10.2f %10.2f %10.2f %8.3f\n", cases[c].name, ck, med, min, max, samples[reps / 2] * 1e9 / bytes); - term_free(t); + wsap_vtcore_free(t); } } if (!matched) fprintf(stderr, "unknown benchmark case: %s\n", argv[1]); -- cgit v1.2.3