]> git.lyx.org Git - lyx.git/blobdiff - src/debug.C
citation patch from Angus
[lyx.git] / src / debug.C
index 3d4d54d382c091bbd11b8556c1ad5d5dc0165389..46b6a39e36c59215e7660f4deedd2e3912081110 100644 (file)
@@ -3,7 +3,7 @@
 * 
 *           LyX, The Document Processor
 *        
-*           Copyright (C) 1999 The LyX Team.
+*           Copyright 1999-2000 The LyX Team.
 *
 * ====================================================== */
 
 #include <config.h>
 #include "debug.h"
 
+#include <iomanip>
+
+using std::ostream;
+using std::setw;
+using std::endl;
+
 struct error_item {
        Debug::type level;
        char const * name;
@@ -21,10 +27,11 @@ struct error_item {
 };
 
 static error_item errorTags[] = {
+       { Debug::NONE,          "none",         "No debugging message"},
        { Debug::INFO,          "info",         "General information"},
        { Debug::INIT,          "init",         "Program initialisation"},
        { Debug::KEY,           "key",          "Keyboard events handling"},
-       { Debug::TOOLBAR,       "toolbar",      "Toolbar handling"},
+       { Debug::GUI,           "gui",          "GUI handling"},
        { Debug::PARSER,        "parser",       "Lyxlex grammer parser"},
        { Debug::LYXRC,         "lyxrc",        "Configuration files reading"},
        { Debug::KBMAP,         "kbmap",        "Custom keyboard definition"},
@@ -36,12 +43,16 @@ static error_item errorTags[] = {
        { Debug::LYXSERVER,     "lyxserver",    "External control interface"},
        { Debug::ROFF,          "roff",         "Keep *roff temporary files"},
        { Debug::ACTION,        "action",       "User commands"},
-       { Debug::NONE,          "none",         "No debugging message"},
+       { Debug::LYXLEX,        "lyxlex",       "The LyX Lexxer"},
+       { Debug::DEPEND,        "depend",       "Dependency information"},
+       { Debug::INSETS,        "insets",       "LyX Insets"},
         { Debug::ANY,          "any",          "All debugging messages"}
 };
 
+
 static const int numErrorTags = sizeof(errorTags)/sizeof(error_item);
 
+
 Debug::type Debug::value(string const & val) 
 {
        type l = Debug::NONE;
@@ -49,14 +60,14 @@ Debug::type Debug::value(string const & val)
        while (!v.empty()) {
                string::size_type st = v.find(',');
                string tmp(lowercase(v.substr(0, st)));
-               if (tmp.empty()) 
+               if (tmp.empty())
                        break;
                // Is it a number?
                if (isStrInt(tmp)) 
                        l |= static_cast<type>(strToInt(tmp));
                else
                // Search for an explicit name
-               for (int i = 0 ; i<numErrorTags ; ++i) 
+               for (int i = 0 ; i < numErrorTags ; ++i) 
                        if (tmp == errorTags[i].name) {
                                l |= errorTags[i].level;
                                break;
@@ -67,7 +78,8 @@ Debug::type Debug::value(string const & val)
        return l;
 }
 
-void Debug::showLevel(ostream &o, Debug::type level)
+
+void Debug::showLevel(ostream & o, Debug::type level)
 {
        // Show what features are traced
        for (int i = 0 ; i < numErrorTags ; ++i)
@@ -79,14 +91,11 @@ void Debug::showLevel(ostream &o, Debug::type level)
 }
 
 
-void Debug::showTags(ostream &) 
+void Debug::showTags(ostream & os
 {
        for (int i = 0 ; i < numErrorTags ; ++i)
-               fprintf(stdout, "  %5d  %-10s%-35s\n", 
-                       errorTags[i].level,
-                       errorTags[i].name, 
-                       errorTags[i].desc);
+               os << setw(7) << errorTags[i].level
+                  << setw(10) << errorTags[i].name
+                  << "  " << errorTags[i].desc << '\n';
+       os.flush();
 }
-
-
-