void BinaryFormatter::writeStaticHeader(std::ostream& into) { FileHelpers::writeByte(into, BF_BYTE); FileHelpers::writeByte(into, 2); FileHelpers::writeByte(into, BF_STRING); FileHelpers::writeString(into, VERSION_STRING); writeStringList(into, SUMOXMLDefinitions::Tags.getStrings()); writeStringList(into, SUMOXMLDefinitions::Attrs.getStrings()); writeStringList(into, SUMOXMLDefinitions::NodeTypes.getStrings()); writeStringList(into, SUMOXMLDefinitions::EdgeFunctions.getStrings()); }
bool BinaryFormatter::writeXMLHeader(std::ostream& into, const std::string& rootElement, const std::map<SumoXMLAttr, std::string>& attrs) { if (myXMLStack.empty()) { writeStaticHeader(into); writeStringList(into, std::vector<std::string>()); writeStringList(into, std::vector<std::string>()); if (SUMOXMLDefinitions::Tags.hasString(rootElement)) { openTag(into, rootElement); for (std::map<SumoXMLAttr, std::string>::const_iterator it = attrs.begin(); it != attrs.end(); ++it) { writeAttr(into, it->first, it->second); } return true; } } return false; }
bool BinaryFormatter::writeXMLHeader(std::ostream& into, const std::string& rootElement, const std::string& /* attrs */, const std::string& /* comment */) { if (myXMLStack.empty()) { FileHelpers::writeByte(into, BF_BYTE); FileHelpers::writeByte(into, 1); FileHelpers::writeByte(into, BF_STRING); FileHelpers::writeString(into, VERSION_STRING); writeStringList(into, SUMOXMLDefinitions::Tags.getStrings()); writeStringList(into, SUMOXMLDefinitions::Attrs.getStrings()); writeStringList(into, SUMOXMLDefinitions::NodeTypes.getStrings()); writeStringList(into, SUMOXMLDefinitions::EdgeFunctions.getStrings()); writeStringList(into, std::vector<std::string>()); writeStringList(into, std::vector<std::string>()); if (SUMOXMLDefinitions::Tags.hasString(rootElement)) { openTag(into, rootElement); return true; } } return false; }
/***************************************************************************** * NAME * show_status * ARGUMENTS * none * DESCRIPTION * Execute a SHOW STATUS command. * RETURN VALUE * none */ void show_status() { char * p; const StringList * sp; fprintf(stderr, "Status of PC-PATR:\n"); fprintf(stderr, " Grammar file: %s\n", (pszPCPATRGrammarFile_g != (char *)NULL) ? pszPCPATRGrammarFile_g : "(none)" ); if (pPCPATRLexiconFiles_g != NULL) { fprintf(stderr, " Lexicon file%s:", (pPCPATRLexiconFiles_g->pNext) ? "s" : ""); for ( sp = pPCPATRLexiconFiles_g ; sp ; sp = sp->pNext ) fprintf(stderr, " %s", sp->pszString); putc('\n', stderr); } else if (pPCPATRAmpleFiles_g != NULL) { fprintf(stderr, " (AMPLE) Lexicon file%s:", (pPCPATRAmpleFiles_g->pNext)?"s":""); for ( sp = pPCPATRAmpleFiles_g ; sp ; sp = sp->pNext ) fprintf(stderr, " %s", sp->pszString); putc('\n', stderr); } else fprintf(stderr, " Lexicon file: (none)\n"); if (sPCPATRKimmoData_g.pszRulesFile != NULL) fprintf(stderr, " Kimmo rules file: %s\n", sPCPATRKimmoData_g.pszRulesFile); if (sPCPATRKimmoData_g.pszLexiconFile != NULL) fprintf(stderr, " Kimmo lexicon file: %s\n", sPCPATRKimmoData_g.pszLexiconFile); if ( (sPCPATRKimmoData_g.sPATR.pGrammar != NULL) && (sPCPATRKimmoData_g.sPATR.pszGrammarFile != NULL) ) fprintf(stderr, " Kimmo grammar file: %s\n", sPCPATRKimmoData_g.sPATR.pszGrammarFile); fprintf(stderr, " Log file: %s\n", (pszCmdLogFile_g != (char *)NULL) ? pszCmdLogFile_g : "(none)" ); putc('\n', stderr); fprintf(stderr, " Ambiguity limit is %d\n", sPCPATRData_g.iMaxAmbiguities); if (sPCPATRData_g.cComment == NUL) fprintf(stderr, " Comment character is (none)\n"); else fprintf(stderr, " Comment character is %c\n", sPCPATRData_g.cComment); fprintf(stderr," Failures display is %s\n", sPCPATRData_g.bFailure ? "ON" : "OFF"); if (sPCPATRData_g.iFeatureDisplay & PATR_FEATURE_ON) { fprintf(stderr, " Feature display is %s and %s\n", (sPCPATRData_g.iFeatureDisplay & PATR_FEATURE_ALL) ? "ALL" : "TOP", (sPCPATRData_g.iFeatureDisplay & PATR_FEATURE_FLAT) ? "FLAT" : "FULL"); } else fprintf(stderr, " Feature display is OFF\n"); fprintf(stderr, " Gloss display is %s\n", (sPCPATRData_g.bGloss)?"ON":"OFF"); if (sPCPATRData_g.iMaxProcTime != 0) fprintf(stderr, " Parse time limit is %lu seconds\n", (unsigned long)sPCPATRData_g.iMaxProcTime); else fprintf(stderr, " Parse time is unlimited\n"); fprintf(stderr, " Record marker is %s\n", sPCPATRData_g.pszRecordMarker); fprintf(stderr, " Word marker is %s\n", sPCPATRData_g.pszWordMarker); fprintf(stderr, " Category marker is %s\n", sPCPATRData_g.pszCategoryMarker); fprintf(stderr, " Feature marker is %s\n", sPCPATRData_g.pszFeatureMarker); fprintf(stderr, " Gloss marker is %s\n", sPCPATRData_g.pszGlossMarker); fprintf(stderr, " Timing is %s\n", (bPCPATRTiming_g)?"ON":"OFF"); switch (sPCPATRData_g.eTreeDisplay) { case PATR_NO_TREE: p = "OFF"; break; case PATR_FLAT_TREE: p = "FLAT"; break; case PATR_FULL_TREE: p = "FULL"; break; case PATR_INDENTED_TREE: p = "INDENTED"; break; case PATR_XML_TREE: p = "XML"; break; default: p = "ON"; break; } fprintf(stderr, " Tree display is %s\n", p); fprintf(stderr, " Trim-empty-features display is %s\n", (sPCPATRData_g.iFeatureDisplay & PATR_FEATURE_TRIM) ? "ON" : "OFF"); fprintf(stderr, " Unification is %s\n", (sPCPATRData_g.bUnification)?"ON":"OFF"); fprintf(stderr, " Verbose output is %s\n", (bPCPATRVerbose_g)?"ON":"OFF"); fprintf(stderr, " Warning display is %s\n", (bCmdShowWarnings_g) ? "ON" : "OFF"); fprintf(stderr, " Sentence final punctuation is "); writeStringList(sPCPATRData_g.pFinalPunc, " ", stderr); fprintf(stderr, "\n\n"); /* blank line before the prompt */ }