1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1999-2000 The LyX Team.
8 * ====================================================== */
11 #pragma implementation
29 static error_item errorTags[] = {
30 { Debug::NONE, "none", "No debugging message"},
31 { Debug::INFO, "info", "General information"},
32 { Debug::INIT, "init", "Program initialisation"},
33 { Debug::KEY, "key", "Keyboard events handling"},
34 { Debug::GUI, "gui", "GUI handling"},
35 { Debug::PARSER, "parser", "Lyxlex grammer parser"},
36 { Debug::LYXRC, "lyxrc", "Configuration files reading"},
37 { Debug::KBMAP, "kbmap", "Custom keyboard definition"},
38 { Debug::LATEX, "latex", "LaTeX generation/execution"},
39 { Debug::MATHED, "mathed", "Math editor"},
40 { Debug::FONT, "font", "Font handling"},
41 { Debug::TCLASS, "tclass", "Textclass files reading"},
42 { Debug::LYXVC, "lyxvc", "Version control"},
43 { Debug::LYXSERVER, "lyxserver", "External control interface"},
44 { Debug::ROFF, "roff", "Keep *roff temporary files"},
45 { Debug::ACTION, "action", "User commands"},
46 { Debug::LYXLEX, "lyxlex", "The LyX Lexxer"},
47 { Debug::DEPEND, "depend", "Dependency information"},
48 { Debug::INSETS, "insets", "LyX Insets"},
49 { Debug::ANY, "any", "All debugging messages"}
53 static const int numErrorTags = sizeof(errorTags)/sizeof(error_item);
56 Debug::type const Debug::ANY = Debug::type(
57 Debug::INFO | Debug::INIT | Debug::KEY | Debug::GUI |
58 Debug::PARSER | Debug::LYXRC | Debug::KBMAP | Debug::LATEX |
59 Debug::MATHED | Debug::FONT | Debug::TCLASS | Debug::LYXVC |
60 Debug::LYXSERVER | Debug::ROFF | Debug::ACTION | Debug::LYXLEX |
61 Debug::DEPEND | Debug::INSETS);
64 Debug::type Debug::value(string const & val)
69 string::size_type st = v.find(',');
70 string tmp(lowercase(v.substr(0, st)));
75 l |= static_cast<type>(strToInt(tmp));
77 // Search for an explicit name
78 for (int i = 0 ; i < numErrorTags ; ++i)
79 if (tmp == errorTags[i].name) {
80 l |= errorTags[i].level;
83 if (st == string::npos) break;
90 void Debug::showLevel(ostream & o, Debug::type level)
92 // Show what features are traced
93 for (int i = 0 ; i < numErrorTags ; ++i)
94 if (errorTags[i].level != Debug::ANY
95 && errorTags[i].level != Debug::NONE
96 && errorTags[i].level & level)
97 o << "Debugging `" << errorTags[i].name
98 << "' (" << errorTags[i].desc << ')' << endl;
102 void Debug::showTags(ostream & os)
104 for (int i = 0 ; i < numErrorTags ; ++i)
105 os << setw(7) << errorTags[i].level
106 << setw(10) << errorTags[i].name
107 << " " << errorTags[i].desc << '\n';