1111# 2) '.bas' file extension is dropped
1212# 3) hyphen '-' characters in directory/filename are replaced
1313# with underscore '_'
14- # 4) if the directory.filename conflicts wity a keyword, i.e. compile error,
14+ # 4) if the directory.filename conflicts with a fbc keyword, i.e. compile error,
1515# an underscore '_' suffix is added
1616#
1717
@@ -26,9 +26,10 @@ usage () {
2626 echo " temporary files ${tmpfile} ?.lst will be created"
2727 echo " results are output to stdout"
2828 echo " clean clean-up temporary files (if script aborted)"
29+ echo " list-utf list all unicode encoded files based on git"
2930 echo
3031 echo " exit code:"
31- echo " 0 = no mismatches found"
32+ echo " 0 = suite names match dir/file - no mismatches found"
3233 echo " 1 = mismatches found"
3334 echo
3435 exit 1
@@ -43,6 +44,9 @@ do_check () {
4344 # search for *.bas files containing SUITE lines (ignore case)
4445 # output from grep expected to be './dir/file.bas:line:SUITE( fbc_tests.dir.file)'
4546 # note that the pattern contains a literal tab character
47+
48+ # !!!FIXME!!! - grep does not search the utf encoded file
49+
4650 grep -i -r -n --include=* .bas --exclude-dir=fbcunit -e ' ^[ ]*SUITE.*(.*).*$' . > ${tmpfile} 1.lst
4751
4852 # extract dir/file and dir.file from previous output
@@ -76,10 +80,26 @@ do_check () {
7680 exit ${return_val}
7781}
7882
83+ do_list_utf () {
84+ # search the current git repo and list all files that appear to be unicode
85+ #
86+ # git diff `git hash-object -t tree /dev/null` --numstat origin/master -- '*.bas' '*.bi' | grep '^\-'
87+ #
88+ # `git hash-object -t tree /dev/null`
89+ # this is a known object name, so we can just write it out
90+ # windows has trouble with the /dev/null in a script (but not from the shell prompt)
91+ emptytree=4b825dc642cb6eb9a060e54bf8d69288fbee4904
92+
93+ git diff $emptytree HEAD --numstat -- ' *.bas' ' *.bi' | grep ' ^\-'
94+ }
95+
7996case " $1 " in
8097check)
8198 do_check
8299 ;;
100+ list-utf)
101+ do_list_utf
102+ ;;
83103clean)
84104 do_clean
85105 exit 0
0 commit comments