From 88fd7006f473d24685c36974315f6ff6e6f6d727 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 31 Oct 2004 08:31:03 +0000 Subject: [PATCH 1/1] fixed spelling of -checkcurleybraces (patch #1054304) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30198 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/tech/tn0003.txt | 4 ++-- utils/tex2rtf/src/rtfutils.cpp | 15 +++++++------ utils/tex2rtf/src/tex2any.cpp | 40 +++++++++++++++++----------------- utils/tex2rtf/src/tex2any.h | 2 +- utils/tex2rtf/src/tex2rtf.cpp | 27 ++++++++++++++--------- utils/tex2rtf/src/tex2rtf.h | 4 ++-- 6 files changed, 50 insertions(+), 42 deletions(-) diff --git a/docs/tech/tn0003.txt b/docs/tech/tn0003.txt index 151d28aa63..da54afac8d 100644 --- a/docs/tech/tn0003.txt +++ b/docs/tech/tn0003.txt @@ -93,7 +93,7 @@ DO: \end{verbatim} block - check that your changes/additions to any TEX documentation - compiles before checking it in! Use the '-checkcurleybraces' + compiles before checking it in! Use the '-checkcurlybraces' and '-checksyntax' commandline parameters (or the OPTIONS menu if running in GUI mode) to check for some of the more common mistakes. See TROUBLESHOOTING below for more details @@ -154,7 +154,7 @@ here is one important tip: caused the problem. When making changes/additions to the documentation, always use - the '-checkcurleybraces' and '-checksyntax' commandline parameters + the '-checkcurlybraces' and '-checksyntax' commandline parameters (or turn these options on in the GUI version via the OPTIONS menu choice), BEFORE checking in your changes. These two debugging options will catch many of the more common mistakes that are made diff --git a/utils/tex2rtf/src/rtfutils.cpp b/utils/tex2rtf/src/rtfutils.cpp index bc03339827..5bc087ed67 100644 --- a/utils/tex2rtf/src/rtfutils.cpp +++ b/utils/tex2rtf/src/rtfutils.cpp @@ -240,6 +240,7 @@ void WriteWinHelpContentsFileLine(wxChar *topicName, wxChar *xitle, int level) wxChar title[255]; int s=0; int d=0; + // assuming iso-8859-1 here even in Unicode build (FIXME?) while ( (xitle[s]!=0)&&(d<255) ) { wxChar ch=wxChar(xitle[s]&0xff); @@ -248,12 +249,12 @@ void WriteWinHelpContentsFileLine(wxChar *topicName, wxChar *xitle, int level) wxChar ch2=wxChar(xitle[s+2]&0xff); wxChar ch3=wxChar(xitle[s+3]&0xff); s+=4; // next character - if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x36)) { title[d++]=_T('ö'); } - if ((ch1==0x27)&&(ch2==0x65)&&(ch3==0x34)) { title[d++]=_T('ä'); } - if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x63)) { title[d++]=_T('ü'); } - if ((ch1==0x27)&&(ch2==0x64)&&(ch3==0x36)) { title[d++]=_T('Ö'); } - if ((ch1==0x27)&&(ch2==0x63)&&(ch3==0x34)) { title[d++]=_T('Ä'); } - if ((ch1==0x27)&&(ch2==0x64)&&(ch3==0x63)) { title[d++]=_T('Ü'); } + if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x36)) { title[d++]=wxChar('ö'); } + if ((ch1==0x27)&&(ch2==0x65)&&(ch3==0x34)) { title[d++]=wxChar('ä'); } + if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x63)) { title[d++]=wxChar('ü'); } + if ((ch1==0x27)&&(ch2==0x64)&&(ch3==0x36)) { title[d++]=wxChar('Ö'); } + if ((ch1==0x27)&&(ch2==0x63)&&(ch3==0x34)) { title[d++]=wxChar('Ä'); } + if ((ch1==0x27)&&(ch2==0x64)&&(ch3==0x63)) { title[d++]=wxChar('Ü'); } } else { title[d++]=ch; s++; @@ -670,7 +671,7 @@ void ProcessText2RTF(TexChunk *chunk) i += 1; changed = true; } - else if (inVerbatim && (ch == '{' || ch == '}')) // Escape the curley bracket + else if (inVerbatim && (ch == '{' || ch == '}')) // Escape the curly bracket { BigBuffer[ptr] = '\\'; ptr ++; BigBuffer[ptr] = ch; ptr ++; diff --git a/utils/tex2rtf/src/tex2any.cpp b/utils/tex2rtf/src/tex2any.cpp index d9227ab721..8400d87a13 100644 --- a/utils/tex2rtf/src/tex2any.cpp +++ b/utils/tex2rtf/src/tex2any.cpp @@ -113,7 +113,7 @@ 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 checkCurlyBraces = false; bool checkSyntax = false; bool headerRule = false; bool footerRule = false; @@ -428,8 +428,8 @@ bool readInVerbatim = false; // Within a verbatim, but not nec. verbatiminput // detection of \verb yet. // #define CHECK_BRACES 1 -unsigned long leftCurley = 0; -unsigned long rightCurley = 0; +unsigned long leftCurly = 0; +unsigned long rightCurly = 0; static wxString currentFileName = _T(""); bool read_a_line(wxChar *buf) @@ -463,22 +463,22 @@ bool read_a_line(wxChar *buf) lastChar = ch; ch = getc(Inputs[CurrentInputIndex]); - if (checkCurleyBraces) + if (checkCurlyBraces) { if (ch == '{' && !readInVerbatim && lastChar != _T('\\')) - leftCurley++; + leftCurly++; if (ch == '}' && !readInVerbatim && lastChar != _T('\\')) { - rightCurley++; - if (rightCurley > leftCurley) + rightCurly++; + if (rightCurly > leftCurly) { 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()); + errBuf.Printf(_T("An extra right Curly 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 + // Reduce the count of right Curly braces, so the mismatched count // isn't reported on every line that has a '}' after the first mismatch - rightCurley--; + rightCurly--; } } } @@ -639,17 +639,17 @@ bool read_a_line(wxChar *buf) ch = ' '; // No real end of file CurrentInputIndex --; - if (checkCurleyBraces) + if (checkCurlyBraces) { - if (leftCurley != rightCurley) + if (leftCurly != rightCurly) { 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); + errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"), + (const wxChar*) currentFileName.c_str(),leftCurly,rightCurly); OnError((wxChar *)errBuf.c_str()); } - leftCurley = 0; - rightCurley = 0; + leftCurly = 0; + rightCurly = 0; } if (readingVerbatim) @@ -849,13 +849,13 @@ bool read_a_line(wxChar *buf) wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0) readInVerbatim = false; - if (checkCurleyBraces) + if (checkCurlyBraces) { - if (ch == EOF && leftCurley != rightCurley) + if (ch == EOF && leftCurly != rightCurly) { 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); + errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"), + (const wxChar*) currentFileName.c_str(),leftCurly,rightCurly); OnError((wxChar *)errBuf.c_str()); } } diff --git a/utils/tex2rtf/src/tex2any.h b/utils/tex2rtf/src/tex2any.h index 107bbd0c1d..5a0ba50e94 100644 --- a/utils/tex2rtf/src/tex2any.h +++ b/utils/tex2rtf/src/tex2any.h @@ -221,7 +221,7 @@ 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; diff --git a/utils/tex2rtf/src/tex2rtf.cpp b/utils/tex2rtf/src/tex2rtf.cpp index 4bb4f431db..46855357c2 100644 --- a/utils/tex2rtf/src/tex2rtf.cpp +++ b/utils/tex2rtf/src/tex2rtf.cpp @@ -269,10 +269,17 @@ bool MyApp::OnInit() } } } + else if (wxStrcmp(argv[i], _T("-checkcurlybraces")) == 0) + { + i ++; + checkCurlyBraces = true; + } else if (wxStrcmp(argv[i], _T("-checkcurleybraces")) == 0) { + // Support the old, incorrectly spelled version of -checkcurlybraces + // so that old scripts which run tex2rtf -checkcurleybraces still work. i ++; - checkCurleyBraces = true; + checkCurlyBraces = true; } else if (wxStrcmp(argv[i], _T("-checksyntax")) == 0) { @@ -351,10 +358,10 @@ bool MyApp::OnInit() wxMenu *options_menu = new wxMenu; - options_menu->Append(TEX_OPTIONS_CURLEY_BRACE, _T("Curley brace matching"), _T("Checks for mismatched curley braces"),true); + options_menu->Append(TEX_OPTIONS_CURLY_BRACE, _T("Curly brace matching"), _T("Checks for mismatched curly braces"),true); options_menu->Append(TEX_OPTIONS_SYNTAX_CHECKING, _T("Syntax checking"), _T("Syntax checking for common errors"),true); - options_menu->Check(TEX_OPTIONS_CURLEY_BRACE, checkCurleyBraces); + options_menu->Check(TEX_OPTIONS_CURLY_BRACE, checkCurlyBraces); options_menu->Check(TEX_OPTIONS_SYNTAX_CHECKING, checkSyntax); wxMenu *help_menu = new wxMenu; @@ -590,7 +597,7 @@ void ShowOptions(void) OnInform(_T(" -charset (default ansi)")); OnInform(_T(" -twice")); OnInform(_T(" -sync")); - OnInform(_T(" -checkcurleybraces")); + OnInform(_T(" -checkcurlybraces")); OnInform(_T(" -checksyntax")); OnInform(_T(" -macros ")); OnInform(_T(" -winhelp")); @@ -616,7 +623,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(TEX_MODE_WINHELP, MyFrame::OnModeWinHelp) EVT_MENU(TEX_MODE_HTML, MyFrame::OnModeHTML) EVT_MENU(TEX_MODE_XLP, MyFrame::OnModeXLP) - EVT_MENU(TEX_OPTIONS_CURLEY_BRACE, MyFrame::OnOptionsCurleyBrace) + EVT_MENU(TEX_OPTIONS_CURLY_BRACE, MyFrame::OnOptionsCurlyBrace) EVT_MENU(TEX_OPTIONS_SYNTAX_CHECKING, MyFrame::OnOptionsSyntaxChecking) EVT_MENU(TEX_HELP, MyFrame::OnHelp) EVT_MENU(TEX_ABOUT, MyFrame::OnAbout) @@ -793,17 +800,17 @@ void MyFrame::OnModeXLP(wxCommandEvent& WXUNUSED(event)) #endif // wxUSE_STATUSBAR } -void MyFrame::OnOptionsCurleyBrace(wxCommandEvent& WXUNUSED(event)) +void MyFrame::OnOptionsCurlyBrace(wxCommandEvent& WXUNUSED(event)) { - checkCurleyBraces = !checkCurleyBraces; + checkCurlyBraces = !checkCurlyBraces; #if wxUSE_STATUSBAR - if (checkCurleyBraces) + if (checkCurlyBraces) { - SetStatusText(_T("Checking curley braces: YES"), 1); + SetStatusText(_T("Checking curly braces: YES"), 1); } else { - SetStatusText(_T("Checking curley braces: NO"), 1); + SetStatusText(_T("Checking curly braces: NO"), 1); } #endif // wxUSE_STATUSBAR } diff --git a/utils/tex2rtf/src/tex2rtf.h b/utils/tex2rtf/src/tex2rtf.h index 9465f9151a..af45002190 100644 --- a/utils/tex2rtf/src/tex2rtf.h +++ b/utils/tex2rtf/src/tex2rtf.h @@ -60,7 +60,7 @@ class MyFrame: public wxFrame void OnModeWinHelp(wxCommandEvent& event); void OnModeHTML(wxCommandEvent& event); void OnModeXLP(wxCommandEvent& event); - void OnOptionsCurleyBrace(wxCommandEvent& event); + void OnOptionsCurlyBrace(wxCommandEvent& event); void OnOptionsSyntaxChecking(wxCommandEvent& event); void OnHelp(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); @@ -131,7 +131,7 @@ class ItemizeStruc: public wxObject #define TEX_MODE_HTML 11 #define TEX_MODE_XLP 12 -#define TEX_OPTIONS_CURLEY_BRACE 13 +#define TEX_OPTIONS_CURLY_BRACE 13 #define TEX_OPTIONS_SYNTAX_CHECKING 14 #define TEX_HELP 15 -- 2.45.2