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