1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21: #include <dlfcn.h>
22:
23: #define FROM_LOOP from_generic
24: #define TO_LOOP to_generic
25: #define DEFINE_INIT 1
26: #define DEFINE_FINI 1
27: #define MIN_NEEDED_FROM 1
28: #define MIN_NEEDED_TO 4
29:
30:
31:
32: #define MIN_NEEDED_INPUT MIN_NEEDED_FROM
33: #define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
34: #define LOOPFCT FROM_LOOP
35: #define BODY \
36: { \
37: uint32_t ch = to_ucs4[*inptr]; \
38: \
39: if (HAS_HOLES && __builtin_expect (ch == L'\0', 0) && *inptr != '\0') \
40: { \
41: \
42: STANDARD_FROM_LOOP_ERR_HANDLER (1); \
43: } \
44: \
45: put32 (outptr, ch); \
46: outptr += 4; \
47: ++inptr; \
48: }
49: #define LOOP_NEED_FLAGS
50: #define ONEBYTE_BODY \
51: { \
52: uint32_t ch = to_ucs4[c]; \
53: \
54: if (HAS_HOLES && __builtin_expect (ch == L'\0', 0) && c != '\0') \
55: return WEOF; \
56: else \
57: return ch; \
58: }
59: #include <iconv/loop.c>
60:
61:
62:
63: #define MIN_NEEDED_INPUT MIN_NEEDED_TO
64: #define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
65: #define LOOPFCT TO_LOOP
66: #define BODY \
67: { \
68: uint32_t ch = get32 (inptr); \
69: \
70: if (__builtin_expect (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0]), 0)\
71: || (__builtin_expect (from_ucs4[ch], '\1') == '\0' && ch != 0)) \
72: { \
73: UNICODE_TAG_HANDLER (ch, 4); \
74: \
75: \
76: STANDARD_TO_LOOP_ERR_HANDLER (4); \
77: } \
78: \
79: *outptr++ = from_ucs4[ch]; \
80: inptr += 4; \
81: }
82: #define LOOP_NEED_FLAGS
83: #include <iconv/loop.c>
84:
85:
86:
87: #include <iconv/skeleton.c>