Functions
commentcnv.h File Reference

Go to the source code of this file.

Functions

void convertCppComments (BufStr *inBuf, BufStr *outBuf, const char *fileName)
 

Function Documentation

void convertCppComments ( BufStr inBuf,
BufStr outBuf,
const char *  fileName 
)

This function does three things:

  1. It converts multi-line C++ style comment blocks (that are aligned) to C style comment blocks (if MULTILINE_CPP_IS_BRIEF is set to NO).
  2. It replaces aliases with their definition (see ALIASES)
  3. It handles conditional sections (cond...endcond blocks)

Definition at line 3717 of file commentcnv.cpp.

3718 {
3719  //printf("convertCppComments(%s)\n",fileName);
3720  g_inBuf = inBuf;
3721  g_outBuf = outBuf;
3722  g_inBufPos = 0;
3723  g_col = 0;
3724  g_mlBrief = Config_getBool("MULTILINE_CPP_IS_BRIEF");
3725  g_skip = FALSE;
3726  g_fileName = fileName;
3729  g_lineNr = 1;
3730  g_condStack.clear();
3731  g_condStack.setAutoDelete(TRUE);
3732  g_commentStack.clear();
3733  g_commentStack.setAutoDelete(TRUE);
3734 
3736  isFixedForm = FALSE;
3738  {
3739  isFixedForm = recognizeFixedForm(inBuf->data());
3740  }
3741 
3743  {
3744  g_nestingCount=0;
3745  BEGIN(CComment);
3746  g_commentStack.push(new CommentCtx(g_lineNr));
3747  }
3748  else
3749  {
3750  BEGIN(Scan);
3751  }
3752  commentcnvYYlex();
3753  while (!g_condStack.isEmpty())
3754  {
3755  CondCtx *ctx = g_condStack.pop();
3756  QCString sectionInfo = " ";
3757  if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label %s ",ctx->sectionId.data());
3758  warn(g_fileName,ctx->lineNr,"Conditional section%sdoes not have "
3759  "a corresponding \\endcond command within this file.",sectionInfo.data());
3760  }
3762  {
3763  QCString tmp= "(probable line reference: ";
3764  bool first = TRUE;
3765  while (!g_commentStack.isEmpty())
3766  {
3767  CommentCtx *ctx = g_commentStack.pop();
3768  if (!first) tmp += ", ";
3769  tmp += QCString().setNum(ctx->lineNr);
3770  first = FALSE;
3771  delete ctx;
3772  }
3773  tmp += ")";
3774  warn(g_fileName,g_lineNr,"Reached end of file while still inside a (nested) comment. "
3775  "Nesting level %d %s",g_nestingCount+1,tmp.data()); // add one for "normal" expected end of comment
3776  }
3777  g_commentStack.clear();
3778  g_nestingCount = 0;
3780  {
3781  g_outBuf->at(g_outBuf->curPos())='\0';
3782  msg("-------------\n%s\n-------------\n",g_outBuf->data());
3783  }
3785 }
static BufStr * g_inBuf
char * data() const
Definition: bufstr.h:81
static bool isFixedForm
static bool recognizeFixedForm(const char *contents)
void msg(const char *fmt,...)
Definition: message.cpp:107
void printlex(int dbg, bool enter, const char *lexName, const char *fileName)
Definition: message.cpp:242
static QCString g_fileName
static SrcLangExt g_lang
const bool FALSE
Definition: qglobal.h:370
uint curPos() const
Definition: bufstr.h:97
static bool g_mlBrief
QCString sectionId
#define CComment
static QStack< CommentCtx > g_commentStack
fileName
Definition: dumpTree.py:9
char & at(uint i) const
Definition: bufstr.h:85
static int g_nestingCount
static int g_col
static QStack< CondCtx > g_condStack
#define Scan
const char * data() const
Definition: qcstring.h:207
string tmp
Definition: languages.py:63
#define Config_getBool(val)
Definition: config.cpp:664
static int g_inBufPos
void warn(const char *file, int line, const char *fmt,...)
Definition: message.cpp:183
static bool g_pythonDocString
static int g_lineNr
QCString & sprintf(const char *format,...)
Definition: qcstring.cpp:27
QCString & setNum(short n)
Definition: qcstring.cpp:469
#define BEGIN
Definition: commentcnv.cpp:144
SrcLangExt getLanguageFromFileName(const QCString fileName)
Definition: util.cpp:7061
int commentcnvYY_flex_debug
static bool isFlagSet(DebugMask mask)
Definition: debug.cpp:119
static BufStr * g_outBuf
int commentcnvYYlex(void)
const bool TRUE
Definition: qglobal.h:371
static bool g_skip