git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Beat Bolli <dev+git@drbeat.li>
To: git@vger.kernel.org
Cc: Beat Bolli <dev+git@drbeat.li>
Subject: [PATCH 3/3] update_unicode.sh: restore hexadecimal output
Date: Mon, 12 Dec 2016 00:34:25 +0100	[thread overview]
Message-ID: <1481499265-18361-3-git-send-email-dev+git@drbeat.li> (raw)
In-Reply-To: <1481499265-18361-1-git-send-email-dev+git@drbeat.li>

The uniset upstream has decided that decimal numbers are The True Way, so
let's convert them back to the usual format that's closer to the U+nnnn
standard.

The generated unicode_widths.h file again looks exactly the same as two
commits ago.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
---
 update_unicode.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/update_unicode.sh b/update_unicode.sh
index e595bf8..d7720d5 100755
--- a/update_unicode.sh
+++ b/update_unicode.sh
@@ -5,6 +5,12 @@
 #Mn Nonspacing_Mark a nonspacing combining mark (zero advance width)
 #Cf Format          a format control character
 #
+
+dec_to_hex() {
+	# convert any decimal numbers to 4-digit hex
+	perl -pe 's/(\d+)/sprintf("0x%04X", $1)/ge'
+}
+
 UNICODEWIDTH_H=../unicode_width.h
 if ! test -d unicode; then
 	mkdir unicode
@@ -29,7 +35,7 @@ fi &&
 		make
 	) &&
 	UNICODE_DIR=. && export UNICODE_DIR &&
-	cat >$UNICODEWIDTH_H <<-EOF
+	dec_to_hex >$UNICODEWIDTH_H <<-EOF
 	static const struct interval zero_width[] = {
 		$(uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD)
 	};
-- 
2.7.2

  parent reply	other threads:[~2016-12-11 23:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-11 23:34 [PATCH 1/3] update_unicode.sh: update the uniset repo if it exists Beat Bolli
2016-12-11 23:34 ` [PATCH 2/3] update_unicode.sh: remove the plane filters Beat Bolli
2016-12-11 23:34 ` Beat Bolli [this message]
2016-12-12  5:53 ` [PATCH 1/3] update_unicode.sh: update the uniset repo if it exists Torsten Bögershausen
2016-12-12  8:54   ` Beat Bolli
2016-12-12 18:12     ` Torsten Bögershausen
2016-12-12 18:33       ` Junio C Hamano
2016-12-12 23:50         ` Beat Bolli
2016-12-13  6:16           ` Torsten Bögershausen
2016-12-13  6:42             ` Junio C Hamano
2016-12-12 19:24       ` Beat Bolli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481499265-18361-3-git-send-email-dev+git@drbeat.li \
    --to=dev+git@drbeat.li \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).