From c4b5d8a0192a406d9f04a23e2c8a768a29e01371 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 14 Mar 2009 12:35:02 +0000 Subject: Added colour styles (not being used) to struct termp. Added nroff style-escape encoding. Removed ANSI schema string tables (there's only ANSI and nroff/backspace). Pushed styling directly into pword (simpler). --- term.h | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'term.h') diff --git a/term.h b/term.h index 15cb73f3..92ea07a0 100644 --- a/term.h +++ b/term.h @@ -70,12 +70,9 @@ enum tsym { TERMSYM_MAX = 41 }; - -enum tstyle { - TERMSTYLE_CLEAR = 0, - TERMSTYLE_BOLD = 1, - TERMSTYLE_UNDER = 2, - TERMSTYLE_MAX = 3 +enum termenc { + TERMENC_ANSI, + TERMENC_NROFF }; struct termsym { @@ -90,18 +87,26 @@ struct termp { size_t offset; size_t col; int flags; -#define TERMP_BOLD (1 << 0) /* Embolden words. */ -#define TERMP_UNDERLINE (1 << 1) /* Underline words. */ -#define TERMP_NOSPACE (1 << 2) /* No space before words. */ -#define TERMP_NOLPAD (1 << 3) /* No leftpad before flush. */ -#define TERMP_NOBREAK (1 << 4) /* No break after flush. */ -#define TERMP_LITERAL (1 << 5) /* Literal words. */ -#define TERMP_IGNDELIM (1 << 6) /* Delims like regulars. */ -#define TERMP_NONOSPACE (1 << 7) /* No space (no autounset). */ -#define TERMP_NONOBREAK (1 << 8) +#define TERMP_NOSPACE (1 << 0) /* No space before words. */ +#define TERMP_NOLPAD (1 << 1) /* No leftpad before flush. */ +#define TERMP_NOBREAK (1 << 2) /* No break after flush. */ +#define TERMP_LITERAL (1 << 3) /* Literal words. */ +#define TERMP_IGNDELIM (1 << 4) /* Delims like regulars. */ +#define TERMP_NONOSPACE (1 << 5) /* No space (no autounset). */ +#define TERMP_NONOBREAK (1 << 7) /* Don't newln NOBREAK. */ + +#define TERMP_STYLE 0xff00 /* Style mask. */ +#define TERMP_BOLD (1 << 8) /* Styles... */ +#define TERMP_UNDER (1 << 9) +#define TERMP_BLUE (1 << 10) +#define TERMP_RED (1 << 11) +#define TERMP_YELLOW (1 << 12) +#define TERMP_MAGENTA (1 << 13) +#define TERMP_CYAN (1 << 14) +#define TERMP_GREEN (1 << 15) char *buf; struct termsym *symtab; /* Special-symbol table. */ - struct termsym *styletab; /* Style table. */ + enum termenc enc; /* Encoding. */ }; struct termpair { -- cgit