// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
unsigned long leftCurly = 0;
unsigned long rightCurly = 0;
-static wxString currentFileName = _T("");
+static wxString currentFileName = wxEmptyString;
bool read_a_line(wxChar *buf)
{
wxString actualFile = TexPathList.FindValidPath(fileName);
currentFileName = actualFile;
- if (actualFile == _T(""))
+ if (actualFile.empty())
{
wxString errBuf;
errBuf.Printf(_T("Could not find file: %s"),fileName);
return read_a_line(buf);
wxString actualFile = TexPathList.FindValidPath(fileNameStr);
- if (actualFile == _T(""))
+ if (actualFile.empty())
{
wxChar buf2[400];
wxSnprintf(buf2, sizeof(buf2), _T("%s.tex"), fileNameStr.c_str());
}
currentFileName = actualFile;
- if (actualFile == _T(""))
+ if (actualFile.empty())
{
wxString errBuf;
errBuf.Printf(_T("Could not find file: %s"),fileName);
if (checkSyntax)
{
wxString bufStr = buf;
- for (int index=0; syntaxTokens[index] != wxEmptyString; index++)
+ for (int index=0; !syntaxTokens[index].empty(); index++)
{
size_t pos = bufStr.find(syntaxTokens[index]);
if (pos != wxString::npos && pos != 0)
return pos;
}
-bool TexLoadFile(wxChar *filename)
+bool TexLoadFile(const wxString& filename)
{
- static wxChar *line_buffer;
- stopRunning = false;
- wxStrcpy(TexFileRoot, filename);
- StripExtension(TexFileRoot);
- wxSnprintf(TexBibName, 300, _T("%s.bb"), TexFileRoot);
- wxSnprintf(TexTmpBibName, 300, _T("%s.bb1"), TexFileRoot);
+ static wxChar *line_buffer;
+ stopRunning = false;
+ wxStrcpy(TexFileRoot, filename);
+ StripExtension(TexFileRoot);
+ wxSnprintf(TexBibName, 300, _T("%s.bb"), TexFileRoot);
+ wxSnprintf(TexTmpBibName, 300, _T("%s.bb1"), TexFileRoot);
- TexPathList.EnsureFileAccessible(filename);
+ TexPathList.EnsureFileAccessible(filename);
- if (line_buffer)
- delete line_buffer;
+ if (line_buffer)
+ delete line_buffer;
- line_buffer = new wxChar[MAX_LINE_BUFFER_SIZE];
+ line_buffer = new wxChar[MAX_LINE_BUFFER_SIZE];
- Inputs[0] = wxFopen(filename, _T("r"));
- LineNumbers[0] = 1;
- FileNames[0] = copystring(filename);
- if (Inputs[0])
- {
- read_a_line(line_buffer);
- ParseMacroBody(_T("toplevel"), TopLevel, 1, line_buffer, 0, NULL, true);
- if (Inputs[0]) fclose(Inputs[0]);
- return true;
- }
+ Inputs[0] = wxFopen(filename, _T("r"));
+ LineNumbers[0] = 1;
+ FileNames[0] = copystring(filename);
+ if (Inputs[0])
+ {
+ read_a_line(line_buffer);
+ ParseMacroBody(_T("toplevel"), TopLevel, 1, line_buffer, 0, NULL, true);
+ if (Inputs[0]) fclose(Inputs[0]);
+ return true;
+ }
- return false;
+ return false;
}
TexMacroDef::TexMacroDef(int the_id, const wxChar *the_name, int n, bool ig, bool forbidLevel)
case ltCINSERT:
if (start)
- TexOutput(_T("<<"), true);
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T("<<"));
+ else
+ TexOutput(_T("<<"), true);
+ }
break;
case ltCEXTRACT:
if (start)
- TexOutput(_T(">>"), true);
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T(">>"));
+ else
+ TexOutput(_T(">>"), true);
+ }
break;
case ltDESTRUCT:
if (start)
// Binary operation symbols
case ltLE:
case ltLEQ:
- if (start) TexOutput(_T("<="));
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T("<="));
+ else
+ TexOutput(_T("<="));
+ }
break;
case ltLL:
- if (start) TexOutput(_T("<<"));
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T("<<"));
+ else
+ TexOutput(_T("<<"));
+ }
break;
case ltSUBSET:
if (start) TexOutput(_T("SUBSET"));
break;
case ltGE:
case ltGEQ:
- if (start) TexOutput(_T(">="));
+ {
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T(">="));
+ else
+ TexOutput(_T(">="));
+ }
break;
+ }
case ltGG:
- if (start) TexOutput(_T(">>"));
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T(">>"));
+ else
+ TexOutput(_T(">>"));
+ }
break;
case ltSUPSET:
if (start) TexOutput(_T("SUPSET"));
// Arrows
case ltLEFTARROW:
- if (start) TexOutput(_T("<--"));
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T("<--"));
+ else
+ TexOutput(_T("<--"));
+ }
break;
case ltLEFTARROW2:
- if (start) TexOutput(_T("<=="));
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T("<=="));
+ else
+ TexOutput(_T("<=="));
+ }
break;
case ltRIGHTARROW:
- if (start) TexOutput(_T("-->"));
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T("-->"));
+ else
+ TexOutput(_T("-->"));
+ }
break;
case ltRIGHTARROW2:
- if (start) TexOutput(_T("==>"));
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T("==>"));
+ else
+ TexOutput(_T("==>"));
+ }
break;
case ltLEFTRIGHTARROW:
- if (start) TexOutput(_T("<-->"));
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T("<-->"));
+ else
+ TexOutput(_T("<-->"));
+ }
break;
case ltLEFTRIGHTARROW2:
- if (start) TexOutput(_T("<==>"));
+ if (start)
+ {
+ if (convertMode == TEX_HTML)
+ TexOutput(_T("<==>"));
+ else
+ TexOutput(_T("<==>"));
+ }
break;
case ltUPARROW:
if (start) TexOutput(_T("UPARROW"));
wxChar fileBuf[300];
wxStrcpy(fileBuf, bibFile);
wxString actualFile = TexPathList.FindValidPath(fileBuf);
- if (actualFile == _T(""))
+ if (actualFile.empty())
{
wxStrcat(fileBuf, _T(".bib"));
actualFile = TexPathList.FindValidPath(fileBuf);
}
- if (actualFile != _T(""))
+ if (!actualFile.empty())
{
if (!ReadBib((wxChar*) (const wxChar*) actualFile))
{
}
return true;
}
-