diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 13:04:01 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 13:04:01 +0300 |
| commit | dcebf9c7f954a55350b68d0ead1935612c4e2e05 (patch) | |
| tree | 3eb3e9f6154c6760bcb89a565f8ddc8f8b66cb90 /benchmarks/term_resize_bench.c | |
| parent | bd8222e615134c3ec5e7a07b6b1fa97c9bd4a471 (diff) | |
Rename the library to wsap_vtcore
ncurses installs <term.h> 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 <wsap_vtcore/wsap_vtcore.h>. 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 <noreply@anthropic.com>
Diffstat (limited to 'benchmarks/term_resize_bench.c')
| -rw-r--r-- | benchmarks/term_resize_bench.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/benchmarks/term_resize_bench.c b/benchmarks/term_resize_bench.c index 08634d1..2899dae 100644 --- a/benchmarks/term_resize_bench.c +++ b/benchmarks/term_resize_bench.c @@ -1,4 +1,4 @@ -#include "term/term.h" +#include "wsap_vtcore/wsap_vtcore.h" #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -34,7 +34,7 @@ static int cmp_double(const void *a, const void *b) enum content { SHORT, WRAPPED, MIXED, PROMPT, WIDE, CONTENT_COUNT }; static const char *content_names[] = {"short", "wrapped", "mixed", "prompt", "wide"}; -static void emit_line(struct term *t, enum content kind, int n, int cols) +static void emit_line(struct wsap_vtcore *t, enum content kind, int n, int cols) { char line[4096]; int len = 0; @@ -74,12 +74,12 @@ static void emit_line(struct term *t, enum content kind, int n, int cols) break; } (void)cols; - term_feed(t, line, (size_t)len, 0); + wsap_vtcore_feed(t, line, (size_t)len, 0); } -static struct term *make_filled(enum content kind, int cols, int rows, int history) +static struct wsap_vtcore *make_filled(enum content kind, int cols, int rows, int history) { - struct term *t = term_new(&(struct term_options){ + struct wsap_vtcore *t = wsap_vtcore_new(&(struct wsap_vtcore_options){ .size = { .x = cols, .y = rows }, .scrollback = history, }); @@ -89,10 +89,10 @@ static struct term *make_filled(enum content kind, int cols, int rows, int histo return t; } -static void resize(struct term *t, int cols, int rows) +static void resize(struct wsap_vtcore *t, int cols, int rows) { - if (!term_resize(t, (struct term_vector2i){ .x = cols, .y = rows })) { - fprintf(stderr, "term_resize failed: out of memory\n"); + if (!wsap_vtcore_resize(t, (struct wsap_vtcore_vector2i){ .x = cols, .y = rows })) { + fprintf(stderr, "wsap_vtcore_resize failed: out of memory\n"); exit(EXIT_FAILURE); } } @@ -113,12 +113,12 @@ static double bench_pair(enum content kind, int from_cols, int to_cols, int rows { double worst = 0; for (int i = 0; i < samples; i++) { - struct term *t = make_filled(kind, from_cols, rows, history); + struct wsap_vtcore *t = make_filled(kind, from_cols, rows, history); if (!t) exit(EXIT_FAILURE); double start = now(); resize(t, to_cols, rows); double ms = (now() - start) * 1e3; - term_free(t); + wsap_vtcore_free(t); out[i] = ms; if (ms > worst) worst = ms; } @@ -132,14 +132,14 @@ static int bench_drag(enum content kind, int from_cols, int to_cols, int rows, int n = 0; int step = from_cols > to_cols ? -1 : 1; for (int p = 0; p < passes; p++) { - struct term *t = make_filled(kind, from_cols, rows, history); + struct wsap_vtcore *t = make_filled(kind, from_cols, rows, history); if (!t) exit(EXIT_FAILURE); for (int c = from_cols + step; c != to_cols + step; c += step) { double start = now(); resize(t, c, rows); out[n++] = (now() - start) * 1e3; } - term_free(t); + wsap_vtcore_free(t); } return n; } |
