// this function exists only in the debug build and exists solely to catch compile errors in the CM_xxx macros void MacroVerify() { HWND hWnd = NULL; { LPCTSTR pszName = 0; CM_SetLanguage( hWnd, pszName ); } { LPCTSTR pszName = 0; CM_GetLanguage( hWnd, pszName ); } { BOOL bEnable = 0; CM_EnableColorSyntax( hWnd, bEnable ); } { CM_IsColorSyntaxEnabled( hWnd ); } { LPCTSTR pszFileName = 0; CM_OpenFile( hWnd, pszFileName ); } { LPCTSTR pszFileName = 0; CM_POSITION *pPos = 0; CM_InsertFile( hWnd, pszFileName, pPos ); } { LPCTSTR pszText = 0; CM_POSITION *pPos = 0; CM_InsertText( hWnd, pszText, pPos ); } { LPCTSTR pszText = 0; CM_SetText( hWnd, pszText ); } { CM_COLORS *pColors = 0; CM_SetColors( hWnd, pColors ); } { CM_COLORS *pColors = 0; CM_GetColors( hWnd, pColors ); } { BOOL bEnable = 0; CM_EnableWhitespaceDisplay( hWnd, bEnable ); } { CM_IsWhitespaceDisplayEnabled( hWnd ); } { BOOL bEnable = 0; CM_EnableTabExpand( hWnd, bEnable ); } { CM_IsTabExpandEnabled( hWnd ); } { BOOL bEnable = 0; CM_EnableSmoothScrolling( hWnd, bEnable ); } { CM_IsSmoothScrollingEnabled( hWnd ); } { int nTabSize = 0; CM_SetTabSize( hWnd, nTabSize ); } { CM_GetTabSize( hWnd ); } { BOOL bReadOnly = 0; CM_SetReadOnly( hWnd, bReadOnly ); } { CM_IsReadOnly( hWnd ); } { BOOL bEnable = 0; CM_EnableLineToolTips( hWnd, bEnable ); } { CM_IsLineToolTipsEnabled( hWnd ); } { BOOL bEnable = 0; CM_EnableLeftMargin( hWnd, bEnable ); } { CM_IsLeftMarginEnabled( hWnd ); } { BOOL bClearUndo = 0; LPCTSTR pszFileName = 0; CM_SaveFile( hWnd, bClearUndo, pszFileName ); } { LPCTSTR pszText = 0; CM_RANGE *pRange = 0; CM_ReplaceText( hWnd, pszText, pRange ); } { CM_RANGE *pRange = 0; BOOL bLogical = FALSE; CM_GetTextLength( hWnd, pRange, bLogical ); } { LPCTSTR pszBuff = 0; CM_RANGE *pRange = 0; CM_GetText( hWnd, pszBuff, pRange ); } { int nLine = 0; LPCTSTR pszBuff = 0; CM_GetLine( hWnd, nLine, pszBuff ); } { int nLine = 0; BOOL bLogical = FALSE; CM_GetLineLength( hWnd, nLine, bLogical ); } { LPCTSTR pszBuff = 0; CM_POSITION *pPos = 0; CM_GetWord( hWnd, pszBuff, pPos ); } { CM_POSITION *pPos = 0; BOOL bLogical = FALSE; CM_GetWordLength( hWnd, pPos, bLogical ); } { LPCTSTR pszText = 0; CM_AddText( hWnd, pszText ); } { int nLine = 0; CM_DeleteLine( hWnd, nLine ); } { int nLine = 0; LPCTSTR pszText = 0; CM_InsertLine( hWnd, nLine, pszText ); } { CM_RANGE *pRange = 0; BOOL bNormalized = 0; CM_GetSel( hWnd, pRange, bNormalized ); } { CM_RANGE *pRange = 0; BOOL bMakeVisible = 0; CM_SetSel( hWnd, pRange, bMakeVisible ); } { CM_DeleteSel( hWnd ); } { LPCTSTR pszText = 0; CM_ReplaceSel( hWnd, pszText ); } { WORD wCmd = 0; DWORD dwCmdData = 0; CM_ExecuteCmd( hWnd, wCmd, dwCmdData ); } { BOOL bHorz = 0; int nPos = 0; CM_SetSplitterPos( hWnd, bHorz, nPos ); } { BOOL bHorz = 0; CM_GetSplitterPos( hWnd, bHorz ); } { int nMode = 0; CM_SetAutoIndentMode( hWnd, nMode ); } { CM_GetAutoIndentMode( hWnd ); } { CM_CanUndo( hWnd ); } { CM_CanRedo( hWnd ); } { CM_Redo( hWnd ); } { CM_Undo( hWnd ); } { CM_ClearUndoBuffer( hWnd ); } { int nLimit = 0; CM_SetUndoLimit( hWnd, nLimit ); } { CM_GetUndoLimit( hWnd ); } { CM_IsModified( hWnd ); } { BOOL bModified = 0; CM_SetModified( hWnd, bModified ); } { BOOL bEnable = 0; CM_EnableOvertype( hWnd, bEnable ); } { CM_IsOvertypeEnabled( hWnd ); } { BOOL bEnable = 0; CM_EnableCaseSensitive( hWnd, bEnable ); } { CM_IsCaseSensitiveEnabled( hWnd ); } { BOOL bEnable = 0; CM_EnablePreserveCase( hWnd, bEnable ); } { CM_IsPreserveCaseEnabled( hWnd ); } { BOOL bEnable = 0; CM_EnableWholeWord( hWnd, bEnable ); } { CM_IsWholeWordEnabled( hWnd ); } { BOOL bEnable = 0; CM_EnableRegExp( hWnd, bEnable ); } { CM_IsRegExpEnabled( hWnd ); } { int nView = 0; int nLine = 0; CM_SetTopIndex( hWnd, nView, nLine ); } { int nView = 0; CM_GetTopIndex( hWnd, nView ); } { int nView = 0; BOOL bFullyVisible = 0; CM_GetVisibleLineCount( hWnd, nView, bFullyVisible ); } { BOOL bEnable = 0; CM_EnableCRLF( hWnd, bEnable ); } { CM_IsCRLFEnabled( hWnd ); } { CM_GetCurrentView( hWnd ); } { CM_GetViewCount( hWnd ); } { BOOL bHorz = 0; BOOL bShow = 0; CM_ShowScrollBar( hWnd, bHorz, bShow ); } { BOOL bHorz = 0; CM_HasScrollBar( hWnd, bHorz ); } { int xClient = 0; int yClient = 0; CM_RANGE *pRange = 0; CM_GetSelFromPoint( hWnd, xClient, yClient, pRange ); } { int nLine = 0; BOOL bMakeVisible = 0; CM_SelectLine( hWnd, nLine, bMakeVisible ); } { int xClient = 0; int yClient = 0; CM_HitTest( hWnd, xClient, yClient ); } { BOOL bEnable = 0; CM_EnableDragDrop( hWnd, bEnable ); } { CM_IsDragDropEnabled( hWnd ); } { BOOL bHorz = 0; BOOL bEnable = 0; CM_EnableSplitter( hWnd, bHorz, bEnable ); } { BOOL bHorz = 0; CM_IsSplitterEnabled( hWnd, bHorz ); } { BOOL bEnable = 0; CM_EnableColumnSel( hWnd, bEnable ); } { CM_IsColumnSelEnabled( hWnd ); } { BOOL bEnable = 0; CM_EnableGlobalProps( hWnd, bEnable ); } { CM_IsGlobalPropsEnabled( hWnd ); } { CM_IsRecordingMacro( hWnd ); } { CM_IsPlayingMacro( hWnd ); } { HWND hWndParent = 0; CM_SetDlgParent( hWnd, hWndParent ); } { BOOL bEnable = 0; CM_EnableSelBounds( hWnd, bEnable ); } { CM_IsSelBoundsEnabled( hWnd ); } { CM_FONTSTYLES *pFontStyles = NULL; CM_SetFontStyles( hWnd, pFontStyles ); } { CM_FONTSTYLES *pFontStyles = NULL; CM_GetFontStyles( hWnd, pFontStyles ); } { LPARAM lParam = 0; int nLine = 0; CM_SetItemData( hWnd, nLine, lParam ); } { int nLine = 0; CM_GetItemData( hWnd, nLine ); } { int nLine = 0; DWORD dwStyle = 0; CM_SetLineStyle( hWnd, nLine, dwStyle ); } { int nLine = 0; CM_GetLineStyle( hWnd, nLine ); } { int nLine = 0; BOOL bEnable = 0; CM_SetBookmark( hWnd, nLine, bEnable ); } { int nLine = 0; CM_GetBookmark( hWnd, nLine ); } { int nCount = 0; LPDWORD pdwLines = NULL; CM_SetAllBookmarks( hWnd, nCount, pdwLines ); } { LPDWORD pdwLines = NULL; CM_GetAllBookmarks( hWnd, pdwLines ); } { CM_LINENUMBERING *pNumbering = NULL; CM_SetLineNumbering( hWnd, pNumbering ); } { CM_LINENUMBERING *pNumbering = NULL; CM_GetLineNumbering( hWnd, pNumbering ); } { CM_POSITION *pPos = NULL; LPRECT pRect = NULL; CM_PosFromChar( hWnd, pPos, pRect ); } { BOOL bEnable = 0; CM_EnableHideSel( hWnd, bEnable ); } { CM_IsHideSelEnabled( hWnd ); } { int nLine = 0; CM_SetHighlightedLine( hWnd, nLine ); } { CM_GetHighlightedLine( hWnd ); } { int nLine = 0; BOOL bEnable = 0; CM_SetDivider( hWnd, nLine, bEnable ); } { int nLine = 0; CM_GetDivider( hWnd, nLine ); } { BOOL bEnable = 0; CM_EnableOvertypeCaret( hWnd, bEnable ); } { CM_IsOvertypeCaretEnabled( hWnd ); } { LPCTSTR pszText = NULL; CM_SetFindText( hWnd, pszText ); } { LPCTSTR pszText = NULL; CM_GetFindText( hWnd, pszText ); } { LPCTSTR pszText = NULL; CM_SetReplaceText( hWnd, pszText ); } { LPCTSTR pszText = NULL; CM_GetReplaceText( hWnd, pszText ); } { HIMAGELIST hImageList = NULL; CM_SetImageList( hWnd, hImageList ); } { CM_GetImageList( hWnd ); } { int nLine = 0; BYTE byImages = 0; CM_SetMarginImages( hWnd, nLine, byImages ); } { int nLine = 0; CM_GetMarginImages( hWnd, nLine ); } { CM_AboutBox( hWnd ); } { HDC hDC = NULL; WORD wFlags = 0; CM_Print( hWnd, hDC, wFlags ); } { int nLine = 0; int nCol = 0; CM_SetCaretPos( hWnd, nLine, nCol ); } { int nLine = 0; int nCol = 0; CM_ViewColToBufferCol( hWnd, nLine, nCol ); } { int nLine = 0; int nCol = 0; CM_BufferColToViewCol( hWnd, nLine, nCol ); } }
CME_CODE CEdit::RegisterLanguage( LPCTSTR pszName, CM_LANGUAGE *pLang ) { ASSERT( pszName ); if ( !pLang ) { // caller did not supply a language definition. See if this // is a stock language for which we have a definition. static struct _StockLang { CM_LANGUAGE *pLang; LPCTSTR pszName; } Languages[] = { { &g_LangCPP, CMLANG_CPP }, { &g_LangPascal, CMLANG_PASCAL }, { &g_LangBasic, CMLANG_BASIC }, { &g_LangSQL, CMLANG_SQL }, { &g_LangJava, CMLANG_JAVA }, { &g_LangHTML, CMLANG_HTML }, { &g_LangXML, CMLANG_XML } }; for ( int i = 0; i < ARRAY_SIZE( Languages ); i++ ) { _StockLang *pLangCurr = Languages + i; if ( _tcsicmp( pLangCurr->pszName, pszName ) == 0 ) { pLang = pLangCurr->pLang; break; } } } ASSERT( pLang ); if ( !pLang ) { return CME_BADARGUMENT; } // make sure the same language is not registered twice BOOL bDupe = FALSE; for ( int i = 0; i < g_nLanguageCount; i++ ) { if ( _tcsicmp( g_pLanguages[ i ]->m_szName, pszName ) == 0 ) { bDupe = TRUE; break; } } if ( bDupe ) { delete g_pLanguages[ i ]; g_pLanguages[ i ] = new CLanguage( pszName, pLang ); // 'flash' the controls that have this language for ( int nWnd = 0; nWnd < g_nhWndCount; nWnd++ ) { HWND hWnd = CEdit::g_phWnds[ nWnd ]; ASSERT( IsWindow( hWnd ) ); TCHAR szLang[ CM_MAX_LANGUAGE_NAME ]; CM_GetLanguage( hWnd, szLang ); if ( _tcsicmp( szLang, pszName ) == 0 ) { // language in use -- re-establish the new language CM_SetLanguage( hWnd, NULL ); CM_SetLanguage( hWnd, pszName ); } } } else { g_pLanguages = g_pLanguages ? ( CLanguage ** ) realloc( g_pLanguages, ( g_nLanguageCount + 1 ) * sizeof( CLanguage * ) ) : ( CLanguage ** ) malloc( sizeof( CLanguage * ) ); g_pLanguages[ g_nLanguageCount++ ] = new CLanguage( pszName, pLang ); } return CME_SUCCESS; }