summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-15 10:34:11 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-15 10:34:11 +0000
commit042ce71e8ac383a838b36f19731e5504a34b95c9 (patch)
tree602076cda7e90c1ce4dad333f82b542428a2307c
parent51e09adba1d4a035fa482100a46581226b5d660f (diff)
downloadmandoc-VERSION_1_5_1.tar.gz
mandoc-VERSION_1_5_1.tar.zst
mandoc-VERSION_1_5_1.zip
Backed out all ANSI code.VERSION_1_5_1
-rw-r--r--mdocterm.18
-rw-r--r--mdocterm.c63
-rw-r--r--term.h16
3 files changed, 11 insertions, 76 deletions
diff --git a/mdocterm.1 b/mdocterm.1
index 96206bff..8e2dcb3c 100644
--- a/mdocterm.1
+++ b/mdocterm.1
@@ -1,4 +1,4 @@
-.\" $Id: mdocterm.1,v 1.21 2009/03/15 07:08:52 kristaps Exp $
+.\" $Id: mdocterm.1,v 1.22 2009/03/15 10:34:11 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -60,7 +60,7 @@ Override default compiler behaviour. See
for details.
.\" ITEM
.It Fl O Ns Ar option...
-Terminal-encoding options. See
+Front-end options. See
.Sx Front-end Options
for details.
.\" ITEM
@@ -139,8 +139,6 @@ Don't punt to
if
.Ar infile
may not be parsed.
-.It Fl O Ns Ar ansi
-Use ANSI/VT100 output encoding instead of backspaces.
.El
.\" SUB-SECTION
.Ss Compiler Options
@@ -296,7 +294,7 @@ Special symbols:
the more general syntax.
.\" SECTION
.Sh EXAMPLES
-To display this manual page on ANSI-capable terminal:
+To display this manual page:
.\" PARAGRAPH
.Pp
.D1 % mdocterm \-Wall,error mdocterm.1
diff --git a/mdocterm.c b/mdocterm.c
index 9c95f9ea..cb7756ea 100644
--- a/mdocterm.c
+++ b/mdocterm.c
@@ -1,4 +1,4 @@
-/* $Id: mdocterm.c,v 1.44 2009/03/15 07:18:10 kristaps Exp $ */
+/* $Id: mdocterm.c,v 1.45 2009/03/15 10:34:11 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -203,7 +203,6 @@ main(int argc, char *argv[])
termp.offset = termp.col = 0;
termp.flags = TERMP_NOSPACE;
termp.symtab = termsym_ascii;
- termp.enc = TERMENC_NROFF;
nroff.termp = &termp;
@@ -247,14 +246,11 @@ static int
optsopt(struct termp *p, char *arg)
{
char *v;
- char *toks[] = { "ansi", "nopunt", NULL };
+ char *toks[] = { "nopunt", NULL };
while (*arg)
switch (getsubopt(&arg, toks, &v)) {
case (0):
- p->enc = TERMENC_ANSI;
- break;
- case (1):
p->iflags |= TERMP_NOPUNT;
break;
default:
@@ -378,17 +374,11 @@ flushln(struct termp *p)
/* LINTED */
for (j = i, vsz = 0; j < p->col; j++) {
- if (isspace((u_char)p->buf[j])) {
+ if (isspace((u_char)p->buf[j]))
break;
- } else if (27 == p->buf[j]) {
- assert(TERMENC_ANSI == p->enc);
- assert(j + 5 <= p->col);
- j += 4;
- } else if (8 == p->buf[j]) {
- assert(TERMENC_NROFF == p->enc);
- assert(j + 2 <= p->col);
+ else if (8 == p->buf[j])
j += 1;
- } else
+ else
vsz++;
}
@@ -858,49 +848,13 @@ pword(struct termp *p, const char *word, size_t len)
* before the word.
*/
- if (TERMENC_ANSI == p->enc && TERMP_STYLE & p->flags) {
- if (TERMP_BOLD & p->flags) {
- chara(p, 27);
- stringa(p, "[01m", 4);
- }
- if (TERMP_UNDER & p->flags) {
- chara(p, 27);
- stringa(p, "[04m", 4);
- }
- if (TERMP_RED & p->flags) {
- chara(p, 27);
- stringa(p, "[31m", 4);
- }
- if (TERMP_GREEN & p->flags) {
- chara(p, 27);
- stringa(p, "[32m", 4);
- }
- if (TERMP_YELLOW & p->flags) {
- chara(p, 27);
- stringa(p, "[33m", 4);
- }
- if (TERMP_BLUE & p->flags) {
- chara(p, 27);
- stringa(p, "[34m", 4);
- }
- if (TERMP_MAGENTA & p->flags) {
- chara(p, 27);
- stringa(p, "[35m", 4);
- }
- if (TERMP_CYAN & p->flags) {
- chara(p, 27);
- stringa(p, "[36m", 4);
- }
- }
-
for (i = 0; i < len; i++) {
if ('\\' == word[i]) {
pescape(p, word, &i, len);
continue;
}
- if (TERMENC_NROFF == p->enc &&
- TERMP_STYLE & p->flags) {
+ if (TERMP_STYLE & p->flags) {
if (TERMP_BOLD & p->flags) {
chara(p, word[i]);
chara(p, 8);
@@ -913,11 +867,6 @@ pword(struct termp *p, const char *word, size_t len)
chara(p, word[i]);
}
-
- if (TERMENC_ANSI == p->enc && TERMP_STYLE & p->flags) {
- chara(p, 27);
- stringa(p, "[00m", 4);
- }
}
diff --git a/term.h b/term.h
index 3d36398c..92993942 100644
--- a/term.h
+++ b/term.h
@@ -1,4 +1,4 @@
-/* $Id: term.h,v 1.23 2009/03/15 07:08:53 kristaps Exp $ */
+/* $Id: term.h,v 1.24 2009/03/15 10:34:11 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -70,11 +70,6 @@ enum tsym {
TERMSYM_MAX = 41
};
-enum termenc {
- TERMENC_ANSI,
- TERMENC_NROFF
-};
-
struct termsym {
const char *sym;
size_t sz;
@@ -96,18 +91,11 @@ struct termp {
#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_STYLE 0x0300 /* 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. */
- enum termenc enc; /* Encoding. */
};
struct termpair {