euc.c (c05bd9ae2520b15e66f8c02d7fce3b4e77548545) euc.c (ddc1eded85352aaaea972947cbf133d0ded34d53)
1/*-
2 * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
3 * Copyright (c) 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Paul Borman at Krystal Technologies.
8 *

--- 60 unchanged lines hidden (view full) ---

69
70int
71_EUC_init(_RuneLocale *rl)
72{
73 _EucInfo *ei;
74 int x, new__mb_cur_max;
75 char *v, *e;
76
1/*-
2 * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
3 * Copyright (c) 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Paul Borman at Krystal Technologies.
8 *

--- 60 unchanged lines hidden (view full) ---

69
70int
71_EUC_init(_RuneLocale *rl)
72{
73 _EucInfo *ei;
74 int x, new__mb_cur_max;
75 char *v, *e;
76
77 if (rl->variable == NULL)
77 if (rl->__variable == NULL)
78 return (EFTYPE);
79
78 return (EFTYPE);
79
80 v = (char *)rl->variable;
80 v = (char *)rl->__variable;
81
82 while (*v == ' ' || *v == '\t')
83 ++v;
84
85 if ((ei = malloc(sizeof(_EucInfo))) == NULL)
86 return (errno == 0 ? ENOMEM : errno);
87
88 new__mb_cur_max = 0;

--- 15 unchanged lines hidden (view full) ---

104 while (*v == ' ' || *v == '\t')
105 ++v;
106 }
107 ei->mask = (int)strtol(v, &e, 0);
108 if (v == e || !(v = e)) {
109 free(ei);
110 return (EFTYPE);
111 }
81
82 while (*v == ' ' || *v == '\t')
83 ++v;
84
85 if ((ei = malloc(sizeof(_EucInfo))) == NULL)
86 return (errno == 0 ? ENOMEM : errno);
87
88 new__mb_cur_max = 0;

--- 15 unchanged lines hidden (view full) ---

104 while (*v == ' ' || *v == '\t')
105 ++v;
106 }
107 ei->mask = (int)strtol(v, &e, 0);
108 if (v == e || !(v = e)) {
109 free(ei);
110 return (EFTYPE);
111 }
112 rl->variable = ei;
113 rl->variable_len = sizeof(_EucInfo);
112 rl->__variable = ei;
113 rl->__variable_len = sizeof(_EucInfo);
114 _CurrentRuneLocale = rl;
115 __mb_cur_max = new__mb_cur_max;
116 __mbrtowc = _EUC_mbrtowc;
117 __wcrtomb = _EUC_wcrtomb;
118 __mbsinit = _EUC_mbsinit;
119 return (0);
120}
121
122int
123_EUC_mbsinit(const mbstate_t *ps)
124{
125
126 return (ps == NULL || ((const _EucState *)ps)->want == 0);
127}
128
114 _CurrentRuneLocale = rl;
115 __mb_cur_max = new__mb_cur_max;
116 __mbrtowc = _EUC_mbrtowc;
117 __wcrtomb = _EUC_wcrtomb;
118 __mbsinit = _EUC_mbsinit;
119 return (0);
120}
121
122int
123_EUC_mbsinit(const mbstate_t *ps)
124{
125
126 return (ps == NULL || ((const _EucState *)ps)->want == 0);
127}
128
129#define CEI ((_EucInfo *)(_CurrentRuneLocale->variable))
129#define CEI ((_EucInfo *)(_CurrentRuneLocale->__variable))
130
131#define _SS2 0x008e
132#define _SS3 0x008f
133
134#define GR_BITS 0x80808080 /* XXX: to be fixed */
135
136static __inline int
137_euc_set(u_int c)

--- 127 unchanged lines hidden ---
130
131#define _SS2 0x008e
132#define _SS3 0x008f
133
134#define GR_BITS 0x80808080 /* XXX: to be fixed */
135
136static __inline int
137_euc_set(u_int c)

--- 127 unchanged lines hidden ---