Replaced wxBuffer with wxTex2RTFBuffer

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-03-22 20:25:49 +00:00
parent 2a0951be51
commit aed3314d6e
5 changed files with 33 additions and 40 deletions

View File

@@ -720,8 +720,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
// Add this section title to the list of keywords // Add this section title to the list of keywords
if (htmlIndex) if (htmlIndex)
{ {
OutputCurrentSectionToString(wxBuffer); OutputCurrentSectionToString(wxTex2RTFBuffer);
AddKeyWordForTopic(topicName, wxBuffer, ConvertCase(currentFileName)); AddKeyWordForTopic(topicName, wxTex2RTFBuffer, ConvertCase(currentFileName));
} }
} }
break; break;
@@ -782,8 +782,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
// Add this section title to the list of keywords // Add this section title to the list of keywords
if (htmlIndex) if (htmlIndex)
{ {
OutputCurrentSectionToString(wxBuffer); OutputCurrentSectionToString(wxTex2RTFBuffer);
AddKeyWordForTopic(topicName, wxBuffer, currentFileName); AddKeyWordForTopic(topicName, wxTex2RTFBuffer, currentFileName);
} }
} }
break; break;
@@ -889,8 +889,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
// Add this section title to the list of keywords // Add this section title to the list of keywords
if (htmlIndex) if (htmlIndex)
{ {
OutputCurrentSectionToString(wxBuffer); OutputCurrentSectionToString(wxTex2RTFBuffer);
AddKeyWordForTopic(topicName, wxBuffer, currentFileName); AddKeyWordForTopic(topicName, wxTex2RTFBuffer, currentFileName);
} }
} }
@@ -967,8 +967,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
// Add this section title to the list of keywords // Add this section title to the list of keywords
if (htmlIndex) if (htmlIndex)
{ {
OutputCurrentSectionToString(wxBuffer); OutputCurrentSectionToString(wxTex2RTFBuffer);
AddKeyWordForTopic(topicName, wxBuffer, currentFileName); AddKeyWordForTopic(topicName, wxTex2RTFBuffer, currentFileName);
} }
} }
} }

View File

@@ -213,18 +213,18 @@ void ResetContentsLevels(int l)
// : for space. // : for space.
void OutputSectionKeyword(FILE *fd) void OutputSectionKeyword(FILE *fd)
{ {
OutputCurrentSectionToString(wxBuffer); OutputCurrentSectionToString(wxTex2RTFBuffer);
unsigned int i; unsigned int i;
for (i = 0; i < strlen(wxBuffer); i++) for (i = 0; i < strlen(wxTex2RTFBuffer); i++)
if (wxBuffer[i] == ':') if (wxTex2RTFBuffer[i] == ':')
wxBuffer[i] = ' '; wxTex2RTFBuffer[i] = ' ';
// Don't write to index if there's some RTF in the string // Don't write to index if there's some RTF in the string
else if ( wxBuffer[i] == '{' ) else if ( wxTex2RTFBuffer[i] == '{' )
return; return;
fprintf(fd, "K{\\footnote {K} "); fprintf(fd, "K{\\footnote {K} ");
fprintf(fd, "%s", wxBuffer); fprintf(fd, "%s", wxTex2RTFBuffer);
fprintf(fd, "}\n"); fprintf(fd, "}\n");
} }
@@ -1113,8 +1113,8 @@ void RTFOnMacro(int macroId, int no_args, bool start)
if (winHelpContents && winHelp && !InPopups()) if (winHelpContents && winHelp && !InPopups())
{ {
OutputCurrentSectionToString(wxBuffer); OutputCurrentSectionToString(wxTex2RTFBuffer);
WriteWinHelpContentsFileLine(topicName, wxBuffer, 1); WriteWinHelpContentsFileLine(topicName, wxTex2RTFBuffer, 1);
} }
AddTexRef(topicName, NULL, ChapterNameString, chapterNo); AddTexRef(topicName, NULL, ChapterNameString, chapterNo);
@@ -1255,8 +1255,8 @@ void RTFOnMacro(int macroId, int no_args, bool start)
NotifyParentHasChildren(1); NotifyParentHasChildren(1);
if (winHelpContents && winHelp && !InPopups()) if (winHelpContents && winHelp && !InPopups())
{ {
OutputCurrentSectionToString(wxBuffer); OutputCurrentSectionToString(wxTex2RTFBuffer);
WriteWinHelpContentsFileLine(topicName, wxBuffer, 2); WriteWinHelpContentsFileLine(topicName, wxTex2RTFBuffer, 2);
} }
AddTexRef(topicName, NULL, SectionNameString, chapterNo, sectionNo); AddTexRef(topicName, NULL, SectionNameString, chapterNo, sectionNo);
@@ -1439,8 +1439,8 @@ void RTFOnMacro(int macroId, int no_args, bool start)
NotifyParentHasChildren(2); NotifyParentHasChildren(2);
if (winHelpContents && winHelp && !InPopups()) if (winHelpContents && winHelp && !InPopups())
{ {
OutputCurrentSectionToString(wxBuffer); OutputCurrentSectionToString(wxTex2RTFBuffer);
WriteWinHelpContentsFileLine(topicName, wxBuffer, 3); WriteWinHelpContentsFileLine(topicName, wxTex2RTFBuffer, 3);
} }
AddTexRef(topicName, NULL, SectionNameString, chapterNo, sectionNo, subsectionNo); AddTexRef(topicName, NULL, SectionNameString, chapterNo, sectionNo, subsectionNo);
@@ -1589,8 +1589,8 @@ void RTFOnMacro(int macroId, int no_args, bool start)
NotifyParentHasChildren(3); NotifyParentHasChildren(3);
if (winHelpContents && winHelp) if (winHelpContents && winHelp)
{ {
OutputCurrentSectionToString(wxBuffer); OutputCurrentSectionToString(wxTex2RTFBuffer);
WriteWinHelpContentsFileLine(topicName, wxBuffer, 4); WriteWinHelpContentsFileLine(topicName, wxTex2RTFBuffer, 4);
} }
AddTexRef(topicName, NULL, SectionNameString, chapterNo, sectionNo, subsectionNo, subsubsectionNo); AddTexRef(topicName, NULL, SectionNameString, chapterNo, sectionNo, subsectionNo, subsubsectionNo);

View File

@@ -1145,7 +1145,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e
pos ++; pos ++;
int noBraces = 1; int noBraces = 1;
wxBuffer[0] = 0; wxTex2RTFBuffer[0] = 0;
int i = 0; int i = 0;
bool end = FALSE; bool end = FALSE;
while (!end) while (!end)
@@ -1156,37 +1156,37 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e
noBraces --; noBraces --;
if (noBraces == 0) if (noBraces == 0)
{ {
wxBuffer[i] = 0; wxTex2RTFBuffer[i] = 0;
end = TRUE; end = TRUE;
} }
else else
{ {
wxBuffer[i] = '}'; wxTex2RTFBuffer[i] = '}';
i ++; i ++;
} }
pos ++; pos ++;
} }
else if (ch == '{') else if (ch == '{')
{ {
wxBuffer[i] = '{'; wxTex2RTFBuffer[i] = '{';
i ++; i ++;
pos ++; pos ++;
} }
else if (ch == '\\' && buffer[pos+1] == '}') else if (ch == '\\' && buffer[pos+1] == '}')
{ {
wxBuffer[i] = '}'; wxTex2RTFBuffer[i] = '}';
pos += 2; pos += 2;
i++; i++;
} }
else if (ch == '\\' && buffer[pos+1] == '{') else if (ch == '\\' && buffer[pos+1] == '{')
{ {
wxBuffer[i] = '{'; wxTex2RTFBuffer[i] = '{';
pos += 2; pos += 2;
i++; i++;
} }
else else
{ {
wxBuffer[i] = ch; wxTex2RTFBuffer[i] = ch;
pos ++; pos ++;
i ++; i ++;
if (ch == 0) if (ch == 0)
@@ -1207,7 +1207,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, char *e
TexChunk *argValue = new TexChunk(CHUNK_TYPE_STRING); TexChunk *argValue = new TexChunk(CHUNK_TYPE_STRING);
arg->children.Append((wxObject *)argValue); arg->children.Append((wxObject *)argValue);
argValue->argn = 1; argValue->argn = 1;
argValue->value = copystring(wxBuffer); argValue->value = copystring(wxTex2RTFBuffer);
children.Append((wxObject *)chunk); children.Append((wxObject *)chunk);
} }

View File

@@ -139,6 +139,7 @@ extern wxHashTable TopicTable;
void AddKeyWordForTopic(char *topic, char *entry, char *filename = NULL); void AddKeyWordForTopic(char *topic, char *entry, char *filename = NULL);
void ClearKeyWordTable(void); void ClearKeyWordTable(void);
extern char wxTex2RTFBuffer[];
extern TexChunk *TopLevel; extern TexChunk *TopLevel;
extern wxHashTable MacroDefs; extern wxHashTable MacroDefs;
extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.tex extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.tex

View File

@@ -132,13 +132,9 @@ int BufSize = 500;
bool Go(void); bool Go(void);
void ShowOptions(void); void ShowOptions(void);
#ifdef NO_GUI char wxTex2RTFBuffer[1500];
#if wxUSE_GUI || !defined(__UNIX__) #ifdef NO_GUI
// wxBase for Unix does not have wxBuffer
extern
#endif
char *wxBuffer; // we must init it, otherwise tex2rtf will crash
int main(int argc, char **argv) int main(int argc, char **argv)
#else #else
@@ -187,9 +183,6 @@ bool MyApp::OnInit()
} }
#ifdef NO_GUI #ifdef NO_GUI
wxBuffer = new char[1500];
// this is done in wxApp, but NO_GUI version doesn't call it :-(
if (!InputFile || !OutputFile) if (!InputFile || !OutputFile)
{ {
wxSTD cout << "Tex2RTF: input or output file is missing.\n"; wxSTD cout << "Tex2RTF: input or output file is missing.\n";
@@ -446,7 +439,6 @@ bool MyApp::OnInit()
// Return the main frame window // Return the main frame window
return TRUE; return TRUE;
#else #else
delete[] wxBuffer;
return FALSE; return FALSE;
#endif #endif
} }