changeset 912:e10cdc51a200

[xemacs-hg @ 2002-07-09 11:58:12 by michaels] 2002-07-08 Mike Sperber <mike@xemacs.org> * text.h: Only include wchar.h if we have it; define wcslen prototype if we don't. * config.h.in: Add stub for HAVE_WCHAR_H. * sysdep.c (wcslen): Added definition for systems which don't have it.
author michaels
date Tue, 09 Jul 2002 11:58:12 +0000
parents 428608d46017
children 89db3de0165d
files src/config.h.in src/sysdep.c src/text.h
diffstat 3 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/config.h.in	Tue Jul 09 11:57:49 2002 +0000
+++ b/src/config.h.in	Tue Jul 09 11:58:12 2002 +0000
@@ -242,6 +242,7 @@
 #undef HAVE_INTTYPES_H
 #undef HAVE_LIBGEN_H
 #undef HAVE_LOCALE_H
+#undef HAVE_WCHAR_H
 #undef HAVE_MACH_MACH_H
 #undef HAVE_SYS_PARAM_H
 #undef HAVE_SYS_PSTAT_H
--- a/src/sysdep.c	Tue Jul 09 11:57:49 2002 +0000
+++ b/src/sysdep.c	Tue Jul 09 11:58:12 2002 +0000
@@ -3328,6 +3328,23 @@
   return ctime_static;
 }
 
+/************************************************************************/
+/*                  Emulation of missing functions from wchar.h         */
+/************************************************************************/
+
+#ifndef HAVE_WCHAR_H
+size_t
+wcslen(const wchar_t *s)
+{
+  const wchar_t *p = s;
+
+  while (*p++)
+    ;
+  
+  return p - s;
+}
+#endif
+
 
 /************************************************************************/
 /*                  Emulations of missing system calls                  */
--- a/src/text.h	Tue Jul 09 11:57:49 2002 +0000
+++ b/src/text.h	Tue Jul 09 11:58:12 2002 +0000
@@ -33,7 +33,11 @@
 #ifndef INCLUDED_text_h_
 #define INCLUDED_text_h_
 
+#ifdef HAVE_WCHAR_H
 #include <wchar.h>
+#else
+size_t wcslen(const wchar_t *);
+#endif
 
 /* ---------------------------------------------------------------------- */
 /*                     Super-basic character properties                   */