On Sun, Jul 29, 2007 at 06:15:53PM +0200, Enrico Forestieri wrote:
> On Sun, Jul 29, 2007 at 05:17:39PM +0200, Stefan Schimanski wrote:
>
> > > Hmm, I doubt that this is the same case as I think that the Mac has
> > > proper support for wchar_t, hasn't it?
> > >
> > > My problem is due to the following line in InsetMathNest.cpp:
> > >
> > > is >> m >> n >> v_align >> h_align;
> > >
> > > where 'is' is an idocstringstream. The extraction fails because 'm'
> > > and 'n' (number of rows and columns, respectively) are 'unsigned int'
> > > and only a facet for 'int' is currently implemented.
> > >
> >
> > It's exactly what I found in the debugger on mac. This call gives n=1
> > and m=1, everytime.
>
> Doh! Seems that the Mac also needs using our custom facets. Please try
> the attached patch and let me know if it works. You'll have to recompile
> lyx pratically from scratch, sorry for that.
Hmpf... better use this one, I goofed (__APPLE_ vs __APPLE__).
--
Enrico
Index: src/support/docstring.cpp
===================================================================
--- src/support/docstring.cpp (revision 19230)
+++ src/support/docstring.cpp (working copy)
@@ -560,19 +560,56 @@ public:
string_num_get_facet() : std::num_get<char,
std::basic_string<char>::iterator>(1) {}
};
-private:
- bool isNumpunct(lyx::char_type const c) const
+protected:
+ iter_type
+ do_get(iter_type iit, iter_type eit, std::ios_base & b,
+ std::ios_base::iostate & err, long & v) const
{
- /// Only account for the standard numpunct "C" locale facet.
- return c < 0x80 && (c == '-' || c == '+' || isdigit(c)
- || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')
- || c == 'x' || c == 'X');
+ return do_get_helper(iit, eit, b, err, v);
}
-protected:
iter_type
do_get(iter_type iit, iter_type eit, std::ios_base & b,
- std::ios_base::iostate & err, long & v) const
+ std::ios_base::iostate & err, unsigned short & v) const
+ {
+ return do_get_helper(iit, eit, b, err, v);
+ }
+
+ iter_type
+ do_get(iter_type iit, iter_type eit, std::ios_base & b,
+ std::ios_base::iostate & err, unsigned int & v) const
+ {
+ return do_get_helper(iit, eit, b, err, v);
+ }
+
+ iter_type
+ do_get(iter_type iit, iter_type eit, std::ios_base & b,
+ std::ios_base::iostate & err, unsigned long & v) const
+ {
+ return do_get_helper(iit, eit, b, err, v);
+ }
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ iter_type
+ do_get(iter_type iit, iter_type eit, std::ios_base & b,
+ std::ios_base::iostate & err, long long & v) const
+ {
+ return do_get_helper(iit, eit, b, err, v);
+ }
+
+ iter_type
+ do_get(iter_type iit, iter_type eit, std::ios_base & b,
+ std::ios_base::iostate & err, unsigned long long & v) const
+ {
+ return do_get_helper(iit, eit, b, err, v);
+ }
+#endif
+
+private:
+ template <typename ValueType>
+ iter_type
+ do_get_helper(iter_type iit, iter_type eit, std::ios_base & b,
+ std::ios_base::iostate & err, ValueType & v) const
{
std::string s;
s.reserve(64);
@@ -588,6 +625,14 @@ protected:
return iit;
}
+
+ bool isNumpunct(lyx::char_type const c) const
+ {
+ /// Only account for the standard numpunct "C" locale facet.
+ return c < 0x80 && (c == '-' || c == '+' || isdigit(c)
+ || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')
+ || c == 'x' || c == 'X');
+ }
};
Index: configure.ac
===================================================================
--- configure.ac (revision 19230)
+++ configure.ac (working copy)
@@ -393,7 +393,7 @@ int mkstemp(char*);
* implements this with the help of libc, or whether it has own code
* does not matter for us, because we don't use libc directly (Georg)
*/
-#if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) &&
!defined(__FreeBSD_kernel__)
+#if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) &&
!defined(__FreeBSD_kernel__) && !defined(__APPLE__)
# define USE_WCHAR_T
#endif