void RTFDocVisitor::visitPre(DocDotFile *df) { DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocDotFile)}\n"); writeDotFile(df->file()); // hide caption since it is not supported at the moment pushEnabled(); m_hide=TRUE; }
void HtmlDocVisitor::visitPre(DocDotFile *df) { if (m_hide) return; m_t << "<div class=\"dotgraph\">" << endl; writeDotFile(df->file(),df->relPath(),df->context()); if (df->hasCaption()) { m_t << "<div class=\"caption\">" << endl; } }
void HtmlDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; switch(s->type()) { case DocVerbatim::Code: forceEndParagraph(s); m_t << PREFRAG_START; Doxygen::parserManager->getParser(m_langExt) ->parseCode(m_ci,s->context(),s->text(), s->isExample(),s->exampleFile()); m_t << PREFRAG_END; forceStartParagraph(s); break; case DocVerbatim::Verbatim: forceEndParagraph(s); m_t << PREFRAG_START; filter(s->text()); m_t << PREFRAG_END; forceStartParagraph(s); break; case DocVerbatim::HtmlOnly: m_t << s->text(); break; case DocVerbatim::ManOnly: case DocVerbatim::LatexOnly: case DocVerbatim::XmlOnly: /* nothing */ break; case DocVerbatim::Dot: { static int dotindex = 1; QCString fileName(4096); fileName.sprintf("%s%d%s", (Config_getString("HTML_OUTPUT")+"/inline_dotgraph_").data(), dotindex++, ".dot" ); QFile file(fileName); if (!file.open(IO_WriteOnly)) { err("Could not open file %s for writing\n",fileName.data()); } file.writeBlock( s->text(), s->text().length() ); file.close(); forceEndParagraph(s); m_t << "<div align=\"center\">" << endl; writeDotFile(fileName,s->relPath(),s->context()); m_t << "</div>" << endl; forceStartParagraph(s); if (Config_getBool("DOT_CLEANUP")) file.remove(); } break; case DocVerbatim::Msc: { static int mscindex = 1; QCString baseName(4096); baseName.sprintf("%s%d", (Config_getString("HTML_OUTPUT")+"/inline_mscgraph_").data(), mscindex++ ); QFile file(baseName+".msc"); if (!file.open(IO_WriteOnly)) { err("Could not open file %s.msc for writing\n",baseName.data()); } QCString text = "msc {"; text+=s->text(); text+="}"; file.writeBlock( text, text.length() ); file.close(); forceEndParagraph(s); m_t << "<div align=\"center\">" << endl; writeMscFile(baseName+".msc",s->relPath(),s->context()); m_t << "</div>" << endl; forceStartParagraph(s); if (Config_getBool("DOT_CLEANUP")) file.remove(); } break; } }
void RTFDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; DBG_RTF("{\\comment RTFDocVisitor::visit(DocVerbatim)}\n"); QCString lang = m_langExt; if (!s->language().isEmpty()) // explicit language setting { lang = s->language(); } switch(s->type()) { case DocVerbatim::Code: // fall though m_t << "{" << endl; m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); Doxygen::parserManager->getParser(lang) ->parseCode(m_ci,s->context(),s->text(), s->isExample(),s->exampleFile()); //m_t << "\\par" << endl; m_t << "}" << endl; break; case DocVerbatim::Verbatim: m_t << "{" << endl; m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); filter(s->text(),TRUE); //m_t << "\\par" << endl; m_t << "}" << endl; break; case DocVerbatim::HtmlOnly: case DocVerbatim::LatexOnly: case DocVerbatim::XmlOnly: case DocVerbatim::ManOnly: /* nothing */ break; case DocVerbatim::Dot: { static int dotindex = 1; QCString fileName(4096); fileName.sprintf("%s%d%s", (Config_getString("RTF_OUTPUT")+"/inline_dotgraph_").data(), dotindex++, ".dot" ); QFile file(fileName); if (!file.open(IO_WriteOnly)) { err("Could not open file %s for writing\n",fileName.data()); } file.writeBlock( s->text(), s->text().length() ); file.close(); m_t << "\\par{\\qc "; // center picture writeDotFile(fileName); m_t << "} "; if (Config_getBool("DOT_CLEANUP")) file.remove(); } break; case DocVerbatim::Msc: { static int mscindex = 1; QCString baseName(4096); baseName.sprintf("%s%d", (Config_getString("RTF_OUTPUT")+"/inline_mscgraph_").data(), mscindex++ ); QFile file(baseName+".msc"); if (!file.open(IO_WriteOnly)) { err("Could not open file %s for writing\n",baseName.data()); } QCString text = "msc {"; text+=s->text(); text+="}"; file.writeBlock( text, text.length() ); file.close(); m_t << "\\par{\\qc "; // center picture writeMscFile(baseName); m_t << "} "; if (Config_getBool("DOT_CLEANUP")) file.remove(); } break; } m_lastIsPara=FALSE; }
void DocbookDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; SrcLangExt langExt = getLanguageFromFileName(m_langExt); switch(s->type()) { case DocVerbatim::Code: // fall though m_t << "<literallayout><computeroutput>"; Doxygen::parserManager->getParser(m_langExt) ->parseCode(m_ci,s->context(),s->text(),langExt, s->isExample(),s->exampleFile()); m_t << "</computeroutput></literallayout>"; break; case DocVerbatim::Verbatim: m_t << "<literallayout>"; filter(s->text()); m_t << "</literallayout>"; break; case DocVerbatim::HtmlOnly: break; case DocVerbatim::RtfOnly: break; case DocVerbatim::ManOnly: break; case DocVerbatim::LatexOnly: break; case DocVerbatim::XmlOnly: break; case DocVerbatim::DocbookOnly: break; m_t << s->text(); break; case DocVerbatim::Dot: { static int dotindex = 1; QCString baseName(4096); QCString name; QCString stext = s->text(); m_t << "<para>" << endl; name.sprintf("%s%d", "dot_inline_dotgraph_", dotindex); baseName.sprintf("%s%d", (Config_getString("DOCBOOK_OUTPUT")+"/inline_dotgraph_").data(), dotindex++ ); QFile file(baseName+".dot"); if (!file.open(IO_WriteOnly)) { err("Could not open file %s.msc for writing\n",baseName.data()); } file.writeBlock( stext, stext.length() ); file.close(); m_t << " <figure>" << endl; m_t << " <title>" << name << "</title>" << endl; m_t << " <mediaobject>" << endl; m_t << " <imageobject>" << endl; writeDotFile(baseName); m_t << " </imageobject>" << endl; m_t << " </mediaobject>" << endl; m_t << " </figure>" << endl; m_t << "</para>" << endl; } break; case DocVerbatim::Msc: static int mscindex = 1; QCString baseName(4096); QCString name; QCString stext = s->text(); m_t << "<para>" << endl; name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex); baseName.sprintf("%s%d", (Config_getString("DOCBOOK_OUTPUT")+"/inline_mscgraph_").data(), mscindex++ ); QFile file(baseName+".msc"); if (!file.open(IO_WriteOnly)) { err("Could not open file %s.msc for writing\n",baseName.data()); } QCString text = "msc {"; text+=stext; text+="}"; file.writeBlock( text, text.length() ); file.close(); m_t << " <figure>" << endl; m_t << " <title>" << name << "</title>" << endl; m_t << " <mediaobject>" << endl; m_t << " <imageobject>" << endl; writeMscFile(baseName); m_t << " </imageobject>" << endl; m_t << " </mediaobject>" << endl; m_t << " </figure>" << endl; m_t << "</para>" << endl; break; } }
void DocbookDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; SrcLangExt langExt = getLanguageFromFileName(m_langExt); switch(s->type()) { case DocVerbatim::Code: // fall though m_t << "<literallayout><computeroutput>"; Doxygen::parserManager->getParser(m_langExt) ->parseCode(m_ci,s->context(),s->text(),langExt, s->isExample(),s->exampleFile()); m_t << "</computeroutput></literallayout>"; break; case DocVerbatim::Verbatim: m_t << "<literallayout>"; filter(s->text()); m_t << "</literallayout>"; break; case DocVerbatim::HtmlOnly: break; case DocVerbatim::RtfOnly: break; case DocVerbatim::ManOnly: break; case DocVerbatim::LatexOnly: break; case DocVerbatim::XmlOnly: break; case DocVerbatim::DocbookOnly: break; m_t << s->text(); break; case DocVerbatim::Dot: { static int dotindex = 1; QCString baseName(4096); QCString name; QCString stext = s->text(); m_t << "<para>" << endl; name.sprintf("%s%d", "dot_inline_dotgraph_", dotindex); baseName.sprintf("%s%d", (Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_").data(), dotindex++ ); QFile file(baseName+".dot"); if (!file.open(IO_WriteOnly)) { err("Could not open file %s.msc for writing\n",baseName.data()); } file.writeBlock( stext, stext.length() ); file.close(); writeDotFile(baseName, s); m_t << "</para>" << endl; } break; case DocVerbatim::Msc: { static int mscindex = 1; QCString baseName(4096); QCString name; QCString stext = s->text(); m_t << "<para>" << endl; name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex); baseName.sprintf("%s%d", (Config_getString(DOCBOOK_OUTPUT)+"/inline_mscgraph_").data(), mscindex++ ); QFile file(baseName+".msc"); if (!file.open(IO_WriteOnly)) { err("Could not open file %s.msc for writing\n",baseName.data()); } QCString text = "msc {"; text+=stext; text+="}"; file.writeBlock( text, text.length() ); file.close(); writeMscFile(baseName,s); m_t << "</para>" << endl; } break; case DocVerbatim::PlantUML: { static QCString docbookOutput = Config_getString(DOCBOOK_OUTPUT); QCString baseName = writePlantUMLSource(docbookOutput,s->exampleFile(),s->text()); QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } m_t << "<para>" << endl; writePlantUMLFile(baseName,s); m_t << "</para>" << endl; } break; } }
void RTFDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; DBG_RTF("{\\comment RTFDocVisitor::visit(DocVerbatim)}\n"); QCString lang = m_langExt; if (!s->language().isEmpty()) // explicit language setting { lang = s->language(); } SrcLangExt langExt = getLanguageFromFileName(lang); switch(s->type()) { case DocVerbatim::Code: // fall though m_t << "{" << endl; m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); Doxygen::parserManager->getParser(lang) ->parseCode(m_ci,s->context(),s->text(),langExt, s->isExample(),s->exampleFile()); //m_t << "\\par" << endl; m_t << "}" << endl; break; case DocVerbatim::Verbatim: m_t << "{" << endl; m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); filter(s->text(),TRUE); //m_t << "\\par" << endl; m_t << "}" << endl; break; case DocVerbatim::RtfOnly: m_t << s->text(); break; case DocVerbatim::HtmlOnly: case DocVerbatim::LatexOnly: case DocVerbatim::XmlOnly: case DocVerbatim::ManOnly: case DocVerbatim::DocbookOnly: /* nothing */ break; case DocVerbatim::Dot: { static int dotindex = 1; QCString fileName(4096); fileName.sprintf("%s%d%s", (Config_getString(RTF_OUTPUT)+"/inline_dotgraph_").data(), dotindex++, ".dot" ); QFile file(fileName); if (!file.open(IO_WriteOnly)) { err("Could not open file %s for writing\n",fileName.data()); } file.writeBlock( s->text(), s->text().length() ); file.close(); writeDotFile(fileName, s->hasCaption()); visitCaption(this, s->children()); includePicturePostRTF(true, s->hasCaption()); if (Config_getBool(DOT_CLEANUP)) file.remove(); } break; case DocVerbatim::Msc: { static int mscindex = 1; QCString baseName(4096); baseName.sprintf("%s%d%s", (Config_getString(RTF_OUTPUT)+"/inline_mscgraph_").data(), mscindex++, ".msc" ); QFile file(baseName); if (!file.open(IO_WriteOnly)) { err("Could not open file %s for writing\n",baseName.data()); } QCString text = "msc {"; text+=s->text(); text+="}"; file.writeBlock( text, text.length() ); file.close(); writeMscFile(baseName, s->hasCaption()); visitCaption(this, s->children()); includePicturePostRTF(true, s->hasCaption()); if (Config_getBool(DOT_CLEANUP)) file.remove(); } break; case DocVerbatim::PlantUML: { static QCString rtfOutput = Config_getString(RTF_OUTPUT); QCString baseName = writePlantUMLSource(rtfOutput,s->exampleFile(),s->text()); writePlantUMLFile(baseName, s->hasCaption()); visitCaption(this, s->children()); includePicturePostRTF(true, s->hasCaption()); } break; } m_lastIsPara=FALSE; }
void RTFDocVisitor::writeDotFile(DocDotFile *df) { writeDotFile(df->file(), df->hasCaption()); }
void RTFDocVisitor::visitPre(DocDotFile *df) { DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocDotFile)}\n"); writeDotFile(df); }
int main(int argc, char* argv[] ) { srand(time(NULL)); int verbose = 0; char outputFile[256]; int doOutput = getWriteToFile( argc, argv, outputFile, 256); if (argc == 1) { showUsageAndExit(); } moleculizer* pMoleculizer = createNewMoleculizerObject(); setRateExtrapolation( pMoleculizer, 1 ); int result = loadModelFile( pMoleculizer, argc, argv); switch(result) { case 0: printf("Model loaded successfully.\n"); break; case 1: printf("Unknown error on load. Aborting\n"); return 1; case 2: printf("Document unparsable. Aborting.\n"); return 1; case 3: printf("Moleculizer has already loaded rules. Ignoring and continuing.\n"); return 1; } int numIter = getNumberOfIterations(argc, argv); int maxSpecies = getMaxNumSpecies( argc, argv); int maxRxns = getMaxNumReactions( argc, argv); if (numIter > 0 && (maxSpecies > 0 || maxRxns > 0) ) { // ANCHOR printf("Error, if either (max species and/or max rxns) can be set or numIters. "); showUsageAndExit(); } verbose = getVerbose(argc, argv); if(numIter == -1 ) { int numRxns; int numSpec; species** speciesArray; reaction** rxnArray; int errorCode = \ getBoundedNetwork( pMoleculizer, maxSpecies, maxRxns, &speciesArray, &numSpec, &rxnArray, &numRxns ); if (errorCode) { printf("Unknown erorr. Check error messages for description. Exiting...\n"); exit(1); } else { numIter = 10; printf("Network generated to %d species and %d reactions.\n", numSpec, numRxns); } } else { int iter = 0; for( iter = 0; iter != numIter; ++iter) { species** theSpecies; int numSpecies = 0; getAllExteriorSpecies( pMoleculizer, &theSpecies, &numSpecies); if (numSpecies == 0) { printf("Entire network has been generated on the %dth iteration.\n", iter); freeSpeciesArray( theSpecies, numSpecies); break; } /* Get a random number in the range [0, numSpecies) */ int speciesNumber = rand() % numSpecies; printf("Iteration %d: Expanding %s\n", iter + 1, theSpecies[speciesNumber]->name); incrementSpecies( pMoleculizer, theSpecies[speciesNumber]->name); freeSpeciesArray( theSpecies, numSpecies); } } if (numIter == -1) { printf("Expanded entire network.\n"); } else { printf("Expanded %d iterations.", numIter); } printf("\n##########################################\n"); printf("There are %d species and %d reactions.\n", getNumberOfSpecies(pMoleculizer), getNumberOfReactions(pMoleculizer) ); if ( verbose ) { showAllSpecies( pMoleculizer ); showAllReactions( pMoleculizer); } if (doOutput) { writeDotFile(pMoleculizer, outputFile); } freeMoleculizerObject( pMoleculizer ); return 0; }