From 457e414febf318290c0fa017a63ed4fc4926672b Mon Sep 17 00:00:00 2001 From: Allan Rae Date: Mon, 13 Dec 1999 07:33:00 +0000 Subject: [PATCH] included sgi-stl-32-merge git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@373 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 27 +++++++++++++++++++++++++++ acconfig.h | 10 ++++++++++ configure.in | 2 +- src/LString.h | 9 +++++++++ src/insets/figinset.C | 1 - src/insets/figinset.h | 2 +- src/insets/insetinclude.C | 2 +- src/insets/insetloa.C | 2 +- src/layout.h | 8 ++++---- src/lyxparagraph.h | 14 +++++++------- src/mathed/math_hash.C | 4 ++-- src/support/LRegex.h | 4 ++-- src/support/lyxstring.C | 15 ++++++++++++++- src/undo.h | 5 ++--- 14 files changed, 81 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46bc603994..8039198808 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,32 @@ 1999-12-13 Allan Rae + * src/mathed/math_hash.C (math_hash): renamed from hash(), name clash. + (in_word_set): hash() -> math_hash() + + * src/LString.h: Used USING_EXCEPTIONS in SGI STL-3.2 support + + * acconfig.h: Added a test for whether we are using exceptions in the + current compilation run. If so USING_EXCEPTIONS is defined. + + * config.in: Check for existance of stl_string_fwd.h + * src/LString.h: If compiling --with-included-string and SGI's + STL version 3.2 is present (see above test) we need to block their + forward declaration of string and supply a __get_c_string(). + However, it turns out this is only necessary if compiling with + exceptions enabled so I've a bit more to add yet. + + * src/insets/figinset.[Ch], src/insets/insetinclude.C, + src/insets/insetloa.C, src/layout.h, src/lyxparagraph.h, + src/support/LRegex.h, src/undo.h: + Shuffle the order of the included files a little to ensure that + LString.h gets included before anything that includes stl_string_fwd.h + + * src/support/lyxstring.C: We need to #include LString.h instead of + lyxstring.h to get the necessary definition of __get_c_string. + (__get_c_string): New function. This is defined static just like SGI's + although why they need to do this I'm not sure. Perhaps it should be + in lstrings.C instead. + * lib/templates/IEEEtran.lyx: New template file. 1999-12-12 Lars Gullik Bjønnes diff --git a/acconfig.h b/acconfig.h index a897db211f..3e53433af6 100644 --- a/acconfig.h +++ b/acconfig.h @@ -144,6 +144,16 @@ char * strerror(int n); /**/#undef const #endif +/* Check on the run if we are using exceptions during this compilation.*/ +#if defined(__sgi) || defined(__GNUC__) +# ifdef __EXCEPTIONS +# define USING_EXCEPTIONS +# endif +#endif + +#if defined(__USLC__) || defined(__SUNPRO_CC) || defined(__COMO__) || defined(__ICL) +# define USING_EXCEPTIONS +#endif #ifdef __EMX__ #include "os2_defines.h" diff --git a/configure.in b/configure.in index 1d9c8c851a..ee1b2ef808 100644 --- a/configure.in +++ b/configure.in @@ -161,7 +161,7 @@ AC_LANG_CPLUSPLUS # some standard header files AC_HEADER_DIRENT AC_HEADER_MAJOR -AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h) +AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h stl_string_fwd.h) # some standard structures AC_HEADER_STAT diff --git a/src/LString.h b/src/LString.h index eabdc7e815..bdb5512c01 100644 --- a/src/LString.h +++ b/src/LString.h @@ -18,5 +18,14 @@ using std::string; #else #include "support/lyxstring.h" typedef lyxstring string; +#if defined(USING_EXCEPTIONS) && defined(HAVE_STL_STRING_FWD_H) +// Hide the forward declaration of string by SGI's STL > 3.13. But only when +// exceptions are in use. +// Due to a clash with SGI's forward declaration of string we have to provide +// __get_c_string() ourselves since SGI expects it to exist and block +// their string declarations as best we can. ARRae. +# define __SGI_STL_STRING_FWD_H +static const char* __get_c_string(const string&); +#endif // HAVE_STL_STRING_FWD_H #endif #endif diff --git a/src/insets/figinset.C b/src/insets/figinset.C index 6eadca591a..aa2a7f51d9 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -42,7 +42,6 @@ extern long int background_pixels; #include using std::ofstream; -#include "form1.h" #include "figinset.h" #include "lyx.h" #include "lyx_main.h" diff --git a/src/insets/figinset.h b/src/insets/figinset.h index d066cc4afb..43d29e2173 100644 --- a/src/insets/figinset.h +++ b/src/insets/figinset.h @@ -8,8 +8,8 @@ #define FIGINSET_H #include "form1.h" -#include "buffer.h" #include "LString.h" +#include "buffer.h" #include "LaTeXFeatures.h" #include "insets/lyxinset.h" /* the rest is figure stuff */ diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index b6cab06a4a..ebde3c0049 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -7,8 +7,8 @@ #endif #include FORMS_H_LOCATION -#include "filedlg.h" #include "insetinclude.h" +#include "filedlg.h" #include "buffer.h" #include "bufferlist.h" #include "debug.h" diff --git a/src/insets/insetloa.C b/src/insets/insetloa.C index 33d14a39ce..826f1bdcf8 100644 --- a/src/insets/insetloa.C +++ b/src/insets/insetloa.C @@ -19,10 +19,10 @@ #pragma implementation "insetlot.h" #endif -#include "LaTeXFeatures.h" #include "insetloa.h" #include "insetlof.h" #include "insetlot.h" +#include "LaTeXFeatures.h" void InsetLOA::Validate(LaTeXFeatures & features) const { diff --git a/src/layout.h b/src/layout.h index 99aabd3374..69c358a416 100644 --- a/src/layout.h +++ b/src/layout.h @@ -16,14 +16,14 @@ #pragma interface #endif -#include -using std::vector; -using std::pair; - #include "lyxlex.h" #include "lyxfont.h" #include "Spacing.h" +#include +using std::vector; +using std::pair; + /// Reads the style files extern void LyXSetStyle(); diff --git a/src/lyxparagraph.h b/src/lyxparagraph.h index 7faa2ad300..e8162459e8 100644 --- a/src/lyxparagraph.h +++ b/src/lyxparagraph.h @@ -16,6 +16,13 @@ #pragma interface #endif +#include "insets/lyxinset.h" +#include "insets/insetbib.h" +#include "table.h" +#include "vspace.h" +#include "layout.h" +#include "support/block.h" + //#define NEW_TABLE 1 #ifdef NEW_TABLE @@ -24,13 +31,6 @@ #include -#include "insets/lyxinset.h" -#include "insets/insetbib.h" -#include "table.h" -#include "vspace.h" -#include "layout.h" -#include "support/block.h" - class BufferParams; class LyXBuffer; class TexRow; diff --git a/src/mathed/math_hash.C b/src/mathed/math_hash.C index a89e60394c..9692a6bd6b 100644 --- a/src/mathed/math_hash.C +++ b/src/mathed/math_hash.C @@ -17,7 +17,7 @@ /* maximum key range = 483, duplicates = 40 */ static unsigned int -hash (register char const *str, register int len) +math_hash (register char const *str, register int len) { static unsigned short asso_values[] = { @@ -357,7 +357,7 @@ in_word_set (register char const *str, register int len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int key = hash (str, len); + register int key = math_hash (str, len); if (key <= MAX_HASH_VALUE && key >= 0) { diff --git a/src/support/LRegex.h b/src/support/LRegex.h index 361a6b1f68..4380423038 100644 --- a/src/support/LRegex.h +++ b/src/support/LRegex.h @@ -11,12 +11,12 @@ #pragma interface #endif +#include "LString.h" + #include using std::vector; using std::pair; -#include "LString.h" - /// class LRegex { public: diff --git a/src/support/lyxstring.C b/src/support/lyxstring.C index 0cdb4e3bdd..47f3e8d587 100644 --- a/src/support/lyxstring.C +++ b/src/support/lyxstring.C @@ -16,7 +16,7 @@ #pragma implementation "lyxstring.h" #endif -#include "lyxstring.h" +#include "LString.h" #include #include #include @@ -1445,6 +1445,19 @@ lyxstring::size_type lyxstring::copy(value_type * buf, size_type len, } +#ifdef HAVE_STL_STRING_FWD_H +// SGI's STL > 3.13 expects string to provide __get_c_string. +// Due to a clash with SGI's forward declaration of string we have +// to provide this ourselves and block their string declarations +// as best we can. ARRae. + +static const char* __get_c_string(const string & s) +{ + return s.c_str(); +} +#endif + + //////////////////// // Comparisons //////////////////// diff --git a/src/undo.h b/src/undo.h index 4f9af2af8f..bd7e6411ba 100644 --- a/src/undo.h +++ b/src/undo.h @@ -16,11 +16,10 @@ #pragma interface #endif -#include -using std::list; - #include "lyxparagraph.h" +#include +using std::list; /// class Undo { -- 2.39.2