complete revision of SGI STL compatability. Heaps better, see ChangeLog.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@379 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Allan Rae 1999-12-15 01:15:08 +00:00
parent ddf753c64a
commit 20229daf94
8 changed files with 86 additions and 31 deletions

View File

@ -1,3 +1,20 @@
1999-12-15 Allan Rae <rae@lyx.org>
* src/stl_string_fwd.h, src/Makefile.am (lyx_SOURCES): added new
header that provides a wrapper around the very annoying SGI STL header
of the same name.
* src/support/lyxstring.C, src/LString.h:
removed old SGI-STL-compatability attempts.
* configure.in: Use LYX_STL_STRING_FWD.
* acinclude.m4 (LYX_STL_STRING_FWD), acconfig.h: Test if
stl_string_fwd.h is around and try to determine it's location.
Major improvement over previous SGI STL 3.2 compatability.
Three small problems remain with this function due to my zero
knowledge of autoconf. JMarc and lgb see the comments in the code.
1999-12-14 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/broken_const.h, config/hack-gcc, config/README: removed

View File

@ -37,6 +37,12 @@
e.g. <forms.h> */
#undef FORMS_H_LOCATION
/* define this to the location of stl_string_fwd.h to be used with #include,
NOTE: Do not set it to <stl_string_fwd.h> as that will find the LyX
supplied version of the header.
e.g. <../include/stl_string_fwd.h> */
#undef STL_STRING_FWD_H_LOCATION
/* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES

View File

@ -1067,6 +1067,31 @@ case "$host" in
esac
])
### Check for stl_string_fwd.h existence and location if it exists
###
### Three problems remain:
### 1. I don't check if $lyx_cv_extra_inc has a value before testing it.
### 2. I don't issue a warning/error if AC_CHECK_HEADERS finds it but I
### don't. The warning should only need to be something like:
### "Can't find path to stl_string_fwd.h please define
### STL_STRING_FWD_H_LOCATION in src/config.h or supply the path
### using --with-extra-inc"
### 3. Multiple extra include dirs? and I don't check --with-extra-prefix yet
###
AC_DEFUN(LYX_STL_STRING_FWD,
[AC_CHECK_HEADERS(stl_string_fwd.h,[
lyx_cv_stl_string_fwd_h_location="<../include/stl_string_fwd.h>"
AC_CHECK_HEADER(../include/stl_string_fwd.h,[
ac_cv_header_stl_string_fwd_h=yes
lyx_cv_stl_string_fwd_h_location="<../include/stl_string_fwd.h>"],[
AC_CHECK_HEADER($lyx_cv_extra_inc/stl_string_fwd.h,[
ac_cv_header_stl_string_fwd_h=yes
lyx_cv_stl_string_fwd_h_location="<$lyx_cv_extra_inc/stl_string_fwd.h>"],[
ac_cv_header_stl_string_fwd_h=no])])
AC_DEFINE_UNQUOTED(STL_STRING_FWD_H_LOCATION,$lyx_cv_stl_string_fwd_h_location)])
])
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl convenience library, adds --enable-ltdl-convenience to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor

View File

@ -153,7 +153,10 @@ 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 stl_string_fwd.h)
AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h)
# some annoying header files
LYX_STL_STRING_FWD
# some standard structures
AC_HEADER_STAT

View File

@ -18,14 +18,5 @@ 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 char const * __get_c_string(string const &);
#endif // HAVE_STL_STRING_FWD_H
#endif
#endif

View File

@ -148,6 +148,7 @@ lyx_SOURCES = \
sp_form.h \
spellchecker.C \
spellchecker.h \
stl_string_fwd.h \
table.C \
table.h \
tex-accent.C \

33
src/stl_string_fwd.h Normal file
View File

@ -0,0 +1,33 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* ====================================================== */
#ifndef LYX_STL_STRING_FWD_H
#define LYX_STL_STRING_FWD_H
#if defined(HAVE_STL_STRING_FWD_H)
# ifndef USE_INCLUDED_STRING
// include the real stl_string_fwd.h
# include STL_STRING_FWD_H_LOCATION
# else
// Hide the forward declaration of string by SGI's STL > 3.13.
// We have to provide the declaration of__get_c_string() ourselves
// since SGI expects it to exist and we're blocking their string declarations
// as best we can.
// Note that a declaration for string is still required so we have to
// provide one via LString.h. ARRae.
# include "LString.h"
# define __SGI_STL_STRING_FWD_H
static char const * __get_c_string(string const &);
# endif // USE_INCLUDED_STRING
#endif // HAVE_STL_STRING_FWD_H
#endif // LYX_STL_STRING_FWD_H

View File

@ -16,7 +16,6 @@
#pragma implementation "lyxstring.h"
#endif
//#include "LString.h"
#include "lyxstring.h"
#include <cstdlib>
#include <cctype>
@ -61,26 +60,6 @@ using std::min;
// Lgb.
#if 0
// I have no clue why this function is needed at all, it is static and
// confined to this filescope. How can any other file/fuction/module
// get access to it at all?? Perhaps the forward declaration in LString.h
// is enough. ARRae, any clues? Lgb.
#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 char const * __get_c_string(string const & s)
{
return s.c_str();
}
#endif
#endif
///////////////////////////////////////
// The internal string representation
///////////////////////////////////////