X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/04b9c5bb04bfa5470997667993f849e25fc5e869..ae200bfcb537c475708959cb034be66eb0f5dcd4:/utils/tex2rtf/src/tex2any.cpp diff --git a/utils/tex2rtf/src/tex2any.cpp b/utils/tex2rtf/src/tex2any.cpp index 7e8062f12a..33466d1a93 100644 --- a/utils/tex2rtf/src/tex2any.cpp +++ b/utils/tex2rtf/src/tex2any.cpp @@ -2,17 +2,14 @@ // Name: tex2any.cpp // Purpose: Utilities for Latex conversion. // Author: Julian Smart -// Modified by: +// Modified by: Wlodzimierz ABX Skiba 2003/2004 Unicode support +// Ron Lee // Created: 01/01/99 // RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -21,7 +18,6 @@ #endif #ifndef WX_PRECOMP -#include "wx/wx.h" #endif #include @@ -29,11 +25,16 @@ #include #include +#if !WXWIN_COMPATIBILITY_2_4 +static inline wxChar* copystring(const wxChar* s) + { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); } +#endif + /* * Variables accessible from clients * */ - + TexChunk * DocumentTitle = NULL; TexChunk * DocumentAuthor = NULL; TexChunk * DocumentDate = NULL; @@ -51,14 +52,14 @@ TexChunk * CentreHeaderOdd = NULL; TexChunk * CentreFooterOdd = NULL; TexChunk * RightHeaderOdd = NULL; TexChunk * RightFooterOdd = NULL; -char * PageStyle = copystring("plain"); +wxChar * PageStyle = copystring(_T("plain")); int DocumentStyle = LATEX_REPORT; int MinorDocumentStyle = 0; wxPathList TexPathList; -char * BibliographyStyleString = copystring("plain"); -char * DocumentStyleString = copystring("report"); -char * MinorDocumentStyleString = NULL; +wxChar * BibliographyStyleString = copystring(_T("plain")); +wxChar * DocumentStyleString = copystring(_T("report")); +wxChar * MinorDocumentStyleString = NULL; int ParSkip = 0; int ParIndent = 0; @@ -76,18 +77,18 @@ int HUGEFont3 = 28; // text) and must start at the first character of the line, or tex2rtf // will fail to process them correctly (a limitation of tex2rtf, not TeX) static const wxString syntaxTokens[] = -{ "\\begin{verbatim}", - "\\begin{toocomplex}", - "\\end{verbatim}", - "\\end{toocomplex}", - "\\verb", - "\\begin{comment}", - "\\end{comment}", - "\\verbatiminput", -// "\\par", - "\\input", - "\\helpinput", - "\\include", +{ _T("\\begin{verbatim}"), + _T("\\begin{toocomplex}"), + _T("\\end{verbatim}"), + _T("\\end{toocomplex}"), + _T("\\verb"), + _T("\\begin{comment}"), + _T("\\end{comment}"), + _T("\\verbatiminput"), +// _T("\\par"), + _T("\\input"), + _T("\\helpinput"), + _T("\\include"), wxEmptyString }; @@ -103,47 +104,50 @@ 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 -char *winHelpTitle = NULL; // Windows Help title +wxChar *winHelpTitle = NULL; // Windows Help title 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 useHeadingStyles = TRUE; // Insert \s1, s2 etc. -bool useWord = TRUE; // Insert proper Word table of contents, etc etc +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 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" -char *bitmapMethod = copystring("includepicture"); -bool upperCaseNames = FALSE; +wxChar *bitmapMethod = copystring(_T("includepicture")); +bool upperCaseNames = false; // HTML background and text colours -char *backgroundImageString = NULL; -char *backgroundColourString = copystring("255;255;255"); -char *textColourString = NULL; -char *linkColourString = NULL; -char *followedLinkColourString = NULL; -bool combineSubSections = FALSE; -bool htmlWorkshopFiles = FALSE; +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; extern int passNumber; @@ -154,26 +158,26 @@ extern wxHashTable TexReferences; */ // Names to help with internationalisation -char *ContentsNameString = copystring("Contents"); -char *AbstractNameString = copystring("Abstract"); -char *GlossaryNameString = copystring("Glossary"); -char *ReferencesNameString = copystring("References"); -char *FiguresNameString = copystring("List of Figures"); -char *TablesNameString = copystring("List of Tables"); -char *FigureNameString = copystring("Figure"); -char *TableNameString = copystring("Table"); -char *IndexNameString = copystring("Index"); -char *ChapterNameString = copystring("chapter"); -char *SectionNameString = copystring("section"); -char *SubsectionNameString = copystring("subsection"); -char *SubsubsectionNameString = copystring("subsubsection"); -char *UpNameString = copystring("Up"); +wxChar *ContentsNameString = copystring(_T("Contents")); +wxChar *AbstractNameString = copystring(_T("Abstract")); +wxChar *GlossaryNameString = copystring(_T("Glossary")); +wxChar *ReferencesNameString = copystring(_T("References")); +wxChar *FiguresNameString = copystring(_T("List of Figures")); +wxChar *TablesNameString = copystring(_T("List of Tables")); +wxChar *FigureNameString = copystring(_T("Figure")); +wxChar *TableNameString = copystring(_T("Table")); +wxChar *IndexNameString = copystring(_T("Index")); +wxChar *ChapterNameString = copystring(_T("chapter")); +wxChar *SectionNameString = copystring(_T("section")); +wxChar *SubsectionNameString = copystring(_T("subsection")); +wxChar *SubsubsectionNameString = copystring(_T("subsubsection")); +wxChar *UpNameString = copystring(_T("Up")); /* * Section numbering * */ - + int chapterNo = 0; int sectionNo = 0; int subsectionNo = 0; @@ -185,45 +189,46 @@ int tableNo = 0; * Other variables * */ - + FILE *CurrentOutput1 = NULL; FILE *CurrentOutput2 = NULL; FILE *Inputs[15]; -int LineNumbers[15]; -char *FileNames[15]; +unsigned long LineNumbers[15]; +wxChar *FileNames[15]; int CurrentInputIndex = 0; -char *TexFileRoot = NULL; -char *TexBibName = NULL; // Bibliography output file name -char *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. +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. static int currentColumn = 0; -char *currentArgData = NULL; -bool haveArgData = FALSE; // If TRUE, we're simulating the data. +wxChar *currentArgData = NULL; +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; // wxList MacroDefs(wxKEY_STRING); wxHashTable MacroDefs(wxKEY_STRING); wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.tex -char *BigBuffer = NULL; // For reading in large chunks of text +wxChar *BigBuffer = NULL; // For reading in large chunks of text TexMacroDef *SoloBlockDef = NULL; TexMacroDef *VerbatimMacroDef = NULL; #define IncrementLineNumber() LineNumbers[CurrentInputIndex] ++ -TexRef::TexRef(char *label, char *file, char *section, char *sectionN) +TexRef::TexRef(const wxChar *label, const wxChar *file, + const wxChar *section, const wxChar *sectionN) { refLabel = copystring(label); - refFile = file ? copystring(file) : (char*) NULL; - sectionNumber = section ? copystring(section) : copystring("??"); - sectionName = sectionN ? copystring(sectionN) : copystring("??"); + refFile = file ? copystring(file) : (wxChar*) NULL; + sectionNumber = section ? copystring(section) : copystring(_T("??")); + sectionName = sectionN ? copystring(sectionN) : copystring(_T("??")); } TexRef::~TexRef(void) @@ -243,9 +248,9 @@ CustomMacro::~CustomMacro() delete [] macroBody; } -void TexOutput(char *s, bool ordinaryText) +void TexOutput(const wxChar *s, bool ordinaryText) { - int len = strlen(s); + int len = wxStrlen(s); // Update current column, but only if we're guaranteed to // be ordinary text (not mark-up stuff) @@ -260,9 +265,9 @@ void TexOutput(char *s, bool ordinaryText) } if (CurrentOutput1) - fprintf(CurrentOutput1, "%s", s); + wxFprintf(CurrentOutput1, _T("%s"), s); if (CurrentOutput2) - fprintf(CurrentOutput2, "%s", s); + wxFprintf(CurrentOutput2, _T("%s"), s); } /* @@ -279,106 +284,109 @@ void ForbidWarning(TexMacroDef *def) { case FORBID_WARN: { - informBuf.Printf("Warning: it is recommended that command %s is not used.", def->name); - OnInform((char *)informBuf.c_str()); + informBuf.Printf(_T("Warning: it is recommended that command %s is not used."), def->name); + OnInform((const wxChar *)informBuf.c_str()); break; } case FORBID_ABSOLUTELY: { - informBuf.Printf("Error: command %s cannot be used and will lead to errors.", def->name); - OnInform((char *)informBuf.c_str()); + informBuf.Printf(_T("Error: command %s cannot be used and will lead to errors."), def->name); + OnInform((const wxChar *)informBuf.c_str()); break; } default: break; } } - -TexMacroDef *MatchMacro(char *buffer, int *pos, char **env, bool *parseToBrace) -{ - *parseToBrace = TRUE; - int i = (*pos); - TexMacroDef *def = NULL; - char macroBuf[40]; - // First, try to find begin{thing} - if (strncmp(buffer+i, "begin{", 6) == 0) - { - i += 6; +TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBrace) +{ + *parseToBrace = true; + int i = (*pos); + TexMacroDef *def = NULL; + wxChar macroBuf[40]; - int j = i; - while ((isalpha(buffer[j]) || buffer[j] == '*') && ((j - i) < 39)) + // First, try to find begin{thing} + if (wxStrncmp(buffer+i, _T("begin{"), 6) == 0) { - macroBuf[j-i] = buffer[j]; - j ++; - } - macroBuf[j-i] = 0; - def = (TexMacroDef *)MacroDefs.Get(macroBuf); + i += 6; - if (def) - { - *pos = j + 1; // BUGBUG Should this be + 1??? - *env = def->name; - ForbidWarning(def); - return def; + int j = i; + while ((isalpha(buffer[j]) || buffer[j] == '*') && ((j - i) < 39)) + { + macroBuf[j-i] = buffer[j]; + j ++; + } + macroBuf[j-i] = 0; + def = (TexMacroDef *)MacroDefs.Get(macroBuf); + + if (def) + { + *pos = j + 1; // BUGBUG Should this be + 1??? + *env = def->name; + ForbidWarning(def); + return def; + } + else + { + return NULL; + } } - else return NULL; - } - // Failed, so try to find macro from definition list - int j = i; + // Failed, so try to find macro from definition list + int j = i; - // First try getting a one-character macro, but ONLY - // if these TWO characters are not both alphabetical (could - // be a longer macro) - if (!(isalpha(buffer[i]) && isalpha(buffer[i+1]))) - { - macroBuf[0] = buffer[i]; - macroBuf[1] = 0; + // First try getting a one-character macro, but ONLY + // if these TWO characters are not both alphabetical (could + // be a longer macro) + if (!(isalpha(buffer[i]) && isalpha(buffer[i+1]))) + { + macroBuf[0] = buffer[i]; + macroBuf[1] = 0; - def = (TexMacroDef *)MacroDefs.Get(macroBuf); - if (def) j ++; - } + def = (TexMacroDef *)MacroDefs.Get(macroBuf); + if (def) j ++; + } - if (!def) - { - while ((isalpha(buffer[j]) || buffer[j] == '*') && ((j - i) < 39)) + if (!def) { - macroBuf[j-i] = buffer[j]; - j ++; + while ((isalpha(buffer[j]) || buffer[j] == '*') && ((j - i) < 39)) + { + macroBuf[j-i] = buffer[j]; + j ++; + } + macroBuf[j-i] = 0; + def = (TexMacroDef *)MacroDefs.Get(macroBuf); } - 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}; - // or a numeric argument, such as \parindent0pt - if ((def->no_args > 0) && ((buffer[i] == 32) || (buffer[i] == '=') || (isdigit(buffer[i])))) + + if (def) { - if ((buffer[i] == 32) || (buffer[i] == '=')) - i ++; + i = j; - *parseToBrace = FALSE; + // 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}; + // or a numeric argument, such as \parindent0pt + if ((def->no_args > 0) && ((buffer[i] == 32) || (buffer[i] == '=') || (isdigit(buffer[i])))) + { + if ((buffer[i] == 32) || (buffer[i] == '=')) + i ++; + + *parseToBrace = false; + } + *pos = i; + ForbidWarning(def); + return def; } - *pos = i; - ForbidWarning(def); - return def; - } - return NULL; + return NULL; } -void EatWhiteSpace(char *buffer, int *pos) +void EatWhiteSpace(wxChar *buffer, int *pos) { - int len = strlen(buffer); + 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)) { @@ -388,86 +396,88 @@ void EatWhiteSpace(char *buffer, int *pos) if (moreLines) { moreLines = read_a_line(buffer); - len = strlen(buffer); + len = wxStrlen(buffer); j = 0; } else - keepGoing = FALSE; + keepGoing = false; } } *pos = j; } -bool FindEndEnvironment(char *buffer, int *pos, char *env) +bool FindEndEnvironment(wxChar *buffer, int *pos, wxChar *env) { int i = (*pos); // Try to find end{thing} - if ((strncmp(buffer+i, "end{", 4) == 0) && - (strncmp(buffer+i+4, env, strlen(env)) == 0)) + if ((wxStrncmp(buffer+i, _T("end{"), 4) == 0) && + (wxStrncmp(buffer+i+4, env, wxStrlen(env)) == 0)) { - *pos = i + 5 + strlen(env); - return TRUE; + *pos = i + 5 + wxStrlen(env); + 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; -static wxString currentFileName = ""; +unsigned long leftCurly = 0; +unsigned long rightCurly = 0; +static wxString currentFileName = wxEmptyString; -bool read_a_line(char *buf) +bool read_a_line(wxChar *buf) { if (CurrentInputIndex < 0) { buf[0] = 0; - return FALSE; + return false; } int ch = -2; - int bufIndex = 0; + unsigned long bufIndex = 0; buf[0] = 0; + int lastChar; while (ch != EOF && ch != 10) { if (bufIndex >= MAX_LINE_BUFFER_SIZE) { wxString errBuf; - errBuf.Printf("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated.", - LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((char *)errBuf.c_str()); - return FALSE; + 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; } - if (((bufIndex == 14) && (strncmp(buf, "\\end{verbatim}", 14) == 0)) || - ((bufIndex == 16) && (strncmp(buf, "\\end{toocomplex}", 16) == 0))) - readInVerbatim = FALSE; + if (((bufIndex == 14) && (wxStrncmp(buf, _T("\\end{verbatim}"), 14) == 0)) || + ((bufIndex == 16) && (wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0))) + 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("An extra right Curley brace ('}') was detected at line %lu inside file %s",LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str()); - OnError((char *)errBuf.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--; } } } @@ -481,21 +491,21 @@ bool read_a_line(char *buf) if ((ch1 == 10) || (ch1 == 13)) { // Eliminate newline (10) following DOS linefeed - if (ch1 == 13) - ch1 = getc(Inputs[CurrentInputIndex]); + if (ch1 == 13) + getc(Inputs[CurrentInputIndex]); buf[bufIndex] = 0; IncrementLineNumber(); -// strcat(buf, "\\par\n"); +// wxStrcat(buf, "\\par\n"); // i += 6; if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE) { wxString errBuf; - errBuf.Printf("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated.", - LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((char *)errBuf.c_str()); - return FALSE; + 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; } - strcat(buf, "\\par"); + wxStrcat(buf, _T("\\par")); bufIndex += 5; } @@ -505,13 +515,13 @@ bool read_a_line(char *buf) if (bufIndex >= MAX_LINE_BUFFER_SIZE) { wxString errBuf; - errBuf.Printf("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated.", - LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((char *)errBuf.c_str()); - return FALSE; + 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; } - buf[bufIndex] = ch; + buf[bufIndex] = (wxChar)ch; bufIndex ++; } } @@ -526,14 +536,14 @@ bool read_a_line(char *buf) case 0xfc: // ü case 0xd6: // Ö case 0xc4: // Ä - case 0xdc: // Ü + case 0xdc: // Ü if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE) { wxString errBuf; - errBuf.Printf("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated.", - LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((char *)errBuf.c_str()); - return FALSE; + 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; } buf[bufIndex++]='\\'; buf[bufIndex++]='"'; @@ -545,70 +555,76 @@ bool read_a_line(char *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("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated.", - LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((char *)errBuf.c_str()); - return FALSE; + 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; } buf[bufIndex++]='\\'; buf[bufIndex++]='s'; buf[bufIndex++]='s'; buf[bufIndex++]='\\'; buf[bufIndex++]='/'; - break; + break; default: if (bufIndex >= MAX_LINE_BUFFER_SIZE) { wxString errBuf; - errBuf.Printf("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated.", - LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); - OnError((char *)errBuf.c_str()); - return FALSE; + 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; } - // 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; } - if (readInVerbatim) - { - // There should NOT be a '\' before the '_' - if ((bufIndex > 0 && (buf[bufIndex-1] == '\\')) && (buf[0] != '%')) - { - wxString errBuf; - errBuf.Printf("An underscore ('_') was detected at line %lu inside file %s that should NOT have a '\\' before it.",LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str()); - OnError((char *)errBuf.c_str()); - } - } - else + if (checkSyntax) { - // There should be a '\' before the '_' - if (bufIndex == 0) + if (readInVerbatim) { - wxString errBuf; - errBuf.Printf("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it.",LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str()); - OnError((char *)errBuf.c_str()); + // 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()); + } } - else if ((buf[bufIndex-1] != '\\') && (buf[0] != '%') && // If it is a comment line, then no warnings - (strncmp(buf, "\\input", 6))) // do not report filenames that have underscores in them + else { - wxString errBuf; - errBuf.Printf("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it.",LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str()); - OnError((char *)errBuf.c_str()); + // There should be a '\' before the '_' + if (bufIndex == 0) + { + wxString errBuf; + errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it."), + LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); + OnError((wxChar *)errBuf.c_str()); + } + else if ((buf[bufIndex-1] != '\\') && (buf[0] != '%') && // If it is a comment line, then no warnings + (wxStrncmp(buf, _T("\\input"), 6))) // do not report filenames that have underscores in them + { + wxString errBuf; + errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it."), + LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); + OnError((wxChar *)errBuf.c_str()); + } } } - buf[bufIndex++] = ch; + buf[bufIndex++] = (wxChar)ch; break; } // switch } // else @@ -618,28 +634,29 @@ bool read_a_line(char *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("Curley braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName.c_str(),leftCurley,rightCurley); - OnError((char *)errBuf.c_str()); + 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; - strcat(buf, "\\end{verbatim}\n"); - return FALSE; + readingVerbatim = false; + readInVerbatim = false; + wxStrcat(buf, _T("\\end{verbatim}\n")); + return false; } } if (ch == 10) @@ -648,47 +665,47 @@ bool read_a_line(char *buf) buf[bufIndex] = 0; // Strip out comment environment - if (strncmp(buf, "\\begin{comment}", 15) == 0) + if (wxStrncmp(buf, _T("\\begin{comment}"), 15) == 0) { - while (strncmp(buf, "\\end{comment}", 13) != 0) + while (wxStrncmp(buf, _T("\\end{comment}"), 13) != 0) read_a_line(buf); return read_a_line(buf); } // Read a verbatim input file as if it were a verbatim environment - else if (strncmp(buf, "\\verbatiminput", 14) == 0) + else if (wxStrncmp(buf, _T("\\verbatiminput"), 14) == 0) { int wordLen = 14; - char *fileName = buf + wordLen + 1; + wxChar *fileName = buf + wordLen + 1; int j = bufIndex - 1; buf[j] = 0; // thing}\par -- eliminate the \par! - if (strncmp((buf + strlen(buf)-5), "\\par", 4) == 0) + if (wxStrncmp((buf + wxStrlen(buf)-5), _T("\\par"), 4) == 0) { j -= 5; buf[j] = 0; } - + if (buf[j-1] == '}') buf[j-1] = 0; // Ignore final brace wxString actualFile = TexPathList.FindValidPath(fileName); currentFileName = actualFile; - if (actualFile == "") + if (actualFile.empty()) { wxString errBuf; - errBuf.Printf("Could not find file: %s",fileName); - OnError((char *)errBuf.c_str()); + errBuf.Printf(_T("Could not find file: %s"),fileName); + OnError((wxChar *)errBuf.c_str()); } else { wxString informStr; - informStr.Printf("Processing: %s",actualFile.c_str()); - OnInform((char *)informStr.c_str()); + informStr.Printf(_T("Processing: %s"),actualFile.c_str()); + OnInform((wxChar *)informStr.c_str()); CurrentInputIndex ++; - Inputs[CurrentInputIndex] = fopen(actualFile, "r"); + Inputs[CurrentInputIndex] = wxFopen(actualFile, _T("r")); LineNumbers[CurrentInputIndex] = 1; if (FileNames[CurrentInputIndex]) delete[] FileNames[CurrentInputIndex]; @@ -697,71 +714,71 @@ bool read_a_line(char *buf) if (!Inputs[CurrentInputIndex]) { CurrentInputIndex --; - OnError("Could not open verbatiminput file."); + OnError(_T("Could not open verbatiminput file.")); } else { - readingVerbatim = TRUE; - readInVerbatim = TRUE; - strcpy(buf, "\\begin{verbatim}\n"); - return FALSE; + readingVerbatim = true; + readInVerbatim = true; + wxStrcpy(buf, _T("\\begin{verbatim}\n")); + return false; } } - return FALSE; + return false; } - else if (strncmp(buf, "\\input", 6) == 0 || strncmp(buf, "\\helpinput", 10) == 0 || - strncmp(buf, "\\include", 8) == 0) + else if (wxStrncmp(buf, _T("\\input"), 6) == 0 || wxStrncmp(buf, _T("\\helpinput"), 10) == 0 || + wxStrncmp(buf, _T("\\include"), 8) == 0) { int wordLen; - if (strncmp(buf, "\\input", 6) == 0) + if (wxStrncmp(buf, _T("\\input"), 6) == 0) wordLen = 6; else - if (strncmp(buf, "\\include", 8) == 0) + if (wxStrncmp(buf, _T("\\include"), 8) == 0) wordLen = 8; else wordLen = 10; - char *fileName = buf + wordLen + 1; + wxChar *fileName = buf + wordLen + 1; int j = bufIndex - 1; buf[j] = 0; // \input{thing}\par -- eliminate the \par! -// if (strncmp((buf + strlen(buf)-5), "\\par", 4) == 0) - if (strncmp((buf + strlen(buf)-4), "\\par", 4) == 0) // Bug fix 8/2/95 Ulrich Leodolter +// if (wxStrncmp((buf + wxStrlen(buf)-5), "\\par", 4) == 0) + if (wxStrncmp((buf + wxStrlen(buf)-4), _T("\\par"), 4) == 0) // Bug fix 8/2/95 Ulrich Leodolter { // j -= 5; j -= 4; // Ditto buf[j] = 0; } - if (buf[j-1] == '}') + if (buf[j-1] == _T('}')) buf[j-1] = 0; // Ignore final brace // Remove backslashes from name wxString fileNameStr(fileName); - fileNameStr.Replace("\\", ""); + fileNameStr.Replace(_T("\\"), _T("")); // Ignore some types of input files (e.g. macro definition files) - char *fileOnly = FileNameFromPath((char*) (const char*) fileNameStr); + wxChar *fileOnly = wxFileNameFromPath((wxChar*) (const wxChar*) fileNameStr); currentFileName = fileOnly; if (IgnorableInputFiles.Member(fileOnly)) return read_a_line(buf); wxString actualFile = TexPathList.FindValidPath(fileNameStr); - if (actualFile == "") + if (actualFile.empty()) { - char buf2[400]; - sprintf(buf2, "%s.tex", (const char*) fileNameStr); + wxChar buf2[400]; + wxSnprintf(buf2, sizeof(buf2), _T("%s.tex"), fileNameStr.c_str()); actualFile = TexPathList.FindValidPath(buf2); } currentFileName = actualFile; - if (actualFile == "") + if (actualFile.empty()) { wxString errBuf; - errBuf.Printf("Could not find file: %s",fileName); - OnError((char *)errBuf.c_str()); + errBuf.Printf(_T("Could not find file: %s"),fileName); + OnError((wxChar *)errBuf.c_str()); } else { @@ -770,11 +787,11 @@ bool read_a_line(char *buf) TexPathList.EnsureFileAccessible(actualFile); wxString informStr; - informStr.Printf("Processing: %s",actualFile.c_str()); - OnInform((char *)informStr.c_str()); + informStr.Printf(_T("Processing: %s"),actualFile.c_str()); + OnInform((wxChar *)informStr.c_str()); CurrentInputIndex ++; - Inputs[CurrentInputIndex] = fopen(actualFile, "r"); + Inputs[CurrentInputIndex] = wxFopen(actualFile, _T("r")); LineNumbers[CurrentInputIndex] = 1; if (FileNames[CurrentInputIndex]) delete[] FileNames[CurrentInputIndex]; @@ -783,9 +800,9 @@ bool read_a_line(char *buf) if (!Inputs[CurrentInputIndex]) { wxString errBuf; - errBuf.Printf("Could not open include file %s", (const char*) actualFile); + errBuf.Printf(_T("Could not open include file %s"), (const wxChar*) actualFile); CurrentInputIndex --; - OnError((char *)errBuf.c_str()); + OnError((wxChar *)errBuf.c_str()); } } bool succ = read_a_line(buf); @@ -795,51 +812,50 @@ bool read_a_line(char *buf) if (checkSyntax) { wxString bufStr = buf; - int index = 0; - size_t pos = 0; - for (index=0; syntaxTokens[index] != wxEmptyString; index++) + for (int index=0; !syntaxTokens[index].empty(); index++) { - pos = bufStr.find(syntaxTokens[index]); + size_t pos = bufStr.find(syntaxTokens[index]); if (pos != wxString::npos && pos != 0) { - size_t commentStart = bufStr.find("%"); + size_t commentStart = bufStr.find(_T("%")); if (commentStart == wxString::npos || commentStart > pos) { wxString errBuf; - if (syntaxTokens[index] == "\\verb") + if (syntaxTokens[index] == _T("\\verb")) { - errBuf.Printf("'%s$....$' was detected at line %lu inside file %s. Please replace this form with \\tt{....}", + errBuf.Printf(_T("'%s$....$' was detected at line %lu inside file %s. Please replace this form with \\tt{....}"), syntaxTokens[index].c_str(), LineNumbers[CurrentInputIndex], currentFileName.c_str()); } else { - errBuf.Printf("'%s' was detected at line %lu inside file %s that is not the only text on the line, starting at column one.", + errBuf.Printf(_T("'%s' was detected at line %lu inside file %s that is not the only text on the line, starting at column one."), syntaxTokens[index].c_str(), LineNumbers[CurrentInputIndex], currentFileName.c_str()); } - OnError((char *)errBuf.c_str()); + OnError((wxChar *)errBuf.c_str()); } } } } // checkSyntax - if (strncmp(buf, "\\begin{verbatim}", 16) == 0 || - strncmp(buf, "\\begin{toocomplex}", 18) == 0) - readInVerbatim = TRUE; - else if (strncmp(buf, "\\end{verbatim}", 14) == 0 || - strncmp(buf, "\\end{toocomplex}", 16) == 0) - readInVerbatim = FALSE; + if (wxStrncmp(buf, _T("\\begin{verbatim}"), 16) == 0 || + wxStrncmp(buf, _T("\\begin{toocomplex}"), 18) == 0) + readInVerbatim = true; + else if (wxStrncmp(buf, _T("\\end{verbatim}"), 14) == 0 || + wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0) + readInVerbatim = false; - if (checkCurleyBraces) + if (checkCurlyBraces) { - if (ch == EOF && leftCurley != rightCurley) + if (ch == EOF && leftCurly != rightCurly) { wxString errBuf; - errBuf.Printf("Curley braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName.c_str(),leftCurley,rightCurley); - OnError((char *)errBuf.c_str()); + 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()); } } @@ -851,21 +867,21 @@ bool read_a_line(char *buf) * */ -bool ParseNewCommand(char *buffer, int *pos) +bool ParseNewCommand(wxChar *buffer, int *pos) { - if ((strncmp((buffer+(*pos)), "newcommand", 10) == 0) || - (strncmp((buffer+(*pos)), "renewcommand", 12) == 0)) + if ((wxStrncmp((buffer+(*pos)), _T("newcommand"), 10) == 0) || + (wxStrncmp((buffer+(*pos)), _T("renewcommand"), 12) == 0)) { - if (strncmp((buffer+(*pos)), "newcommand", 10) == 0) + if (wxStrncmp((buffer+(*pos)), _T("newcommand"), 10) == 0) *pos = *pos + 12; else *pos = *pos + 14; - char commandName[100]; - char commandValue[1000]; + wxChar commandName[100]; + wxChar commandValue[1000]; int noArgs = 0; int i = 0; - while (buffer[*pos] != '}' && (buffer[*pos] != 0)) + while (buffer[*pos] != _T('}') && (buffer[*pos] != 0)) { commandName[i] = buffer[*pos]; *pos += 1; @@ -874,29 +890,29 @@ bool ParseNewCommand(char *buffer, int *pos) commandName[i] = 0; i = 0; *pos += 1; - if (buffer[*pos] == '[') + if (buffer[*pos] == _T('[')) { *pos += 1; 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]; - if (ch == '{') + wxChar ch = buffer[*pos]; + if (ch == _T('{')) braceCount ++; - else if (ch == '}') + else if (ch == _T('}')) { braceCount --; if (braceCount == 0) - end = TRUE; + end = true; } else if (ch == 0) { - if (!read_a_line(buffer)) - end = TRUE; + end = !read_a_line(buffer); + wxUnusedVar(end); *pos = 0; break; } @@ -907,25 +923,25 @@ bool ParseNewCommand(char *buffer, int *pos) commandValue[i] = 0; CustomMacro *macro = new CustomMacro(commandName, noArgs, NULL); - if (strlen(commandValue) > 0) + if (wxStrlen(commandValue) > 0) macro->macroBody = copystring(commandValue); if (!CustomMacroList.Find(commandName)) { CustomMacroList.Append(commandName, macro); AddMacroDef(ltCUSTOM_MACRO, commandName, noArgs); } - return TRUE; + return true; } - else return FALSE; + else return false; } -void MacroError(char *buffer) +void MacroError(wxChar *buffer) { wxString errBuf; - char macroBuf[200]; + wxChar macroBuf[200]; macroBuf[0] = '\\'; int i = 1; - char ch; + wxChar ch; while (((ch = buffer[i-1]) != '\n') && (ch != 0)) { macroBuf[i] = ch; @@ -935,16 +951,14 @@ void MacroError(char *buffer) if (i > 20) macroBuf[20] = 0; - errBuf.Printf("Could not find macro: %s at line %d, file %s", + errBuf.Printf(_T("Could not find macro: %s at line %d, file %s"), macroBuf, (int)(LineNumbers[CurrentInputIndex]-1), FileNames[CurrentInputIndex]); - OnError((char *)errBuf.c_str()); + OnError((wxChar *)errBuf.c_str()); - if (wxStrcmp(macroBuf,"\\end{document}") == 0) + if (wxStrcmp(macroBuf,_T("\\end{document}")) == 0) { - wxString buf; - buf = "Halted build due to unrecoverable error."; - OnInform((char *)buf.c_str()); - stopRunning = TRUE; + OnInform( _T("Halted build due to unrecoverable error.") ); + stopRunning = true; } } @@ -952,16 +966,16 @@ void MacroError(char *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 * */ -int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *environment, bool parseToBrace, TexChunk *customMacroArgs) +int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxChar *environment, bool parseToBrace, TexChunk *customMacroArgs) { Tex2RTFYield(); if (stopRunning) return pos; - - bool eof = FALSE; + + bool eof = false; BigBuffer[0] = 0; int buf_ptr = 0; int len; @@ -980,17 +994,17 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e 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) @@ -999,7 +1013,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e 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]; @@ -1008,7 +1022,6 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e { TexChunk *chunk = new TexChunk(CHUNK_TYPE_STRING); BigBuffer[buf_ptr] = 0; - buf_ptr = 0; chunk->value = copystring(BigBuffer); children.Append((wxObject *)chunk); } @@ -1017,26 +1030,24 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e while (!eof) { - len = strlen(buffer); + len = wxStrlen(buffer); if (pos >= len) { if (customMacroArgs) return 0; eof = read_a_line(buffer); pos = 0; - len = strlen(buffer); // Check for verbatim (or toocomplex, which comes to the same thing) wxString bufStr = buffer; // if (bufStr.find("\\begin{verbatim}") != wxString::npos || // bufStr.find("\\begin{toocomplex}") != wxString::npos) - if (strncmp(buffer, "\\begin{verbatim}", 16) == 0 || - strncmp(buffer, "\\begin{toocomplex}", 18) == 0) + if (wxStrncmp(buffer, _T("\\begin{verbatim}"), 16) == 0 || + wxStrncmp(buffer, _T("\\begin{toocomplex}"), 18) == 0) { if (buf_ptr > 0) { TexChunk *chunk = new TexChunk(CHUNK_TYPE_STRING); BigBuffer[buf_ptr] = 0; - buf_ptr = 0; chunk->value = copystring(BigBuffer); children.Append((wxObject *)chunk); } @@ -1044,12 +1055,12 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e buf_ptr = 0; eof = read_a_line(buffer); - while (!eof && (strncmp(buffer, "\\end{verbatim}", 14) != 0) && - (strncmp(buffer, "\\end{toocomplex}", 16) != 0) + while (!eof && (wxStrncmp(buffer, _T("\\end{verbatim}"), 14) != 0) && + (wxStrncmp(buffer, _T("\\end{toocomplex}"), 16) != 0) ) { - strcat(BigBuffer, buffer); - buf_ptr += strlen(buffer); + wxStrcat(BigBuffer, buffer); + buf_ptr += wxStrlen(buffer); eof = read_a_line(buffer); } eof = read_a_line(buffer); @@ -1072,7 +1083,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e // after a verbatim): EXCEPT in HTML if (convertMode != TEX_HTML) { - TexMacroDef *parDef = (TexMacroDef *)MacroDefs.Get("\\"); + TexMacroDef *parDef = (TexMacroDef *)MacroDefs.Get(_T("\\")); TexChunk *parChunk = new TexChunk(CHUNK_TYPE_MACRO, parDef); parChunk->no_args = 0; parChunk->macroId = ltBACKSLASHCHAR; @@ -1081,29 +1092,27 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e } } - 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) { TexChunk *chunk = new TexChunk(CHUNK_TYPE_STRING); BigBuffer[buf_ptr] = 0; - buf_ptr = 0; chunk->value = copystring(BigBuffer); children.Append((wxObject *)chunk); } - if (ch == '}') pos ++; + if (wxCh == _T('}')) pos ++; return pos; - break; } - case '\\': + case _T('\\'): { if (buf_ptr > 0) // Finish off the string we've read so far { @@ -1114,7 +1123,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e children.Append((wxObject *)chunk); } pos ++; - + // Try matching \end{environment} if (environment && FindEndEnvironment(buffer, &pos, environment)) { @@ -1131,7 +1140,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e if (ParseNewCommand(buffer, &pos)) break; - if (strncmp(buffer+pos, "special", 7) == 0) + if (wxStrncmp(buffer+pos, _T("special"), 7) == 0) { pos += 7; @@ -1139,58 +1148,58 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e pos ++; int noBraces = 1; - wxBuffer[0] = 0; + 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) { - wxBuffer[i] = 0; - end = TRUE; + wxTex2RTFBuffer[i] = 0; + end = true; } else { - wxBuffer[i] = '}'; + wxTex2RTFBuffer[i] = _T('}'); i ++; } pos ++; } - else if (ch == '{') + else if (ch == _T('{')) { - wxBuffer[i] = '{'; + wxTex2RTFBuffer[i] = _T('{'); i ++; pos ++; } - else if (ch == '\\' && buffer[pos+1] == '}') + else if (ch == _T('\\') && buffer[pos+1] == _T('}')) { - wxBuffer[i] = '}'; + wxTex2RTFBuffer[i] = _T('}'); pos += 2; i++; } - else if (ch == '\\' && buffer[pos+1] == '{') + else if (ch == _T('\\') && buffer[pos+1] == _T('{')) { - wxBuffer[i] = '{'; + wxTex2RTFBuffer[i] = _T('{'); pos += 2; i++; } else { - wxBuffer[i] = ch; + wxTex2RTFBuffer[i] = ch; pos ++; i ++; if (ch == 0) - end = TRUE; + end = true; } } TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); chunk->no_args = 1; chunk->macroId = ltSPECIAL; - TexMacroDef *specialDef = (TexMacroDef *)MacroDefs.Get("special"); + TexMacroDef *specialDef = (TexMacroDef *)MacroDefs.Get(_T("special")); chunk->def = specialDef; TexChunk *arg = new TexChunk(CHUNK_TYPE_ARG, specialDef); chunk->children.Append((wxObject *)arg); @@ -1201,24 +1210,24 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e TexChunk *argValue = new TexChunk(CHUNK_TYPE_STRING); arg->children.Append((wxObject *)argValue); argValue->argn = 1; - argValue->value = copystring(wxBuffer); + argValue->value = copystring(wxTex2RTFBuffer); children.Append((wxObject *)chunk); } - else if (strncmp(buffer+pos, "verb", 4) == 0) + else if (wxStrncmp(buffer+pos, _T("verb"), 4) == 0) { pos += 4; - if (buffer[pos] == '*') + if (buffer[pos] == _T('*')) pos ++; - // Find the delimiter character - int ch = buffer[pos]; + // Find the delimiter character + wxChar ch = buffer[pos]; pos ++; // Now at start of verbatim text int j = pos; while ((buffer[pos] != ch) && buffer[pos] != 0) pos ++; - char *val = new char[pos - j + 1]; + wxChar *val = new wxChar[pos - j + 1]; int i; for (i = j; i < pos; i++) { @@ -1231,7 +1240,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); chunk->no_args = 1; chunk->macroId = ltVERB; - TexMacroDef *verbDef = (TexMacroDef *)MacroDefs.Get("verb"); + TexMacroDef *verbDef = (TexMacroDef *)MacroDefs.Get(_T("verb")); chunk->def = verbDef; TexChunk *arg = new TexChunk(CHUNK_TYPE_ARG, verbDef); chunk->children.Append((wxObject *)arg); @@ -1246,10 +1255,10 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e children.Append((wxObject *)chunk); } - else - { - char *env = NULL; - bool tmpParseToBrace = TRUE; + else + { + wxChar *env = NULL; + bool tmpParseToBrace = true; TexMacroDef *def = MatchMacro(buffer, &pos, &env, &tmpParseToBrace); if (def) { @@ -1265,29 +1274,33 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e children.Append((wxObject *)chunk); // Eliminate newline after a \begin{} or a \\ if possible - if (env || strcmp(def->name, "\\") == 0) - if (buffer[pos] == 13) - { + if ((env || wxStrcmp(def->name, _T("\\")) == 0) && (buffer[pos] == 13)) + { pos ++; if (buffer[pos] == 10) pos ++; - } + } - pos = ParseMacroBody(def->name, chunk, chunk->no_args, - buffer, pos, env, tmpParseToBrace, customMacroArgs); + pos = ParseMacroBody(def->name, + chunk, chunk->no_args, + buffer, + pos, + env, + tmpParseToBrace, + customMacroArgs); // If custom macro, parse the body substituting the above found args. if (customMacro) { if (customMacro->macroBody) { - char macroBuf[300]; -// strcpy(macroBuf, "{"); - strcpy(macroBuf, customMacro->macroBody); - strcat(macroBuf, "}"); - ParseArg(thisArg, children, macroBuf, 0, NULL, TRUE, chunk); + wxChar macroBuf[300]; +// wxStrcpy(macroBuf, _T("{")); + wxStrcpy(macroBuf, customMacro->macroBody); + wxStrcat(macroBuf, _T("}")); + ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk); } - + // delete chunk; // Might delete children } } @@ -1300,10 +1313,10 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e } // 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) { @@ -1315,7 +1328,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e } pos ++; - char *env; + wxChar *env; bool tmpParseToBrace; TexMacroDef *def = MatchMacro(buffer, &pos, &env, &tmpParseToBrace); if (def) @@ -1330,20 +1343,20 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e 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) { if (customMacro->macroBody) { - char macroBuf[300]; -// strcpy(macroBuf, "{"); - strcpy(macroBuf, customMacro->macroBody); - strcat(macroBuf, "}"); - ParseArg(thisArg, children, macroBuf, 0, NULL, TRUE, chunk); + wxChar macroBuf[300]; +// wxStrcpy(macroBuf, _T("{")); + wxStrcpy(macroBuf, customMacro->macroBody); + wxStrcat(macroBuf, _T("}")); + ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk); } - + // delete chunk; // Might delete children } } @@ -1353,7 +1366,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e } } else - { + { /* * If all else fails, we assume that we have * a pair of braces on their own, so return a `dummy' macro @@ -1361,7 +1374,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e */ if (!SoloBlockDef) { - SoloBlockDef = new TexMacroDef(ltSOLO_BLOCK, "solo block", 1, FALSE); + SoloBlockDef = new TexMacroDef(ltSOLO_BLOCK, _T("solo block"), 1, false); } // Save text so far if (buf_ptr > 0) @@ -1385,11 +1398,11 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e 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) { @@ -1402,11 +1415,11 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e pos ++; - if (buffer[pos] == '$') + if (buffer[pos] == _T('$')) { TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); chunk->no_args = 0; -// chunk->name = copystring("$$"); +// chunk->name = copystring(_T("$$")); chunk->macroId = ltSPECIALDOUBLEDOLLAR; children.Append((wxObject *)chunk); pos ++; @@ -1415,13 +1428,13 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e { TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); chunk->no_args = 0; -// chunk->name = copystring("_$"); +// chunk->name = copystring(_T("_$")); chunk->macroId = ltSPECIALDOLLAR; children.Append((wxObject *)chunk); } break; } - case '~': + case _T('~'): { if (buf_ptr > 0) { @@ -1435,12 +1448,12 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e pos ++; TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); chunk->no_args = 0; -// chunk->name = copystring("_~"); +// chunk->name = copystring(_T("_~")); chunk->macroId = ltSPECIALTILDE; 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) { @@ -1456,7 +1469,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e { TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); chunk->no_args = 0; -// chunk->name = copystring("_#"); +// chunk->name = copystring(_T("_#")); chunk->macroId = ltSPECIALHASH; children.Append((wxObject *)chunk); } @@ -1466,22 +1479,22 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e { int n = buffer[pos] - 48; pos ++; - wxNode *node = customMacroArgs->children.Nth(n-1); + wxNode *node = customMacroArgs->children.Item(n-1); if (node) { - TexChunk *argChunk = (TexChunk *)node->Data(); + TexChunk *argChunk = (TexChunk *)node->GetData(); children.Append((wxObject *)new TexChunk(*argChunk)); } } } 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) @@ -1495,24 +1508,24 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e pos ++; - while (buffer[pos] == ' ' || buffer[pos] == 9) + while (buffer[pos] == _T(' ') || buffer[pos] == 9) pos ++; TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO); chunk->no_args = 0; -// chunk->name = copystring("_&"); +// chunk->name = copystring(_T("_&")); chunk->macroId = ltSPECIALAMPERSAND; children.Append((wxObject *)chunk); 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) { @@ -1524,7 +1537,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e // Eliminate tab case 9: { - BigBuffer[buf_ptr] = ' '; + BigBuffer[buf_ptr] = _T(' '); BigBuffer[buf_ptr+1] = 0; buf_ptr ++; pos ++; @@ -1532,7 +1545,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e } default: { - BigBuffer[buf_ptr] = ch; + BigBuffer[buf_ptr] = wxCh; BigBuffer[buf_ptr+1] = 0; buf_ptr ++; pos ++; @@ -1547,10 +1560,10 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e * Consume as many arguments as the macro definition specifies * */ - -int ParseMacroBody(char *macro_name, TexChunk *parent, - int no_args, char *buffer, int pos, - char *environment, bool parseToBrace, + +int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent, + int no_args, wxChar *buffer, int pos, + wxChar *environment, bool parseToBrace, TexChunk *customMacroArgs) { Tex2RTFYield(); @@ -1585,13 +1598,13 @@ int ParseMacroBody(char *macro_name, TexChunk *parent, // To parse the first arg of a 2 arg \begin{thing}{arg} ... \end{thing} // have to fool parser into thinking this is a regular kind of block. - char *actualEnv; + wxChar *actualEnv; if ((no_args == 2) && (i == 0)) actualEnv = NULL; 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); @@ -1605,12 +1618,12 @@ int ParseMacroBody(char *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) @@ -1619,11 +1632,11 @@ int ParseMacroBody(char *macro_name, TexChunk *parent, wxString tmpBuffer(buffer); if (tmpBuffer.length() > 4) { - if (tmpBuffer.Right(4) == "\\par") + if (tmpBuffer.Right(4) == _T("\\par")) tmpBuffer = tmpBuffer.Mid(0,tmpBuffer.length()-4); } - errBuf.Printf("Missing macro argument in the line:\n\t%s\n",tmpBuffer.c_str()); - OnError((char *)errBuf.c_str()); + errBuf.Printf(_T("Missing macro argument in the line:\n\t%s\n"),tmpBuffer.c_str()); + OnError((wxChar *)errBuf.c_str()); } } @@ -1643,47 +1656,47 @@ int ParseMacroBody(char *macro_name, TexChunk *parent, parent->no_args = maxArgs; // Tell each argument how many args there are (useful when processing an arg) - wxNode *node = parent->children.First(); + wxNode *node = parent->children.GetFirst(); while (node) { - TexChunk *chunk = (TexChunk *)node->Data(); + TexChunk *chunk = (TexChunk *)node->GetData(); chunk->no_args = maxArgs; - node = node->Next(); + node = node->GetNext(); } return pos; } -bool TexLoadFile(char *filename) +bool TexLoadFile(const wxString& filename) { - static char *line_buffer; - stopRunning = FALSE; - strcpy(TexFileRoot, filename); - StripExtension(TexFileRoot); - sprintf(TexBibName, "%s.bb", TexFileRoot); - sprintf(TexTmpBibName, "%s.bb1", TexFileRoot); - - TexPathList.EnsureFileAccessible(filename); - - if (line_buffer) - delete line_buffer; - - line_buffer = new char[MAX_LINE_BUFFER_SIZE]; - - Inputs[0] = fopen(filename, "r"); - LineNumbers[0] = 1; - FileNames[0] = copystring(filename); - if (Inputs[0]) - { - read_a_line(line_buffer); - ParseMacroBody("toplevel", TopLevel, 1, line_buffer, 0, NULL, TRUE); - if (Inputs[0]) fclose(Inputs[0]); - return TRUE; - } + 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); + + if (line_buffer) + delete line_buffer; + + line_buffer = new wxChar[MAX_LINE_BUFFER_SIZE]; - return FALSE; + 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; } -TexMacroDef::TexMacroDef(int the_id, char *the_name, int n, bool ig, bool forbidLevel) +TexMacroDef::TexMacroDef(int the_id, const wxChar *the_name, int n, bool ig, bool forbidLevel) { name = copystring(the_name); no_args = n; @@ -1706,7 +1719,7 @@ TexChunk::TexChunk(int the_type, TexMacroDef *the_def) def = the_def; macroId = 0; value = NULL; - optional = FALSE; + optional = false; } TexChunk::TexChunk(TexChunk& toCopy) @@ -1715,7 +1728,7 @@ TexChunk::TexChunk(TexChunk& toCopy) no_args = toCopy.no_args; argn = toCopy.argn; macroId = toCopy.macroId; - + // if (toCopy.name) // name = copystring(toCopy.name); // else @@ -1726,14 +1739,14 @@ TexChunk::TexChunk(TexChunk& toCopy) value = copystring(toCopy.value); else value = NULL; - + optional = toCopy.optional; - wxNode *node = toCopy.children.First(); + wxNode *node = toCopy.children.GetFirst(); while (node) { - TexChunk *child = (TexChunk *)node->Data(); + TexChunk *child = (TexChunk *)node->GetData(); children.Append((wxObject *)new TexChunk(*child)); - node = node->Next(); + node = node->GetNext(); } } @@ -1741,12 +1754,12 @@ TexChunk::~TexChunk(void) { // if (name) delete[] name; if (value) delete[] value; - wxNode *node = children.First(); + wxNode *node = children.GetFirst(); while (node) { - TexChunk *child = (TexChunk *)node->Data(); + TexChunk *child = (TexChunk *)node->GetData(); delete child; - wxNode *next = node->Next(); + wxNode *next = node->GetNext(); delete node; node = next; } @@ -1766,7 +1779,7 @@ int GetNoArgs(void) // Number of args for this macro * only!) * */ - + void GetArgData1(TexChunk *chunk) { switch (chunk->type) @@ -1777,52 +1790,52 @@ void GetArgData1(TexChunk *chunk) if (def && def->ignore) return; - if (def && (strcmp(def->name, "solo block") != 0)) + if (def && (wxStrcmp(def->name, _T("solo block")) != 0)) { - strcat(currentArgData, "\\"); - strcat(currentArgData, def->name); + wxStrcat(currentArgData, _T("\\")); + wxStrcat(currentArgData, def->name); } - wxNode *node = chunk->children.First(); + wxNode *node = chunk->children.GetFirst(); while (node) { - TexChunk *child_chunk = (TexChunk *)node->Data(); - strcat(currentArgData, "{"); + TexChunk *child_chunk = (TexChunk *)node->GetData(); + wxStrcat(currentArgData, _T("{")); GetArgData1(child_chunk); - strcat(currentArgData, "}"); - node = node->Next(); + wxStrcat(currentArgData, _T("}")); + node = node->GetNext(); } break; } case CHUNK_TYPE_ARG: { - wxNode *node = chunk->children.First(); + wxNode *node = chunk->children.GetFirst(); while (node) { - TexChunk *child_chunk = (TexChunk *)node->Data(); + TexChunk *child_chunk = (TexChunk *)node->GetData(); GetArgData1(child_chunk); - node = node->Next(); + node = node->GetNext(); } break; } case CHUNK_TYPE_STRING: { if (chunk->value) - strcat(currentArgData, chunk->value); + wxStrcat(currentArgData, chunk->value); break; } } } -char *GetArgData(TexChunk *chunk) +wxChar *GetArgData(TexChunk *WXUNUSED(chunk)) { currentArgData[0] = 0; GetArgData1(currentArgument); - haveArgData = FALSE; + haveArgData = false; return currentArgData; } -char *GetArgData(void) +wxChar *GetArgData(void) { if (!haveArgData) { @@ -1872,22 +1885,21 @@ 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.First(); - TexChunk *child_chunk = NULL; + wxNode *node = chunk->children.GetFirst(); while (node) { - child_chunk = (TexChunk *)node->Data(); + TexChunk *child_chunk = (TexChunk *)node->GetData(); TraverseFromChunk(child_chunk, node); - node = node->Next(); + node = node->GetNext(); } - if (thisNode && thisNode->Next()) - nextChunk = (TexChunk *)thisNode->Next()->Data(); + if (thisNode && thisNode->GetNext()) + 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: @@ -1897,29 +1909,29 @@ 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.First(); + wxNode *node = chunk->children.GetFirst(); while (node) { - TexChunk *child_chunk = (TexChunk *)node->Data(); + TexChunk *child_chunk = (TexChunk *)node->GetData(); TraverseFromChunk(child_chunk, node); - node = node->Next(); + node = node->GetNext(); } } currentArgument = chunk; - if (thisNode && thisNode->Next()) - nextChunk = (TexChunk *)thisNode->Next()->Data(); + if (thisNode && thisNode->GetNext()) + nextChunk = (TexChunk *)thisNode->GetNext()->GetData(); isArgOptional = chunk->optional; 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: @@ -1932,9 +1944,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; } @@ -1958,7 +1970,7 @@ void SetCurrentOutputs(FILE *fd1, FILE *fd2) CurrentOutput2 = fd2; } -void AddMacroDef(int the_id, char *name, int n, bool ignore, bool forbid) +void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore, bool forbid) { MacroDefs.Put(name, new TexMacroDef(the_id, name, n, ignore, forbid)); } @@ -1967,10 +1979,10 @@ void TexInitialize(int bufSize) { InitialiseColourTable(); #ifdef __WXMSW__ - TexPathList.AddEnvList("TEXINPUT"); + TexPathList.AddEnvList(_T("TEXINPUT")); #endif #ifdef __UNIX__ - TexPathList.AddEnvList("TEXINPUTS"); + TexPathList.AddEnvList(_T("TEXINPUTS")); #endif int i; for (i = 0; i < 15; i++) @@ -1980,18 +1992,18 @@ void TexInitialize(int bufSize) FileNames[i] = NULL; } - IgnorableInputFiles.Add("psbox.tex"); - BigBuffer = new char[(bufSize*1000)]; - currentArgData = new char[2000]; - TexFileRoot = new char[300]; - TexBibName = new char[300]; - TexTmpBibName = new char[300]; - AddMacroDef(ltTOPLEVEL, "toplevel", 1); + IgnorableInputFiles.Add(_T("psbox.tex")); + BigBuffer = new wxChar[(bufSize*1000)]; + currentArgData = new wxChar[2000]; + TexFileRoot = new wxChar[300]; + TexBibName = new wxChar[300]; + TexTmpBibName = new wxChar[300]; + AddMacroDef(ltTOPLEVEL, _T("toplevel"), 1); TopLevel = new TexChunk(CHUNK_TYPE_MACRO); -// TopLevel->name = copystring("toplevel"); +// TopLevel->name = copystring(_T("toplevel")); TopLevel->macroId = ltTOPLEVEL; TopLevel->no_args = 1; - VerbatimMacroDef = (TexMacroDef *)MacroDefs.Get("verbatim"); + VerbatimMacroDef = (TexMacroDef *)MacroDefs.Get(_T("verbatim")); } void TexCleanUp(void) @@ -2009,13 +2021,13 @@ void TexCleanUp(void) CurrentOutput1 = NULL; CurrentOutput2 = NULL; CurrentInputIndex = 0; - haveArgData = FALSE; + haveArgData = false; noArgs = 0; if (TopLevel) delete TopLevel; TopLevel = new TexChunk(CHUNK_TYPE_MACRO); -// TopLevel->name = copystring("toplevel"); +// TopLevel->name = copystring(_T("toplevel")); TopLevel->macroId = ltTOPLEVEL; TopLevel->no_args = 1; @@ -2024,8 +2036,8 @@ void TexCleanUp(void) DocumentDate = NULL; DocumentStyle = LATEX_REPORT; MinorDocumentStyle = 0; - BibliographyStyleString = copystring("plain"); - DocumentStyleString = copystring("report"); + BibliographyStyleString = copystring(_T("plain")); + DocumentStyleString = copystring(_T("report")); MinorDocumentStyleString = NULL; // gt - Changed this so if this is the final pass @@ -2038,33 +2050,33 @@ void TexCleanUp(void) { /* Don't want to remove custom macros after each pass.*/ SetFontSizes(10); - wxNode *node = CustomMacroList.First(); + wxNode *node = CustomMacroList.GetFirst(); while (node) { - CustomMacro *macro = (CustomMacro *)node->Data(); + CustomMacro *macro = (CustomMacro *)node->GetData(); delete macro; delete node; - node = CustomMacroList.First(); + node = CustomMacroList.GetFirst(); } } /**/ TexReferences.BeginFind(); - wxNode *node = TexReferences.Next(); - while (node) + wxHashTable::Node *refNode = TexReferences.Next(); + while (refNode) { - TexRef *ref = (TexRef *)node->Data(); + TexRef *ref = (TexRef *)refNode->GetData(); delete ref; - node = TexReferences.Next(); + refNode = TexReferences.Next(); } TexReferences.Clear(); - - node = BibList.First(); - while (node) + + wxNode* bibNode = BibList.GetFirst(); + while (bibNode) { - BibEntry *entry = (BibEntry *)node->Data(); + BibEntry *entry = (BibEntry *)bibNode->GetData(); delete entry; - delete node; - node = BibList.First(); + delete bibNode; + bibNode = BibList.GetFirst(); } CitationList.Clear(); ResetTopicCounter(); @@ -2076,491 +2088,492 @@ void DefineDefaultMacros(void) // Put names which subsume other names at the TOP // so they get recognized first - AddMacroDef(ltACCENT_GRAVE, "`", 1); - AddMacroDef(ltACCENT_ACUTE, "'", 1); - AddMacroDef(ltACCENT_CARET, "^", 1); - AddMacroDef(ltACCENT_UMLAUT, "\"", 1); - AddMacroDef(ltACCENT_TILDE, "~", 1); - AddMacroDef(ltACCENT_DOT, ".", 1); - AddMacroDef(ltACCENT_CADILLA, "c", 1); - AddMacroDef(ltSMALLSPACE1, ",", 0); - AddMacroDef(ltSMALLSPACE2, ";", 0); - - AddMacroDef(ltABSTRACT, "abstract", 1); - AddMacroDef(ltADDCONTENTSLINE, "addcontentsline", 3); - AddMacroDef(ltADDTOCOUNTER, "addtocounter", 2); - AddMacroDef(ltALEPH, "aleph", 0); - AddMacroDef(ltALPHA, "alpha", 0); - AddMacroDef(ltALPH1, "alph", 1); - AddMacroDef(ltALPH2, "Alph", 1); - AddMacroDef(ltANGLE, "angle", 0); - AddMacroDef(ltAPPENDIX, "appendix", 0); - AddMacroDef(ltAPPROX, "approx", 0); - AddMacroDef(ltARABIC, "arabic", 1); - AddMacroDef(ltARRAY, "array", 1); - AddMacroDef(ltAST, "ast", 0); - AddMacroDef(ltASYMP, "asymp", 0); - AddMacroDef(ltAUTHOR, "author", 1); - - AddMacroDef(ltBACKGROUNDCOLOUR, "backgroundcolour", 1); - AddMacroDef(ltBACKGROUNDIMAGE, "backgroundimage", 1); - AddMacroDef(ltBACKGROUND, "background", 1); - AddMacroDef(ltBACKSLASHRAW, "backslashraw", 0); - AddMacroDef(ltBACKSLASH, "backslash", 0); - AddMacroDef(ltBASELINESKIP, "baselineskip", 1); - AddMacroDef(ltBCOL, "bcol", 2); - AddMacroDef(ltBETA, "beta", 0); - AddMacroDef(ltBFSERIES, "bfseries", 1); - AddMacroDef(ltBF, "bf", 1); - AddMacroDef(ltBIBITEM, "bibitem", 2); // For convenience, bibitem has 2 args: label and item. + AddMacroDef(ltACCENT_GRAVE, _T("`"), 1); + AddMacroDef(ltACCENT_ACUTE, _T("'"), 1); + AddMacroDef(ltACCENT_CARET, _T("^"), 1); + AddMacroDef(ltACCENT_UMLAUT, _T("\""), 1); + AddMacroDef(ltACCENT_TILDE, _T("~"), 1); + AddMacroDef(ltACCENT_DOT, _T("."), 1); + AddMacroDef(ltACCENT_CADILLA, _T("c"), 1); + AddMacroDef(ltSMALLSPACE1, _T(","), 0); + AddMacroDef(ltSMALLSPACE2, _T(";"), 0); + + AddMacroDef(ltABSTRACT, _T("abstract"), 1); + AddMacroDef(ltADDCONTENTSLINE, _T("addcontentsline"), 3); + AddMacroDef(ltADDTOCOUNTER, _T("addtocounter"), 2); + AddMacroDef(ltALEPH, _T("aleph"), 0); + AddMacroDef(ltALPHA, _T("alpha"), 0); + AddMacroDef(ltALPH1, _T("alph"), 1); + AddMacroDef(ltALPH2, _T("Alph"), 1); + AddMacroDef(ltANGLE, _T("angle"), 0); + AddMacroDef(ltAPPENDIX, _T("appendix"), 0); + AddMacroDef(ltAPPROX, _T("approx"), 0); + AddMacroDef(ltARABIC, _T("arabic"), 1); + AddMacroDef(ltARRAY, _T("array"), 1); + AddMacroDef(ltAST, _T("ast"), 0); + AddMacroDef(ltASYMP, _T("asymp"), 0); + AddMacroDef(ltAUTHOR, _T("author"), 1); + + AddMacroDef(ltBACKGROUNDCOLOUR, _T("backgroundcolour"), 1); + AddMacroDef(ltBACKGROUNDIMAGE, _T("backgroundimage"), 1); + AddMacroDef(ltBACKGROUND, _T("background"), 1); + AddMacroDef(ltBACKSLASHRAW, _T("backslashraw"), 0); + AddMacroDef(ltBACKSLASH, _T("backslash"), 0); + AddMacroDef(ltBASELINESKIP, _T("baselineskip"), 1); + AddMacroDef(ltBCOL, _T("bcol"), 2); + AddMacroDef(ltBETA, _T("beta"), 0); + AddMacroDef(ltBFSERIES, _T("bfseries"), 1); + AddMacroDef(ltBF, _T("bf"), 1); + AddMacroDef(ltBIBITEM, _T("bibitem"), 2); + // For convenience, bibitem has 2 args: label and item. // The Latex syntax permits writing as 2 args. - AddMacroDef(ltBIBLIOGRAPHYSTYLE, "bibliographystyle", 1); - AddMacroDef(ltBIBLIOGRAPHY, "bibliography", 1); - AddMacroDef(ltBIGTRIANGLEDOWN, "bigtriangledown", 0); - AddMacroDef(ltBOT, "bot", 0); - AddMacroDef(ltBOXIT, "boxit", 1); - AddMacroDef(ltBOX, "box", 0); - AddMacroDef(ltBRCLEAR, "brclear", 0); - AddMacroDef(ltBULLET, "bullet", 0); - - AddMacroDef(ltCAPTIONSTAR, "caption*", 1); - AddMacroDef(ltCAPTION, "caption", 1); - AddMacroDef(ltCAP, "cap", 0); - AddMacroDef(ltCDOTS, "cdots", 0); - AddMacroDef(ltCDOT, "cdot", 0); - AddMacroDef(ltCENTERLINE, "centerline", 1); - AddMacroDef(ltCENTERING, "centering", 0); - AddMacroDef(ltCENTER, "center", 1); - AddMacroDef(ltCEXTRACT, "cextract", 0); - AddMacroDef(ltCHAPTERHEADING, "chapterheading", 1); - AddMacroDef(ltCHAPTERSTAR, "chapter*", 1); - AddMacroDef(ltCHAPTER, "chapter", 1); - AddMacroDef(ltCHI, "chi", 0); - AddMacroDef(ltCINSERT, "cinsert", 0); - AddMacroDef(ltCIRC, "circ", 0); - AddMacroDef(ltCITE, "cite", 1); - AddMacroDef(ltCLASS, "class", 1); - AddMacroDef(ltCLEARDOUBLEPAGE, "cleardoublepage", 0); - AddMacroDef(ltCLEARPAGE, "clearpage", 0); - AddMacroDef(ltCLINE, "cline", 1); - AddMacroDef(ltCLIPSFUNC, "clipsfunc", 3); - AddMacroDef(ltCLUBSUIT, "clubsuit", 0); - AddMacroDef(ltCOLUMNSEP, "columnsep", 1); - AddMacroDef(ltCOMMENT, "comment", 1, TRUE); - AddMacroDef(ltCONG, "cong", 0); - AddMacroDef(ltCOPYRIGHT, "copyright", 0); - AddMacroDef(ltCPARAM, "cparam", 2); - AddMacroDef(ltCHEAD, "chead", 1); - AddMacroDef(ltCFOOT, "cfoot", 1); - AddMacroDef(ltCUP, "cup", 0); - - AddMacroDef(ltDASHV, "dashv", 0); - AddMacroDef(ltDATE, "date", 1); - AddMacroDef(ltDELTA, "delta", 0); - AddMacroDef(ltCAP_DELTA, "Delta", 0); - AddMacroDef(ltDEFINECOLOUR, "definecolour", 4); - AddMacroDef(ltDEFINECOLOR, "definecolor", 4); - AddMacroDef(ltDESCRIPTION, "description", 1); - AddMacroDef(ltDESTRUCT, "destruct", 1); - AddMacroDef(ltDIAMOND2, "diamond2", 0); - AddMacroDef(ltDIAMOND, "diamond", 0); - AddMacroDef(ltDIV, "div", 0); - AddMacroDef(ltDOCUMENTCLASS, "documentclass", 1); - AddMacroDef(ltDOCUMENTSTYLE, "documentstyle", 1); - AddMacroDef(ltDOCUMENT, "document", 1); - AddMacroDef(ltDOUBLESPACE, "doublespace", 1); - AddMacroDef(ltDOTEQ, "doteq", 0); - AddMacroDef(ltDOWNARROW, "downarrow", 0); - AddMacroDef(ltDOWNARROW2, "Downarrow", 0); - - AddMacroDef(ltEMPTYSET, "emptyset", 0); - AddMacroDef(ltEMPH, "emph", 1); - AddMacroDef(ltEM, "em", 1); - AddMacroDef(ltENUMERATE, "enumerate", 1); - AddMacroDef(ltEPSILON, "epsilon", 0); - AddMacroDef(ltEQUATION, "equation", 1); - AddMacroDef(ltEQUIV, "equiv", 0); - AddMacroDef(ltETA, "eta", 0); - AddMacroDef(ltEVENSIDEMARGIN, "evensidemargin", 1); - AddMacroDef(ltEXISTS, "exists", 0); - - AddMacroDef(ltFBOX, "fbox", 1); - AddMacroDef(ltFCOL, "fcol", 2); - AddMacroDef(ltFIGURE, "figure", 1); - AddMacroDef(ltFIGURESTAR, "figure*", 1); - AddMacroDef(ltFLUSHLEFT, "flushleft", 1); - AddMacroDef(ltFLUSHRIGHT, "flushright", 1); - AddMacroDef(ltFOLLOWEDLINKCOLOUR, "followedlinkcolour", 1); - AddMacroDef(ltFOOTHEIGHT, "footheight", 1); - AddMacroDef(ltFOOTNOTEPOPUP, "footnotepopup", 2); - AddMacroDef(ltFOOTNOTE, "footnote", 1); - AddMacroDef(ltFOOTSKIP, "footskip", 1); - AddMacroDef(ltFORALL, "forall", 0); - AddMacroDef(ltFRAMEBOX, "framebox", 1); - AddMacroDef(ltFROWN, "frown", 0); - AddMacroDef(ltFUNCTIONSECTION, "functionsection", 1); - AddMacroDef(ltFUNC, "func", 3); - AddMacroDef(ltFOOTNOTESIZE, "footnotesize", 0); - AddMacroDef(ltFANCYPLAIN, "fancyplain", 2); - - AddMacroDef(ltGAMMA, "gamma", 0); - AddMacroDef(ltCAP_GAMMA, "Gamma", 0); - AddMacroDef(ltGEQ, "geq", 0); - AddMacroDef(ltGE, "ge", 0); - AddMacroDef(ltGG, "gg", 0); - AddMacroDef(ltGLOSSARY, "glossary", 1); - AddMacroDef(ltGLOSS, "gloss", 1); - - AddMacroDef(ltHEADHEIGHT, "headheight", 1); - AddMacroDef(ltHEARTSUIT, "heartsuit", 0); - AddMacroDef(ltHELPGLOSSARY, "helpglossary", 1); - AddMacroDef(ltHELPIGNORE, "helpignore", 1, TRUE); - AddMacroDef(ltHELPONLY, "helponly", 1); - AddMacroDef(ltHELPINPUT, "helpinput", 1); - AddMacroDef(ltHELPFONTFAMILY, "helpfontfamily", 1); - AddMacroDef(ltHELPFONTSIZE, "helpfontsize", 1); - AddMacroDef(ltHELPREFN, "helprefn", 2); - AddMacroDef(ltHELPREF, "helpref", 2); - AddMacroDef(ltHFILL, "hfill", 0); - AddMacroDef(ltHLINE, "hline", 0); - AddMacroDef(ltHRULE, "hrule", 0); - AddMacroDef(ltHSPACESTAR, "hspace*", 1); - AddMacroDef(ltHSPACE, "hspace", 1); - AddMacroDef(ltHSKIPSTAR, "hskip*", 1); - AddMacroDef(ltHSKIP, "hskip", 1); - AddMacroDef(lthuge, "huge", 1); - AddMacroDef(ltHuge, "Huge", 1); - AddMacroDef(ltHUGE, "HUGE", 1); - AddMacroDef(ltHTMLIGNORE, "htmlignore", 1); - AddMacroDef(ltHTMLONLY, "htmlonly", 1); - - AddMacroDef(ltIM, "im", 0); - AddMacroDef(ltINCLUDEONLY, "includeonly", 1); - AddMacroDef(ltINCLUDE, "include", 1); - AddMacroDef(ltINDENTED, "indented", 2); - AddMacroDef(ltINDEX, "index", 1); - AddMacroDef(ltINPUT, "input", 1, TRUE); - AddMacroDef(ltIOTA, "iota", 0); - AddMacroDef(ltITEMIZE, "itemize", 1); - AddMacroDef(ltITEM, "item", 0); - AddMacroDef(ltIMAGEMAP, "imagemap", 3); - AddMacroDef(ltIMAGEL, "imagel", 2); - AddMacroDef(ltIMAGER, "imager", 2); - AddMacroDef(ltIMAGE, "image", 2); - AddMacroDef(ltIN, "in", 0); - AddMacroDef(ltINFTY, "infty", 0); - AddMacroDef(ltITSHAPE, "itshape", 1); - AddMacroDef(ltIT, "it", 1); - AddMacroDef(ltITEMSEP, "itemsep", 1); - AddMacroDef(ltINSERTATLEVEL, "insertatlevel", 2); - - AddMacroDef(ltKAPPA, "kappa", 0); - AddMacroDef(ltKILL, "kill", 0); - - AddMacroDef(ltLABEL, "label", 1); - AddMacroDef(ltLAMBDA, "lambda", 0); - AddMacroDef(ltCAP_LAMBDA, "Lambda", 0); - AddMacroDef(ltlarge, "large", 1); - AddMacroDef(ltLarge, "Large", 1); - AddMacroDef(ltLARGE, "LARGE", 1); - AddMacroDef(ltLATEXIGNORE, "latexignore", 1); - AddMacroDef(ltLATEXONLY, "latexonly", 1); - AddMacroDef(ltLATEX, "LaTeX", 0); - AddMacroDef(ltLBOX, "lbox", 1); - AddMacroDef(ltLBRACERAW, "lbraceraw", 0); - AddMacroDef(ltLDOTS, "ldots", 0); - AddMacroDef(ltLEQ, "leq", 0); - AddMacroDef(ltLE, "le", 0); - AddMacroDef(ltLEFTARROW, "leftarrow", 0); - AddMacroDef(ltLEFTRIGHTARROW, "leftrightarrow", 0); - AddMacroDef(ltLEFTARROW2, "Leftarrow", 0); - AddMacroDef(ltLEFTRIGHTARROW2, "Leftrightarrow", 0); - AddMacroDef(ltLINEBREAK, "linebreak", 0); - AddMacroDef(ltLINKCOLOUR, "linkcolour", 1); - AddMacroDef(ltLISTOFFIGURES, "listoffigures", 0); - AddMacroDef(ltLISTOFTABLES, "listoftables", 0); - AddMacroDef(ltLHEAD, "lhead", 1); - AddMacroDef(ltLFOOT, "lfoot", 1); - AddMacroDef(ltLOWERCASE, "lowercase", 1); - AddMacroDef(ltLL, "ll", 0); - - AddMacroDef(ltMAKEGLOSSARY, "makeglossary", 0); - AddMacroDef(ltMAKEINDEX, "makeindex", 0); - AddMacroDef(ltMAKETITLE, "maketitle", 0); - AddMacroDef(ltMARKRIGHT, "markright", 1); - AddMacroDef(ltMARKBOTH, "markboth", 2); - AddMacroDef(ltMARGINPARWIDTH, "marginparwidth", 1); - AddMacroDef(ltMARGINPARSEP, "marginparsep", 1); - AddMacroDef(ltMARGINPARODD, "marginparodd", 1); - AddMacroDef(ltMARGINPAREVEN, "marginpareven", 1); - AddMacroDef(ltMARGINPAR, "marginpar", 1); - AddMacroDef(ltMBOX, "mbox", 1); - AddMacroDef(ltMDSERIES, "mdseries", 1); - AddMacroDef(ltMEMBERSECTION, "membersection", 1); - AddMacroDef(ltMEMBER, "member", 2); - AddMacroDef(ltMID, "mid", 0); - AddMacroDef(ltMODELS, "models", 0); - AddMacroDef(ltMP, "mp", 0); - AddMacroDef(ltMULTICOLUMN, "multicolumn", 3); - AddMacroDef(ltMU, "mu", 0); - - AddMacroDef(ltNABLA, "nabla", 0); - AddMacroDef(ltNEG, "neg", 0); - AddMacroDef(ltNEQ, "neq", 0); - AddMacroDef(ltNEWCOUNTER, "newcounter", 1, FALSE, (bool)FORBID_ABSOLUTELY); - AddMacroDef(ltNEWLINE, "newline", 0); - AddMacroDef(ltNEWPAGE, "newpage", 0); - AddMacroDef(ltNI, "ni", 0); - AddMacroDef(ltNOCITE, "nocite", 1); - AddMacroDef(ltNOINDENT, "noindent", 0); - AddMacroDef(ltNOLINEBREAK, "nolinebreak", 0); - AddMacroDef(ltNOPAGEBREAK, "nopagebreak", 0); - AddMacroDef(ltNORMALSIZE, "normalsize", 1); - AddMacroDef(ltNORMALBOX, "normalbox", 1); - AddMacroDef(ltNORMALBOXD, "normalboxd", 1); - AddMacroDef(ltNOTEQ, "noteq", 0); - AddMacroDef(ltNOTIN, "notin", 0); - AddMacroDef(ltNOTSUBSET, "notsubset", 0); - AddMacroDef(ltNU, "nu", 0); - - AddMacroDef(ltODDSIDEMARGIN, "oddsidemargin", 1); - AddMacroDef(ltOMEGA, "omega", 0); - AddMacroDef(ltCAP_OMEGA, "Omega", 0); - AddMacroDef(ltONECOLUMN, "onecolumn", 0); - AddMacroDef(ltOPLUS, "oplus", 0); - AddMacroDef(ltOSLASH, "oslash", 0); - AddMacroDef(ltOTIMES, "otimes", 0); - - AddMacroDef(ltPAGEBREAK, "pagebreak", 0); - AddMacroDef(ltPAGEREF, "pageref", 1); - AddMacroDef(ltPAGESTYLE, "pagestyle", 1); - AddMacroDef(ltPAGENUMBERING, "pagenumbering", 1); - AddMacroDef(ltPARAGRAPHSTAR, "paragraph*", 1); - AddMacroDef(ltPARAGRAPH, "paragraph", 1); - AddMacroDef(ltPARALLEL, "parallel", 0); - AddMacroDef(ltPARAM, "param", 2); - AddMacroDef(ltPARINDENT, "parindent", 1); - AddMacroDef(ltPARSKIP, "parskip", 1); - AddMacroDef(ltPARTIAL, "partial", 0); - AddMacroDef(ltPARTSTAR, "part*", 1); - AddMacroDef(ltPART, "part", 1); - AddMacroDef(ltPAR, "par", 0); - AddMacroDef(ltPERP, "perp", 0); - AddMacroDef(ltPHI, "phi", 0); - AddMacroDef(ltCAP_PHI, "Phi", 0); - AddMacroDef(ltPFUNC, "pfunc", 3); - AddMacroDef(ltPICTURE, "picture", 1); - AddMacroDef(ltPI, "pi", 0); - AddMacroDef(ltCAP_PI, "Pi", 0); - AddMacroDef(ltPM, "pm", 0); - AddMacroDef(ltPOPREFONLY, "poprefonly", 1); - AddMacroDef(ltPOPREF, "popref", 2); - AddMacroDef(ltPOUNDS, "pounds", 0); - AddMacroDef(ltPREC, "prec", 0); - AddMacroDef(ltPRECEQ, "preceq", 0); - AddMacroDef(ltPRINTINDEX, "printindex", 0); - AddMacroDef(ltPROPTO, "propto", 0); - AddMacroDef(ltPSBOXTO, "psboxto", 1, FALSE, (bool)FORBID_ABSOLUTELY); - AddMacroDef(ltPSBOX, "psbox", 1, FALSE, (bool)FORBID_ABSOLUTELY); - AddMacroDef(ltPSI, "psi", 0); - AddMacroDef(ltCAP_PSI, "Psi", 0); - - AddMacroDef(ltQUOTE, "quote", 1); - AddMacroDef(ltQUOTATION, "quotation", 1); - - AddMacroDef(ltRAGGEDBOTTOM, "raggedbottom", 0); - AddMacroDef(ltRAGGEDLEFT, "raggedleft", 0); - AddMacroDef(ltRAGGEDRIGHT, "raggedright", 0); - AddMacroDef(ltRBRACERAW, "rbraceraw", 0); - AddMacroDef(ltREF, "ref", 1); - AddMacroDef(ltREGISTERED, "registered", 0); - AddMacroDef(ltRE, "we", 0); - AddMacroDef(ltRHO, "rho", 0); - AddMacroDef(ltRIGHTARROW, "rightarrow", 0); - AddMacroDef(ltRIGHTARROW2, "rightarrow2", 0); - AddMacroDef(ltRMFAMILY, "rmfamily", 1); - AddMacroDef(ltRM, "rm", 1); - AddMacroDef(ltROMAN, "roman", 1); - AddMacroDef(ltROMAN2, "Roman", 1); + AddMacroDef(ltBIBLIOGRAPHYSTYLE, _T("bibliographystyle"), 1); + AddMacroDef(ltBIBLIOGRAPHY, _T("bibliography"), 1); + AddMacroDef(ltBIGTRIANGLEDOWN, _T("bigtriangledown"), 0); + AddMacroDef(ltBOT, _T("bot"), 0); + AddMacroDef(ltBOXIT, _T("boxit"), 1); + AddMacroDef(ltBOX, _T("box"), 0); + AddMacroDef(ltBRCLEAR, _T("brclear"), 0); + AddMacroDef(ltBULLET, _T("bullet"), 0); + + AddMacroDef(ltCAPTIONSTAR, _T("caption*"), 1); + AddMacroDef(ltCAPTION, _T("caption"), 1); + AddMacroDef(ltCAP, _T("cap"), 0); + AddMacroDef(ltCDOTS, _T("cdots"), 0); + AddMacroDef(ltCDOT, _T("cdot"), 0); + AddMacroDef(ltCENTERLINE, _T("centerline"), 1); + AddMacroDef(ltCENTERING, _T("centering"), 0); + AddMacroDef(ltCENTER, _T("center"), 1); + AddMacroDef(ltCEXTRACT, _T("cextract"), 0); + AddMacroDef(ltCHAPTERHEADING, _T("chapterheading"), 1); + AddMacroDef(ltCHAPTERSTAR, _T("chapter*"), 1); + AddMacroDef(ltCHAPTER, _T("chapter"), 1); + AddMacroDef(ltCHI, _T("chi"), 0); + AddMacroDef(ltCINSERT, _T("cinsert"), 0); + AddMacroDef(ltCIRC, _T("circ"), 0); + AddMacroDef(ltCITE, _T("cite"), 1); + AddMacroDef(ltCLASS, _T("class"), 1); + AddMacroDef(ltCLEARDOUBLEPAGE, _T("cleardoublepage"), 0); + AddMacroDef(ltCLEARPAGE, _T("clearpage"), 0); + AddMacroDef(ltCLINE, _T("cline"), 1); + AddMacroDef(ltCLIPSFUNC, _T("clipsfunc"), 3); + AddMacroDef(ltCLUBSUIT, _T("clubsuit"), 0); + AddMacroDef(ltCOLUMNSEP, _T("columnsep"), 1); + AddMacroDef(ltCOMMENT, _T("comment"), 1, true); + AddMacroDef(ltCONG, _T("cong"), 0); + AddMacroDef(ltCOPYRIGHT, _T("copyright"), 0); + AddMacroDef(ltCPARAM, _T("cparam"), 2); + AddMacroDef(ltCHEAD, _T("chead"), 1); + AddMacroDef(ltCFOOT, _T("cfoot"), 1); + AddMacroDef(ltCUP, _T("cup"), 0); + + AddMacroDef(ltDASHV, _T("dashv"), 0); + AddMacroDef(ltDATE, _T("date"), 1); + AddMacroDef(ltDELTA, _T("delta"), 0); + AddMacroDef(ltCAP_DELTA, _T("Delta"), 0); + AddMacroDef(ltDEFINECOLOUR, _T("definecolour"), 4); + AddMacroDef(ltDEFINECOLOR, _T("definecolor"), 4); + AddMacroDef(ltDESCRIPTION, _T("description"), 1); + AddMacroDef(ltDESTRUCT, _T("destruct"), 1); + AddMacroDef(ltDIAMOND2, _T("diamond2"), 0); + AddMacroDef(ltDIAMOND, _T("diamond"), 0); + AddMacroDef(ltDIV, _T("div"), 0); + AddMacroDef(ltDOCUMENTCLASS, _T("documentclass"), 1); + AddMacroDef(ltDOCUMENTSTYLE, _T("documentstyle"), 1); + AddMacroDef(ltDOCUMENT, _T("document"), 1); + AddMacroDef(ltDOUBLESPACE, _T("doublespace"), 1); + AddMacroDef(ltDOTEQ, _T("doteq"), 0); + AddMacroDef(ltDOWNARROW, _T("downarrow"), 0); + AddMacroDef(ltDOWNARROW2, _T("Downarrow"), 0); + + AddMacroDef(ltEMPTYSET, _T("emptyset"), 0); + AddMacroDef(ltEMPH, _T("emph"), 1); + AddMacroDef(ltEM, _T("em"), 1); + AddMacroDef(ltENUMERATE, _T("enumerate"), 1); + AddMacroDef(ltEPSILON, _T("epsilon"), 0); + AddMacroDef(ltEQUATION, _T("equation"), 1); + AddMacroDef(ltEQUIV, _T("equiv"), 0); + AddMacroDef(ltETA, _T("eta"), 0); + AddMacroDef(ltEVENSIDEMARGIN, _T("evensidemargin"), 1); + AddMacroDef(ltEXISTS, _T("exists"), 0); + + AddMacroDef(ltFBOX, _T("fbox"), 1); + AddMacroDef(ltFCOL, _T("fcol"), 2); + AddMacroDef(ltFIGURE, _T("figure"), 1); + AddMacroDef(ltFIGURESTAR, _T("figure*"), 1); + AddMacroDef(ltFLUSHLEFT, _T("flushleft"), 1); + AddMacroDef(ltFLUSHRIGHT, _T("flushright"), 1); + AddMacroDef(ltFOLLOWEDLINKCOLOUR, _T("followedlinkcolour"), 1); + AddMacroDef(ltFOOTHEIGHT, _T("footheight"), 1); + AddMacroDef(ltFOOTNOTEPOPUP, _T("footnotepopup"), 2); + AddMacroDef(ltFOOTNOTE, _T("footnote"), 1); + AddMacroDef(ltFOOTSKIP, _T("footskip"), 1); + AddMacroDef(ltFORALL, _T("forall"), 0); + AddMacroDef(ltFRAMEBOX, _T("framebox"), 1); + AddMacroDef(ltFROWN, _T("frown"), 0); + AddMacroDef(ltFUNCTIONSECTION, _T("functionsection"), 1); + AddMacroDef(ltFUNC, _T("func"), 3); + AddMacroDef(ltFOOTNOTESIZE, _T("footnotesize"), 0); + AddMacroDef(ltFANCYPLAIN, _T("fancyplain"), 2); + + AddMacroDef(ltGAMMA, _T("gamma"), 0); + AddMacroDef(ltCAP_GAMMA, _T("Gamma"), 0); + AddMacroDef(ltGEQ, _T("geq"), 0); + AddMacroDef(ltGE, _T("ge"), 0); + AddMacroDef(ltGG, _T("gg"), 0); + AddMacroDef(ltGLOSSARY, _T("glossary"), 1); + AddMacroDef(ltGLOSS, _T("gloss"), 1); + + AddMacroDef(ltHEADHEIGHT, _T("headheight"), 1); + AddMacroDef(ltHEARTSUIT, _T("heartsuit"), 0); + AddMacroDef(ltHELPGLOSSARY, _T("helpglossary"), 1); + AddMacroDef(ltHELPIGNORE, _T("helpignore"), 1, true); + AddMacroDef(ltHELPONLY, _T("helponly"), 1); + AddMacroDef(ltHELPINPUT, _T("helpinput"), 1); + AddMacroDef(ltHELPFONTFAMILY, _T("helpfontfamily"), 1); + AddMacroDef(ltHELPFONTSIZE, _T("helpfontsize"), 1); + AddMacroDef(ltHELPREFN, _T("helprefn"), 2); + AddMacroDef(ltHELPREF, _T("helpref"), 2); + AddMacroDef(ltHFILL, _T("hfill"), 0); + AddMacroDef(ltHLINE, _T("hline"), 0); + AddMacroDef(ltHRULE, _T("hrule"), 0); + AddMacroDef(ltHSPACESTAR, _T("hspace*"), 1); + AddMacroDef(ltHSPACE, _T("hspace"), 1); + AddMacroDef(ltHSKIPSTAR, _T("hskip*"), 1); + AddMacroDef(ltHSKIP, _T("hskip"), 1); + AddMacroDef(lthuge, _T("huge"), 1); + AddMacroDef(ltHuge, _T("Huge"), 1); + AddMacroDef(ltHUGE, _T("HUGE"), 1); + AddMacroDef(ltHTMLIGNORE, _T("htmlignore"), 1); + AddMacroDef(ltHTMLONLY, _T("htmlonly"), 1); + + AddMacroDef(ltIM, _T("im"), 0); + AddMacroDef(ltINCLUDEONLY, _T("includeonly"), 1); + AddMacroDef(ltINCLUDE, _T("include"), 1); + AddMacroDef(ltINDENTED, _T("indented"), 2); + AddMacroDef(ltINDEX, _T("index"), 1); + AddMacroDef(ltINPUT, _T("input"), 1, true); + AddMacroDef(ltIOTA, _T("iota"), 0); + AddMacroDef(ltITEMIZE, _T("itemize"), 1); + AddMacroDef(ltITEM, _T("item"), 0); + AddMacroDef(ltIMAGEMAP, _T("imagemap"), 3); + AddMacroDef(ltIMAGEL, _T("imagel"), 2); + AddMacroDef(ltIMAGER, _T("imager"), 2); + AddMacroDef(ltIMAGE, _T("image"), 2); + AddMacroDef(ltIN, _T("in"), 0); + AddMacroDef(ltINFTY, _T("infty"), 0); + AddMacroDef(ltITSHAPE, _T("itshape"), 1); + AddMacroDef(ltIT, _T("it"), 1); + AddMacroDef(ltITEMSEP, _T("itemsep"), 1); + AddMacroDef(ltINSERTATLEVEL, _T("insertatlevel"), 2); + + AddMacroDef(ltKAPPA, _T("kappa"), 0); + AddMacroDef(ltKILL, _T("kill"), 0); + + AddMacroDef(ltLABEL, _T("label"), 1); + AddMacroDef(ltLAMBDA, _T("lambda"), 0); + AddMacroDef(ltCAP_LAMBDA, _T("Lambda"), 0); + AddMacroDef(ltlarge, _T("large"), 1); + AddMacroDef(ltLarge, _T("Large"), 1); + AddMacroDef(ltLARGE, _T("LARGE"), 1); + AddMacroDef(ltLATEXIGNORE, _T("latexignore"), 1); + AddMacroDef(ltLATEXONLY, _T("latexonly"), 1); + AddMacroDef(ltLATEX, _T("LaTeX"), 0); + AddMacroDef(ltLBOX, _T("lbox"), 1); + AddMacroDef(ltLBRACERAW, _T("lbraceraw"), 0); + AddMacroDef(ltLDOTS, _T("ldots"), 0); + AddMacroDef(ltLEQ, _T("leq"), 0); + AddMacroDef(ltLE, _T("le"), 0); + AddMacroDef(ltLEFTARROW, _T("leftarrow"), 0); + AddMacroDef(ltLEFTRIGHTARROW, _T("leftrightarrow"), 0); + AddMacroDef(ltLEFTARROW2, _T("Leftarrow"), 0); + AddMacroDef(ltLEFTRIGHTARROW2, _T("Leftrightarrow"), 0); + AddMacroDef(ltLINEBREAK, _T("linebreak"), 0); + AddMacroDef(ltLINKCOLOUR, _T("linkcolour"), 1); + AddMacroDef(ltLISTOFFIGURES, _T("listoffigures"), 0); + AddMacroDef(ltLISTOFTABLES, _T("listoftables"), 0); + AddMacroDef(ltLHEAD, _T("lhead"), 1); + AddMacroDef(ltLFOOT, _T("lfoot"), 1); + AddMacroDef(ltLOWERCASE, _T("lowercase"), 1); + AddMacroDef(ltLL, _T("ll"), 0); + + AddMacroDef(ltMAKEGLOSSARY, _T("makeglossary"), 0); + AddMacroDef(ltMAKEINDEX, _T("makeindex"), 0); + AddMacroDef(ltMAKETITLE, _T("maketitle"), 0); + AddMacroDef(ltMARKRIGHT, _T("markright"), 1); + AddMacroDef(ltMARKBOTH, _T("markboth"), 2); + AddMacroDef(ltMARGINPARWIDTH, _T("marginparwidth"), 1); + AddMacroDef(ltMARGINPARSEP, _T("marginparsep"), 1); + AddMacroDef(ltMARGINPARODD, _T("marginparodd"), 1); + AddMacroDef(ltMARGINPAREVEN, _T("marginpareven"), 1); + AddMacroDef(ltMARGINPAR, _T("marginpar"), 1); + AddMacroDef(ltMBOX, _T("mbox"), 1); + AddMacroDef(ltMDSERIES, _T("mdseries"), 1); + AddMacroDef(ltMEMBERSECTION, _T("membersection"), 1); + AddMacroDef(ltMEMBER, _T("member"), 2); + AddMacroDef(ltMID, _T("mid"), 0); + AddMacroDef(ltMODELS, _T("models"), 0); + AddMacroDef(ltMP, _T("mp"), 0); + AddMacroDef(ltMULTICOLUMN, _T("multicolumn"), 3); + AddMacroDef(ltMU, _T("mu"), 0); + + 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(ltNEWLINE, _T("newline"), 0); + AddMacroDef(ltNEWPAGE, _T("newpage"), 0); + AddMacroDef(ltNI, _T("ni"), 0); + AddMacroDef(ltNOCITE, _T("nocite"), 1); + AddMacroDef(ltNOINDENT, _T("noindent"), 0); + AddMacroDef(ltNOLINEBREAK, _T("nolinebreak"), 0); + AddMacroDef(ltNOPAGEBREAK, _T("nopagebreak"), 0); + AddMacroDef(ltNORMALSIZE, _T("normalsize"), 1); + AddMacroDef(ltNORMALBOX, _T("normalbox"), 1); + AddMacroDef(ltNORMALBOXD, _T("normalboxd"), 1); + AddMacroDef(ltNOTEQ, _T("noteq"), 0); + AddMacroDef(ltNOTIN, _T("notin"), 0); + AddMacroDef(ltNOTSUBSET, _T("notsubset"), 0); + AddMacroDef(ltNU, _T("nu"), 0); + + AddMacroDef(ltODDSIDEMARGIN, _T("oddsidemargin"), 1); + AddMacroDef(ltOMEGA, _T("omega"), 0); + AddMacroDef(ltCAP_OMEGA, _T("Omega"), 0); + AddMacroDef(ltONECOLUMN, _T("onecolumn"), 0); + AddMacroDef(ltOPLUS, _T("oplus"), 0); + AddMacroDef(ltOSLASH, _T("oslash"), 0); + AddMacroDef(ltOTIMES, _T("otimes"), 0); + + AddMacroDef(ltPAGEBREAK, _T("pagebreak"), 0); + AddMacroDef(ltPAGEREF, _T("pageref"), 1); + AddMacroDef(ltPAGESTYLE, _T("pagestyle"), 1); + AddMacroDef(ltPAGENUMBERING, _T("pagenumbering"), 1); + AddMacroDef(ltPARAGRAPHSTAR, _T("paragraph*"), 1); + AddMacroDef(ltPARAGRAPH, _T("paragraph"), 1); + AddMacroDef(ltPARALLEL, _T("parallel"), 0); + AddMacroDef(ltPARAM, _T("param"), 2); + AddMacroDef(ltPARINDENT, _T("parindent"), 1); + AddMacroDef(ltPARSKIP, _T("parskip"), 1); + AddMacroDef(ltPARTIAL, _T("partial"), 0); + AddMacroDef(ltPARTSTAR, _T("part*"), 1); + AddMacroDef(ltPART, _T("part"), 1); + AddMacroDef(ltPAR, _T("par"), 0); + AddMacroDef(ltPERP, _T("perp"), 0); + AddMacroDef(ltPHI, _T("phi"), 0); + AddMacroDef(ltCAP_PHI, _T("Phi"), 0); + AddMacroDef(ltPFUNC, _T("pfunc"), 3); + AddMacroDef(ltPICTURE, _T("picture"), 1); + AddMacroDef(ltPI, _T("pi"), 0); + AddMacroDef(ltCAP_PI, _T("Pi"), 0); + AddMacroDef(ltPM, _T("pm"), 0); + AddMacroDef(ltPOPREFONLY, _T("poprefonly"), 1); + AddMacroDef(ltPOPREF, _T("popref"), 2); + AddMacroDef(ltPOUNDS, _T("pounds"), 0); + AddMacroDef(ltPREC, _T("prec"), 0); + 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(ltPSI, _T("psi"), 0); + AddMacroDef(ltCAP_PSI, _T("Psi"), 0); + + AddMacroDef(ltQUOTE, _T("quote"), 1); + AddMacroDef(ltQUOTATION, _T("quotation"), 1); + + AddMacroDef(ltRAGGEDBOTTOM, _T("raggedbottom"), 0); + AddMacroDef(ltRAGGEDLEFT, _T("raggedleft"), 0); + AddMacroDef(ltRAGGEDRIGHT, _T("raggedright"), 0); + AddMacroDef(ltRBRACERAW, _T("rbraceraw"), 0); + AddMacroDef(ltREF, _T("ref"), 1); + AddMacroDef(ltREGISTERED, _T("registered"), 0); + AddMacroDef(ltRE, _T("we"), 0); + AddMacroDef(ltRHO, _T("rho"), 0); + AddMacroDef(ltRIGHTARROW, _T("rightarrow"), 0); + AddMacroDef(ltRIGHTARROW2, _T("rightarrow2"), 0); + AddMacroDef(ltRMFAMILY, _T("rmfamily"), 1); + AddMacroDef(ltRM, _T("rm"), 1); + AddMacroDef(ltROMAN, _T("roman"), 1); + AddMacroDef(ltROMAN2, _T("Roman"), 1); // AddMacroDef(lt"row", 1); - AddMacroDef(ltRTFSP, "rtfsp", 0); - AddMacroDef(ltRTFIGNORE, "rtfignore", 1); - AddMacroDef(ltRTFONLY, "rtfonly", 1); - AddMacroDef(ltRULEDROW, "ruledrow", 1); - AddMacroDef(ltDRULED, "druled", 1); - AddMacroDef(ltRULE, "rule", 2); - AddMacroDef(ltRHEAD, "rhead", 1); - AddMacroDef(ltRFOOT, "rfoot", 1); - AddMacroDef(ltROW, "row", 1); - - AddMacroDef(ltSCSHAPE, "scshape", 1); - AddMacroDef(ltSC, "sc", 1); - AddMacroDef(ltSECTIONHEADING, "sectionheading", 1); - AddMacroDef(ltSECTIONSTAR, "section*", 1); - AddMacroDef(ltSECTION, "section", 1); - AddMacroDef(ltSETCOUNTER, "setcounter", 2); - AddMacroDef(ltSFFAMILY, "sffamily", 1); - AddMacroDef(ltSF, "sf", 1); - AddMacroDef(ltSHARP, "sharp", 0); - AddMacroDef(ltSHORTCITE, "shortcite", 1); - AddMacroDef(ltSIGMA, "sigma", 0); - AddMacroDef(ltCAP_SIGMA, "Sigma", 0); - AddMacroDef(ltSIM, "sim", 0); - AddMacroDef(ltSIMEQ, "simeq", 0); - AddMacroDef(ltSINGLESPACE, "singlespace", 1); - AddMacroDef(ltSIZEDBOX, "sizedbox", 2); - AddMacroDef(ltSIZEDBOXD, "sizedboxd", 2); - AddMacroDef(ltSLOPPYPAR, "sloppypar", 1); - AddMacroDef(ltSLOPPY, "sloppy", 0); - AddMacroDef(ltSLSHAPE, "slshape", 1); - AddMacroDef(ltSL, "sl", 1); - AddMacroDef(ltSMALL, "small", 1); - AddMacroDef(ltSMILE, "smile", 0); - AddMacroDef(ltSS, "ss", 0); - AddMacroDef(ltSTAR, "star", 0); - AddMacroDef(ltSUBITEM, "subitem", 0); - AddMacroDef(ltSUBPARAGRAPHSTAR, "subparagraph*", 1); - AddMacroDef(ltSUBPARAGRAPH, "subparagraph", 1); - AddMacroDef(ltSPECIAL, "special", 1); - AddMacroDef(ltSUBSECTIONSTAR, "subsection*", 1); - AddMacroDef(ltSUBSECTION, "subsection", 1); - AddMacroDef(ltSUBSETEQ, "subseteq", 0); - AddMacroDef(ltSUBSET, "subset", 0); - AddMacroDef(ltSUCC, "succ", 0); - AddMacroDef(ltSUCCEQ, "succeq", 0); - AddMacroDef(ltSUPSETEQ, "supseteq", 0); - AddMacroDef(ltSUPSET, "supset", 0); - AddMacroDef(ltSUBSUBSECTIONSTAR,"subsubsection*", 1); - AddMacroDef(ltSUBSUBSECTION, "subsubsection", 1); - AddMacroDef(ltSUPERTABULAR, "supertabular", 2, FALSE); - AddMacroDef(ltSURD, "surd", 0); - AddMacroDef(ltSCRIPTSIZE, "scriptsize", 1); - AddMacroDef(ltSETHEADER, "setheader", 6); - AddMacroDef(ltSETFOOTER, "setfooter", 6); - AddMacroDef(ltSETHOTSPOTCOLOUR, "sethotspotcolour", 1); - AddMacroDef(ltSETHOTSPOTCOLOR, "sethotspotcolor", 1); - AddMacroDef(ltSETHOTSPOTUNDERLINE, "sethotspotunderline", 1); - AddMacroDef(ltSETTRANSPARENCY, "settransparency", 1); - AddMacroDef(ltSPADESUIT, "spadesuit", 0); - - AddMacroDef(ltTABBING, "tabbing", 2); - AddMacroDef(ltTABLEOFCONTENTS, "tableofcontents", 0); - AddMacroDef(ltTABLE, "table", 1); - AddMacroDef(ltTABULAR, "tabular", 2, FALSE); - AddMacroDef(ltTAB, "tab", 0); - AddMacroDef(ltTAU, "tau", 0); - AddMacroDef(ltTEXTRM, "textrm", 1); - AddMacroDef(ltTEXTSF, "textsf", 1); - AddMacroDef(ltTEXTTT, "texttt", 1); - AddMacroDef(ltTEXTBF, "textbf", 1); - AddMacroDef(ltTEXTIT, "textit", 1); - AddMacroDef(ltTEXTSL, "textsl", 1); - AddMacroDef(ltTEXTSC, "textsc", 1); - AddMacroDef(ltTEXTWIDTH, "textwidth", 1); - AddMacroDef(ltTEXTHEIGHT, "textheight", 1); - AddMacroDef(ltTEXTCOLOUR, "textcolour", 1); - AddMacroDef(ltTEX, "TeX", 0); - AddMacroDef(ltTHEBIBLIOGRAPHY, "thebibliography", 2); - AddMacroDef(ltTHETA, "theta", 0); - AddMacroDef(ltTIMES, "times", 0); - AddMacroDef(ltCAP_THETA, "Theta", 0); - AddMacroDef(ltTITLEPAGE, "titlepage", 1); - AddMacroDef(ltTITLE, "title", 1); - AddMacroDef(ltTINY, "tiny", 1); - AddMacroDef(ltTODAY, "today", 0); - AddMacroDef(ltTOPMARGIN, "topmargin", 1); - AddMacroDef(ltTOPSKIP, "topskip", 1); - AddMacroDef(ltTRIANGLE, "triangle", 0); - AddMacroDef(ltTTFAMILY, "ttfamily", 1); - AddMacroDef(ltTT, "tt", 1); - AddMacroDef(ltTYPEIN, "typein", 1); - AddMacroDef(ltTYPEOUT, "typeout", 1); - AddMacroDef(ltTWOCOLWIDTHA, "twocolwidtha", 1); - AddMacroDef(ltTWOCOLWIDTHB, "twocolwidthb", 1); - AddMacroDef(ltTWOCOLSPACING, "twocolspacing", 1); - AddMacroDef(ltTWOCOLITEMRULED, "twocolitemruled", 2); - AddMacroDef(ltTWOCOLITEM, "twocolitem", 2); - AddMacroDef(ltTWOCOLLIST, "twocollist", 1); - AddMacroDef(ltTWOCOLUMN, "twocolumn", 0); - AddMacroDef(ltTHEPAGE, "thepage", 0); - AddMacroDef(ltTHECHAPTER, "thechapter", 0); - AddMacroDef(ltTHESECTION, "thesection", 0); - AddMacroDef(ltTHISPAGESTYLE, "thispagestyle", 1); - - AddMacroDef(ltUNDERLINE, "underline", 1); - AddMacroDef(ltUPSILON, "upsilon", 0); - AddMacroDef(ltCAP_UPSILON, "Upsilon", 0); - AddMacroDef(ltUPARROW, "uparrow", 0); - AddMacroDef(ltUPARROW2, "Uparrow", 0); - AddMacroDef(ltUPPERCASE, "uppercase", 1); - AddMacroDef(ltUPSHAPE, "upshape", 1); - AddMacroDef(ltURLREF, "urlref", 2); - AddMacroDef(ltUSEPACKAGE, "usepackage", 1); - - AddMacroDef(ltVAREPSILON, "varepsilon", 0); - AddMacroDef(ltVARPHI, "varphi", 0); - AddMacroDef(ltVARPI, "varpi", 0); - AddMacroDef(ltVARRHO, "varrho", 0); - AddMacroDef(ltVARSIGMA, "varsigma", 0); - AddMacroDef(ltVARTHETA, "vartheta", 0); - AddMacroDef(ltVDOTS, "vdots", 0); - AddMacroDef(ltVEE, "vee", 0); - AddMacroDef(ltVERBATIMINPUT, "verbatiminput", 1); - AddMacroDef(ltVERBATIM, "verbatim", 1); - AddMacroDef(ltVERBSTAR, "verb*", 1); - AddMacroDef(ltVERB, "verb", 1); - AddMacroDef(ltVERSE, "verse", 1); - AddMacroDef(ltVFILL, "vfill", 0); - AddMacroDef(ltVLINE, "vline", 0); - AddMacroDef(ltVOID, "void", 0); - AddMacroDef(ltVDASH, "vdash", 0); - AddMacroDef(ltVRULE, "vrule", 0); - AddMacroDef(ltVSPACESTAR, "vspace*", 1); - AddMacroDef(ltVSKIPSTAR, "vskip*", 1); - AddMacroDef(ltVSPACE, "vspace", 1); - AddMacroDef(ltVSKIP, "vskip", 1); - - AddMacroDef(ltWEDGE, "wedge", 0); - AddMacroDef(ltWXCLIPS, "wxclips", 0); - AddMacroDef(ltWINHELPIGNORE, "winhelpignore", 1); - AddMacroDef(ltWINHELPONLY, "winhelponly", 1); - AddMacroDef(ltWP, "wp", 0); - - AddMacroDef(ltXI, "xi", 0); - AddMacroDef(ltCAP_XI, "Xi", 0); - AddMacroDef(ltXLPIGNORE, "xlpignore", 1); - AddMacroDef(ltXLPONLY, "xlponly", 1); - - AddMacroDef(ltZETA, "zeta", 0); - - AddMacroDef(ltSPACE, " ", 0); - AddMacroDef(ltBACKSLASHCHAR, "\\", 0); - AddMacroDef(ltPIPE, "|", 0); - AddMacroDef(ltFORWARDSLASH, "/", 0); - AddMacroDef(ltUNDERSCORE, "_", 0); - AddMacroDef(ltAMPERSAND, "&", 0); - AddMacroDef(ltPERCENT, "%", 0); - AddMacroDef(ltDOLLAR, "$", 0); - AddMacroDef(ltHASH, "#", 0); - AddMacroDef(ltLPARENTH, "(", 0); - AddMacroDef(ltRPARENTH, ")", 0); - AddMacroDef(ltLBRACE, "{", 0); - AddMacroDef(ltRBRACE, "}", 0); -// AddMacroDef(ltEQUALS, "=", 0); - AddMacroDef(ltRANGLEBRA, ">", 0); - AddMacroDef(ltLANGLEBRA, "<", 0); - AddMacroDef(ltPLUS, "+", 0); - AddMacroDef(ltDASH, "-", 0); - AddMacroDef(ltAT_SYMBOL, "@", 0); -// AddMacroDef(ltSINGLEQUOTE, "'", 0); -// AddMacroDef(ltBACKQUOTE, "`", 0); + AddMacroDef(ltRTFSP, _T("rtfsp"), 0); + AddMacroDef(ltRTFIGNORE, _T("rtfignore"), 1); + AddMacroDef(ltRTFONLY, _T("rtfonly"), 1); + AddMacroDef(ltRULEDROW, _T("ruledrow"), 1); + AddMacroDef(ltDRULED, _T("druled"), 1); + AddMacroDef(ltRULE, _T("rule"), 2); + AddMacroDef(ltRHEAD, _T("rhead"), 1); + AddMacroDef(ltRFOOT, _T("rfoot"), 1); + AddMacroDef(ltROW, _T("row"), 1); + + AddMacroDef(ltSCSHAPE, _T("scshape"), 1); + AddMacroDef(ltSC, _T("sc"), 1); + AddMacroDef(ltSECTIONHEADING, _T("sectionheading"), 1); + AddMacroDef(ltSECTIONSTAR, _T("section*"), 1); + AddMacroDef(ltSECTION, _T("section"), 1); + AddMacroDef(ltSETCOUNTER, _T("setcounter"), 2); + AddMacroDef(ltSFFAMILY, _T("sffamily"), 1); + AddMacroDef(ltSF, _T("sf"), 1); + AddMacroDef(ltSHARP, _T("sharp"), 0); + AddMacroDef(ltSHORTCITE, _T("shortcite"), 1); + AddMacroDef(ltSIGMA, _T("sigma"), 0); + AddMacroDef(ltCAP_SIGMA, _T("Sigma"), 0); + AddMacroDef(ltSIM, _T("sim"), 0); + AddMacroDef(ltSIMEQ, _T("simeq"), 0); + AddMacroDef(ltSINGLESPACE, _T("singlespace"), 1); + AddMacroDef(ltSIZEDBOX, _T("sizedbox"), 2); + AddMacroDef(ltSIZEDBOXD, _T("sizedboxd"), 2); + AddMacroDef(ltSLOPPYPAR, _T("sloppypar"), 1); + AddMacroDef(ltSLOPPY, _T("sloppy"), 0); + AddMacroDef(ltSLSHAPE, _T("slshape"), 1); + AddMacroDef(ltSL, _T("sl"), 1); + AddMacroDef(ltSMALL, _T("small"), 1); + AddMacroDef(ltSMILE, _T("smile"), 0); + AddMacroDef(ltSS, _T("ss"), 0); + AddMacroDef(ltSTAR, _T("star"), 0); + AddMacroDef(ltSUBITEM, _T("subitem"), 0); + AddMacroDef(ltSUBPARAGRAPHSTAR, _T("subparagraph*"), 1); + AddMacroDef(ltSUBPARAGRAPH, _T("subparagraph"), 1); + AddMacroDef(ltSPECIAL, _T("special"), 1); + AddMacroDef(ltSUBSECTIONSTAR, _T("subsection*"), 1); + AddMacroDef(ltSUBSECTION, _T("subsection"), 1); + AddMacroDef(ltSUBSETEQ, _T("subseteq"), 0); + AddMacroDef(ltSUBSET, _T("subset"), 0); + AddMacroDef(ltSUCC, _T("succ"), 0); + AddMacroDef(ltSUCCEQ, _T("succeq"), 0); + AddMacroDef(ltSUPSETEQ, _T("supseteq"), 0); + AddMacroDef(ltSUPSET, _T("supset"), 0); + AddMacroDef(ltSUBSUBSECTIONSTAR, _T("subsubsection*"), 1); + AddMacroDef(ltSUBSUBSECTION, _T("subsubsection"), 1); + AddMacroDef(ltSUPERTABULAR, _T("supertabular"), 2, false); + AddMacroDef(ltSURD, _T("surd"), 0); + AddMacroDef(ltSCRIPTSIZE, _T("scriptsize"), 1); + AddMacroDef(ltSETHEADER, _T("setheader"), 6); + AddMacroDef(ltSETFOOTER, _T("setfooter"), 6); + AddMacroDef(ltSETHOTSPOTCOLOUR, _T("sethotspotcolour"), 1); + AddMacroDef(ltSETHOTSPOTCOLOR, _T("sethotspotcolor"), 1); + AddMacroDef(ltSETHOTSPOTUNDERLINE, _T("sethotspotunderline"), 1); + AddMacroDef(ltSETTRANSPARENCY, _T("settransparency"), 1); + AddMacroDef(ltSPADESUIT, _T("spadesuit"), 0); + + AddMacroDef(ltTABBING, _T("tabbing"), 2); + AddMacroDef(ltTABLEOFCONTENTS, _T("tableofcontents"), 0); + AddMacroDef(ltTABLE, _T("table"), 1); + AddMacroDef(ltTABULAR, _T("tabular"), 2, false); + AddMacroDef(ltTAB, _T("tab"), 0); + AddMacroDef(ltTAU, _T("tau"), 0); + AddMacroDef(ltTEXTRM, _T("textrm"), 1); + AddMacroDef(ltTEXTSF, _T("textsf"), 1); + AddMacroDef(ltTEXTTT, _T("texttt"), 1); + AddMacroDef(ltTEXTBF, _T("textbf"), 1); + AddMacroDef(ltTEXTIT, _T("textit"), 1); + AddMacroDef(ltTEXTSL, _T("textsl"), 1); + AddMacroDef(ltTEXTSC, _T("textsc"), 1); + AddMacroDef(ltTEXTWIDTH, _T("textwidth"), 1); + AddMacroDef(ltTEXTHEIGHT, _T("textheight"), 1); + AddMacroDef(ltTEXTCOLOUR, _T("textcolour"), 1); + AddMacroDef(ltTEX, _T("TeX"), 0); + AddMacroDef(ltTHEBIBLIOGRAPHY, _T("thebibliography"), 2); + AddMacroDef(ltTHETA, _T("theta"), 0); + AddMacroDef(ltTIMES, _T("times"), 0); + AddMacroDef(ltCAP_THETA, _T("Theta"), 0); + AddMacroDef(ltTITLEPAGE, _T("titlepage"), 1); + AddMacroDef(ltTITLE, _T("title"), 1); + AddMacroDef(ltTINY, _T("tiny"), 1); + AddMacroDef(ltTODAY, _T("today"), 0); + AddMacroDef(ltTOPMARGIN, _T("topmargin"), 1); + AddMacroDef(ltTOPSKIP, _T("topskip"), 1); + AddMacroDef(ltTRIANGLE, _T("triangle"), 0); + AddMacroDef(ltTTFAMILY, _T("ttfamily"), 1); + AddMacroDef(ltTT, _T("tt"), 1); + AddMacroDef(ltTYPEIN, _T("typein"), 1); + AddMacroDef(ltTYPEOUT, _T("typeout"), 1); + AddMacroDef(ltTWOCOLWIDTHA, _T("twocolwidtha"), 1); + AddMacroDef(ltTWOCOLWIDTHB, _T("twocolwidthb"), 1); + AddMacroDef(ltTWOCOLSPACING, _T("twocolspacing"), 1); + AddMacroDef(ltTWOCOLITEMRULED, _T("twocolitemruled"), 2); + AddMacroDef(ltTWOCOLITEM, _T("twocolitem"), 2); + AddMacroDef(ltTWOCOLLIST, _T("twocollist"), 1); + AddMacroDef(ltTWOCOLUMN, _T("twocolumn"), 0); + AddMacroDef(ltTHEPAGE, _T("thepage"), 0); + AddMacroDef(ltTHECHAPTER, _T("thechapter"), 0); + AddMacroDef(ltTHESECTION, _T("thesection"), 0); + AddMacroDef(ltTHISPAGESTYLE, _T("thispagestyle"), 1); + + AddMacroDef(ltUNDERLINE, _T("underline"), 1); + AddMacroDef(ltUPSILON, _T("upsilon"), 0); + AddMacroDef(ltCAP_UPSILON, _T("Upsilon"), 0); + AddMacroDef(ltUPARROW, _T("uparrow"), 0); + AddMacroDef(ltUPARROW2, _T("Uparrow"), 0); + AddMacroDef(ltUPPERCASE, _T("uppercase"), 1); + 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); + AddMacroDef(ltVARRHO, _T("varrho"), 0); + AddMacroDef(ltVARSIGMA, _T("varsigma"), 0); + AddMacroDef(ltVARTHETA, _T("vartheta"), 0); + AddMacroDef(ltVDOTS, _T("vdots"), 0); + AddMacroDef(ltVEE, _T("vee"), 0); + AddMacroDef(ltVERBATIMINPUT, _T("verbatiminput"), 1); + AddMacroDef(ltVERBATIM, _T("verbatim"), 1); + AddMacroDef(ltVERBSTAR, _T("verb*"), 1); + AddMacroDef(ltVERB, _T("verb"), 1); + AddMacroDef(ltVERSE, _T("verse"), 1); + AddMacroDef(ltVFILL, _T("vfill"), 0); + AddMacroDef(ltVLINE, _T("vline"), 0); + AddMacroDef(ltVOID, _T("void"), 0); + AddMacroDef(ltVDASH, _T("vdash"), 0); + AddMacroDef(ltVRULE, _T("vrule"), 0); + AddMacroDef(ltVSPACESTAR, _T("vspace*"), 1); + AddMacroDef(ltVSKIPSTAR, _T("vskip*"), 1); + AddMacroDef(ltVSPACE, _T("vspace"), 1); + AddMacroDef(ltVSKIP, _T("vskip"), 1); + + AddMacroDef(ltWEDGE, _T("wedge"), 0); + AddMacroDef(ltWXCLIPS, _T("wxclips"), 0); + AddMacroDef(ltWINHELPIGNORE, _T("winhelpignore"), 1); + AddMacroDef(ltWINHELPONLY, _T("winhelponly"), 1); + AddMacroDef(ltWP, _T("wp"), 0); + + AddMacroDef(ltXI, _T("xi"), 0); + AddMacroDef(ltCAP_XI, _T("Xi"), 0); + AddMacroDef(ltXLPIGNORE, _T("xlpignore"), 1); + AddMacroDef(ltXLPONLY, _T("xlponly"), 1); + + AddMacroDef(ltZETA, _T("zeta"), 0); + + AddMacroDef(ltSPACE, _T(" "), 0); + AddMacroDef(ltBACKSLASHCHAR, _T("\\"), 0); + AddMacroDef(ltPIPE, _T("|"), 0); + AddMacroDef(ltFORWARDSLASH, _T("/"), 0); + AddMacroDef(ltUNDERSCORE, _T("_"), 0); + AddMacroDef(ltAMPERSAND, _T("&"), 0); + AddMacroDef(ltPERCENT, _T("%"), 0); + AddMacroDef(ltDOLLAR, _T("$"), 0); + AddMacroDef(ltHASH, _T("#"), 0); + AddMacroDef(ltLPARENTH, _T("("), 0); + AddMacroDef(ltRPARENTH, _T(")"), 0); + AddMacroDef(ltLBRACE, _T("{"), 0); + AddMacroDef(ltRBRACE, _T("}"), 0); +// AddMacroDef(ltEQUALS, _T("="), 0); + AddMacroDef(ltRANGLEBRA, _T(">"), 0); + AddMacroDef(ltLANGLEBRA, _T("<"), 0); + AddMacroDef(ltPLUS, _T("+"), 0); + AddMacroDef(ltDASH, _T("-"), 0); + AddMacroDef(ltAT_SYMBOL, _T("@"), 0); +// AddMacroDef(ltSINGLEQUOTE, _T("'"), 0); +// AddMacroDef(ltBACKQUOTE, _T("`"), 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) { @@ -2573,8 +2586,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 { @@ -2593,117 +2606,128 @@ 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; } case ltSPECIALAMPERSAND: if (start) - TexOutput(" "); + TexOutput(_T(" ")); break; case ltCINSERT: if (start) - TexOutput("<<", TRUE); + { + if (convertMode == TEX_HTML) + TexOutput(_T("<<")); + else + TexOutput(_T("<<"), true); + } break; case ltCEXTRACT: if (start) - TexOutput(">>", TRUE); + { + if (convertMode == TEX_HTML) + TexOutput(_T(">>")); + else + TexOutput(_T(">>"), true); + } break; case ltDESTRUCT: if (start) - TexOutput("~", TRUE); + TexOutput(_T("~"), true); break; case ltTILDE: if (start) - TexOutput("~", TRUE); + TexOutput(_T("~"), true); break; case ltSPECIALTILDE: if (start) - TexOutput(" ", TRUE); + TexOutput(_T(" "), true); break; case ltUNDERSCORE: if (start) - TexOutput("_", TRUE); + TexOutput(_T("_"), true); break; case ltHASH: if (start) - TexOutput("#", TRUE); + TexOutput(_T("#"), true); break; case ltAMPERSAND: if (start) - TexOutput("&", TRUE); + TexOutput(_T("&"), true); break; case ltSPACE: if (start) - TexOutput(" ", TRUE); + TexOutput(_T(" "), true); break; case ltPIPE: if (start) - TexOutput("|", TRUE); + TexOutput(_T("|"), true); break; case ltPERCENT: if (start) - TexOutput("%", TRUE); + TexOutput(_T("%"), true); break; case ltDOLLAR: if (start) - TexOutput("$", TRUE); + TexOutput(_T("$"), true); break; case ltLPARENTH: if (start) - TexOutput("", TRUE); + TexOutput(_T(""), true); break; case ltRPARENTH: if (start) - TexOutput("", TRUE); + TexOutput(_T(""), true); break; case ltLBRACE: if (start) - TexOutput("{", TRUE); + TexOutput(_T("{"), true); break; case ltRBRACE: if (start) - TexOutput("}", TRUE); + TexOutput(_T("}"), true); break; case ltCOPYRIGHT: if (start) - TexOutput("(c)", TRUE); + TexOutput(_T("(c)"), true); break; case ltREGISTERED: if (start) - TexOutput("(r)", TRUE); + TexOutput(_T("(r)"), true); break; case ltBACKSLASH: - if (start) - TexOutput("\\", TRUE); + if (start) + TexOutput(_T("\\"), true); break; case ltLDOTS: case ltCDOTS: if (start) - TexOutput("...", TRUE); + TexOutput(_T("..."), true); break; case ltVDOTS: if (start) - TexOutput("|", TRUE); + TexOutput(_T("|"), true); break; case ltLATEX: if (start) - TexOutput("LaTeX", TRUE); + TexOutput(_T("LaTeX"), true); break; case ltTEX: if (start) - TexOutput("TeX", TRUE); + TexOutput(_T("TeX"), true); break; case ltPOUNDS: if (start) - TexOutput("£", 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); @@ -2726,7 +2750,7 @@ void DefaultOnMacro(int macroId, int no_args, bool start) { time_t when; (void) time(&when); - TexOutput(ctime(&when), TRUE); + TexOutput(wxCtime(&when), true); } break; } @@ -2737,389 +2761,451 @@ void DefaultOnMacro(int macroId, int no_args, bool start) // Symbols case ltALPHA: - if (start) TexOutput("alpha"); + if (start) TexOutput(_T("alpha")); break; case ltBETA: - if (start) TexOutput("beta"); + if (start) TexOutput(_T("beta")); break; case ltGAMMA: - if (start) TexOutput("gamma"); + if (start) TexOutput(_T("gamma")); break; case ltDELTA: - if (start) TexOutput("delta"); + if (start) TexOutput(_T("delta")); break; case ltEPSILON: case ltVAREPSILON: - if (start) TexOutput("epsilon"); + if (start) TexOutput(_T("epsilon")); break; case ltZETA: - if (start) TexOutput("zeta"); + if (start) TexOutput(_T("zeta")); break; case ltETA: - if (start) TexOutput("eta"); + if (start) TexOutput(_T("eta")); break; case ltTHETA: case ltVARTHETA: - if (start) TexOutput("theta"); + if (start) TexOutput(_T("theta")); break; case ltIOTA: - if (start) TexOutput("iota"); + if (start) TexOutput(_T("iota")); break; case ltKAPPA: - if (start) TexOutput("kappa"); + if (start) TexOutput(_T("kappa")); break; case ltLAMBDA: - if (start) TexOutput("lambda"); + if (start) TexOutput(_T("lambda")); break; case ltMU: - if (start) TexOutput("mu"); + if (start) TexOutput(_T("mu")); break; case ltNU: - if (start) TexOutput("nu"); + if (start) TexOutput(_T("nu")); break; case ltXI: - if (start) TexOutput("xi"); + if (start) TexOutput(_T("xi")); break; case ltPI: case ltVARPI: - if (start) TexOutput("pi"); + if (start) TexOutput(_T("pi")); break; case ltRHO: case ltVARRHO: - if (start) TexOutput("rho"); + if (start) TexOutput(_T("rho")); break; case ltSIGMA: case ltVARSIGMA: - if (start) TexOutput("sigma"); + if (start) TexOutput(_T("sigma")); break; case ltTAU: - if (start) TexOutput("tau"); + if (start) TexOutput(_T("tau")); break; case ltUPSILON: - if (start) TexOutput("upsilon"); + if (start) TexOutput(_T("upsilon")); break; case ltPHI: case ltVARPHI: - if (start) TexOutput("phi"); + if (start) TexOutput(_T("phi")); break; case ltCHI: - if (start) TexOutput("chi"); + if (start) TexOutput(_T("chi")); break; case ltPSI: - if (start) TexOutput("psi"); + if (start) TexOutput(_T("psi")); break; case ltOMEGA: - if (start) TexOutput("omega"); + if (start) TexOutput(_T("omega")); break; case ltCAP_GAMMA: - if (start) TexOutput("GAMMA"); + if (start) TexOutput(_T("GAMMA")); break; case ltCAP_DELTA: - if (start) TexOutput("DELTA"); + if (start) TexOutput(_T("DELTA")); break; case ltCAP_THETA: - if (start) TexOutput("THETA"); + if (start) TexOutput(_T("THETA")); break; case ltCAP_LAMBDA: - if (start) TexOutput("LAMBDA"); + if (start) TexOutput(_T("LAMBDA")); break; case ltCAP_XI: - if (start) TexOutput("XI"); + if (start) TexOutput(_T("XI")); break; case ltCAP_PI: - if (start) TexOutput("PI"); + if (start) TexOutput(_T("PI")); break; case ltCAP_SIGMA: - if (start) TexOutput("SIGMA"); + if (start) TexOutput(_T("SIGMA")); break; case ltCAP_UPSILON: - if (start) TexOutput("UPSILON"); + if (start) TexOutput(_T("UPSILON")); break; case ltCAP_PHI: - if (start) TexOutput("PHI"); + if (start) TexOutput(_T("PHI")); break; case ltCAP_PSI: - if (start) TexOutput("PSI"); + if (start) TexOutput(_T("PSI")); break; case ltCAP_OMEGA: - if (start) TexOutput("OMEGA"); + if (start) TexOutput(_T("OMEGA")); break; // Binary operation symbols case ltLE: case ltLEQ: - if (start) TexOutput("<="); + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T("<=")); + else + TexOutput(_T("<=")); + } break; case ltLL: - if (start) TexOutput("<<"); + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T("<<")); + else + TexOutput(_T("<<")); + } break; case ltSUBSET: - if (start) TexOutput("SUBSET"); + if (start) TexOutput(_T("SUBSET")); break; case ltSUBSETEQ: - if (start) TexOutput("SUBSETEQ"); + if (start) TexOutput(_T("SUBSETEQ")); break; case ltIN: - if (start) TexOutput("IN"); + if (start) TexOutput(_T("IN")); break; case ltVDASH: - if (start) TexOutput("VDASH"); + if (start) TexOutput(_T("VDASH")); break; case ltMODELS: - if (start) TexOutput("MODELS"); + if (start) TexOutput(_T("MODELS")); break; case ltGE: case ltGEQ: - if (start) TexOutput(">="); + { + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T(">=")); + else + TexOutput(_T(">=")); + } break; + } case ltGG: - if (start) TexOutput(">>"); + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T(">>")); + else + TexOutput(_T(">>")); + } break; case ltSUPSET: - if (start) TexOutput("SUPSET"); + if (start) TexOutput(_T("SUPSET")); break; case ltSUPSETEQ: - if (start) TexOutput("SUPSETEQ"); + if (start) TexOutput(_T("SUPSETEQ")); break; case ltNI: - if (start) TexOutput("NI"); + if (start) TexOutput(_T("NI")); break; case ltDASHV: - if (start) TexOutput("DASHV"); + if (start) TexOutput(_T("DASHV")); break; case ltPERP: - if (start) TexOutput("PERP"); + if (start) TexOutput(_T("PERP")); break; case ltNEQ: - if (start) TexOutput("NEQ"); + if (start) TexOutput(_T("NEQ")); break; case ltDOTEQ: - if (start) TexOutput("DOTEQ"); + if (start) TexOutput(_T("DOTEQ")); break; case ltAPPROX: - if (start) TexOutput("APPROX"); + if (start) TexOutput(_T("APPROX")); break; case ltCONG: - if (start) TexOutput("CONG"); + if (start) TexOutput(_T("CONG")); break; case ltEQUIV: - if (start) TexOutput("EQUIV"); + if (start) TexOutput(_T("EQUIV")); break; case ltPROPTO: - if (start) TexOutput("PROPTO"); + if (start) TexOutput(_T("PROPTO")); break; case ltPREC: - if (start) TexOutput("PREC"); + if (start) TexOutput(_T("PREC")); break; case ltPRECEQ: - if (start) TexOutput("PRECEQ"); + if (start) TexOutput(_T("PRECEQ")); break; case ltPARALLEL: - if (start) TexOutput("|"); + if (start) TexOutput(_T("|")); break; case ltSIM: - if (start) TexOutput("~"); + if (start) TexOutput(_T("~")); break; case ltSIMEQ: - if (start) TexOutput("SIMEQ"); + if (start) TexOutput(_T("SIMEQ")); break; case ltASYMP: - if (start) TexOutput("ASYMP"); + if (start) TexOutput(_T("ASYMP")); break; case ltSMILE: - if (start) TexOutput(":-)"); + if (start) TexOutput(_T(":-)")); break; case ltFROWN: - if (start) TexOutput(":-("); + if (start) TexOutput(_T(":-(")); break; case ltSUCC: - if (start) TexOutput("SUCC"); + if (start) TexOutput(_T("SUCC")); break; case ltSUCCEQ: - if (start) TexOutput("SUCCEQ"); + if (start) TexOutput(_T("SUCCEQ")); break; case ltMID: - if (start) TexOutput("|"); + if (start) TexOutput(_T("|")); break; // Negated relation symbols case ltNOTEQ: - if (start) TexOutput("!="); + if (start) TexOutput(_T("!=")); break; case ltNOTIN: - if (start) TexOutput("NOTIN"); + if (start) TexOutput(_T("NOTIN")); break; case ltNOTSUBSET: - if (start) TexOutput("NOTSUBSET"); + if (start) TexOutput(_T("NOTSUBSET")); break; // Arrows case ltLEFTARROW: - if (start) TexOutput("<--"); + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T("<--")); + else + TexOutput(_T("<--")); + } break; case ltLEFTARROW2: - if (start) TexOutput("<=="); + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T("<==")); + else + TexOutput(_T("<==")); + } break; case ltRIGHTARROW: - if (start) TexOutput("-->"); + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T("-->")); + else + TexOutput(_T("-->")); + } break; case ltRIGHTARROW2: - if (start) TexOutput("==>"); + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T("==>")); + else + TexOutput(_T("==>")); + } break; case ltLEFTRIGHTARROW: - if (start) TexOutput("<-->"); + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T("<-->")); + else + TexOutput(_T("<-->")); + } break; case ltLEFTRIGHTARROW2: - if (start) TexOutput("<==>"); + if (start) + { + if (convertMode == TEX_HTML) + TexOutput(_T("<==>")); + else + TexOutput(_T("<==>")); + } break; case ltUPARROW: - if (start) TexOutput("UPARROW"); + if (start) TexOutput(_T("UPARROW")); break; case ltUPARROW2: - if (start) TexOutput("UPARROW2"); + if (start) TexOutput(_T("UPARROW2")); break; case ltDOWNARROW: - if (start) TexOutput("DOWNARROW"); + if (start) TexOutput(_T("DOWNARROW")); break; case ltDOWNARROW2: - if (start) TexOutput("DOWNARROW2"); + if (start) TexOutput(_T("DOWNARROW2")); break; // Miscellaneous symbols case ltALEPH: - if (start) TexOutput("ALEPH"); + if (start) TexOutput(_T("ALEPH")); break; case ltWP: - if (start) TexOutput("WP"); + if (start) TexOutput(_T("WP")); break; case ltRE: - if (start) TexOutput("RE"); + if (start) TexOutput(_T("RE")); break; case ltIM: - if (start) TexOutput("IM"); + if (start) TexOutput(_T("IM")); break; case ltEMPTYSET: - if (start) TexOutput("EMPTYSET"); + if (start) TexOutput(_T("EMPTYSET")); break; case ltNABLA: - if (start) TexOutput("NABLA"); + if (start) TexOutput(_T("NABLA")); break; case ltSURD: - if (start) TexOutput("SURD"); + if (start) TexOutput(_T("SURD")); break; case ltPARTIAL: - if (start) TexOutput("PARTIAL"); + if (start) TexOutput(_T("PARTIAL")); break; case ltBOT: - if (start) TexOutput("BOT"); + if (start) TexOutput(_T("BOT")); break; case ltFORALL: - if (start) TexOutput("FORALL"); + if (start) TexOutput(_T("FORALL")); break; case ltEXISTS: - if (start) TexOutput("EXISTS"); + if (start) TexOutput(_T("EXISTS")); break; case ltNEG: - if (start) TexOutput("NEG"); + if (start) TexOutput(_T("NEG")); break; case ltSHARP: - if (start) TexOutput("SHARP"); + if (start) TexOutput(_T("SHARP")); break; case ltANGLE: - if (start) TexOutput("ANGLE"); + if (start) TexOutput(_T("ANGLE")); break; case ltTRIANGLE: - if (start) TexOutput("TRIANGLE"); + if (start) TexOutput(_T("TRIANGLE")); break; case ltCLUBSUIT: - if (start) TexOutput("CLUBSUIT"); + if (start) TexOutput(_T("CLUBSUIT")); break; case ltDIAMONDSUIT: - if (start) TexOutput("DIAMONDSUIT"); + if (start) TexOutput(_T("DIAMONDSUIT")); break; case ltHEARTSUIT: - if (start) TexOutput("HEARTSUIT"); + if (start) TexOutput(_T("HEARTSUIT")); break; case ltSPADESUIT: - if (start) TexOutput("SPADESUIT"); + if (start) TexOutput(_T("SPADESUIT")); break; case ltINFTY: - if (start) TexOutput("INFTY"); + if (start) TexOutput(_T("INFTY")); break; case ltPM: - if (start) TexOutput("PM"); + if (start) TexOutput(_T("PM")); break; case ltMP: - if (start) TexOutput("MP"); + if (start) TexOutput(_T("MP")); break; case ltTIMES: - if (start) TexOutput("TIMES"); + if (start) TexOutput(_T("TIMES")); break; case ltDIV: - if (start) TexOutput("DIV"); + if (start) TexOutput(_T("DIV")); break; case ltCDOT: - if (start) TexOutput("CDOT"); + if (start) TexOutput(_T("CDOT")); break; case ltAST: - if (start) TexOutput("AST"); + if (start) TexOutput(_T("AST")); break; case ltSTAR: - if (start) TexOutput("STAR"); + if (start) TexOutput(_T("STAR")); break; case ltCAP: - if (start) TexOutput("CAP"); + if (start) TexOutput(_T("CAP")); break; case ltCUP: - if (start) TexOutput("CUP"); + if (start) TexOutput(_T("CUP")); break; case ltVEE: - if (start) TexOutput("VEE"); + if (start) TexOutput(_T("VEE")); break; case ltWEDGE: - if (start) TexOutput("WEDGE"); + if (start) TexOutput(_T("WEDGE")); break; case ltCIRC: - if (start) TexOutput("CIRC"); + if (start) TexOutput(_T("CIRC")); break; case ltBULLET: - if (start) TexOutput("BULLET"); + if (start) TexOutput(_T("BULLET")); break; case ltDIAMOND: - if (start) TexOutput("DIAMOND"); + if (start) TexOutput(_T("DIAMOND")); break; case ltOSLASH: - if (start) TexOutput("OSLASH"); + if (start) TexOutput(_T("OSLASH")); break; case ltBOX: - if (start) TexOutput("BOX"); + if (start) TexOutput(_T("BOX")); break; case ltDIAMOND2: - if (start) TexOutput("DIAMOND2"); + if (start) TexOutput(_T("DIAMOND2")); break; case ltBIGTRIANGLEDOWN: - if (start) TexOutput("BIGTRIANGLEDOWN"); + if (start) TexOutput(_T("BIGTRIANGLEDOWN")); break; case ltOPLUS: - if (start) TexOutput("OPLUS"); + if (start) TexOutput(_T("OPLUS")); break; case ltOTIMES: - if (start) TexOutput("OTIMES"); + if (start) TexOutput(_T("OTIMES")); break; case ltSS: - if (start) TexOutput("s"); + if (start) TexOutput(_T("s")); break; case ltBACKSLASHRAW: - if (start) TexOutput("\\"); + if (start) TexOutput(_T("\\")); break; case ltLBRACERAW: - if (start) TexOutput("{"); + if (start) TexOutput(_T("{")); break; case ltRBRACERAW: - if (start) TexOutput("}"); + if (start) TexOutput(_T("}")); break; case ltSMALLSPACE1: case ltSMALLSPACE2: - if (start) TexOutput(" "); + if (start) TexOutput(_T(" ")); break; default: break; @@ -3135,7 +3221,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (arg_no == 1 && start) { - char *refName = GetArgData(); + wxChar *refName = GetArgData(); if (refName) { TexRef *texRef = FindReference(refName); @@ -3143,11 +3229,11 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { // Must strip the 'section' or 'chapter' or 'figure' text // from a normal 'ref' reference - char buf[150]; - strcpy(buf, texRef->sectionNumber); - int len = strlen(buf); + wxChar buf[150]; + wxStrcpy(buf, texRef->sectionNumber); + int len = wxStrlen(buf); int i = 0; - if (strcmp(buf, "??") != 0) + if (wxStrcmp(buf, _T("??")) != 0) { while (i < len) { @@ -3159,45 +3245,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("Warning: unresolved reference '%s'", refName); - OnInform((char *)informBuf.c_str()); + informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName); + OnInform((wxChar *)informBuf.c_str()); } } - else TexOutput("??", TRUE); - return FALSE; + else TexOutput(_T("??"), true); + return false; } break; } case ltLABEL: { - return FALSE; - break; + return false; } case ltAUTHOR: { if (start && (arg_no == 1)) DocumentAuthor = GetArgChunk(); - return FALSE; - break; + return false; } case ltDATE: { if (start && (arg_no == 1)) DocumentDate = GetArgChunk(); - return FALSE; - break; + return false; } case ltTITLE: { if (start && (arg_no == 1)) DocumentTitle = GetArgChunk(); - return FALSE; - break; + return false; } case ltDOCUMENTCLASS: case ltDOCUMENTSTYLE: @@ -3205,53 +3287,51 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) if (start && !IsArgOptional()) { DocumentStyleString = copystring(GetArgData()); - if (strncmp(DocumentStyleString, "art", 3) == 0) + if (wxStrncmp(DocumentStyleString, _T("art"), 3) == 0) DocumentStyle = LATEX_ARTICLE; - else if (strncmp(DocumentStyleString, "rep", 3) == 0) + else if (wxStrncmp(DocumentStyleString, _T("rep"), 3) == 0) DocumentStyle = LATEX_REPORT; - else if (strncmp(DocumentStyleString, "book", 4) == 0 || - strncmp(DocumentStyleString, "thesis", 6) == 0) + else if (wxStrncmp(DocumentStyleString, _T("book"), 4) == 0 || + wxStrncmp(DocumentStyleString, _T("thesis"), 6) == 0) DocumentStyle = LATEX_BOOK; - else if (strncmp(DocumentStyleString, "letter", 6) == 0) + else if (wxStrncmp(DocumentStyleString, _T("letter"), 6) == 0) DocumentStyle = LATEX_LETTER; - else if (strncmp(DocumentStyleString, "slides", 6) == 0) + else if (wxStrncmp(DocumentStyleString, _T("slides"), 6) == 0) DocumentStyle = LATEX_SLIDES; - - if (StringMatch("10", DocumentStyleString)) + + if (StringMatch(_T("10"), DocumentStyleString)) SetFontSizes(10); - else if (StringMatch("11", DocumentStyleString)) + else if (StringMatch(_T("11"), DocumentStyleString)) SetFontSizes(11); - else if (StringMatch("12", DocumentStyleString)) + else if (StringMatch(_T("12"), DocumentStyleString)) SetFontSizes(12); - OnMacro(ltHELPFONTSIZE, 1, TRUE); - sprintf(currentArgData, "%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()) { MinorDocumentStyleString = copystring(GetArgData()); - if (StringMatch("10", MinorDocumentStyleString)) + if (StringMatch(_T("10"), MinorDocumentStyleString)) SetFontSizes(10); - else if (StringMatch("11", MinorDocumentStyleString)) + else if (StringMatch(_T("11"), MinorDocumentStyleString)) SetFontSizes(11); - else if (StringMatch("12", MinorDocumentStyleString)) + else if (StringMatch(_T("12"), MinorDocumentStyleString)) SetFontSizes(12); } - return FALSE; - break; + return false; } case ltBIBLIOGRAPHYSTYLE: { if (start && !IsArgOptional()) BibliographyStyleString = copystring(GetArgData()); - return FALSE; - break; + return false; } case ltPAGESTYLE: { @@ -3260,50 +3340,49 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) if (PageStyle) delete[] PageStyle; PageStyle = copystring(GetArgData()); } - return FALSE; - break; + 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; } */ @@ -3312,30 +3391,30 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (start && !IsArgOptional()) { - char *citeKeys = GetArgData(); + wxChar *citeKeys = GetArgData(); int pos = 0; - char *citeKey = ParseMultifieldString(citeKeys, &pos); + wxChar *citeKey = ParseMultifieldString(citeKeys, &pos); while (citeKey) { AddCitation(citeKey); TexRef *ref = FindReference(citeKey); if (ref) { - TexOutput(ref->sectionNumber, TRUE); - if (strcmp(ref->sectionNumber, "??") == 0) + TexOutput(ref->sectionNumber, true); + if (wxStrcmp(ref->sectionNumber, _T("??")) == 0) { wxString informBuf; - informBuf.Printf("Warning: unresolved citation %s.", citeKey); - OnInform((char *)informBuf.c_str()); + informBuf.Printf(_T("Warning: unresolved citation %s."), citeKey); + OnInform((wxChar *)informBuf.c_str()); } } citeKey = ParseMultifieldString(citeKeys, &pos); if (citeKey) { - TexOutput(", ", TRUE); + TexOutput(_T(", "), true); } } - return FALSE; + return false; } break; } @@ -3343,9 +3422,9 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (start && !IsArgOptional()) { - char *citeKey = GetArgData(); + wxChar *citeKey = GetArgData(); AddCitation(citeKey); - return FALSE; + return false; } break; } @@ -3353,14 +3432,14 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (start) { - char *data = GetArgData(); - if (strcmp(data, "10") == 0) + wxChar *data = GetArgData(); + if (wxStrcmp(data, _T("10")) == 0) SetFontSizes(10); - else if (strcmp(data, "11") == 0) + else if (wxStrcmp(data, _T("11")) == 0) SetFontSizes(11); - else if (strcmp(data, "12") == 0) + else if (wxStrcmp(data, _T("12")) == 0) SetFontSizes(12); - return FALSE; + return false; } break; } @@ -3368,8 +3447,8 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (start) { - TexOutput(" ??", TRUE); - return FALSE; + TexOutput(_T(" ??"), true); + return false; } break; } @@ -3377,9 +3456,9 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (start && arg_no == 1) { - char *data = GetArgData(); + wxChar *data = GetArgData(); ParSkip = ParseUnitArgument(data); - return FALSE; + return false; } break; } @@ -3387,21 +3466,19 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (start && arg_no == 1) { - char *data = GetArgData(); + wxChar *data = GetArgData(); ParIndent = ParseUnitArgument(data); - return FALSE; + return false; } break; } case ltSL: { return OnArgument(ltIT, arg_no, start); - break; } case ltSPECIALDOUBLEDOLLAR: { return OnArgument(ltCENTER, arg_no, start); - break; } case ltPARAGRAPH: case ltPARAGRAPHSTAR: @@ -3409,7 +3486,6 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) case ltSUBPARAGRAPHSTAR: { return OnArgument(ltSUBSUBSECTION, arg_no, start); - break; } case ltTYPEOUT: { @@ -3420,64 +3496,64 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) case ltFOOTNOTE: { if (start) - TexOutput(" (", TRUE); + TexOutput(_T(" ("), true); else - TexOutput(")", TRUE); + TexOutput(_T(")"), true); break; } case ltBIBLIOGRAPHY: { if (start) { - FILE *fd; int ch; - char smallBuf[2]; + wxChar smallBuf[2]; smallBuf[1] = 0; - if ((fd = fopen(TexBibName, "r"))) + FILE *fd = wxFopen(TexBibName, _T("r")); + 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); } else { - OnInform("Run Tex2RTF again to include bibliography."); + OnInform(_T("Run Tex2RTF again to include bibliography.")); } // Read in the .bib file, resolve all known references, write out the RTF. - char *allFiles = GetArgData(); + wxChar *allFiles = GetArgData(); int pos = 0; - char *bibFile = ParseMultifieldString(allFiles, &pos); + wxChar *bibFile = ParseMultifieldString(allFiles, &pos); while (bibFile) { - char fileBuf[300]; - strcpy(fileBuf, bibFile); + wxChar fileBuf[300]; + wxStrcpy(fileBuf, bibFile); wxString actualFile = TexPathList.FindValidPath(fileBuf); - if (actualFile == "") + if (actualFile.empty()) { - strcat(fileBuf, ".bib"); + wxStrcat(fileBuf, _T(".bib")); actualFile = TexPathList.FindValidPath(fileBuf); } - if (actualFile != "") + if (!actualFile.empty()) { - if (!ReadBib((char*) (const char*) actualFile)) + if (!ReadBib((wxChar*) (const wxChar*) actualFile)) { wxString errBuf; - errBuf.Printf(".bib file %s not found or malformed", (const char*) actualFile); - OnError((char *)errBuf.c_str()); + errBuf.Printf(_T(".bib file %s not found or malformed"), (const wxChar*) actualFile); + OnError((wxChar *)errBuf.c_str()); } } else { wxString errBuf; - errBuf.Printf(".bib file %s not found", fileBuf); - OnError((char *)errBuf.c_str()); + errBuf.Printf(_T(".bib file %s not found"), fileBuf); + OnError((wxChar *)errBuf.c_str()); } bibFile = ParseMultifieldString(allFiles, &pos); } @@ -3487,7 +3563,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) // Write it a new bib section in the appropriate format. FILE *save1 = CurrentOutput1; FILE *save2 = CurrentOutput2; - FILE *Biblio = fopen(TexTmpBibName, "w"); + FILE *Biblio = wxFopen(TexTmpBibName, _T("w")); SetCurrentOutput(Biblio); OutputBib(); fclose(Biblio); @@ -3497,124 +3573,98 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) wxRenameFile(TexTmpBibName, TexBibName); } SetCurrentOutputs(save1, save2); - return FALSE; + return false; } break; } case ltMULTICOLUMN: - { - if (start && (arg_no == 3)) - return TRUE; - else - return FALSE; - break; - } + return (start && (arg_no == 3)); case ltSCSHAPE: case ltTEXTSC: case ltSC: { if (start && (arg_no == 1)) { - char *s = GetArgData(); + wxChar *s = GetArgData(); if (s) { - char *s1 = copystring(s); + wxChar *s1 = copystring(s); int i; - for (i = 0; i < (int)strlen(s); i++) - s1[i] = toupper(s[i]); + for (i = 0; i < (int)wxStrlen(s); i++) + s1[i] = (wxChar)wxToupper(s[i]); TexOutput(s1); delete[] s1; - return FALSE; + return false; } - else return TRUE; + else return true; } - return TRUE; - break; + return true; } case ltLOWERCASE: { if (start && (arg_no == 1)) { - char *s = GetArgData(); + wxChar *s = GetArgData(); if (s) { - char *s1 = copystring(s); + wxChar *s1 = copystring(s); int i; - for (i = 0; i < (int)strlen(s); i++) - s1[i] = tolower(s[i]); + for (i = 0; i < (int)wxStrlen(s); i++) + s1[i] = (wxChar)wxTolower(s[i]); TexOutput(s1); delete[] s1; - return FALSE; + return false; } - else return TRUE; + else return true; } - return TRUE; - break; + return true; } case ltUPPERCASE: { if (start && (arg_no == 1)) { - char *s = GetArgData(); + wxChar *s = GetArgData(); if (s) { - char *s1 = copystring(s); + wxChar *s1 = copystring(s); int i; - for (i = 0; i < (int)strlen(s); i++) - s1[i] = toupper(s[i]); + for (i = 0; i < (int)wxStrlen(s); i++) + s1[i] = (wxChar)wxToupper(s[i]); TexOutput(s1); delete[] s1; - return FALSE; + return false; } - else return TRUE; + else return true; } - return TRUE; - break; + return true; } case ltPOPREF: // Ignore second argument by default - { - if (start && (arg_no == 1)) - return TRUE; - else - return FALSE; - break; - } + return (start && (arg_no == 1)); case ltTWOCOLUMN: - return TRUE; - break; + return true; case ltXLPIGNORE: - return ((convertMode == TEX_XLP) ? FALSE : TRUE); - break; + return ((convertMode == TEX_XLP) ? false : true); case ltXLPONLY: - return ((convertMode != TEX_XLP) ? FALSE : TRUE); - break; + return ((convertMode != TEX_XLP) ? false : true); case ltHTMLIGNORE: - return ((convertMode == TEX_HTML) ? FALSE : TRUE); - break; + return ((convertMode == TEX_HTML) ? false : true); case ltHTMLONLY: - return ((convertMode != TEX_HTML) ? FALSE : TRUE); - break; + return ((convertMode != TEX_HTML) ? false : true); case ltRTFIGNORE: - return (((convertMode == TEX_RTF) && !winHelp) ? FALSE : TRUE); - break; + return (((convertMode == TEX_RTF) && !winHelp) ? false : true); case ltRTFONLY: - return (!((convertMode == TEX_RTF) && !winHelp) ? FALSE : TRUE); - break; + return (!((convertMode == TEX_RTF) && !winHelp) ? false : true); case ltWINHELPIGNORE: - return (winHelp ? FALSE : TRUE); - break; + return (winHelp ? false : true); case ltWINHELPONLY: - return (!winHelp ? FALSE : TRUE); - break; + return (!winHelp ? false : true); case ltLATEXIGNORE: - return TRUE; - break; + return true; case ltLATEXONLY: - return FALSE; - break; + return false; case ltCLINE: case ltARABIC: case ltALPH1: @@ -3684,36 +3734,20 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) case ltIMAGER: case ltPOPREFONLY: case ltINSERTATLEVEL: - return FALSE; - break; + return false; case ltTABULAR: case ltSUPERTABULAR: - { - if (arg_no == 2) - return TRUE; - else return FALSE; - break; - } case ltINDENTED: - { - if (arg_no == 2) return TRUE; - else return FALSE; - break; - } case ltSIZEDBOX: case ltSIZEDBOXD: - { - if (arg_no == 2) return TRUE; - else return FALSE; - break; - } + return (arg_no == 2); case ltDEFINECOLOUR: case ltDEFINECOLOR: { static int redVal = 0; static int greenVal = 0; static int blueVal = 0; - static char *colourName = NULL; + static wxChar *colourName = NULL; if (start) { switch (arg_no) @@ -3726,17 +3760,17 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) } case 2: { - redVal = atoi(GetArgData()); + redVal = wxAtoi(GetArgData()); break; } case 3: { - greenVal = atoi(GetArgData()); + greenVal = wxAtoi(GetArgData()); break; } case 4: { - blueVal = atoi(GetArgData()); + blueVal = wxAtoi(GetArgData()); AddColour(colourName, redVal, greenVal, blueVal); break; } @@ -3744,22 +3778,14 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) break; } } - return FALSE; - break; + return false; } case ltFIGURE: case ltFIGURESTAR: case ltNORMALBOX: case ltNORMALBOXD: default: - { - if (IsArgOptional()) - return FALSE; - else - return TRUE; - break; + return (!IsArgOptional()); } - } - return TRUE; + return true; } -