Remove CELL_WIDEASIAN_MASK from docs #1277

This commit is contained in:
nick black 2021-01-03 17:53:34 -05:00 committed by Nick Black
parent a229d64703
commit 0c38728ceb
2 changed files with 15 additions and 14 deletions

View File

@ -1647,7 +1647,6 @@ typedef struct nccell {
uint64_t channels; // + 8B == 16B uint64_t channels; // + 8B == 16B
} nccell; } nccell;
#define CELL_WIDEASIAN_MASK 0x8000000000000000ull
#define CELL_BGDEFAULT_MASK 0x0000000040000000ull #define CELL_BGDEFAULT_MASK 0x0000000040000000ull
#define CELL_FGDEFAULT_MASK (CELL_BGDEFAULT_MASK << 32u) #define CELL_FGDEFAULT_MASK (CELL_BGDEFAULT_MASK << 32u)
#define CELL_BG_RGB_MASK 0x0000000000ffffffull #define CELL_BG_RGB_MASK 0x0000000000ffffffull
@ -1762,28 +1761,31 @@ cell_off_styles(nccell* c, unsigned stylebits){
c->stylemask &= ~(stylebits & NCSTYLE_MASK); c->stylemask &= ~(stylebits & NCSTYLE_MASK);
} }
// does the cell contain an East Asian Wide codepoint? // Is the cell part of a multicolumn element?
static inline bool static inline bool
cell_double_wide_p(const nccell* c){ cell_double_wide_p(const nccell* c){
return (c->channels & CELL_WIDEASIAN_MASK); return (c->width >= 2);
} }
// Load a 7-bit char 'ch' into the cell 'c'. // Load a 7-bit char 'ch' into the nccell 'c'. Returns the number of bytes
// used, or -1 on error.
static inline int static inline int
cell_load_char(struct ncplane* n, nccell* c, char ch){ cell_load_char(struct ncplane* n, nccell* c, char ch){
cell_release(n, c); char gcluster[2];
c->channels &= ~(CELL_WIDEASIAN_MASK | CELL_NOBACKGROUND_MASK); gcluster[0] = ch;
c->gcluster = ch; gcluster[1] = '\0';
return 1; return cell_load(n, c, gcluster);
} }
// Load a UTF-8 encoded EGC of up to 4 bytes into the cell 'c'. // Load a UTF-8 encoded EGC of up to 4 bytes into the nccell 'c'. Returns the
// number of bytes used, or -1 on error.
static inline int static inline int
cell_load_egc32(struct ncplane* n, nccell* c, uint32_t egc){ cell_load_egc32(struct ncplane* n, nccell* c, uint32_t egc){
cell_release(n, c); char gcluster[sizeof(egc) + 1];
c->channels &= ~(CELL_WIDEASIAN_MASK | CELL_NOBACKGROUND_MASK); egc = htole(egc);
c->gcluster = htole(egc); memcpy(gcluster, &egc, sizeof(egc));
return 1; gcluster[4] = '\0';
return cell_load(n, c, gcluster);
} }
// return a pointer to the NUL-terminated EGC referenced by 'c'. this pointer // return a pointer to the NUL-terminated EGC referenced by 'c'. this pointer

View File

@ -27,7 +27,6 @@ typedef struct nccell {
#define CELL_INITIALIZER(c, s, chan) \ #define CELL_INITIALIZER(c, s, chan) \
{ .gcluster = (c), .stylemask = (s), .channels = (chan), } { .gcluster = (c), .stylemask = (s), .channels = (chan), }
#define CELL_WIDEASIAN_MASK 0x8000000080000000ull
#define CELL_BGDEFAULT_MASK 0x0000000040000000ull #define CELL_BGDEFAULT_MASK 0x0000000040000000ull
#define CELL_FGDEFAULT_MASK (CELL_BGDEFAULT_MASK << 32u) #define CELL_FGDEFAULT_MASK (CELL_BGDEFAULT_MASK << 32u)
#define CELL_BG_RGB_MASK 0x0000000000ffffffull #define CELL_BG_RGB_MASK 0x0000000000ffffffull