From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19975 invoked by alias); 13 Jan 2009 00:31:28 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 19949 invoked by uid 306); 13 Jan 2009 00:31:27 -0000 Date: Tue, 13 Jan 2009 00:31:00 -0000 Message-ID: <20090113003127.19934.qmail@sourceware.org> From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-charset: print some escape sequences in a prettier way X-Git-Refname: refs/heads/archer-tromey-charset X-Git-Reftype: branch X-Git-Oldrev: 9b2cc12d114246c76e7f288ca2b9e5b9eaaed27a X-Git-Newrev: 55fb85b195ef23a2ddba4e81337b32d3c2554e3e X-SW-Source: 2009-q1/txt/msg00037.txt.bz2 List-Id: 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 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.