nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* Copyright (C) 2000-2002, 2005-2006, 2008-2009 Free Software Foundation, Inc. |
2 | This file is part of the GNU LIBICONV Library. |
||
3 | |||
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. |
||
8 | |||
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. |
||
13 | |||
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, write to the Free Software Foundation, Inc., 51 Franklin Street, |
||
17 | Fifth Floor, Boston, MA 02110-1301, USA. */ |
||
18 | |||
19 | /* Creates the flags.h include file. */ |
||
20 | |||
21 | #include <stdio.h> |
||
22 | #include <stdlib.h> |
||
23 | #include <string.h> |
||
24 | |||
25 | /* Consider all encodings, including the system dependent ones. */ |
||
26 | #define USE_AIX |
||
27 | #define USE_OSF1 |
||
28 | #define USE_DOS |
||
29 | #define USE_EXTRA |
||
30 | |||
31 | struct loop_funcs {}; |
||
32 | struct iconv_fallbacks {}; |
||
33 | struct iconv_hooks {}; |
||
34 | #include "converters.h" |
||
35 | |||
36 | static void emit_encoding (struct wctomb_funcs * ofuncs, const char* c_name) |
||
37 | { |
||
38 | /* Prepare a converter struct. */ |
||
39 | struct conv_struct conv; |
||
40 | memset(&conv,'\0',sizeof(conv)); |
||
41 | conv.ofuncs = *ofuncs; |
||
42 | |||
43 | { |
||
44 | /* See whether the encoding can encode the accents and quotation marks. */ |
||
45 | ucs4_t probe[6] = { 0x0060, 0x00b4, 0x2018, 0x2019, 0x3131, 0x3163, }; |
||
46 | int res[6]; |
||
47 | int i; |
||
48 | for (i = 0; i < 6; i++) { |
||
49 | unsigned char buf[10]; |
||
50 | memset(&conv.ostate,'\0',sizeof(state_t)); |
||
51 | res[i] = (conv.ofuncs.xxx_wctomb(&conv,buf,probe[i],sizeof(buf)) != RET_ILUNI); |
||
52 | } |
||
53 | printf("#define ei_%s_oflags (",c_name); |
||
54 | { |
||
55 | int first = 1; |
||
56 | if (res[0] && res[1]) { |
||
57 | printf("HAVE_ACCENTS"); |
||
58 | first = 0; |
||
59 | } |
||
60 | if (res[2] && res[3]) { |
||
61 | if (!first) printf(" | "); |
||
62 | printf("HAVE_QUOTATION_MARKS"); |
||
63 | first = 0; |
||
64 | } |
||
65 | if (res[4] && res[5]) { |
||
66 | if (!first) printf(" | "); |
||
67 | printf("HAVE_HANGUL_JAMO"); |
||
68 | first = 0; |
||
69 | } |
||
70 | if (first) printf("0"); |
||
71 | } |
||
72 | printf(")\n"); |
||
73 | } |
||
74 | } |
||
75 | |||
76 | int main () |
||
77 | { |
||
78 | int bitmask = 1; |
||
79 | printf("/* Generated automatically by genflags. */\n"); |
||
80 | printf("\n"); |
||
81 | printf("/* Set if the encoding can encode\n"); |
||
82 | printf(" the acute and grave accents U+00B4 and U+0060. */\n"); |
||
83 | printf("#define HAVE_ACCENTS %d\n",bitmask); |
||
84 | printf("\n"); |
||
85 | bitmask = bitmask << 1; |
||
86 | printf("/* Set if the encoding can encode\n"); |
||
87 | printf(" the single quotation marks U+2018 and U+2019. */\n"); |
||
88 | printf("#define HAVE_QUOTATION_MARKS %d\n",bitmask); |
||
89 | printf("\n"); |
||
90 | bitmask = bitmask << 1; |
||
91 | printf("/* Set if the encoding can encode\n"); |
||
92 | printf(" the double-width Hangul letters (Jamo) U+3131 to U+3163. */\n"); |
||
93 | printf("#define HAVE_HANGUL_JAMO %d\n",bitmask); |
||
94 | printf("\n"); |
||
95 | |||
96 | #define DEFENCODING(xxx_names,xxx,xxx_ifuncs1,xxx_ifuncs2,xxx_ofuncs1,xxx_ofuncs2) \ |
||
97 | { \ |
||
98 | struct wctomb_funcs ofuncs = xxx_ofuncs1,xxx_ofuncs2; \ |
||
99 | emit_encoding(&ofuncs,#xxx); \ |
||
100 | } |
||
101 | #define DEFALIAS(xxx_alias,xxx) /* nothing */ |
||
102 | /* Consider all encodings, including the system dependent ones. */ |
||
103 | #include "encodings.def" |
||
104 | #include "encodings_aix.def" |
||
105 | #include "encodings_osf1.def" |
||
106 | #include "encodings_dos.def" |
||
107 | #include "encodings_extra.def" |
||
108 | #undef DEFALIAS |
||
109 | #undef DEFENCODING |
||
110 | |||
111 | if (ferror(stdout) || fclose(stdout)) |
||
112 | exit(1); |
||
113 | exit(0); |
||
114 | } |