X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e4a2236693452eb1199f47ce25064ee28dc09920..1a42f89c41256c9de765b5e7671f4d1e94dbdc51:/utils/tex2rtf/src/tex2any.h?ds=sidebyside diff --git a/utils/tex2rtf/src/tex2any.h b/utils/tex2rtf/src/tex2any.h index 0fc16cd94e..97c6d0d123 100644 --- a/utils/tex2rtf/src/tex2any.h +++ b/utils/tex2rtf/src/tex2any.h @@ -10,10 +10,10 @@ ///////////////////////////////////////////////////////////////////////////// #include -#include "wx/wx.h" #include "wx/utils.h" #include "wx/list.h" #include "wx/hash.h" +#include "wx/tokenzr.h" #include "wxhlpblk.h" /* @@ -36,21 +36,21 @@ #ifdef __WXMSW__ - const int MAX_LINE_BUFFER_SIZE = 600; + const unsigned long MAX_LINE_BUFFER_SIZE = 600; #else - const int MAX_LINE_BUFFER_SIZE = 11000; + const unsigned long MAX_LINE_BUFFER_SIZE = 11000; #endif class TexMacroDef: public wxObject { public: int no_args; - char *name; + wxChar *name; bool ignore; int forbidden; int macroId; - TexMacroDef(int the_id, const char *the_name, int n, bool ig, bool forbidLevel = FORBID_OK); + TexMacroDef(int the_id, const wxChar *the_name, int n, bool ig, bool forbidLevel = FORBID_OK); ~TexMacroDef(void); }; @@ -106,7 +106,7 @@ class TexChunk int type; // char *name; TexMacroDef *def; - char *value; + wxChar *value; int macroId; int no_args; int argn; @@ -130,38 +130,39 @@ class TexTopic: public wxObject // to find there's only one page in it. We might force a book to be used if // a top-level topic has no children (?) bool hasChildren; - char *filename; + wxChar *filename; wxStringList *keywords; - TexTopic(char *f = NULL); + TexTopic(wxChar *f = NULL); ~TexTopic(void); }; extern wxHashTable TopicTable; -void AddKeyWordForTopic(char *topic, char *entry, char *filename = NULL); +void AddKeyWordForTopic(wxChar *topic, wxChar *entry, wxChar *filename = NULL); void ClearKeyWordTable(void); +extern wxChar wxTex2RTFBuffer[]; extern TexChunk *TopLevel; extern wxHashTable MacroDefs; extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.tex -bool read_a_line(char *buf); -bool TexLoadFile(char *filename); -int ParseArg(TexChunk *thisArg, wxList& children, char *buffer, int pos, - char *environment = NULL, bool parseArgToBrace = TRUE, TexChunk *customMacroArgs = NULL); -int ParseMacroBody(char *macro_name, TexChunk *parent, int no_args, - char *buffer, int pos, char *environment = NULL, bool parseArgToBrace = TRUE, TexChunk *customMacroArgs = NULL); +bool read_a_line(wxChar *buf); +bool TexLoadFile(wxChar *filename); +int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, + 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); 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 char *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 char *s, bool ordinaryText = FALSE); -char *GetArgData(TexChunk *chunk); -char *GetArgData(void); // Get the string for the current argument +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 TexChunk *GetArgChunk(void); // Get the chunk for the current argument TexChunk *GetTopLevelChunk(void); // Get the chunk for the top level @@ -169,11 +170,15 @@ TexChunk *GetNextChunk(void); // Look ahead to the next chunk bool IsArgOptional(void); // Is this argument an optional argument? void DefineDefaultMacros(void); // Optional set of default macros int GetCurrentColumn(void); // number of characters on current line -char *ConvertCase(char *s); // Convert case, according to upperCaseNames setting. +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 + // Define a variable value from the .ini file -char *RegisterSetting(char *settingName, char *settingValue, bool interactive = TRUE); +wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interactive = true); // Major document styles #define LATEX_REPORT 1 @@ -187,9 +192,9 @@ extern TexChunk *DocumentAuthor; extern TexChunk *DocumentDate; extern int DocumentStyle; extern int MinorDocumentStyle; -extern char *BibliographyStyleString; -extern char *DocumentStyleString; -extern char *MinorDocumentStyleString; +extern wxChar *BibliographyStyleString; +extern wxChar *DocumentStyleString; +extern wxChar *MinorDocumentStyleString; extern int normalFont; extern int smallFont; @@ -231,39 +236,42 @@ extern bool useWord; // Insert Word table of contents, etc. etc. extern bool indexSubsections; // put subsections in index extern bool compatibilityMode; extern bool generateHPJ; // Generate WinHelp HPJ file -extern char *winHelpTitle; // Title for Windows Help file +extern wxChar *winHelpTitle; // Title for Windows Help file extern int defaultTableColumnWidth; -extern char *bitmapMethod; +extern wxChar *bitmapMethod; extern bool truncateFilenames; // Truncate for DOS extern int winHelpVersion; // Version e.g. 4 for Win95 extern bool winHelpContents; // Generate .cnt file extern bool htmlIndex; // Generate .htx HTML index file extern bool htmlFrameContents; // Use frames for HTML contents page +extern wxChar *htmlStylesheet; // Use this CSS stylesheet for HTML pages extern int contentsDepth; // Depth of contents for linear RTF files extern bool upperCaseNames; // Filenames; default is lower case -extern char *backgroundImageString; // HTML background image -extern char *backgroundColourString; // HTML background colour -extern char *textColourString; // HTML text colour -extern char *linkColourString; // HTML link colour -extern char *followedLinkColourString; // HTML followed link colour +extern wxChar *backgroundImageString; // HTML background image +extern wxChar *backgroundColourString; // HTML background colour +extern wxChar *textColourString; // HTML text colour +extern wxChar *linkColourString; // HTML link colour +extern wxChar *followedLinkColourString; // HTML followed link colour extern bool combineSubSections; // Stop splitting files below section extern bool htmlWorkshopFiles; // generate HTML Help Workshop project files +extern bool ignoreBadRefs; // Don't insert (REF NOT FOUND) +extern wxChar *htmlFaceName; // HTML face name // Names to help with internationalisation -extern char *ContentsNameString; -extern char *AbstractNameString; -extern char *GlossaryNameString; -extern char *ReferencesNameString; -extern char *FiguresNameString; -extern char *TablesNameString; -extern char *FigureNameString; -extern char *TableNameString; -extern char *IndexNameString; -extern char *ChapterNameString; -extern char *SectionNameString; -extern char *SubsectionNameString; -extern char *SubsubsectionNameString; -extern char *UpNameString; +extern wxChar *ContentsNameString; +extern wxChar *AbstractNameString; +extern wxChar *GlossaryNameString; +extern wxChar *ReferencesNameString; +extern wxChar *FiguresNameString; +extern wxChar *TablesNameString; +extern wxChar *FigureNameString; +extern wxChar *TableNameString; +extern wxChar *IndexNameString; +extern wxChar *ChapterNameString; +extern wxChar *SectionNameString; +extern wxChar *SubsectionNameString; +extern wxChar *SubsubsectionNameString; +extern wxChar *UpNameString; /* * HTML button identifiers: what kind of browse buttons @@ -308,26 +316,24 @@ extern TexChunk * CentreHeaderEven; extern TexChunk * CentreFooterEven; extern TexChunk * RightHeaderEven; extern TexChunk * RightFooterEven; -extern char * PageStyle; +extern wxChar * PageStyle; // Repeat the currentSection, either real (Chapter) or simulated (References) extern void OutputCurrentSection(void); -extern void OutputCurrentSectionToString(char *buf); -extern void OutputChunkToString(TexChunk *chunk, char *buf); - -extern char *fakeCurrentSection; +extern void OutputCurrentSectionToString(wxChar *buf); +extern void OutputChunkToString(TexChunk *chunk, wxChar *buf); // Called by Tex2Any to simulate a section -extern void FakeCurrentSection(char *fakeSection, bool addToContents = TRUE); +extern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = true); /* * Local to Tex2Any library * */ -extern char *currentArgData; +extern wxChar *currentArgData; extern bool haveArgData; // If TRUE, we're simulating the data. -void StartSimulateArgument(char *data); +void StartSimulateArgument(wxChar *data); void EndSimulateArgument(void); /* @@ -350,13 +356,13 @@ void DefaultOnMacro(int macroId, int no_args, bool start); bool DefaultOnArgument(int macroId, int arg_no, bool start); // Called on error -void OnError(const char *msg); +void OnError(const wxChar *msg); // Called for information -void OnInform(const char *msg); +void OnInform(const wxChar *msg); // Special yield wrapper -void Tex2RTFYield(bool force = FALSE); +void Tex2RTFYield(bool force = false); /* * Useful utilities @@ -365,13 +371,13 @@ void Tex2RTFYield(bool force = FALSE); // Look for \label macro, use this ref name if found or // make up a topic name otherwise. -char *FindTopicName(TexChunk *chunk); +wxChar *FindTopicName(TexChunk *chunk); // Force the current topic to be this (e.g. force 'references' label). -void ForceTopicName(char *name); +void ForceTopicName(const wxChar *name); void ResetTopicCounter(void); // Parse unit eg. 14, 12pt, 34cm and return value in points. -int ParseUnitArgument(char *unitArg); +int ParseUnitArgument(wxChar *unitArg); // Set small, large, normal etc. point sizes for reference size void SetFontSizes(int pointSize); @@ -382,7 +388,7 @@ void SetFontSizes(int pointSize); * */ -void StripExtension(char *buffer); +void StripExtension(wxChar *buffer); /* * Reference structure @@ -392,11 +398,11 @@ void StripExtension(char *buffer); class TexRef: public wxObject { public: - char *refLabel; // Reference label - char *refFile; // Reference filename (can be NULL) - char *sectionNumber; // Section or figure number (as a string) - char *sectionName; // name e.g. 'section' - TexRef(char *label, char *file, char *section, char *sectionN = NULL); + wxChar *refLabel; // Reference label + wxChar *refFile; // Reference filename (can be NULL) + 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); }; @@ -405,15 +411,15 @@ class TexRef: public wxObject * */ -void AddTexRef(char *name, char *file = NULL, char *sectionName = NULL, +void AddTexRef(wxChar *name, wxChar *file = NULL, wxChar *sectionName = NULL, int chapter = 0, int section = 0, int subsection = 0, int subsubsection = 0); /* * Read and write reference file (.ref), to resolve refs for second pass. * */ -void WriteTexReferences(char *filename); -void ReadTexReferences(char *filename); +void WriteTexReferences(wxChar *filename); +void ReadTexReferences(wxChar *filename); /* * Bibliography stuff @@ -423,33 +429,33 @@ void ReadTexReferences(char *filename); class BibEntry: public wxObject { public: - char *key; + wxChar *key; /* * book, inbook, article, phdthesis, inproceedings, techreport */ - char *type; + wxChar *type; /* * Possible fields * */ - char *editor; - char *title; - char *booktitle; - char *author; - char *journal; - char *volume; - char *number; - char *year; - char *month; - char *pages; - char *chapter; - char *publisher; - char *address; - char *institution; - char *organization; - char *comment; + wxChar *editor; + wxChar *title; + wxChar *booktitle; + wxChar *author; + wxChar *journal; + wxChar *volume; + wxChar *number; + wxChar *year; + wxChar *month; + wxChar *pages; + wxChar *chapter; + wxChar *publisher; + wxChar *address; + wxChar *institution; + wxChar *organization; + wxChar *comment; inline BibEntry(void) { @@ -477,11 +483,11 @@ class BibEntry: public wxObject extern wxList BibList; extern wxStringList CitationList; -bool ReadBib(char *filename); +bool ReadBib(wxChar *filename); void OutputBib(void); void ResolveBibReferences(void); -void AddCitation(char *citeKey); -TexRef *FindReference(char *key); +void AddCitation(wxChar *citeKey); +TexRef *FindReference(wxChar *key); /* * Ability to customize, or at least suppress unknown macro errors @@ -497,25 +503,25 @@ extern wxList CustomMacroList; class CustomMacro: public wxObject { public: - char *macroName; - char *macroBody; + wxChar *macroName; + wxChar *macroBody; int noArgs; - inline CustomMacro(char *name, int args, char *body) + inline CustomMacro(wxChar *name, int args, wxChar *body) { noArgs = args; - macroName = copystring(name); + macroName = wxStrcpy(new wxChar[wxStrlen(name) + 1], name); if (body) - macroBody = copystring(body); + macroBody = wxStrcpy(new wxChar[wxStrlen(body) + 1], body); else macroBody = NULL; } ~CustomMacro(); }; -bool ReadCustomMacros(char *filename); +bool ReadCustomMacros(wxChar *filename); void ShowCustomMacros(void); -CustomMacro *FindCustomMacro(char *name); -char *ParseMultifieldString(char *s, int *pos); +CustomMacro *FindCustomMacro(wxChar *name); +wxChar *ParseMultifieldString(wxChar *s, int *pos); /* * Colour table stuff @@ -525,20 +531,20 @@ char *ParseMultifieldString(char *s, int *pos); class ColourTableEntry: public wxObject { public: - char *name; + wxChar *name; unsigned int red; unsigned int green; unsigned int blue; - ColourTableEntry(char *theName, unsigned int r, unsigned int g, unsigned int b); + ColourTableEntry(const wxChar *theName, unsigned int r, unsigned int g, unsigned int b); ~ColourTableEntry(void); }; extern wxList ColourTable; -extern void AddColour(char *theName, unsigned int r, unsigned int g, unsigned int b); -extern int FindColourPosition(char *theName); +extern void AddColour(const wxChar *theName, unsigned int r, unsigned int g, unsigned int b); +extern int FindColourPosition(wxChar *theName); // Converts e.g. "red" -> "#FF0000" -extern bool FindColourHTMLString(char *theName, char *buf); +extern bool FindColourHTMLString(wxChar *theName, wxChar *buf); extern void InitialiseColourTable(void); #define ltABSTRACT 1