|
Aegis
4.25.D505
|
00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 1996-1999, 2001, 2002, 2004-2006, 2008, 2012 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or (at 00008 // your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #ifndef COMMON_AC_WCHAR_H 00020 #define COMMON_AC_WCHAR_H 00021 00022 #include <common/ac/stdarg.h> 00023 #include <common/ac/stddef.h> 00024 00025 #if HAVE_WCHAR_H 00026 #include <wchar.h> 00027 00028 #if !HAVE_WINT_T 00029 #define HAVE_WINT_T 1 00030 #ifndef _WINT_T 00031 #define _WINT_T 00032 typedef wchar_t wint_t; 00033 #endif 00034 #endif 00035 00036 #if !HAVE_MBSTATE_T 00037 #define HAVE_MBSTATE_T 1 00038 #ifndef _MBSTATE_T 00039 #define _MBSTATE_T 00040 typedef int mbstate_t; 00041 #endif 00042 #endif 00043 00044 #else 00045 00046 #include <common/ac/stddef.h> 00047 typedef int mbstate_t; 00048 #ifndef WEOF 00049 #define WEOF (wchar_t)(-1); 00050 #endif 00051 int mbsinit(const mbstate_t *); 00052 size_t wcslen(const wchar_t *); 00053 size_t mbrlen(const char *, size_t, mbstate_t *); 00054 size_t mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *); 00055 size_t wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *); 00056 00057 #endif 00058 00059 00060 #if !HAVE_DECL_WCWIDTH 00061 extern "C" { 00062 int wcwidth(wchar_t); 00063 } 00064 #endif 00065 00066 #if !HAVE_DECL_WCSWIDTH 00067 extern "C" { 00068 int wcswidth(const wchar_t *, size_t); 00069 } 00070 #endif 00071 00072 #if !HAVE_DECL_MBRTOWC 00073 extern "C" { 00074 size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *); 00075 } 00076 #endif 00077 00078 #if !HAVE_DECL_WCRTOMB 00079 extern "C" { 00080 size_t wcrtomb(char *, wchar_t, mbstate_t *); 00081 } 00082 #endif 00083 00084 // Solaris bug 1250837: include wchar.h before widec.h 00085 #if HAVE_WIDEC_H 00086 #include <widec.h> 00087 #endif 00088 00089 00090 // 00091 // HAVE_ISWPRINT is only set if (a) there is an iswprint function, 00092 // and (b) it works for ascii. It is assumed that if iswprint is absent 00093 // or brain-dead, then so are the rest. 00094 // 00095 // This code copes with the case where (a) it exists, (b) it is broken, 00096 // and (c) it is defined in <wchar.h>, of all places! 00097 // 00098 #if HAVE_ISWPRINT 00099 00100 #ifdef iswprint 00101 #undef iswprint 00102 #endif 00103 00104 #ifdef iswspace 00105 #undef iswspace 00106 #endif 00107 00108 #ifdef iswpunct 00109 #undef iswpunct 00110 #endif 00111 00112 #ifdef iswupper 00113 #undef iswupper 00114 #endif 00115 00116 #ifdef iswlower 00117 #undef iswlower 00118 #endif 00119 00120 #ifdef iswdigit 00121 #undef iswdigit 00122 #endif 00123 00124 #ifdef iswalnum 00125 #undef iswalnum 00126 #endif 00127 00128 #ifdef towupper 00129 #undef towupper 00130 #endif 00131 00132 #ifdef towlower 00133 #undef towlower 00134 #endif 00135 00136 #endif // !HAVE_ISWPRINT 00137 00138 // 00139 // The ANSI C standard states that wint_t symbol shall be defined by 00140 // <wchar.h> and <wctype.h>. The GNU people also define it in <stddef.h>, 00141 // but this is incorrect. 00142 // 00143 #ifndef HAVE_WINT_T 00144 #define HAVE_WINT_T 00145 typedef wchar_t wint_t; 00146 #endif 00147 00148 #endif // COMMON_AC_WCHAR_H 00149 // vim: set ts=8 sw=4 et :
1.7.6.1