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