My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
message.cpp File Reference
#include <stdio.h>
#include <qdatetime.h>
#include "config.h"
#include "util.h"
#include "debug.h"
#include "doxygen.h"
#include "portable.h"
#include "filedef.h"
#include "message.h"

Go to the source code of this file.

Functions

void initWarningFormat ()
 
void msg (const char *fmt,...)
 
static void format_warn (const char *file, int line, const char *text)
 
static void do_warn (bool enabled, const char *file, int line, const char *prefix, const char *fmt, va_list args)
 
void warn (const char *file, int line, const char *fmt,...)
 
void va_warn (const char *file, int line, const char *fmt, va_list args)
 
void warn_simple (const char *file, int line, const char *text)
 
void warn_undoc (const char *file, int line, const char *fmt,...)
 
void warn_doc_error (const char *file, int line, const char *fmt,...)
 
void warn_uncond (const char *fmt,...)
 
void err (const char *fmt,...)
 
void err_full (const char *file, int line, const char *fmt,...)
 
void printlex (int dbg, bool enter, const char *lexName, const char *fileName)
 

Variables

static QCString outputFormat
 
static const char * warning_str = "warning: "
 
static const char * error_str = "error: "
 
static FILE * warnFile = stderr
 

Function Documentation

static void do_warn ( bool  enabled,
const char *  file,
int  line,
const char *  prefix,
const char *  fmt,
va_list  args 
)
static

Definition at line 167 of file message.cpp.

References format_warn().

Referenced by err_full(), va_warn(), warn(), warn_doc_error(), and warn_undoc().

{
if (!enabled) return; // warning type disabled
const int bufSize = 40960;
char text[bufSize];
int l=0;
if (prefix)
{
qstrncpy(text,prefix,bufSize);
l=strlen(prefix);
}
vsnprintf(text+l, bufSize-l, fmt, args);
text[bufSize-1]='\0';
format_warn(file,line,text);
}
void err ( const char *  fmt,
  ... 
)

Definition at line 226 of file message.cpp.

References error_str, and warnFile.

Referenced by MemberDef::_writeReimplements(), FileDef::acquireFileVersion(), Definition::addInnerCompound(), PropertyMapper< ModuleContext::ModuleContext::Private >::addProperty(), adjustConfiguration(), MemberContext::Private::callerGraph(), MemberContext::Private::callGraph(), checkDotResult(), checkPageRelations(), classInheritedProtectionLevel(), ClassContext::Private::collaborationDiagram(), convertMapFile(), copyExtraFiles(), copyFile(), copyLatexStyleSheet(), copyLogo(), ResourceMgr::copyResourceAs(), copyStyleSheet(), MemberList::countDecMembers(), PerlModGenerator::createOutputDir(), createOutputDirectory(), PerlModGenerator::createOutputFile(), HtmlHelp::createProjectFile(), createSVG(), FlowChart::createSVG(), RTFGenerator::decrementIndentLevel(), DirContext::Private::dirGraph(), elemIsVisible(), LayoutErrorHandler::error(), Htags::execute(), TagFileErrorHandler::fatalError(), LayoutErrorHandler::fatalError(), fileToString(), Qhp::finalize(), findAndCopyImage(), FlowChart::findLabel(), FormulaList::generateBitmaps(), generateConfigFile(), generateDEF(), generateDocbook(), generateDocbookForClass(), generateDocbookForDir(), generateDocbookForFile(), generateDocbookForGroup(), generateDocbookForNamespace(), generateDocbookForPage(), generateGraphLegend(), generateLink(), generateOutput(), CiteDict::generatePage(), generatePlantUMLOutput(), generateSqlite3(), generateTemplateFiles(), generateXML(), generateXMLForClass(), generateXMLForDir(), generateXMLForFile(), generateXMLForGroup(), generateXMLForNamespace(), generateXMLForPage(), ModuleContext::Private::groupGraph(), TranslateContext::Private::handleCollaborationDiagramFor(), MemberContext::Private::handleDetailsVisibleFor(), TranslateContext::Private::handleDirDependencyGraphFor(), TranslateContext::Private::handleGeneratedAt(), TranslateContext::Private::handleImplementedBy(), TranslateContext::Private::handleIncludeDependencyGraph(), TranslateContext::Private::handleInheritanceDiagramFor(), TranslateContext::Private::handleInheritedByList(), TranslateContext::Private::handleInheritsList(), MemberContext::Private::handleNameWithContextFor(), TranslateContext::Private::handleReimplementedBy(), TranslateContext::Private::handleSourceRefBys(), TranslateContext::Private::handleSourceRefs(), TranslateContext::Private::handleWriteList(), FileContext::Private::includedByGraph(), FileContext::Private::includeGraph(), RTFGenerator::incrementIndentLevel(), ClassContext::Private::inheritanceDiagram(), RTFGenerator::init(), ManGenerator::init(), LatexGenerator::init(), HtmlGenerator::init(), DocSets::initialize(), EclipseHelp::initialize(), HtmlHelp::initialize(), NamespaceDef::insertMember(), GroupDef::insertMember(), FileDef::insertMember(), ClassDef::internalInsertMember(), ClassDef::isBaseClass(), VhdlDocGen::isSubClass(), ClassDef::isSubClass(), TemplateEngine::Private::loadByName(), loadExtensions(), Htags::loadFilemap(), loadStylesheet(), TemplateNodeCreator< TemplateNodeBlock >::mkpath(), DocInclude::parse(), parseCode(), parseDoc(), parseInput(), preProcessFile(), RTFGenerator::preProcessFileInplace(), readBoundingBox(), readConfiguration(), readInputFile(), readTagFile(), GroupDef::removeMember(), DotRunner::run(), DotFilePatcher::run(), StyleData::setStyle(), LayoutParser::startElement(), LayoutParser::startNavEntry(), OutputGenerator::startPlainFile(), testRTFOutput(), transcodeCharacterBuffer(), transcodeCharacterStringToUTF8(), updateLanguageMapping(), DocbookDocVisitor::visit(), TextDocVisitor::visit(), RTFDocVisitor::visit(), XmlDocVisitor::visit(), HtmlDocVisitor::visit(), LatexDocVisitor::visit(), ManDocVisitor::visit(), PrintDocVisitor::visit(), PerlModDocVisitor::visit(), PerlModDocVisitor::visitPre(), SearchIndexExternal::write(), ResourceMgr::writeCategory(), writeCombineScript(), NamespaceSDict::writeDeclaration(), writeDefaultLayoutFile(), writeDiaGraphFromFile(), NamespaceDef::writeDocumentation(), GroupDef::writeDocumentation(), DirDef::writeDocumentation(), FileDef::writeDocumentation(), ClassDef::writeDocumentationContents(), writeDotGraphFromFile(), writeDotImageMapFromFile(), HtmlGenerator::writeExternalSearchPage(), ClassDiagram::writeFigure(), FlowChart::writeFlowChart(), DotGfxHierarchyTable::writeGraph(), DotClassGraph::writeGraph(), DotInclDepGraph::writeGraph(), DotCallGraph::writeGraph(), DotDirDeps::writeGraph(), DotGroupCollaboration::writeGraph(), ClassDef::writeInheritanceGraph(), writeJavascriptSearchIndex(), writeLatexMakefile(), writeMakeBat(), writeMscGraphFromFile(), writePlantUMLSource(), HtmlGenerator::writeSearchPage(), Definition::writeSourceDef(), HtmlGenerator::writeStyleInfo(), and writeTagFile().

{
va_list args;
va_start(args, fmt);
vfprintf(warnFile, (QCString(error_str) + fmt).data(), args);
va_end(args);
}
void err_full ( const char *  file,
int  line,
const char *  fmt,
  ... 
)

Definition at line 234 of file message.cpp.

References do_warn(), and error_str.

Referenced by NamespaceDef::compoundTypeString().

{
va_list args;
va_start(args, fmt);
do_warn(TRUE, file, line, error_str, fmt, args);
va_end(args);
}
static void format_warn ( const char *  file,
int  line,
const char *  text 
)
static

Definition at line 122 of file message.cpp.

References Config_getBool, findFileDef(), FileDef::getVersion(), Doxygen::inputNameDict, outputFormat, substitute(), and warnFile.

Referenced by do_warn(), and warn_simple().

{
QCString fileSubst = file==0 ? "<unknown>" : file;
QCString lineSubst; lineSubst.setNum(line);
QCString textSubst = text;
QCString versionSubst;
if (file) // get version from file name
{
bool ambig;
if (fd)
{
versionSubst = fd->getVersion();
}
}
// substitute markers by actual values
bool warnAsError = Config_getBool(WARN_AS_ERROR);
QCString msgText =
"$file",fileSubst
),
"$line",lineSubst
),
"$version",versionSubst
),
"$text",textSubst
);
if (warnAsError)
{
msgText += " (warning treated as error, aborting now)";
}
msgText += '\n';
// print resulting message
fwrite(msgText.data(),1,msgText.length(),warnFile);
if (warnAsError)
{
exit(1);
}
}
void initWarningFormat ( )

Definition at line 38 of file message.cpp.

References Config_getBool, Config_getString, error_str, outputFormat, portable_fopen(), warnFile, and warning_str.

Referenced by checkConfiguration().

{
// int filePos = Config_getString(WARN_FORMAT).find("$file");
// int linePos = Config_getString(WARN_FORMAT).find("$line");
// int textPos = Config_getString(WARN_FORMAT).find("$text");
//
// // sort items on position (there are 6 cases)
// warnFormatOrder = 1;
// if (filePos>linePos && filePos>textPos)
// {
// if (linePos>textPos) // $text,$line,$file
// {
// warnFormatOrder = 2;
// }
// else // $line,$text,$file
// {
// warnFormatOrder = 3;
// }
// }
// else if (filePos<linePos && filePos<textPos)
// {
// if (linePos>textPos) // $file,$text,$line
// {
// warnFormatOrder = 4;
// }
// }
// else if (filePos<linePos && filePos>textPos) // $text,$file,$line
// {
// warnFormatOrder = 5;
// }
// else // $line,$file,$text
// {
// warnFormatOrder = 6;
// }
// outputFormat =
// substitute(
// substitute(
// substitute(
// Config_getString(WARN_FORMAT),
// "$file","%s"
// ),
// "$text","%s"
// ),
// "$line","%d"
// )+'\n';
// replace(QRegExp("\\$file"),"%s").
// replace(QRegExp("\\$text"),"%s").
// replace(QRegExp("\\$line"),"%d")+
// '\n';
if (!Config_getString(WARN_LOGFILE).isEmpty())
{
}
if (!warnFile) // point it to something valid, because warn() relies on it
{
warnFile = stderr;
}
if (Config_getBool(WARN_AS_ERROR))
{
}
}
void msg ( const char *  fmt,
  ... 
)
void printlex ( int  dbg,
bool  enter,
const char *  lexName,
const char *  fileName 
)

Definition at line 242 of file message.cpp.

References Debug::Lex, and Debug::print().

{
const char *enter_txt = "entering";
const char *enter_txt_uc = "Entering";
if (!enter)
{
enter_txt = "finished";
enter_txt_uc = "Finished";
}
if (dbg)
{
if (fileName)
fprintf(stderr,"--%s lexical analyzer: %s (for: %s)\n",enter_txt, qPrint(lexName), qPrint(fileName));
else
fprintf(stderr,"--%s lexical analyzer: %s\n",enter_txt, qPrint(lexName));
}
else
{
if (fileName)
Debug::print(Debug::Lex,0,"%s lexical analyzer: %s (for: %s)\n",enter_txt_uc, qPrint(lexName), qPrint(fileName));
else
Debug::print(Debug::Lex,0,"%s lexical analyzer: %s\n",enter_txt_uc, qPrint(lexName));
}
}
void va_warn ( const char *  file,
int  line,
const char *  fmt,
va_list  args 
)

Definition at line 191 of file message.cpp.

References Config_getBool, do_warn(), and warning_str.

Referenced by TemplateContextImpl::warn(), and TemplateParser::warn().

{
do_warn(Config_getBool(WARNINGS), file, line, warning_str, fmt, args);
}
void warn ( const char *  file,
int  line,
const char *  fmt,
  ... 
)
void warn_doc_error ( const char *  file,
int  line,
const char *  fmt,
  ... 
)

Definition at line 210 of file message.cpp.

References Config_getBool, do_warn(), and warning_str.

Referenced by checkArgumentName(), checkUndocumentedParams(), defaultHandleTitleAndSize(), defaultHandleToken(), detectNoDocumentedParams(), DocAnchor::DocAnchor(), DocCite::DocCite(), DocFormula::DocFormula(), DocHtmlCaption::DocHtmlCaption(), DocLink::DocLink(), DocRef::DocRef(), findAndCopyImage(), handleAHref(), handleAnchor(), DocPara::handleCite(), DocPara::handleCommand(), DocPara::handleFile(), DocPara::handleHtmlEndTag(), DocPara::handleHtmlStartTag(), DocPara::handleImage(), handleImg(), DocPara::handleInclude(), DocPara::handleIncludeOperator(), handleInternalRef(), DocPara::handleLink(), handleLinkedWord(), DocPara::handleRef(), DocPara::handleSection(), DocPara::handleStartCode(), handleStyleArgument(), handleStyleLeave(), handleUnclosedStyleCommands(), DocInclude::parse(), DocIndexEntry::parse(), DocCopy::parse(), DocTitle::parse(), DocDotFile::parse(), DocMscFile::parse(), DocDiaFile::parse(), DocVhdlFlow::parse(), DocLink::parse(), DocRef::parse(), DocInternalRef::parse(), DocHRef::parse(), DocHtmlHeader::parse(), DocHtmlDescTitle::parse(), DocHtmlDescList::parse(), DocSection::parse(), DocSecRefItem::parse(), DocSecRefList::parse(), DocInternal::parse(), DocHtmlList::parse(), DocPara::parse(), DocParamList::parse(), DocHtmlCaption::parse(), DocHtmlRow::parse(), DocHtmlTable::parse(), DocText::parse(), DocRoot::parse(), DocHtmlList::parseXml(), DocParamList::parseXml(), DocHtmlRow::parseXml(), processCopyDoc(), readTextFileByName(), and MemberDef::writeDocumentation().

{
va_list args;
va_start(args, fmt);
do_warn(Config_getBool(WARN_IF_DOC_ERROR), file, line, warning_str, fmt, args);
va_end(args);
}
void warn_simple ( const char *  file,
int  line,
const char *  text 
)

Definition at line 196 of file message.cpp.

References Config_getBool, format_warn(), and warning_str.

Referenced by findMember().

{
if (!Config_getBool(WARNINGS)) return; // warning type disabled
format_warn(file,line,QCString(warning_str) + text);
}
void warn_uncond ( const char *  fmt,
  ... 
)
void warn_undoc ( const char *  file,
int  line,
const char *  fmt,
  ... 
)

Definition at line 202 of file message.cpp.

References Config_getBool, do_warn(), and warning_str.

Referenced by computeClassRelations(), findMember(), and MemberDef::warnIfUndocumented().

{
va_list args;
va_start(args, fmt);
do_warn(Config_getBool(WARN_IF_UNDOCUMENTED), file, line, warning_str, fmt, args);
va_end(args);
}

Variable Documentation

const char* error_str = "error: "
static

Definition at line 28 of file message.cpp.

Referenced by err(), err_full(), and initWarningFormat().

QCString outputFormat
static

Definition at line 26 of file message.cpp.

Referenced by format_warn(), and initWarningFormat().

FILE* warnFile = stderr
static

Definition at line 36 of file message.cpp.

Referenced by err(), format_warn(), initWarningFormat(), and warn_uncond().

const char* warning_str = "warning: "
static