(svn r9611) [NoAI] -Add: allow a single param for squirrel_export which indicates the only file it should run on, instead of all *.hpp files noai
authortruelight
Thu, 12 Apr 2007 14:29:15 +0000
branchnoai
changeset 9586 656646f23da7
parent 9585 1300741e3230
child 9587 b0716d4c0128
(svn r9611) [NoAI] -Add: allow a single param for squirrel_export which indicates the only file it should run on, instead of all *.hpp files
src/ai/api/squirrel_export.sh
--- a/src/ai/api/squirrel_export.sh	Thu Apr 12 13:14:26 2007 +0000
+++ b/src/ai/api/squirrel_export.sh	Thu Apr 12 14:29:15 2007 +0000
@@ -2,19 +2,29 @@
 
 # This must be called from within the src/ai/api directory.
 
-for f in `ls *.hpp `; do
-	case "$f" in
-		# these files should not be changed by this script
-		"ai_controller.hpp" | "ai_object.hpp") continue;
-	esac
-	awk -f squirrel_export.awk ${f} > ${f}.tmp
-	if [ -n "`diff ${f} ${f}.tmp`" ]; then
-		mv ${f}.tmp ${f}
-		echo "Updated: ${f}"
+if [ -z "$1" ]; then
+	for f in `ls *.hpp `; do
+		case "$f" in
+			# these files should not be changed by this script
+			"ai_controller.hpp" | "ai_object.hpp") continue;
+		esac
+		awk -f squirrel_export.awk ${f} > ${f}.tmp
+		if [ -n "`diff ${f} ${f}.tmp`" ]; then
+			mv ${f}.tmp ${f}
+			echo "Updated: ${f}"
+		else
+			rm -f ${f}.tmp
+		fi
+	done
+else
+	awk -f squirrel_export.awk $1 > $1.tmp
+	if [ -n "`diff $1 $1.tmp`" ]; then
+		mv $1.tmp $1
+		echo "Updated: $1"
 	else
-		rm -f ${f}.tmp
+		rm -f $1.tmp
 	fi
-done
+fi
 
 
 # Add stuff to ../ai_squirrel.cpp