1 /* Message list test for ASCII character set.
2 Copyright (C) 2001-2002, 2005-2006, 2015 Free Software Foundation,
4 Written by Bruno Haible <haible@clisp.cons.org>, 2001.
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 #include "msgl-ascii.h"
30 /* This file's structure parallels msgl-iconv.c. */
34 is_ascii_string (const char *string)
36 for (; *string; string++)
37 if (!c_isascii ((unsigned char) *string))
43 is_ascii_string_list (string_list_ty *slp)
48 for (i = 0; i < slp->nitems; i++)
49 if (!is_ascii_string (slp->item[i]))
55 is_ascii_message (message_ty *mp)
57 const char *p = mp->msgstr;
58 const char *p_end = p + mp->msgstr_len;
60 for (; p < p_end; p++)
61 if (!c_isascii ((unsigned char) *p))
64 if (!is_ascii_string_list (mp->comment))
66 if (!is_ascii_string_list (mp->comment_dot))
69 /* msgid and msgid_plural are normally ASCII, so why checking?
70 Because in complete UTF-8 environments they can be UTF-8, not ASCII. */
71 if (!is_ascii_string (mp->msgid))
73 if (mp->msgid_plural != NULL && !is_ascii_string (mp->msgid_plural))
76 /* Likewise for msgctxt. */
77 if (mp->msgctxt != NULL && !is_ascii_string (mp->msgctxt))
80 /* Likewise for the prev_* fields. */
81 if (mp->prev_msgctxt != NULL && !is_ascii_string (mp->prev_msgctxt))
83 if (mp->prev_msgid != NULL && !is_ascii_string (mp->prev_msgid))
85 if (mp->prev_msgid_plural != NULL && !is_ascii_string (mp->prev_msgid_plural))
92 is_ascii_message_list (message_list_ty *mlp)
96 for (j = 0; j < mlp->nitems; j++)
97 if (!is_ascii_message (mlp->item[j]))
104 is_ascii_msgdomain_list (msgdomain_list_ty *mdlp)
108 for (k = 0; k < mdlp->nitems; k++)
109 if (!is_ascii_message_list (mdlp->item[k]->messages))