[uim-commit] r3048 - trunk/tools

yamaken at freedesktop.org yamaken at freedesktop.org
Tue Jan 31 11:32:11 PST 2006


Author: yamaken
Date: 2006-01-31 11:32:05 -0800 (Tue, 31 Jan 2006)
New Revision: 3048

Modified:
   trunk/tools/trim-src.sh
Log:
* tools/trim-src.sh
  - Add fep, emacs, replace subdirs
  - Add more rewriting rules


Modified: trunk/tools/trim-src.sh
===================================================================
--- trunk/tools/trim-src.sh	2006-01-31 19:26:00 UTC (rev 3047)
+++ trunk/tools/trim-src.sh	2006-01-31 19:32:05 UTC (rev 3048)
@@ -1,7 +1,16 @@
 #!/bin/sh
 
-SUBDIRS='uim helper gtk xim examples'
+SUBDIRS='uim replace helper gtk xim fep emacs examples'
 
 for subdir in $SUBDIRS; do
-    find $subdir \( -name '*.c' -or -name '*.h' -or -name '*.cpp' \) -exec perl -i -pe 's/\b(if|else|do|while|for|switch)\s*([{\(])/\1 \2/g; s/\)(|\s{2,}){/) {/g; s/(})\s*(if|else)/\1 \2/g' {} \;
+    find $subdir \( -name '*.c' -or -name '*.h' -or -name '*.cpp' \) \
+      -exec perl -i -pe 'next if (/===|DECLARE_|_BODY/); s/\b(if|else|do|while|for|switch|FOR_EACH|FOR_EACH_BUTLAST|FOR_EACH_PAIR|FOR_EACH_WHILE)\s*([{\(])/\1 \2/g; s/\)(|\s{2,}){/) {/g; s/(})\s*(if|else)/\1 \2/g; s/\s*([=!<>\+\-\*\/%&^|]=)\s*/ \1 /g; s/\s*\b([=?\+^\|])\b\s*/ \1 /g; s/\s*\b(&&|\|\||<<|>>|<<=|>>=)\b\s*/ \1 /g; s/([\(\[])\s+/\1/g; s/\s+([\)\]])/\1/g; if (!/Copyright|^\s*\/\*.+/*/\\s*$/) { s/\s+([,;])/\1/g; s/([,;])([^;\)\s])/\1 \2/g }' {} \;
+
+# special operators: needs manual fixup
+#    find $subdir \( -name '*.c' -or -name '*.h' -or -name '*.cpp' \) \
+#      -exec perl -i -pe 'next if (/#include|Copyright|Project|and\/or|DECLARE_|(FileName|About)\s+:|\w\.[ch]: /); s/\s*\b([\*\-\/%:<>])\b\s*/ \1 /g' {} \;
+
+# normalize function invocation: needs manual fixup
+#    find $subdir \( -name '*.c' -or -name '*.h' -or -name '*.cpp' \) \
+#      -exec perl -i -pe 'next if (/Copyright|DAMAGES|OR TORT|(FileName|About)\s+:/); s/(\w+)\s+\(/\1(/g; s/\b(if|else|do|while|for|switch|FOR_EACH|FOR_EACH_BUTLAST|FOR_EACH_PAIR|FOR_EACH_WHILE)\s*([{\(])/\1 \2/g' {} \;
 done



More information about the uim-commit mailing list