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