* Variables accessible from clients
*
*/
-
+
TexChunk * DocumentTitle = NULL;
TexChunk * DocumentAuthor = NULL;
TexChunk * DocumentDate = NULL;
int titleFont = LARGEFont3;
int authorFont = LargeFont2;
int mirrorMargins = true;
-bool winHelp = false; // Output in Windows Help format if TRUE, linear otherwise
+bool winHelp = false; // Output in Windows Help format if true, linear otherwise
bool isInteractive = false;
bool runTwice = false;
int convertMode = TEX_RTF;
bool checkSyntax = false;
bool headerRule = false;
bool footerRule = false;
-bool compatibilityMode = false; // If TRUE, maximum Latex compatibility
+bool compatibilityMode = false; // If true, maximum Latex compatibility
// (Quality of RTF generation deteriorate)
bool generateHPJ; // Generate WinHelp Help Project file
wxChar *winHelpTitle = NULL; // Windows Help title
bool combineSubSections = false;
bool htmlWorkshopFiles = false;
bool ignoreBadRefs = false;
-wxChar *htmlFaceName = NULL;
+wxChar *htmlFaceName = NULL;
extern int passNumber;
* Section numbering
*
*/
-
+
int chapterNo = 0;
int sectionNo = 0;
int subsectionNo = 0;
* Other variables
*
*/
-
+
FILE *CurrentOutput1 = NULL;
FILE *CurrentOutput2 = NULL;
FILE *Inputs[15];
wxChar *TexFileRoot = NULL;
wxChar *TexBibName = NULL; // Bibliography output file name
wxChar *TexTmpBibName = NULL; // Temporary bibliography output file name
-bool isSync = false; // If TRUE, should not yield to other processes.
-bool stopRunning = false; // If TRUE, should abort.
+bool isSync = false; // If true, should not yield to other processes.
+bool stopRunning = false; // If true, should abort.
static int currentColumn = 0;
wxChar *currentArgData = NULL;
-bool haveArgData = false; // If TRUE, we're simulating the data.
+bool haveArgData = false; // If true, we're simulating the data.
TexChunk *currentArgument = NULL;
TexChunk *nextChunk = NULL;
bool isArgOptional = false;
TexRef::TexRef(const wxChar *label, const wxChar *file,
- const wxChar *section, const wxChar *sectionN)
+ const wxChar *section, const wxChar *sectionN)
{
refLabel = copystring(label);
refFile = file ? copystring(file) : (wxChar*) NULL;
break;
}
}
-
+
TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBrace)
{
*parseToBrace = true;
macroBuf[j-i] = 0;
def = (TexMacroDef *)MacroDefs.Get(macroBuf);
}
-
+
if (def)
{
i = j;
-
+
// We want to check whether this is a space-consuming macro
// (e.g. {\bf word})
// No brace, e.g. \input thing.tex instead of \input{thing};
int ch = -2;
unsigned long bufIndex = 0;
buf[0] = 0;
+ int lastChar;
while (ch != EOF && ch != 10)
{
((bufIndex == 16) && (wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0)))
readInVerbatim = false;
+ lastChar = ch;
ch = getc(Inputs[CurrentInputIndex]);
if (checkCurleyBraces)
{
- if (ch == '{' && !readInVerbatim)
+ if (ch == '{' && !readInVerbatim && lastChar != _T('\\'))
leftCurley++;
- if (ch == '}' && !readInVerbatim)
+ if (ch == '}' && !readInVerbatim && lastChar != _T('\\'))
{
rightCurley++;
if (rightCurley > leftCurley)
if ((ch1 == 10) || (ch1 == 13))
{
// Eliminate newline (10) following DOS linefeed
- if (ch1 == 13)
+ if (ch1 == 13)
getc(Inputs[CurrentInputIndex]);
buf[bufIndex] = 0;
IncrementLineNumber();
return false;
}
- buf[bufIndex] = ch;
+ buf[bufIndex] = (wxChar)ch;
bufIndex ++;
}
}
case 0xfc: // ü
case 0xd6: // Ö
case 0xc4: // Ä
- case 0xdc: // Ü
+ case 0xdc: // Ü
if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE)
{
wxString errBuf;
case 0xfc:buf[bufIndex++]='u';break; // ü
case 0xd6:buf[bufIndex++]='O';break; // Ö
case 0xc4:buf[bufIndex++]='A';break; // Ä
- case 0xdc:buf[bufIndex++]='U';break; // Ü
- }
+ case 0xdc:buf[bufIndex++]='U';break; // Ü
+ }
buf[bufIndex++]='}';
break;
- case 0xdf: // ß
+ case 0xdf: // ß
if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE)
{
wxString errBuf;
buf[bufIndex++]='s';
buf[bufIndex++]='\\';
buf[bufIndex++]='/';
- break;
+ break;
default:
if (bufIndex >= MAX_LINE_BUFFER_SIZE)
{
OnError((wxChar *)errBuf.c_str());
return false;
}
- // If the current character read in is a '_', we need to check
+ // If the current character read in is a '_', we need to check
// whether there should be a '\' before it or not
if (ch != '_')
{
- buf[bufIndex++] = ch;
+ buf[bufIndex++] = (wxChar)ch;
break;
}
// There should NOT be a '\' before the '_'
if ((bufIndex > 0 && (buf[bufIndex-1] == '\\')) && (buf[0] != '%'))
{
- wxString errBuf;
- errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that should NOT have a '\\' before it."),
- LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str());
- OnError((wxChar *)errBuf.c_str());
+// wxString errBuf;
+// errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that should NOT have a '\\' before it."),
+// LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str());
+// OnError((wxChar *)errBuf.c_str());
}
}
else
}
}
}
- buf[bufIndex++] = ch;
+ buf[bufIndex++] = (wxChar)ch;
break;
} // switch
} // else
buf[bufIndex] = 0;
fclose(Inputs[CurrentInputIndex]);
Inputs[CurrentInputIndex] = NULL;
- if (CurrentInputIndex > 0)
+ if (CurrentInputIndex > 0)
ch = ' '; // No real end of file
CurrentInputIndex --;
j -= 5;
buf[j] = 0;
}
-
+
if (buf[j-1] == '}')
buf[j-1] = 0; // Ignore final brace
buf[j] = 0;
}
- if (buf[j-1] == _T('}'))
+ if (buf[j-1] == _T('}'))
buf[j-1] = 0; // Ignore final brace
// Remove backslashes from name
* Parse an argument.
* 'environment' specifies the name of the macro IFF if we're looking for the end
* of an environment, e.g. \end{itemize}. Otherwise it's NULL.
- * 'parseToBrace' is TRUE if the argument should extend to the next right brace,
+ * 'parseToBrace' is true if the argument should extend to the next right brace,
* e.g. in {\bf an argument} as opposed to \vskip 30pt
*
*/
{
Tex2RTFYield();
if (stopRunning) return pos;
-
+
bool eof = false;
BigBuffer[0] = 0;
int buf_ptr = 0;
}
}
*/
-
+
// If not parsing to brace, just read the next word
// (e.g. \vskip 20pt)
if (!parseToBrace)
while (!eof && ch != 13 && ch != 32 && ch != 10 &&
ch != 0 && ch != '{')
{
- BigBuffer[buf_ptr] = ch;
+ BigBuffer[buf_ptr] = (wxChar)ch;
buf_ptr ++;
pos ++;
ch = buffer[pos];
children.Append((wxObject *)chunk);
}
pos ++;
-
+
// Try matching \end{environment}
if (environment && FindEndEnvironment(buffer, &pos, environment))
{
}
else
{
- wxTex2RTFBuffer[i] = ch;
+ wxTex2RTFBuffer[i] = (wxChar)ch;
pos ++;
i ++;
if (ch == 0)
if (buffer[pos] == '*')
pos ++;
- // Find the delimiter character
+ // Find the delimiter character
int ch = buffer[pos];
pos ++;
// Now at start of verbatim text
wxStrcat(macroBuf, _T("}"));
ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk);
}
-
+
// delete chunk; // Might delete children
}
}
wxStrcat(macroBuf, _T("}"));
ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk);
}
-
+
// delete chunk; // Might delete children
}
}
* Consume as many arguments as the macro definition specifies
*
*/
-
+
int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent,
int no_args, wxChar *buffer, int pos,
wxChar *environment, bool parseToBrace,
TexPathList.EnsureFileAccessible(filename);
- if (line_buffer)
+ if (line_buffer)
delete line_buffer;
line_buffer = new wxChar[MAX_LINE_BUFFER_SIZE];
-
+
Inputs[0] = wxFopen(filename, _T("r"));
LineNumbers[0] = 1;
FileNames[0] = copystring(filename);
no_args = toCopy.no_args;
argn = toCopy.argn;
macroId = toCopy.macroId;
-
+
// if (toCopy.name)
// name = copystring(toCopy.name);
// else
value = copystring(toCopy.value);
else
value = NULL;
-
+
optional = toCopy.optional;
wxNode *node = toCopy.children.GetFirst();
while (node)
* only!)
*
*/
-
+
void GetArgData1(TexChunk *chunk)
{
switch (chunk->type)
}
/**/
TexReferences.BeginFind();
- wxNode *node = TexReferences.Next();
- while (node)
+ wxHashTable::Node *refNode = TexReferences.Next();
+ while (refNode)
{
- TexRef *ref = (TexRef *)node->GetData();
+ TexRef *ref = (TexRef *)refNode->GetData();
delete ref;
- node = TexReferences.Next();
+ refNode = TexReferences.Next();
}
TexReferences.Clear();
-
- node = BibList.GetFirst();
- while (node)
+
+ wxNode* bibNode = BibList.GetFirst();
+ while (bibNode)
{
- BibEntry *entry = (BibEntry *)node->GetData();
+ BibEntry *entry = (BibEntry *)bibNode->GetData();
delete entry;
- delete node;
- node = BibList.GetFirst();
+ delete bibNode;
+ bibNode = BibList.GetFirst();
}
CitationList.Clear();
ResetTopicCounter();
AddMacroDef(ltUPSHAPE, _T("upshape"), 1);
AddMacroDef(ltURLREF, _T("urlref"), 2);
AddMacroDef(ltUSEPACKAGE, _T("usepackage"), 1);
-
+
AddMacroDef(ltVAREPSILON, _T("varepsilon"), 0);
AddMacroDef(ltVARPHI, _T("varphi"), 0);
AddMacroDef(ltVARPI, _T("varpi"), 0);
* Default behaviour, should be called by client if can't match locally.
*
*/
-
+
// Called on start/end of macro examination
void DefaultOnMacro(int macroId, int no_args, bool start)
{
TexOutput(_T("(r)"), true);
break;
case ltBACKSLASH:
- if (start)
+ if (start)
TexOutput(_T("\\"), true);
break;
case ltLDOTS:
else
{
wxString informBuf;
- informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
+ informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
OnInform((wxChar *)informBuf.c_str());
}
}
DocumentStyle = LATEX_LETTER;
else if (wxStrncmp(DocumentStyleString, _T("slides"), 6) == 0)
DocumentStyle = LATEX_SLIDES;
-
+
if (StringMatch(_T("10"), DocumentStyleString))
SetFontSizes(10);
else if (StringMatch(_T("11"), DocumentStyleString))
if (fd)
{
ch = getc(fd);
- smallBuf[0] = ch;
+ smallBuf[0] = (wxChar)ch;
while (ch != EOF)
{
TexOutput(smallBuf);
ch = getc(fd);
- smallBuf[0] = ch;
+ smallBuf[0] = (wxChar)ch;
}
fclose(fd);
}
wxChar *s1 = copystring(s);
int i;
for (i = 0; i < (int)wxStrlen(s); i++)
- s1[i] = wxToupper(s[i]);
+ s1[i] = (wxChar)wxToupper(s[i]);
TexOutput(s1);
delete[] s1;
return false;
wxChar *s1 = copystring(s);
int i;
for (i = 0; i < (int)wxStrlen(s); i++)
- s1[i] = wxTolower(s[i]);
+ s1[i] = (wxChar)wxTolower(s[i]);
TexOutput(s1);
delete[] s1;
return false;
wxChar *s1 = copystring(s);
int i;
for (i = 0; i < (int)wxStrlen(s); i++)
- s1[i] = wxToupper(s[i]);
+ s1[i] = (wxChar)wxToupper(s[i]);
TexOutput(s1);
delete[] s1;
return false;