@@ -1621,7 +1621,9 @@ void build_general_category_table(FILE *f)
16211621{
16221622 int i , v , j , n , n1 ;
16231623 DynBuf dbuf_s , * dbuf = & dbuf_s ;
1624+ #ifdef DUMP_TABLE_SIZE
16241625 int cw_count , cw_len_count [4 ], cw_start ;
1626+ #endif
16251627
16261628 fprintf (f , "typedef enum {\n" );
16271629 for (i = 0 ; i < GCAT_COUNT ; i ++ )
@@ -1635,9 +1637,11 @@ void build_general_category_table(FILE *f)
16351637
16361638
16371639 dbuf_init (dbuf );
1640+ #ifdef DUMP_TABLE_SIZE
16381641 cw_count = 0 ;
16391642 for (i = 0 ; i < 4 ; i ++ )
16401643 cw_len_count [i ] = 0 ;
1644+ #endif
16411645 for (i = 0 ; i <= CHARCODE_MAX ;) {
16421646 v = unicode_db [i ].general_category ;
16431647 j = i + 1 ;
@@ -1656,9 +1660,11 @@ void build_general_category_table(FILE *f)
16561660 }
16571661 }
16581662 // printf("%05x %05x %d\n", i, n, v);
1659- cw_count ++ ;
16601663 n -- ;
1664+ #ifdef DUMP_TABLE_SIZE
1665+ cw_count ++ ;
16611666 cw_start = dbuf -> size ;
1667+ #endif
16621668 if (n < 7 ) {
16631669 dbuf_putc (dbuf , (n << 5 ) | v );
16641670 } else if (n < 7 + 128 ) {
@@ -1680,12 +1686,13 @@ void build_general_category_table(FILE *f)
16801686 dbuf_putc (dbuf , n1 >> 8 );
16811687 dbuf_putc (dbuf , n1 );
16821688 }
1689+ #ifdef DUMP_TABLE_SIZE
16831690 cw_len_count [dbuf -> size - cw_start - 1 ]++ ;
1691+ #endif
16841692 i += n + 1 ;
16851693 }
16861694#ifdef DUMP_TABLE_SIZE
1687- printf ("general category: %d entries [" ,
1688- cw_count );
1695+ printf ("general category: %d entries [" , cw_count );
16891696 for (i = 0 ; i < 4 ; i ++ )
16901697 printf (" %d" , cw_len_count [i ]);
16911698 printf (" ], length=%d bytes\n" , (int )dbuf -> size );
@@ -1700,7 +1707,9 @@ void build_script_table(FILE *f)
17001707{
17011708 int i , v , j , n , n1 , type ;
17021709 DynBuf dbuf_s , * dbuf = & dbuf_s ;
1710+ #ifdef DUMP_TABLE_SIZE
17031711 int cw_count , cw_len_count [4 ], cw_start ;
1712+ #endif
17041713
17051714 fprintf (f , "typedef enum {\n" );
17061715 for (i = 0 ; i < SCRIPT_COUNT ; i ++ )
@@ -1714,9 +1723,11 @@ void build_script_table(FILE *f)
17141723 unicode_script_short_name + i );
17151724
17161725 dbuf_init (dbuf );
1726+ #ifdef DUMP_TABLE_SIZE
17171727 cw_count = 0 ;
17181728 for (i = 0 ; i < 4 ; i ++ )
17191729 cw_len_count [i ] = 0 ;
1730+ #endif
17201731 for (i = 0 ; i <= CHARCODE_MAX ;) {
17211732 v = unicode_db [i ].script ;
17221733 j = i + 1 ;
@@ -1726,9 +1737,11 @@ void build_script_table(FILE *f)
17261737 if (v == 0 && j == (CHARCODE_MAX + 1 ))
17271738 break ;
17281739 // printf("%05x %05x %d\n", i, n, v);
1729- cw_count ++ ;
17301740 n -- ;
1741+ #ifdef DUMP_TABLE_SIZE
1742+ cw_count ++ ;
17311743 cw_start = dbuf -> size ;
1744+ #endif
17321745 if (v == 0 )
17331746 type = 0 ;
17341747 else
@@ -1750,12 +1763,13 @@ void build_script_table(FILE *f)
17501763 if (type != 0 )
17511764 dbuf_putc (dbuf , v );
17521765
1766+ #ifdef DUMP_TABLE_SIZE
17531767 cw_len_count [dbuf -> size - cw_start - 1 ]++ ;
1768+ #endif
17541769 i += n + 1 ;
17551770 }
1756- #if defined(DUMP_TABLE_SIZE )
1757- printf ("script: %d entries [" ,
1758- cw_count );
1771+ #ifdef DUMP_TABLE_SIZE
1772+ printf ("script: %d entries [" , cw_count );
17591773 for (i = 0 ; i < 4 ; i ++ )
17601774 printf (" %d" , cw_len_count [i ]);
17611775 printf (" ], length=%d bytes\n" , (int )dbuf -> size );
@@ -1770,10 +1784,11 @@ void build_script_ext_table(FILE *f)
17701784{
17711785 int i , j , n , n1 , script_ext_len ;
17721786 DynBuf dbuf_s , * dbuf = & dbuf_s ;
1773- int cw_count ;
1787+ #if defined(DUMP_TABLE_SIZE )
1788+ int cw_count = 0 ;
1789+ #endif
17741790
17751791 dbuf_init (dbuf );
1776- cw_count = 0 ;
17771792 for (i = 0 ; i <= CHARCODE_MAX ;) {
17781793 script_ext_len = unicode_db [i ].script_ext_len ;
17791794 j = i + 1 ;
@@ -1784,7 +1799,9 @@ void build_script_ext_table(FILE *f)
17841799 j ++ ;
17851800 }
17861801 n = j - i ;
1802+ #if defined(DUMP_TABLE_SIZE )
17871803 cw_count ++ ;
1804+ #endif
17881805 n -- ;
17891806 if (n < 128 ) {
17901807 dbuf_putc (dbuf , n );
@@ -1806,8 +1823,7 @@ void build_script_ext_table(FILE *f)
18061823 i += n + 1 ;
18071824 }
18081825#ifdef DUMP_TABLE_SIZE
1809- printf ("script_ext: %d entries" ,
1810- cw_count );
1826+ printf ("script_ext: %d entries" , cw_count );
18111827 printf (", length=%d bytes\n" , (int )dbuf -> size );
18121828#endif
18131829
@@ -1981,17 +1997,21 @@ void check_flags(void)
19811997
19821998void build_cc_table (FILE * f )
19831999{
1984- int i , cc , n , cc_table_len , type , n1 ;
2000+ int i , cc , n , type , n1 , block_end_pos ;
19852001 DynBuf dbuf_s , * dbuf = & dbuf_s ;
19862002 DynBuf dbuf1_s , * dbuf1 = & dbuf1_s ;
1987- int cw_len_tab [3 ], cw_start , block_end_pos ;
2003+ #if defined(DUMP_CC_TABLE ) || defined(DUMP_TABLE_SIZE )
2004+ int cw_len_tab [3 ], cw_start , cc_table_len ;
2005+ #endif
19882006 uint32_t v ;
19892007
19902008 dbuf_init (dbuf );
19912009 dbuf_init (dbuf1 );
2010+ #if defined(DUMP_CC_TABLE ) || defined(DUMP_TABLE_SIZE )
19922011 cc_table_len = 0 ;
19932012 for (i = 0 ; i < countof (cw_len_tab ); i ++ )
19942013 cw_len_tab [i ] = 0 ;
2014+ #endif
19952015 block_end_pos = CC_BLOCK_LEN ;
19962016 for (i = 0 ; i <= CHARCODE_MAX ;) {
19972017 cc = unicode_db [i ].combining_class ;
@@ -2032,7 +2052,9 @@ void build_cc_table(FILE *f)
20322052 dbuf_putc (dbuf1 , v >> 16 );
20332053 block_end_pos += CC_BLOCK_LEN ;
20342054 }
2055+ #if defined(DUMP_CC_TABLE ) || defined(DUMP_TABLE_SIZE )
20352056 cw_start = dbuf -> size ;
2057+ #endif
20362058 if (n1 < 48 ) {
20372059 dbuf_putc (dbuf , n1 | (type << 6 ));
20382060 } else if (n1 < 48 + (1 << 11 )) {
@@ -2046,10 +2068,12 @@ void build_cc_table(FILE *f)
20462068 dbuf_putc (dbuf , n1 >> 8 );
20472069 dbuf_putc (dbuf , n1 );
20482070 }
2071+ #if defined(DUMP_CC_TABLE ) || defined(DUMP_TABLE_SIZE )
20492072 cw_len_tab [dbuf -> size - cw_start - 1 ]++ ;
2073+ cc_table_len ++ ;
2074+ #endif
20502075 if (type == 0 || type == 1 )
20512076 dbuf_putc (dbuf , cc );
2052- cc_table_len ++ ;
20532077 i += n ;
20542078 }
20552079
0 commit comments