⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 doc.l

📁 doxygen(一个自动从源代码生成文档的工具)的源代码
💻 L
📖 第 1 页 / 共 5 页
字号:
	includeFileOffset==includeFileLength) found=TRUE;  }  if (s.find(key)!=-1)  {    od.writeString("    ");    parseCode(od,className,s,exampleDoc,exampleName);    //od.writeString("\n");  }}static void showUntil(OutputDocInterface &od,const char *key){  bool found=FALSE;  while (!found)  {    QCString s;    char c;    while ( includeFileOffset<includeFileLength && 	    (c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0	  ) s+=c;    if (!s.stripWhiteSpace().isEmpty())    {      od.writeString("    ");      parseCode(od,className,s,exampleDoc,exampleName);      //od.writeString("\n");      if (s.find(key)!=-1) found=TRUE;     }    if (includeFileOffset==includeFileLength) found=TRUE;  }}//-----------------------------------------------------------------static bool inBlock(){  return inParamBlock || inRetValBlock || inSeeBlock || inReturnBlock || inAuthorBlock ||         inVersionBlock || inSinceBlock || inDateBlock || inWarningBlock || inRemarkBlock || 	 inAttentionBlock || inBugBlock || inNoteBlock ||	 inParBlock || inExceptionBlock || inDeprecatedBlock || inPreBlock ||	 inPostBlock || inInvarBlock;}static void endBlock(){    if (inParamBlock || inRetValBlock || inExceptionBlock)     {      outDoc->endDescTableData();      outDoc->endDescTable();      outDoc->endParamList();    }    else    {      outDoc->endDescList();    }    currentListIndent.pop();    inParamBlock=inRetValBlock=inSeeBlock=inReturnBlock=inAuthorBlock=    inVersionBlock=inSinceBlock=inDateBlock=inBugBlock=inNoteBlock=inWarningBlock=    inParBlock=inExceptionBlock=inDeprecatedBlock=inPreBlock=inPostBlock=    inInvarBlock=inRemarkBlock=inAttentionBlock=FALSE;}//-----------------------------------------------------------------struct IndentInfo{  public:    IndentInfo(int i,bool e) : indent(i), enumerated(e) {};   ~IndentInfo() {}    void startList()     {       if (enumerated) outDoc->startEnumList(); else outDoc->startItemList();    }    void endList()    {      if (enumerated) outDoc->endEnumList(); else outDoc->endItemList();    }    void writeItem()    {      outDoc->writeListItem();    }    int indent;    bool enumerated;};static QStack<IndentInfo> listIndentStack;   // indent stack of - itemsstatic void addListItemMarker(const char *marker,int dashPos,bool enumerated){  // find the actual position at which the bullet was found  int i;  int indent=0;  for (i=0;i<dashPos;i++)  {    //printf("Parsed[%d]=%d\n",i,marker[i]);    if (marker[i]=='\t')    {      indent+=Config_getInt("TAB_SIZE") - (indent%Config_getInt("TAB_SIZE"));    }    else if (marker[i]=='\n')    {      indent=0;    }    else    {      indent++;    }  }  //printf("list marker found at column %d enumerated %d\n",indent,enumerated);  if (!insideItemList)  {    currentListIndent.push(enumerated ? "O" : "U");    listIndentStack.push(new IndentInfo(indent,enumerated));    listIndentStack.top()->startList();    listIndentStack.top()->writeItem();    insideItemList=TRUE;  }   else  {    IndentInfo *pPrevInfo = listIndentStack.top();     if (pPrevInfo->indent==indent && pPrevInfo->enumerated==enumerated)       // new item of same kind at the same indent level    {      pPrevInfo->writeItem();     }    else if (pPrevInfo->indent==indent)      // new item of diffent kind at the same indent level    {      // switch to a diffent list type      pPrevInfo->endList();      pPrevInfo->enumerated=enumerated;      pPrevInfo->startList();      pPrevInfo->writeItem();     }    else if (pPrevInfo->indent<indent) // start sub item list    {      currentListIndent.push(enumerated ? "O" : "U");      listIndentStack.push(new IndentInfo(indent,enumerated));      listIndentStack.top()->startList();      listIndentStack.top()->writeItem();    }    else // end sub item list    {      while (pPrevInfo && pPrevInfo->indent>indent)      {	pPrevInfo->endList();	listIndentStack.pop();	currentListIndent.pop();	delete pPrevInfo;	pPrevInfo = listIndentStack.top();      }      // safe guard against wrong indenting      if (listIndentStack.isEmpty())       {	insideItemList=FALSE;	warn(yyFileName,yyLineNr,             "Warning: list item with invalid indent found!");      }      else      {	listIndentStack.top()->writeItem();      }    }  }}// end the current (nested) list regardless of the nesting level.static void forceEndItemList(){  IndentInfo *info;  while ((info=listIndentStack.pop())!=0)  {    delete info;  }  while (!currentListIndent.isEmpty())  {    char c=*currentListIndent.pop();    switch(c)    {       case 'O': outDoc->endEnumList(); break;       case 'U': outDoc->endItemList(); break;       case 'D':	if (inBlock()) 	{	  currentListIndent.push("D"); // hack!	  endBlock(); 	}	else 	{	  outDoc->endDescription(); 	}	break;    }  }  insideItemList=FALSE;}static void endArgumentList(){#if 0  IndentInfo *info;  while ((info=listIndentStack.pop())!=0)  {    delete info;  }  while (!currentListIndent.isEmpty())  {    char c=*currentListIndent.pop();    switch(c)    {       case 'O': outDoc->endEnumList(); break;       case 'U': outDoc->endItemList(); break;       case 'D':	if (!inBlock()) outDoc->endDescription(); 	break;    }  }  insideItemList=FALSE;#endif  if (insideArgumentList)  {    insideArgumentList=FALSE;    outDoc->endItemList();  }}//-----------------------------------------------------------------enum ImageTypes{  IT_Html,  IT_Latex,  IT_RTF};/*! search for an image in the imageNameDict and if found * copies the image to the output directory (which is the * html directory if type==0 or the latex directory if type==1) */static QCString findAndCopyImage(const char *fileName,ImageTypes type){  QCString result;  bool ambig;  FileDef *fd;  //printf("Search for %s\n",fileName);  if ((fd=findFileDef(Doxygen::imageNameDict,fileName,ambig)))  {    QFile inImage(QString(fd->absFilePath().data()));    if (inImage.open(IO_ReadOnly))    {      result = fileName;      int i;      if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1)      {	result.right(result.length()-i-1);      }      QCString outputDir;      switch(type)      {	case IT_Html: 	  outputDir = Config_getString("HTML_OUTPUT");	  break;	case IT_Latex: 	  outputDir = Config_getString("LATEX_OUTPUT");	  break;	case IT_RTF:	  outputDir = Config_getString("RTF_OUTPUT");	  break;      }      QCString outputFile = outputDir+"/"+result;      QFile outImage(QString(outputFile.data()));      if (outImage.open(IO_WriteOnly)) // copy the image      {	char *buffer = new char[inImage.size()];	inImage.readBlock(buffer,inImage.size());	outImage.writeBlock(buffer,inImage.size());	outImage.flush();	delete buffer;      }      else      {	warn(yyFileName,yyLineNr,             "Warning: could not write output image %s",outputFile.data());      }    }    else    {      warn(yyFileName,yyLineNr,           "Warning: could not open image %s",fileName);    }  }  else if (ambig)  {    QCString text;    text.sprintf("Warning: image file name %s is ambigious.\n",fileName);    text+="Possible candidates:\n";    text+=showFileDefMatches(Doxygen::imageNameDict,fileName);    warn(yyFileName,yyLineNr,text);  }  else  {    result=fileName;    if (result.left(5)!="http:" && result.left(6)!="https:")    {      warn(yyFileName,yyLineNr,           "Warning: image file %s is not found in IMAGE_PATH: "  	   "assuming external image.",fileName          );    }  }  return result;}void writeImage(ImageTypes it,const char *size){  bool hasCaption=!curImageCaption.isEmpty();  outDoc->pushGeneratorState();  switch(it)  {    case IT_Latex:      {	outDoc->disableAllBut(OutputGenerator::Latex);	outDoc->startImage(curImageName,size,hasCaption);	if (hasCaption)	{	  scanString(curImageCaption);	}	outDoc->endImage(hasCaption);      }      break;    case IT_Html:      {	outDoc->disableAllBut(OutputGenerator::Html);	outDoc->startImage(curImageName,0,hasCaption);	if (hasCaption)	{	  scanString(curImageCaption);	}	outDoc->endImage(hasCaption);      }      break;    case IT_RTF:      {	outDoc->disableAllBut(OutputGenerator::RTF);	outDoc->startImage(curImageName,0,hasCaption);	if (hasCaption)	{	  scanString(curImageCaption);	}	outDoc->endImage(hasCaption);      }  }  outDoc->popGeneratorState();}// search for a dot file in the dotFileNameDict, and if found// generates the graph in the output directories.static void writeDotFile(const char *fileName, const char *captionText){  bool ambig;  FileDef *fd;  bool hasCaption = captionText!=0;  if ((fd=findFileDef(Doxygen::dotFileNameDict,fileName,ambig)))  {    outDoc->startDotFile(fd->absFilePath(),hasCaption);    if (hasCaption)    {       scanString(captionText);    }    outDoc->endDotFile(hasCaption);  }  else if (ambig)  {    QCString text;    text.sprintf("Warning: dot file name %s is ambigious.\n",fileName);    text+="Possible candidates:\n";    text+=showFileDefMatches(Doxygen::dotFileNameDict,fileName);    warn(yyFileName,yyLineNr,text);  }  else  {    warn(yyFileName,yyLineNr,         "Warning: dot file %s is not found in DOTFILE_DIRS! ",fileName        );  }}/* ----------------------------------------------------------------- */#undef	YY_INPUT#define	YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);static int yyread(char *buf,int max_size){    int c=0;    while ( c < max_size && inputString[inputPosition] )    {	*buf = inputString[inputPosition++] ;	//printf("%d (%c)\n",*buf,*buf);	c++; buf++;    }    return c;}//ATTR      ((({BN}+[^\>]+)/">")?)%}CMD	  ("\\"|"@")BN        [ \t\n\r]BL        [ \t\r]*"\n"BSEP      [ \t\r]*([ \t\r]|"\n")({BL}{0,100})B         [ \t]BS        ^(({B}*"//")?)(({B}*"*"+)?){B}*FILESCHAR [a-z_A-Z0-9\\:\\\/\-\+]FILEECHAR [a-z_A-Z0-9\-\+]FILEMASK  {FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)+FILE      ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|("\""[^\n\"]+"\"")ID        [a-z_A-Z][a-z_A-Z0-9]*SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})SCOPEMASK {ID}?(("::"|"#")?(~)?{ID})+URLCHAR   [a-z_A-Z0-9\~\:\?\@\&\%\#\.\-\+\/\=]URLMASK   ([a-z_A-Z][^\>\"\n]*{URLCHAR})|({URLCHAR}+)NONTERM   [\{\}\[\]\`\~\@\|\-\+\#\$\/\\\!\%\^\&\*()a-z_A-Z<>0-9\x80-\xff]WORD      ({NONTERM}+([^\n\t ]*{NONTERM}+)?)|("\""[^\n\"]"\"")ATTR      ({B}+[^>\n]*)?A         [aA]BOLD	  [bB]BODY	  [bB][oO][dD][yY]BR	  [bB][rR]EM	  [eE][mM]CENTER    [cC][eE][nN][tT][eE][rR]CODE      [cC][oO][dD][eE]DL	  [dD][lL]DD	  [dD][dD]DT	  [dD][tT]DFN       [dD][fF][nN]FORM	  [fF][oO][rR][mM]H1	  [hH]1H2	  [hH]2H3	  [hH][3-6]HEAD	  [hH][eE][aA][dD]HR	  [hH][rR]HREF      [hH][rR][eE][fF]I         [iI]IMG       [iI][mM][gG]INPUT     [iI][nN][pP][uU][tT]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -