From 27e6e84ca19b6def0c7cf97aedcfde6020007ad8 Mon Sep 17 00:00:00 2001 From: HAT Date: Fri, 7 Jan 2011 01:42:56 +0900 Subject: [PATCH] more simple hangul variable name --- contrib/misc/make-precompose.h.pl | 20 ++++++++++---------- libatalk/unicode/precompose.h | 18 +++++++++--------- libatalk/unicode/util_unistr.c | 30 +++++++++++++++--------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/contrib/misc/make-precompose.h.pl b/contrib/misc/make-precompose.h.pl index 1700a7c8..11cb8d9b 100755 --- a/contrib/misc/make-precompose.h.pl +++ b/contrib/misc/make-precompose.h.pl @@ -2,7 +2,7 @@ # # usage: make-precompose.h.pl UnicodeData.txt > precompose.h # -# (c) 2008-2010 by HAT +# (c) 2008-2011 by HAT # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -187,15 +187,15 @@ printf ("\/\* %s is got from \*\/\n", $ARGV print ("\/\* http\:\/\/www.unicode.org\/Public\/UNIDATA\/UnicodeData.txt \*\/\n"); print ("\n"); -print ("\#define HANGUL_SBASE 0xAC00\n"); -print ("\#define HANGUL_LBASE 0x1100\n"); -print ("\#define HANGUL_VBASE 0x1161\n"); -print ("\#define HANGUL_TBASE 0x11A7\n"); -print ("\#define HANGUL_LCOUNT 19\n"); -print ("\#define HANGUL_VCOUNT 21\n"); -print ("\#define HANGUL_TCOUNT 28\n"); -print ("\#define HANGUL_NCOUNT 588 \/\* (HANGUL_VCOUNT \* HANGUL_TCOUNT) \*\/\n"); -print ("\#define HANGUL_SCOUNT 11172 \/\* (HANGUL_LCOUNT \* HANGUL_NCOUNT) \*\/\n"); +print ("\#define SBASE 0xAC00\n"); +print ("\#define LBASE 0x1100\n"); +print ("\#define VBASE 0x1161\n"); +print ("\#define TBASE 0x11A7\n"); +print ("\#define LCOUNT 19\n"); +print ("\#define VCOUNT 21\n"); +print ("\#define TCOUNT 28\n"); +print ("\#define NCOUNT 588 \/\* (VCOUNT \* TCOUNT) \*\/\n"); +print ("\#define SCOUNT 11172 \/\* (LCOUNT \* NCOUNT) \*\/\n"); print ("\n"); printf ("\#define PRECOMP_COUNT %d\n", $comp_count); diff --git a/libatalk/unicode/precompose.h b/libatalk/unicode/precompose.h index da959fa0..c925b00d 100644 --- a/libatalk/unicode/precompose.h +++ b/libatalk/unicode/precompose.h @@ -5,15 +5,15 @@ /* UnicodeData.txt is got from */ /* http://www.unicode.org/Public/UNIDATA/UnicodeData.txt */ -#define HANGUL_SBASE 0xAC00 -#define HANGUL_LBASE 0x1100 -#define HANGUL_VBASE 0x1161 -#define HANGUL_TBASE 0x11A7 -#define HANGUL_LCOUNT 19 -#define HANGUL_VCOUNT 21 -#define HANGUL_TCOUNT 28 -#define HANGUL_NCOUNT 588 /* (HANGUL_VCOUNT * HANGUL_TCOUNT) */ -#define HANGUL_SCOUNT 11172 /* (HANGUL_LCOUNT * HANGUL_NCOUNT) */ +#define SBASE 0xAC00 +#define LBASE 0x1100 +#define VBASE 0x1161 +#define TBASE 0x11A7 +#define LCOUNT 19 +#define VCOUNT 21 +#define TCOUNT 28 +#define NCOUNT 588 /* (VCOUNT * TCOUNT) */ +#define SCOUNT 11172 /* (LCOUNT * NCOUNT) */ #define PRECOMP_COUNT 955 #define DECOMP_COUNT 955 diff --git a/libatalk/unicode/util_unistr.c b/libatalk/unicode/util_unistr.c index 21dd156a..ef48f21b 100644 --- a/libatalk/unicode/util_unistr.c +++ b/libatalk/unicode/util_unistr.c @@ -449,7 +449,7 @@ size_t precompose_w (ucs2_t *name, size_t inplen, ucs2_t *comp, size_t *outlen) ucs2_t base, comb; u_int32_t base_sp, comb_sp; ucs2_t *in, *out; - ucs2_t hangul_lindex, hangul_vindex; + ucs2_t lindex, vindex; ucs2_t result; u_int32_t result_sp; size_t o_len = *outlen; @@ -482,20 +482,20 @@ size_t precompose_w (ucs2_t *name, size_t inplen, ucs2_t *comp, size_t *outlen) /* Unicode Standard Annex #15 A10.3 Hangul Composition */ /* Step 1 */ - else if ((HANGUL_VBASE <= comb) && (comb <= HANGUL_VBASE + HANGUL_VCOUNT)) { - if ((HANGUL_LBASE <= base) && (base < HANGUL_LBASE + HANGUL_LCOUNT)) { + else if ((VBASE <= comb) && (comb <= VBASE + VCOUNT)) { + if ((LBASE <= base) && (base < LBASE + LCOUNT)) { result = 1; - hangul_lindex = base - HANGUL_LBASE; - hangul_vindex = comb - HANGUL_VBASE; - base = HANGUL_SBASE + (hangul_lindex * HANGUL_VCOUNT + hangul_vindex) * HANGUL_TCOUNT; + lindex = base - LBASE; + vindex = comb - VBASE; + base = SBASE + (lindex * VCOUNT + vindex) * TCOUNT; } } /* Step 2 */ - else if ((HANGUL_TBASE < comb) && (comb < HANGUL_TBASE + HANGUL_TCOUNT)) { - if ((HANGUL_SBASE <= base) && (base < HANGUL_SBASE +HANGUL_SCOUNT) && (((base - HANGUL_SBASE) % HANGUL_TCOUNT) == 0)) { + else if ((TBASE < comb) && (comb < TBASE + TCOUNT)) { + if ((SBASE <= base) && (base < SBASE + SCOUNT) && (((base - SBASE) % TCOUNT) == 0)) { result = 1; - base += comb - HANGUL_TBASE; + base += comb - TBASE; } } @@ -557,7 +557,7 @@ size_t decompose_w (ucs2_t *name, size_t inplen, ucs2_t *comp, size_t *outlen) size_t comblen; ucs2_t base, comb[COMBBUFLEN]; u_int32_t base_sp; - ucs2_t hangul_sindex, tjamo; + ucs2_t sindex, tjamo; ucs2_t *in, *out; unsigned int result; u_int64_t result_sp; @@ -577,13 +577,13 @@ size_t decompose_w (ucs2_t *name, size_t inplen, ucs2_t *comp, size_t *outlen) if (base <= 0x007f) ; /* Unicode Standard Annex #15 A10.2 Hangul Decomposition */ - else if ((HANGUL_SBASE <= base) && (base < HANGUL_SBASE + HANGUL_SCOUNT)) { - hangul_sindex = base - HANGUL_SBASE; - base = HANGUL_LBASE + hangul_sindex / HANGUL_NCOUNT; - comb[COMBBUFLEN-2] = HANGUL_VBASE + (hangul_sindex % HANGUL_NCOUNT) / HANGUL_TCOUNT; + else if ((SBASE <= base) && (base < SBASE + SCOUNT)) { + sindex = base - SBASE; + base = LBASE + sindex / NCOUNT; + comb[COMBBUFLEN-2] = VBASE + (sindex % NCOUNT) / TCOUNT; /* */ - if ((tjamo = HANGUL_TBASE + hangul_sindex % HANGUL_TCOUNT) == HANGUL_TBASE) { + if ((tjamo = TBASE + sindex % TCOUNT) == TBASE) { comb[COMBBUFLEN-1] = comb[COMBBUFLEN-2]; comblen = 1; } -- 2.39.2