source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Flip on -Tutf8 backend support.
@ 2011-05-20 15:48 kristaps
  2011-05-20 15:49 ` Kristaps Dzonsons
  0 siblings, 1 reply; 2+ messages in thread
From: kristaps @ 2011-05-20 15:48 UTC (permalink / raw)
  To: source

Log Message:
-----------
Flip on -Tutf8 backend support.  This forces the UTF-8 LC_CTYPE and does
little else.  Also remove the check for __STDC_ISO_10646__.  It turns
out that very few systems---even those that support it---actually
declare this and it's just causing problems instead of being useful.

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

Revision Data
-------------
Index: term.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -Lterm.h -Lterm.h -u -p -r1.84 -r1.85
--- term.h
+++ term.h
@@ -23,7 +23,8 @@ struct	termp;
 
 enum	termenc {
 	TERMENC_ASCII,
-	TERMENC_LOCALE
+	TERMENC_LOCALE,
+	TERMENC_UTF8
 };
 
 enum	termtype {
Index: term_ascii.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ascii.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lterm_ascii.c -Lterm_ascii.c -u -p -r1.16 -r1.17
--- term_ascii.c
+++ term_ascii.c
@@ -89,15 +89,19 @@ ascii_init(enum termenc enc, char *outop
 	p->letter = ascii_letter;
 	p->width = ascii_width;
 
-#if defined (USE_WCHAR)
-	if (TERMENC_LOCALE == enc)
-		if (setlocale(LC_ALL, "") && MB_CUR_MAX > 1) {
+#ifdef	USE_WCHAR
+	if (TERMENC_ASCII != enc) {
+		v = TERMENC_LOCALE == enc ?
+			setlocale(LC_ALL, "") :
+			setlocale(LC_CTYPE, "UTF-8");
+		if (NULL != v && MB_CUR_MAX > 1) {
 			p->enc = enc;
 			p->advance = locale_advance;
 			p->endline = locale_endline;
 			p->letter = locale_letter;
 			p->width = locale_width;
 		}
+	}
 #endif
 
 	toks[0] = "width";
@@ -125,6 +129,14 @@ ascii_alloc(char *outopts)
 
 	return(ascii_init(TERMENC_ASCII, outopts));
 }
+
+void *
+utf8_alloc(char *outopts)
+{
+
+	return(ascii_init(TERMENC_UTF8, outopts));
+}
+
 
 void *
 locale_alloc(char *outopts)
Index: main.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/main.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -Lmain.h -Lmain.h -u -p -r1.11 -r1.12
--- main.h
+++ main.h
@@ -42,6 +42,7 @@ void		  tree_mdoc(void *, const struct m
 void		  tree_man(void *, const struct man *);
 
 void		 *locale_alloc(char *);
+void		 *utf8_alloc(char *);
 void		 *ascii_alloc(char *);
 void		  ascii_free(void *);
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mdocml: Flip on -Tutf8 backend support.
  2011-05-20 15:48 mdocml: Flip on -Tutf8 backend support kristaps
@ 2011-05-20 15:49 ` Kristaps Dzonsons
  0 siblings, 0 replies; 2+ messages in thread
From: Kristaps Dzonsons @ 2011-05-20 15:49 UTC (permalink / raw)
  To: source

> Log Message:
> -----------
> Flip on -Tutf8 backend support.  This forces the UTF-8 LC_CTYPE and does
> little else.  Also remove the check for __STDC_ISO_10646__.  It turns
> out that very few systems---even those that support it---actually
> declare this and it's just causing problems instead of being useful.

Ignore this last part---I'd already done that before this commit.
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-20 15:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20 15:48 mdocml: Flip on -Tutf8 backend support kristaps
2011-05-20 15:49 ` Kristaps Dzonsons

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).