0.9.2.40:
authorWilliam Harold Newman <william.newman@airmail.net>
Tue, 12 Jul 2005 12:58:01 +0000 (12:58 +0000)
committerWilliam Harold Newman <william.newman@airmail.net>
Tue, 12 Jul 2005 12:58:01 +0000 (12:58 +0000)
added scripts to impose whitespace canonicalization
added scripts to check that sources haven't drifted away from
canonical whitespacing (as when someone doesn't use
emacs' INDENT-TABS-MODE=NIL...)
(Note that the scripts include an annoying level of "echo"-ish
commands which should probably be removed once things seem
to be working OK for everyone.)
(Something about huge touch-every-file "cvs commit" of
canonicalized-whitespace versions of all sources is
clashing with my flaky internet connection, so there may
be some further delay in committing the result of running
the scripts.)

tools-for-build/canonicalize-whitespace [new file with mode: 0755]
tools-for-build/canonicalize-whitespace-1 [new file with mode: 0755]
tools-for-build/check-canonical-whitespace [new file with mode: 0644]
tools-for-build/grep-noncanonical-whitespace [new file with mode: 0755]
tools-for-build/whitespacely-canonical-filenames [new file with mode: 0755]
version.lisp-expr

diff --git a/tools-for-build/canonicalize-whitespace b/tools-for-build/canonicalize-whitespace
new file mode 100755 (executable)
index 0000000..5c64e69
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# (a script to be run in the root directory of the distribution)
+#
+# Convert tabs to spaces and delete trailing whitespace in files
+# which we can safely assume to be source files in appropriate languages.
+
+tools-for-build/whitespacely-canonical-filenames \
+  | xargs tools-for-build/canonicalize-whitespace-1
diff --git a/tools-for-build/canonicalize-whitespace-1 b/tools-for-build/canonicalize-whitespace-1
new file mode 100755 (executable)
index 0000000..1e33369
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# in-place "canonicalize-whitespace" conversion for files in $*:
+#   * Convert tabs to spaces.
+#   * Delete trailing whitespace.
+# (on $*, in place, overwriting the old file)
+
+scratchfilename=/tmp/canonicalize-whitespace-1.$$.tmp
+
+echo '/in canonicalize-whitespace-1'
+echo '/$*'=$*
+echo '/$scratchfilename='$scratchfilename
+
+for f in $*; do
+
+  echo '/$f'=$f
+
+  # We reuse the "expand" GNU utility to remove tabs, but if it turns out
+  # not to be available everywhere (or someone has defined "expand" to 
+  # mean something else on some other class of system!) we could probably
+  # hand-code a replacement in a few lines.
+  expand $f > $scratchfilename
+
+  sed 's/[     ]*$//' < $scratchfilename > $f
+
+done
+
+rm $scratchfilename
diff --git a/tools-for-build/check-canonical-whitespace b/tools-for-build/check-canonical-whitespace
new file mode 100644 (file)
index 0000000..fec0a58
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Look for violations of whitespace canonicalization. On the first
+# one found, print the line (mostly to help humans) and exit with 
+# nonzero (mostly to help scripts).
+
diff --git a/tools-for-build/grep-noncanonical-whitespace b/tools-for-build/grep-noncanonical-whitespace
new file mode 100755 (executable)
index 0000000..a76dd1f
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Look for violations of whitespace canonicalization, handling them as
+# greppish matches:
+#   * Print human-readable description of each one.
+#   * Exit with 0 if >=1 found, or exit with 0 if none found.
+
+tools-for-build/whitespacely-canonical-filenames | \
+  xargs egrep --with-filename  '       | $'
\ No newline at end of file
diff --git a/tools-for-build/whitespacely-canonical-filenames b/tools-for-build/whitespacely-canonical-filenames
new file mode 100755 (executable)
index 0000000..b858795
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# (a script to be run in the root directory of the distribution,
+# probably as part of an enclosing do-something-with-whitespace script)
+#
+# Print to stdout the names of files whose whitespace we (SBCLers)
+# try to keep canonical.
+
+# glob patterns for source files in languages for which the
+# canonicalization is safe (not affecting meaning, at least given the
+# conservative syntax used in SBCL sources)
+source_extensions='.lisp .lisp-expr .c .h'
+# other candidates:
+#   .sh
+#   ?
+
+for source_extension in $source_extensions; do 
+    find . -name '*'$source_extension -print
+done
index 134df11..c8cb11c 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.2.39"
+"0.9.2.40"