X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e8469290907e3ed1ade8579932f6a9c2b6bcc949..fdf1429eea5962a8da6134d37d3c12aac259a5c0:/utils/tex2rtf/src/tex2any.cpp diff --git a/utils/tex2rtf/src/tex2any.cpp b/utils/tex2rtf/src/tex2any.cpp index 26519cf47b..8d595fdecb 100644 --- a/utils/tex2rtf/src/tex2any.cpp +++ b/utils/tex2rtf/src/tex2any.cpp @@ -21,7 +21,6 @@ #endif #ifndef WX_PRECOMP -#include "wx/wx.h" #endif #include @@ -29,6 +28,11 @@ #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 * @@ -51,14 +55,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; @@ -72,6 +76,26 @@ int hugeFont1 = 20; int HugeFont2 = 24; int HUGEFont3 = 28; +// All of these tokens MUST be found on a line by themselves (no other +// 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[] = +{ _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 +}; + + /* * USER-ADJUSTABLE SETTINGS * @@ -88,12 +112,14 @@ bool winHelp = FALSE; // Output in Windows Help format if TRUE, line 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 // (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) @@ -107,41 +133,48 @@ int winHelpVersion = 3; // WinHelp Version (3 for Windows 3.1, 4 for 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 // Linear RTF method of including bitmaps. Can be "includepicture", "hex" -char *bitmapMethod = copystring("includepicture"); +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; +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; + +extern wxHashTable TexReferences; /* * International support */ // 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 @@ -163,18 +196,18 @@ int tableNo = 0; 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 +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; +wxChar *currentArgData = NULL; bool haveArgData = FALSE; // If TRUE, we're simulating the data. TexChunk *currentArgument = NULL; TexChunk *nextChunk = NULL; @@ -185,15 +218,42 @@ 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] ++ -void TexOutput(char *s, bool ordinaryText) + +TexRef::TexRef(const wxChar *label, const wxChar *file, + const wxChar *section, const wxChar *sectionN) +{ + refLabel = copystring(label); + refFile = file ? copystring(file) : (wxChar*) NULL; + sectionNumber = section ? copystring(section) : copystring(_T("??")); + sectionName = sectionN ? copystring(sectionN) : copystring(_T("??")); +} + +TexRef::~TexRef(void) { - int len = strlen(s); + delete [] refLabel; refLabel = NULL; + delete [] refFile; refFile = NULL; + delete [] sectionNumber; sectionNumber = NULL; + delete [] sectionName; sectionName = NULL; +} + + +CustomMacro::~CustomMacro() +{ + if (macroName) + delete [] macroName; + if (macroBody) + delete [] macroBody; +} + +void TexOutput(const wxChar *s, bool ordinaryText) +{ + int len = wxStrlen(s); // Update current column, but only if we're guaranteed to // be ordinary text (not mark-up stuff) @@ -208,9 +268,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); } /* @@ -222,19 +282,19 @@ void TexOutput(char *s, bool ordinaryText) void ForbidWarning(TexMacroDef *def) { - char buf[100]; + wxString informBuf; switch (def->forbidden) { case FORBID_WARN: { - sprintf(buf, "Warning: it is recommended that command %s is not used.", def->name); - OnInform(buf); + 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: { - sprintf(buf, "Error: command %s cannot be used and will lead to errors.", def->name); - OnInform(buf); + informBuf.Printf(_T("Error: command %s cannot be used and will lead to errors."), def->name); + OnInform((const wxChar *)informBuf.c_str()); break; } default: @@ -242,15 +302,15 @@ void ForbidWarning(TexMacroDef *def) } } -TexMacroDef *MatchMacro(char *buffer, int *pos, char **env, bool *parseToBrace) +TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBrace) { *parseToBrace = TRUE; int i = (*pos); TexMacroDef *def = NULL; - char macroBuf[40]; + wxChar macroBuf[40]; // First, try to find begin{thing} - if (strncmp(buffer+i, "begin{", 6) == 0) + if (wxStrncmp(buffer+i, _T("begin{"), 6) == 0) { i += 6; @@ -321,9 +381,9 @@ TexMacroDef *MatchMacro(char *buffer, int *pos, char **env, bool *parseToBrace) 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; @@ -336,7 +396,7 @@ void EatWhiteSpace(char *buffer, int *pos) if (moreLines) { moreLines = read_a_line(buffer); - len = strlen(buffer); + len = wxStrlen(buffer); j = 0; } else @@ -346,15 +406,15 @@ void EatWhiteSpace(char *buffer, int *pos) *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); + *pos = i + 5 + wxStrlen(env); return TRUE; } else return FALSE; @@ -365,50 +425,60 @@ 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 0 +// #define CHECK_BRACES 1 -unsigned long leftCurly = 0; -unsigned long rightCurly = 0; -static wxString currentFileName = ""; +unsigned long leftCurley = 0; +unsigned long rightCurley = 0; +static wxString currentFileName = _T(""); -bool read_a_line(char *buf) +bool read_a_line(wxChar *buf) { if (CurrentInputIndex < 0) { buf[0] = 0; return FALSE; } - + int ch = -2; - int i = 0; + unsigned long bufIndex = 0; buf[0] = 0; while (ch != EOF && ch != 10) { - if (((i == 14) && (strncmp(buf, "\\end{verbatim}", 14) == 0)) || - ((i == 16) && (strncmp(buf, "\\end{toocomplex}", 16) == 0))) + if (bufIndex >= MAX_LINE_BUFFER_SIZE) + { + wxString errBuf; + errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), + LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(), MAX_LINE_BUFFER_SIZE); + OnError((wxChar *)errBuf.c_str()); + return FALSE; + } + + if (((bufIndex == 14) && (wxStrncmp(buf, _T("\\end{verbatim}"), 14) == 0)) || + ((bufIndex == 16) && (wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0))) readInVerbatim = FALSE; ch = getc(Inputs[CurrentInputIndex]); -#if CHECK_BRACES - if (ch == '{' && !readInVerbatim) - leftCurly++; - if (ch == '}' && !readInVerbatim) + if (checkCurleyBraces) { - rightCurly++; - if (rightCurly > leftCurly) - { - wxString errBuf; - errBuf.Printf("An extra right Curly brace ('}') was detected at line %l inside file %s",LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str()); - OnError((char *)errBuf.c_str()); - - // Reduce the count of right curly braces, so the mismatched count - // isn't reported on every line that has a '}' after the first mismatch - rightCurly--; - } + if (ch == '{' && !readInVerbatim) + leftCurley++; + if (ch == '}' && !readInVerbatim) + { + rightCurley++; + if (rightCurley > leftCurley) + { + wxString errBuf; + errBuf.Printf(_T("An extra right Curley brace ('}') was detected at line %lu inside file %s"), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); + OnError((wxChar *)errBuf.c_str()); + + // Reduce the count of right Curley braces, so the mismatched count + // isn't reported on every line that has a '}' after the first mismatch + rightCurley--; + } + } } -#endif if (ch != EOF) { @@ -419,133 +489,221 @@ bool read_a_line(char *buf) if ((ch1 == 10) || (ch1 == 13)) { // Eliminate newline (10) following DOS linefeed - if (ch1 == 13) ch1 = getc(Inputs[CurrentInputIndex]); - buf[i] = 0; + if (ch1 == 13) + getc(Inputs[CurrentInputIndex]); + buf[bufIndex] = 0; IncrementLineNumber(); -// strcat(buf, "\\par\n"); +// wxStrcat(buf, "\\par\n"); // i += 6; - strcat(buf, "\\par"); - i += 5; + if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE) + { + wxString errBuf; + errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), + LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); + OnError((wxChar *)errBuf.c_str()); + return FALSE; + } + wxStrcat(buf, _T("\\par")); + bufIndex += 5; + } else { ungetc(ch1, Inputs[CurrentInputIndex]); - buf[i] = ch; - i ++; + if (bufIndex >= MAX_LINE_BUFFER_SIZE) + { + wxString errBuf; + errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), + LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); + OnError((wxChar *)errBuf.c_str()); + return FALSE; + } + + buf[bufIndex] = ch; + bufIndex ++; } } else { // Convert embedded characters to RTF equivalents - switch(ch) - { - case 0xf6: // ö - case 0xe4: // ü - case 0xfc: // ü - case 0xd6: // Ö - case 0xc4: // Ä - case 0xdc: // Ü - buf[i++]='\\'; - buf[i++]='"'; - buf[i++]='{'; - switch(ch) - { - case 0xf6:buf[i++]='o';break; // ö - case 0xe4:buf[i++]='a';break; // ä - case 0xfc:buf[i++]='u';break; // ü - case 0xd6:buf[i++]='O';break; // Ö - case 0xc4:buf[i++]='A';break; // Ä - case 0xdc:buf[i++]='U';break; // Ü - } - buf[i++]='}'; - break; - case 0xdf: // ß - buf[i++]='\\'; - buf[i++]='s'; - buf[i++]='s'; - buf[i++]='\\'; - buf[i++]='/'; - break; - default: - buf[i++] = ch; - break; - } - - } + switch(ch) + { + case 0xf6: // ö + case 0xe4: // ü + case 0xfc: // ü + case 0xd6: // Ö + case 0xc4: // Ä + case 0xdc: // Ü + if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE) + { + wxString errBuf; + errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), + LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); + OnError((wxChar *)errBuf.c_str()); + return FALSE; + } + buf[bufIndex++]='\\'; + buf[bufIndex++]='"'; + buf[bufIndex++]='{'; + switch(ch) + { + case 0xf6:buf[bufIndex++]='o';break; // ö + case 0xe4:buf[bufIndex++]='a';break; // ä + case 0xfc:buf[bufIndex++]='u';break; // ü + case 0xd6:buf[bufIndex++]='O';break; // Ö + case 0xc4:buf[bufIndex++]='A';break; // Ä + case 0xdc:buf[bufIndex++]='U';break; // Ü + } + buf[bufIndex++]='}'; + break; + case 0xdf: // ß + if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE) + { + wxString errBuf; + errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), + LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); + OnError((wxChar *)errBuf.c_str()); + return FALSE; + } + buf[bufIndex++]='\\'; + buf[bufIndex++]='s'; + buf[bufIndex++]='s'; + buf[bufIndex++]='\\'; + buf[bufIndex++]='/'; + break; + default: + if (bufIndex >= MAX_LINE_BUFFER_SIZE) + { + wxString errBuf; + errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), + LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); + OnError((wxChar *)errBuf.c_str()); + return FALSE; + } + // 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; + break; + } + + if (checkSyntax) + { + if (readInVerbatim) + { + // 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 + { + // 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; + break; + } // switch + } // else } else { - buf[i] = 0; + buf[bufIndex] = 0; fclose(Inputs[CurrentInputIndex]); Inputs[CurrentInputIndex] = NULL; if (CurrentInputIndex > 0) ch = ' '; // No real end of file CurrentInputIndex --; -#if CHECK_BRACES - if (leftCurly != rightCurly) + + if (checkCurleyBraces) { - wxString errBuf; - errBuf.Printf("Curly braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName.c_str(),leftCurly,rightCurly); - OnError((char *)errBuf.c_str()); + if (leftCurley != rightCurley) + { + wxString errBuf; + errBuf.Printf(_T("Curley braces do not match inside file %s\n%lu opens, %lu closes"), + (const wxChar*) currentFileName.c_str(),leftCurley,rightCurley); + OnError((wxChar *)errBuf.c_str()); + } + leftCurley = 0; + rightCurley = 0; } - leftCurly = 0; - rightCurly = 0; -#endif + if (readingVerbatim) { readingVerbatim = FALSE; readInVerbatim = FALSE; - strcat(buf, "\\end{verbatim}\n"); + wxStrcat(buf, _T("\\end{verbatim}\n")); return FALSE; } } if (ch == 10) IncrementLineNumber(); } - buf[i] = 0; + 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 = i - 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 + if (buf[j-1] == '}') + buf[j-1] = 0; // Ignore final brace wxString actualFile = TexPathList.FindValidPath(fileName); currentFileName = actualFile; - if (actualFile == "") + if (actualFile == _T("")) { - char errBuf[300]; - strcpy(errBuf, "Could not find file: "); - strncat(errBuf, fileName, 100); - OnError(errBuf); + wxString errBuf; + 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]; @@ -554,71 +712,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"); + wxStrcpy(buf, _T("\\begin{verbatim}\n")); 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 = i - 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] == '}') buf[j-1] = 0; // Ignore final brace + 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 == _T("")) { - char buf2[400]; - sprintf(buf2, "%s.tex", (const char*) fileNameStr); + wxChar buf2[400]; + wxSprintf(buf2, _T("%s.tex"), fileNameStr.c_str()); actualFile = TexPathList.FindValidPath(buf2); } currentFileName = actualFile; - if (actualFile == "") + if (actualFile == _T("")) { - char errBuf[300]; - strcpy(errBuf, "Could not find file: "); - strncat(errBuf, fileName, 100); - OnError(errBuf); + wxString errBuf; + errBuf.Printf(_T("Could not find file: %s"),fileName); + OnError((wxChar *)errBuf.c_str()); } else { @@ -627,10 +785,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]; @@ -638,54 +797,89 @@ bool read_a_line(char *buf) if (!Inputs[CurrentInputIndex]) { - char errBuf[300]; - sprintf(errBuf, "Could not open include file %s", (const char*) actualFile); + wxString errBuf; + errBuf.Printf(_T("Could not open include file %s"), (const wxChar*) actualFile); CurrentInputIndex --; - OnError(errBuf); + OnError((wxChar *)errBuf.c_str()); } } bool succ = read_a_line(buf); return succ; } - if (strncmp(buf, "\\begin{verbatim}", 16) == 0 || - strncmp(buf, "\\begin{toocomplex}", 18) == 0) + + if (checkSyntax) + { + wxString bufStr = buf; + for (int index=0; syntaxTokens[index] != wxEmptyString; index++) + { + size_t pos = bufStr.find(syntaxTokens[index]); + if (pos != wxString::npos && pos != 0) + { + size_t commentStart = bufStr.find(_T("%")); + if (commentStart == wxString::npos || commentStart > pos) + { + wxString errBuf; + if (syntaxTokens[index] == _T("\\verb")) + { + 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(_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((wxChar *)errBuf.c_str()); + } + } + } + } // checkSyntax + + if (wxStrncmp(buf, _T("\\begin{verbatim}"), 16) == 0 || + wxStrncmp(buf, _T("\\begin{toocomplex}"), 18) == 0) readInVerbatim = TRUE; - else if (strncmp(buf, "\\end{verbatim}", 14) == 0 || - strncmp(buf, "\\end{toocomplex}", 16) == 0) + else if (wxStrncmp(buf, _T("\\end{verbatim}"), 14) == 0 || + wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0) readInVerbatim = FALSE; -#if CHECK_BRACES - if (ch == EOF && leftCurly != rightCurly) + if (checkCurleyBraces) { - wxString errBuf; - errBuf.Printf("Curly braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName.c_str(),leftCurly,rightCurly); - OnError((char *)errBuf.c_str()); + if (ch == EOF && leftCurley != rightCurley) + { + wxString errBuf; + errBuf.Printf(_T("Curley braces do not match inside file %s\n%lu opens, %lu closes"), + (const wxChar*) currentFileName.c_str(),leftCurley,rightCurley); + OnError((wxChar *)errBuf.c_str()); + } } -#endif return (ch == EOF); -} +} // read_a_line /* * Parse newcommand * */ -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; @@ -694,7 +888,7 @@ 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; @@ -705,9 +899,9 @@ bool ParseNewCommand(char *buffer, int *pos) while (!end) { char ch = buffer[*pos]; - if (ch == '{') + if (ch == _T('{')) braceCount ++; - else if (ch == '}') + else if (ch == _T('}')) { braceCount --; if (braceCount == 0) @@ -715,8 +909,8 @@ bool ParseNewCommand(char *buffer, int *pos) } else if (ch == 0) { - if (!read_a_line(buffer)) - end = TRUE; + end = !read_a_line(buffer); + wxUnusedVar(end); *pos = 0; break; } @@ -727,7 +921,7 @@ 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)) { @@ -739,10 +933,10 @@ bool ParseNewCommand(char *buffer, int *pos) else return FALSE; } -void MacroError(char *buffer) +void MacroError(wxChar *buffer) { - char errBuf[300]; - char macroBuf[200]; + wxString errBuf; + wxChar macroBuf[200]; macroBuf[0] = '\\'; int i = 1; char ch; @@ -755,9 +949,15 @@ void MacroError(char *buffer) if (i > 20) macroBuf[20] = 0; - sprintf(errBuf, "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(errBuf); + OnError((wxChar *)errBuf.c_str()); + + if (wxStrcmp(macroBuf,_T("\\end{document}")) == 0) + { + OnInform( _T("Halted build due to unrecoverable error.") ); + stopRunning = TRUE; + } } /* @@ -768,7 +968,7 @@ void MacroError(char *buffer) * 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; @@ -820,7 +1020,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); } @@ -829,23 +1028,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) - if (strncmp(buffer, "\\begin{verbatim}", 16) == 0 || - strncmp(buffer, "\\begin{toocomplex}", 18) == 0) + wxString bufStr = buffer; +// if (bufStr.find("\\begin{verbatim}") != wxString::npos || +// bufStr.find("\\begin{toocomplex}") != wxString::npos) + 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); } @@ -853,14 +1053,14 @@ 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); buf_ptr = 0; @@ -881,7 +1081,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; @@ -904,13 +1104,11 @@ 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); } if (ch == '}') pos ++; return pos; - break; } case '\\': { @@ -924,7 +1122,6 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e } pos ++; - // Try matching \end{environment} if (environment && FindEndEnvironment(buffer, &pos, environment)) { @@ -941,7 +1138,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; @@ -949,7 +1146,7 @@ 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; while (!end) @@ -960,37 +1157,37 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e noBraces --; if (noBraces == 0) { - wxBuffer[i] = 0; + wxTex2RTFBuffer[i] = 0; end = TRUE; } else { - wxBuffer[i] = '}'; + wxTex2RTFBuffer[i] = '}'; i ++; } pos ++; } else if (ch == '{') { - wxBuffer[i] = '{'; + wxTex2RTFBuffer[i] = '{'; i ++; pos ++; } else if (ch == '\\' && buffer[pos+1] == '}') { - wxBuffer[i] = '}'; + wxTex2RTFBuffer[i] = '}'; pos += 2; i++; } else if (ch == '\\' && buffer[pos+1] == '{') { - wxBuffer[i] = '{'; + wxTex2RTFBuffer[i] = '{'; pos += 2; i++; } else { - wxBuffer[i] = ch; + wxTex2RTFBuffer[i] = ch; pos ++; i ++; if (ch == 0) @@ -1000,7 +1197,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 = 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); @@ -1011,11 +1208,11 @@ 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] == '*') @@ -1028,7 +1225,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e 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++) { @@ -1041,7 +1238,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); @@ -1056,9 +1253,9 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e children.Append((wxObject *)chunk); } - else - { - char *env = NULL; + else + { + wxChar *env = NULL; bool tmpParseToBrace = TRUE; TexMacroDef *def = MatchMacro(buffer, &pos, &env, &tmpParseToBrace); if (def) @@ -1066,6 +1263,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e CustomMacro *customMacro = FindCustomMacro(def->name); TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO, def); + chunk->no_args = def->no_args; // chunk->name = copystring(def->name); chunk->macroId = def->macroId; @@ -1074,7 +1272,7 @@ 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 (env || wxStrcmp(def->name, _T("\\")) == 0) if (buffer[pos] == 13) { pos ++; @@ -1090,10 +1288,10 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e { if (customMacro->macroBody) { - char macroBuf[300]; -// strcpy(macroBuf, "{"); - strcpy(macroBuf, customMacro->macroBody); - strcat(macroBuf, "}"); + wxChar macroBuf[300]; +// wxStrcpy(macroBuf, _T("{")); + wxStrcpy(macroBuf, customMacro->macroBody); + wxStrcat(macroBuf, _T("}")); ParseArg(thisArg, children, macroBuf, 0, NULL, TRUE, chunk); } @@ -1124,7 +1322,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) @@ -1146,15 +1344,15 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e { if (customMacro->macroBody) { - char macroBuf[300]; -// strcpy(macroBuf, "{"); - strcpy(macroBuf, customMacro->macroBody); - strcat(macroBuf, "}"); + 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 - } + } } else { @@ -1162,7 +1360,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 @@ -1170,7 +1368,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) @@ -1195,7 +1393,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e arg->macroId = chunk->macroId; pos = ParseArg(arg, arg->children, buffer, pos, NULL, TRUE, customMacroArgs); - } + } break; } case '$': @@ -1215,7 +1413,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 = ltSPECIALDOUBLEDOLLAR; children.Append((wxObject *)chunk); pos ++; @@ -1224,7 +1422,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 = ltSPECIALDOLLAR; children.Append((wxObject *)chunk); } @@ -1244,7 +1442,7 @@ 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; @@ -1265,7 +1463,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); } @@ -1275,10 +1473,10 @@ 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)); } } @@ -1309,7 +1507,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 = ltSPECIALAMPERSAND; children.Append((wxObject *)chunk); break; @@ -1357,9 +1555,9 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e * */ -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(); @@ -1394,7 +1592,7 @@ 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 @@ -1422,6 +1620,19 @@ int ParseMacroBody(char *macro_name, TexChunk *parent, isOptional = TRUE; pos += 2; } + else if (i > 0) + { + wxString errBuf; + wxString tmpBuffer(buffer); + if (tmpBuffer.length() > 4) + { + if (tmpBuffer.Right(4) == _T("\\par")) + tmpBuffer = tmpBuffer.Mid(0,tmpBuffer.length()-4); + } + errBuf.Printf(_T("Missing macro argument in the line:\n\t%s\n"),tmpBuffer.c_str()); + OnError((wxChar *)errBuf.c_str()); + } + } arg->optional = isOptional; @@ -1439,39 +1650,39 @@ 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(wxChar *filename) { + static wxChar *line_buffer; stopRunning = FALSE; - strcpy(TexFileRoot, filename); + wxStrcpy(TexFileRoot, filename); StripExtension(TexFileRoot); - sprintf(TexBibName, "%s.bb", TexFileRoot); - sprintf(TexTmpBibName, "%s.bb1", TexFileRoot); + wxSprintf(TexBibName, _T("%s.bb"), TexFileRoot); + wxSprintf(TexTmpBibName, _T("%s.bb1"), TexFileRoot); TexPathList.EnsureFileAccessible(filename); -#ifdef __WXMSW__ - static char *line_buffer = new char[600]; -#else - static char *line_buffer = new char[11000]; -#endif + if (line_buffer) + delete line_buffer; + + line_buffer = new wxChar[MAX_LINE_BUFFER_SIZE]; - Inputs[0] = fopen(filename, "r"); + Inputs[0] = wxFopen(filename, _T("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); + ParseMacroBody(_T("toplevel"), TopLevel, 1, line_buffer, 0, NULL, TRUE); if (Inputs[0]) fclose(Inputs[0]); return TRUE; } @@ -1479,7 +1690,7 @@ bool TexLoadFile(char *filename) 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; @@ -1524,12 +1735,12 @@ TexChunk::TexChunk(TexChunk& toCopy) 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(); } } @@ -1537,12 +1748,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; } @@ -1573,44 +1784,44 @@ 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); @@ -1618,7 +1829,7 @@ char *GetArgData(TexChunk *chunk) return currentArgData; } -char *GetArgData(void) +wxChar *GetArgData(void) { if (!haveArgData) { @@ -1670,15 +1881,16 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly) if (!childrenOnly) OnMacro(chunk->macroId, chunk->no_args, 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(); } - 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); @@ -1695,18 +1907,19 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly) 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; @@ -1724,7 +1937,9 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly) // If non-whitespace text, we no longer have a new paragraph. if (issuedNewParagraph && !((chunk->value[0] == 10 || chunk->value[0] == 13 || chunk->value[0] == 32) && chunk->value[1] == 0)) + { issuedNewParagraph = FALSE; + } TexOutput(chunk->value, TRUE); } break; @@ -1749,7 +1964,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)); } @@ -1758,10 +1973,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++) @@ -1771,18 +1986,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) @@ -1806,7 +2021,7 @@ void TexCleanUp(void) 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; @@ -1815,37 +2030,47 @@ 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; -/* Don't want to remove custom macros after each pass. - SetFontSizes(10); - wxNode *node = CustomMacroList.First(); - while (node) - { - CustomMacro *macro = (CustomMacro *)node->Data(); - delete macro; - delete node; - node = CustomMacroList.First(); + + // gt - Changed this so if this is the final pass + // then we DO want to remove these macros, so that + // memory is not MASSIVELY leaked if the user + // does not exit the program, but instead runs + // the program again + if ((passNumber == 1 && !runTwice) || + (passNumber == 2 && runTwice)) + { +/* Don't want to remove custom macros after each pass.*/ + SetFontSizes(10); + wxNode *node = CustomMacroList.GetFirst(); + while (node) + { + CustomMacro *macro = (CustomMacro *)node->GetData(); + delete macro; + delete node; + node = CustomMacroList.GetFirst(); + } } -*/ +/**/ TexReferences.BeginFind(); wxNode *node = TexReferences.Next(); while (node) { - TexRef *ref = (TexRef *)node->Data(); + TexRef *ref = (TexRef *)node->GetData(); delete ref; node = TexReferences.Next(); } TexReferences.Clear(); - node = BibList.First(); + node = BibList.GetFirst(); while (node) { - BibEntry *entry = (BibEntry *)node->Data(); + BibEntry *entry = (BibEntry *)node->GetData(); delete entry; delete node; - node = BibList.First(); + node = BibList.GetFirst(); } CitationList.Clear(); ResetTopicCounter(); @@ -1857,484 +2082,485 @@ 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(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, "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(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); } /* @@ -2386,105 +2612,105 @@ void DefaultOnMacro(int macroId, int no_args, bool start) } case ltSPECIALAMPERSAND: if (start) - TexOutput(" "); + TexOutput(_T(" ")); break; case ltCINSERT: if (start) - TexOutput("<<", TRUE); + TexOutput(_T("<<"), TRUE); break; case ltCEXTRACT: if (start) - TexOutput(">>", TRUE); + 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); + 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); + TexOutput(_T("£"), TRUE); break; case ltSPECIALDOUBLEDOLLAR: // Interpret as center OnMacro(ltCENTER, no_args, start); @@ -2507,7 +2733,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; } @@ -2518,389 +2744,389 @@ 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) TexOutput(_T("<=")); break; case ltLL: - if (start) TexOutput("<<"); + if (start) 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) TexOutput(_T(">=")); break; case ltGG: - if (start) TexOutput(">>"); + if (start) 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) TexOutput(_T("<--")); break; case ltLEFTARROW2: - if (start) TexOutput("<=="); + if (start) TexOutput(_T("<==")); break; case ltRIGHTARROW: - if (start) TexOutput("-->"); + if (start) TexOutput(_T("-->")); break; case ltRIGHTARROW2: - if (start) TexOutput("==>"); + if (start) TexOutput(_T("==>")); break; case ltLEFTRIGHTARROW: - if (start) TexOutput("<-->"); + if (start) TexOutput(_T("<-->")); break; case ltLEFTRIGHTARROW2: - if (start) TexOutput("<==>"); + if (start) 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; @@ -2916,7 +3142,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); @@ -2924,11 +3150,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) { @@ -2944,13 +3170,12 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) } else { - char buf[300]; - TexOutput("??", TRUE); - sprintf(buf, "Warning: unresolved reference %s.", refName); - OnInform(buf); + wxString informBuf; + informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName); + OnInform((wxChar *)informBuf.c_str()); } } - else TexOutput("??", TRUE); + else TexOutput(_T("??"), TRUE); return FALSE; } break; @@ -2958,28 +3183,24 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) case ltLABEL: { return FALSE; - break; } case ltAUTHOR: { if (start && (arg_no == 1)) DocumentAuthor = GetArgChunk(); return FALSE; - break; } case ltDATE: { if (start && (arg_no == 1)) DocumentDate = GetArgChunk(); return FALSE; - break; } case ltTITLE: { if (start && (arg_no == 1)) DocumentTitle = GetArgChunk(); return FALSE; - break; } case ltDOCUMENTCLASS: case ltDOCUMENTSTYLE: @@ -2987,27 +3208,27 @@ 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); + wxSprintf(currentArgData, _T("%d"), normalFont); haveArgData = TRUE; OnArgument(ltHELPFONTSIZE, 1, TRUE); OnArgument(ltHELPFONTSIZE, 1, FALSE); @@ -3018,22 +3239,20 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { 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; } case ltBIBLIOGRAPHYSTYLE: { if (start && !IsArgOptional()) BibliographyStyleString = copystring(GetArgData()); return FALSE; - break; } case ltPAGESTYLE: { @@ -3043,7 +3262,6 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) PageStyle = copystring(GetArgData()); } return FALSE; - break; } /* case ltLHEAD: @@ -3094,9 +3312,9 @@ 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); @@ -3104,17 +3322,17 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) if (ref) { TexOutput(ref->sectionNumber, TRUE); - if (strcmp(ref->sectionNumber, "??") == 0) + if (wxStrcmp(ref->sectionNumber, _T("??")) == 0) { - char buf[300]; - sprintf(buf, "Warning: unresolved citation %s.", citeKey); - OnInform(buf); + wxString informBuf; + 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; @@ -3125,7 +3343,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (start && !IsArgOptional()) { - char *citeKey = GetArgData(); + wxChar *citeKey = GetArgData(); AddCitation(citeKey); return FALSE; } @@ -3135,12 +3353,12 @@ 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; } @@ -3150,7 +3368,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) { if (start) { - TexOutput(" ??", TRUE); + TexOutput(_T(" ??"), TRUE); return FALSE; } break; @@ -3159,7 +3377,7 @@ 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; } @@ -3169,7 +3387,7 @@ 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; } @@ -3178,12 +3396,10 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) case ltSL: { return OnArgument(ltIT, arg_no, start); - break; } case ltSPECIALDOUBLEDOLLAR: { return OnArgument(ltCENTER, arg_no, start); - break; } case ltPARAGRAPH: case ltPARAGRAPHSTAR: @@ -3191,7 +3407,6 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) case ltSUBPARAGRAPHSTAR: { return OnArgument(ltSUBSUBSECTION, arg_no, start); - break; } case ltTYPEOUT: { @@ -3202,20 +3417,20 @@ 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; @@ -3229,37 +3444,37 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) } 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 == _T("")) { - strcat(fileBuf, ".bib"); + wxStrcat(fileBuf, _T(".bib")); actualFile = TexPathList.FindValidPath(fileBuf); } - if (actualFile != "") + if (actualFile != _T("")) { - if (!ReadBib((char*) (const char*) actualFile)) + if (!ReadBib((wxChar*) (const wxChar*) actualFile)) { - char buf[300]; - sprintf(buf, ".bib file %s not found or malformed", (const char*) actualFile); - OnError(buf); + wxString errBuf; + errBuf.Printf(_T(".bib file %s not found or malformed"), (const wxChar*) actualFile); + OnError((wxChar *)errBuf.c_str()); } } else { - char buf[300]; - sprintf(buf, ".bib file %s not found", fileBuf); - OnError(buf); + wxString errBuf; + errBuf.Printf(_T(".bib file %s not found"), fileBuf); + OnError((wxChar *)errBuf.c_str()); } bibFile = ParseMultifieldString(allFiles, &pos); } @@ -3269,7 +3484,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); @@ -3284,26 +3499,20 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) 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] = wxToupper(s[i]); TexOutput(s1); delete[] s1; return FALSE; @@ -3312,19 +3521,18 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) } return TRUE; - break; } 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] = wxTolower(s[i]); TexOutput(s1); delete[] s1; return FALSE; @@ -3333,19 +3541,18 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) } return TRUE; - break; } 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] = wxToupper(s[i]); TexOutput(s1); delete[] s1; return FALSE; @@ -3354,49 +3561,31 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) } return TRUE; - break; } 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; case ltXLPIGNORE: return ((convertMode == TEX_XLP) ? FALSE : TRUE); - break; case ltXLPONLY: return ((convertMode != TEX_XLP) ? FALSE : TRUE); - break; case ltHTMLIGNORE: return ((convertMode == TEX_HTML) ? FALSE : TRUE); - break; case ltHTMLONLY: return ((convertMode != TEX_HTML) ? FALSE : TRUE); - break; case ltRTFIGNORE: return (((convertMode == TEX_RTF) && !winHelp) ? FALSE : TRUE); - break; case ltRTFONLY: return (!((convertMode == TEX_RTF) && !winHelp) ? FALSE : TRUE); - break; case ltWINHELPIGNORE: return (winHelp ? FALSE : TRUE); - break; case ltWINHELPONLY: return (!winHelp ? FALSE : TRUE); - break; case ltLATEXIGNORE: return TRUE; - break; case ltLATEXONLY: return FALSE; - break; case ltCLINE: case ltARABIC: case ltALPH1: @@ -3467,35 +3656,19 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) case ltPOPREFONLY: case ltINSERTATLEVEL: return FALSE; - break; 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) @@ -3508,17 +3681,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; } @@ -3527,20 +3700,13 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start) } } return FALSE; - break; } case ltFIGURE: case ltFIGURESTAR: case ltNORMALBOX: case ltNORMALBOXD: default: - { - if (IsArgOptional()) - return FALSE; - else - return TRUE; - break; - } + return (!IsArgOptional()); } return TRUE; }