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::TOOLBAR, "toolbar", "Toolbar 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 Debug::value(string const & val)
61 string::size_type st = v.find(',');
62 string tmp(lowercase(v.substr(0, st)));
67 l |= static_cast<type>(strToInt(tmp));
69 // Search for an explicit name
70 for (int i = 0 ; i < numErrorTags ; ++i)
71 if (tmp == errorTags[i].name) {
72 l |= errorTags[i].level;
75 if (st == string::npos) break;
82 void Debug::showLevel(ostream & o, Debug::type level)
84 // Show what features are traced
85 for (int i = 0 ; i < numErrorTags ; ++i)
86 if (errorTags[i].level != Debug::ANY
87 && errorTags[i].level != Debug::NONE
88 && errorTags[i].level & level)
89 o << "Debugging `" << errorTags[i].name
90 << "' (" << errorTags[i].desc << ')' << endl;
94 void Debug::showTags(ostream & os)
96 for (int i = 0 ; i < numErrorTags ; ++i)
97 os << setw(7) << errorTags[i].level
98 << setw(10) << errorTags[i].name
99 << " " << errorTags[i].desc << '\n';