source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: In -Tascii mode, print "<?>" only for Unicode escapes of unknown
@ 2014-10-28 18:49 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-10-28 18:49 UTC (permalink / raw)
  To: source

Log Message:
-----------
In -Tascii mode, print "<?>" only for Unicode escapes of unknown
representation, not for character escapes with unknown names.
According to groff, the latter produce no output, and we now warn 
about them.

Modified Files:
--------------
    mdocml:
        term.c
        term_ascii.c

Revision Data
-------------
Index: term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v
retrieving revision 1.231
retrieving revision 1.232
diff -Lterm.c -Lterm.c -u -p -r1.231 -r1.232
--- term.c
+++ term.c
@@ -458,9 +458,7 @@ term_word(struct termp *p, const char *w
 			if (p->enc == TERMENC_ASCII) {
 				cp = mchars_spec2str(p->symtab,
 				    seq, sz, &ssz);
-				if (cp == NULL)
-					encode(p, "<?>", 3);
-				else
+				if (cp != NULL)
 					encode(p, cp, ssz);
 			} else {
 				uc = mchars_spec2cp(p->symtab, seq, sz);
@@ -690,14 +688,10 @@ term_strlen(const struct termp *p, const
 					sz += cond_width(p, c, &skip);
 				break;
 			case ESCAPE_SPECIAL:
-				if (p->enc == TERMENC_ASCII) {
+				if (p->enc == TERMENC_ASCII)
 					rhs = mchars_spec2str(p->symtab,
 					    seq, ssz, &rsz);
-					if (rhs == NULL) {
-						rhs = "<?>";
-						rsz = 3;
-					}
-				} else {
+				else {
 					c = mchars_spec2cp(p->symtab,
 					    seq, ssz);
 					if (c > 0)
Index: term_ascii.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ascii.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -Lterm_ascii.c -Lterm_ascii.c -u -p -r1.38 -r1.39
--- term_ascii.c
+++ term_ascii.c
@@ -19,6 +19,7 @@
 
 #include <sys/types.h>
 
+#include <assert.h>
 #if HAVE_WCHAR
 #include <locale.h>
 #endif
@@ -337,8 +338,7 @@ ascii_uc2str(int uc)
 	"j",	"DZ",	"Dz",	"dz",	"'\bG",	"'\bg",	"HV",	"W",
 	"`\bN",	"`\bn",	"A",	"a",	"'\bAE","'\bae","O",	"o"};
 
-	if (uc < 0)
-		return("<?>");
+	assert(uc >= 0);
 	if ((size_t)uc < sizeof(tab)/sizeof(tab[0]))
 		return(tab[uc]);
 	return(mchars_uc2str(uc));
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-28 18:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-28 18:49 mdocml: In -Tascii mode, print "<?>" only for Unicode escapes of unknown schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).