[uClibc-cvs] CVS uClibc++/include

CVS User gkajmowi gkajmowi at codepoet.org
Sun Jan 23 18:58:19 UTC 2005


Update of /var/cvs/uClibc++/include
In directory nail:/tmp/cvs-serv8303/include

Modified Files:
	char_traits cwchar cwctype fstream ios iosfwd iostream istream 
	locale ostream string string_iostream 
Log Message:
Basic support for wchar functions/parameters has been done successfully.

--- /var/cvs/uClibc++/include/char_traits	2005/01/10 20:24:43	1.5
+++ /var/cvs/uClibc++/include/char_traits	2005/01/23 18:58:13	1.6
@@ -22,10 +22,8 @@
 #include <memory>
 
 #ifdef __UCLIBCXX_HAS_WCHAR__
-#include <wchar.h>
-#ifdef __UCLIBCXX_HAS_WCTYPE_H
-#include <wctype.h>
-#endif
+#include <cwchar>
+#include <cwctype>
 #endif
 
 #ifndef __HEADER_CHAR_TRAITS
@@ -132,6 +130,22 @@
 		typedef mbstate_t state_type;
 
 		static void assign(char_type & c, char_type & d){ c=d; }
+
+		static char_type to_char_type(const int_type & i){
+			return i;
+		}
+
+		static int_type to_int_type(const char_type & c){
+			return c;
+		}
+
+		inline static bool eq_int_type(const int_type & a, const int_type & b){
+			if(a==b){
+				return true;
+			}
+			return false;
+		}
+
 		inline static bool eq(const char_type& c1, const char_type& c2){
 			if(wcsncmp(&c1, &c2, 1) == 0){
 				return true;
@@ -177,7 +191,7 @@
 				return i;
 			}
 		}
-		static state_type get_state(pos_type p){
+		static state_type get_state(pos_type){
 			state_type a;
 			return a;
 		}
--- /var/cvs/uClibc++/include/cwchar	2005/01/10 20:24:43	1.2
+++ /var/cvs/uClibc++/include/cwchar	2005/01/23 18:58:13	1.3
@@ -46,7 +46,7 @@
 
 #pragma GCC system_header
 
-#include <bits/c++config.h>
+//#include <bits/c++config.h>
 #include <cstddef>
 #include <ctime>
 
@@ -56,7 +56,7 @@
 
 // Need to do a bit of trickery here with mbstate_t as char_traits
 // assumes it is in wchar.h, regardless of wchar_t specializations.
-#ifndef _GLIBCPP_HAVE_MBSTATE_T
+#ifndef __mbstate_t_defined
 extern "C" 
 {
   typedef struct 
--- /var/cvs/uClibc++/include/cwctype	2005/01/10 20:24:43	1.2
+++ /var/cvs/uClibc++/include/cwctype	2005/01/23 18:58:13	1.3
@@ -46,13 +46,11 @@
 
 #pragma GCC system_header
 
-#include <bits/c++config.h>
+//#include <bits/c++config.h>
 
 #ifdef __UCLIBCXX_HAS_WCHAR__
-#ifdef __UCLIBCXX_HAS_WCTYPE_H
 #include <wctype.h>
 #endif
-#endif
 
 // Get rid of those macros defined in <wctype.h> in lieu of real functions.
 #undef iswalnum
--- /var/cvs/uClibc++/include/fstream	2005/01/22 00:42:56	1.16
+++ /var/cvs/uClibc++/include/fstream	2005/01/23 18:58:13	1.17
@@ -18,14 +18,11 @@
 
 #include<basic_definitions>
 
-#include <iosfwd>
 #include <cstdio>
 #include <cstdlib>
-#include <ios>
 #include <streambuf>
 #include <istream>
 #include <ostream>
-#include <errno.h>
 
 #ifndef __STD_HEADER_FSTREAM 
 #define __STD_HEADER_FSTREAM 1
--- /var/cvs/uClibc++/include/ios	2005/01/06 18:03:05	1.11
+++ /var/cvs/uClibc++/include/ios	2005/01/23 18:58:14	1.12
@@ -18,18 +18,14 @@
 */
 
 #include <basic_definitions>
-#include <exception>
+#include <cstddef>
 #include <locale>
-#include <memory>
-#include <string>
 #include <iosfwd>
-#include <cstdio>
 
-#ifndef HEADER_STD_IOS
-#define HEADER_STD_IOS 1
+#ifndef __HEADER_STD_IOS
+#define __HEADER_STD_IOS 1
 
 namespace std{
-//	typedef OFF_T streamoff;
 	template <class stateT> class fpos;
 
 	class ios_base {
@@ -101,9 +97,6 @@
 
 		fmtflags setf(fmtflags fmtfl);
 		fmtflags setf(fmtflags fmtfl, fmtflags mask ){
-//			fmtflags temp = mformat;
-//			mformat = (mformat& (~mask)) | (fmtfl & mask);
-//			return temp;
 			return flags( (flags()& ~mask) | (fmtfl & mask));
 		}
 
@@ -369,13 +362,10 @@
 			return temp;
 		}
 
-
 		locale imbue(const locale& loc);
 		char narrow(char_type c, char dfault) const;
-		char_type widen(char c) const{
-//			return use_facet< ctype<char_type> >(getloc()).widen(c);
-			return c;
-		}
+		char_type widen(char c) const;
+
 	protected:
 		char_type fill_char;
 		basic_ostream<charT,traits>* mtied;
@@ -389,6 +379,50 @@
 		}
 	};
 
+	template <class charT, class traits>
+		inline char basic_ios<charT, traits>::narrow(char_type c, char dfault) const
+	{
+		return dfault;
+	}
+
+	template <>
+		inline char basic_ios<char, char_traits<char> >::narrow(char_type c, char) const
+	{
+		return c;
+	}
+
+	template <>
+		inline char basic_ios<wchar_t, char_traits<wchar_t> >::narrow(char_type c, char dfault) const
+	{
+		char retval = wctob (c);
+		if(retval == EOF){
+			retval = dfault;
+		}
+		return retval;
+	}
+
+	template <class charT, class traits> 
+		inline typename basic_ios<charT, traits>::char_type
+		basic_ios<charT, traits>::widen(char c) const
+	{
+		return c;
+	}
+
+	template <> 
+		inline basic_ios<char, char_traits<char> >::char_type
+		basic_ios<char, char_traits<char> >::widen(char c) const
+	{
+		return c;
+	}
+
+	template <> 
+		inline basic_ios<wchar_t, char_traits<wchar_t> >::char_type
+		basic_ios<wchar_t, char_traits<wchar_t> >::widen(char c) const
+	{
+		return btowc(c);
+	}
+
+
 
 	template <class stateT> class fpos{
 	public:
--- /var/cvs/uClibc++/include/iosfwd	2004/09/01 16:39:31	1.4
+++ /var/cvs/uClibc++/include/iosfwd	2005/01/23 18:58:14	1.5
@@ -22,8 +22,8 @@
 #include <memory>
 
 
-#ifndef HEADER_STD_IOSFWD
-#define HEADER_STD_IOSFWD 1
+#ifndef __HEADER_STD_IOSFWD
+#define __HEADER_STD_IOSFWD 1
 
 namespace std {
 	class ios_base;
--- /var/cvs/uClibc++/include/iostream	2004/12/18 22:00:45	1.5
+++ /var/cvs/uClibc++/include/iostream	2005/01/23 18:58:14	1.6
@@ -19,8 +19,8 @@
 
 #include <basic_definitions>
 
-#ifndef HEADER_STD_IOSTREAM
-#define HEADER_STD_IOSTREAM 1
+#ifndef __HEADER_STD_IOSTREAM
+#define __HEADER_STD_IOSTREAM 1
 
 #include <iosfwd>
 #include <ios>
@@ -39,18 +39,19 @@
 #ifdef __UCLIBCXX_SUPPORT_CERR__
 	extern ostream cerr;
 #endif
+#ifdef __UCLIBCXX_SUPPORT_CLOG__
 	extern ostream clog;
-
-#ifdef __UCLIBCXX_HAS_WCHAR__
-#ifdef __UCLIBCXX_SUPPORT_CIN__
+#endif
+#ifdef __UCLIBCXX_SUPPORT_WCIN__
 	extern wistream wcin;
 #endif
-#ifdef __UCLIBCXX_SUPPORT_COUT__
+#ifdef __UCLIBCXX_SUPPORT_WCOUT__
 	extern wostream wcout;
 #endif
-#ifdef __UCLIBCXX_SUPPORT_CERR__
+#ifdef __UCLIBCXX_SUPPORT_WCERR__
 	extern wostream wcerr;
 #endif
+#ifdef __UCLIBCXX_SUPPORT_WCLOG__
 	extern wostream wclog;
 #endif
 
--- /var/cvs/uClibc++/include/istream	2005/01/08 17:49:52	1.11
+++ /var/cvs/uClibc++/include/istream	2005/01/23 18:58:14	1.12
@@ -19,7 +19,6 @@
 
 #include <ios>
 #include <cctype>
-//#include <string>
 #include <streambuf>
 #include <istream_helpers>
 #include <ostream>
--- /var/cvs/uClibc++/include/locale	2004/12/18 22:00:45	1.3
+++ /var/cvs/uClibc++/include/locale	2005/01/23 18:58:14	1.4
@@ -18,14 +18,10 @@
 */
 
 #include <basic_definitions>
-#include <memory>
-#include <iterator>
-#include <exception>
+#include <cstddef>
 
-#ifndef HEADER_STD_LOCALE
-#define HEADER_STD_LOCALE 1
-
-#include <iosfwd>
+#ifndef __HEADER_STD_LOCALE
+#define __HEADER_STD_LOCALE 1
 
 namespace std{
 	class locale {
--- /var/cvs/uClibc++/include/ostream	2005/01/03 16:28:46	1.7
+++ /var/cvs/uClibc++/include/ostream	2005/01/23 18:58:14	1.8
@@ -316,7 +316,7 @@
 	
 	template<class charT, class traits> basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out, const char* c){
 		typename basic_ostream<charT,traits>::sentry s(out);
-		out.write(c, traits::length(c) );
+		out.write(c, char_traits<char>::length(c) );
 		return out;
 	}
 
@@ -327,6 +327,18 @@
 		return out;
 	}
 
+	template<class traits> basic_ostream<wchar_t,traits>& operator<<(basic_ostream<wchar_t,traits>& out, const char* c){
+		typename basic_ostream<wchar_t, traits>::sentry s(out);
+		size_t numChars = char_traits<char>::length(c);
+		wchar_t * temp = new wchar_t[numChars];
+
+		for(size_t i=0; i < numChars; ++i){
+			temp[i] = out.widen(c[i]);
+		}
+
+		out.write(temp, numChars);
+		return out;
+	}
     
     //  signed and unsigned
 	template<class traits> basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, const signed char* c){
@@ -342,14 +354,14 @@
 	}
 
 	template <class charT, class traits> basic_ostream<charT,traits>& endl(basic_ostream<charT,traits>& os){
-		typename basic_ostream<char,traits>::sentry s(os);
+		typename basic_ostream<charT,traits>::sentry s(os);
 		os.put('\n');
 		os.flush();
 		return os;
 	}
 
 	template <class charT, class traits> basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os){
-		typename basic_ostream<char,traits>::sentry s(os);
+		typename basic_ostream<charT,traits>::sentry s(os);
 		os.flush();
 		return os;
 	}
--- /var/cvs/uClibc++/include/string	2005/01/22 00:42:57	1.19
+++ /var/cvs/uClibc++/include/string	2005/01/23 18:58:14	1.20
@@ -20,17 +20,14 @@
 #include <basic_definitions>
 #include <char_traits>
 #include <string.h>
-#include <exception>
 #include <func_exception>
 #include <memory>
 #include <vector>
 
 
 #ifdef __UCLIBCXX_HAS_WCHAR__
-#include <wchar.h>
-#ifdef __UCLIBCXX_HAS_WCTYPE_H
-#include <wctype.h>
-#endif
+#include <cwchar>
+#include <cwctype>
 #endif
 
 #ifndef __HEADER_STD_STRING
--- /var/cvs/uClibc++/include/string_iostream	2005/01/14 23:57:30	1.4
+++ /var/cvs/uClibc++/include/string_iostream	2005/01/23 18:58:15	1.5
@@ -22,10 +22,8 @@
 #include <string>
 
 #ifdef __UCLIBCXX_HAS_WCHAR__
-#include <wchar.h>
-#ifdef __UCLIBCXX_HAS_WCTYPE_H
-#include <wctype.h>
-#endif
+#include <cwchar>
+#include <cwctype>
 #endif
 
 #ifndef __HEADER_STD_STRING_IOSTREAM



More information about the uClibc-cvs mailing list