X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4116fac052b9b6f7963b4acf2721a24075692454..a124f99a24fb1f2ef41e37223ea35bcc9a4eece9:/utils/tex2rtf/src/htmlutil.cpp
diff --git a/utils/tex2rtf/src/htmlutil.cpp b/utils/tex2rtf/src/htmlutil.cpp
index ec8fdfb658..de0409e8ce 100644
--- a/utils/tex2rtf/src/htmlutil.cpp
+++ b/utils/tex2rtf/src/htmlutil.cpp
@@ -10,10 +10,6 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
@@ -39,6 +35,7 @@ static inline wxChar* copystring(const wxChar* s)
extern wxHashTable TexReferences;
+extern int passNumber;
extern void DecToHex(int, wxChar *);
void GenerateHTMLIndexFile(wxChar *fname);
@@ -117,7 +114,7 @@ class TexNextPage: public wxObject
label = copystring(theLabel);
filename = copystring(theFile);
}
- ~TexNextPage(void)
+ virtual ~TexNextPage(void)
{
delete[] label;
delete[] filename;
@@ -662,7 +659,7 @@ void OutputBodyStart(void)
if (s)
{
TexOutput(_T(" BACKGROUND=\""));
- TexOutput(s);
+ TexOutput(s);
TexOutput(_T("\""));
}
}
@@ -905,7 +902,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
if ( combineSubSections && !subsectionStarted )
{
fflush(Sections);
-
+
// Read old .con file in at this point
wxChar buf[256];
wxStrcpy(buf, CurrentSectionFile);
@@ -1323,7 +1320,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
TexOutput(_T("\n
\n"));
else {
TexOutput(_T("\n
\n"));
- // DHS
+ // DHS
TwoColWidthA = -1;
TwoColWidthB = -1;
}
@@ -1825,7 +1822,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
static bool CheckTypeRef()
{
wxString typeDecl = GetArgData();
- if( !typeDecl.IsEmpty() ) {
+ if( !typeDecl.empty() ) {
typeDecl.Replace(wxT("\\"),wxT(""));
wxString label = typeDecl;
label.Replace(wxT("const"),wxT(""));
@@ -2107,9 +2104,15 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
TraverseChildrenFromChunk(helpRefText);
if (!ignoreBadRefs)
TexOutput(_T(" (REF NOT FOUND)"));
- wxString errBuf;
- errBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
- OnInform((wxChar *)errBuf.c_str());
+
+ // for launching twice do not warn in preparation pass
+ if ((passNumber == 1 && !runTwice) ||
+ (passNumber == 2 && runTwice))
+ {
+ wxString errBuf;
+ errBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
+ OnInform((wxChar *)errBuf.c_str());
+ }
}
}
else TexOutput(_T("??"));
@@ -2181,7 +2184,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
TexOutput(_T("
"));
}
else
@@ -2190,7 +2193,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
TexOutput(_T("
"));
delete[] inlineFilename;
}
@@ -2240,7 +2243,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
if (imageFile)
delete[] imageFile;
imageFile = NULL;
- if (!f.IsEmpty())
+ if (!f.empty())
{
imageFile = copystring(f);
}
@@ -2335,7 +2338,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
wxSnprintf(buf, sizeof(buf), _T("\n\n"),TwoColWidthB);
TexOutput(buf);
}
- else
+ else
{
TexOutput(_T("\n | \n"));
}
@@ -3024,223 +3027,222 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
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("\n\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("%s\n"), ContentsNameString);
+ if (htmlFrameContents)
+ {
+// FrameContents = wxFopen(TmpFrameContentsName, _T("w"));
+ FrameContents = wxFopen(contentsFrameName, _T("w"));
+ wxFprintf(FrameContents, _T("\n \n"));
- wxFprintf(FrameContents, _T(" |