mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Some cleanups to compile with dec cxx. We are not there yet though.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@189 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3635ff7370
commit
2ac6d6da48
18
ChangeLog
18
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>
|
1999-10-12 Asger Alstrup Nielsen <alstrup@alstrup.galaxy.dk>
|
||||||
|
|
||||||
* src/sys*: Cleaned up the Systemcall stuff a bit. Added "kill(int)"
|
* src/sys*: Cleaned up the Systemcall stuff a bit. Added "kill(int)"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#ifndef COMMANDTAGS_H
|
#ifndef COMMANDTAGS_H
|
||||||
#define COMMANDTAGS_H
|
#define COMMANDTAGS_H
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
/** These are all the lyxfunctions (as enums).
|
/** These are all the lyxfunctions (as enums).
|
||||||
*/
|
*/
|
||||||
@ -240,7 +241,6 @@ enum kb_action {
|
|||||||
LFUN_LASTACTION /* this marks the end of the table */
|
LFUN_LASTACTION /* this marks the end of the table */
|
||||||
};
|
};
|
||||||
|
|
||||||
class ostream;
|
|
||||||
ostream & operator<<(ostream &, kb_action);
|
ostream & operator<<(ostream &, kb_action);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -82,11 +82,12 @@ struct Debug {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
|
||||||
ostream & operator<<(ostream & o, Debug::type t);
|
|
||||||
|
|
||||||
#include "support/DebugStream.h"
|
#include "support/DebugStream.h"
|
||||||
|
|
||||||
|
///
|
||||||
|
ostream & operator<<(ostream & o, Debug::type t);
|
||||||
|
|
||||||
extern DebugStream lyxerr;
|
extern DebugStream lyxerr;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,7 +4,7 @@ noinst_PROGRAMS = insets.o
|
|||||||
LIBS=
|
LIBS=
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
ETAGS_ARGS = --c++
|
ETAGS_ARGS = --c++
|
||||||
INCLUDES = -I${srcdir}/../
|
INCLUDES = -I${srcdir}/../ -I${srcdir}/../support
|
||||||
CXXLINK = $(LD) -r -o $(noinst_PROGRAMS)
|
CXXLINK = $(LD) -r -o $(noinst_PROGRAMS)
|
||||||
|
|
||||||
insets_o_SOURCES = \
|
insets_o_SOURCES = \
|
||||||
@ -47,4 +47,4 @@ insets_o_SOURCES = \
|
|||||||
insettoc.h \
|
insettoc.h \
|
||||||
inseturl.C \
|
inseturl.C \
|
||||||
inseturl.h \
|
inseturl.h \
|
||||||
lyxinset.h
|
lyxinset.h
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
// It might happen that locale.h defines ON and OFF. This is not good
|
// 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
|
// for us, since we use these names below. But of course this is due
|
||||||
|
@ -4,7 +4,7 @@ noinst_PROGRAMS = mathed.o
|
|||||||
LIBS=
|
LIBS=
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
ETAGS_ARGS = --c++
|
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)
|
CXXLINK = $(LD) -r -o $(noinst_PROGRAMS)
|
||||||
|
|
||||||
mathed_o_SOURCES = array.h \
|
mathed_o_SOURCES = array.h \
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ ostream & operator<<(ostream & o, Debug::type t)
|
|||||||
that is the intention. You can call it a no-op streambuffer, and
|
that is the intention. You can call it a no-op streambuffer, and
|
||||||
the ostream that uses it will be a no-op stream.
|
the ostream that uses it will be a no-op stream.
|
||||||
*/
|
*/
|
||||||
class nullbuf : public std::streambuf {
|
class nullbuf : public streambuf {
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
virtual int sync() { return 0; }
|
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
|
// fakes a purge of the buffer by returning n
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
@ -46,11 +46,11 @@ protected:
|
|||||||
/** A streambuf that sends the output to two different streambufs. These
|
/** A streambuf that sends the output to two different streambufs. These
|
||||||
can be any kind of streambufs.
|
can be any kind of streambufs.
|
||||||
*/
|
*/
|
||||||
class teebuf : public std::streambuf {
|
class teebuf : public streambuf {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
teebuf(std::streambuf * b1, std::streambuf * b2)
|
teebuf(streambuf * b1, streambuf * b2)
|
||||||
: std::streambuf(), sb1(b1), sb2(b2) {}
|
: streambuf(), sb1(b1), sb2(b2) {}
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
virtual int sync() {
|
virtual int sync() {
|
||||||
@ -63,7 +63,7 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
virtual std::streamsize xsputn(char const * p, std::streamsize n) {
|
virtual streamsize xsputn(char const * p, streamsize n) {
|
||||||
#ifdef MODERN_STL
|
#ifdef MODERN_STL
|
||||||
sb2->sputn(p, n);
|
sb2->sputn(p, n);
|
||||||
return sb1->sputn(p, n);
|
return sb1->sputn(p, n);
|
||||||
@ -84,17 +84,17 @@ protected:
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
std::streambuf * sb1;
|
streambuf * sb1;
|
||||||
///
|
///
|
||||||
std::streambuf * sb2;
|
streambuf * sb2;
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
class debugbuf : public std::streambuf {
|
class debugbuf : public streambuf {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
debugbuf(std::streambuf * b)
|
debugbuf(streambuf * b)
|
||||||
: std::streambuf(), sb(b) {}
|
: streambuf(), sb(b) {}
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
virtual int sync() {
|
virtual int sync() {
|
||||||
@ -105,7 +105,7 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
virtual std::streamsize xsputn(char const * p, std::streamsize n) {
|
virtual streamsize xsputn(char const * p, streamsize n) {
|
||||||
#ifdef MODERN_STL
|
#ifdef MODERN_STL
|
||||||
return sb->sputn(p, n);
|
return sb->sputn(p, n);
|
||||||
#else
|
#else
|
||||||
@ -122,29 +122,29 @@ protected:
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
std::streambuf * sb;
|
streambuf * sb;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// So that public parts of DebugStream does not need to know about filebuf
|
/// So that public parts of DebugStream does not need to know about filebuf
|
||||||
struct DebugStream::debugstream_internal {
|
struct DebugStream::debugstream_internal {
|
||||||
/// Used when logging to file.
|
/// Used when logging to file.
|
||||||
std::filebuf fbuf;
|
filebuf fbuf;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Constructor, sets the debug level to t.
|
/// Constructor, sets the debug level to t.
|
||||||
DebugStream::DebugStream(Debug::type 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) {}
|
dt(t), nullstream(new nullbuf), internal(0) {}
|
||||||
|
|
||||||
|
|
||||||
/// Constructor, sets the log file to f, and the debug level to t.
|
/// Constructor, sets the log file to f, and the debug level to t.
|
||||||
DebugStream::DebugStream(char const * f, Debug::type 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),
|
dt(t), nullstream(new nullbuf),
|
||||||
internal(new debugstream_internal)
|
internal(new debugstream_internal)
|
||||||
{
|
{
|
||||||
internal->fbuf.open(f, std::ios::out|std::ios::app);
|
internal->fbuf.open(f, ios::out|ios::app);
|
||||||
delete rdbuf(new teebuf(std::cerr.rdbuf(),
|
delete rdbuf(new teebuf(cerr.rdbuf(),
|
||||||
&internal->fbuf));
|
&internal->fbuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,8 +165,8 @@ void DebugStream::logFile(char const * f)
|
|||||||
} else {
|
} else {
|
||||||
internal = new debugstream_internal;
|
internal = new debugstream_internal;
|
||||||
}
|
}
|
||||||
internal->fbuf.open(f, std::ios::out|std::ios::app);
|
internal->fbuf.open(f, ios::out|ios::app);
|
||||||
delete rdbuf(new teebuf(std::cerr.rdbuf(),
|
delete rdbuf(new teebuf(cerr.rdbuf(),
|
||||||
&internal->fbuf));
|
&internal->fbuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,12 +250,12 @@ int main(int, char **)
|
|||||||
// support partial specialization. In egcs this should not be
|
// support partial specialization. In egcs this should not be
|
||||||
// needed.
|
// needed.
|
||||||
debugstream << "automatic " << &i
|
debugstream << "automatic " << &i
|
||||||
<< ", free store " << p << std::endl;
|
<< ", free store " << p << endl;
|
||||||
delete p;
|
delete p;
|
||||||
/*
|
/*
|
||||||
for (int j = 0; j < 200000; ++j) {
|
for (int j = 0; j < 200000; ++j) {
|
||||||
DebugStream tmp;
|
DebugStream tmp;
|
||||||
tmp << "Test" << std::endl;
|
tmp << "Test" << endl;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,16 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#endif
|
#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
|
#ifdef TEST_DEBUGSTREAM
|
||||||
#include <string>
|
#include <string>
|
||||||
struct Debug {
|
struct Debug {
|
||||||
@ -90,7 +100,7 @@ struct Debug {
|
|||||||
debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
|
debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class DebugStream : public std::ostream {
|
class DebugStream : public ostream {
|
||||||
public:
|
public:
|
||||||
/// Constructor, sets the debug level to t.
|
/// Constructor, sets the debug level to t.
|
||||||
DebugStream(Debug::type t = Debug::NONE);
|
DebugStream(Debug::type t = Debug::NONE);
|
||||||
@ -136,7 +146,7 @@ public:
|
|||||||
current debug level otherwise the real debug stream
|
current debug level otherwise the real debug stream
|
||||||
is used.
|
is used.
|
||||||
*/
|
*/
|
||||||
std::ostream & debug(Debug::type t = Debug::ANY) {
|
ostream & debug(Debug::type t = Debug::ANY) {
|
||||||
if (dt & t) return *this;
|
if (dt & t) return *this;
|
||||||
return nullstream;
|
return nullstream;
|
||||||
}
|
}
|
||||||
@ -145,14 +155,14 @@ public:
|
|||||||
/** This is an operator to give a more convenient use:
|
/** This is an operator to give a more convenient use:
|
||||||
dbgstream[Debug::INFO] << "Info!\n";
|
dbgstream[Debug::INFO] << "Info!\n";
|
||||||
*/
|
*/
|
||||||
std::ostream & operator[](Debug::type t) {
|
ostream & operator[](Debug::type t) {
|
||||||
return debug(t);
|
return debug(t);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
/// The current debug level
|
/// The current debug level
|
||||||
Debug::type dt;
|
Debug::type dt;
|
||||||
/// The no-op stream.
|
/// The no-op stream.
|
||||||
std::ostream nullstream;
|
ostream nullstream;
|
||||||
struct debugstream_internal;
|
struct debugstream_internal;
|
||||||
debugstream_internal * internal;
|
debugstream_internal * internal;
|
||||||
};
|
};
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "FileInfo.h"
|
#include "FileInfo.h"
|
||||||
#include "pathstack.h" // I know it's OS/2 specific (SMiyata)
|
#include "pathstack.h" // I know it's OS/2 specific (SMiyata)
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
#include "LAssert.h"
|
||||||
|
|
||||||
// Which part of this is still necessary? (JMarc).
|
// Which part of this is still necessary? (JMarc).
|
||||||
#if HAVE_DIRENT_H
|
#if HAVE_DIRENT_H
|
||||||
|
Loading…
Reference in New Issue
Block a user