annotate help/help_create.sh @ 35643:f8eb470c25ea

Add doxygen comments.
author ib
date Sat, 12 Jan 2013 00:04:24 +0000
parents dc5355a5b42f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26878
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
1 #!/bin/sh
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
2 # Create the messages header file from the master source file or a translation.
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
3 # Missing messages are filled in from the master message file and, if
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
4 # requested, character set conversion is performed.
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
5
28432
eb42079ed5f7 Print an error message when given insufficient parameters.
diego
parents: 26878
diff changeset
6 if test -z $2 ; then
eb42079ed5f7 Print an error message when given insufficient parameters.
diego
parents: 26878
diff changeset
7 echo "Error: missing parameters"
eb42079ed5f7 Print an error message when given insufficient parameters.
diego
parents: 26878
diff changeset
8 echo "Usage: $0 <messages file> <character set>"
eb42079ed5f7 Print an error message when given insufficient parameters.
diego
parents: 26878
diff changeset
9 exit 1
eb42079ed5f7 Print an error message when given insufficient parameters.
diego
parents: 26878
diff changeset
10 fi
eb42079ed5f7 Print an error message when given insufficient parameters.
diego
parents: 26878
diff changeset
11
26878
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
12 MASTER=help/help_mp-en.h
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
13 TARGET=help_mp.h
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
14
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
15 TRANSLATION=$1
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
16 CHARSET=$2
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
17
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
18 missing_messages(){
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
19 curr=""
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
20
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
21 while read -r line; do
30990
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 28432
diff changeset
22 if echo "$line" | grep -q '^#define' ; then
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 28432
diff changeset
23 curr=`printf "%s\n" "$line" | cut -d ' ' -f 2`
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 28432
diff changeset
24 if grep -q "^#define $curr[ ]" "$TRANSLATION" ; then
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 28432
diff changeset
25 curr=""
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 28432
diff changeset
26 fi
31681
7e7c541566ad cosmetics: Use 'elif' instead of 'else .. if'.
diego
parents: 30990
diff changeset
27 elif [ -z "$line" ]; then
7e7c541566ad cosmetics: Use 'elif' instead of 'else .. if'.
diego
parents: 30990
diff changeset
28 curr=""
30990
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 28432
diff changeset
29 fi
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 28432
diff changeset
30 if [ -n "$curr" ]; then
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 28432
diff changeset
31 printf "%s\n" "$line"
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 28432
diff changeset
32 fi
26878
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
33 done
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
34 }
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
35
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
36 cat <<EOF > "$TARGET"
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
37 /* WARNING! This is a generated file, do NOT edit.
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
38 * See the help/ subdirectory for the editable files. */
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
39
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
40 #ifndef MPLAYER_HELP_MP_H
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
41 #define MPLAYER_HELP_MP_H
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
42
35588
dc5355a5b42f Include inttypes.h in generated help messages file.
ib
parents: 35586
diff changeset
43 #include <inttypes.h>
35586
be4dcfb3620c Include config.h in generated help messages file.
ib
parents: 31681
diff changeset
44 #include "config.h"
be4dcfb3620c Include config.h in generated help messages file.
ib
parents: 31681
diff changeset
45
26878
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
46 EOF
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
47
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
48 cat "$TRANSLATION" >> "$TARGET"
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
49
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
50 cat <<EOF >> "$TARGET"
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
51
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
52 /* untranslated messages from the English master file */
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
53
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
54 EOF
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
55
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
56 if test "$MASTER" != "$TRANSLATION" ; then
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
57 missing_messages < "$MASTER" >> "$TARGET"
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
58 fi
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
59
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
60 cat <<EOF >> "$TARGET"
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
61
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
62 #endif /* MPLAYER_HELP_MP_H */
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
63 EOF
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
64
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
65 if test $CHARSET != UTF-8 ; then
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
66 iconv -f UTF-8 -t "$CHARSET" "$TARGET" > "${TARGET}.tmp"
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
67 mv "${TARGET}.tmp" "$TARGET"
73921138ff30 Move messages header file creation to a separate shell script.
diego
parents:
diff changeset
68 fi