caseclash.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #! /bin/sh
  2. # This file tried to list instances of symbols where there could be conflict
  3. # as between inconsistent capitalization. So if there is a symbol "camelCase"
  4. # and another "CamelCase", or is "x" is used in one place and "X" in another
  5. # this will be reported.
  6. # Names using in strings or comments (or within the "#Word;" notation for
  7. # named unicode characters) are not considered. Special (but approximate)
  8. # parsing is used to separate names used as types in the syntax as introduced
  9. # by the "assert" package.
  10. # This script can be run from anywhere. It creates three files in whatever
  11. # directory is currenty when it is launched:
  12. # caseclash.files list of Reduce source file it will scan
  13. # caseclash.log log file probably only relevant on failure
  14. # caseclash.list main output file reporting clashes.
  15. # If the script is given an argument "redlog" is just scans files in the
  16. # packages/redlog part of the Reduce tree. Special provision is made for
  17. # redlog both because it is a large and important sub-part of Reduce and
  18. # because it makes significant use of assert-style annotations.
  19. #
  20. # If any other argument is given than the script assumes that caseclash.files
  21. # already exists and scans the files listed in it. An anticipated use case
  22. # is
  23. # scripts/caseclash.sh
  24. # (observe clashes, scan files to understand)
  25. # (identify some files where work on them is to be deferred, and edit the
  26. # file caseclash.files to remove reference to them)
  27. # scripts/caseclash.sh some_argument
  28. # This looks for clashes in the files you did not decide to defer so it is
  29. # possible to tidy up the feasible parts of the system first and just come
  30. # back to the hard bits later on.
  31. here="$0";while test -L "$here";do here=`ls -ld "$here" | sed 's/.*-> //'`;done
  32. here=`dirname "$here"`
  33. here=`cd "$here"; pwd -P`
  34. here=`dirname "$here"`
  35. dir=""
  36. if test "x$1" = "xredlog"
  37. then
  38. shift
  39. dir="/redlog"
  40. fi
  41. if test "x$1" = "x"
  42. then
  43. # Here I filter out less1.red to less7.red because they use case
  44. # for emphasis. They are old enough now that they really need an overall
  45. # review I suspect!
  46. find $here/packages$dir -name \*.red -and -not -name less\*.red \
  47. > caseclash.files
  48. # I avoid mathmlom.tst because it contains a load of markup notation
  49. # rather than "straightforward" Reduce input.
  50. find $here/packages$dir -name \*.tst -and -not -name mathmlom.tst \
  51. >> caseclash.files
  52. fi
  53. $here/bin/redcsl -w \
  54. -Dfiles="caseclash.files" \
  55. -Doutputfile="caseclash.list" \
  56. "$here/generic/casefold/caseclash.red" \
  57. -l caseclash.log
  58. # End of script