Skip to content

Commit 39bc0d1

Browse files
committed
Update instructions to update Unicode standard.
1 parent 5e6912b commit 39bc0d1

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed

MAINTAINING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
The test suite uses files included in the UCD. These files should be
66
synchronized with the version of unicode supported by `unicode-data`.
77

8-
`download-ucd-files.sh` downloads the required test files. Replace the `VERSION`
9-
with the current version supported by `unicode-data` and run this from the root
10-
of the project.
8+
`ucd.sh` downloads the required test files and generates corresponding code.
9+
Replace the `VERSION` with the current version supported by `unicode-data` and
10+
run the following from the root of the project:
1111

1212
```
13-
$ ./download-ucd-files.sh
13+
$ ./ucd.sh clean && ./ucd.sh download && ./ucd generate
1414
```
1515

1616
Additionally check for the unicode version in the documentation and make sure it

ucd.sh

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ FILES="\
1414
DerivedNormalizationProps.txt:ucd:b2c444c20730b097787fdf50bd7d6dd3fc5256ab8084f5b35b11c8776eca674c \
1515
NormalizationTest.txt:test/data:7cb30cc2abe6c29c292b99095865d379ce1213045c78c4ff59c7e9391bbe2331"
1616

17+
delete_file() {
18+
local pair=$1
19+
local file=$(echo $pair | cut -f1 -d':')
20+
local destination="$(echo $pair | cut -f2 -d':')/$file"
21+
rm "$destination"
22+
}
23+
24+
# Remove previous downloaded files
25+
delete_files() {
26+
for pair in $FILES
27+
do
28+
delete_file "$pair"
29+
done
30+
}
31+
1732
# Download the files
1833

1934
# Download $file from https://www.unicode.org/Public/$VERSION/$file
@@ -28,7 +43,7 @@ download_file() {
2843

2944
if test ! -e "$destination"
3045
then
31-
wget -P `dirname "$destination"` "https://www.unicode.org/Public/$VERSION/ucd/$file"
46+
wget -P `dirname "$destination"` "https://www.unicode.org/Public/$VERSION/ucd/$file"
3247
fi
3348
if test -n "$VERIFY_CHECKSUM"
3449
then
@@ -52,26 +67,27 @@ download_files() {
5267
done
5368
}
5469

70+
# Generate the Haskell files.
71+
run_generator() {
72+
# Compile and run ucd2haskell
73+
cabal run --flag ucd2haskell ucd2haskell -- \
74+
--input ./ucd/ \
75+
--output ./
76+
}
77+
5578
# Print help text
5679
print_help() {
5780
echo "Usage: ucd.sh <command>"
5881
echo
5982
echo "Available commands:"
83+
echo " clean: delete downloaded files"
6084
echo " download: downloads the text files required"
6185
echo " generate: generate the haskell files from the downloaded text files"
6286
echo
6387
echo "Example:"
6488
echo "$ ./ucd.sh download && ./ucd.sh generate"
6589
}
6690

67-
# Generate the Haskell files.
68-
run_generator() {
69-
# Compile and run ucd2haskell
70-
cabal run --flag ucd2haskell ucd2haskell -- \
71-
--input ./ucd/ \
72-
--output ./
73-
}
74-
7591
# Main program
7692

7793
# Export the version so it can be used by the executable
@@ -80,6 +96,7 @@ export UNICODE_VERSION="$VERSION"
8096
# Parse command line
8197
case $1 in
8298
-h|--help) print_help;;
99+
clean) delete_files;;
83100
download) download_files;;
84101
generate) run_generator;;
85102
*) echo "Unknown argument"; print_help;;

0 commit comments

Comments
 (0)