]> git.lyx.org Git - features.git/commitdiff
Some cleanups to compile with dec cxx. We are not there yet though.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 13 Oct 1999 10:34:07 +0000 (10:34 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 13 Oct 1999 10:34:07 +0000 (10:34 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@189 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/commandtags.h
src/debug.h
src/insets/Makefile.am
src/lyxfont.h
src/mathed/Makefile.am
src/mathed/math_defs.h
src/support/DebugStream.C
src/support/DebugStream.h
src/support/filetools.C

index f8f15495cb6c905f08b1b800c4da5536a1594ea6..ca42a9ae852f795baa494af003dc3438abd8b6b1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+1999-10-13  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * src/support/DebugStream.[Ch]: remove the explicit std:: before
+       streams classes and types, add the proper 'using' statements when
+       MODERN_STL is defined.
+       
+       * src/debug.h: move the << operator definition after the inclusion
+       of DebugStream.h
+
+       * src/support/filetools.C: include "LAssert.h", which is needed
+       later. 
+
+       * src/insets/Makefile.am, src/mathed/Makefile.am: add src/support
+       to includes. 
+
+       * src/lyxfont.h, src/commandtags.h, src/mathed/math_defs.h:
+       include "debug.h" to define a proper ostream.
+
 1999-10-12  Asger Alstrup Nielsen  <alstrup@alstrup.galaxy.dk>
 
        * src/sys*: Cleaned up the Systemcall stuff a bit. Added "kill(int)"
index c5461022e98496eb9a5b427f34404021e04c0324..a8c36d313c8a629caefb0e0d00e77f0588bcd100 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef COMMANDTAGS_H
 #define COMMANDTAGS_H
 
+#include "debug.h"
 
 /** These are all the lyxfunctions (as enums).
  */
@@ -240,7 +241,6 @@ enum kb_action {
        LFUN_LASTACTION  /* this marks the end of the table */
 };
 
-class ostream;
 ostream & operator<<(ostream &, kb_action);
 #endif
 
index a6495f33fd3f4f8f7c23aa8f238a221972ef1321..0dd2501c6051cd95fb384a4473cd0905ac9e26e9 100644 (file)
@@ -82,11 +82,12 @@ struct Debug {
        }
 };
 
-///
-ostream & operator<<(ostream & o, Debug::type t);
 
 #include "support/DebugStream.h"
 
+///
+ostream & operator<<(ostream & o, Debug::type t);
+
 extern DebugStream lyxerr;
 
 #endif
index cfa746538d2c84e8302cd46a7e96f36247444763..aac101d0307fb3b56575364f677260404abf8706 100644 (file)
@@ -4,7 +4,7 @@ noinst_PROGRAMS = insets.o
 LIBS=
 LDFLAGS=
 ETAGS_ARGS = --c++
-INCLUDES = -I${srcdir}/../
+INCLUDES = -I${srcdir}/../ -I${srcdir}/../support
 CXXLINK = $(LD) -r -o $(noinst_PROGRAMS)
 
 insets_o_SOURCES = \
@@ -47,4 +47,4 @@ insets_o_SOURCES = \
        insettoc.h \
        inseturl.C \
        inseturl.h \
-       lyxinset.h
\ No newline at end of file
+       lyxinset.h
index 6c0287b5d65ba9d23ddf4be303a43c2477c634c9..8de7868ea4c12f3cd3d6b28a4723d9f7a449ec9f 100644 (file)
@@ -17,6 +17,7 @@
 
 #include FORMS_H_LOCATION
 #include "LString.h"
+#include "debug.h"
 
 // It might happen that locale.h defines ON and OFF. This is not good
 // for us, since we use these names below. But of course this is due
index e0562fc8a60186eacebd2ce8e67b8a39991cc143..06aadaec5f3141ad32845a5b2a5eba12efb1b03b 100644 (file)
@@ -4,7 +4,7 @@ noinst_PROGRAMS = mathed.o
 LIBS=
 LDFLAGS=
 ETAGS_ARGS = --c++
-INCLUDES = -I${top_srcdir}/images -I${srcdir}/../
+INCLUDES = -I${top_srcdir}/images -I${srcdir}/../ -I${srcdir}/../support
 CXXLINK = $(LD) -r -o $(noinst_PROGRAMS)
 
 mathed_o_SOURCES = array.h \
index 0a8970a0ff629dbf13fd2b7acc19edc1330b1d87..0e34bb0ce428731480890519aebb283f755a2535 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <cstdio>
 #include "LString.h"
+#include "debug.h"
 
 #include "array.h"
 
index 37ca1fcf96754797ba2114dc658e9391f58be5c1..a450373c7368517fd31033a17db4ed0f4ff3b4ef 100644 (file)
@@ -27,12 +27,12 @@ ostream & operator<<(ostream & o, Debug::type t)
     that is the intention. You can call it a no-op streambuffer, and
     the ostream that uses it will be a no-op stream.
 */
-class nullbuf : public std::streambuf {
+class nullbuf : public streambuf {
 protected:
        ///
        virtual int sync() { return 0; }
        /// 
-       virtual std::streamsize xsputn(char const *, std::streamsize n) {
+       virtual streamsize xsputn(char const *, streamsize n) {
                // fakes a purge of the buffer by returning n
                return n;
        }
@@ -46,11 +46,11 @@ protected:
 /** A streambuf that sends the output to two different streambufs. These
     can be any kind of streambufs.
 */
-class teebuf : public std::streambuf {
+class teebuf : public streambuf {
 public:
        ///
-       teebuf(std::streambuf * b1, std::streambuf * b2)
-               : std::streambuf(), sb1(b1), sb2(b2) {}
+       teebuf(streambuf * b1, streambuf * b2)
+               : streambuf(), sb1(b1), sb2(b2) {}
 protected:
        ///
        virtual int sync() {
@@ -63,7 +63,7 @@ protected:
 #endif
        }
        ///
-       virtual std::streamsize xsputn(char const * p, std::streamsize n) {
+       virtual streamsize xsputn(char const * p, streamsize n) {
 #ifdef MODERN_STL
                sb2->sputn(p, n);
                return sb1->sputn(p, n);
@@ -84,17 +84,17 @@ protected:
        }
 private:
        ///
-       std::streambuf * sb1;
+       streambuf * sb1;
        ///
-       std::streambuf * sb2;
+       streambuf * sb2;
 };
 
 ///
-class debugbuf : public std::streambuf {
+class debugbuf : public streambuf {
 public:
        ///
-       debugbuf(std::streambuf * b)
-               : std::streambuf(), sb(b) {}
+       debugbuf(streambuf * b)
+               : streambuf(), sb(b) {}
 protected:
        ///
        virtual int sync() {
@@ -105,7 +105,7 @@ protected:
 #endif
        }
        ///
-       virtual std::streamsize xsputn(char const * p, std::streamsize n) {
+       virtual streamsize xsputn(char const * p, streamsize n) {
 #ifdef MODERN_STL
                return sb->sputn(p, n);
 #else
@@ -122,29 +122,29 @@ protected:
        }
 private:
        ///
-       std::streambuf * sb;
+       streambuf * sb;
 };
 
 /// So that public parts of DebugStream does not need to know about filebuf
 struct DebugStream::debugstream_internal {
        /// Used when logging to file.
-       std::filebuf fbuf;
+       filebuf fbuf;
 };
 
 /// Constructor, sets the debug level to t.
 DebugStream::DebugStream(Debug::type t)
-       : std::ostream(new debugbuf(std::cerr.rdbuf())),
+       : ostream(new debugbuf(cerr.rdbuf())),
          dt(t), nullstream(new nullbuf), internal(0) {}
 
        
 /// Constructor, sets the log file to f, and the debug level to t.
 DebugStream::DebugStream(char const * f, Debug::type t)
-       : std::ostream(new debugbuf(std::cerr.rdbuf())),
+       : ostream(new debugbuf(cerr.rdbuf())),
          dt(t), nullstream(new nullbuf),
          internal(new debugstream_internal)
 {
-       internal->fbuf.open(f, std::ios::out|std::ios::app);
-       delete rdbuf(new teebuf(std::cerr.rdbuf(),
+       internal->fbuf.open(f, ios::out|ios::app);
+       delete rdbuf(new teebuf(cerr.rdbuf(),
                                &internal->fbuf));
 }
 
@@ -165,8 +165,8 @@ void DebugStream::logFile(char const * f)
        } else {
                internal = new debugstream_internal;
        }
-       internal->fbuf.open(f, std::ios::out|std::ios::app);
-       delete rdbuf(new teebuf(std::cerr.rdbuf(),
+       internal->fbuf.open(f, ios::out|ios::app);
+       delete rdbuf(new teebuf(cerr.rdbuf(),
                                &internal->fbuf));
 }
 
@@ -250,12 +250,12 @@ int main(int, char **)
        // support partial specialization. In egcs this should not be
        // needed.
        debugstream << "automatic " << &i 
-                   << ", free store " << p << std::endl;
+                   << ", free store " << p << endl;
        delete p;
        /*
        for (int j = 0; j < 200000; ++j) {
                DebugStream tmp;
-               tmp << "Test" << std::endl;
+               tmp << "Test" << endl;
        }
        */
 }
index cdf5e0841a5098f4aed917064455edb7dc2a9fdb..d5be8b609dc46be8b42c625d35f8a1c188aa7be6 100644 (file)
 #include <iostream>
 #endif
 
+#ifdef MODERN_STL
+using std::ostream;
+using std::streambuf;
+using std::streamsize;
+using std::filebuf;
+using std::cerr;
+using std::ios;
+using std::endl; 
+#endif
+
 #ifdef TEST_DEBUGSTREAM
 #include <string>
 struct Debug {
@@ -90,7 +100,7 @@ struct Debug {
     debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
 
 */
-class DebugStream : public std::ostream {
+class DebugStream : public ostream {
 public:
        /// Constructor, sets the debug level to t.
        DebugStream(Debug::type t = Debug::NONE);
@@ -136,7 +146,7 @@ public:
            current debug level otherwise the real debug stream
            is used.
        */
-       std::ostream & debug(Debug::type t = Debug::ANY) {
+       ostream & debug(Debug::type t = Debug::ANY) {
                if (dt & t) return *this;
                return nullstream;
        }
@@ -145,14 +155,14 @@ public:
        /** This is an operator to give a more convenient use:
            dbgstream[Debug::INFO] << "Info!\n";
        */
-       std::ostream & operator[](Debug::type t) {
+       ostream & operator[](Debug::type t) {
                return debug(t);
        }
 private:
        /// The current debug level
        Debug::type dt;
        /// The no-op stream.
-       std::ostream nullstream;
+       ostream nullstream;
        struct debugstream_internal;
        debugstream_internal * internal;
 };
index cb824cb840880639e600e331e081fde7201f80e4..ad1f61d745c89f0b192bbfc4562e273893276af6 100644 (file)
@@ -27,6 +27,7 @@
 #include "FileInfo.h"
 #include "pathstack.h"        // I know it's OS/2 specific (SMiyata)
 #include "gettext.h"
+#include "LAssert.h"
 
 // Which part of this is still necessary? (JMarc).
 #if HAVE_DIRENT_H