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 /src/text_run.h | |
| 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 'src/text_run.h')
| -rw-r--r-- | src/text_run.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/text_run.h b/src/text_run.h index 3ff432b..630c1c7 100644 --- a/src/text_run.h +++ b/src/text_run.h @@ -1,5 +1,5 @@ -#ifndef TERM_TEXT_RUN_H -#define TERM_TEXT_RUN_H +#ifndef WSAP_VTCORE_TEXT_RUN_H +#define WSAP_VTCORE_TEXT_RUN_H #include "cell.h" #include "unicode/unicode.h" @@ -10,19 +10,19 @@ #define UTF8_LEAD3_TAG 0xE0 #define UTF8_LEAD3_MASK 0xF0 -#define TERM_WIDTH_SLOTS 4 +#define WSAP_VTCORE_WIDTH_SLOTS 4 struct width_cache { - uint32_t lo[TERM_WIDTH_SLOTS]; - uint32_t span[TERM_WIDTH_SLOTS]; + uint32_t lo[WSAP_VTCORE_WIDTH_SLOTS]; + uint32_t span[WSAP_VTCORE_WIDTH_SLOTS]; uint8_t klass; uint8_t next; }; -/* term_new() builds the shared tables before any terminal can use them. */ -bool term_tables_ready(void); -void term_text_tables_init(void); +/* wsap_vtcore_new() builds the shared tables before any terminal can use them. */ +bool wsap_vtcore_tables_ready(void); +void wsap_vtcore_text_tables_init(void); -int term_text_class(uint32_t cp); +int wsap_vtcore_text_class(uint32_t cp); struct text_run_result { int bytes; @@ -30,7 +30,7 @@ struct text_run_result { uint32_t last; }; -struct text_run_result term_text_run(struct cell *restrict row, const char *restrict buf, +struct text_run_result wsap_vtcore_text_run(struct cell *restrict row, const char *restrict buf, int len, int max_cols, uint32_t fg, uint32_t bg, uint32_t flags, uint32_t last, struct width_cache *restrict wc); @@ -43,35 +43,35 @@ struct text_run_bytes { bool wide, narrow; /* narrow: every character was one ASCII byte */ }; -/* term_text_run() with the same rules, that writes the text in the history +/* wsap_vtcore_text_run() with the same rules, that writes the text in the history * format instead of cells: raw UTF-8, a wide character after 0xF5. dst has * room for 4 bytes per column. */ -struct text_run_bytes term_text_run_bytes(uint8_t *restrict dst, const char *restrict buf, int len, +struct text_run_bytes wsap_vtcore_text_run_bytes(uint8_t *restrict dst, const char *restrict buf, int len, int max_cols, uint32_t last, struct width_cache *restrict wc); static inline bool joins_cluster(uint32_t cp, int klass) { if (cp < 0x0300) return false; - if (klass == 0 || term_grapheme_emoji_modifier(cp)) + if (klass == 0 || wsap_vtcore_grapheme_emoji_modifier(cp)) return true; - return klass == 1 && term_unicode_spacing_mark(cp); + return klass == 1 && wsap_vtcore_unicode_spacing_mark(cp); } static inline bool can_extend_cluster(uint32_t last_char, uint32_t cp, int klass) { if (klass == 0) return true; - if (last_char == 0x200D || term_grapheme_is_handle(last_char)) return true; - if (cp - 0x1F1E6u <= 0x19u && term_grapheme_regional_indicator(cp)) + if (last_char == 0x200D || wsap_vtcore_grapheme_is_handle(last_char)) return true; + if (cp - 0x1F1E6u <= 0x19u && wsap_vtcore_grapheme_regional_indicator(cp)) return true; return joins_cluster(cp, klass); } static inline bool cluster_contextual(uint32_t cp) { - return term_unicode_spacing_mark(cp) || term_grapheme_emoji_modifier(cp) || - (cp - 0x1F1E6u <= 0x19u && term_grapheme_regional_indicator(cp)); + return wsap_vtcore_unicode_spacing_mark(cp) || wsap_vtcore_grapheme_emoji_modifier(cp) || + (cp - 0x1F1E6u <= 0x19u && wsap_vtcore_grapheme_regional_indicator(cp)); } static inline bool cluster_joins(const uint32_t *cps, int len, @@ -80,10 +80,10 @@ static inline bool cluster_joins(const uint32_t *cps, int len, if (joins_cluster(cp, klass)) return true; if (cps[len - 1] == 0x200D) - return term_unicode_extended_pictographic(cp); + return wsap_vtcore_unicode_extended_pictographic(cp); return len == 1 && cp - 0x1F1E6u <= 0x19u && - term_grapheme_regional_indicator(cp) && - term_grapheme_regional_indicator(cps[0]); + wsap_vtcore_grapheme_regional_indicator(cp) && + wsap_vtcore_grapheme_regional_indicator(cps[0]); } #endif |
