// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
static bool CheckTypeRef()
{
wxString typeDecl = GetArgData();
- if( !typeDecl.IsEmpty() ) {
+ if( !typeDecl.empty() ) {
typeDecl.Replace(wxT("\\"),wxT(""));
wxString label = typeDecl;
label.Replace(wxT("const"),wxT(""));
if (imageFile)
delete[] imageFile;
imageFile = NULL;
- if (!f.IsEmpty())
+ if (!f.empty())
{
imageFile = copystring(f);
}
bool HTMLGo(void)
{
- fileId = 0;
- inVerbatim = false;
- indentLevel = 0;
- inTabular = false;
- startRows = false;
- tableVerticalLineLeft = false;
- tableVerticalLineRight = false;
- noColumns = 0;
-
- if (InputFile && OutputFile)
- {
- // Do some HTML-specific transformations on all the strings,
- // recursively
- Text2HTML(GetTopLevelChunk());
-
- wxChar buf[300];
- if (truncateFilenames)
- wxSnprintf(buf, sizeof(buf), _T("%s.htm"), FileRoot);
- else
- wxSnprintf(buf, sizeof(buf), _T("%s_contents.html"), FileRoot);
- if (TitlepageName) delete[] TitlepageName;
- TitlepageName = copystring(buf);
- Titlepage = wxFopen(buf, _T("w"));
+ fileId = 0;
+ inVerbatim = false;
+ indentLevel = 0;
+ inTabular = false;
+ startRows = false;
+ tableVerticalLineLeft = false;
+ tableVerticalLineRight = false;
+ noColumns = 0;
- if (truncateFilenames)
- wxSnprintf(buf, sizeof(buf), _T("%s_fc.htm"), FileRoot);
- else
- wxSnprintf(buf, sizeof(buf), _T("%s_fcontents.html"), FileRoot);
+ if (!InputFile.empty() && !OutputFile.empty())
+ {
+ // Do some HTML-specific transformations on all the strings,
+ // recursively
+ Text2HTML(GetTopLevelChunk());
- contentsFrameName = copystring(buf);
+ wxChar buf[300];
+ if (truncateFilenames)
+ wxSnprintf(buf, sizeof(buf), _T("%s.htm"), FileRoot);
+ else
+ wxSnprintf(buf, sizeof(buf), _T("%s_contents.html"), FileRoot);
+ if (TitlepageName) delete[] TitlepageName;
+ TitlepageName = copystring(buf);
+ Titlepage = wxFopen(buf, _T("w"));
- Contents = wxFopen(TmpContentsName, _T("w"));
+ if (truncateFilenames)
+ wxSnprintf(buf, sizeof(buf), _T("%s_fc.htm"), FileRoot);
+ else
+ wxSnprintf(buf, sizeof(buf), _T("%s_fcontents.html"), FileRoot);
- if (htmlFrameContents)
- {
-// FrameContents = wxFopen(TmpFrameContentsName, _T("w"));
- FrameContents = wxFopen(contentsFrameName, _T("w"));
- wxFprintf(FrameContents, _T("<HTML>\n<UL>\n"));
- }
+ contentsFrameName = copystring(buf);
- if (!Titlepage || !Contents)
- {
- OnError(_T("Cannot open output file!"));
- return false;
- }
- AddTexRef(_T("contents"), wxFileNameFromPath(TitlepageName), ContentsNameString);
+ Contents = wxFopen(TmpContentsName, _T("w"));
- wxFprintf(Contents, _T("<P><P><H2>%s</H2><P><P>\n"), ContentsNameString);
+ if (htmlFrameContents)
+ {
+// FrameContents = wxFopen(TmpFrameContentsName, _T("w"));
+ FrameContents = wxFopen(contentsFrameName, _T("w"));
+ wxFprintf(FrameContents, _T("<HTML>\n<UL>\n"));
+ }
- wxFprintf(Contents, _T("<UL>\n"));
+ if (!Titlepage || !Contents)
+ {
+ OnError(_T("Cannot open output file!"));
+ return false;
+ }
+ AddTexRef(_T("contents"), wxFileNameFromPath(TitlepageName), ContentsNameString);
- SetCurrentOutput(Titlepage);
- if (htmlWorkshopFiles) HTMLWorkshopStartContents();
- OnInform(_T("Converting..."));
+ wxFprintf(Contents, _T("<P><P><H2>%s</H2><P><P>\n"), ContentsNameString);
- TraverseDocument();
- wxFprintf(Contents, _T("</UL>\n\n"));
+ wxFprintf(Contents, _T("<UL>\n"));
-// SetCurrentOutput(Titlepage);
- fclose(Titlepage);
+ SetCurrentOutput(Titlepage);
+ if (htmlWorkshopFiles) HTMLWorkshopStartContents();
+ OnInform(_T("Converting..."));
- if (Contents)
- {
-// wxFprintf(Titlepage, _T("\n</BODY></HTML>\n"));
- fclose(Contents);
- Contents = NULL;
- }
+ TraverseDocument();
+ wxFprintf(Contents, _T("</UL>\n\n"));
- if (FrameContents)
- {
- wxFprintf(FrameContents, _T("\n</UL>\n"));
- wxFprintf(FrameContents, _T("</HTML>\n"));
- fclose(FrameContents);
- FrameContents = NULL;
- }
+// SetCurrentOutput(Titlepage);
+ fclose(Titlepage);
- if (Chapters)
- {
- wxFprintf(Chapters, _T("\n</FONT></BODY></HTML>\n"));
- fclose(Chapters);
- Chapters = NULL;
- }
- if (Sections)
- {
- wxFprintf(Sections, _T("\n</FONT></BODY></HTML>\n"));
- fclose(Sections);
- Sections = NULL;
- }
- if (Subsections && !combineSubSections)
- {
- wxFprintf(Subsections, _T("\n</FONT></BODY></HTML>\n"));
- fclose(Subsections);
- Subsections = NULL;
- }
- if (Subsubsections && !combineSubSections)
- {
- wxFprintf(Subsubsections, _T("\n</FONT></BODY></HTML>\n"));
- fclose(Subsubsections);
- Subsubsections = NULL;
- }
- if ( SectionContentsFD )
- {
- fclose(SectionContentsFD);
- SectionContentsFD = NULL;
- }
+ if (Contents)
+ {
+// wxFprintf(Titlepage, _T("\n</BODY></HTML>\n"));
+ fclose(Contents);
+ Contents = NULL;
+ }
- // Create a temporary file for the title page header, add some info,
- // and concat the titlepage just generated.
- // This is necessary in order to put the title of the document
- // at the TOP of the file within <HEAD>, even though we only find out
- // what it is later on.
- FILE *tmpTitle = wxFopen(_T("title.tmp"), _T("w"));
- if (tmpTitle)
- {
- if (DocumentTitle)
- {
- SetCurrentOutput(tmpTitle);
- HTMLHead();
- TexOutput(_T("\n<TITLE>"));
- TraverseChildrenFromChunk(DocumentTitle);
- TexOutput(_T("</TITLE></HEAD>\n"));
- }
- else
- {
- SetCurrentOutput(tmpTitle);
- HTMLHeadTo(tmpTitle);
- if (contentsString)
- wxFprintf(tmpTitle, _T("<TITLE>%s</TITLE></HEAD>\n\n"), contentsString);
- else
- wxFprintf(tmpTitle, _T("<TITLE>%s</TITLE></HEAD>\n\n"), wxFileNameFromPath(FileRoot));
- }
+ if (FrameContents)
+ {
+ wxFprintf(FrameContents, _T("\n</UL>\n"));
+ wxFprintf(FrameContents, _T("</HTML>\n"));
+ fclose(FrameContents);
+ FrameContents = NULL;
+ }
- // Output frame information
- if (htmlFrameContents)
- {
- wxChar firstFileName[300];
- if (truncateFilenames)
- wxSnprintf(firstFileName, sizeof(firstFileName), _T("%s1.htm"), FileRoot);
- else
- wxStrcpy(firstFileName, gs_filenames[1].c_str());
+ if (Chapters)
+ {
+ wxFprintf(Chapters, _T("\n</FONT></BODY></HTML>\n"));
+ fclose(Chapters);
+ Chapters = NULL;
+ }
+ if (Sections)
+ {
+ wxFprintf(Sections, _T("\n</FONT></BODY></HTML>\n"));
+ fclose(Sections);
+ Sections = NULL;
+ }
+ if (Subsections && !combineSubSections)
+ {
+ wxFprintf(Subsections, _T("\n</FONT></BODY></HTML>\n"));
+ fclose(Subsections);
+ Subsections = NULL;
+ }
+ if (Subsubsections && !combineSubSections)
+ {
+ wxFprintf(Subsubsections, _T("\n</FONT></BODY></HTML>\n"));
+ fclose(Subsubsections);
+ Subsubsections = NULL;
+ }
+ if ( SectionContentsFD )
+ {
+ fclose(SectionContentsFD);
+ SectionContentsFD = NULL;
+ }
- wxFprintf(tmpTitle, _T("<FRAMESET COLS=\"30%%,70%%\">\n"));
+ // Create a temporary file for the title page header, add some info,
+ // and concat the titlepage just generated.
+ // This is necessary in order to put the title of the document
+ // at the TOP of the file within <HEAD>, even though we only find out
+ // what it is later on.
+ FILE *tmpTitle = wxFopen(_T("title.tmp"), _T("w"));
+ if (tmpTitle)
+ {
+ if (DocumentTitle)
+ {
+ SetCurrentOutput(tmpTitle);
+ HTMLHead();
+ TexOutput(_T("\n<TITLE>"));
+ TraverseChildrenFromChunk(DocumentTitle);
+ TexOutput(_T("</TITLE></HEAD>\n"));
+ }
+ else
+ {
+ SetCurrentOutput(tmpTitle);
+ HTMLHeadTo(tmpTitle);
+ if (contentsString)
+ wxFprintf(tmpTitle, _T("<TITLE>%s</TITLE></HEAD>\n\n"), contentsString);
+ else
+ wxFprintf(tmpTitle, _T("<TITLE>%s</TITLE></HEAD>\n\n"), wxFileNameFromPath(FileRoot));
+ }
- wxFprintf(tmpTitle, _T("<FRAME SRC=\"%s\">\n"), ConvertCase(wxFileNameFromPath(contentsFrameName)));
- wxFprintf(tmpTitle, _T("<FRAME SRC=\"%s\" NAME=\"mainwindow\">\n"), ConvertCase(wxFileNameFromPath(firstFileName)));
- wxFprintf(tmpTitle, _T("</FRAMESET>\n"));
+ // Output frame information
+ if (htmlFrameContents)
+ {
+ wxChar firstFileName[300];
+ if (truncateFilenames)
+ wxSnprintf(firstFileName, sizeof(firstFileName), _T("%s1.htm"), FileRoot);
+ else
+ wxStrcpy(firstFileName, gs_filenames[1].c_str());
- wxFprintf(tmpTitle, _T("<NOFRAMES>\n"));
- }
+ wxFprintf(tmpTitle, _T("<FRAMESET COLS=\"30%%,70%%\">\n"));
- // Output <BODY...> to temporary title page
- OutputBodyStart();
- fflush(tmpTitle);
+ wxFprintf(tmpTitle, _T("<FRAME SRC=\"%s\">\n"), ConvertCase(wxFileNameFromPath(contentsFrameName)));
+ wxFprintf(tmpTitle, _T("<FRAME SRC=\"%s\" NAME=\"mainwindow\">\n"), ConvertCase(wxFileNameFromPath(firstFileName)));
+ wxFprintf(tmpTitle, _T("</FRAMESET>\n"));
- // Concat titlepage
- FILE *fd = wxFopen(TitlepageName, _T("r"));
- if (fd)
- {
- int ch = getc(fd);
- while (ch != EOF)
- {
- wxPutc(ch, tmpTitle);
- ch = getc(fd);
- }
- fclose(fd);
- }
+ wxFprintf(tmpTitle, _T("<NOFRAMES>\n"));
+ }
- wxFprintf(tmpTitle, _T("\n</FONT></BODY>\n"));
+ // Output <BODY...> to temporary title page
+ OutputBodyStart();
+ fflush(tmpTitle);
- if (htmlFrameContents)
- {
- wxFprintf(tmpTitle, _T("\n</NOFRAMES>\n"));
- }
- wxFprintf(tmpTitle, _T("\n</HTML>\n"));
+ // Concat titlepage
+ FILE *fd = wxFopen(TitlepageName, _T("r"));
+ if (fd)
+ {
+ int ch = getc(fd);
+ while (ch != EOF)
+ {
+ wxPutc(ch, tmpTitle);
+ ch = getc(fd);
+ }
+ fclose(fd);
+ }
- fclose(tmpTitle);
- if (wxFileExists(TitlepageName)) wxRemoveFile(TitlepageName);
- if (!wxRenameFile(_T("title.tmp"), TitlepageName))
- {
- wxCopyFile(_T("title.tmp"), TitlepageName);
- wxRemoveFile(_T("title.tmp"));
- }
- }
+ wxFprintf(tmpTitle, _T("\n</FONT></BODY>\n"));
- if (lastFileName) delete[] lastFileName;
- lastFileName = NULL;
- if (lastTopic) delete[] lastTopic;
- lastTopic = NULL;
+ if (htmlFrameContents)
+ {
+ wxFprintf(tmpTitle, _T("\n</NOFRAMES>\n"));
+ }
+ wxFprintf(tmpTitle, _T("\n</HTML>\n"));
- if (wxFileExists(ContentsName)) wxRemoveFile(ContentsName);
+ fclose(tmpTitle);
+ if (wxFileExists(TitlepageName)) wxRemoveFile(TitlepageName);
+ if (!wxRenameFile(_T("title.tmp"), TitlepageName))
+ {
+ wxCopyFile(_T("title.tmp"), TitlepageName);
+ wxRemoveFile(_T("title.tmp"));
+ }
+ }
- if (!wxRenameFile(TmpContentsName, ContentsName))
- {
- wxCopyFile(TmpContentsName, ContentsName);
- wxRemoveFile(TmpContentsName);
- }
+ if (lastFileName) delete[] lastFileName;
+ lastFileName = NULL;
+ if (lastTopic) delete[] lastTopic;
+ lastTopic = NULL;
- // Generate .htx file if requested
- if (htmlIndex)
- {
- wxChar htmlIndexName[300];
- wxSnprintf(htmlIndexName, sizeof(htmlIndexName), _T("%s.htx"), FileRoot);
- GenerateHTMLIndexFile(htmlIndexName);
- }
+ if (wxFileExists(ContentsName)) wxRemoveFile(ContentsName);
- // Generate HTML Help Workshop files if requested
- if (htmlWorkshopFiles)
- {
- HTMLWorkshopEndContents();
- GenerateHTMLWorkshopFiles(FileRoot);
- }
+ if (!wxRenameFile(TmpContentsName, ContentsName))
+ {
+ wxCopyFile(TmpContentsName, ContentsName);
+ wxRemoveFile(TmpContentsName);
+ }
+ // Generate .htx file if requested
+ if (htmlIndex)
+ {
+ wxChar htmlIndexName[300];
+ wxSnprintf(htmlIndexName, sizeof(htmlIndexName), _T("%s.htx"), FileRoot);
+ GenerateHTMLIndexFile(htmlIndexName);
+ }
- return true;
- }
+ // Generate HTML Help Workshop files if requested
+ if (htmlWorkshopFiles)
+ {
+ HTMLWorkshopEndContents();
+ GenerateHTMLWorkshopFiles(FileRoot);
+ }
- return false;
+ return true;
+ }
+
+ return false;
}
// Output .htx index file