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 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2002-2004 Tim J. Robbins * All rights reserved. * * Redistribution and use in source and binary forms, with or without
*** 26,40 **** */ #include "lint.h" #include <errno.h> #include <limits.h> - #include "runetype.h" #include <stdlib.h> #include <string.h> #include <wchar.h> #include "mblocal.h" static size_t _UTF8_mbrtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD); static int _UTF8_mbsinit(const mbstate_t *); --- 27,41 ---- */ #include "lint.h" #include <errno.h> #include <limits.h> #include <stdlib.h> #include <string.h> #include <wchar.h> #include "mblocal.h" + #include "lctype.h" static size_t _UTF8_mbrtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD); static int _UTF8_mbsinit(const mbstate_t *);
*** 51,83 **** wchar_t ch; int want; wchar_t lbound; } _UTF8State; ! int ! _UTF8_init(_RuneLocale *rl) { ! __mbrtowc = _UTF8_mbrtowc; ! __wcrtomb = _UTF8_wcrtomb; ! __mbsinit = _UTF8_mbsinit; ! __mbsnrtowcs = _UTF8_mbsnrtowcs; ! __wcsnrtombs = _UTF8_wcsnrtombs; ! _CurrentRuneLocale = rl; ! ! charset_is_ascii = 0; ! ! /* ! * In theory up to 6 bytes can be used for the encoding, ! * but only encodings with more than 4 bytes are illegal. ! */ ! __ctype[520] = 4; ! /* ! * Note that the other CSWIDTH members are nonsensical for this ! * this coding. They only are valid with EUC codings. ! */ ! ! return (0); } static int _UTF8_mbsinit(const mbstate_t *ps) { --- 52,71 ---- wchar_t ch; int want; wchar_t lbound; } _UTF8State; ! void ! _UTF8_init(struct lc_ctype *lct) { ! lct->lc_mbrtowc = _UTF8_mbrtowc; ! lct->lc_wcrtomb = _UTF8_wcrtomb; ! lct->lc_mbsinit = _UTF8_mbsinit; ! lct->lc_mbsnrtowcs = _UTF8_mbsnrtowcs; ! lct->lc_wcsnrtombs = _UTF8_wcsnrtombs; ! lct->lc_is_ascii = 0; ! lct->lc_max_mblen = 4; } static int _UTF8_mbsinit(const mbstate_t *ps) {