PageRenderTime 38ms CodeModel.GetById 18ms app.highlight 17ms RepoModel.GetById 1ms app.codeStats 0ms

/src/core/stdc/wchar_.d

http://github.com/AlexeyProkhin/druntime
D | 133 lines | 98 code | 17 blank | 18 comment | 0 complexity | 836c9c9b809cc8c6ffb62a27263a608b MD5 | raw file
  1/**
  2 * D header file for C99.
  3 *
  4 * Copyright: Copyright Sean Kelly 2005 - 2009.
  5 * License:   <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
  6 * Authors:   Sean Kelly
  7 * Standards: ISO/IEC 9899:1999 (E)
  8 */
  9
 10/*          Copyright Sean Kelly 2005 - 2009.
 11 * Distributed under the Boost Software License, Version 1.0.
 12 *    (See accompanying file LICENSE or copy at
 13 *          http://www.boost.org/LICENSE_1_0.txt)
 14 */
 15module core.stdc.wchar_;
 16
 17private import core.stdc.config;
 18private import core.stdc.stdarg; // for va_list
 19private import core.stdc.stdio;  // for FILE, not exposed per spec
 20public import core.stdc.stddef;  // for size_t, wchar_t
 21public import core.stdc.time;    // for tm
 22public import core.stdc.stdint;  // for WCHAR_MIN, WCHAR_MAX
 23
 24extern (C):
 25@system:
 26nothrow:
 27
 28alias int     mbstate_t;
 29alias wchar_t wint_t;
 30
 31enum wchar_t WEOF = 0xFFFF;
 32
 33int fwprintf(FILE* stream, in wchar_t* format, ...);
 34int fwscanf(FILE* stream, in wchar_t* format, ...);
 35int swprintf(wchar_t* s, size_t n, in wchar_t* format, ...);
 36int swscanf(in wchar_t* s, in wchar_t* format, ...);
 37int vfwprintf(FILE* stream, in wchar_t* format, va_list arg);
 38int vfwscanf(FILE* stream, in wchar_t* format, va_list arg);
 39int vswprintf(wchar_t* s, size_t n, in wchar_t* format, va_list arg);
 40int vswscanf(in wchar_t* s, in wchar_t* format, va_list arg);
 41int vwprintf(in wchar_t* format, va_list arg);
 42int vwscanf(in wchar_t* format, va_list arg);
 43int wprintf(in wchar_t* format, ...);
 44int wscanf(in wchar_t* format, ...);
 45
 46// No unsafe pointer manipulation.
 47@trusted
 48{
 49    wint_t fgetwc(FILE* stream);
 50    wint_t fputwc(wchar_t c, FILE* stream);
 51}
 52
 53wchar_t* fgetws(wchar_t* s, int n, FILE* stream);
 54int      fputws(in wchar_t* s, FILE* stream);
 55
 56// No unsafe pointer manipulation.
 57extern (D) @trusted
 58{
 59    wint_t getwchar()                     { return fgetwc(stdin);     }
 60    wint_t putwchar(wchar_t c)            { return fputwc(c,stdout);  }
 61    wint_t getwc(FILE* stream)            { return fgetwc(stream);    }
 62    wint_t putwc(wchar_t c, FILE* stream) { return fputwc(c, stream); }
 63}
 64
 65// No unsafe pointer manipulation.
 66@trusted
 67{
 68    wint_t ungetwc(wint_t c, FILE* stream);
 69    version( Win64 )
 70    {
 71        // MSVC defines this as an inline function.
 72        int fwide(FILE* stream, int mode) { return mode; }
 73    }
 74    else
 75    {
 76        int    fwide(FILE* stream, int mode);
 77    }
 78}
 79
 80double  wcstod(in wchar_t* nptr, wchar_t** endptr);
 81float   wcstof(in wchar_t* nptr, wchar_t** endptr);
 82real    wcstold(in wchar_t* nptr, wchar_t** endptr);
 83c_long  wcstol(in wchar_t* nptr, wchar_t** endptr, int base);
 84long    wcstoll(in wchar_t* nptr, wchar_t** endptr, int base);
 85c_ulong wcstoul(in wchar_t* nptr, wchar_t** endptr, int base);
 86ulong   wcstoull(in wchar_t* nptr, wchar_t** endptr, int base);
 87
 88wchar_t* wcscpy(wchar_t* s1, in wchar_t* s2);
 89wchar_t* wcsncpy(wchar_t* s1, in wchar_t* s2, size_t n);
 90wchar_t* wcscat(wchar_t* s1, in wchar_t* s2);
 91wchar_t* wcsncat(wchar_t* s1, in wchar_t* s2, size_t n);
 92int      wcscmp(in wchar_t* s1, in wchar_t* s2);
 93int      wcscoll(in wchar_t* s1, in wchar_t* s2);
 94int      wcsncmp(in wchar_t* s1, in wchar_t* s2, size_t n);
 95size_t   wcsxfrm(wchar_t* s1, in wchar_t* s2, size_t n);
 96wchar_t* wcschr(in wchar_t* s, wchar_t c);
 97size_t   wcscspn(in wchar_t* s1, in wchar_t* s2);
 98wchar_t* wcspbrk(in wchar_t* s1, in wchar_t* s2);
 99wchar_t* wcsrchr(in wchar_t* s, wchar_t c);
100size_t   wcsspn(in wchar_t* s1, in wchar_t* s2);
101wchar_t* wcsstr(in wchar_t* s1, in wchar_t* s2);
102wchar_t* wcstok(wchar_t* s1, in wchar_t* s2, wchar_t** ptr);
103size_t   wcslen(in wchar_t* s);
104
105wchar_t* wmemchr(in wchar_t* s, wchar_t c, size_t n);
106int      wmemcmp(in wchar_t* s1, in wchar_t* s2, size_t n);
107wchar_t* wmemcpy(wchar_t* s1, in wchar_t* s2, size_t n);
108wchar_t* wmemmove(wchar_t*s1, in wchar_t* s2, size_t n);
109wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
110
111size_t wcsftime(wchar_t* s, size_t maxsize, in wchar_t* format, in tm* timeptr);
112
113version( Windows )
114{
115    wchar_t* _wasctime(tm*);      // non-standard
116    wchar_t* _wctime(time_t*);    // non-standard
117    wchar_t* _wstrdate(wchar_t*); // non-standard
118    wchar_t* _wstrtime(wchar_t*); // non-standard
119}
120
121// No unsafe pointer manipulation.
122@trusted
123{
124    wint_t btowc(int c);
125    int    wctob(wint_t c);
126}
127
128int    mbsinit(in mbstate_t* ps);
129size_t mbrlen(in char* s, size_t n, mbstate_t* ps);
130size_t mbrtowc(wchar_t* pwc, in char* s, size_t n, mbstate_t* ps);
131size_t wcrtomb(char* s, wchar_t wc, mbstate_t* ps);
132size_t mbsrtowcs(wchar_t* dst, in char** src, size_t len, mbstate_t* ps);
133size_t wcsrtombs(char* dst, in wchar_t** src, size_t len, mbstate_t* ps);