static void ProcHelp( const char *arg ) /*************************************/ { arg=arg; WriteHelp(); WriteOptions( OptionsTable ); Suicide(); }
static void ProcHelp( const char *arg ) /*************************************/ { /* unused parameters */ (void)arg; WriteHelp(); WriteOptions( OptionsTable ); Suicide(); }
static void DoConvert( void ) /***************************/ { if( !InitParsing() ) { WriteHelp(); } else { ParseMicrosoft(); // most of the work is done here. BuildWATCOM(); } }
bool GenerateHelp::OnInit() { InitializeHtmlEntities(); imayle = _T("tizer@c"); imayle += _T("ozic.net"); imayle.Prepend(_T("appe")); wxArrayString localeCodes; localeCodes.Add(_T("en")); localeCodes.Add(_T("fr")); localeCodes.Add(_T("de")); for (int i = 0; i < localeCodes.Count(); i++) { wxString localeCode = localeCodes[i]; const wxLanguageInfo* info = wxLocale::FindLanguageInfo(localeCode); if (!info) { wxLogDebug(_T("CANNOT GET LANGUAGE INFO")); continue; } wxLocale locale; locale.Init(info->Language); locale.AddCatalogLookupPathPrefix(_T("Data/Help")); locale.AddCatalog(_T("appetizer_help")); wxString htmlString = GenerateHTMLString(); wxRegEx imageRegEx(_T("\\[([^\\s]+(\\.png|\\.gif|\\.jpg))\\]"), wxRE_ADVANCED); wxRegEx urlRegEx(_T("\\[((ftp|http|https)://[^\\s]+)\\s([^\\]]+)\\]"), wxRE_ADVANCED); wxRegEx strongRegEx(_T("\\[b\\](.*?)\\[\\/b\\]"), wxRE_ADVANCED); wxRegEx internalUrlRegEx(_T("\\[(#[^\\s]+)\\s([^\\]]+)\\]"), wxRE_ADVANCED); imageRegEx.ReplaceAll(&htmlString, _T("<img src='\\1'/>")); urlRegEx.ReplaceAll(&htmlString, _T("<a href='\\1'>\\3</a>")); strongRegEx.ReplaceAll(&htmlString, _T("<b>\\1</b>")); internalUrlRegEx.ReplaceAll(&htmlString, _T("<a href='\\1'>\\2</a>")); htmlString.Replace(imayle, wxString::Format(_T("<a href='mailto:%s'>%s</a>"), imayle, imayle)); WriteHelp(_T("Data/Help/") + localeCode + _T("/Appetizer.html"), htmlString); } return false; }
int main(int argc, char* argv[]) { char *fname = NULL; char *oname = NULL; char *ename = NULL; bool sax = false; bool model = true; bool full = false; bool expat = false; if (argc == 1) { WriteHelp(); return 0; } for (int i = 1; i < argc; i++) { if ((argv[i][0] == '-') || (argv[i][0] == '/')) { // switch switch(argv[i][1]) { case 'o': // output file oname = argv[++i]; break; case 'e': // error file ename = argv[++i]; break; case 's': sax = true; break; case 'n': model = false; break; case 'f': full = true; break; case 'x': expat = true; break; case 'h': case '?': WriteHelp(false); return 0; case 'a': WriteHelp(true); return 0; default: fputs("Unrecognized option; options are case-sensitive.\n\n", stdout); WriteHelp(false); return 0; } } else // source filename fname = argv[i]; } if (oname) { FILE *tmp = fopen(oname, "w"); if (tmp) ofile = tmp; } Parser = new MxlParser(); Parser->SetOptions(sax, model, full); if (expat) Parser->SetExpatCallbacks(ename); else Parser->SetCallbacks(ename); element *result = Parser->ParseFile(fname, NULL); // send result to stdout in JSON format if (result) { fputs("\n\n", ofile); WriteJSON(result, 1); fputs("\n\n", ofile); } return 0; }