pidgin.next.minor: b0b41393: Add a script to change casts to GObject ...
rlaager at pidgin.im
rlaager at pidgin.im
Fri Nov 14 01:10:32 EST 2008
-----------------------------------------------------------------
Revision: b0b41393064106eacd6ab68870f2b742de2f7e3b
Ancestor: 5f58e433ca197b90df72b88c7134435141a3aadb
Author: rlaager at pidgin.im
Date: 2008-11-14T02:26:28
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/b0b41393064106eacd6ab68870f2b742de2f7e3b
Added files:
fix-casts.sh
Modified files:
Makefile.am
Modified attrs:
fix-casts.sh
ChangeLog:
Add a script to change casts to GObject macros. We'll run this later.
-------------- next part --------------
============================================================
--- fix-casts.sh 702fa2e42bf8f1e4d76df3229715d540a611c868
+++ fix-casts.sh 702fa2e42bf8f1e4d76df3229715d540a611c868
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+if [ $# -eq 0 ]; then
+ echo "Usage: `basename "$0"` PurpleFoo..."
+ echo
+ echo "This script searches the *current working directory* and replaces casts"
+ echo "with GObject-style type checking and casting macros."
+ echo 'For example, "(PurpleBuddy *)b" becomes "PURPLE_BUDDY(b)".'
+ exit 0
+fi
+
+for struct in $* ; do
+ cast=`echo $struct | sed "s|[A-Z]|_\0|g" | tr "a-z" "A-Z" | sed "s|^_||"`
+ for file in `grep -rl "([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)" . --include=*.c` ; do
+ sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*(|$cast(|" $file
+ sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*\([^(][^,);]*\)|$cast(\1)|" $file
+ done
+done
============================================================
--- Makefile.am b234db231f3ce0eeb55e05e72a4959b6f1eb0855
+++ Makefile.am 21044f190912e6130b75e9c1c40e0c77d940fd41
@@ -10,6 +10,7 @@ EXTRA_DIST = \
README.mingw \
config.h.mingw \
doxy2devhelp.xsl \
+ fix-casts.sh \
gaim.pc.in \
gaim-uninstalled.pc.in \
intltool-extract.in \
More information about the Commits
mailing list