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