Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>

*** 1,6 **** --- 1,7 ---- /* + * Copyright 2013 Garrett D'Amore <garrett@damore.org> * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved. * * ja_JP.SJIS locale table for BSD4.4/rune * version 1.0
*** 35,72 **** */ #include "lint.h" #include <sys/types.h> #include <errno.h> - #include "runetype.h" #include <stdlib.h> #include <string.h> #include <wchar.h> #include "mblocal.h" static size_t _MSKanji_mbrtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD); static int _MSKanji_mbsinit(const mbstate_t *); static size_t _MSKanji_wcrtomb(char *_RESTRICT_KYWD, wchar_t, mbstate_t *_RESTRICT_KYWD); typedef struct { wchar_t ch; } _MSKanjiState; ! int ! _MSKanji_init(_RuneLocale *rl) { ! __mbrtowc = _MSKanji_mbrtowc; ! __wcrtomb = _MSKanji_wcrtomb; ! __mbsinit = _MSKanji_mbsinit; ! _CurrentRuneLocale = rl; ! __ctype[520] = 2; ! charset_is_ascii = 0; ! return (0); } static int _MSKanji_mbsinit(const mbstate_t *ps) { --- 36,79 ---- */ #include "lint.h" #include <sys/types.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <wchar.h> #include "mblocal.h" + #include "lctype.h" static size_t _MSKanji_mbrtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD); static int _MSKanji_mbsinit(const mbstate_t *); static size_t _MSKanji_wcrtomb(char *_RESTRICT_KYWD, wchar_t, mbstate_t *_RESTRICT_KYWD); + static size_t _MSKanji_mbsnrtowcs(wchar_t *_RESTRICT_KYWD, + const char **_RESTRICT_KYWD, size_t, size_t, + mbstate_t *_RESTRICT_KYWD); + static size_t _MSKanji_wcsnrtombs(char *_RESTRICT_KYWD, + const wchar_t **_RESTRICT_KYWD, size_t, size_t, + mbstate_t *_RESTRICT_KYWD); typedef struct { wchar_t ch; } _MSKanjiState; ! void ! _MSKanji_init(struct lc_ctype *lct) { ! lct->lc_mbrtowc = _MSKanji_mbrtowc; ! lct->lc_wcrtomb = _MSKanji_wcrtomb; ! lct->lc_mbsnrtowcs = _MSKanji_mbsnrtowcs; ! lct->lc_wcsnrtombs = _MSKanji_wcsnrtombs; ! lct->lc_mbsinit = _MSKanji_mbsinit; ! lct->lc_max_mblen = 2; ! lct->lc_is_ascii = 0; } static int _MSKanji_mbsinit(const mbstate_t *ps) {
*** 151,156 **** --- 158,179 ---- return (1); len = (wc > 0x100) ? 2 : 1; for (i = len; i-- > 0; ) *s++ = wc >> (i << 3); return (len); + } + + static size_t + _MSKanji_mbsnrtowcs(wchar_t *_RESTRICT_KYWD dst, + const char **_RESTRICT_KYWD src, size_t nms, + size_t len, mbstate_t *_RESTRICT_KYWD ps) + { + return (__mbsnrtowcs_std(dst, src, nms, len, ps, _MSKanji_mbrtowc)); + } + + static size_t + _MSKanji_wcsnrtombs(char *_RESTRICT_KYWD dst, + const wchar_t **_RESTRICT_KYWD src, size_t nwc, + size_t len, mbstate_t *_RESTRICT_KYWD ps) + { + return (__wcsnrtombs_std(dst, src, nwc, len, ps, _MSKanji_wcrtomb)); }