Branch: Tag:

2001-03-06

2001-03-06 16:40:19 by David Norlin <norlin@roxen.com>

New error reporting system with better line info.

Rev: lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:1.10
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/DocParser.pmod:1.24
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/PikeExtractor.pmod:1.8
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/PikeObjects.pmod:1.10
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:1.13
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/ProcessXML.pmod:1.9
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/debug.h:1.1
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/module.pmod:1.4

1:   // This module contains utility functions for XML creation and   // some other useful stuff common to all the modules.    + #include "./debug.h" +    static constant DOC_COMMENT = "//!";      static int isDigit(int c) { return '0' <= c && c <= '9'; }
57:    string content = stringp(arg1) ? arg1 : stringp(arg2) ? arg2 : 0;    if (content && content != "")    return opentag(t, attributes) + content + closetag(t); -  return "<" + t + "/>"; +  string s = "<" + t + writeattributes(attributes) + "/>"; +  return s;   }      class SourcePosition {
65:    int firstline;    int lastline;    -  static void create(string|void filename, int|void firstline, +  static void create(string filename, int firstline,    int|void lastline)    { -  +  if (!firstline) { +  werror("**********************************************************\n"); +  werror("* NO FIRST LINE !!!!! \n"); +  werror("**********************************************************\n"); +  werror("%s", describe_backtrace(backtrace())); +  werror("**********************************************************\n"); +  werror("**********************************************************\n"); +  }    local::filename = filename;    local::firstline = firstline;    local::lastline = lastline;    }    -  +  SourcePosition copy() { +  return SourcePosition(filename, firstline, lastline); +  } +     string _sprintf() {    string res = "SourcePosition(File: " + (filename ? filename : "?");    if (firstline)
82:    res += sprintf(", line: %d", firstline);    return res + ")";    } +  +  string xml() { +  mapping(string:string) m = ([]); +  m["file"] = filename || "?"; +  if (firstline) m["first-line"] = (string) firstline; +  if (lastline) m["last-line"] = (string) lastline; +  return xmltag("source-position", m);    } -  + }    -  + class AutoDocError { +  SourcePosition position; +  string part; // which part of the autodoc system... +  string message; +  static void create(SourcePosition _position, string _part, string _message) { +  position = _position; +  part = _part; +  message = _message; +  } +  string _sprintf() { +  return sprintf("AutoDocError(%O, %O, %O)", position, part, message); +  } + }