1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright (C) 1999 The LyX Team.
8 * ====================================================== */
11 #pragma implementation
23 static error_item errorTags[] = {
24 { Debug::INFO, "info", "General information"},
25 { Debug::INIT, "init", "Program initialisation"},
26 { Debug::KEY, "key", "Keyboard events handling"},
27 { Debug::TOOLBAR, "toolbar", "Toolbar handling"},
28 { Debug::PARSER, "parser", "Lyxlex grammer parser"},
29 { Debug::LYXRC, "lyxrc", "Configuration files reading"},
30 { Debug::KBMAP, "kbmap", "Custom keyboard definition"},
31 { Debug::LATEX, "latex", "LaTeX generation/execution"},
32 { Debug::MATHED, "mathed", "Math editor"},
33 { Debug::FONT, "font", "Font handling"},
34 { Debug::TCLASS, "tclass", "Textclass files reading"},
35 { Debug::LYXVC, "lyxvc", "Version control"},
36 { Debug::LYXSERVER, "lyxserver", "External control interface"},
37 { Debug::ROFF, "roff", "Keep *roff temporary files"},
38 { Debug::ACTION, "action", "User commands"},
39 { Debug::NONE, "none", "No debugging message"},
40 { Debug::ANY, "any", "All debugging messages"}
44 static const int numErrorTags = sizeof(errorTags)/sizeof(error_item);
47 Debug::type Debug::value(string const & val)
52 string::size_type st = v.find(',');
53 string tmp(lowercase(v.substr(0, st)));
58 l |= static_cast<type>(strToInt(tmp));
60 // Search for an explicit name
61 for (int i = 0 ; i < numErrorTags ; ++i)
62 if (tmp == errorTags[i].name) {
63 l |= errorTags[i].level;
66 if (st == string::npos) break;
73 void Debug::showLevel(ostream & o, Debug::type level)
75 // Show what features are traced
76 for (int i = 0 ; i < numErrorTags ; ++i)
77 if (errorTags[i].level != Debug::ANY
78 && errorTags[i].level != Debug::NONE
79 && errorTags[i].level & level)
80 o << "Debugging `" << errorTags[i].name
81 << "' (" << errorTags[i].desc << ')' << endl;
85 void Debug::showTags(ostream & os)
87 for (int i = 0 ; i < numErrorTags ; ++i)
88 os << " " << errorTags[i].level
89 << " " << errorTags[i].name
90 << " " << errorTags[i].desc << '\n';