public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-charset: print some escape sequences in a prettier way
@ 2009-01-13  0:31 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2009-01-13  0:31 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-charset has been updated
       via  55fb85b195ef23a2ddba4e81337b32d3c2554e3e (commit)
      from  9b2cc12d114246c76e7f288ca2b9e5b9eaaed27a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 55fb85b195ef23a2ddba4e81337b32d3c2554e3e
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Jan 12 17:30:47 2009 -0700

    print some escape sequences in a prettier way

-----------------------------------------------------------------------

Summary of changes:
 gdb/c-lang.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

First 500 lines of diff:
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index f3da24b..4612ede 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -171,6 +171,9 @@ print_wchar (wchar_t w, mbstate_t *state, struct obstack *output,
       reset_state (output, state);
       switch (w)
 	{
+	case L'\0':
+	  obstack_grow_str (output, quoter == '"' ? "\\000" : "\\0");
+	  break;
 	case L'\a':
 	  obstack_grow_str (output, "\\a");
 	  break;
@@ -199,8 +202,13 @@ print_wchar (wchar_t w, mbstate_t *state, struct obstack *output,
 	       character set.  */
 #ifdef __STDC_ISO_10646__
 	    char buf[20];
-	    /* We print all 8 digits to avoid any possible ambiguity.  */
-	    sprintf (buf, "\\U%08lx", (long) w);
+	    /* We print all the digits to avoid any possible
+	       ambiguity.  Also, we try to prefer the \u form because
+	       it is easier on the eyes.  */
+	    if (w < 65536)
+	      sprintf (buf, "\\u%04lx", (long) w);
+	    else
+	      sprintf (buf, "\\U%08lx", (long) w);
 	    obstack_grow_str (output, buf);
 #else
 #error "Not yet ported where __STDC_ISO_10646__ is not defined."


hooks/post-receive
--
Repository for Project Archer.


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

only message in thread, other threads:[~2009-01-13  0:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-13  0:31 [SCM] archer-tromey-charset: print some escape sequences in a prettier way tromey

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 read-only IMAP folder(s) and NNTP newsgroup(s).