| 1 | #!/bin/sh |
| 2 | |
| 3 | # Convert name2ctype.kwd to name2ctype.h using GNU gperf. |
| 4 | # |
| 5 | # Usage: |
| 6 | # convert-name2ctype.sh name2ctype.kwd > name2ctype.h |
| 7 | |
| 8 | NAME2CTYPE_OPTIONS='-7 -c -j1 -i1 -t -C -P -T -H uniname2ctype_hash -Q uniname2ctype_pool -N uniname2ctype_p' |
| 9 | |
| 10 | # undef USE_UNICODE_PROPERTIES |
| 11 | sed '/^#ifdef USE_UNICODE_PROPERTIES/,/^#endif \/\* USE_UNICODE_PROPERTIES \*\//d' $1 | gperf ${NAME2CTYPE_OPTIONS} > name2ctype-1.h |
| 12 | # define USE_UNICODE_PROPERTIES |
| 13 | sed '/^\(#ifdef USE_UNICODE_PROPERTIES\|#endif \/\* USE_UNICODE_PROPERTIES \*\/\)/d' $1 > name2ctype-2.h |
| 14 | # undef USE_UNICODE_AGE_PROPERTIES |
| 15 | sed '/^#ifdef USE_UNICODE_AGE_PROPERTIES/,/^#endif \/\* USE_UNICODE_AGE_PROPERTIES \*\//d' name2ctype-2.h | gperf ${NAME2CTYPE_OPTIONS} > name2ctype-3.h |
| 16 | # define USE_UNICODE_AGE_PROPERTIES |
| 17 | sed '/^\(#ifdef USE_UNICODE_AGE_PROPERTIES\|#endif \/\* USE_UNICODE_AGE_PROPERTIES \*\/\)/d' name2ctype-2.h | gperf ${NAME2CTYPE_OPTIONS} > name2ctype-4.h |
| 18 | # merge them |
| 19 | diff -DUSE_UNICODE_AGE_PROPERTIES name2ctype-3.h name2ctype-4.h > name2ctype-2.h |
| 20 | diff -DUSE_UNICODE_PROPERTIES name2ctype-1.h name2ctype-2.h |
| 21 | rm name2ctype-?.h |