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"}
43 static const int numErrorTags = sizeof(errorTags)/sizeof(error_item);
45 Debug::type Debug::value(string const & val)
50 string::size_type st = v.find(',');
51 string tmp(lowercase(v.substr(0, st)));
56 l |= static_cast<type>(strToInt(tmp));
58 // Search for an explicit name
59 for (int i = 0 ; i<numErrorTags ; ++i)
60 if (tmp == errorTags[i].name) {
61 l |= errorTags[i].level;
64 if (st == string::npos) break;
70 void Debug::showLevel(ostream &o, Debug::type level)
72 // Show what features are traced
73 for (int i = 0 ; i < numErrorTags ; ++i)
74 if (errorTags[i].level != Debug::ANY
75 && errorTags[i].level != Debug::NONE
76 && errorTags[i].level & level)
77 o << "Debugging `" << errorTags[i].name
78 << "' (" << errorTags[i].desc << ')' << endl;
82 void Debug::showTags(ostream &)
84 for (int i = 0 ; i < numErrorTags ; ++i)
85 fprintf(stdout, " %5d %-10s%-35s\n",