示例#1
0
void ManDocVisitor::visitPre(DocAutoListItem *li)
{
  if (m_hide) return;
  QCString ws;
  ws.fill(' ',m_indent-2);
  if (!m_firstCol) m_t << endl;
  m_t << ".IP \"" << ws; 
  if (((DocAutoList *)li->parent())->isEnumList())
  {
    m_t << li->itemNumber() << ".\" " << m_indent+2;
  }
  else // bullet list
  {
    m_t << "\\(bu\" " << m_indent;
  }
  m_t << endl;
  m_firstCol=TRUE;
}
示例#2
0
static void writeTemplateArgumentList(sqlite3* /*db*/,
                                      ArgumentList * /*al*/,
                                      Definition * /*scope*/,
                                      FileDef * /*fileScope*/,
                                      int /*indent*/)
{
#if 0
  QCString indentStr;
  indentStr.fill(' ',indent);
  if (al)
  {
    t << indentStr << "<templateparamlist>" << endl;
    ArgumentListIterator ali(*al);
    Argument *a;
    for (ali.toFirst();(a=ali.current());++ali)
    {
      t << indentStr << "  <param>" << endl;
      if (!a->type.isEmpty())
      {
        t << indentStr <<  "    <type>";
        linkifyText(TextGeneratorXMLImpl(t),scope,fileScope,0,a->type);
        t << "</type>" << endl;
      }
      if (!a->name.isEmpty())
      {
        t << indentStr <<  "    <declname>" << a->name << "</declname>" << endl;
        t << indentStr <<  "    <defname>" << a->name << "</defname>" << endl;
      }
      if (!a->defval.isEmpty())
      {
        t << indentStr << "    <defval>";
        linkifyText(TextGeneratorXMLImpl(t),scope,fileScope,0,a->defval);
        t << "</defval>" << endl;
      }
      t << indentStr << "  </param>" << endl;
    }
    t << indentStr << "</templateparamlist>" << endl;
  }
#endif
}
示例#3
0
static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t,
                           const QList<FTVNode> &nl,int level,bool &first)
{
    static QCString htmlOutput = Config_getString("HTML_OUTPUT");
    QCString indentStr;
    indentStr.fill(' ',level*2);
    bool found=FALSE;
    QListIterator<FTVNode> nli(nl);
    FTVNode *n;
    for (nli.toFirst(); (n=nli.current()); ++nli)
    {
        // terminate previous entry
        if (!first) t << "," << endl;
        first=FALSE;

        // start entry
        if (!found)
        {
            t << "[" << endl;
        }
        found=TRUE;

        if (n->addToNavIndex) // add entry to the navigation index
        {
            if (n->def && n->def->definitionType()==Definition::TypeFile)
            {
                FileDef *fd = (FileDef*)n->def;
                bool doc,src;
                doc = fileVisibleInIndex(fd,src);
                if (doc)
                {
                    navIndex.append(new NavIndexEntry(node2URL(n,TRUE,FALSE),pathToNode(n,n)));
                }
                if (src)
                {
                    navIndex.append(new NavIndexEntry(node2URL(n,TRUE,TRUE),pathToNode(n,n)));
                }
            }
            else
            {
                navIndex.append(new NavIndexEntry(node2URL(n),pathToNode(n,n)));
            }
        }

        if (n->separateIndex) // store items in a separate file for dynamic loading
        {
            bool firstChild=TRUE;
            t << indentStr << "  [ ";
            generateJSLink(t,n);
            if (n->children.count()>0) // write children to separate file for dynamic loading
            {
                QCString fileId = n->file;
                if (n->anchor)
                {
                    fileId+="_"+n->anchor;
                }
                if (dupOfParent(n))
                {
                    fileId+="_dup";
                }
                QFile f(htmlOutput+"/"+fileId+".js");
                if (f.open(IO_WriteOnly))
                {
                    FTextStream tt(&f);
                    tt << "var " << convertFileId2Var(fileId) << " =" << endl;
                    generateJSTree(navIndex,tt,n->children,1,firstChild);
                    tt << endl << "];";
                }
                t << "\"" << fileId << "\" ]";
            }
            else // no children
            {
                t << "null ]";
            }
        }
        else // show items in this file
        {
            bool firstChild=TRUE;
            t << indentStr << "  [ ";
            generateJSLink(t,n);
            bool emptySection = !generateJSTree(navIndex,t,n->children,level+1,firstChild);
            if (emptySection)
                t << "null ]";
            else
                t << endl << indentStr << "  ] ]";
        }
    }
    return found;
}
示例#4
0
QCString DocSets::indent()
{
  QCString result;
  result.fill(' ',(m_dc+2)*2);
  return result;
}
示例#5
0
/*! Reads a fragment of code from file \a fileName starting at 
 * line \a startLine and ending at line \a endLine (inclusive). The fragment is
 * stored in \a result. If FALSE is returned the code fragment could not be
 * found.
 *
 * The file is scanned for a opening bracket ('{') from \a startLine onward
 * The line actually containing the bracket is returned via startLine.
 * The file is scanned for a closing bracket ('}') from \a endLine backward.
 * The line actually containing the bracket is returned via endLine.
 * Note that for VHDL code the bracket search is not done.
 */
static bool readCodeFragment(const char *fileName,
                      int &startLine,int &endLine,QCString &result)
{
  static bool vhdlOpt           = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
  static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES");
  //printf("readCodeFragment(%s,%d,%d)\n",fileName,startLine,endLine);
  if (fileName==0 || fileName[0]==0) return FALSE; // not a valid file name
  QCString filter = getFileFilter(fileName,TRUE);
  FILE *f=0;
  bool usePipe = !filter.isEmpty() && filterSourceFiles;
  if (!usePipe) // no filter given or wanted
  {
    f = portable_fopen(fileName,"r");
  }
  else // use filter
  {
    QCString cmd=filter+" \""+fileName+"\"";
    Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data());
    f = portable_popen(cmd,"r");
  }
  bool found=vhdlOpt;  // for VHDL no bracket search is possible
  if (f)
  {
    int c=0;
    int col=0;
    int lineNr=1;
    // skip until the startLine has reached
    while (lineNr<startLine && !feof(f))
    {
      while ((c=fgetc(f))!='\n' && c!=EOF) /* skip */;
      lineNr++; 
    }
    if (!feof(f))
    {
      // skip until the opening bracket or lonely : is found
      char cn=0;
      while (lineNr<=endLine && !feof(f) && !found)
      {
        int pc=0;
        while ((c=fgetc(f))!='{' && c!=':' && c!=EOF) 
        {
          //printf("parsing char `%c'\n",c);
          if (c=='\n') 
          {
            lineNr++,col=0; 
          }
          else if (c=='\t') 
          {
            col+=Config_getInt("TAB_SIZE") - (col%Config_getInt("TAB_SIZE"));
          }
          else if (pc=='/' && c=='/') // skip single line comment
          {
            while ((c=fgetc(f))!='\n' && c!=EOF) pc=c;
            if (c=='\n') lineNr++,col=0;
          }
          else if (pc=='/' && c=='*') // skip C style comment
          {
            while (((c=fgetc(f))!='/' || pc!='*') && c!=EOF) 
            {
              if (c=='\n') lineNr++,col=0;
              pc=c;
            }
          }
          else
          {
            col++;
          }
          pc = c;
        }
        if (c==':')
        {
          cn=fgetc(f);
          if (cn!=':') found=TRUE;
        }
        else if (c=='{')
        {
          found=TRUE;
        }
      }
      //printf(" -> readCodeFragment(%s,%d,%d) lineNr=%d\n",fileName,startLine,endLine,lineNr);
      if (found) 
      {
        // For code with more than one line,
        // fill the line with spaces until we are at the right column
        // so that the opening brace lines up with the closing brace
        if (endLine!=startLine)
        {
          QCString spaces;
          spaces.fill(' ',col);
          result+=spaces;
        }
        // copy until end of line
        result+=c;
        if (c==':') 
        {
          result+=cn;
          if (cn=='\n') lineNr++;
        }
        startLine=lineNr;
        const int maxLineLength=4096;
        char lineStr[maxLineLength];
        do 
        {
          //printf("reading line %d in range %d-%d\n",lineNr,startLine,endLine);
          int size_read;
          do 
          {
            // read up to maxLineLength-1 bytes, the last byte being zero
            char *p = fgets(lineStr, maxLineLength,f);
            //printf("  read %s",p);
            if (p) 
            {
              size_read=qstrlen(p); 
            }
            else  // nothing read
            {
              size_read=-1;
              lineStr[0]='\0';
            }
            result+=lineStr;
          } while (size_read == (maxLineLength-1));

          lineNr++; 
        } while (lineNr<=endLine && !feof(f));

        // strip stuff after closing bracket
        int newLineIndex = result.findRev('\n');
        int braceIndex   = result.findRev('}');
        if (braceIndex > newLineIndex) 
        {
          result.truncate(braceIndex+1);
        }
        endLine=lineNr-1;
      }
    }
    if (usePipe) 
    {
      portable_pclose(f); 
    }
    else 
    {
      fclose(f);
    }
  }
  result = transcodeCharacterStringToUTF8(result);
  return found;
}