1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1999-2001 The LyX Team.
8 * ====================================================== */
11 #pragma implementation
20 #include "support/lstrings.h"
35 error_item errorTags[] = {
36 { Debug::NONE, "none", N_("No debugging message")},
37 { Debug::INFO, "info", N_("General information")},
38 { Debug::INIT, "init", N_("Program initialisation")},
39 { Debug::KEY, "key", N_("Keyboard events handling")},
40 { Debug::GUI, "gui", N_("GUI handling")},
41 { Debug::PARSER, "parser", N_("Lyxlex grammer parser")},
42 { Debug::LYXRC, "lyxrc", N_("Configuration files reading")},
43 { Debug::KBMAP, "kbmap", N_("Custom keyboard definition")},
44 { Debug::LATEX, "latex", N_("LaTeX generation/execution")},
45 { Debug::MATHED, "mathed", N_("Math editor")},
46 { Debug::FONT, "font", N_("Font handling")},
47 { Debug::TCLASS, "tclass", N_("Textclass files reading")},
48 { Debug::LYXVC, "lyxvc", N_("Version control")},
49 { Debug::LYXSERVER, "lyxserver", N_("External control interface")},
50 { Debug::ROFF, "roff", N_("Keep *roff temporary files")},
51 { Debug::ACTION, "action", N_("User commands")},
52 { Debug::LYXLEX, "lyxlex", N_("The LyX Lexxer")},
53 { Debug::DEPEND, "depend", N_("Dependency information")},
54 { Debug::INSETS, "insets", N_("LyX Insets")},
55 { Debug::FILES, "files", N_("Files used by LyX")},
56 { Debug::WORKAREA, "workarea", N_("Workarea events")},
57 { Debug::INSETTEXT, "insettext", N_("Insettext/tabular messages")},
58 { Debug::GRAPHICS, "graphics", N_("Graphics conversion and loading")},
59 { Debug::ANY, "any", N_("All debugging messages")}
63 int const numErrorTags = sizeof(errorTags)/sizeof(error_item);
68 Debug::type const Debug::ANY = Debug::type(
69 Debug::INFO | Debug::INIT | Debug::KEY | Debug::GUI |
70 Debug::PARSER | Debug::LYXRC | Debug::KBMAP | Debug::LATEX |
71 Debug::MATHED | Debug::FONT | Debug::TCLASS | Debug::LYXVC |
72 Debug::LYXSERVER | Debug::ROFF | Debug::ACTION | Debug::LYXLEX |
73 Debug::DEPEND | Debug::INSETS | Debug::FILES | Debug::WORKAREA |
74 Debug::INSETTEXT | Debug::GRAPHICS);
77 Debug::type Debug::value(string const & val)
82 string::size_type st = v.find(',');
83 string tmp(lowercase(v.substr(0, st)));
88 l |= static_cast<type>(strToInt(tmp));
90 // Search for an explicit name
91 for (int i = 0 ; i < numErrorTags ; ++i)
92 if (tmp == errorTags[i].name) {
93 l |= errorTags[i].level;
96 if (st == string::npos) break;
103 void Debug::showLevel(ostream & o, Debug::type level)
105 // Show what features are traced
106 for (int i = 0 ; i < numErrorTags ; ++i)
107 if (errorTags[i].level != Debug::ANY
108 && errorTags[i].level != Debug::NONE
109 && errorTags[i].level & level)
110 o << _("Debugging `") << errorTags[i].name
111 << "' (" << _(errorTags[i].desc) << ')' << endl;
115 void Debug::showTags(ostream & os)
117 for (int i = 0 ; i < numErrorTags ; ++i)
118 os << setw(7) << errorTags[i].level
119 << setw(10) << errorTags[i].name
120 << " " << _(errorTags[i].desc) << '\n';