]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/tex2rtf/src/rtfutils.cpp
Add a couple of wxPerl notes.
[wxWidgets.git] / utils / tex2rtf / src / rtfutils.cpp
index a33c1628b8637ab9e89cdae83daad4caa624e0d2..ef7a7456831653502282a47d077e486c93a811f3 100644 (file)
@@ -21,7 +21,6 @@
 #endif
 
 #ifndef WX_PRECOMP
 #endif
 
 #ifndef WX_PRECOMP
-#include "wx/wx.h"
 #endif
 
 #include "tex2any.h"
 #endif
 
 #include "tex2any.h"
 #include "bmputils.h"
 #include "table.h"
 
 #include "bmputils.h"
 #include "table.h"
 
+#if !WXWIN_COMPATIBILITY_2_4
+static inline wxChar* copystring(const wxChar* s)
+    { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); }
+#endif
+
 wxList itemizeStack;
 static int indentLevel = 0;
 static int forbidParindent = 0; // if > 0, no parindent (e.g. in center environment)
 wxList itemizeStack;
 static int indentLevel = 0;
 static int forbidParindent = 0; // if > 0, no parindent (e.g. in center environment)
@@ -243,7 +247,6 @@ void WriteWinHelpContentsFileLine(char *topicName, char *xitle, int level)
                  char ch1=xitle[s+1]&0xff;
                  char ch2=xitle[s+2]&0xff;
                  char ch3=xitle[s+3]&0xff;
                  char ch1=xitle[s+1]&0xff;
                  char ch2=xitle[s+2]&0xff;
                  char ch3=xitle[s+3]&0xff;
-                 char ch4=xitle[s+4]&0xff;
                  s+=4; // next character                 
                  char a=0;
                  if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x36)) { title[d++]='ö';  a=1; }
                  s+=4; // next character                 
                  char a=0;
                  if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x36)) { title[d++]='ö';  a=1; }
@@ -527,7 +530,7 @@ bool WriteHPJ(char *filename)
   StripExtension(hpjFilename);
   strcat(hpjFilename, ".hpj");
 
   StripExtension(hpjFilename);
   strcat(hpjFilename, ".hpj");
 
-  strcpy(helpFile, FileNameFromPath(filename));
+  strcpy(helpFile, wxFileNameFromPath(filename));
   StripExtension(helpFile);
   strcpy(rtfFile, helpFile);
   strcat(helpFile, ".hlp");
   StripExtension(helpFile);
   strcpy(rtfFile, helpFile);
   strcat(helpFile, ".hlp");
@@ -1195,7 +1198,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
             fprintf(Chapters, "!{\\footnote DisableButton(\"Up\")}\n");
           else
             fprintf(Chapters, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
             fprintf(Chapters, "!{\\footnote DisableButton(\"Up\")}\n");
           else
             fprintf(Chapters, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
-               FileNameFromPath(FileRoot), "Contents");
+               wxFileNameFromPath(FileRoot), "Contents");
         }
       }
 
         }
       }
 
@@ -1350,12 +1353,12 @@ void RTFOnMacro(int macroId, int no_args, bool start)
           if (DocumentStyle == LATEX_ARTICLE)
           {
             fprintf(Sections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
           if (DocumentStyle == LATEX_ARTICLE)
           {
             fprintf(Sections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
-               FileNameFromPath(FileRoot), "Contents");
+               wxFileNameFromPath(FileRoot), "Contents");
           }
           else if (CurrentChapterName)
           {
             fprintf(Sections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
           }
           else if (CurrentChapterName)
           {
             fprintf(Sections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
-               FileNameFromPath(FileRoot), CurrentChapterName);
+               wxFileNameFromPath(FileRoot), CurrentChapterName);
           }
         }
       }
           }
         }
       }
@@ -1501,7 +1504,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
         if (useUpButton && CurrentSectionName)
         {
           fprintf(Subsections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
         if (useUpButton && CurrentSectionName)
         {
           fprintf(Subsections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
-             FileNameFromPath(FileRoot), CurrentSectionName);
+             wxFileNameFromPath(FileRoot), CurrentSectionName);
         }
       }
       if (!winHelp && indexSubsections && useWord)
         }
       }
       if (!winHelp && indexSubsections && useWord)
@@ -1647,7 +1650,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
         if (useUpButton && CurrentSubsectionName)
         {
           fprintf(Subsubsections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
         if (useUpButton && CurrentSubsectionName)
         {
           fprintf(Subsubsections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
-             FileNameFromPath(FileRoot), CurrentSubsectionName);
+             wxFileNameFromPath(FileRoot), CurrentSubsectionName);
         }
       }
       if (!winHelp && indexSubsections && useWord)
         }
       }
       if (!winHelp && indexSubsections && useWord)
@@ -2205,7 +2208,6 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       {
         struc->currentItem += 1;
 
       {
         struc->currentItem += 1;
 
-        int indentSize = struc->indentation;
         int oldIndent = 0;
         wxNode *node2 = NULL;
         if (itemizeStack.Number() > 1) // TODO: do I actually mean Nth(0) here??
         int oldIndent = 0;
         wxNode *node2 = NULL;
         if (itemizeStack.Number() > 1) // TODO: do I actually mean Nth(0) here??
@@ -3367,7 +3369,6 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
                 {
                   if (useWord)
                   {
                 {
                   if (useWord)
                   {
-                      char *s = GetArgData();
                       TexOutput("p. ");
                       TexOutput("{\\field{\\*\\fldinst  PAGEREF ");
                       TexOutput(refName);
                       TexOutput("p. ");
                       TexOutput("{\\field{\\*\\fldinst  PAGEREF ");
                       TexOutput(refName);
@@ -3619,7 +3620,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
               }
               else
               {
               }
               else
               {
-                sprintf(buf, "Could not read metafile %s. Perhaps it's not a placeable metafile?", f);
+                sprintf(buf, "Could not read metafile %s. Perhaps it's not a placeable metafile?", (const char*)f);
                 OnError(buf);
               }
               fclose(fd);
                 OnError(buf);
               }
               fclose(fd);
@@ -4898,7 +4899,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         if (useUpButton)
         {
           fprintf(Chapters, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
         if (useUpButton)
         {
           fprintf(Chapters, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
-               FileNameFromPath(FileRoot), "Contents");
+               wxFileNameFromPath(FileRoot), "Contents");
         }
       }
       
         }
       }
       
@@ -5248,7 +5249,7 @@ bool RTFGo(void)
     {
       wxConcatFiles("header.rtf", "chapters.rtf", "tmp1.rtf");
       Tex2RTFYield(TRUE);
     {
       wxConcatFiles("header.rtf", "chapters.rtf", "tmp1.rtf");
       Tex2RTFYield(TRUE);
-      if (FileExists(OutputFile))
+      if (wxFileExists(OutputFile))
           wxRemoveFile(OutputFile);
 
       char *cwdStr;
           wxRemoveFile(OutputFile);
 
       char *cwdStr;
@@ -5274,7 +5275,7 @@ bool RTFGo(void)
       wxRemoveFile("tmp1.rtf");
     }
     
       wxRemoveFile("tmp1.rtf");
     }
     
-    if (FileExists(ContentsName)) wxRemoveFile(ContentsName);
+    if (wxFileExists(ContentsName)) wxRemoveFile(ContentsName);
 
     if (!wxRenameFile(TmpContentsName, ContentsName))
     {
 
     if (!wxRenameFile(TmpContentsName, ContentsName))
     {