1 /* Message list test for ASCII character set.
2 Copyright (C) 2001-2002, 2005-2006 Free Software Foundation, Inc.
3 Written by Bruno Haible <haible@clisp.cons.org>, 2001.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (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, see <http://www.gnu.org/licenses/>. */
24 #include "msgl-ascii.h"
29 /* This file's structure parallels msgl-iconv.c. */
33 is_ascii_string (const char *string)
35 for (; *string; string++)
36 if (!c_isascii ((unsigned char) *string))
42 is_ascii_string_list (string_list_ty *slp)
47 for (i = 0; i < slp->nitems; i++)
48 if (!is_ascii_string (slp->item[i]))
54 is_ascii_message (message_ty *mp)
56 const char *p = mp->msgstr;
57 const char *p_end = p + mp->msgstr_len;
59 for (; p < p_end; p++)
60 if (!c_isascii ((unsigned char) *p))
63 if (!is_ascii_string_list (mp->comment))
65 if (!is_ascii_string_list (mp->comment_dot))
68 /* msgid and msgid_plural are normally ASCII, so why checking?
69 Because in complete UTF-8 environments they can be UTF-8, not ASCII. */
70 if (!is_ascii_string (mp->msgid))
72 if (mp->msgid_plural != NULL && !is_ascii_string (mp->msgid_plural))
75 /* Likewise for msgctxt. */
76 if (mp->msgctxt != NULL && !is_ascii_string (mp->msgctxt))
79 /* Likewise for the prev_* fields. */
80 if (mp->prev_msgctxt != NULL && !is_ascii_string (mp->prev_msgctxt))
82 if (mp->prev_msgid != NULL && !is_ascii_string (mp->prev_msgid))
84 if (mp->prev_msgid_plural != NULL && !is_ascii_string (mp->prev_msgid_plural))
91 is_ascii_message_list (message_list_ty *mlp)
95 for (j = 0; j < mlp->nitems; j++)
96 if (!is_ascii_message (mlp->item[j]))
103 is_ascii_msgdomain_list (msgdomain_list_ty *mdlp)
107 for (k = 0; k < mdlp->nitems; k++)
108 if (!is_ascii_message_list (mdlp->item[k]->messages))