diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 13:04:32 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 13:04:32 +0300 |
| commit | bdaedce69b17b654bd0060579dd9b9ff120009b5 (patch) | |
| tree | 0e9cd8597652263a96c48ba678fb0b66e1fc131b /src/hist.h | |
| parent | ba75c8b0a1bba03ad92c53375432f122ddb4cb98 (diff) | |
| parent | dcebf9c7f954a55350b68d0ead1935612c4e2e05 (diff) | |
Merge branch 'wt/rename' into api-hardening
# Conflicts:
# README.md
Diffstat (limited to 'src/hist.h')
| -rw-r--r-- | src/hist.h | 70 |
1 files changed, 35 insertions, 35 deletions
@@ -92,7 +92,7 @@ struct text_row { #define TEXT_ROW_RUNS(cols) (((size_t)(cols) + 2) * 22) /* Emit the pending run in the general form. */ -void term_hist_runs_emit_slow(struct hist_runs *r); +void wsap_vtcore_hist_runs_emit_slow(struct hist_runs *r); /* Close the pending run and start one with the given pen. The caller * sized the buffer. A run that changes only colors and covers fewer than @@ -102,7 +102,7 @@ static inline void hist_runs_switch(struct hist_runs *r, struct text_pen pen) { if (r->count) { uint32_t psl = pen_sl(&r->pen); - if (TERM_EXPECT(r->count < 0x80 && psl == pen_sl(&r->base), 1)) { + if (WSAP_VTCORE_EXPECT(r->count < 0x80 && psl == pen_sl(&r->base), 1)) { uint8_t *p = r->data + r->len; uint32_t dfg = r->pen.fg != r->base.fg, dbg = r->pen.bg != r->base.bg; p[0] = (uint8_t)(dfg | dbg << 1); @@ -112,7 +112,7 @@ static inline void hist_runs_switch(struct hist_runs *r, struct text_pen pen) memcpy(p, &r->pen.bg, 4); r->len = (uint32_t)(p + dbg * 4 - r->data); } else { - term_hist_runs_emit_slow(r); + wsap_vtcore_hist_runs_emit_slow(r); } pen_set(&r->base, r->pen.fg, r->pen.bg, psl); } @@ -160,8 +160,8 @@ static inline void text_row_unshare(struct text_row *row) } /* Write the cells of a text row to out; return the cell count. */ -int term_hist_text_decode(const struct text_row *row, struct cell *out, int cap, struct gstore *g); -void term_hist_text_mark_links(const struct text_row *row, void (*mark)(void *ud, uint16_t link), void *ud); +int wsap_vtcore_hist_text_decode(const struct text_row *row, struct cell *out, int cap, struct gstore *g); +void wsap_vtcore_hist_text_mark_links(const struct text_row *row, void (*mark)(void *ud, uint16_t link), void *ud); struct hist_dec_cache { const uint8_t *p, *end; @@ -225,34 +225,34 @@ static inline uint32_t rows_narrow(uint64_t cells, int cols) (uint32_t)((cells + (uint64_t)cols - 1) / (uint64_t)cols); } -bool term_hist_init(struct hist *h, int line_limit, size_t byte_cap); -void term_hist_free(struct hist *h); -void term_hist_clear(struct hist *h); +bool wsap_vtcore_hist_init(struct hist *h, int line_limit, size_t byte_cap); +void wsap_vtcore_hist_free(struct hist *h); +void wsap_vtcore_hist_clear(struct hist *h); /* Push one screen row. It joins the open line, or starts a new line. A * wrapped row leaves the line open for the next row. */ -void term_hist_push_row(struct hist *h, const struct cell *cells, int len, bool wrapped, +void wsap_vtcore_hist_push_row(struct hist *h, const struct cell *cells, int len, bool wrapped, const struct gstore *g); -void term_hist_push_ascii(struct hist *h, const char *bytes, int n, +void wsap_vtcore_hist_push_ascii(struct hist *h, const char *bytes, int n, const struct pen_attr *pen, bool wrapped); -void term_hist_push_ascii_lines(struct hist *h, const struct hist_ascii_line *lines, +void wsap_vtcore_hist_push_ascii_lines(struct hist *h, const struct hist_ascii_line *lines, int count, const struct pen_attr *pen); /* Ends include LF. ends[0] is the start of the first line. */ -void term_hist_push_ascii_lf(struct hist *h, const char *bytes, const uint16_t *ends, int count); -/* Push a text row as one screen row, like term_hist_push_row(). */ -void term_hist_push_text(struct hist *h, const struct text_row *row, bool wrapped); +void wsap_vtcore_hist_push_ascii_lf(struct hist *h, const char *bytes, const uint16_t *ends, int count); +/* Push a text row as one screen row, like wsap_vtcore_hist_push_row(). */ +void wsap_vtcore_hist_push_text(struct hist *h, const struct text_row *row, bool wrapped); /* Push n empty unwrapped rows. The first one closes an open line. */ -void term_hist_push_blank(struct hist *h, size_t n); -void term_hist_close_open_line(struct hist *h); +void wsap_vtcore_hist_push_blank(struct hist *h, size_t n); +void wsap_vtcore_hist_close_open_line(struct hist *h); /* Remove the last line. Write its cells to out (at most cap) and return the * number of cells in the line. */ -int term_hist_pop_line(struct hist *h, struct cell *out, int cap, struct gstore *g); -/* Copy the last line's cells to out, as term_hist_pop_line() does, and keep the line. +int wsap_vtcore_hist_pop_line(struct hist *h, struct cell *out, int cap, struct gstore *g); +/* Copy the last line's cells to out, as wsap_vtcore_hist_pop_line() does, and keep the line. * Return the number of cells in the line. */ -int term_hist_peek_last_line(const struct hist *h, struct cell *out, int cap, struct gstore *g); +int wsap_vtcore_hist_peek_last_line(const struct hist *h, struct cell *out, int cap, struct gstore *g); /* Take up to n cells back off the end of the last line. Return the count. */ -int term_hist_pop_tail_cells(struct hist *h, int n, struct cell *out, struct gstore *g); +int wsap_vtcore_hist_pop_tail_cells(struct hist *h, int n, struct cell *out, struct gstore *g); static inline uint64_t hist_first_id(const struct hist *h) { @@ -269,29 +269,29 @@ static inline bool hist_is_open(const struct hist *h) return h->head != h->tail && (h->ring[(h->head - 1) & h->ring_mask].flags & HLINE_OPEN); } -uint64_t term_hist_line_cells(const struct hist *h, uint64_t id); -uint64_t term_hist_line_wide(const struct hist *h, uint64_t id); -uint8_t term_hist_line_flags(const struct hist *h, uint64_t id); -int term_hist_line_rows(const struct hist *h, uint64_t id, int cols); -int term_hist_decode_segment(const struct hist *h, uint64_t id, int seg, int cols, +uint64_t wsap_vtcore_hist_line_cells(const struct hist *h, uint64_t id); +uint64_t wsap_vtcore_hist_line_wide(const struct hist *h, uint64_t id); +uint8_t wsap_vtcore_hist_line_flags(const struct hist *h, uint64_t id); +int wsap_vtcore_hist_line_rows(const struct hist *h, uint64_t id, int cols); +int wsap_vtcore_hist_decode_segment(const struct hist *h, uint64_t id, int seg, int cols, struct cell *out, struct gstore *g); -int term_hist_decode_segments(const struct hist *h, uint64_t id, int start_seg, int count, int cols, +int wsap_vtcore_hist_decode_segments(const struct hist *h, uint64_t id, int start_seg, int count, int cols, struct cell *out, int *lens, struct gstore *g); -uint64_t term_hist_segment_cell(const struct hist *h, uint64_t id, int seg, int cols); -int term_hist_cell_segment(const struct hist *h, uint64_t id, uint64_t cell, int cols); +uint64_t wsap_vtcore_hist_segment_cell(const struct hist *h, uint64_t id, int seg, int cols); +int wsap_vtcore_hist_cell_segment(const struct hist *h, uint64_t id, uint64_t cell, int cols); -void term_hist_mark_links(const struct hist *h, void (*mark)(void *ud, uint16_t link), void *ud); +void wsap_vtcore_hist_mark_links(const struct hist *h, void (*mark)(void *ud, uint16_t link), void *ud); /* Set the width that pushed rows have. It costs O(1): the stored row counts * become stale. Reads count them without changing the history. */ -void term_hist_set_width(struct hist *h, int cols); +void wsap_vtcore_hist_set_width(struct hist *h, int cols); /* Rows of all retained lines at cols. */ -uint64_t term_hist_rows(const struct hist *h, int cols); -uint64_t term_hist_line_estimate(const struct hist *h, uint64_t id, int cols); -uint64_t term_hist_estimated_rows(const struct hist *h, int cols); -void term_hist_prepare_rows(struct hist *h, int cols); -void term_hist_refine_rows(struct hist *h, uint64_t id, int cols, int rows); +uint64_t wsap_vtcore_hist_rows(const struct hist *h, int cols); +uint64_t wsap_vtcore_hist_line_estimate(const struct hist *h, uint64_t id, int cols); +uint64_t wsap_vtcore_hist_estimated_rows(const struct hist *h, int cols); +void wsap_vtcore_hist_prepare_rows(struct hist *h, int cols); +void wsap_vtcore_hist_refine_rows(struct hist *h, uint64_t id, int cols, int rows); #endif |
