--- /home/derhally/home/xml-xerces/c/src/xercesc/util/Compilers/CodeWarriorDefs.cpp	Thu Aug 22 23:23:54 2002
+++ CodeWarriorDefs.cpp	Mon Nov  4 14:49:01 2002
@@ -60,6 +60,8 @@
 
 #include <xercesc/util/XercesDefs.hpp>
 #include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
 
 // These functions are needed because MacOS doesn't define them
 //	(these routines are defined in CW 8 by extras.h, but there is no MachO
@@ -94,6 +96,73 @@
         if (!c1) return 0;
     }
     return 0;
+}
+#endif
+
+
+#if __MWERKS__
+int mbswcslen(const char * s, const unsigned int n)
+{
+	int     result;
+	char *  source;
+	int count = -1;
+	size_t  source_len;
+	
+	source_len = strlen(s);
+
+    source      = (char *)s;
+    
+    for (count = 0; count < n; count++)
+    {
+    	if (*source)
+    	{
+        	result = mbtowc(0, source, source_len);
+        	if (result > 0)
+        	{
+        		source += result;
+        		source_len -= result;
+        	}
+        	else
+        		return((size_t)-1);								/*- mm 011102 -*/
+        }
+        else
+        	break;
+    }
+
+	return(count);
+}
+
+int wcsmbslen(const wchar_t * pwcs, const unsigned int n)
+{
+	int     count = 0;
+	int     result;
+	wchar_t * source;
+	char    temp[3];
+	
+	if (!pwcs)
+		return (0);
+	
+	source = (wchar_t*)pwcs;
+	
+	while(count <= n)
+	{
+		if (!*source)
+		{
+			break;
+		}
+		else
+		{
+			result = wctomb(temp, *source++);
+			if ((count + result) <= n)
+			{
+				count += result;
+			}
+			else
+				break;
+		}
+	}
+			
+	return(count);
 }
 #endif
 
