]> arthur.barton.de Git - netatalk.git/commitdiff
more simple hangul variable name
authorHAT <hat@fa2.so-net.ne.jp>
Thu, 6 Jan 2011 16:42:56 +0000 (01:42 +0900)
committerHAT <hat@fa2.so-net.ne.jp>
Thu, 6 Jan 2011 16:42:56 +0000 (01:42 +0900)
contrib/misc/make-precompose.h.pl
libatalk/unicode/precompose.h
libatalk/unicode/util_unistr.c

index 1700a7c8bf66538ac7256e21394f1e03138c9656..11cb8d9b41140f3d1799baa5766a990d43ae1eb0 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # usage: make-precompose.h.pl UnicodeData.txt > precompose.h
 #
-# (c) 2008-2010 by HAT <hat@fa2.so-net.ne.jp>
+# (c) 2008-2011 by HAT <hat@fa2.so-net.ne.jp>
 #
 #  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);
index da959fa07d22010f1f6a31bdc457dddcc0977fff..c925b00d74204a8792e911a43a30332134f17aca 100644 (file)
@@ -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
index 21dd156ae16cd04bc715fd3d3453a44770ddfe06..ef48f21b27841b3d2920cf19972e7c5b2e95ad18 100644 (file)
@@ -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 <L,V> */
-               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 <LV,T> */
-               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;
                        
                        /* <L,V> */
-                       if ((tjamo = HANGUL_TBASE + hangul_sindex % HANGUL_TCOUNT) == HANGUL_TBASE) {
+                       if ((tjamo = TBASE + sindex % TCOUNT) == TBASE) {
                                comb[COMBBUFLEN-1] = comb[COMBBUFLEN-2];
                                comblen = 1;
                        }