コード例 #1
0
ファイル: vhdljjparser.cpp プロジェクト: Distrotech/doxygen
bool checkInlineCode(QCString & doc)
{
  int index=doc.find("\\code");

  if (index>0)
  {
     strComment+=doc;
	 startCodeBlock(index);
	 doxComment=TRUE;
	 return true;
  }
  return false;
}
コード例 #2
0
static int findMatchingPart(const QCString &path,const QCString dir)
{
  int si1;
  int pos1=0,pos2=0;
  while ((si1=path.find('/',pos1))!=-1)
  {
    int si2=dir.find('/',pos2);
    //printf("  found slash at pos %d in path %d: %s<->%s\n",si1,si2,
    //    path.mid(pos1,si1-pos2).data(),dir.mid(pos2).data());
    if (si2==-1 && path.mid(pos1,si1-pos2)==dir.mid(pos2)) // match at end
    {
      return dir.length();
    }
    if (si1!=si2 || path.mid(pos1,si1-pos2)!=dir.mid(pos2,si2-pos2)) // no match in middle
    {
      return QMAX(pos1-1,0);
    }
    pos1=si1+1;
    pos2=si2+1;
  }
  return 0;
}
コード例 #3
0
ファイル: UmlClass.cpp プロジェクト: gregsmirnov/bouml
void UmlClass::uml2java(bool rec) {
  if (isJavaExternal())
    set_JavaDecl(JavaSettings::externalClassDecl());
  else {
    QCString st = JavaSettings::classStereotype(stereotype());
    UmlItem * pack = parent()->parent();
    
    while (pack->kind() != aPackage)
      pack = pack->parent();
    
    if ((st == "stereotype") ||
	(st == "metaclass") ||
	(pack->stereotype() == "profile")) {
      set_CppDecl("");
      return;
    }
    
    if (st == "enum_pattern")
      set_JavaDecl(JavaSettings::enumPatternDecl());
    else if (st == "enum")
      set_JavaDecl(JavaSettings::enumDecl());
    else if (st == "interface")
      set_JavaDecl(JavaSettings::interfaceDecl());
    else if (st == "@interface") {
      QCString s = JavaSettings::interfaceDecl();
      int index = s.find("interface");
      
      if (index != -1)
	s.insert(index, '@');
      set_JavaDecl(s);
    }
    else if (st == "ignored") {
      set_JavaDecl("");
      return;
    }
    else
      set_JavaDecl(JavaSettings::classDecl());
    
    if (rec) {
      const QVector<UmlItem> ch = children();
      unsigned n = ch.size();
      
      for (unsigned i = 0; i != n; i += 1)
	ch[i]->uml2java(rec);
    }
    
    if (parent()->kind() == aClassView)
      // not nested
      artifact()->set_JavaSource(JavaSettings::sourceContent());
  }
}
コード例 #4
0
void FileOut::define_datatypes(bool uml_20, bool primitive_type, bool gen_extension) {
  const char * pfix = (primitive_type) 
	? ((uml_20) ? "<ownedMember xmi:type=\"uml:PrimitiveType\""
		    : "<packagedElement xmi:type=\"uml:PrimitiveType\"")
	: ((uml_20) ? "<ownedMember xmi:type=\"uml:DataType\""
		    : "<packagedElement xmi:type=\"uml:DataType\"");

  QMap<QCString, int>::ConstIterator it;
  
  for (it = _datatypes.begin();
       it != _datatypes.end();
       ++it) {
    indent();
    (*this) << pfix << " xmi:id=\"BOUML_datatype_"
      << it.data() << "\" name=\"";
    quote(it.key());
    (*this) << "\"/>\n";
  }
  
  const char * postfix = 
    (uml_20) ? "</ownedMember>\n" : "</packagedElement>\n";

  for (it = _modifiedtypes.begin();
       it != _modifiedtypes.end();
       ++it) {
    QCString k = it.key();
    int index = k.find('_');
    
    indent();
    (*this) << pfix << " xmi:id=\"BOUML_basedontype_"
      << it.data() << "\" name = \"";
    quote(k.mid(index + 1));
    (*this) << '"';

    if (gen_extension) {
      (*this) << ">\n";
      indent();
      (*this) << "\t<xmi:Extension extender=\"Bouml\">\n";
      indent();
      (*this) << "\t\t<basedOn \"BOUML_" << k.left(index) << "\"/>\n";
      indent();
      (*this) << "\t</xmi:Extension>\n";
      indent();
      (*this) << postfix;
    }
    else
      (*this) << "/>\n";
  }
}
コード例 #5
0
ファイル: dmctl.cpp プロジェクト: serghei/kde3-kdebase
int DM::numReserve()
{
    if(DMType == GDM)
        return 1; /* Bleh */

    if(DMType == OldKDM)
        return strstr(ctl, ",rsvd") ? 1 : -1;

    QCString re;
    int p;

    if(!(exec("caps\n", re) && (p = re.find("\treserve ")) >= 0))
        return -1;
    return atoi(re.data() + p + 9);
}
コード例 #6
0
void UmlClassItem::remove_preprocessor(QCString & s)
{
  int index = 0;
  
  while ((index = s.find('#', index)) != -1) {
    // remove all up to the end of line
    int index2 = index + 1;
    int index3;
    
    while ((index3 = s.find('\n', index2)) != -1) {
      // manage multi lines #define
      if (((const char *) s)[index3 - 1] != '\\')
	break;
      else
	index2 = index3 + 1;
    }
    
    // the \n is still here to hava a separator
    if (index3 == -1)
      s.truncate(index);
    else
      s.remove(index, index3 - index);
  }
}
コード例 #7
0
void KJFilename::timeUpdate(int)
{
	if ( !napp->player()->current() ) // just for safety
		return;

	QCString title = QCString( napp->player()->current().title().local8Bit() );

	if ( title == mLastTitle )
		return;

	mLastTitle = title;

	QCString timestring = napp->player()->lengthString().local8Bit();
	timestring = timestring.mid(timestring.find('/')+1);
	prepareString ( title + " (" + timestring + ")   ");
}
コード例 #8
0
QCString value_of(QCString s, QCString k, int & index)
{
  index = s.find(k);
  
  if (index == -1) {
    QCString result;
    
    return result;
  }
  else {
    int index2;
    
    index += k.length();
    return get_next_word(s, index, index2);
  }
}
コード例 #9
0
ファイル: kbufferdrag.cpp プロジェクト: serghei/kde3-kdeutils
// tries to create a codec by the given charset description
static QTextCodec* codecForCharset( const QCString& Desc )
{
  int i = Desc.find( "charset=" );
  if( i >= 0 )
  {
    QCString CharSetName = Desc.mid( i+8 );
    // remove any further attributes
    if( (i=CharSetName.find( ';' )) >= 0 )
      CharSetName = CharSetName.left( i );

    // try to find codec
    return QTextCodec::codecForName( CharSetName );
  }
  // no charset=, use locale
  return KGlobal::locale()->codecForEncoding();
}
コード例 #10
0
ファイル: qdragobject.cpp プロジェクト: kthxbyte/QT2-Linaro
static
QTextCodec* findcharset(const QCString& mimetype)
{
    int i=mimetype.find("charset=");
    if ( i >= 0 ) {
	QCString cs = mimetype.mid(i+8);
	stripws(cs);
	i = cs.find(';');
	if ( i >= 0 )
	    cs = cs.left(i);
	// May return 0 if unknown charset
	return QTextCodec::codecForName(cs,cs.length()*3/4);
    }
    // no charset=, use locale
    return QTextCodec::codecForLocale();
}
コード例 #11
0
ファイル: groupdef.cpp プロジェクト: wufengyi/doxygen
bool GroupDef::addClass(const ClassDef *cd)
{
  static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
  if (cd->isHidden()) return FALSE;
  updateLanguage(cd);
  QCString qn = cd->name();
  if (classSDict->find(qn)==0)
  {
    //printf("--- addClass %s sort=%d\n",qn.data(),sortBriefDocs);
    if (sortBriefDocs)
    {
      classSDict->inSort(qn,cd);
    }
    else
    {
      int i=qn.findRev("::");
      if (i==-1) i=qn.find('.');
      bool found=FALSE;
      //printf("i=%d\n",i);
      if (i!=-1)
      {
        // add nested classes (e.g. A::B, A::C) after their parent (A) in 
        // order of insertion
        QCString scope = qn.left(i);
        int j=classSDict->findAt(scope);
        if (j!=-1)
        {
          while (j<(int)classSDict->count() && 
              classSDict->at(j)->qualifiedName().left(i)==scope)
          {
            //printf("skipping over %s\n",classSDict->at(j)->qualifiedName().data());
            j++;
          }
          //printf("Found scope at index %d\n",j);
          classSDict->insertAt(j,qn,cd);
          found=TRUE;
        }
      }
      if (!found) // no insertion point found -> just append
      {
        classSDict->append(qn,cd);
      }
    }
    return TRUE;
  }
  return FALSE;
}
コード例 #12
0
void DebuggerPart::slotDCOPApplicationRegistered(const QCString& appId)
{
    if (appId.find("drkonqi-") == 0) {
        QByteArray answer;
        QCString replyType;

        kapp->dcopClient()->call(appId, "krashinfo", "appName()", QByteArray(), replyType, answer, true, 5000);

        QDataStream d(answer, IO_ReadOnly);
        QCString appName;
        d >> appName;

        if (appName.length() && project() && project()->mainProgram().endsWith(appName)) {
            kapp->dcopClient()->send(appId, "krashinfo", "registerDebuggingApplication(QString)", i18n("Debug in &KDevelop"));
            connectDCOPSignal(appId, "krashinfo", "acceptDebuggingApplication()", "slotDebugExternalProcess()", true);
        }
    }
コード例 #13
0
ファイル: kbufferdrag.cpp プロジェクト: serghei/kde3-kdeutils
// creates the name for the local text/plain
static const char *localTextPlain()
{
  static QCString TextPlainLocal;

  if( TextPlainLocal.isNull() )
  {
    TextPlainLocal = QCString(KGlobal::locale()->encoding()).lower();
    // remove the whitespaces
    int s;
    while( (s=TextPlainLocal.find(' ')) >= 0 )
      TextPlainLocal.remove( s, 1 );

    TextPlainLocal.prepend( TextPlainLocalStub );
  }

  return TextPlainLocal;
}
コード例 #14
0
ファイル: dcopsignals.cpp プロジェクト: serghei/kde3-kdelibs
/**
 * Client "conn" emits the signal "fun" with "data" as arguments.
 *
 * If "excludeSelf" is true, signal is never sent to "conn" itself.
 */
void DCOPSignals::emitSignal(DCOPConnection *conn, const QCString &_fun, const QByteArray &data, bool excludeSelf)
{
    QCString senderObj;
    QCString fun = _fun;
    int i = fun.find('#');
    if(i > -1)
    {
        senderObj = fun.left(i);
        fun = fun.mid(i + 1);
    }

    DCOPSignalConnectionList *list = connections.find(fun);
    if(!list)
        return;
    for(DCOPSignalConnection *current = list->first(); current; current = list->next())
    {
        bool doSend = false;
        if(current->senderConn)
        {
            if(current->senderConn == conn)
                doSend = true;
        }
        else if(!current->sender.isEmpty())
        {
            if((conn && current->sender == conn->appId) || (current->sender == "DCOPServer"))
                doSend = true;
        }
        else
        {
            doSend = true;
        }

        if(!current->senderObj.isEmpty() && (current->senderObj != senderObj))
        {
            doSend = false;
        }

        if(excludeSelf && (conn == current->recvConn))
            doSend = false;
        if(doSend)
        {
            the_server->sendMessage(current->recvConn, conn ? conn->appId : QCString("DCOPServer"), current->recvConn->appId, current->recvObj,
                                    current->slot, data);
        }
    }
}
コード例 #15
0
ファイル: applnk.cpp プロジェクト: opieproject/opie
/*!
  Executes the application associated with this AppLnk, with
  \a args as arguments.

  \sa exec()
*/
void AppLnk::execute(const QStringList& args) const
{
#ifdef Q_WS_QWS
    if ( !mRotation.isEmpty() ) {
  // ######## this will only work in the server
  int rot = QPEApplication::defaultRotation();
  int j = 0;
  rot = (rot+mRotation.toInt())%360;
  QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed";
  QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() );
  setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( rot ), 1 );
  invoke(args);
  setenv("QWS_DISPLAY", old.data(), 1);
    } else
#endif
  invoke(args);
}
コード例 #16
0
ファイル: knnntpclient.cpp プロジェクト: serghei/kde3-kdepim
void KNNntpClient::doPostArticle()
{
    KNLocalArticle *art = static_cast<KNLocalArticle *>(job->data());

    sendSignal(TSsendArticle);

    if(art->messageID(false) != 0)
    {
        int rep;
        if(!sendCommand(QCString("STAT ") + art->messageID(false)->as7BitString(false), rep))
            return;

        if(rep == 223)    // 223 n <a> article retrieved - request text separately
        {
#ifndef NDEBUG
            qDebug("knode: STAT successful, we have probably already sent this article.");
#endif
            return;       // the article is already on the server, lets put it silently into the send folder
        }
    }

    if(!sendCommandWCheck("POST", 340))       // 340 send article to be posted. End with <CR-LF>.<CR-LF>
        return;

    if(art->messageID(false) == 0)   // article has no message ID => search for a ID in the response
    {
        QCString s = getCurrentLine();
        int start = s.findRev(QRegExp("<[^\\s]*@[^\\s]*>"));
        if(start != -1)           // post response includes a recommended id
        {
            int end = s.find('>', start);
            art->messageID()->from7BitString(s.mid(start, end - start + 1));
            art->assemble();
#ifndef NDEBUG
            qDebug("knode: using the message-id recommended by the server: %s", s.mid(start, end - start + 1).data());
#endif
        }
    }

    if(!sendMsg(art->encodedContent(true)))
        return;

    if(!checkNextResponse(240))             // 240 article posted ok
        return;
}
コード例 #17
0
ファイル: ioLAG.cpp プロジェクト: serghei/kde3-kdenetwork
void KSircIOLAG::sirc_receive(QCString str, bool)
{

  if(str.contains("*L*")){
    int s1, s2;
    s1 = str.find("*L* ") + 4;
    s2 = str.length();
    if(s1 < 0 || s2 < 0){
      kdDebug(5008) << "Lag mesage broken: " << str << endl;
      return;
    }
    QString lag = str.mid(s1, s2 - s1);
    //    cerr << "Lag: " << str << endl;
    //    cerr << "Setting lag to: " << lag << endl;
    (proc->getWindowList())["!all"]->control_message(SET_LAG, lag);
  }

}
コード例 #18
0
// Returns the position of the encoding string.
static int findXMLEncoding(const QCString &str, int &encodingLength)
{
    int len = str.length();
    int pos = str.find("encoding");
    if(pos == -1)
        return -1;
    pos += 8;

    // Skip spaces and stray control characters.
    while(pos < len && str[pos] <= ' ')
        ++pos;

    //Bail out if nothing after
    // Skip equals sign.
    if(pos >= len || str[pos] != '=')
        return -1;
    ++pos;

    // Skip spaces and stray control characters.
    while(pos < len && str[pos] <= ' ')
        ++pos;

    //Bail out if nothing after
    if(pos >= len)
        return -1;

    // Skip quotation mark.
    char quoteMark = str[pos];
    if(quoteMark != '"' && quoteMark != '\'')
        return -1;
    ++pos;

    // Find the trailing quotation mark.
    int end = pos;
    while(end < len && str[end] != quoteMark)
        ++end;

    if(end >= len)
        return -1;

    encodingLength = end - pos;
    return pos;
}
コード例 #19
0
ファイル: classlist.cpp プロジェクト: stden/doxygen
void GenericsSDict::insert(const QCString &key,ClassDef *cd)
{
  int i=key.find('<');
  if (i==-1) return;
  ArgumentList argList;
  stringToArgumentList(key.mid(i),&argList);
  int c = argList.count();
  if (c==0) return;
  GenericsCollection *collection = m_dict.find(key.left(i));
  if (collection==0) // new name
  {
    collection = new GenericsCollection;
    m_dict.append(key.left(i),collection);
  }
  if (collection->find(c)==0) // should always be 0!
  {
    collection->insert(c,cd);
  }
}
コード例 #20
0
QCString value_of(QCString s, QCString k, int & index,
		  QCString & next, int & index2)
{
  QCString result;
  
  index = s.find(k, index);
  
  if (index != -1) {
    index += k.length();
    result = get_next_word(s, index, index2);
    
    if (! result.isEmpty()) {
      int index3;
      
      next = get_next_word(s, index2, index3);
    }
  }
  
  return result;
}
コード例 #21
0
ファイル: dmctl.cpp プロジェクト: serghei/kde3-kdebase
void DM::shutdown(KApplication::ShutdownType shutdownType, KApplication::ShutdownMode shutdownMode, /* NOT Default */
                  const QString &bootOption)
{
    if(shutdownType == KApplication::ShutdownTypeNone)
        return;

    bool cap_ask;
    if(DMType == NewKDM)
    {
        QCString re;
        cap_ask = exec("caps\n", re) && re.find("\tshutdown ask") >= 0;
    }
    else
    {
        if(!bootOption.isEmpty())
            return;
        cap_ask = false;
    }
    if(!cap_ask && shutdownMode == KApplication::ShutdownModeInteractive)
        shutdownMode = KApplication::ShutdownModeForceNow;

    QCString cmd;
    if(DMType == GDM)
    {
        cmd.append(shutdownMode == KApplication::ShutdownModeForceNow ? "SET_LOGOUT_ACTION " : "SET_SAFE_LOGOUT_ACTION ");
        cmd.append(shutdownType == KApplication::ShutdownTypeReboot ? "REBOOT\n" : "HALT\n");
    }
    else
    {
        cmd.append("shutdown\t");
        cmd.append(shutdownType == KApplication::ShutdownTypeReboot ? "reboot\t" : "halt\t");
        if(!bootOption.isEmpty())
            cmd.append("=").append(bootOption.local8Bit()).append("\t");
        cmd.append(shutdownMode == KApplication::ShutdownModeInteractive ? "ask\n" : shutdownMode == KApplication::ShutdownModeForceNow
                                                                                         ? "forcenow\n"
                                                                                         : shutdownMode == KApplication::ShutdownModeTryNow
                                                                                               ? "trynow\n"
                                                                                               : "schedule\n");
    }
    exec(cmd.data());
}
コード例 #22
0
ファイル: definition.cpp プロジェクト: kevinoupeng/mydg
bool Definition::_docsAlreadyAdded(const QCString &doc,QCString &sigList)
{
  uchar md5_sig[16];
  QCString sigStr(33);
  // to avoid mismatches due to differences in indenting, we first remove
  // double whitespaces...
  QCString docStr = doc.simplifyWhiteSpace();
  MD5Buffer((const unsigned char *)docStr.data(),docStr.length(),md5_sig);
  MD5SigToString(md5_sig,sigStr.rawData(),33);
  //printf("%s:_docsAlreadyAdded doc='%s' sig='%s' docSigs='%s'\n",
  //    name().data(),doc.data(),sigStr.data(),sigList.data());
  if (sigList.find(sigStr)==-1) // new docs, add signature to prevent re-adding it
  {
    sigList+=":"+sigStr;
    return FALSE;
  }
  else
  {
    return TRUE;
  }
}
コード例 #23
0
ファイル: htmlhelp.cpp プロジェクト: dnjsflagh1/code
/*! Stores an item in the index if it is not already present. 
 *  Items are stored in alphetical order, by sorting on the
 *  concatenation of \a level1 and \a level2 (if present).
 *
 *  \param level1 the string at level 1 in the index.
 *  \param level2 the string at level 2 in the index (or 0 if not applicable).
 *  \param url the url of the documentation (without .html extension).
 *  \param anchor the anchor of the documentation within the page.
 *  \param hasLink if true, the url (without anchor) can be used in the 
 *         level1 item, when writing the header of a list of level2 items.
 *  \param reversed TRUE if level1 is the member name and level2 the compound
 *         name.
 */
void HtmlHelpIndex::addItem(const char *level1,const char *level2,
                       const char *url,const char *anchor,bool hasLink,
                       bool reversed)
{
  QCString key = level1; 
  if (level2) key+= (QCString)"?" + level2;
  if (key.find(QRegExp("@[0-9]+"))!=-1) // skip anonymous stuff
  {
    return;
  }
  if (dict->find(key)==0) // new key
  {
    //printf(">>>>>>>>> HtmlHelpIndex::addItem(%s,%s,%s,%s)\n",
    //      level1,level2,url,anchor);
    IndexField *f = new IndexField;
    f->name     = key;
    f->url      = url;
    f->anchor   = anchor;
    f->link     = hasLink;
    f->reversed = reversed;
    dict->append(key,f);
  }
}
コード例 #24
0
QCString Driver::escapeIdentifier(const QCString& str, int options) const
{
	bool needOuterQuotes = false;

// Need to use quotes if ...
// ... we have been told to, or ...
	if(options & EscapeAlways)
		needOuterQuotes = true;

// ... or if the driver does not have a list of keywords,
	else if(!d->driverSQLDict)
		needOuterQuotes = true;

// ... or if it's a keyword in Kexi's SQL dialect,
	else if(d->kexiSQLDict->find(str))
		needOuterQuotes = true;

// ... or if it's a keyword in the backends SQL dialect,
// (have already checked !d->driverSQLDict)
	else if((options & EscapeDriver) && d->driverSQLDict->find(str))
		needOuterQuotes = true;

// ... or if the identifier has a space in it...
  else if(str.find(' ') != -1)
		needOuterQuotes = true;

	if(needOuterQuotes && (options & EscapeKexi)) {
		const char quote = '"';
		return quote + QCString(str).replace( quote, "\"\"" ) + quote;
	}
	else if (needOuterQuotes) {
		const char quote = beh->QUOTATION_MARKS_FOR_IDENTIFIER.latin1();
		return quote + drv_escapeIdentifier(str) + quote;
	} else {
		return drv_escapeIdentifier(str);
	}
}
コード例 #25
0
QString Namespace::namespacify(QCString s, bool local) {
  QString r;
  int index = s.find("::");
  
  if (index == 0)
    r = ((const char *) s) + 2;
  else {
    if (index != -1) {
      QMap<QCString,QCString>::ConstIterator it = 
	Aliases.find(s.left(index));
      
      if (it != Aliases.end())
	s.replace(0, index, *it);
    }
    
    r = (Stack.isEmpty())
      ? QString(s)
      : Stack.last() + QString(s);
  }
  
  return (local)
    ? r + "\n" + Lex::filename()
    : r;
}
コード例 #26
0
ファイル: cite.cpp プロジェクト: CN-Sean/doxygen
void CiteDict::generatePage() const
{
  //printf("** CiteDict::generatePage() count=%d\n",m_ordering.count());

  // do not generate an empty citations page
  if (isEmpty()) return; // nothing to cite

  // 1. generate file with markers and citations to OUTPUT_DIRECTORY
  QFile f;
  QCString outputDir = Config_getString("OUTPUT_DIRECTORY");
  QCString citeListFile = outputDir+"/citelist.doc";
  f.setName(citeListFile);
  if (!f.open(IO_WriteOnly)) 
  {
    err("could not open file %s for writing\n",citeListFile.data());
  }
  FTextStream t(&f);
  t << "<!-- BEGIN CITATIONS -->" << endl;
  t << "<!--" << endl;
  QDictIterator<CiteInfo> it(m_entries);
  CiteInfo *ci;
  for (it.toFirst();(ci=it.current());++it)
  {
    t << "\\citation{" << ci->label << "}" << endl;
  }
  t << "-->" << endl;
  t << "<!-- END CITATIONS -->" << endl;
  t << "<!-- BEGIN BIBLIOGRAPHY -->" << endl;
  t << "<!-- END BIBLIOGRAPHY -->" << endl;
  f.close();

  // 2. generate bib2xhtml
  QCString bib2xhtmlFile = outputDir+"/bib2xhtml.pl";
  f.setName(bib2xhtmlFile);
  QCString bib2xhtml = bib2xhtml_pl;
  if (!f.open(IO_WriteOnly)) 
  {
    err("could not open file %s for writing\n",bib2xhtmlFile.data());
  }
  f.writeBlock(bib2xhtml, bib2xhtml.length());
  f.close();

  // 3. generate doxygen.bst
  QCString doxygenBstFile = outputDir+"/doxygen.bst";
  QCString bstData = doxygen_bst;
  f.setName(doxygenBstFile);
  if (!f.open(IO_WriteOnly)) 
  {
    err("could not open file %s for writing\n",doxygenBstFile.data());
  }
  f.writeBlock(bstData, bstData.length());
  f.close();

  // 4. for html we just copy the bib files to the output so that
  //    bibtex can find them without path (bibtex doesn't support path's
  //    with spaces!)
  QList<QCString> tempFiles;
  tempFiles.setAutoDelete(TRUE);
  QDir thisDir;
  if (Config_getBool("GENERATE_HTML"))
  {
    // copy bib files to the latex output dir
    QStrList &citeDataList = Config_getList("CITE_BIB_FILES");
    QCString bibOutputDir = outputDir+"/";
    QFileInfo fo(bibOutputDir);
    const char *bibdata = citeDataList.first();
    while (bibdata)
    {
      QCString bibFile = bibdata;
      if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib";
      QFileInfo fi(bibFile);
      if (fi.exists() && fi.dirPath(TRUE)!=fo.absFilePath())
      {
        if (!bibFile.isEmpty())
        {
          QCString destFile=bibOutputDir+fi.fileName().data();
          copyFile(bibFile,destFile);
          tempFiles.append(new QCString(destFile));
        }
      }
      else if (!fi.exists())
      {
        err("bib file %s not found!\n",bibFile.data());
      }
      bibdata = citeDataList.next();
    }
  }

  QCString oldDir = QDir::currentDirPath().utf8();
  QDir::setCurrent(outputDir);

  // 5. run bib2xhtml perl script on the generated file which will insert the
  //    bibliography in citelist.doc
  portable_system("perl","\""+bib2xhtmlFile+"\" "+getListOfBibFiles(" ",FALSE)+" \""+
                         citeListFile+"\"");

  QDir::setCurrent(oldDir);

  // 6. read back the file
  f.setName(citeListFile);
  if (!f.open(IO_ReadOnly)) 
  {
    err("could not open file %s/citelist.doc for reading\n",outputDir.data());
  }
  bool insideBib=FALSE;
  
  QCString doc;
  QFileInfo fi(citeListFile);
  QCString input(fi.size()+1);
  f.readBlock(input.data(),fi.size());
  f.close();
  input.at(fi.size())='\0';
  int p=0,s;
  //printf("input=[%s]\n",input.data());
  while ((s=input.find('\n',p))!=-1)
  {
    QCString line = input.mid(p,s-p);
    //printf("p=%d s=%d line=[%s]\n",p,s,line.data());
    p=s+1;

    if      (line.find("<!-- BEGIN BIBLIOGRAPHY")!=-1) insideBib=TRUE;
    else if (line.find("<!-- END BIBLIOGRAPH")!=-1)    insideBib=FALSE;
    else if (insideBib) doc+=line+"\n";
    int i;
    // determine text to use at the location of the @cite command
    if (insideBib && (i=line.find("<a name=\"CITEREF_"))!=-1)
    {
      int j=line.find("\">[");
      int k=line.find("]</a>");
      if (j!=-1 && k!=-1)
      {
        QCString label = line.mid(i+17,j-i-17);
        QCString number = line.mid(j+2,k-j-1);
        CiteInfo *ci = m_entries.find(label);
        //printf("label='%s' number='%s' => %p\n",label.data(),number.data(),ci);
        if (ci)
        {
          ci->text = number;
        }
      }
    }
  }
  //printf("doc=[%s]\n",doc.data());

  // 7. add it as a page
  addRelatedPage(CiteConsts::fileName,
       theTranslator->trCiteReferences(),doc,0,CiteConsts::fileName,1,0,0,0);

  // 8. for latex we just copy the bib files to the output and let 
  //    latex do this work.
  if (Config_getBool("GENERATE_LATEX"))
  {
    // copy bib files to the latex output dir
    QStrList &citeDataList = Config_getList("CITE_BIB_FILES");
    QCString latexOutputDir = Config_getString("LATEX_OUTPUT")+"/";
    const char *bibdata = citeDataList.first();
    while (bibdata)
    {
      QCString bibFile = bibdata;
      if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib";
      QFileInfo fi(bibFile);
      if (fi.exists())
      {
        if (!bibFile.isEmpty())
        {
          copyFile(bibFile,latexOutputDir+fi.fileName().data());
        }
      }
      else
      {
        err("bib file %s not found!\n",bibFile.data());
      }
      bibdata = citeDataList.next();
    }
  }

  // 9. Remove temporary files
  thisDir.remove(citeListFile);
  thisDir.remove(doxygenBstFile);
  thisDir.remove(bib2xhtmlFile);
  while (!tempFiles.isEmpty()) 
  {
    QCString *s=tempFiles.take(0);
    thisDir.remove(*s);
  }
}
コード例 #27
0
bool UmlOperation::get_param(QCString s, int & index, QCString & r, QCString & kname, QCString & ktype, int & rank) {
int index0 = index;
int level = 0;
const char * p = (const char *) s;

r = "";

do {
  switch (p[index]) {
  case 0:
    if (level != 0)
      return FALSE;
    r = s.mid(index0, index - index0).stripWhiteSpace();
    if (r.isEmpty())
      return FALSE;
  case ',':
    if (level == 0) {
      r = s.mid(index0, index - index0).stripWhiteSpace();
      index += 1;
      if (r.isEmpty())
	return FALSE;
    }
    break;
  case '(':
  case '{':
  case '[':
    level += 1;
    break;
  case ')':
  case '}':
  case ']':
    if (--level < 0)
      return FALSE;
  }
  
  index += 1;
} while (r.isEmpty());

int index1;
int index2;

rank = -1;

if (((index1 = r.find("${p")) != -1) &&
    ((index2 = r.find("}", index1 + 3)) != -1)) {
  kname = r.mid(index1, index2 - index1 + 1);
  rank = atoi(((const char *) r) + index1 + 3);
}
else
  kname = "";

if (((index1 = r.find("${t")) != -1) &&
    ((index2 = r.find("}", index1 + 3)) != -1)) {
  ktype = r.mid(index1, index2 - index1 + 1);
  if (rank == -1)
    rank = atoi(((const char *) r) + index1 + 3);
}
else if (rank == -1)
  // too complicated;
  return FALSE;
else
  ktype = "";

return TRUE;
}
コード例 #28
0
ファイル: fetchtr.cpp プロジェクト: opieproject/opie
static void parse( MetaTranslator *tor, const char *initialContext,
		   const char *defaultContext )
{
    QMap<QCString, QCString> qualifiedContexts;
    QStringList namespaces;
    QCString context;
    QCString text;
    QCString com;
    QCString functionContext = initialContext;
    QCString prefix;
    bool utf8 = FALSE;
    bool missing_Q_OBJECT = FALSE;

    yyTok = getToken();
    while ( yyTok != Tok_Eof ) {
	switch ( yyTok ) {
	case Tok_class:
	    /*
	      Partial support for inlined functions.
	    */
	    yyTok = getToken();
	    if ( yyBraceDepth == (int) namespaces.count() &&
		 yyParenDepth == 0 ) {
		do {
		    /*
		      This code should execute only once, but we play
		      safe with impure definitions such as
		      'class Q_EXPORT QMessageBox', in which case
		      'QMessageBox' is the class name, not 'Q_EXPORT'.
		    */
		    functionContext = yyIdent;
		    yyTok = getToken();
		} while ( yyTok == Tok_Ident );

		while ( yyTok == Tok_Gulbrandsen ) {
		    yyTok = getToken();
		    functionContext += "::";
		    functionContext += yyIdent;
		    yyTok = getToken();
		}

		if ( yyTok == Tok_Colon ) {
		    missing_Q_OBJECT = TRUE;
		} else {
		    functionContext = defaultContext;
		}
	    }
	    break;
	case Tok_namespace:
	    yyTok = getToken();
	    if ( yyTok == Tok_Ident ) {
		QCString ns = yyIdent;
		yyTok = getToken();
		if ( yyTok == Tok_LeftBrace &&
		     yyBraceDepth == (int) namespaces.count() + 1 )
		    namespaces.append( QString(ns) );
	    }
	    break;
	case Tok_tr:
	case Tok_trUtf8:
	    utf8 = ( yyTok == Tok_trUtf8 );
	    yyTok = getToken();
	    if ( match(Tok_LeftParen) && matchString(&text) ) {
		com = "";
		if ( match(Tok_RightParen) || (match(Tok_Comma) &&
			matchString(&com) && match(Tok_RightParen)) ) {
		    if ( prefix.isNull() ) {
			context = functionContext;
			if ( !namespaces.isEmpty() )
			    context.prepend( (namespaces.join(QString("::")) +
					      QString("::")).latin1() );
		    } else {
			context = prefix;
		    }
		    prefix = (const char *) 0;

		    if ( qualifiedContexts.contains(context) )
			context = qualifiedContexts[context];
		    tor->insert( MetaTranslatorMessage(context, text, com,
						       QString::null, utf8) );

		    if ( lacks_Q_OBJECT.contains(context) ) {
			qWarning( "%s:%d: Class '%s' lacks Q_OBJECT macro",
				  (const char *) yyFileName, yyLineNo,
				  (const char *) context );
			lacks_Q_OBJECT.remove( context );
		    } else {
			needs_Q_OBJECT.insert( context, 0 );
		    }
		}
	    }
	    break;
	case Tok_translate:
	    utf8 = FALSE;
	    yyTok = getToken();
	    if ( match(Tok_LeftParen) &&
		 matchString(&context) &&
		 match(Tok_Comma) &&
		 matchString(&text) ) {
		com = "";
		if ( match(Tok_RightParen) ||
		     (match(Tok_Comma) &&
		      matchString(&com) &&
		      (match(Tok_RightParen) ||
		       match(Tok_Comma) &&
		       matchEncoding(&utf8) &&
		       match(Tok_RightParen))) )
		    tor->insert( MetaTranslatorMessage(context, text, com,
						       QString::null, utf8) );
	    }
	    break;
	case Tok_Q_OBJECT:
	    missing_Q_OBJECT = FALSE;
	    yyTok = getToken();
	    break;
	case Tok_Ident:
	    if ( !prefix.isNull() )
		prefix += "::";
	    prefix += yyIdent;
	    yyTok = getToken();
	    if ( yyTok != Tok_Gulbrandsen )
		prefix = (const char *) 0;
	    break;
	case Tok_Comment:
	    com = yyComment;
	    com = com.simplifyWhiteSpace();
	    if ( com.left(sizeof(MagicComment) - 1) == MagicComment ) {
		com.remove( 0, sizeof(MagicComment) - 1 );
		int k = com.find( ' ' );
		if ( k == -1 ) {
		    context = com;
		} else {
		    context = com.left( k );
		    com.remove( 0, k + 1 );
		    tor->insert( MetaTranslatorMessage(context, "", com,
						       QString::null, FALSE) );
		}

		/*
		  Provide a backdoor for people using "using
		  namespace". See the manual for details.
		*/
		k = 0;
		while ( (k = context.find("::", k)) != -1 ) {
		    qualifiedContexts.insert( context.mid(k + 2), context );
		    k++;
		}
	    }
	    yyTok = getToken();
	    break;
	case Tok_Arrow:
	    yyTok = getToken();
	    if ( yyTok == Tok_tr || yyTok == Tok_trUtf8 )
		qWarning( "%s:%d: Cannot invoke tr() like this",
			  (const char *) yyFileName, yyLineNo );
	    break;
	case Tok_Gulbrandsen:
	    // at top level?
	    if ( yyBraceDepth == (int) namespaces.count() && yyParenDepth == 0 )
		functionContext = prefix;
	    yyTok = getToken();
	    break;
	case Tok_RightBrace:
	case Tok_Semicolon:
	    if ( yyBraceDepth >= 0 &&
		 yyBraceDepth + 1 == (int) namespaces.count() )
		namespaces.remove( namespaces.fromLast() );
	    if ( yyBraceDepth == (int) namespaces.count() ) {
		if ( missing_Q_OBJECT ) {
		    if ( needs_Q_OBJECT.contains(functionContext) ) {
			qWarning( "%s:%d: Class '%s' lacks Q_OBJECT macro",
				  (const char *) yyFileName, yyLineNo,
				  (const char *) functionContext );
		    } else {
			lacks_Q_OBJECT.insert( functionContext, 0 );
		    }
		}
		functionContext = defaultContext;
		missing_Q_OBJECT = FALSE;
	    }
	    yyTok = getToken();
	    break;
	default:
	    yyTok = getToken();
	}
    }

    if ( yyBraceDepth != 0 )
	fprintf( stderr,
		 "%s:%d: Unbalanced braces in C++ code (or abuse of the C++"
		  " preprocessor)\n",
		  (const char *)yyFileName, yyBraceLineNo );
    else if ( yyParenDepth != 0 )
	fprintf( stderr,
		 "%s:%d: Unbalanced parentheses in C++ code (or abuse of the C++"
		 " preprocessor)\n",
		 (const char *)yyFileName, yyParenLineNo );
}
コード例 #29
0
bool Lex::identifierp(const char * s)
{
  return (Separators.find(*s) == -1);
}
コード例 #30
0
char Lex::read_word_bis(bool in_templ)
{
  char result = 0;
  
  if (!context.reread.isEmpty()) {
    if (in_templ && (context.reread == ">>")) {
      // >> read as > because unlike C++ not have to write "T<..X<..> >"
      context.reread = context.reread.mid(1);
      result = '>';
    }
    else {
      result = context.reread.latin1()[0];
      context.reread = QString::null;
    }
  }
  else {
    for (;;) {
      int c = get();
      
#ifdef TRACE
      //cout << "deja \"" << result << "\", '" << ((char) c) << "'\n";
#endif
      if (c == EOF)
	break;
      else if (Separators.find(c) == -1) {
	if (result == 0)
	  result = c;
      }
      else if (result != 0) {	
	unget();
	break;
      }
      else {
	switch (c) {
	case '"':
	  bypass_string();
#ifdef TRACE
	  cout << "retourne '" << (char) c << "'\n";
#endif
	  return (char) c;
	case '[':
	  bypass_array_dim();
#ifdef TRACE
	  cout << "retourne '!' (array dim)\n";
#endif
	  return '!';	// to not be [
	case '\'':
	  bypass_character();
#ifdef TRACE
	  cout << "retourne ' (char)\n";
#endif
	  return (char) c;
	case '/':
	  switch (peek()) {
	  case '/':
	    bypass_cpp_comment();
	    break;
	  case '*':
	    bypass_c_comment();
	    break;
	  case '=':
	    get();
#ifdef TRACE
	    cout << "retourne '/' (/=)\n";
#endif
	    return (char) c;
	  default:
#ifdef TRACE
	    cout << "retourne '/'\n";
#endif
	    return (char) c;
	  }
	  break;
	case '\n':
	  context.line_number += 1;
	  break;
	case '@':
	  bypass_annotation();
#ifdef TRACE
	  cout << "retourne '@' (annotation)\n";
#endif
	  return (char) c;
	case '>':
	  if (in_templ && (peek() == '>')) {
	    // >> read as > because unlike C++ not have to write "T<..X<..> >"
	    get();
	    if (peek() != '=') {
	      unget();
#ifdef TRACE
	      cout << "retourne '>'\n";
#endif
	      return '>';
	    }
	    unget();
	  }
	  // no break
	default:
	  if (c > ' ')
	    return bypass_operator(c);
	  break;
	}
      }
    }
  }
#ifdef TRACE
  cout << "retourne '" << result << "'\n";
#endif
  return result;
}