00001 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. 00002 00003 Copyright (C) 2007 Free Software Foundation, Inc. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU Lesser General Public License as published by 00007 the Free Software Foundation; either version 2.1, or (at your option) 00008 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 00013 GNU Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program; if not, write to the Free Software Foundation, 00017 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 00018 00019 /* Written by Eric Blake. */ 00020 00021 /* 00022 * ISO C 99 <wchar.h> for platforms that have issues. 00023 * <http://www.opengroup.org/susv3xbd/wchar.h.html> 00024 * 00025 * For now, this just ensures proper prerequisite inclusion order and 00026 * the declaration of wcwidth(). 00027 */ 00028 00029 #ifndef _GL_WCHAR_H 00030 00031 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 00032 <wchar.h>. 00033 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be 00034 included before <wchar.h>. */ 00035 #include <stddef.h> 00036 #include <stdio.h> 00037 #include <time.h> 00038 00039 /* Include the original <wchar.h> if it exists. 00040 Some builds of uClibc lack it. */ 00041 /* The include_next requires a split double-inclusion guard. */ 00042 #if @HAVE_WCHAR_H@ 00043 # @INCLUDE_NEXT@ @NEXT_WCHAR_H@ 00044 #endif 00045 00046 #ifndef _GL_WCHAR_H 00047 #define _GL_WCHAR_H 00048 00049 /* The definition of GL_LINK_WARNING is copied here. */ 00050 00051 #ifdef __cplusplus 00052 extern "C" { 00053 #endif 00054 00055 00056 /* Return the number of screen columns needed for WC. */ 00057 #if @GNULIB_WCWIDTH@ 00058 # if @REPLACE_WCWIDTH@ 00059 # undef wcwidth 00060 # define wcwidth rpl_wcwidth 00061 extern int wcwidth (wchar_t); 00062 # else 00063 # if !defined wcwidth && !@HAVE_DECL_WCWIDTH@ 00064 /* wcwidth exists but is not declared. */ 00065 extern int wcwidth (int /* actually wchar_t */); 00066 # endif 00067 # endif 00068 #elif defined GNULIB_POSIXCHECK 00069 # undef wcwidth 00070 # define wcwidth(w) \ 00071 (GL_LINK_WARNING ("wcwidth is unportable - " \ 00072 "use gnulib module wcwidth for portability"), \ 00073 wcwidth (w)) 00074 #endif 00075 00076 00077 #ifdef __cplusplus 00078 } 00079 #endif 00080 00081 #endif /* _GL_WCHAR_H */ 00082 #endif /* _GL_WCHAR_H */