Mercurial > hg > CbC > CbC_gcc
comparison gcc/po/exgettext @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
1 #! /bin/sh | 1 #! /bin/sh |
2 # Wrapper around gettext for programs using the msgid convention. | 2 # Wrapper around gettext for programs using the msgid convention. |
3 # Copyright 1998, 2001, 2002, 2003, 2009 Free Software Foundation, Inc. | 3 # Copyright 1998, 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc. |
4 | 4 |
5 # Written by Paul Eggert <eggert@twinsun.com>. | 5 # Written by Paul Eggert <eggert@twinsun.com>. |
6 # Revised by Zack Weinberg <zackw@stanford.edu> for no-POTFILES operation. | 6 # Revised by Zack Weinberg <zackw@stanford.edu> for no-POTFILES operation. |
7 | 7 |
8 # This file is part of GCC. | 8 # This file is part of GCC. |
61 pwd=`${PWDCMD-pwd}` | 61 pwd=`${PWDCMD-pwd}` |
62 kopt=$pwd/$T/keyword-options | 62 kopt=$pwd/$T/keyword-options |
63 kopt2=$pwd/$T/keyword2-options | 63 kopt2=$pwd/$T/keyword2-options |
64 emsg=$pwd/$T/emsgids.c | 64 emsg=$pwd/$T/emsgids.c |
65 posr=$pwd/$T/po-sources | 65 posr=$pwd/$T/po-sources |
66 posrcxx=$pwd/$T/po-cxx-sources | |
66 pottmp1=$pwd/$T/tmp1.pot | 67 pottmp1=$pwd/$T/tmp1.pot |
67 pottmp2=$pwd/$T/tmp2.pot | 68 pottmp2=$pwd/$T/tmp2.pot |
69 pottmp3=$pwd/$T/tmp3.pot | |
68 pottmp=$pwd/$T/tmp.pot | 70 pottmp=$pwd/$T/tmp.pot |
69 | 71 |
70 # Locate files to scan, and generate the list. All .c, .h, and .def files | 72 # Locate files to scan. We scan the following directories: |
71 # in $srcdir are examined, likewise $srcdir/config and $srcdir/config/* | 73 # $srcdir |
72 # (directories). Also, all subdirectories of $srcdir that contain a | 74 # $srcdir/c-family |
73 # config-lang.in. Exclusions come from $srcdir/po/EXCLUDE. | 75 # $srcdir/config |
76 # $srcdir/config/* | |
77 # all subdirectories of $srcdir containing a config-lang.in file, and | |
78 # all subdirectories of those directories. | |
79 # Within those directories, we examine all .c, .cc, .h, and .def files. | |
80 # However, any files listed in $srcdir/po/EXCLUDE are not examined. | |
74 # | 81 # |
75 # Then generate keyword options for xgettext, by scanning for declarations | 82 # Then generate keyword options for xgettext, by scanning for declarations |
76 # of functions whose parameter names end in "msgid". | 83 # of functions whose parameter names end in "msgid". |
77 # | 84 # |
78 # Finally, generate a source file containing all %e and %n strings from | 85 # Finally, generate a source file containing all %e and %n strings from |
81 # All in one huge awk script. | 88 # All in one huge awk script. |
82 | 89 |
83 echo "scanning for keywords, %e and %n strings..." >&2 | 90 echo "scanning for keywords, %e and %n strings..." >&2 |
84 | 91 |
85 ( cd $srcdir | 92 ( cd $srcdir |
86 lang_subdirs=`echo */config-lang.in */*/config-lang.in | sed -e 's|config-lang\.in||g'` | 93 lang_subdirs=`echo */config-lang.in */*/config-lang.in | sed -e 's|/config-lang\.in||g'` |
87 { for dir in "" config/ config/*/ $lang_subdirs | 94 { for dir in "" c-family/ config/ config/*/ \ |
88 do for glob in '*.c' '*.h' '*.def' | 95 `find $lang_subdirs -type d -print | fgrep -v .svn | sort | sed -e 's|$|/|'` |
96 do for glob in '*.c' '*.cc' '*.h' '*.def' | |
89 do eval echo $dir$glob | 97 do eval echo $dir$glob |
90 done | 98 done |
91 done; | 99 done; |
92 } | tr ' ' "$nl" | grep -v '\*' | | 100 } | tr ' ' "$nl" | grep -v '\*' | |
93 $AWK -v excl=po/EXCLUDES -v posr=$posr -v kopt=$kopt -v kopt2=$kopt2 -v emsg=$emsg ' | 101 $AWK -v excl=po/EXCLUDES -v posr=$posr -v posrcxx=$posrcxx -v kopt=$kopt -v kopt2=$kopt2 -v emsg=$emsg ' |
94 function keyword_option(line) { | 102 function keyword_option(line) { |
95 paren_index = index(line, "(") | 103 paren_index = index(line, "(") |
96 name = substr(line, 1, paren_index - 1) | 104 name = substr(line, 1, paren_index - 1) |
97 sub(/[^0-9A-Z_a-z]*$/, "", name) | 105 sub(/[^0-9A-Z_a-z]*$/, "", name) |
98 sub(/[ ]+PARAMS/, "", name) | 106 sub(/[ ]+PARAMS/, "", name) |
176 excludes[$1] = 1 | 184 excludes[$1] = 1 |
177 } | 185 } |
178 } | 186 } |
179 | 187 |
180 { if (!($0 in excludes)) { | 188 { if (!($0 in excludes)) { |
181 print > posr | 189 if ($0 ~ /.cc$/) { |
190 print > posrcxx | |
191 } else { | |
192 print > posr | |
193 } | |
182 files[NR] = $0 | 194 files[NR] = $0 |
183 } | 195 } |
184 } | 196 } |
185 | 197 |
186 END { | 198 END { |
221 field = 0 | 233 field = 0 |
222 while (getline < file) { | 234 while (getline < file) { |
223 if (/^[ \t]*(;|$)/ || !/^[^ \t]/) { | 235 if (/^[ \t]*(;|$)/ || !/^[^ \t]/) { |
224 field = 0 | 236 field = 0 |
225 } else { | 237 } else { |
238 if ((field == 1) && /MissingArgError/) { | |
239 line = $0 | |
240 sub(".*MissingArgError\\(", "", line) | |
241 if (line ~ "^{") { | |
242 sub("^{", "", line) | |
243 sub("}\\).*", "", line) | |
244 } else | |
245 sub("\\).*", "", line) | |
246 printf("#line %d \"%s\"\n", lineno, file) | |
247 printf("_(\"%s\")\n", line) | |
248 } | |
249 if ((field == 1) && /UnknownError/) { | |
250 line = $0 | |
251 sub(".*UnknownError\\(", "", line) | |
252 if (line ~ "^{") { | |
253 sub("^{", "", line) | |
254 sub("}\\).*", "", line) | |
255 } else | |
256 sub("\\).*", "", line) | |
257 printf("#line %d \"%s\"\n", lineno, file) | |
258 printf("_(\"%s\")\n", line) | |
259 } | |
260 if ((field == 1) && /Warn\(/) { | |
261 line = $0 | |
262 sub(".*Warn\\(", "", line) | |
263 if (line ~ "^{") { | |
264 sub("^{", "", line) | |
265 sub("}\\).*", "", line) | |
266 } else | |
267 sub("\\).*", "", line) | |
268 printf("#line %d \"%s\"\n", lineno, file) | |
269 printf("_(\"%s\")\n", line) | |
270 } | |
226 if (field == 2) { | 271 if (field == 2) { |
227 line = $0 | 272 line = $0 |
228 printf("#line %d \"%s\"\n", lineno, file) | 273 printf("#line %d \"%s\"\n", lineno, file) |
229 printf("_(\"%s\")\n", line) | 274 printf("_(\"%s\")\n", line) |
230 } | 275 } |
232 } | 277 } |
233 lineno++; | 278 lineno++; |
234 } | 279 } |
235 }') >> $emsg | 280 }') >> $emsg |
236 | 281 |
237 # Run the xgettext command, with temporary added as a file to scan. | 282 # Run the xgettext commands, with temporary added as a file to scan. |
238 echo "running xgettext..." >&2 | 283 echo "running xgettext..." >&2 |
239 $xgettext --default-domain=$package --directory=$srcdir \ | 284 $xgettext --default-domain=$package --directory=$srcdir \ |
240 --add-comments `cat $kopt` --files-from=$posr \ | 285 --add-comments `cat $kopt` --files-from=$posr \ |
241 --copyright-holder="Free Software Foundation, Inc." \ | 286 --copyright-holder="Free Software Foundation, Inc." \ |
242 --msgid-bugs-address="http://gcc.gnu.org/bugs.html" \ | 287 --msgid-bugs-address="http://gcc.gnu.org/bugs.html" \ |
243 --language=c -o $pottmp1 | 288 --language=c -o $pottmp1 |
289 if test -s $posrcxx; then | |
290 $xgettext --default-domain=$package --directory=$srcdir \ | |
291 --add-comments `cat $kopt` --files-from=$posrcxx \ | |
292 --copyright-holder="Free Software Foundation, Inc." \ | |
293 --msgid-bugs-address="http://gcc.gnu.org/bugs.html" \ | |
294 --language=c++ -o $pottmp2 | |
295 else | |
296 echo > $pottmp2 | |
297 fi | |
244 $xgettext --default-domain=$package --directory=$srcdir \ | 298 $xgettext --default-domain=$package --directory=$srcdir \ |
245 --add-comments --keyword= `cat $kopt2` --files-from=$posr \ | 299 --add-comments --keyword= `cat $kopt2` --files-from=$posr \ |
246 --copyright-holder="Free Software Foundation, Inc." \ | 300 --copyright-holder="Free Software Foundation, Inc." \ |
247 --msgid-bugs-address="http://gcc.gnu.org/bugs.html" \ | 301 --msgid-bugs-address="http://gcc.gnu.org/bugs.html" \ |
248 --language=GCC-source -o $pottmp2 | 302 --language=GCC-source -o $pottmp3 |
249 $xgettext --default-domain=$package \ | 303 $xgettext --default-domain=$package \ |
250 --add-comments $pottmp1 $pottmp2 \ | 304 --add-comments $pottmp1 $pottmp2 $pottmp3 \ |
251 --copyright-holder="Free Software Foundation, Inc." \ | 305 --copyright-holder="Free Software Foundation, Inc." \ |
252 --msgid-bugs-address="http://gcc.gnu.org/bugs.html" \ | 306 --msgid-bugs-address="http://gcc.gnu.org/bugs.html" \ |
253 --language=PO -o $pottmp | 307 --language=PO -o $pottmp |
254 # Remove local paths from .pot file. | 308 # Remove local paths from .pot file. |
255 sed "s:$srcdir/::g;s:$pwd/::g;" <$pottmp >po/$package.pot | 309 sed "s:$srcdir/::g;s:$pwd/::g;" <$pottmp >po/$package.pot |