summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-07-07 20:59:43 +0000
committerBruno Haible <bruno@clisp.org>2007-07-07 20:59:43 +0000
commit9e8ce574adfade2243a6141a1655addb92512aeb (patch)
treeae69237c8ec13f45fafca1d87b77c978d7f61ffc /lib
parent5407ddca850d0472f06fa0ef4ec8042e9353d25e (diff)
downloadgnulib-9e8ce574adfade2243a6141a1655addb92512aeb.tar.gz
Remove the wcwidth.h file. Move wcwidth's declaration to wchar_.h.
Diffstat (limited to 'lib')
-rw-r--r--lib/mbchar.h4
-rw-r--r--lib/mbswidth.c5
-rw-r--r--lib/wchar_.h35
-rw-r--r--lib/wcwidth.c2
-rw-r--r--lib/wcwidth.h50
5 files changed, 37 insertions, 59 deletions
diff --git a/lib/mbchar.h b/lib/mbchar.h
index f3e28ef5ca..213d425679 100644
--- a/lib/mbchar.h
+++ b/lib/mbchar.h
@@ -1,5 +1,5 @@
/* Multibyte character data type.
- Copyright (C) 2001, 2005-2006 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -157,8 +157,6 @@
#include <wchar.h>
#include <wctype.h>
-#include "wcwidth.h"
-
#define MBCHAR_BUF_SIZE 24
struct mbchar
diff --git a/lib/mbswidth.c b/lib/mbswidth.c
index 0bc1a682c1..012576ed25 100644
--- a/lib/mbswidth.c
+++ b/lib/mbswidth.c
@@ -30,12 +30,9 @@
/* Get isprint(). */
#include <ctype.h>
-/* Get mbstate_t, mbrtowc(), mbsinit(). */
+/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */
#include <wchar.h>
-/* Get wcwidth(). */
-#include "wcwidth.h"
-
/* Get iswcntrl(). */
#include <wctype.h>
diff --git a/lib/wchar_.h b/lib/wchar_.h
index 1d52b1dd1d..924a3382d3 100644
--- a/lib/wchar_.h
+++ b/lib/wchar_.h
@@ -22,7 +22,8 @@
* ISO C 99 <wchar.h> for platforms that have issues.
* <http://www.opengroup.org/susv3xbd/wchar.h.html>
*
- * For now, this just ensures proper prerequisite inclusion order.
+ * For now, this just ensures proper prerequisite inclusion order and
+ * the declaration of wcwidth().
*/
#ifndef _GL_WCHAR_H
@@ -45,5 +46,37 @@
#ifndef _GL_WCHAR_H
#define _GL_WCHAR_H
+/* The definition of GL_LINK_WARNING is copied here. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Return the number of screen columns needed for WC. */
+#if @GNULIB_WCWIDTH@
+# if @REPLACE_WCWIDTH@
+# undef wcwidth
+# define wcwidth rpl_wcwidth
+extern int wcwidth (wchar_t);
+# else
+# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@
+/* wcwidth exists but is not declared. */
+extern int wcwidth (int /* actually wchar_t */);
+# endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcwidth
+# define wcwidth(w) \
+ (GL_LINK_WARNING ("wcwidth is unportable - " \
+ "use gnulib module wcwidth for portability"), \
+ wcwidth (w))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _GL_WCHAR_H */
#endif /* _GL_WCHAR_H */
diff --git a/lib/wcwidth.c b/lib/wcwidth.c
index 6317083435..57fb0a467b 100644
--- a/lib/wcwidth.c
+++ b/lib/wcwidth.c
@@ -18,7 +18,7 @@
#include <config.h>
/* Specification. */
-#include "wcwidth.h"
+#include <wchar.h>
/* Get iswprint. */
#include <wctype.h>
diff --git a/lib/wcwidth.h b/lib/wcwidth.h
deleted file mode 100644
index 8294458084..0000000000
--- a/lib/wcwidth.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Determine the number of screen columns needed for a character.
- Copyright (C) 2006, 2007 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _gl_WCWIDTH_H
-#define _gl_WCWIDTH_H
-
-#if HAVE_WCHAR_T
-
-/* Get wcwidth if available, along with wchar_t. */
-# include <wchar.h>
-
-# ifndef HAVE_DECL_WCWIDTH
-"this configure-time declaration test was not run"
-# endif
-# ifndef wcwidth
-# if !HAVE_WCWIDTH
-
-/* Defined by gnulib. */
-# define wcwidth rpl_wcwidth
-extern int wcwidth (wchar_t);
-
-# elif !HAVE_DECL_WCWIDTH
-
-/* wcwidth exists but is not declared. */
-extern
-# ifdef __cplusplus
-"C"
-# endif
-int wcwidth (int /* actually wchar_t */);
-
-# endif
-# endif
-
-#endif /* HAVE_WCHAR_T */
-
-#endif /* _gl_WCWIDTH_H */