+
+ // It is not clear that __from < __from_end implies __ret != ok
+ // (see DR 382).
+ if (__ret == ok && __from < __from_end)
+ __ret = partial;
+
+ __from_next = __from;
+ __to_next = __to;
+ return __ret;
+ }
+
+ int
+ codecvt<wchar_t, char, mbstate_t>::
+ do_encoding() const throw()
+ {
+ // XXX This implementation assumes that the encoding is
+ // stateless and is either single-byte or variable-width.
+ int __ret = 0;
+ if (MB_CUR_MAX == 1)
+ __ret = 1;
+ return __ret;
+ }
+
+ int
+ codecvt<wchar_t, char, mbstate_t>::
+ do_max_length() const throw()
+ {
+ // XXX Probably wrong for stateful encodings.
+ int __ret = MB_CUR_MAX;
+ return __ret;
+ }
+
+ int
+ codecvt<wchar_t, char, mbstate_t>::
+ do_length(state_type& __state, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ {
+ int __ret = 0;
+ state_type __tmp_state(__state);
+
+ while (__from < __end && __max)