2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2009 The GemRB Project
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 if [[ ! -d admin
]]; then
22 echo 'Run me from the top gemrb dir that contains the admin subdir!'
25 docdir
=gemrb
/docs
/en
/GUIScript
28 methods
=$
(.
/check_gui_doc.pl |
grep ^
+)
31 #+ SwapPCs : $md5_hash : SwapPCs(idx1, idx2)\n\n : Swaps the party order
39 prototype
=$
(cut
-d: -f1 <<< "$tmp" |
sed 's,nn\s*$,,')
40 description
=$
(cut
-d: -f2- <<< "$tmp")
42 echo Adding
$method stub with
: $description
43 cp $docdir/doc_template.txt
$docdir/$method.txt
45 return_value
=$
(awk '{ if(split($0,a,"=>")) print a[2]; }' <<< "$prototype")
46 if [[ -n $return_value ]]; then
47 # we also have the return "value", so remove it from the prototype
48 prototype
=$
(awk '{ if(split($0,a,"=>")) print a[1]; }' <<< "$prototype")
49 sed -i "s@^Return value:@& ${return_value# }@" $docdir/$method.txt
51 sed -i "s@^Prototype:@& GemRB.${prototype% }@" $docdir/$method.txt
52 sed -i "s@^Description:@& $description@" $docdir/$method.txt
55 # eg: WindowIndex ControlID x y w h direction[ font]
57 for parameter
in $
(sed -n 's@^[^(]*(\([^)]*\)).*$@\1@p' <<< "$prototype"); do
58 parameter
=$
(tr -d ',' <<< "$parameter")
59 if [[ ${parameter:${#parameter}-1:1} == "]" ]]; then
61 parameters
="$parameters\n${parameter//]/} - (optional) "
63 parameters
="$parameters\n${parameter//[/} - "
66 sed -i "s@^Parameters:@& $parameters@" $docdir/$method.txt