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/isa.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/isa.c') diff --git a/src/isa.c b/src/isa.c index 1fe1517..cf40358 100644 --- a/src/isa.c +++ b/src/isa.c @@ -3,19 +3,19 @@ * the first terminal exists, so every call in a process uses the same * kernels. */ -#include "term.h" +#include "wsap_vtcore.h" #include "simd.h" #include #include #include -int term_isa_level; +int wsap_vtcore_isa_level; static atomic_int isa_state; static const char *const level_names[] = { "base", "avx2", "avx512" }; -#if defined(TERM_ISA_RUNTIME) +#if defined(WSAP_VTCORE_ISA_RUNTIME) /* The AVX-512 kernels also need VBMI and VBMI2. Every CPU with VBMI except * Cannon Lake has VBMI2. */ static int cpu_level(void) @@ -23,56 +23,56 @@ static int cpu_level(void) __builtin_cpu_init(); if (__builtin_cpu_supports("x86-64-v4") && __builtin_cpu_supports("avx512vbmi") && __builtin_cpu_supports("avx512vbmi2")) - return TERM_ISA_AVX512; + return WSAP_VTCORE_ISA_AVX512; if (__builtin_cpu_supports("x86-64-v3")) - return TERM_ISA_AVX2; - return TERM_ISA_BASE; + return WSAP_VTCORE_ISA_AVX2; + return WSAP_VTCORE_ISA_BASE; } #else static int cpu_level(void) { - return TERM_ISA_FLOOR; + return WSAP_VTCORE_ISA_FLOOR; } #endif static int pick_level(void) { int level = cpu_level(); - /* TERM_HEADLESS_ISA can only lower the level, never below the floor the + /* WSAP_VTCORE_ISA can only lower the level, never below the floor the * compiler flags fix. */ - const char *want = getenv("TERM_HEADLESS_ISA"); - for (int i = TERM_ISA_FLOOR; want && i < level; i++) + const char *want = getenv("WSAP_VTCORE_ISA"); + for (int i = WSAP_VTCORE_ISA_FLOOR; want && i < level; i++) if (!strcmp(want, level_names[i])) level = i; return level; } /* The first caller picks the level. A second caller waits until it is set. */ -void term_isa_init(void) +void wsap_vtcore_isa_init(void) { if (atomic_load_explicit(&isa_state, memory_order_acquire) == 2) return; int expected = 0; if (atomic_compare_exchange_strong(&isa_state, &expected, 1)) { - term_isa_level = pick_level(); + wsap_vtcore_isa_level = pick_level(); atomic_store_explicit(&isa_state, 2, memory_order_release); return; } while (atomic_load_explicit(&isa_state, memory_order_acquire) != 2) - term_cpu_relax(); + wsap_vtcore_cpu_relax(); } -const char *term_isa(void) +const char *wsap_vtcore_isa(void) { - term_isa_init(); + wsap_vtcore_isa_init(); #if defined(__aarch64__) return "neon"; #else - int level = TERM_ISA_FLOOR; - if (term_use_avx2()) - level = TERM_ISA_AVX2; - if (term_use_avx512()) - level = TERM_ISA_AVX512; + int level = WSAP_VTCORE_ISA_FLOOR; + if (wsap_vtcore_use_avx2()) + level = WSAP_VTCORE_ISA_AVX2; + if (wsap_vtcore_use_avx512()) + level = WSAP_VTCORE_ISA_AVX512; return level_names[level]; #endif } -- cgit v1.2.3