diff --git a/configure.ac b/configure.ac index c2c89c2aba..ecb4cd26c3 100644 --- a/configure.ac +++ b/configure.ac @@ -147,6 +147,9 @@ AC_SUBST(AIKSAURUS_LIBS) LYX_USE_INCLUDED_BOOST +# Needed for our char_type +AC_CHECK_SIZEOF(wchar_t) + ### Setup libtool dnl Dirty trick ahead: disable libtool checking for a fortran compiler dnl see http://permalink.gmane.org/gmane.comp.gnu.libtool.general/6699 diff --git a/src/LaTeX.h b/src/LaTeX.h index 2860e68d6c..6e2d0c6197 100644 --- a/src/LaTeX.h +++ b/src/LaTeX.h @@ -16,6 +16,8 @@ #include "outputparams.h" +#include "support/docstring.h" + #include #include diff --git a/src/errorlist.h b/src/errorlist.h index 39ab893f7d..a593adcf66 100644 --- a/src/errorlist.h +++ b/src/errorlist.h @@ -12,7 +12,7 @@ #ifndef ERRORLIST_H #define ERRORLIST_H -#include "support/types.h" +#include "support/docstring.h" #include #include diff --git a/src/frontends/Painter.h b/src/frontends/Painter.h index 1cca72c19b..9dd8731c44 100644 --- a/src/frontends/Painter.h +++ b/src/frontends/Painter.h @@ -15,9 +15,7 @@ #include "LColor.h" -#include "support/types.h" - -#include +#include "support/docstring.h" class LyXFont; diff --git a/src/frontends/font_metrics.h b/src/frontends/font_metrics.h index a1bd2725c5..9c6becdab9 100644 --- a/src/frontends/font_metrics.h +++ b/src/frontends/font_metrics.h @@ -13,9 +13,7 @@ #ifndef FONT_METRICS_H #define FONT_METRICS_H -#include "support/types.h" - -#include +#include "support/docstring.h" class LyXFont; diff --git a/src/frontends/qt4/qt_helpers.h b/src/frontends/qt4/qt_helpers.h index d1e8de8935..9574965f41 100644 --- a/src/frontends/qt4/qt_helpers.h +++ b/src/frontends/qt4/qt_helpers.h @@ -17,7 +17,7 @@ #include "lyxlength.h" //#include "lengthcombo.h" -#include "support/types.h" +#include "support/docstring.h" #include diff --git a/src/lyxfunc.h b/src/lyxfunc.h index 7fa82bb621..7a2b322e69 100644 --- a/src/lyxfunc.h +++ b/src/lyxfunc.h @@ -18,7 +18,7 @@ #include "kbsequence.h" #include "lfuns.h" -#include "support/types.h" +#include "support/docstring.h" #include #include diff --git a/src/lyxlex.h b/src/lyxlex.h index 3dd942eea8..18a95aa26a 100644 --- a/src/lyxlex.h +++ b/src/lyxlex.h @@ -17,12 +17,11 @@ #ifndef LYXLEX_H #define LYXLEX_H -#include "support/types.h" +#include "support/docstring.h" #include #include -#include /// diff --git a/src/metricsinfo.h b/src/metricsinfo.h index d55c3f4e4e..669679d39c 100644 --- a/src/metricsinfo.h +++ b/src/metricsinfo.h @@ -13,9 +13,7 @@ #define METRICSINFO_H #include "lyxfont.h" -#include "support/types.h" - -#include +#include "support/docstring.h" class BufferView; diff --git a/src/support/docstring.h b/src/support/docstring.h index a17d4832d6..7b248f6ab1 100644 --- a/src/support/docstring.h +++ b/src/support/docstring.h @@ -13,13 +13,14 @@ #ifndef LYX_DOCSTRING_H #define LYX_DOCSTRING_H -#include +#include "support/types.h" + #include namespace lyx { /// String type for storing the main text in UCS4 encoding -typedef std::basic_string docstring; +typedef std::basic_string docstring; /// Creates a docstring from a C string of ASCII characters docstring const from_ascii(char const *); @@ -60,7 +61,7 @@ lyx::docstring operator+(lyx::docstring const & l, char r); lyx::docstring operator+(char l, lyx::docstring const & r); -#if defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ == 3 && __GNUC_MINOR__ < 4 +#if SIZEOF_WCHAR_T != 4 && defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ == 3 && __GNUC_MINOR__ < 4 // Missing char_traits methods in gcc 3.3 and older. Taken from gcc 4.2svn. namespace std { diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 36b556a81c..18a35ff5bc 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -16,7 +16,7 @@ #ifndef LSTRINGS_H #define LSTRINGS_H -#include "support/types.h" +#include "support/docstring.h" #include diff --git a/src/support/types.h b/src/support/types.h index 65928821c3..446aa3d60f 100644 --- a/src/support/types.h +++ b/src/support/types.h @@ -16,21 +16,22 @@ #ifndef LYX_TYPES_H #define LYX_TYPES_H -#include "docstring.h" - #include #include -#include namespace lyx { - // The type used to hold characters in paragraphs - typedef boost::uint32_t char_type; // Possibly the ucs-4 type we will use - //typedef wchar_t char_type; // The wide char type CJK-LyX uses - //typedef char char_type; // Current narrow char type in use - - //typedef std::wstring docstring; + /// The type used to hold characters in paragraphs +#if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 + // Prefer this if possible because GNU libstdc++ has usable + // std::ctype locale facets but not + // std::ctype. gcc older than 3.4 is also missing + // usable std::char_traits. + typedef wchar_t char_type; +#else + typedef boost::uint32_t char_type; +#endif /// a type for positions used in paragraphs // needs to be signed for a while to hold the special value -1 that is