1 /* Copyright (C) 2000-2002, 2005-2006, 2008-2009, 2016 Free Software Foundation, Inc.
2 This file is part of the GNU LIBICONV Library.
4 The GNU LIBICONV Library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 The GNU LIBICONV Library is distributed in the hope that it will be
10 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU LIBICONV Library; see the file COPYING.LIB.
16 If not, see <http://www.gnu.org/licenses/>. */
18 /* Creates the flags.h include file. */
25 /* Avoid lots of warnings from "gcc -Wall". */
26 #if (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) || __GNUC__ > 4
27 # pragma GCC diagnostic ignored "-Wunused-function"
30 /* Consider all encodings, including the system dependent ones. */
37 struct iconv_fallbacks {};
38 struct iconv_hooks {};
39 #include "converters.h"
41 static void emit_encoding (struct wctomb_funcs * ofuncs, const char* c_name)
43 /* Prepare a converter struct. */
44 struct conv_struct conv;
45 memset(&conv,'\0',sizeof(conv));
46 conv.ofuncs = *ofuncs;
49 /* See whether the encoding can encode the accents and quotation marks. */
50 ucs4_t probe[6] = { 0x0060, 0x00b4, 0x2018, 0x2019, 0x3131, 0x3163, };
53 for (i = 0; i < 6; i++) {
54 unsigned char buf[10];
55 memset(&conv.ostate,'\0',sizeof(state_t));
56 res[i] = (conv.ofuncs.xxx_wctomb(&conv,buf,probe[i],sizeof(buf)) != RET_ILUNI);
58 printf("#define ei_%s_oflags (",c_name);
61 if (res[0] && res[1]) {
62 printf("HAVE_ACCENTS");
65 if (res[2] && res[3]) {
66 if (!first) printf(" | ");
67 printf("HAVE_QUOTATION_MARKS");
70 if (res[4] && res[5]) {
71 if (!first) printf(" | ");
72 printf("HAVE_HANGUL_JAMO");
75 if (first) printf("0");
84 printf("/* Generated automatically by genflags. */\n");
86 printf("/* Set if the encoding can encode\n");
87 printf(" the acute and grave accents U+00B4 and U+0060. */\n");
88 printf("#define HAVE_ACCENTS %d\n",bitmask);
90 bitmask = bitmask << 1;
91 printf("/* Set if the encoding can encode\n");
92 printf(" the single quotation marks U+2018 and U+2019. */\n");
93 printf("#define HAVE_QUOTATION_MARKS %d\n",bitmask);
95 bitmask = bitmask << 1;
96 printf("/* Set if the encoding can encode\n");
97 printf(" the double-width Hangul letters (Jamo) U+3131 to U+3163. */\n");
98 printf("#define HAVE_HANGUL_JAMO %d\n",bitmask);
101 #define DEFENCODING(xxx_names,xxx,xxx_ifuncs1,xxx_ifuncs2,xxx_ofuncs1,xxx_ofuncs2) \
103 struct wctomb_funcs ofuncs = xxx_ofuncs1,xxx_ofuncs2; \
104 emit_encoding(&ofuncs,#xxx); \
106 #define DEFALIAS(xxx_alias,xxx) /* nothing */
107 /* Consider all encodings, including the system dependent ones. */
108 #include "encodings.def"
109 #include "encodings_aix.def"
110 #include "encodings_osf1.def"
111 #include "encodings_dos.def"
112 #include "encodings_extra.def"
116 if (ferror(stdout) || fclose(stdout))