1#! /bin/sh 2 3# Test C++ support: test boost-format. 4 5tmpfiles="" 6trap 'rm -fr $tmpfiles' 1 2 3 15 7 8tmpfiles="$tmpfiles xg-c-14.cc" 9cat <<\EOF > xg-c-14.cc 10// These are recognized as boost-format because of the keyword 'format'. 11format(gettext("%s on, %s off")); 12format(gettext("%1$d on, %2$d off")); 13format(gettext("%|1$| on, %|2$| off")); 14format(gettext("%1% on, %2% off")); 15// These are recognized as boost-format only through the heuristics. 16gettext("heuristic %s on, %s off"); 17gettext("heuristic %1$d on, %2$d off"); 18gettext("heuristic %|1$| on, %|2$| off"); 19gettext("heuristic %1% on, %2% off"); 20EOF 21 22tmpfiles="$tmpfiles xg-c-14.tmp.po xg-c-14.po" 23: ${XGETTEXT=xgettext} 24${XGETTEXT} --omit-header --no-location -d xg-c-14.tmp --boost xg-c-14.cc 25test $? = 0 || { rm -fr $tmpfiles; exit 1; } 26tr -d '\r' < xg-c-14.tmp.po > xg-c-14.po 27test $? = 0 || { rm -fr $tmpfiles; exit 1; } 28 29# The first 4 are not marked as c-format, because they are known as 30# boost-format. The last 4 are governed by the heuristic. The first two 31# among them are valid c-format strings. The last one is a valid but unlikely 32# c-format string, therefore the heuristic doesn't mark it. 33tmpfiles="$tmpfiles xg-c-14.ok" 34cat <<\EOF > xg-c-14.ok 35#, boost-format 36msgid "%s on, %s off" 37msgstr "" 38 39#, boost-format 40msgid "%1$d on, %2$d off" 41msgstr "" 42 43#, boost-format 44msgid "%|1$| on, %|2$| off" 45msgstr "" 46 47#, boost-format 48msgid "%1% on, %2% off" 49msgstr "" 50 51#, c-format, boost-format 52msgid "heuristic %s on, %s off" 53msgstr "" 54 55#, c-format, boost-format 56msgid "heuristic %1$d on, %2$d off" 57msgstr "" 58 59#, boost-format 60msgid "heuristic %|1$| on, %|2$| off" 61msgstr "" 62 63#, boost-format 64msgid "heuristic %1% on, %2% off" 65msgstr "" 66EOF 67 68: ${DIFF=diff} 69${DIFF} xg-c-14.ok xg-c-14.po 70result=$? 71 72rm -fr $tmpfiles 73 74exit $result 75