From: K.Kosako Date: Tue, 21 Aug 2018 09:28:35 +0000 (+0900) Subject: changes for gperf 3.0.4 => 3.1 X-Git-Tag: v6.9.0~42 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=daf699ee36fe84e099e63a7e22428adf3bdd77cc;p=onig changes for gperf 3.0.4 => 3.1 --- diff --git a/src/gperf_fold_key_conv.py b/src/gperf_fold_key_conv.py index 59c5de9..376d343 100755 --- a/src/gperf_fold_key_conv.py +++ b/src/gperf_fold_key_conv.py @@ -1,16 +1,16 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # gperf_fold_key_conv.py -# Copyright (c) 2016-2017 K.Kosako +# Copyright (c) 2016-2018 K.Kosako import sys import re REG_LINE_GPERF = re.compile('#line .+gperf"') -REG_HASH_FUNC = re.compile('hash\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\s*\)') +REG_HASH_FUNC = re.compile('hash\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+size_t\s+len\s*\)') REG_STR_AT = re.compile('str\[(\d+)\]') REG_RETURN_TYPE = re.compile('^const\s+short\s+int\s*\*') -REG_FOLD_KEY = re.compile('unicode_fold(\d)_key\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\)') +REG_FOLD_KEY = re.compile('unicode_fold(\d)_key\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+size_t\s+len\)') REG_ENTRY = re.compile('\{".*?",\s*(-?\d+)\s*\}') REG_IF_LEN = re.compile('if\s*\(\s*len\s*<=\s*MAX_WORD_LENGTH.+') REG_GET_HASH = re.compile('(?:register\s+)?(?:unsigned\s+)?int\s+key\s*=\s*hash\s*\(str,\s*len\);') diff --git a/src/gperf_unfold_key_conv.py b/src/gperf_unfold_key_conv.py index 6f3ccb4..1d38bf4 100755 --- a/src/gperf_unfold_key_conv.py +++ b/src/gperf_unfold_key_conv.py @@ -1,15 +1,15 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # gperf_unfold_key_conv.py -# Copyright (c) 2016-2017 K.Kosako +# Copyright (c) 2016-2018 K.Kosako import sys import re REG_LINE_GPERF = re.compile('#line .+gperf"') -REG_HASH_FUNC = re.compile('hash\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\s*\)') +REG_HASH_FUNC = re.compile('hash\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+size_t\s+len\s*\)') REG_STR_AT = re.compile('str\[(\d+)\]') -REG_UNFOLD_KEY = re.compile('unicode_unfold_key\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\)') +REG_UNFOLD_KEY = re.compile('unicode_unfold_key\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+size_t\s+len\)') REG_ENTRY = re.compile('\{".+?",\s*/\*(.+?)\*/\s*(-?\d+),\s*(\d)\}') REG_EMPTY_ENTRY = re.compile('\{"",\s*(-?\d+),\s*(\d)\}') REG_IF_LEN = re.compile('if\s*\(\s*len\s*<=\s*MAX_WORD_LENGTH.+') diff --git a/src/make_unicode_fold.sh b/src/make_unicode_fold.sh index ddf1dd4..d92077c 100755 --- a/src/make_unicode_fold.sh +++ b/src/make_unicode_fold.sh @@ -1,22 +1,29 @@ #!/bin/sh -TMP=gperf.tmp +GPERF=/usr/bin/gperf + +TMP0=gperf0.tmp +TMP1=gperf1.tmp +TMP2=gperf2.tmp +TMP3=gperf3.tmp + GPERF_OPT='-n -C -T -c -t -j1 -L ANSI-C ' ./make_unicode_fold_data.py > unicode_fold_data.c -gperf ${GPERF_OPT} -F,-1,0 -N unicode_unfold_key unicode_unfold_key.gperf > ${TMP} -./gperf_unfold_key_conv.py < ${TMP} > unicode_unfold_key.c +${GPERF} ${GPERF_OPT} -F,-1,0 -N unicode_unfold_key unicode_unfold_key.gperf > ${TMP0} +./gperf_unfold_key_conv.py < ${TMP0} > unicode_unfold_key.c -gperf ${GPERF_OPT} -F,-1 -N unicode_fold1_key unicode_fold1_key.gperf > ${TMP} -./gperf_fold_key_conv.py 1 < ${TMP} > unicode_fold1_key.c +${GPERF} ${GPERF_OPT} -F,-1 -N unicode_fold1_key unicode_fold1_key.gperf > ${TMP1} +./gperf_fold_key_conv.py 1 < ${TMP1} > unicode_fold1_key.c -gperf ${GPERF_OPT} -F,-1 -N unicode_fold2_key unicode_fold2_key.gperf > ${TMP} -./gperf_fold_key_conv.py 2 < ${TMP} > unicode_fold2_key.c +${GPERF} ${GPERF_OPT} -F,-1 -N unicode_fold2_key unicode_fold2_key.gperf > ${TMP2} +./gperf_fold_key_conv.py 2 < ${TMP2} > unicode_fold2_key.c -gperf ${GPERF_OPT} -F,-1 -N unicode_fold3_key unicode_fold3_key.gperf > ${TMP} -./gperf_fold_key_conv.py 3 < ${TMP} > unicode_fold3_key.c +${GPERF} ${GPERF_OPT} -F,-1 -N unicode_fold3_key unicode_fold3_key.gperf > ${TMP3} +./gperf_fold_key_conv.py 3 < ${TMP3} > unicode_fold3_key.c -rm -f ${TMP} +rm -f ${TMP0} ${TMP1} ${TMP2} ${TMP3} +rm -f unicode_unfold_key.gperf unicode_fold1_key.gperf unicode_fold2_key.gperf unicode_fold3_key.gperf exit 0 diff --git a/src/make_unicode_property.sh b/src/make_unicode_property.sh index 1e57674..206b8cf 100755 --- a/src/make_unicode_property.sh +++ b/src/make_unicode_property.sh @@ -1,19 +1,21 @@ #!/bin/sh NAME=unicode_property_data -TMP=gperf.tmp -#GPERF_OPT='-P -Q prop_name_pool -C -c -t -j1 -L ANSI-C --ignore-case' +TMP1=gperf1.tmp +TMP2=gperf2.tmp +GPERF=/usr/bin/gperf + GPERF_OPT='-T -C -c -t -j1 -L ANSI-C --ignore-case --pic -Q unicode_prop_name_pool' -POOL_CAST='s/\(int *\)\(long *\)&\(\(struct +unicode_prop_name_pool_t *\* *\) *0\)->unicode_prop_name_pool_str([^,]+)/pool_offset(\1)/g' +POOL_CAST='s/\(int *\)\(size_t *\)&\(\(struct +unicode_prop_name_pool_t *\* *\) *0\)->unicode_prop_name_pool_str([^,]+)/pool_offset(\1)/g' ./make_unicode_property_data.py > ${NAME}.gperf ./make_unicode_property_data.py -posix > ${NAME}_posix.gperf -gperf ${GPERF_OPT} -N unicode_lookup_property_name --output-file ${TMP} ${NAME}.gperf -sed -e 's/^#line.*$//g' ${TMP} | sed -r "${POOL_CAST}" > ${NAME}.c -gperf ${GPERF_OPT} -N unicode_lookup_property_name --output-file ${TMP} ${NAME}_posix.gperf -sed -e 's/^#line.*$//g' ${TMP} | sed -r "${POOL_CAST}" > ${NAME}_posix.c +${GPERF} ${GPERF_OPT} -N unicode_lookup_property_name --output-file ${TMP1} ${NAME}.gperf +sed -e 's/^#line.*$//g' ${TMP1} | sed -r "${POOL_CAST}" > ${NAME}.c +${GPERF} ${GPERF_OPT} -N unicode_lookup_property_name --output-file ${TMP2} ${NAME}_posix.gperf +sed -e 's/^#line.*$//g' ${TMP2} | sed -r "${POOL_CAST}" > ${NAME}_posix.c -rm -f ${NAME}.gperf ${NAME}_posix.gperf ${TMP} +rm -f ${NAME}.gperf ${NAME}_posix.gperf ${TMP1} ${TMP2} exit 0 diff --git a/src/regenc.h b/src/regenc.h index ae7a774..31c6c6a 100644 --- a/src/regenc.h +++ b/src/regenc.h @@ -160,7 +160,7 @@ extern int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UCh extern int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype)); extern struct PropertyNameCtype* euc_jp_lookup_property_name P_((register const char *str, register unsigned int len)); extern struct PropertyNameCtype* sjis_lookup_property_name P_((register const char *str, register unsigned int len)); -/* extern const struct PropertyNameCtype* unicode_lookup_property_name P_((register const char *str, register unsigned int len)); */ +/* extern const struct PropertyNameCtype* unicode_lookup_property_name P_((register const char *str, register size_t len)); */ /* in enc/unicode.c */ extern int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype));