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