summaryrefslogtreecommitdiff
path: root/lib/wchar.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-02-06 15:51:55 +0100
committerBruno Haible <bruno@clisp.org>2011-02-07 23:36:08 +0100
commitcbe8a0a3fe09047b99e5c0cfb67f45634d036487 (patch)
tree1d601d5061599d1be1f1a34e469477dd8ee053b3 /lib/wchar.in.h
parentcdddb1e1f27b899a9580d3ad289539c3c124d045 (diff)
downloadgnulib-cbe8a0a3fe09047b99e5c0cfb67f45634d036487.tar.gz
New module 'wcswidth'.
* modules/wcswidth: New file. * lib/wchar.in.h (wcswidth): New declaration. * lib/wcswidth.c: New file. * lib/wcswidth-impl.h: New file, from libutf8 with modifications. * m4/wcswidth.m4: New file. * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcswidth is declared. (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSWIDTH, HAVE_WCSWIDTH, REPLACE_WCSWIDTH. * modules/wchar (Makefile.am): Substitute GNULIB_WCSWIDTH, HAVE_WCSWIDTH, REPLACE_WCSWIDTH. * tests/test-wchar-c++.cc: Test the declaration of wcswidth. * doc/posix-functions/wcswidth.texi: Mention the new module.
Diffstat (limited to 'lib/wchar.in.h')
-rw-r--r--lib/wchar.in.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 13e4d7fed5..e2010a8c0e 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -891,6 +891,32 @@ _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
#endif
+/* Determine number of column positions required for first N wide
+ characters (or fewer if S ends before this) in S. */
+#if @GNULIB_WCSWIDTH@
+# if @REPLACE_WCSWIDTH@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef wcswidth
+# define wcswidth rpl_wcswidth
+# endif
+_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n));
+_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
+# else
+# if !@HAVE_WCSWIDTH@
+_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
+# endif
+_GL_CXXALIASWARN (wcswidth);
+#elif defined GNULIB_POSIXCHECK
+# undef wcswidth
+# if HAVE_RAW_DECL_WCSWIDTH
+_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
+ "use gnulib module wcswidth for portability");
+# endif
+#endif
+
+
#endif /* _GL_WCHAR_H */
#endif /* _GL_WCHAR_H */
#endif