X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c155d33875eb3641bf845fbac186c1b5470708e..4c268e6a10d820b9ea9851924e37014caa9fb5e8:/utils/tex2rtf/src/tex2any.h diff --git a/utils/tex2rtf/src/tex2any.h b/utils/tex2rtf/src/tex2any.h index cd29772fc4..9b78d397c9 100644 --- a/utils/tex2rtf/src/tex2any.h +++ b/utils/tex2rtf/src/tex2any.h @@ -14,13 +14,15 @@ #include "wx/list.h" #include "wx/hash.h" #include "wx/tokenzr.h" +#include "wx/wfstream.h" +#include "wx/txtstrm.h" #include "wxhlpblk.h" /* * Conversion modes * */ - + #define TEX_RTF 1 #define TEX_XLP 2 #define TEX_HTML 3 @@ -51,7 +53,7 @@ class TexMacroDef: public wxObject int macroId; TexMacroDef(int the_id, const wxChar *the_name, int n, bool ig, bool forbidLevel = FORBID_OK); - ~TexMacroDef(void); + virtual ~TexMacroDef(void); }; #define CHUNK_TYPE_MACRO 1 @@ -133,7 +135,7 @@ class TexTopic: public wxObject wxChar *filename; wxStringList *keywords; TexTopic(wxChar *f = NULL); - ~TexTopic(void); + virtual ~TexTopic(void); }; extern wxHashTable TopicTable; void AddKeyWordForTopic(wxChar *topic, wxChar *entry, wxChar *filename = NULL); @@ -145,22 +147,22 @@ extern wxHashTable MacroDefs; extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.tex bool read_a_line(wxChar *buf); -bool TexLoadFile(wxChar *filename); +bool TexLoadFile(const wxString& filename); int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, - wxChar *environment = NULL, bool parseArgToBrace = TRUE, TexChunk *customMacroArgs = NULL); + wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL); int ParseMacroBody(const wxChar *macro_name, TexChunk *parent, int no_args, - wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = TRUE, TexChunk *customMacroArgs = NULL); + wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL); void TraverseDocument(void); -void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode = NULL, bool childrenOnly = FALSE); -#define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, TRUE) +void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode = NULL, bool childrenOnly = false); +#define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, true) void SetCurrentOutput(FILE *fd); void SetCurrentOutputs(FILE *fd1, FILE *fd2); extern FILE *CurrentOutput1; extern FILE *CurrentOutput2; -void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore = FALSE, bool forbidden = FALSE); +void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore = false, bool forbidden = false); void TexInitialize(int bufSize); void TexCleanUp(void); -void TexOutput(const wxChar *s, bool ordinaryText = FALSE); +void TexOutput(const wxChar *s, bool ordinaryText = false); wxChar *GetArgData(TexChunk *chunk); wxChar *GetArgData(void); // Get the string for the current argument int GetNoArgs(void); // Get the number of arguments for the current macro @@ -173,12 +175,10 @@ int GetCurrentColumn(void); // number of characters on current line wxChar *ConvertCase(wxChar *s); // Convert case, according to upperCaseNames setting. extern wxPathList TexPathList; // Path list, can be used for file searching. -#if !WXWIN_COMPATIBILITY_2 -extern bool StringMatch(const wxChar *one, const wxChar *two, bool subString = TRUE, bool exact = FALSE); -#endif +extern bool StringMatch(const wxChar *one, const wxChar *two, bool subString = true, bool exact = false); // Define a variable value from the .ini file -wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interactive = TRUE); +wxChar *RegisterSetting(const wxString& settingName, const wxString& settingValue, bool interactive = true); // Major document styles #define LATEX_REPORT 1 @@ -217,11 +217,11 @@ extern int sectionFont; extern int subsectionFont; extern int titleFont; extern int authorFont; -extern bool winHelp; // Output in Windows Help format if TRUE, linear otherwise +extern bool winHelp; // Output in Windows Help format if true, linear otherwise extern bool isInteractive; extern bool runTwice; extern int convertMode; -extern bool checkCurleyBraces; +extern bool checkCurlyBraces; extern bool checkSyntax; extern bool stopRunning; extern int mirrorMargins; @@ -324,15 +324,15 @@ extern void OutputCurrentSectionToString(wxChar *buf); extern void OutputChunkToString(TexChunk *chunk, wxChar *buf); // Called by Tex2Any to simulate a section -extern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = TRUE); +extern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = true); /* * Local to Tex2Any library * */ - + extern wxChar *currentArgData; -extern bool haveArgData; // If TRUE, we're simulating the data. +extern bool haveArgData; // If true, we're simulating the data. void StartSimulateArgument(wxChar *data); void EndSimulateArgument(void); @@ -345,7 +345,7 @@ void EndSimulateArgument(void); void OnMacro(int macroId, int no_args, bool start); // Called on start/end of argument examination. -// Return TRUE at the start of an argument to traverse +// Return true at the start of an argument to traverse // (output) the argument. bool OnArgument(int macroId, int arg_no, bool start); @@ -362,7 +362,7 @@ void OnError(const wxChar *msg); void OnInform(const wxChar *msg); // Special yield wrapper -void Tex2RTFYield(bool force = FALSE); +void Tex2RTFYield(bool force = false); /* * Useful utilities @@ -387,7 +387,7 @@ void SetFontSizes(int pointSize); * IF one exists. Inserts zero into buffer. * */ - + void StripExtension(wxChar *buffer); /* @@ -403,14 +403,14 @@ class TexRef: public wxObject wxChar *sectionNumber; // Section or figure number (as a string) wxChar *sectionName; // name e.g. 'section' TexRef(const wxChar *label, const wxChar *file, const wxChar *section, const wxChar *sectionN = NULL); - ~TexRef(void); + virtual ~TexRef(void); }; /* * Add a reference * */ - + void AddTexRef(wxChar *name, wxChar *file = NULL, wxChar *sectionName = NULL, int chapter = 0, int section = 0, int subsection = 0, int subsubsection = 0); @@ -502,23 +502,23 @@ extern wxList CustomMacroList; class CustomMacro: public wxObject { - public: - wxChar *macroName; - wxChar *macroBody; - int noArgs; - inline CustomMacro(wxChar *name, int args, wxChar *body) - { - noArgs = args; - macroName = wxStrcpy(new wxChar[wxStrlen(name) + 1], name); - if (body) - macroBody = wxStrcpy(new wxChar[wxStrlen(body) + 1], body); - else - macroBody = NULL; - } - ~CustomMacro(); +public: + wxChar *macroName; + wxChar *macroBody; + int noArgs; + inline CustomMacro(const wxChar *name, int args, wxChar *body) + { + noArgs = args; + macroName = wxStrcpy(new wxChar[wxStrlen(name) + 1], name); + if (body) + macroBody = wxStrcpy(new wxChar[wxStrlen(body) + 1], body); + else + macroBody = NULL; + } + virtual ~CustomMacro(); }; -bool ReadCustomMacros(wxChar *filename); +bool ReadCustomMacros(const wxString& filename); void ShowCustomMacros(void); CustomMacro *FindCustomMacro(wxChar *name); wxChar *ParseMultifieldString(wxChar *s, int *pos); @@ -537,7 +537,7 @@ class ColourTableEntry: public wxObject unsigned int blue; ColourTableEntry(const wxChar *theName, unsigned int r, unsigned int g, unsigned int b); - ~ColourTableEntry(void); + virtual ~ColourTableEntry(void); }; extern wxList ColourTable; @@ -830,7 +830,7 @@ extern void InitialiseColourTable(void); #define ltURLREF 551 #define ltUPPERCASE 552 #define ltUSEPACKAGE 553 - + #define ltVDOTS 570 #define ltVERBATIMINPUT 571 #define ltVERBATIM 572 @@ -1068,6 +1068,3 @@ extern void InitialiseColourTable(void); #define ltTOPLEVEL 15000 #define ltCUSTOM_MACRO 15001 #define ltSOLO_BLOCK 15002 - - -