author | truebrain |
Wed, 26 Mar 2008 15:17:40 +0000 | |
branch | noai |
changeset 9823 | 0b7f816cf46f |
parent 9741 | 53c1c5850e01 |
child 10216 | 794533ba4cbf |
permissions | -rwxr-xr-x |
9526
a4ad60ba03be
(svn r9446) [NoAI] -Add: simple script to make changing/adding classes to export a little simpler.
rubidium
parents:
diff
changeset
|
1 |
#!/bin/bash |
a4ad60ba03be
(svn r9446) [NoAI] -Add: simple script to make changing/adding classes to export a little simpler.
rubidium
parents:
diff
changeset
|
2 |
|
a4ad60ba03be
(svn r9446) [NoAI] -Add: simple script to make changing/adding classes to export a little simpler.
rubidium
parents:
diff
changeset
|
3 |
# This must be called from within the src/ai/api directory. |
a4ad60ba03be
(svn r9446) [NoAI] -Add: simple script to make changing/adding classes to export a little simpler.
rubidium
parents:
diff
changeset
|
4 |
|
9586
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
5 |
if [ -z "$1" ]; then |
9693
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
6 |
for f in `ls *.hpp`; do |
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
7 |
case "${f}" in |
9586
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
8 |
# these files should not be changed by this script |
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
9 |
"ai_controller.hpp" | "ai_object.hpp") continue; |
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
10 |
esac |
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
11 |
awk -f squirrel_export.awk ${f} > ${f}.tmp |
9693
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
12 |
if [ -n "`diff -b ${f}.tmp ${f}.sq 2> /dev/null || echo boo`" ]; then |
9596
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
9586
diff
changeset
|
13 |
mv ${f}.tmp ${f}.sq |
9693
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
14 |
echo "Updated: ${f}.sq" |
9596
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
9586
diff
changeset
|
15 |
svn add ${f}.sq > /dev/null 2>&1 |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
9586
diff
changeset
|
16 |
svn propset svn:eol-style native ${f}.sq > /dev/null 2>&1 |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
9586
diff
changeset
|
17 |
svn propset svn:keywords Id ${f}.sq > /dev/null 2>&1 |
9586
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
18 |
else |
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
19 |
rm -f ${f}.tmp |
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
20 |
fi |
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
21 |
done |
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
22 |
else |
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
23 |
awk -f squirrel_export.awk $1 > $1.tmp |
9693
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
24 |
if [ -n "`diff -b $1.sq $1.tmp`" ]; then |
9596
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
9586
diff
changeset
|
25 |
mv $1.tmp $1.sq |
9693
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
26 |
echo "Updated: $1.sq" |
9596
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
9586
diff
changeset
|
27 |
svn add $1.sq > /dev/null 2>&1 |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
9586
diff
changeset
|
28 |
svn propset svn:eol-style native $1.sq > /dev/null 2>&1 |
8af5a1399842
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
9586
diff
changeset
|
29 |
svn propset svn:keywords Id $1.sq > /dev/null 2>&1 |
9526
a4ad60ba03be
(svn r9446) [NoAI] -Add: simple script to make changing/adding classes to export a little simpler.
rubidium
parents:
diff
changeset
|
30 |
else |
9586
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
31 |
rm -f $1.tmp |
9526
a4ad60ba03be
(svn r9446) [NoAI] -Add: simple script to make changing/adding classes to export a little simpler.
rubidium
parents:
diff
changeset
|
32 |
fi |
9586
656646f23da7
(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
truelight
parents:
9572
diff
changeset
|
33 |
fi |
9528
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
34 |
|
9693
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
35 |
# Remove .hpp.sq if .hpp doesn't exist anymore |
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
36 |
for f in `ls *.hpp.sq`; do |
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
37 |
f=`echo ${f} | sed "s/.hpp.sq$/.hpp/"` |
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
38 |
if [ ! -f ${f} ];then |
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
39 |
echo "Deleted: ${f}.sq" |
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
40 |
svn del --force ${f}.sq > /dev/null 2>&1 |
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
41 |
fi |
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
42 |
done |
9528
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
43 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
44 |
# Add stuff to ../ai_squirrel.cpp |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
45 |
f='../ai_squirrel.cpp' |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
46 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
47 |
functions=`` |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
48 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
49 |
echo " |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
50 |
{ } |
9597
db3908cf597a
(svn r9630) [NoAI] -Codechange: remove now useless define.
rubidium
parents:
9596
diff
changeset
|
51 |
/.hpp.sq/ { next } |
db3908cf597a
(svn r9630) [NoAI] -Codechange: remove now useless define.
rubidium
parents:
9596
diff
changeset
|
52 |
/squirrel_register_std/ { next } |
9741
53c1c5850e01
(svn r12221) [NoAI] -Fix: Register functions are no _Register functions, and always on top of the sort list
truebrain
parents:
9693
diff
changeset
|
53 |
/SQAI.*_Register/ { next } |
9597
db3908cf597a
(svn r9630) [NoAI] -Codechange: remove now useless define.
rubidium
parents:
9596
diff
changeset
|
54 |
|
db3908cf597a
(svn r9630) [NoAI] -Codechange: remove now useless define.
rubidium
parents:
9596
diff
changeset
|
55 |
/Note: this line a marker in squirrel_export.sh. Do not change!/ { |
db3908cf597a
(svn r9630) [NoAI] -Codechange: remove now useless define.
rubidium
parents:
9596
diff
changeset
|
56 |
print \$0 |
9741
53c1c5850e01
(svn r12221) [NoAI] -Fix: Register functions are no _Register functions, and always on top of the sort list
truebrain
parents:
9693
diff
changeset
|
57 |
split(\"`grep '^void SQAI.*_Register(Squirrel \*engine) {$' *.hpp.sq | sed 's/:.*$//' | sort | uniq | tr -d '\r' | tr '\n' ' '`\", files, \" \") |
9528
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
58 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
59 |
for (i = 1; files[i] != \"\"; i++) { |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
60 |
print \"#include \\\"api/\" files[i] \"\\\"\" |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
61 |
} |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
62 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
63 |
next; |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
64 |
} |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
65 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
66 |
/\/\* Register all classes \*\// { |
9597
db3908cf597a
(svn r9630) [NoAI] -Codechange: remove now useless define.
rubidium
parents:
9596
diff
changeset
|
67 |
print \$0 |
9528
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
68 |
print \" squirrel_register_std(this->engine);\" |
9741
53c1c5850e01
(svn r12221) [NoAI] -Fix: Register functions are no _Register functions, and always on top of the sort list
truebrain
parents:
9693
diff
changeset
|
69 |
split(\"`grep '^void SQAI.*_Register(Squirrel \*engine) {$' *.hpp.sq | sed 's/^.*void //;s/Squirrel \*/this->/;s/ {/;/;s/_Register/0000Register/g;' | sort | sed 's/0000Register/_Register/g' | tr -d '\r' | tr '\n' ' '`\", regs, \" \") |
9528
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
70 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
71 |
for (i = 1; regs[i] != \"\"; i++) { |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
72 |
print \" \" regs[i] |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
73 |
} |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
74 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
75 |
next |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
76 |
} |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
77 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
78 |
{ print \$0; } |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
79 |
" > ${f}.awk |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
80 |
|
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
81 |
awk -f ${f}.awk ${f} > ${f}.tmp |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
82 |
|
9693
31fcaa5375a1
(svn r10769) [NoAI] -Fix: EOL only changes are now considered as "not changed"
glx
parents:
9597
diff
changeset
|
83 |
if [ -n "`diff -b ${f} ${f}.tmp`" ]; then |
9528
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
84 |
mv ${f}.tmp ${f} |
9572
6a78470c53f3
(svn r9535) [NoAI] -Codechange: don't export virtual classes, only their class signature for parameters.
rubidium
parents:
9528
diff
changeset
|
85 |
echo "Updated: ${f}" |
9528
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
86 |
else |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
87 |
rm -f ${f}.tmp |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
88 |
fi |
b2cc6f31363c
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.
rubidium
parents:
9526
diff
changeset
|
89 |
rm -f ${f}.awk |