1999-10-07 18:44:17 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file debug.h
|
2006-11-14 16:46:06 +00:00
|
|
|
|
*
|
|
|
|
|
* FIXME: It would be nice if, in lyx::use_gui mode, instead of
|
|
|
|
|
* outputting to the console, we would pipe all messages onto a file
|
|
|
|
|
* and visualise the contents dynamically in a Qt window if needed.
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
1999-10-07 18:44:17 +00:00
|
|
|
|
|
|
|
|
|
#ifndef LYXDEBUG_H
|
|
|
|
|
#define LYXDEBUG_H
|
|
|
|
|
|
2003-09-26 14:27:20 +00:00
|
|
|
|
#include "support/debugstream.h"
|
2006-09-11 08:54:10 +00:00
|
|
|
|
#include "support/docstring.h"
|
1999-10-07 18:44:17 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
|
/** Ideally this should have been a namespace, but since we try to be
|
2004-10-05 10:11:42 +00:00
|
|
|
|
* compilable on older C++ compilators too, we use a struct instead.
|
|
|
|
|
* This is all the different debug levels that we have.
|
|
|
|
|
*/
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class lyx_debug_trait {
|
|
|
|
|
public:
|
1999-10-07 18:44:17 +00:00
|
|
|
|
///
|
|
|
|
|
enum type {
|
|
|
|
|
///
|
|
|
|
|
NONE = 0,
|
|
|
|
|
///
|
|
|
|
|
INFO = (1 << 0), // 1
|
|
|
|
|
///
|
|
|
|
|
INIT = (1 << 1), // 2
|
|
|
|
|
///
|
|
|
|
|
KEY = (1 << 2), // 4
|
|
|
|
|
///
|
2000-07-24 13:53:19 +00:00
|
|
|
|
GUI = (1 << 3), // 8
|
1999-10-07 18:44:17 +00:00
|
|
|
|
///
|
|
|
|
|
PARSER = (1 << 4), // 16
|
|
|
|
|
///
|
|
|
|
|
LYXRC = (1 << 5), // 32
|
|
|
|
|
///
|
|
|
|
|
KBMAP = (1 << 6), // 64
|
|
|
|
|
///
|
|
|
|
|
LATEX = (1 << 7), // 128
|
|
|
|
|
///
|
|
|
|
|
MATHED = (1 << 8), // 256 // Alejandro, please use this.
|
|
|
|
|
///
|
|
|
|
|
FONT = (1 << 9), // 512
|
|
|
|
|
///
|
|
|
|
|
TCLASS = (1 << 10), // 1024
|
|
|
|
|
///
|
|
|
|
|
LYXVC = (1 << 11), // 2048
|
|
|
|
|
///
|
|
|
|
|
LYXSERVER = (1 << 12), // 4096
|
|
|
|
|
///
|
1999-11-25 17:29:19 +00:00
|
|
|
|
ROFF = (1 << 13), // 8192
|
|
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
|
ACTION = (1 << 14), // 16384
|
|
|
|
|
///
|
2000-01-25 12:35:27 +00:00
|
|
|
|
LYXLEX = (1 << 15),
|
|
|
|
|
///
|
2000-04-19 14:42:19 +00:00
|
|
|
|
DEPEND = (1 << 16),
|
|
|
|
|
///
|
2000-11-14 02:01:57 +00:00
|
|
|
|
INSETS = (1 << 17),
|
|
|
|
|
///
|
2001-11-09 13:44:48 +00:00
|
|
|
|
FILES = (1 << 18),
|
|
|
|
|
///
|
2001-11-28 16:09:25 +00:00
|
|
|
|
WORKAREA = (1 << 19),
|
|
|
|
|
///
|
2002-02-16 12:33:19 +00:00
|
|
|
|
INSETTEXT = (1 << 20),
|
|
|
|
|
///
|
2003-02-08 19:18:01 +00:00
|
|
|
|
GRAPHICS = (1 << 21),
|
|
|
|
|
/// change tracking
|
2003-09-04 17:01:00 +00:00
|
|
|
|
CHANGES = (1 << 22),
|
|
|
|
|
///
|
2003-09-26 14:27:20 +00:00
|
|
|
|
EXTERNAL = (1 << 23),
|
|
|
|
|
///
|
2006-03-10 16:10:35 +00:00
|
|
|
|
PAINTING = (1 << 24),
|
|
|
|
|
///
|
2004-06-18 13:31:55 +00:00
|
|
|
|
DEBUG = (1 << 31),
|
|
|
|
|
///
|
|
|
|
|
ANY = 0xffffffff
|
1999-10-07 18:44:17 +00:00
|
|
|
|
};
|
2003-09-26 14:27:20 +00:00
|
|
|
|
|
|
|
|
|
static bool match(type a, type b) {
|
|
|
|
|
return (a & b);
|
|
|
|
|
}
|
2000-10-11 21:06:43 +00:00
|
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
|
/** A function to convert symbolic string names on debug levels
|
|
|
|
|
to their numerical value.
|
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
static type value(std::string const & val);
|
1999-12-13 15:31:52 +00:00
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
/** Display the tags and descriptions of the current debug level
|
|
|
|
|
of ds
|
1999-12-13 15:31:52 +00:00
|
|
|
|
*/
|
2000-04-04 00:19:15 +00:00
|
|
|
|
static void showLevel(std::ostream & o, type level);
|
1999-12-13 15:31:52 +00:00
|
|
|
|
|
|
|
|
|
/** show all the possible tags that can be used for debugging */
|
2000-04-04 00:19:15 +00:00
|
|
|
|
static void showTags(std::ostream & o);
|
1999-12-13 15:31:52 +00:00
|
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
|
};
|
1999-12-13 15:31:52 +00:00
|
|
|
|
|
1999-12-13 21:59:26 +00:00
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
|
2000-03-07 01:14:37 +00:00
|
|
|
|
inline
|
2003-09-26 14:27:20 +00:00
|
|
|
|
void operator|=(lyx_debug_trait::type & d1, lyx_debug_trait::type d2)
|
1999-11-04 01:40:20 +00:00
|
|
|
|
{
|
2003-09-26 14:27:20 +00:00
|
|
|
|
d1 = static_cast<lyx_debug_trait::type>(d1 | d2);
|
1999-11-04 01:40:20 +00:00
|
|
|
|
}
|
1999-10-07 18:44:17 +00:00
|
|
|
|
|
|
|
|
|
|
2003-09-26 14:27:20 +00:00
|
|
|
|
// std::ostream & operator<<(std::ostream & o, Debug::type t);
|
2000-07-15 23:51:46 +00:00
|
|
|
|
|
2003-09-26 14:27:20 +00:00
|
|
|
|
typedef basic_debugstream<lyx_debug_trait> LyXErr;
|
|
|
|
|
typedef LyXErr::debug Debug;
|
1999-10-13 10:34:07 +00:00
|
|
|
|
|
2003-09-26 14:27:20 +00:00
|
|
|
|
extern LyXErr lyxerr;
|
1999-10-07 18:44:17 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
|
#endif
|