static void insertMemberReference(sqlite3 *db, const char*src, const char*dst, const char *file, int line, int column)
{
#if 0
  QCString scope = dst->getScopeString();
  QCString src_name = src->name();
  QCString dst_name = dst->name();
  if (!dst->getScopeString().isEmpty() && dst->getScopeString()!=def->name())
  {
    dst_name.prepend(scope+getLanguageSpecificSeparator(dst->getLanguage()));
  }
  if (!src->getScopeString().isEmpty() && src->getScopeString()!=def->name())
  {
    src_name.prepend(scope+getLanguageSpecificSeparator(src->getLanguage()));
  }
#endif
    //
  bindTextParameter(i_s_xrefs,":src",src);
  bindTextParameter(i_s_xrefs,":dst",dst);

  int id_file = insertFile(db,file);

  bindIntParameter(i_s_xrefs,":id_file",id_file);
  bindIntParameter(i_s_xrefs,":line",line);
  bindIntParameter(i_s_xrefs,":column",column);

  step(db,i_s_xrefs);
}
Exemple #2
0
static int insertMemberReference(sqlite3 *db, const char*src, const char*dst, const char *file, int line, int column)
{
  int id_file = insertFile(db,file);
  bindTextParameter(i_s_xrefs,":src",src);
  bindTextParameter(i_s_xrefs,":dst",dst);

  bindIntParameter(i_s_xrefs,":id_file",id_file);
  bindIntParameter(i_s_xrefs,":line",line);
  bindIntParameter(i_s_xrefs,":column",column);

return step(db,i_s_xrefs);
}
static void writeInnerClasses(sqlite3*db,const ClassSDict *cl)
{
  if (!cl) return;

  ClassSDict::Iterator cli(*cl);
  ClassDef *cd;
  for (cli.toFirst();(cd=cli.current());++cli)
  {
    if (!cd->isHidden() && cd->name().find('@')==-1) // skip anonymous scopes
    {
      bindTextParameter(i_s_innerclass,":refid",cd->getOutputFileBase());
      bindIntParameter(i_s_innerclass,":prot",cd->protection());
      bindTextParameter(i_s_innerclass,":name",cd->name());
      step(db,i_s_innerclass);
    }
  }
}
static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
{
  // + declaration/definition arg lists
  // + reimplements
  // + reimplementedBy
  // + exceptions
  // + const/volatile specifiers
  // - examples
  // + source definition
  // + source references
  // + source referenced by
  // - body code
  // + template arguments
  //     (templateArguments(), definitionTemplateParameterLists())
  // - call graph

  // enum values are written as part of the enum
  if (md->memberType()==MemberType_EnumValue) return;
  if (md->isHidden()) return;
  //if (md->name().at(0)=='@') return; // anonymous member

  // group members are only visible in their group
  //if (def->definitionType()!=Definition::TypeGroup && md->getGroupDef()) return;
  QCString memType;
#if 0
  // member
  idx = sqlite3_bind_parameter_index(stmt, ":refid");
  sqlite3_bind_text(stmt, idx, memberOutputFileBase(md).data(),-1,SQLITE_TRANSIENT);

  idx = sqlite3_bind_parameter_index(stmt,":kind");
  sqlite3_bind_int(stmt, idx, md->memberType());

  idx = sqlite3_bind_parameter_index(stmt, ":name");
  sqlite3_bind_text(stmt, idx, md->name().data(),-1,SQLITE_TRANSIENT);
#endif
  // memberdef
  bindTextParameter(i_s_memberdef,":refid",md->anchor());
  bindIntParameter(i_s_memberdef,":kind",md->memberType());
  bindIntParameter(i_s_memberdef,":prot",md->protection());
  bindIntParameter(i_s_memberdef,":static",md->isStatic());

  bool isFunc=FALSE;
  switch (md->memberType())
  {
    case MemberType_Function: // fall through
    case MemberType_Signal:   // fall through
    case MemberType_Friend:   // fall through
    case MemberType_DCOP:     // fall through
    case MemberType_Slot:        
      isFunc=TRUE; 
      break;
    default: 
      break;
  }
  if (isFunc)
  {
    LockingPtr<ArgumentList> al = md->argumentList();
    if (al!=0 && al->constSpecifier) 
    {
      bindIntParameter(i_s_memberdef,":const",al->constSpecifier);
    }

    bindIntParameter(i_s_memberdef,":explicit",md->isExplicit());
    bindIntParameter(i_s_memberdef,":inline",md->isInline());
    bindIntParameter(i_s_memberdef,":final",md->isFinal());
    bindIntParameter(i_s_memberdef,":sealed",md->isSealed());
    bindIntParameter(i_s_memberdef,":new",md->isNew());
    bindIntParameter(i_s_memberdef,":optional",md->isOptional());
    bindIntParameter(i_s_memberdef,":required",md->isRequired());
    bindIntParameter(i_s_memberdef,":virt",md->virtualness());
  }
  // place in the arguments and linkify the arguments

  if (md->memberType() == MemberType_Variable)
  {
    bindIntParameter(i_s_memberdef,":mutable",md->isMutable());
    bindIntParameter(i_s_memberdef,":initonly",md->isInitonly());
  }
  else if (md->memberType() == MemberType_Property)
  {
    bindIntParameter(i_s_memberdef,":readable",md->isReadable());
    bindIntParameter(i_s_memberdef,":writable",md->isWritable());
    bindIntParameter(i_s_memberdef,":gettable",md->isGettable());
    bindIntParameter(i_s_memberdef,":settable",md->isSettable());

    if (md->isAssign() || md->isCopy() || md->isRetain())
    {
      int accessor = md->isAssign() ? md->isAssign() :
          (md->isCopy() ? md->isCopy() : md->isRetain()) ;

      bindIntParameter(i_s_memberdef,":accessor",accessor);
    }
  }
  else if (md->memberType() == MemberType_Event)
  {
    bindIntParameter(i_s_memberdef,":addable",md->isAddable());
    bindIntParameter(i_s_memberdef,":removable",md->isRemovable());
    bindIntParameter(i_s_memberdef,":raisable",md->isRaisable());
  }

  if (md->memberType()!=MemberType_Define &&
      md->memberType()!=MemberType_Enumeration
     )
  {
    QCString typeStr = md->typeString();
    stripQualifiers(typeStr);
    StringList l;
    linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,typeStr);
    if (typeStr.data()) 
    {
      bindTextParameter(i_s_memberdef,":type",typeStr);
    }

    if (md->definition()) 
    {
      bindTextParameter(i_s_memberdef,":definition",md->definition());
    }

    if (md->argsString()) 
    {
      bindTextParameter(i_s_memberdef,":argsstring",md->argsString());
    }
  }

  bindTextParameter(i_s_memberdef,":name",md->name());

  if (md->memberType() == MemberType_Property)
  {
    if (md->isReadable())
    {
      DBG_CTX(("<read>\n"));
    }
    if (md->isWritable())
    {
      DBG_CTX(("<write>\n"));
    }
  }
#if 0
  if (md->memberType()==MemberType_Variable && md->bitfieldString())
  {
    QCString bitfield = md->bitfieldString();
    if (bitfield.at(0)==':') bitfield=bitfield.mid(1);
    t << "        <bitfield>" << bitfield << "</bitfield>" << endl;
  }

  MemberDef *rmd = md->reimplements();
  if (rmd)
  {
    t << "        <reimplements refid=\""
      << memberOutputFileBase(rmd) << "_1" << rmd->anchor() << "\">"
      << convertToXML(rmd->name()) << "</reimplements>" << endl;
  }
  LockingPtr<MemberList> rbml = md->reimplementedBy();
  if (rbml!=0)
  {
    MemberListIterator mli(*rbml);
    for (mli.toFirst();(rmd=mli.current());++mli)
    {
      t << "        <reimplementedby refid=\""
        << memberOutputFileBase(rmd) << "_1" << rmd->anchor() << "\">"
        << convertToXML(rmd->name()) << "</reimplementedby>" << endl;
    }
  }
#endif
  if (isFunc) //function
  {
    LockingPtr<ArgumentList> declAl = md->declArgumentList();
    LockingPtr<ArgumentList> defAl = md->argumentList();
    if (declAl!=0 && declAl->count()>0)
    {
      ArgumentListIterator declAli(*declAl);
      ArgumentListIterator defAli(*defAl);
      Argument *a;
      for (declAli.toFirst();(a=declAli.current());++declAli)
      {
        Argument *defArg = defAli.current();
        DBG_CTX(("<param>\n"));
        if (!a->attrib.isEmpty())
        {
          DBG_CTX(("<attributes>:%s\n",a->attrib.data()));
        }
        if (!a->type.isEmpty())
        {
          StringList l;
          linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,a->type);

          QCString *s=l.first();
          while (s) 
          {
            insertMemberReference(db,md->anchor().data(),s->data(),def->getDefFileName().data(),md->getDefLine(),1);
            s=l.next();
          }
        }
        if (!a->name.isEmpty())
        {
          DBG_CTX(("<declname>%s\n",a->name.data()));
        }
        if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name)
        {
          DBG_CTX(("<defname>%s\n",defArg->name.data()));
        }
        if (!a->array.isEmpty())
        {
          DBG_CTX(("<array>%s",a->array.data()));
        }
        if (!a->defval.isEmpty())
        {
          StringList l;
          linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,a->defval);
        }
        if (defArg) ++defAli;
      }
    }
  }
  else if (md->memberType()==MemberType_Define &&
          md->argsString()) // define
  {
    if (md->argumentList()->count()==0) // special case for "foo()" to
                                        // disguish it from "foo".
    {
      DBG_CTX(("no params\n"));
    }
    else
    {
      ArgumentListIterator ali(*md->argumentList());
      Argument *a;
      for (ali.toFirst();(a=ali.current());++ali)
      {
        DBG_CTX(("<param><defname>%s\n",a->type.data()));
      }
    }
  }


  // Extract references from initializer
  // avoid that extremely large tables are written to the output.
  // todo: it's better to adhere to MAX_INITIALIZER_LINES.
  // drm_mod_register_buffer,
  if (!md->initializer().isEmpty() && md->initializer().length()<2000)
  {
    StringList l;
    linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,md->initializer());
    QCString *s=l.first();
    while (s) 
    {
      DBG_CTX(("initializer:%s %s %s %d\n",
              md->anchor().data(),
              s->data(), 
              md->getBodyDef()->getDefFileName().data(), 
              md->getStartBodyLine()));
      insertMemberReference(db,md->anchor().data(),s->data(),md->getBodyDef()->getDefFileName().data(),md->getStartBodyLine(),1);
      s=l.next();
    }
  }

#if 0
  if (md->excpString())
  {
    linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,md->excpString());
  }
#endif
  if ( md->getScopeString() ) 
  {
    bindTextParameter(i_s_memberdef,":scope",md->getScopeString());
  }

  // File location
  if (md->getDefLine() != -1)
  {
    int id_file = insertFile(db,md->getDefFileName());
    if (id_file!=-1) 
    {
      bindIntParameter(i_s_memberdef,":id_file",id_file);
      bindIntParameter(i_s_memberdef,":line",md->getDefLine());
      bindIntParameter(i_s_memberdef,":column",md->getDefColumn());

      if (md->getStartBodyLine()!=-1) 
      {
        int id_bfile = insertFile(db,md->getBodyDef()->absFilePath());
        if (id_bfile == -1) exit(-1);
        bindIntParameter(i_s_memberdef,":id_ibfile",id_bfile);
        bindIntParameter(i_s_memberdef,":bline",md->getStartBodyLine());

        // XXX implement getStartBodyColumn
        bindIntParameter(i_s_memberdef,":bcolumn",1);
      }
    }
  }


  step(db,i_s_memberdef);
  /*int id_src =*/ sqlite3_last_insert_rowid(db);

  // + cross-references
  // The cross-references in initializers only work when both the src and dst
  // are defined.
  LockingPtr<MemberSDict> mdict = md->getReferencesMembers();
  // references
  if (mdict!=0)
  {
    MemberSDict::IteratorDict mdi(*mdict);
    MemberDef *rmd;
    for (mdi.toFirst();(rmd=mdi.current());++mdi)
    {
      insertMemberReference(db,md,rmd,mdi.currentKey());
    }
  }

  mdict = md->getReferencedByMembers();
  // referencedby
  if (mdict!=0)
  {
    MemberSDict::IteratorDict mdi(*mdict);
    MemberDef *rmd;
    for (mdi.toFirst();(rmd=mdi.current());++mdi)
    {
      insertMemberReference(db,rmd,md,mdi.currentKey());
    }
  }
}
static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd)
{
  // + brief description
  // + detailed description
  // + template argument list(s)
  // - include file
  // + member groups
  // + inheritance diagram
  // + list of direct super classes
  // + list of direct sub classes
  // + list of inner classes
  // + collaboration diagram
  // + list of all members
  // + user defined member sections
  // + standard member sections
  // + detailed member documentation
  // - examples using the class

  if (cd->isReference())        return; // skip external references.
  if (cd->isHidden())           return; // skip hidden classes.
  if (cd->name().find('@')!=-1) return; // skip anonymous compounds.
  if (cd->templateMaster()!=0)  return; // skip generated template instances.

  msg("Generating Sqlite3 output for class %s\n",cd->name().data());

  //int idx,rc;
  //sqlite3_stmt *stmt ;

  // + compounddef
  //stmt = i_s_compounddef;

  bindTextParameter(i_s_compounddef,":name",cd->name());
  bindTextParameter(i_s_compounddef,":kind",cd->compoundTypeString());
  bindIntParameter(i_s_compounddef,":prot",cd->protection());
  bindTextParameter(i_s_compounddef,":refid",cd->getOutputFileBase());

  int id_file = insertFile(db,cd->getDefFileName().data());
  bindIntParameter(i_s_compounddef,":id_file",id_file);
  bindIntParameter(i_s_compounddef,":line",cd->getDefLine());
  bindIntParameter(i_s_compounddef,":column",cd->getDefColumn());

  step(db,i_s_compounddef);
  sqlite3_int64 id_compound=0 ;
  id_compound = sqlite3_last_insert_rowid(db);

  // + basecompoundref
  if (cd->baseClasses())
  {
    BaseClassListIterator bcli(*cd->baseClasses());
    BaseClassDef *bcd;
    for (bcli.toFirst();(bcd=bcli.current());++bcli)
    {
      bindTextParameter(i_s_basecompoundref,":refid",bcd->classDef->getOutputFileBase());
      bindIntParameter(i_s_basecompoundref,":prot",bcd->prot);
      bindIntParameter(i_s_basecompoundref,":virt",bcd->virt);

      if (!bcd->templSpecifiers.isEmpty())
      {
        bindTextParameter(i_s_basecompoundref,":base",insertTemplateSpecifierInScope(bcd->classDef->name(),bcd->templSpecifiers));
      }
      else
      {
        bindTextParameter(i_s_basecompoundref,":base",bcd->classDef->displayName());
      }
      bindTextParameter(i_s_basecompoundref,":derived",cd->displayName());
      step(db,i_s_basecompoundref);
    }
  }

  // + derivedcompoundref
  if (cd->subClasses())
  {
    BaseClassListIterator bcli(*cd->subClasses());
    BaseClassDef *bcd;
    for (bcli.toFirst();(bcd=bcli.current());++bcli)
    {
      bindTextParameter(i_s_derivedcompoundref,":base",cd->displayName());
      bindTextParameter(i_s_derivedcompoundref,":dervied",bcd->classDef->displayName());
      bindTextParameter(i_s_derivedcompoundref,":refid",bcd->classDef->getOutputFileBase());
      bindIntParameter(i_s_derivedcompoundref,":prot",bcd->prot);
      bindIntParameter(i_s_derivedcompoundref,":virt",bcd->virt);
      step(db,i_s_derivedcompoundref);
    }
  }

  ///////////////////////////////////////////////////////////////////
  // INCLUDEINFO
  IncludeInfo *ii=cd->includeInfo();
  if (ii)
  {
    QCString nm = ii->includeName;
    if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName();
    if (!nm.isEmpty())
    {
      bindTextParameter(c_s_includes,":refid",ii->fileDef->getOutputFileBase());
      bindIntParameter(c_s_includes,":local",ii->local);
      bindTextParameter(c_s_includes,":name",nm);
      int count=step(db,c_s_includes,TRUE);
      if ( count==0 ) 
      {
        bindTextParameter(i_s_includes,":refid",ii->fileDef->getOutputFileBase());
        bindIntParameter(i_s_includes,":local",ii->local);
        bindTextParameter(i_s_includes,":name",nm);
        step(db,i_s_includes);
      }
    }
  }
  ///////////////////////////////////////////////////////////////////
  writeInnerClasses(db,cd->getClassSDict());
  writeTemplateList(db,cd);

  if (cd->getMemberGroupSDict())
  {
    MemberGroupSDict::Iterator mgli(*cd->getMemberGroupSDict());
    MemberGroup *mg;
    for (;(mg=mgli.current());++mgli)
    {
      generateSqlite3Section(db,cd,mg->members(),"user-defined",mg->header(),
          mg->documentation());
    }
  }

  QListIterator<MemberList> mli(cd->getMemberLists());
  MemberList *ml;
  for (mli.toFirst();(ml=mli.current());++mli)
  {
    if ((ml->listType()&MemberListType_detailedLists)==0)
    {
      generateSqlite3Section(db,cd,ml,"user-defined");//g_xmlSectionMapper.find(ml->listType()));
    }
  }
}
Exemple #6
0
static void generateSqlite3ForFile(sqlite3 *db, FileDef *fd)
{
  // + includes files
  // + includedby files
  // - include graph
  // - included by graph
  // + contained class definitions
  // + contained namespace definitions
  // + member groups
  // + normal members
  // - brief desc
  // - detailed desc
  // - source code
  // - location
  // - number of lines

  if (fd->isReference()) return; // skip external references

  // + includes files
  IncludeInfo *ii;
  if (fd->includeFileList())
  {
    QListIterator<IncludeInfo> ili(*fd->includeFileList());
    for (ili.toFirst();(ii=ili.current());++ili)
    {
      int id_file=insertFile(db,fd->absFilePath().data());
      bindIntParameter(i_s_includes,":local",ii->local);
      bindIntParameter(i_s_includes,":id_src",id_file);
      bindTextParameter(i_s_includes,":dst",ii->includeName.data(),FALSE);
      if (-1==step(db,i_s_includes))
        continue;
    }
  }

  // + includedby files
  if (fd->includedByFileList())
  {
    QListIterator<IncludeInfo> ili(*fd->includedByFileList());
    for (ili.toFirst();(ii=ili.current());++ili)
    {
      int id_file=insertFile(db,ii->includeName);
      bindIntParameter(i_s_includes,":local",ii->local);
      bindIntParameter(i_s_includes,":id_src",id_file);
      bindTextParameter(i_s_includes,":dst",fd->absFilePath().data(),FALSE);
      if (-1==step(db,i_s_includes))
        continue;

    }
  }

  // + contained class definitions
  if (fd->getClassSDict())
  {
    writeInnerClasses(db,fd->getClassSDict());
  }

  // + contained namespace definitions
  if (fd->getNamespaceSDict())
  {
    writeInnerNamespaces(db,fd->getNamespaceSDict());
  }

  // + member groups
  if (fd->getMemberGroupSDict())
  {
    MemberGroupSDict::Iterator mgli(*fd->getMemberGroupSDict());
    MemberGroup *mg;
    for (;(mg=mgli.current());++mgli)
    {
      generateSqlite3Section(db,fd,mg->members(),"user-defined",mg->header(),
          mg->documentation());
    }
  }

  // + normal members
  QListIterator<MemberList> mli(fd->getMemberLists());
  MemberList *ml;
  for (mli.toFirst();(ml=mli.current());++mli)
  {
    if ((ml->listType()&MemberListType_declarationLists)!=0)
    {
      generateSqlite3Section(db,fd,ml,"user-defined");//g_xmlSectionMapper.find(ml->listType()));
    }
  }
}
Exemple #7
0
static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def)
{
  // + declaration/definition arg lists
  // + reimplements
  // + reimplementedBy
  // + exceptions
  // + const/volatile specifiers
  // - examples
  // + source definition
  // + source references
  // + source referenced by
  // - body code
  // + template arguments
  //     (templateArguments(), definitionTemplateParameterLists())
  // - call graph

  // enum values are written as part of the enum
  if (md->memberType()==MemberType_EnumValue) return;
  if (md->isHidden()) return;
  //if (md->name().at(0)=='@') return; // anonymous member

  // group members are only visible in their group
  //if (def->definitionType()!=Definition::TypeGroup && md->getGroupDef()) return;
  QCString memType;
  // memberdef
  bindTextParameter(i_s_memberdef,":refid",md->anchor().data(),FALSE);
  bindIntParameter(i_s_memberdef,":kind",md->memberType());
  bindIntParameter(i_s_memberdef,":prot",md->protection());
  bindIntParameter(i_s_memberdef,":static",md->isStatic());

  bool isFunc=FALSE;
  switch (md->memberType())
  {
    case MemberType_Function: // fall through
    case MemberType_Signal:   // fall through
    case MemberType_Friend:   // fall through
    case MemberType_DCOP:     // fall through
    case MemberType_Slot:
      isFunc=TRUE;
      break;
    default:
      break;
  }
  if (isFunc)
  {
    ArgumentList *al = md->argumentList();
    if (al!=0 && al->constSpecifier)
    {
      bindIntParameter(i_s_memberdef,":const",al->constSpecifier);
    }

    bindIntParameter(i_s_memberdef,":explicit",md->isExplicit());
    bindIntParameter(i_s_memberdef,":inline",md->isInline());
    bindIntParameter(i_s_memberdef,":final",md->isFinal());
    bindIntParameter(i_s_memberdef,":sealed",md->isSealed());
    bindIntParameter(i_s_memberdef,":new",md->isNew());
    bindIntParameter(i_s_memberdef,":optional",md->isOptional());
    bindIntParameter(i_s_memberdef,":required",md->isRequired());
    bindIntParameter(i_s_memberdef,":virt",md->virtualness());
  }
  // place in the arguments and linkify the arguments

  if (md->memberType() == MemberType_Variable)
  {
    bindIntParameter(i_s_memberdef,":mutable",md->isMutable());
    bindIntParameter(i_s_memberdef,":initonly",md->isInitonly());
  }
  else if (md->memberType() == MemberType_Property)
  {
    bindIntParameter(i_s_memberdef,":readable",md->isReadable());
    bindIntParameter(i_s_memberdef,":writable",md->isWritable());
    bindIntParameter(i_s_memberdef,":gettable",md->isGettable());
    bindIntParameter(i_s_memberdef,":settable",md->isSettable());

    if (md->isAssign() || md->isCopy() || md->isRetain())
    {
      int accessor = md->isAssign() ? md->isAssign() :
          (md->isCopy() ? md->isCopy() : md->isRetain()) ;

      bindIntParameter(i_s_memberdef,":accessor",accessor);
    }
  }
  else if (md->memberType() == MemberType_Event)
  {
    bindIntParameter(i_s_memberdef,":addable",md->isAddable());
    bindIntParameter(i_s_memberdef,":removable",md->isRemovable());
    bindIntParameter(i_s_memberdef,":raisable",md->isRaisable());
  }

  // + declaration/definition arg lists
  if (md->memberType()!=MemberType_Define &&
      md->memberType()!=MemberType_Enumeration
     )
  {
    QCString typeStr = md->typeString();
    stripQualifiers(typeStr);
    StringList l;
    linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,typeStr);
    if (typeStr.data())
    {
      bindTextParameter(i_s_memberdef,":type",typeStr.data(),FALSE);
    }

    if (md->definition())
    {
      bindTextParameter(i_s_memberdef,":definition",md->definition());
    }

    if (md->argsString())
    {
      bindTextParameter(i_s_memberdef,":argsstring",md->argsString());
    }
  }

  bindTextParameter(i_s_memberdef,":name",md->name());

  if (md->memberType() == MemberType_Property)
  {
    if (md->isReadable())
    {
      DBG_CTX(("<read>\n"));
    }
    if (md->isWritable())
    {
      DBG_CTX(("<write>\n"));
    }
  }
  if (isFunc) //function
  {
    ArgumentList *declAl = md->declArgumentList();
    ArgumentList *defAl = md->argumentList();
    if (declAl!=0 && declAl->count()>0)
    {
      ArgumentListIterator declAli(*declAl);
      ArgumentListIterator defAli(*defAl);
      Argument *a;
      for (declAli.toFirst();(a=declAli.current());++declAli)
      {
        Argument *defArg = defAli.current();
        DBG_CTX(("<param>\n"));
        if (!a->attrib.isEmpty())
        {
          DBG_CTX(("<attributes>:%s\n",a->attrib.data()));
        }
        if (!a->type.isEmpty())
        {
          StringList l;
          linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,a->type);

          StringListIterator li(l);
          QCString *s;
          while ((s=li.current()))
          {
            insertMemberReference(db,md->anchor().data(),s->data(),def->getDefFileName().data(),md->getDefLine(),1);
            ++li;
          }
        }
        if (!a->name.isEmpty())
        {
          DBG_CTX(("<declname>%s\n",a->name.data()));
        }
        if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name)
        {
          DBG_CTX(("<defname>%s\n",defArg->name.data()));
        }
        if (!a->array.isEmpty())
        {
          DBG_CTX(("<array>%s",a->array.data()));
        }
        if (!a->defval.isEmpty())
        {
          StringList l;
          linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,a->defval);
        }
        if (defArg) ++defAli;
      }
    }
  }
  else if (md->memberType()==MemberType_Define &&
          md->argsString()) // define
  {
    if (md->argumentList()->count()==0) // special case for "foo()" to
                                        // disguish it from "foo".
    {
      DBG_CTX(("no params\n"));
    }
    else
    {
      ArgumentListIterator ali(*md->argumentList());
      Argument *a;
      for (ali.toFirst();(a=ali.current());++ali)
      {
        DBG_CTX(("<param><defname>%s\n",a->type.data()));
      }
    }
  }


  // Extract references from initializer
  // avoid that extremely large tables are written to the output.
  // todo: it's better to adhere to MAX_INITIALIZER_LINES.
  // drm_mod_register_buffer,
  if (!md->initializer().isEmpty() && md->initializer().length()<2000)
  {
    bindTextParameter(i_s_memberdef,":initializer",md->initializer().data());

    StringList l;
    linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,md->initializer());
    StringListIterator li(l);
    QCString *s;
    while ((s=li.current()))
    {
      if (md->getBodyDef())
      {
        DBG_CTX(("initializer:%s %s %s %d\n",
              md->anchor().data(),
              s->data(),
              md->getBodyDef()->getDefFileName().data(),
              md->getStartBodyLine()));
        insertMemberReference(db,md->anchor().data(),s->data(),md->getBodyDef()->getDefFileName().data(),md->getStartBodyLine(),1);
      }
      ++li;
    }
  }

  if ( md->getScopeString() )
  {
    bindTextParameter(i_s_memberdef,":scope",md->getScopeString().data(),FALSE);
  }

  // Brief and detail description

  bindTextParameter(i_s_memberdef,":briefdescription",md->briefDescription(),FALSE);
  bindTextParameter(i_s_memberdef,":detaileddescription",md->documentation(),FALSE);
  bindTextParameter(i_s_memberdef,":inbodydescription",md->inbodyDocumentation(),FALSE);

  // File location
  if (md->getDefLine() != -1)
  {
    int id_file = insertFile(db,md->getDefFileName());
    if (id_file!=-1)
    {
      bindIntParameter(i_s_memberdef,":id_file",id_file);
      bindIntParameter(i_s_memberdef,":line",md->getDefLine());
      bindIntParameter(i_s_memberdef,":column",md->getDefColumn());

      if (md->getStartBodyLine()!=-1)
      {
        int id_bodyfile = insertFile(db,md->getBodyDef()->absFilePath());
        if (id_bodyfile == -1)
        {
            sqlite3_clear_bindings(i_s_memberdef);
        }
        else
        {
            bindIntParameter(i_s_memberdef,":id_bodyfile",id_bodyfile);
            bindIntParameter(i_s_memberdef,":bodystart",md->getStartBodyLine());
            bindIntParameter(i_s_memberdef,":bodyend",md->getEndBodyLine());
        }
      }
    }
  }

  if (-1==step(db,i_s_memberdef))
  {
      sqlite3_clear_bindings(i_s_memberdef);
  }
  sqlite3_last_insert_rowid(db);

  // + source references
  // The cross-references in initializers only work when both the src and dst
  // are defined.
  MemberSDict *mdict = md->getReferencesMembers();
  if (mdict!=0)
  {
    MemberSDict::IteratorDict mdi(*mdict);
    MemberDef *rmd;
    for (mdi.toFirst();(rmd=mdi.current());++mdi)
    {
      insertMemberReference(db,md,rmd,mdi.currentKey());
    }
  }

  // + source referenced by
  mdict = md->getReferencedByMembers();
  if (mdict!=0)
  {
    MemberSDict::IteratorDict mdi(*mdict);
    MemberDef *rmd;
    for (mdi.toFirst();(rmd=mdi.current());++mdi)
    {
      insertMemberReference(db,rmd,md,mdi.currentKey());
    }
  }
}