summaryrefslogtreecommitdiff
path: root/src/pen.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pen.h')
-rw-r--r--src/pen.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/pen.h b/src/pen.h
index f84d6e3..947b875 100644
--- a/src/pen.h
+++ b/src/pen.h
@@ -2,12 +2,12 @@
#define WSAP_TERM_PEN_H
#include "compat.h"
-#include "term.h"
+#include "wsap_vtcore.h"
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
-struct term_pen {
+struct wsap_vtcore_pen {
uint32_t fg;
uint32_t bg;
uint32_t ul;
@@ -71,12 +71,12 @@ static inline void pen_set_text(struct pen_attr *p, struct text_pen pen)
static inline struct pen_attr pen_attr_default(void)
{
- return (struct pen_attr){ .fg = TERM_COLOR_FG, .bg = TERM_COLOR_BG };
+ return (struct pen_attr){ .fg = WSAP_VTCORE_COLOR_FG, .bg = WSAP_VTCORE_COLOR_BG };
}
static inline bool pen_attr_is_default(const struct pen_attr *a)
{
- return a->fg == TERM_COLOR_FG && a->bg == TERM_COLOR_BG && a->flags == 0 && a->link == 0;
+ return a->fg == WSAP_VTCORE_COLOR_FG && a->bg == WSAP_VTCORE_COLOR_BG && a->flags == 0 && a->link == 0;
}
static inline bool pen_attr_equal(const struct pen_attr *a, const struct pen_attr *b)
@@ -84,15 +84,15 @@ static inline bool pen_attr_equal(const struct pen_attr *a, const struct pen_att
return a->fg == b->fg && a->bg == b->bg && a->flags == b->flags && a->link == b->link;
}
-static inline uint32_t term_rgb(int r, int g, int b)
+static inline uint32_t wsap_vtcore_rgb(int r, int g, int b)
{
- return term_color_rgb((uint8_t)r, (uint8_t)g, (uint8_t)b);
+ return wsap_vtcore_color_rgb((uint8_t)r, (uint8_t)g, (uint8_t)b);
}
-static inline void pen_reset(struct term_pen *p)
+static inline void pen_reset(struct wsap_vtcore_pen *p)
{
- p->fg = TERM_COLOR_FG;
- p->bg = TERM_COLOR_BG;
+ p->fg = WSAP_VTCORE_COLOR_FG;
+ p->bg = WSAP_VTCORE_COLOR_BG;
p->ul = 0;
p->underline = 0;
p->bold = false;
@@ -112,7 +112,7 @@ static inline int sgr_extended_color(const int *params, int nparams, uint16_t su
if (i + 2 < nparams && params[i + 1] == 5) {
int index = params[i + 2];
if (index >= 0 && index <= 255) {
- *color = term_color_index(index);
+ *color = wsap_vtcore_color_index(index);
*assigned = true;
}
return 2;
@@ -123,7 +123,7 @@ static inline int sgr_extended_color(const int *params, int nparams, uint16_t su
int k = i + 2;
if (k < 16 && k < nparams) {
uint32_t shifted = (~(uint32_t)subparams) >> k;
- colon = term_ctz32(shifted);
+ colon = wsap_vtcore_ctz32(shifted);
int max_colon = (nparams < 16 ? nparams : 16) - k;
if (colon > max_colon)
colon = max_colon;
@@ -131,27 +131,27 @@ static inline int sgr_extended_color(const int *params, int nparams, uint16_t su
int skip = colon >= 4 ? 1 : 0;
if (i + 4 + skip >= nparams)
return 0;
- *color = term_rgb(params[i + 2 + skip], params[i + 3 + skip], params[i + 4 + skip]);
+ *color = wsap_vtcore_rgb(params[i + 2 + skip], params[i + 3 + skip], params[i + 4 + skip]);
*assigned = true;
return 4 + skip;
}
-static inline bool pen_set_standard_color(struct term_pen *p, int code)
+static inline bool pen_set_standard_color(struct wsap_vtcore_pen *p, int code)
{
if ((unsigned)(code - 30) < 8)
- p->fg = term_color_index(code - 30);
+ p->fg = wsap_vtcore_color_index(code - 30);
else if ((unsigned)(code - 40) < 8)
- p->bg = term_color_index(code - 40);
+ p->bg = wsap_vtcore_color_index(code - 40);
else if ((unsigned)(code - 90) < 8)
- p->fg = term_color_index(code - 90 + 8);
+ p->fg = wsap_vtcore_color_index(code - 90 + 8);
else if ((unsigned)(code - 100) < 8)
- p->bg = term_color_index(code - 100 + 8);
+ p->bg = wsap_vtcore_color_index(code - 100 + 8);
else
return false;
return true;
}
-static inline void sgr_apply(struct term_pen *pen, const int *params, int nparams, uint16_t subparams)
+static inline void sgr_apply(struct wsap_vtcore_pen *pen, const int *params, int nparams, uint16_t subparams)
{
if (nparams == 0) {
pen_reset(pen);
@@ -185,14 +185,14 @@ static inline void sgr_apply(struct term_pen *pen, const int *params, int nparam
if (ok) pen->fg = c;
break;
}
- case 39: pen->fg = TERM_COLOR_FG; break;
+ case 39: pen->fg = WSAP_VTCORE_COLOR_FG; break;
case 48: {
uint32_t c; bool ok;
i += sgr_extended_color(params, nparams, subparams, i, &c, &ok);
if (ok) pen->bg = c;
break;
}
- case 49: pen->bg = TERM_COLOR_BG; break;
+ case 49: pen->bg = WSAP_VTCORE_COLOR_BG; break;
case 53: pen->overline = true; break;
case 55: pen->overline = false; break;
case 58: {