X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c155d33875eb3641bf845fbac186c1b5470708e..f525dc54798efe715b2139d7633bd907f437d3f2:/utils/tex2rtf/src/tex2any.cpp diff --git a/utils/tex2rtf/src/tex2any.cpp b/utils/tex2rtf/src/tex2any.cpp index 8d595fdecb..8b1ef42b5d 100644 --- a/utils/tex2rtf/src/tex2any.cpp +++ b/utils/tex2rtf/src/tex2any.cpp @@ -2,7 +2,8 @@ // Name: tex2any.cpp // Purpose: Utilities for Latex conversion. // Author: Julian Smart -// Modified by: +// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support +// Ron Lee // Created: 01/01/99 // RCS-ID: $Id$ // Copyright: (c) Julian Smart @@ -37,7 +38,7 @@ static inline wxChar* copystring(const wxChar* s) * Variables accessible from clients * */ - + TexChunk * DocumentTitle = NULL; TexChunk * DocumentAuthor = NULL; TexChunk * DocumentDate = NULL; @@ -107,16 +108,16 @@ int sectionFont = 12; // LargeFont2; int subsectionFont = 12; // largeFont1; int titleFont = LARGEFont3; int authorFont = LargeFont2; -int mirrorMargins = TRUE; -bool winHelp = FALSE; // Output in Windows Help format if TRUE, linear otherwise -bool isInteractive = FALSE; -bool runTwice = FALSE; +int mirrorMargins = true; +bool winHelp = false; // Output in Windows Help format if true, linear otherwise +bool isInteractive = false; +bool runTwice = false; int convertMode = TEX_RTF; -bool checkCurleyBraces = FALSE; -bool checkSyntax = FALSE; -bool headerRule = FALSE; -bool footerRule = FALSE; -bool compatibilityMode = FALSE; // If TRUE, maximum Latex compatibility +bool checkCurlyBraces = false; +bool checkSyntax = false; +bool headerRule = false; +bool footerRule = false; +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 @@ -125,32 +126,32 @@ int defaultTableColumnWidth = 2000; int labelIndentTab = 18; // From left indent to item label (points) int itemIndentTab = 40; // From left indent to item (points) -bool useUpButton = TRUE; +bool useUpButton = true; int htmlBrowseButtons = HTML_BUTTONS_TEXT; -bool truncateFilenames = FALSE; // Truncate for DOS +bool truncateFilenames = false; // Truncate for DOS int winHelpVersion = 3; // WinHelp Version (3 for Windows 3.1, 4 for Win95) -bool winHelpContents = FALSE; // Generate .cnt file for WinHelp 4 -bool htmlIndex = FALSE; // Generate .htx file for HTML -bool htmlFrameContents = FALSE; // Use frames for HTML contents page +bool winHelpContents = false; // Generate .cnt file for WinHelp 4 +bool htmlIndex = false; // Generate .htx file for HTML +bool htmlFrameContents = false; // Use frames for HTML contents page wxChar *htmlStylesheet = NULL; // Use this CSS stylesheet for HTML pages -bool useHeadingStyles = TRUE; // Insert \s1, s2 etc. -bool useWord = TRUE; // Insert proper Word table of contents, etc etc +bool useHeadingStyles = true; // Insert \s1, s2 etc. +bool useWord = true; // Insert proper Word table of contents, etc etc int contentsDepth = 4; // Depth of Word table of contents -bool indexSubsections = TRUE; // Index subsections in linear RTF +bool indexSubsections = true; // Index subsections in linear RTF // Linear RTF method of including bitmaps. Can be "includepicture", "hex" wxChar *bitmapMethod = copystring(_T("includepicture")); -bool upperCaseNames = FALSE; +bool upperCaseNames = false; // HTML background and text colours wxChar *backgroundImageString = NULL; wxChar *backgroundColourString = copystring(_T("255;255;255")); wxChar *textColourString = NULL; wxChar *linkColourString = NULL; wxChar *followedLinkColourString = NULL; -bool combineSubSections = FALSE; -bool htmlWorkshopFiles = FALSE; -bool ignoreBadRefs = FALSE; -wxChar *htmlFaceName = NULL; +bool combineSubSections = false; +bool htmlWorkshopFiles = false; +bool ignoreBadRefs = false; +wxChar *htmlFaceName = NULL; extern int passNumber; @@ -180,7 +181,7 @@ wxChar *UpNameString = copystring(_T("Up")); * Section numbering * */ - + int chapterNo = 0; int sectionNo = 0; int subsectionNo = 0; @@ -192,7 +193,7 @@ int tableNo = 0; * Other variables * */ - + FILE *CurrentOutput1 = NULL; FILE *CurrentOutput2 = NULL; FILE *Inputs[15]; @@ -203,15 +204,15 @@ int CurrentInputIndex = 0; 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; +bool isArgOptional = false; int noArgs = 0; TexChunk *TopLevel = NULL; @@ -226,7 +227,7 @@ TexMacroDef *VerbatimMacroDef = NULL; 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; @@ -301,10 +302,10 @@ void ForbidWarning(TexMacroDef *def) break; } } - + TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBrace) { - *parseToBrace = TRUE; + *parseToBrace = true; int i = (*pos); TexMacroDef *def = NULL; wxChar macroBuf[40]; @@ -358,11 +359,11 @@ TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBra 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}; @@ -372,7 +373,7 @@ TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBra if ((buffer[i] == 32) || (buffer[i] == '=')) i ++; - *parseToBrace = FALSE; + *parseToBrace = false; } *pos = i; ForbidWarning(def); @@ -385,8 +386,8 @@ void EatWhiteSpace(wxChar *buffer, int *pos) { int len = wxStrlen(buffer); int j = *pos; - bool keepGoing = TRUE; - bool moreLines = TRUE; + bool keepGoing = true; + bool moreLines = true; while ((j < len) && keepGoing && (buffer[j] == 10 || buffer[j] == 13 || buffer[j] == ' ' || buffer[j] == 9)) { @@ -400,7 +401,7 @@ void EatWhiteSpace(wxChar *buffer, int *pos) j = 0; } else - keepGoing = FALSE; + keepGoing = false; } } *pos = j; @@ -415,20 +416,20 @@ bool FindEndEnvironment(wxChar *buffer, int *pos, wxChar *env) (wxStrncmp(buffer+i+4, env, wxStrlen(env)) == 0)) { *pos = i + 5 + wxStrlen(env); - return TRUE; + return true; } - else return FALSE; + else return false; } -bool readingVerbatim = FALSE; -bool readInVerbatim = FALSE; // Within a verbatim, but not nec. verbatiminput +bool readingVerbatim = false; +bool readInVerbatim = false; // Within a verbatim, but not nec. verbatiminput // Switched this off because e.g. \verb${$ causes it to fail. There is no // detection of \verb yet. // #define CHECK_BRACES 1 -unsigned long leftCurley = 0; -unsigned long rightCurley = 0; +unsigned long leftCurly = 0; +unsigned long rightCurly = 0; static wxString currentFileName = _T(""); bool read_a_line(wxChar *buf) @@ -436,12 +437,13 @@ bool read_a_line(wxChar *buf) if (CurrentInputIndex < 0) { buf[0] = 0; - return FALSE; + return false; } int ch = -2; unsigned long bufIndex = 0; buf[0] = 0; + int lastChar; while (ch != EOF && ch != 10) { @@ -451,31 +453,32 @@ bool read_a_line(wxChar *buf) errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(), MAX_LINE_BUFFER_SIZE); OnError((wxChar *)errBuf.c_str()); - return FALSE; + return false; } if (((bufIndex == 14) && (wxStrncmp(buf, _T("\\end{verbatim}"), 14) == 0)) || ((bufIndex == 16) && (wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0))) - readInVerbatim = FALSE; + readInVerbatim = false; + lastChar = ch; ch = getc(Inputs[CurrentInputIndex]); - if (checkCurleyBraces) + if (checkCurlyBraces) { - if (ch == '{' && !readInVerbatim) - leftCurley++; - if (ch == '}' && !readInVerbatim) + if (ch == '{' && !readInVerbatim && lastChar != _T('\\')) + leftCurly++; + if (ch == '}' && !readInVerbatim && lastChar != _T('\\')) { - rightCurley++; - if (rightCurley > leftCurley) + rightCurly++; + if (rightCurly > leftCurly) { wxString errBuf; - errBuf.Printf(_T("An extra right Curley brace ('}') was detected at line %lu inside file %s"), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); + errBuf.Printf(_T("An extra right Curly brace ('}') was detected at line %lu inside file %s"), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); OnError((wxChar *)errBuf.c_str()); - // Reduce the count of right Curley braces, so the mismatched count + // Reduce the count of right Curly braces, so the mismatched count // isn't reported on every line that has a '}' after the first mismatch - rightCurley--; + rightCurly--; } } } @@ -489,7 +492,7 @@ bool read_a_line(wxChar *buf) if ((ch1 == 10) || (ch1 == 13)) { // Eliminate newline (10) following DOS linefeed - if (ch1 == 13) + if (ch1 == 13) getc(Inputs[CurrentInputIndex]); buf[bufIndex] = 0; IncrementLineNumber(); @@ -501,7 +504,7 @@ bool read_a_line(wxChar *buf) errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); OnError((wxChar *)errBuf.c_str()); - return FALSE; + return false; } wxStrcat(buf, _T("\\par")); bufIndex += 5; @@ -516,10 +519,10 @@ bool read_a_line(wxChar *buf) errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); OnError((wxChar *)errBuf.c_str()); - return FALSE; + return false; } - buf[bufIndex] = ch; + buf[bufIndex] = (wxChar)ch; bufIndex ++; } } @@ -534,14 +537,14 @@ bool read_a_line(wxChar *buf) case 0xfc: // ü case 0xd6: // Ö case 0xc4: // Ä - case 0xdc: // Ü + case 0xdc: // Ü if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE) { wxString errBuf; errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); OnError((wxChar *)errBuf.c_str()); - return FALSE; + return false; } buf[bufIndex++]='\\'; buf[bufIndex++]='"'; @@ -553,25 +556,25 @@ bool read_a_line(wxChar *buf) 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; errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); OnError((wxChar *)errBuf.c_str()); - return FALSE; + return false; } buf[bufIndex++]='\\'; buf[bufIndex++]='s'; buf[bufIndex++]='s'; buf[bufIndex++]='\\'; buf[bufIndex++]='/'; - break; + break; default: if (bufIndex >= MAX_LINE_BUFFER_SIZE) { @@ -579,13 +582,13 @@ bool read_a_line(wxChar *buf) errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); OnError((wxChar *)errBuf.c_str()); - return FALSE; + 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; } @@ -596,10 +599,10 @@ bool read_a_line(wxChar *buf) // 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 @@ -622,7 +625,7 @@ bool read_a_line(wxChar *buf) } } } - buf[bufIndex++] = ch; + buf[bufIndex++] = (wxChar)ch; break; } // switch } // else @@ -632,29 +635,29 @@ bool read_a_line(wxChar *buf) buf[bufIndex] = 0; fclose(Inputs[CurrentInputIndex]); Inputs[CurrentInputIndex] = NULL; - if (CurrentInputIndex > 0) + if (CurrentInputIndex > 0) ch = ' '; // No real end of file CurrentInputIndex --; - if (checkCurleyBraces) + if (checkCurlyBraces) { - if (leftCurley != rightCurley) + if (leftCurly != rightCurly) { wxString errBuf; - errBuf.Printf(_T("Curley braces do not match inside file %s\n%lu opens, %lu closes"), - (const wxChar*) currentFileName.c_str(),leftCurley,rightCurley); + errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"), + (const wxChar*) currentFileName.c_str(),leftCurly,rightCurly); OnError((wxChar *)errBuf.c_str()); } - leftCurley = 0; - rightCurley = 0; + leftCurly = 0; + rightCurly = 0; } if (readingVerbatim) { - readingVerbatim = FALSE; - readInVerbatim = FALSE; + readingVerbatim = false; + readInVerbatim = false; wxStrcat(buf, _T("\\end{verbatim}\n")); - return FALSE; + return false; } } if (ch == 10) @@ -684,7 +687,7 @@ bool read_a_line(wxChar *buf) j -= 5; buf[j] = 0; } - + if (buf[j-1] == '}') buf[j-1] = 0; // Ignore final brace @@ -716,13 +719,13 @@ bool read_a_line(wxChar *buf) } else { - readingVerbatim = TRUE; - readInVerbatim = TRUE; + readingVerbatim = true; + readInVerbatim = true; wxStrcpy(buf, _T("\\begin{verbatim}\n")); - return FALSE; + return false; } } - return FALSE; + return false; } else if (wxStrncmp(buf, _T("\\input"), 6) == 0 || wxStrncmp(buf, _T("\\helpinput"), 10) == 0 || wxStrncmp(buf, _T("\\include"), 8) == 0) @@ -750,7 +753,7 @@ bool read_a_line(wxChar *buf) buf[j] = 0; } - if (buf[j-1] == _T('}')) + if (buf[j-1] == _T('}')) buf[j-1] = 0; // Ignore final brace // Remove backslashes from name @@ -767,7 +770,7 @@ bool read_a_line(wxChar *buf) if (actualFile == _T("")) { wxChar buf2[400]; - wxSprintf(buf2, _T("%s.tex"), fileNameStr.c_str()); + wxSnprintf(buf2, sizeof(buf2), _T("%s.tex"), fileNameStr.c_str()); actualFile = TexPathList.FindValidPath(buf2); } currentFileName = actualFile; @@ -841,18 +844,18 @@ bool read_a_line(wxChar *buf) if (wxStrncmp(buf, _T("\\begin{verbatim}"), 16) == 0 || wxStrncmp(buf, _T("\\begin{toocomplex}"), 18) == 0) - readInVerbatim = TRUE; + readInVerbatim = true; else if (wxStrncmp(buf, _T("\\end{verbatim}"), 14) == 0 || wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0) - readInVerbatim = FALSE; + readInVerbatim = false; - if (checkCurleyBraces) + if (checkCurlyBraces) { - if (ch == EOF && leftCurley != rightCurley) + if (ch == EOF && leftCurly != rightCurly) { wxString errBuf; - errBuf.Printf(_T("Curley braces do not match inside file %s\n%lu opens, %lu closes"), - (const wxChar*) currentFileName.c_str(),leftCurley,rightCurley); + errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"), + (const wxChar*) currentFileName.c_str(),leftCurly,rightCurly); OnError((wxChar *)errBuf.c_str()); } } @@ -894,18 +897,18 @@ bool ParseNewCommand(wxChar *buffer, int *pos) noArgs = (int)(buffer[*pos]) - 48; *pos += 2; // read past argument and '[' } - bool end = FALSE; + bool end = false; int braceCount = 0; while (!end) { - char ch = buffer[*pos]; + wxChar ch = buffer[*pos]; if (ch == _T('{')) braceCount ++; else if (ch == _T('}')) { braceCount --; if (braceCount == 0) - end = TRUE; + end = true; } else if (ch == 0) { @@ -928,9 +931,9 @@ bool ParseNewCommand(wxChar *buffer, int *pos) CustomMacroList.Append(commandName, macro); AddMacroDef(ltCUSTOM_MACRO, commandName, noArgs); } - return TRUE; + return true; } - else return FALSE; + else return false; } void MacroError(wxChar *buffer) @@ -939,7 +942,7 @@ void MacroError(wxChar *buffer) wxChar macroBuf[200]; macroBuf[0] = '\\'; int i = 1; - char ch; + wxChar ch; while (((ch = buffer[i-1]) != '\n') && (ch != 0)) { macroBuf[i] = ch; @@ -956,7 +959,7 @@ void MacroError(wxChar *buffer) if (wxStrcmp(macroBuf,_T("\\end{document}")) == 0) { OnInform( _T("Halted build due to unrecoverable error.") ); - stopRunning = TRUE; + stopRunning = true; } } @@ -964,7 +967,7 @@ void MacroError(wxChar *buffer) * 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 * */ @@ -972,8 +975,8 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha { Tex2RTFYield(); if (stopRunning) return pos; - - bool eof = FALSE; + + bool eof = false; BigBuffer[0] = 0; int buf_ptr = 0; int len; @@ -992,17 +995,17 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha if ((pos > 0) && (buffer[pos-1] != ' ') && (buffer[pos] == '[' || buffer[pos] == '(')) { - isOptional = TRUE; + isOptional = true; pos ++; } else if ((pos > 1) && (buffer[pos-1] != ' ') && (buffer[pos+1] == '[' || buffer[pos+1] == '(')) { - isOptional = TRUE; + isOptional = true; pos += 2; } } */ - + // If not parsing to brace, just read the next word // (e.g. \vskip 20pt) if (!parseToBrace) @@ -1011,7 +1014,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha 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]; @@ -1090,15 +1093,15 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha } } - char ch = buffer[pos]; + wxChar wxCh = buffer[pos]; // End of optional argument -- pretend it's right brace for simplicity - if (thisArg->optional && (ch == ']')) - ch = '}'; + if (thisArg->optional && (wxCh == _T(']'))) + wxCh = _T('}'); - switch (ch) + switch (wxCh) { case 0: - case '}': // End of argument + case _T('}'): // End of argument { if (buf_ptr > 0) { @@ -1107,10 +1110,10 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha chunk->value = copystring(BigBuffer); children.Append((wxObject *)chunk); } - if (ch == '}') pos ++; + if (wxCh == _T('}')) pos ++; return pos; } - case '\\': + case _T('\\'): { if (buf_ptr > 0) // Finish off the string we've read so far { @@ -1121,7 +1124,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha children.Append((wxObject *)chunk); } pos ++; - + // Try matching \end{environment} if (environment && FindEndEnvironment(buffer, &pos, environment)) { @@ -1148,40 +1151,40 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha wxTex2RTFBuffer[0] = 0; int i = 0; - bool end = FALSE; + bool end = false; while (!end) { - int ch = buffer[pos]; - if (ch == '}') + wxChar ch = buffer[pos]; + if (ch == _T('}')) { noBraces --; if (noBraces == 0) { wxTex2RTFBuffer[i] = 0; - end = TRUE; + end = true; } else { - wxTex2RTFBuffer[i] = '}'; + wxTex2RTFBuffer[i] = _T('}'); i ++; } pos ++; } - else if (ch == '{') + else if (ch == _T('{')) { - wxTex2RTFBuffer[i] = '{'; + wxTex2RTFBuffer[i] = _T('{'); i ++; pos ++; } - else if (ch == '\\' && buffer[pos+1] == '}') + else if (ch == _T('\\') && buffer[pos+1] == _T('}')) { - wxTex2RTFBuffer[i] = '}'; + wxTex2RTFBuffer[i] = _T('}'); pos += 2; i++; } - else if (ch == '\\' && buffer[pos+1] == '{') + else if (ch == _T('\\') && buffer[pos+1] == _T('{')) { - wxTex2RTFBuffer[i] = '{'; + wxTex2RTFBuffer[i] = _T('{'); pos += 2; i++; } @@ -1191,7 +1194,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha pos ++; i ++; if (ch == 0) - end = TRUE; + end = true; } } TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); @@ -1215,10 +1218,10 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha else if (wxStrncmp(buffer+pos, _T("verb"), 4) == 0) { pos += 4; - if (buffer[pos] == '*') + if (buffer[pos] == _T('*')) pos ++; - // Find the delimiter character + // Find the delimiter character int ch = buffer[pos]; pos ++; // Now at start of verbatim text @@ -1253,10 +1256,10 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha children.Append((wxObject *)chunk); } - else - { + else + { wxChar *env = NULL; - bool tmpParseToBrace = TRUE; + bool tmpParseToBrace = true; TexMacroDef *def = MatchMacro(buffer, &pos, &env, &tmpParseToBrace); if (def) { @@ -1292,9 +1295,9 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha // wxStrcpy(macroBuf, _T("{")); wxStrcpy(macroBuf, customMacro->macroBody); wxStrcat(macroBuf, _T("}")); - ParseArg(thisArg, children, macroBuf, 0, NULL, TRUE, chunk); + ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk); } - + // delete chunk; // Might delete children } } @@ -1307,10 +1310,10 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha } // Parse constructs like {\bf thing} as if they were // \bf{thing} - case '{': + case _T('{'): { pos ++; - if (buffer[pos] == '\\') + if (buffer[pos] == _T('\\')) { if (buf_ptr > 0) { @@ -1337,7 +1340,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha children.Append((wxObject *)chunk); pos = ParseMacroBody(def->name, chunk, chunk->no_args, - buffer, pos, NULL, TRUE, customMacroArgs); + buffer, pos, NULL, true, customMacroArgs); // If custom macro, parse the body substituting the above found args. if (customMacro) @@ -1348,9 +1351,9 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha // wxStrcpy(macroBuf, _T("{")); wxStrcpy(macroBuf, customMacro->macroBody); wxStrcat(macroBuf, _T("}")); - ParseArg(thisArg, children, macroBuf, 0, NULL, TRUE, chunk); + ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk); } - + // delete chunk; // Might delete children } } @@ -1360,7 +1363,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha } } else - { + { /* * If all else fails, we assume that we have * a pair of braces on their own, so return a `dummy' macro @@ -1368,7 +1371,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha */ if (!SoloBlockDef) { - SoloBlockDef = new TexMacroDef(ltSOLO_BLOCK, _T("solo block"), 1, FALSE); + SoloBlockDef = new TexMacroDef(ltSOLO_BLOCK, _T("solo block"), 1, false); } // Save text so far if (buf_ptr > 0) @@ -1392,11 +1395,11 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha arg->argn = 1; arg->macroId = chunk->macroId; - pos = ParseArg(arg, arg->children, buffer, pos, NULL, TRUE, customMacroArgs); - } + pos = ParseArg(arg, arg->children, buffer, pos, NULL, true, customMacroArgs); + } break; } - case '$': + case _T('$'): { if (buf_ptr > 0) { @@ -1409,7 +1412,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha pos ++; - if (buffer[pos] == '$') + if (buffer[pos] == _T('$')) { TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); chunk->no_args = 0; @@ -1428,7 +1431,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha } break; } - case '~': + case _T('~'): { if (buf_ptr > 0) { @@ -1447,7 +1450,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha children.Append((wxObject *)chunk); break; } - case '#': // Either treat as a special TeX character or as a macro arg + case _T('#'): // Either treat as a special TeX character or as a macro arg { if (buf_ptr > 0) { @@ -1483,12 +1486,12 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha } break; } - case '&': + case _T('&'): { // Remove white space before and after the ampersand, // since this is probably a table column separator with // some convenient -- but useless -- white space in the text. - while ((buf_ptr > 0) && ((BigBuffer[buf_ptr-1] == ' ') || (BigBuffer[buf_ptr-1] == 9))) + while ((buf_ptr > 0) && ((BigBuffer[buf_ptr-1] == _T(' ')) || (BigBuffer[buf_ptr-1] == 9))) buf_ptr --; if (buf_ptr > 0) @@ -1502,7 +1505,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha pos ++; - while (buffer[pos] == ' ' || buffer[pos] == 9) + while (buffer[pos] == _T(' ') || buffer[pos] == 9) pos ++; TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); @@ -1513,13 +1516,13 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha break; } // Eliminate end-of-line comment - case '%': + case _T('%'): { - ch = buffer[pos]; - while (ch != 10 && ch != 13 && ch != 0) + wxCh = buffer[pos]; + while (wxCh != 10 && wxCh != 13 && wxCh != 0) { pos ++; - ch = buffer[pos]; + wxCh = buffer[pos]; } if (buffer[pos] == 10 || buffer[pos] == 13) { @@ -1531,7 +1534,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha // Eliminate tab case 9: { - BigBuffer[buf_ptr] = ' '; + BigBuffer[buf_ptr] = _T(' '); BigBuffer[buf_ptr+1] = 0; buf_ptr ++; pos ++; @@ -1539,7 +1542,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha } default: { - BigBuffer[buf_ptr] = ch; + BigBuffer[buf_ptr] = wxCh; BigBuffer[buf_ptr+1] = 0; buf_ptr ++; pos ++; @@ -1554,7 +1557,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha * 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, @@ -1598,7 +1601,7 @@ int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent, else actualEnv = environment; - bool isOptional = FALSE; + bool isOptional = false; // Remove the first { of the argument so it doesn't get recognized as { ... } // EatWhiteSpace(buffer, &pos); @@ -1612,12 +1615,12 @@ int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent, else if ((pos > 0) && (buffer[pos-1] != ' ') && (buffer[pos] == '[')) { - isOptional = TRUE; + isOptional = true; pos ++; } else if ((pos > 1) && (buffer[pos-1] != ' ') && (buffer[pos+1] == '[')) { - isOptional = TRUE; + isOptional = true; pos += 2; } else if (i > 0) @@ -1663,31 +1666,31 @@ int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent, bool TexLoadFile(wxChar *filename) { static wxChar *line_buffer; - stopRunning = FALSE; + stopRunning = false; wxStrcpy(TexFileRoot, filename); StripExtension(TexFileRoot); - wxSprintf(TexBibName, _T("%s.bb"), TexFileRoot); - wxSprintf(TexTmpBibName, _T("%s.bb1"), TexFileRoot); + wxSnprintf(TexBibName, 300, _T("%s.bb"), TexFileRoot); + wxSnprintf(TexTmpBibName, 300, _T("%s.bb1"), TexFileRoot); 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); if (Inputs[0]) { read_a_line(line_buffer); - ParseMacroBody(_T("toplevel"), TopLevel, 1, line_buffer, 0, NULL, TRUE); + ParseMacroBody(_T("toplevel"), TopLevel, 1, line_buffer, 0, NULL, true); if (Inputs[0]) fclose(Inputs[0]); - return TRUE; + return true; } - return FALSE; + return false; } TexMacroDef::TexMacroDef(int the_id, const wxChar *the_name, int n, bool ig, bool forbidLevel) @@ -1713,7 +1716,7 @@ TexChunk::TexChunk(int the_type, TexMacroDef *the_def) def = the_def; macroId = 0; value = NULL; - optional = FALSE; + optional = false; } TexChunk::TexChunk(TexChunk& toCopy) @@ -1722,7 +1725,7 @@ TexChunk::TexChunk(TexChunk& toCopy) no_args = toCopy.no_args; argn = toCopy.argn; macroId = toCopy.macroId; - + // if (toCopy.name) // name = copystring(toCopy.name); // else @@ -1733,7 +1736,7 @@ TexChunk::TexChunk(TexChunk& toCopy) value = copystring(toCopy.value); else value = NULL; - + optional = toCopy.optional; wxNode *node = toCopy.children.GetFirst(); while (node) @@ -1773,7 +1776,7 @@ int GetNoArgs(void) // Number of args for this macro * only!) * */ - + void GetArgData1(TexChunk *chunk) { switch (chunk->type) @@ -1825,7 +1828,7 @@ wxChar *GetArgData(TexChunk *WXUNUSED(chunk)) { currentArgData[0] = 0; GetArgData1(currentArgument); - haveArgData = FALSE; + haveArgData = false; return currentArgData; } @@ -1879,7 +1882,7 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly) return; if (!childrenOnly) - OnMacro(chunk->macroId, chunk->no_args, TRUE); + OnMacro(chunk->macroId, chunk->no_args, true); wxNode *node = chunk->children.GetFirst(); while (node) @@ -1893,7 +1896,7 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly) nextChunk = (TexChunk *)thisNode->GetNext()->GetData(); if (!childrenOnly) - OnMacro(chunk->macroId, chunk->no_args, FALSE); + OnMacro(chunk->macroId, chunk->no_args, false); break; } case CHUNK_TYPE_ARG: @@ -1903,9 +1906,9 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly) isArgOptional = chunk->optional; noArgs = chunk->no_args; - // If OnArgument returns FALSE, don't output. + // If OnArgument returns false, don't output. - if (childrenOnly || OnArgument(chunk->macroId, chunk->argn, TRUE)) + if (childrenOnly || OnArgument(chunk->macroId, chunk->argn, true)) { wxNode *node = chunk->children.GetFirst(); while (node) @@ -1925,7 +1928,7 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly) noArgs = chunk->no_args; if (!childrenOnly) - (void)OnArgument(chunk->macroId, chunk->argn, FALSE); + (void)OnArgument(chunk->macroId, chunk->argn, false); break; } case CHUNK_TYPE_STRING: @@ -1938,9 +1941,9 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly) if (issuedNewParagraph && !((chunk->value[0] == 10 || chunk->value[0] == 13 || chunk->value[0] == 32) && chunk->value[1] == 0)) { - issuedNewParagraph = FALSE; + issuedNewParagraph = false; } - TexOutput(chunk->value, TRUE); + TexOutput(chunk->value, true); } break; } @@ -2015,7 +2018,7 @@ void TexCleanUp(void) CurrentOutput1 = NULL; CurrentOutput2 = NULL; CurrentInputIndex = 0; - haveArgData = FALSE; + haveArgData = false; noArgs = 0; if (TopLevel) @@ -2055,22 +2058,22 @@ void TexCleanUp(void) } /**/ 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(); @@ -2153,7 +2156,7 @@ void DefineDefaultMacros(void) AddMacroDef(ltCLIPSFUNC, _T("clipsfunc"), 3); AddMacroDef(ltCLUBSUIT, _T("clubsuit"), 0); AddMacroDef(ltCOLUMNSEP, _T("columnsep"), 1); - AddMacroDef(ltCOMMENT, _T("comment"), 1, TRUE); + AddMacroDef(ltCOMMENT, _T("comment"), 1, true); AddMacroDef(ltCONG, _T("cong"), 0); AddMacroDef(ltCOPYRIGHT, _T("copyright"), 0); AddMacroDef(ltCPARAM, _T("cparam"), 2); @@ -2221,7 +2224,7 @@ void DefineDefaultMacros(void) AddMacroDef(ltHEADHEIGHT, _T("headheight"), 1); AddMacroDef(ltHEARTSUIT, _T("heartsuit"), 0); AddMacroDef(ltHELPGLOSSARY, _T("helpglossary"), 1); - AddMacroDef(ltHELPIGNORE, _T("helpignore"), 1, TRUE); + AddMacroDef(ltHELPIGNORE, _T("helpignore"), 1, true); AddMacroDef(ltHELPONLY, _T("helponly"), 1); AddMacroDef(ltHELPINPUT, _T("helpinput"), 1); AddMacroDef(ltHELPFONTFAMILY, _T("helpfontfamily"), 1); @@ -2246,7 +2249,7 @@ void DefineDefaultMacros(void) AddMacroDef(ltINCLUDE, _T("include"), 1); AddMacroDef(ltINDENTED, _T("indented"), 2); AddMacroDef(ltINDEX, _T("index"), 1); - AddMacroDef(ltINPUT, _T("input"), 1, TRUE); + AddMacroDef(ltINPUT, _T("input"), 1, true); AddMacroDef(ltIOTA, _T("iota"), 0); AddMacroDef(ltITEMIZE, _T("itemize"), 1); AddMacroDef(ltITEM, _T("item"), 0); @@ -2314,7 +2317,7 @@ void DefineDefaultMacros(void) AddMacroDef(ltNABLA, _T("nabla"), 0); AddMacroDef(ltNEG, _T("neg"), 0); AddMacroDef(ltNEQ, _T("neq"), 0); - AddMacroDef(ltNEWCOUNTER, _T("newcounter"), 1, FALSE, (bool)FORBID_ABSOLUTELY); + AddMacroDef(ltNEWCOUNTER, _T("newcounter"), 1, false, (bool)FORBID_ABSOLUTELY); AddMacroDef(ltNEWLINE, _T("newline"), 0); AddMacroDef(ltNEWPAGE, _T("newpage"), 0); AddMacroDef(ltNI, _T("ni"), 0); @@ -2367,8 +2370,8 @@ void DefineDefaultMacros(void) AddMacroDef(ltPRECEQ, _T("preceq"), 0); AddMacroDef(ltPRINTINDEX, _T("printindex"), 0); AddMacroDef(ltPROPTO, _T("propto"), 0); - AddMacroDef(ltPSBOXTO, _T("psboxto"), 1, FALSE, (bool)FORBID_ABSOLUTELY); - AddMacroDef(ltPSBOX, _T("psbox"), 1, FALSE, (bool)FORBID_ABSOLUTELY); + AddMacroDef(ltPSBOXTO, _T("psboxto"), 1, false, (bool)FORBID_ABSOLUTELY); + AddMacroDef(ltPSBOX, _T("psbox"), 1, false, (bool)FORBID_ABSOLUTELY); AddMacroDef(ltPSI, _T("psi"), 0); AddMacroDef(ltCAP_PSI, _T("Psi"), 0); @@ -2439,7 +2442,7 @@ void DefineDefaultMacros(void) AddMacroDef(ltSUPSET, _T("supset"), 0); AddMacroDef(ltSUBSUBSECTIONSTAR, _T("subsubsection*"), 1); AddMacroDef(ltSUBSUBSECTION, _T("subsubsection"), 1); - AddMacroDef(ltSUPERTABULAR, _T("supertabular"), 2, FALSE); + AddMacroDef(ltSUPERTABULAR, _T("supertabular"), 2, false); AddMacroDef(ltSURD, _T("surd"), 0); AddMacroDef(ltSCRIPTSIZE, _T("scriptsize"), 1); AddMacroDef(ltSETHEADER, _T("setheader"), 6); @@ -2453,7 +2456,7 @@ void DefineDefaultMacros(void) AddMacroDef(ltTABBING, _T("tabbing"), 2); AddMacroDef(ltTABLEOFCONTENTS, _T("tableofcontents"), 0); AddMacroDef(ltTABLE, _T("table"), 1); - AddMacroDef(ltTABULAR, _T("tabular"), 2, FALSE); + AddMacroDef(ltTABULAR, _T("tabular"), 2, false); AddMacroDef(ltTAB, _T("tab"), 0); AddMacroDef(ltTAU, _T("tau"), 0); AddMacroDef(ltTEXTRM, _T("textrm"), 1); @@ -2503,7 +2506,7 @@ void DefineDefaultMacros(void) 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); @@ -2567,7 +2570,7 @@ void DefineDefaultMacros(void) * 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) { @@ -2580,8 +2583,8 @@ void DefaultOnMacro(int macroId, int no_args, bool start) { // Write the heading FakeCurrentSection(AbstractNameString); - OnMacro(ltPAR, 0, TRUE); - OnMacro(ltPAR, 0, FALSE); + OnMacro(ltPAR, 0, true); + OnMacro(ltPAR, 0, false); } else { @@ -2600,12 +2603,12 @@ void DefaultOnMacro(int macroId, int no_args, bool start) { // Write the heading FakeCurrentSection(GlossaryNameString); - OnMacro(ltPAR, 0, TRUE); - OnMacro(ltPAR, 0, FALSE); + OnMacro(ltPAR, 0, true); + OnMacro(ltPAR, 0, false); if ((convertMode == TEX_RTF) && !winHelp) { - OnMacro(ltPAR, 0, TRUE); - OnMacro(ltPAR, 0, FALSE); + OnMacro(ltPAR, 0, true); + OnMacro(ltPAR, 0, false); } } break; @@ -2617,100 +2620,101 @@ void DefaultOnMacro(int macroId, int no_args, bool start) case ltCINSERT: if (start) - TexOutput(_T("<<"), TRUE); + TexOutput(_T("<<"), true); break; case ltCEXTRACT: if (start) - TexOutput(_T(">>"), TRUE); + TexOutput(_T(">>"), true); break; case ltDESTRUCT: if (start) - TexOutput(_T("~"), TRUE); + TexOutput(_T("~"), true); break; case ltTILDE: if (start) - TexOutput(_T("~"), TRUE); + TexOutput(_T("~"), true); break; case ltSPECIALTILDE: if (start) - TexOutput(_T(" "), TRUE); + TexOutput(_T(" "), true); break; case ltUNDERSCORE: if (start) - TexOutput(_T("_"), TRUE); + TexOutput(_T("_"), true); break; case ltHASH: if (start) - TexOutput(_T("#"), TRUE); + TexOutput(_T("#"), true); break; case ltAMPERSAND: if (start) - TexOutput(_T("&"), TRUE); + TexOutput(_T("&"), true); break; case ltSPACE: if (start) - TexOutput(_T(" "), TRUE); + TexOutput(_T(" "), true); break; case ltPIPE: if (start) - TexOutput(_T("|"), TRUE); + TexOutput(_T("|"), true); break; case ltPERCENT: if (start) - TexOutput(_T("%"), TRUE); + TexOutput(_T("%"), true); break; case ltDOLLAR: if (start) - TexOutput(_T("$"), TRUE); + TexOutput(_T("$"), true); break; case ltLPARENTH: if (start) - TexOutput(_T(""), TRUE); + TexOutput(_T(""), true); break; case ltRPARENTH: if (start) - TexOutput(_T(""), TRUE); + TexOutput(_T(""), true); break; case ltLBRACE: if (start) - TexOutput(_T("{"), TRUE); + TexOutput(_T("{"), true); break; case ltRBRACE: if (start) - TexOutput(_T("}"), TRUE); + TexOutput(_T("}"), true); break; case ltCOPYRIGHT: if (start) - TexOutput(_T("(c)"), TRUE); + TexOutput(_T("(c)"), true); break; case ltREGISTERED: if (start) - TexOutput(_T("(r)"), TRUE); + TexOutput(_T("(r)"), true); break; case ltBACKSLASH: - if (start) - TexOutput(_T("\\"), TRUE); + if (start) + TexOutput(_T("\\"), true); break; case ltLDOTS: case ltCDOTS: if (start) - TexOutput(_T("..."), TRUE); + TexOutput(_T("..."), true); break; case ltVDOTS: if (start) - TexOutput(_T("|"), TRUE); + TexOutput(_T("|"), true); break; case ltLATEX: if (start) - TexOutput(_T("LaTeX"), TRUE); + TexOutput(_T("LaTeX"), true); break; case ltTEX: if (start) - TexOutput(_T("TeX"), TRUE); + TexOutput(_T("TeX"), true); break; case ltPOUNDS: if (start) - TexOutput(_T("£"), TRUE); + // FIXME: this is valid only if the output is iso-8859-1 + TexOutput(wxString::FromAscii("£"), true); break; case ltSPECIALDOUBLEDOLLAR: // Interpret as center OnMacro(ltCENTER, no_args, start); @@ -2733,7 +2737,7 @@ void DefaultOnMacro(int macroId, int no_args, bool start) { time_t when; (void) time(&when); - TexOutput(wxCtime(&when), TRUE); + TexOutput(wxCtime(&when), true); } break; } @@ -3166,41 +3170,41 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) else i ++; } } - TexOutput(texRef->sectionNumber + i, TRUE); + TexOutput(texRef->sectionNumber + i, true); } else { wxString informBuf; - informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName); + informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName); OnInform((wxChar *)informBuf.c_str()); } } - else TexOutput(_T("??"), TRUE); - return FALSE; + else TexOutput(_T("??"), true); + return false; } break; } case ltLABEL: { - return FALSE; + return false; } case ltAUTHOR: { if (start && (arg_no == 1)) DocumentAuthor = GetArgChunk(); - return FALSE; + return false; } case ltDATE: { if (start && (arg_no == 1)) DocumentDate = GetArgChunk(); - return FALSE; + return false; } case ltTITLE: { if (start && (arg_no == 1)) DocumentTitle = GetArgChunk(); - return FALSE; + return false; } case ltDOCUMENTCLASS: case ltDOCUMENTSTYLE: @@ -3219,7 +3223,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) 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)) @@ -3227,13 +3231,13 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) else if (StringMatch(_T("12"), DocumentStyleString)) SetFontSizes(12); - OnMacro(ltHELPFONTSIZE, 1, TRUE); - wxSprintf(currentArgData, _T("%d"), normalFont); - haveArgData = TRUE; - OnArgument(ltHELPFONTSIZE, 1, TRUE); - OnArgument(ltHELPFONTSIZE, 1, FALSE); - haveArgData = FALSE; - OnMacro(ltHELPFONTSIZE, 1, FALSE); + OnMacro(ltHELPFONTSIZE, 1, true); + wxSnprintf(currentArgData, 2000, _T("%d"), normalFont); + haveArgData = true; + OnArgument(ltHELPFONTSIZE, 1, true); + OnArgument(ltHELPFONTSIZE, 1, false); + haveArgData = false; + OnMacro(ltHELPFONTSIZE, 1, false); } else if (start && IsArgOptional()) { @@ -3246,13 +3250,13 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) else if (StringMatch(_T("12"), MinorDocumentStyleString)) SetFontSizes(12); } - return FALSE; + return false; } case ltBIBLIOGRAPHYSTYLE: { if (start && !IsArgOptional()) BibliographyStyleString = copystring(GetArgData()); - return FALSE; + return false; } case ltPAGESTYLE: { @@ -3261,49 +3265,49 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) if (PageStyle) delete[] PageStyle; PageStyle = copystring(GetArgData()); } - return FALSE; + return false; } /* case ltLHEAD: { if (start && !IsArgOptional()) LeftHeader = GetArgChunk(); - return FALSE; + return false; break; } case ltLFOOT: { if (start && !IsArgOptional()) LeftFooter = GetArgChunk(); - return FALSE; + return false; break; } case ltCHEAD: { if (start && !IsArgOptional()) CentreHeader = GetArgChunk(); - return FALSE; + return false; break; } case ltCFOOT: { if (start && !IsArgOptional()) CentreFooter = GetArgChunk(); - return FALSE; + return false; break; } case ltRHEAD: { if (start && !IsArgOptional()) RightHeader = GetArgChunk(); - return FALSE; + return false; break; } case ltRFOOT: { if (start && !IsArgOptional()) RightFooter = GetArgChunk(); - return FALSE; + return false; break; } */ @@ -3321,7 +3325,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) TexRef *ref = FindReference(citeKey); if (ref) { - TexOutput(ref->sectionNumber, TRUE); + TexOutput(ref->sectionNumber, true); if (wxStrcmp(ref->sectionNumber, _T("??")) == 0) { wxString informBuf; @@ -3332,10 +3336,10 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) citeKey = ParseMultifieldString(citeKeys, &pos); if (citeKey) { - TexOutput(_T(", "), TRUE); + TexOutput(_T(", "), true); } } - return FALSE; + return false; } break; } @@ -3345,7 +3349,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { wxChar *citeKey = GetArgData(); AddCitation(citeKey); - return FALSE; + return false; } break; } @@ -3360,7 +3364,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) SetFontSizes(11); else if (wxStrcmp(data, _T("12")) == 0) SetFontSizes(12); - return FALSE; + return false; } break; } @@ -3368,8 +3372,8 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (start) { - TexOutput(_T(" ??"), TRUE); - return FALSE; + TexOutput(_T(" ??"), true); + return false; } break; } @@ -3379,7 +3383,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { wxChar *data = GetArgData(); ParSkip = ParseUnitArgument(data); - return FALSE; + return false; } break; } @@ -3389,7 +3393,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { wxChar *data = GetArgData(); ParIndent = ParseUnitArgument(data); - return FALSE; + return false; } break; } @@ -3417,9 +3421,9 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) case ltFOOTNOTE: { if (start) - TexOutput(_T(" ("), TRUE); + TexOutput(_T(" ("), true); else - TexOutput(_T(")"), TRUE); + TexOutput(_T(")"), true); break; } case ltBIBLIOGRAPHY: @@ -3433,12 +3437,12 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) 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); } @@ -3494,7 +3498,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) wxRenameFile(TexTmpBibName, TexBibName); } SetCurrentOutputs(save1, save2); - return FALSE; + return false; } break; } @@ -3512,15 +3516,15 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) 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; + return false; } - else return TRUE; + else return true; } - return TRUE; + return true; } case ltLOWERCASE: { @@ -3532,15 +3536,15 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) 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; + return false; } - else return TRUE; + else return true; } - return TRUE; + return true; } case ltUPPERCASE: { @@ -3552,40 +3556,40 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) 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; + return false; } - else return TRUE; + else return true; } - return TRUE; + return true; } case ltPOPREF: // Ignore second argument by default return (start && (arg_no == 1)); case ltTWOCOLUMN: - return TRUE; + return true; case ltXLPIGNORE: - return ((convertMode == TEX_XLP) ? FALSE : TRUE); + return ((convertMode == TEX_XLP) ? false : true); case ltXLPONLY: - return ((convertMode != TEX_XLP) ? FALSE : TRUE); + return ((convertMode != TEX_XLP) ? false : true); case ltHTMLIGNORE: - return ((convertMode == TEX_HTML) ? FALSE : TRUE); + return ((convertMode == TEX_HTML) ? false : true); case ltHTMLONLY: - return ((convertMode != TEX_HTML) ? FALSE : TRUE); + return ((convertMode != TEX_HTML) ? false : true); case ltRTFIGNORE: - return (((convertMode == TEX_RTF) && !winHelp) ? FALSE : TRUE); + return (((convertMode == TEX_RTF) && !winHelp) ? false : true); case ltRTFONLY: - return (!((convertMode == TEX_RTF) && !winHelp) ? FALSE : TRUE); + return (!((convertMode == TEX_RTF) && !winHelp) ? false : true); case ltWINHELPIGNORE: - return (winHelp ? FALSE : TRUE); + return (winHelp ? false : true); case ltWINHELPONLY: - return (!winHelp ? FALSE : TRUE); + return (!winHelp ? false : true); case ltLATEXIGNORE: - return TRUE; + return true; case ltLATEXONLY: - return FALSE; + return false; case ltCLINE: case ltARABIC: case ltALPH1: @@ -3655,7 +3659,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) case ltIMAGER: case ltPOPREFONLY: case ltINSERTATLEVEL: - return FALSE; + return false; case ltTABULAR: case ltSUPERTABULAR: case ltINDENTED: @@ -3699,7 +3703,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) break; } } - return FALSE; + return false; } case ltFIGURE: case ltFIGURESTAR: @@ -3708,6 +3712,6 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) default: return (!IsArgOptional()); } - return TRUE; + return true; }