Index: include/commctrl.h =================================================================== --- include/commctrl.h (revision 0) +++ include/commctrl.h (revision 0) @@ -0,0 +1,12 @@ +#ifndef MYCOMPAT_COMMCTRL_H +#define MYCOMPAT_COMMCTRL_H + +#include_next + +typedef struct tagNMKEY { + NMHDR hdr; + UINT nVKey; + UINT uFlags; +} NMKEY, *LPNMKEY; + +#endif Index: include/tchar.h =================================================================== --- include/tchar.h (revision 0) +++ include/tchar.h (revision 0) @@ -0,0 +1,22 @@ +#ifndef MYCOMPAT_TCHAR_H +#define MYCOMPAT_TCHAR_H + +#include_next +#include + +#ifdef UNICODE +#define _tcscpy_s wcscpy_s +#define _tcscat_s wcscat_s +#define _tcsncicmp _wcsnicmp +#define _ttempnam _wtempnam +#define _tWinMain wWinMain +#else +#define _tcscpy_s strcpy_s +#define _tcscat_s strcat_s +#define _tcsncicmp _strnicmp +#define _ttempnam tempnam +#define _tWinMain WinMain +#endif + + +#endif Index: include/imm.h =================================================================== --- include/imm.h (revision 0) +++ include/imm.h (revision 0) @@ -0,0 +1,10 @@ +#ifndef MYCOMPAT_IMM_H +#define MYCOMPAT_IMM_H + +#include_next + +#define SCS_CAP_SETRECONVERTSTRING 0x00000004 +#define SCS_QUERYRECONVERTSTRING 0x00020000 +#define SCS_SETRECONVERTSTRING 0x00010000 + +#endif Index: include/stdio.h =================================================================== --- include/stdio.h (revision 0) +++ include/stdio.h (revision 0) @@ -0,0 +1,11 @@ +#ifndef MYCOMPAT_STDIO_H +#define MYCOMPAT_STDIO_H + +#include_next +#include // size_t +#include // va_list + +int vsprintf_s(char *buf, size_t num, const char *fmt, va_list vaarg); +int vswprintf_s(wchar_t *buf, size_t num, const wchar_t *fmt, va_list vaarg); + +#endif Index: include/string.h =================================================================== --- include/string.h (revision 0) +++ include/string.h (revision 0) @@ -0,0 +1,18 @@ +#ifndef MYCOMPAT_STRING_H +#define MYCOMPAT_STRING_H + +#include_next +#include // size_t + +typedef int errno_t; + +errno_t strcpy_s(char *dest, size_t num, const char *src); +errno_t wcscpy_s(wchar_t *dest, size_t num, const wchar_t *src); +errno_t wcsncpy_s(wchar_t *dest, size_t num, const wchar_t *src, size_t count); +errno_t strcat_s(char *dest, size_t num, const char *src); +errno_t wcscat_s(wchar_t *dest, size_t num, const wchar_t *src); + +size_t strnlen(const char *str, size_t num); +size_t wcsnlen(const wchar_t *str, size_t num); + +#endif Index: sakura_core/debug/Debug.h =================================================================== --- sakura_core/debug/Debug.h (revision 1562) +++ sakura_core/debug/Debug.h (working copy) @@ -13,6 +13,11 @@ #ifndef _DEBUG_H_ #define _DEBUG_H_ +#ifdef __GNUC__ +// GCCの標準C++ライブラリのヘッダと名前が被る +#include_next +#endif + #include #include "global.h" @@ -113,7 +118,43 @@ #define MYMESSAGEBOX MessageBoxF #define MYMESSAGEBOX_A MessageBoxF_A +#ifdef __GNUC__ +// 可変長引数が空の場合、コンマが余計になる。 +// GCCの拡張機能で回避(http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Variadic-Macros.html) + //エラー:赤丸に「×」 +#define ErrorMessage(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_ICONSTOP , GSTR_APPNAME, format, ## __VA_ARGS__) +#define ErrorMessage_A(hwnd, format, ...) MessageBoxF_A (hwnd, MB_OK | MB_ICONSTOP , GSTR_APPNAME_A, format, ## __VA_ARGS__) +//(TOPMOST) +#define TopErrorMessage(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_ICONSTOP | MB_TOPMOST , GSTR_APPNAME, format, ## __VA_ARGS__) +#define TopErrorMessage_A(hwnd, format, ...) MessageBoxF_A (hwnd, MB_OK | MB_ICONSTOP | MB_TOPMOST , GSTR_APPNAME_A, format, ## __VA_ARGS__) +#define ErrorBeep() MessageBeep(MB_ICONSTOP) + +//警告:三角に「!」 +#define WarningMessage(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_ICONEXCLAMATION , GSTR_APPNAME, format, ## __VA_ARGS__) +#define WarningMessage_A(hwnd, format, ...) MessageBoxF_A (hwnd, MB_OK | MB_ICONEXCLAMATION , GSTR_APPNAME_A, format, ## __VA_ARGS__) +#define TopWarningMessage(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_ICONEXCLAMATION | MB_TOPMOST , GSTR_APPNAME, format, ## __VA_ARGS__) +#define WarningBeep() MessageBeep(MB_ICONEXCLAMATION) + +//情報:青丸に「i」 +#define InfoMessage(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_ICONINFORMATION , GSTR_APPNAME, format, ## __VA_ARGS__) +#define InfoMessage_A(hwnd, format, ...) MessageBoxF_A (hwnd, MB_OK | MB_ICONINFORMATION , GSTR_APPNAME_A, format, ## __VA_ARGS__) +#define TopInfoMessage(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_ICONINFORMATION | MB_TOPMOST , GSTR_APPNAME, format, ## __VA_ARGS__) +#define InfoBeep() MessageBeep(MB_ICONINFORMATION) + +//その他メッセージ表示用ボックス +#define OkMessage(hwnd, format, ...) MessageBoxF (hwnd, MB_OK , GSTR_APPNAME, format, ## __VA_ARGS__) +#define OkMessage_A(hwnd, format, ...) MessageBoxF_A (hwnd, MB_OK , GSTR_APPNAME_A, format, ## __VA_ARGS__) +//(TOPMOST) +#define TopOkMessage(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_TOPMOST , GSTR_APPNAME, format, ## __VA_ARGS__) +#define TopOkMessage_A(hwnd, format, ...) MessageBoxF_A (hwnd, MB_OK | MB_TOPMOST , GSTR_APPNAME_A, format, ## __VA_ARGS__) + +//作者に教えて欲しいエラー +#define PleaseReportToAuthor(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_ICONSTOP | MB_TOPMOST , _T("作者に教えて欲しいエラー"), format, ## __VA_ARGS__) + +#else + +//エラー:赤丸に「×」 #define ErrorMessage(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_ICONSTOP , GSTR_APPNAME, format, __VA_ARGS__) #define ErrorMessage_A(hwnd, format, ...) MessageBoxF_A (hwnd, MB_OK | MB_ICONSTOP , GSTR_APPNAME_A, format, __VA_ARGS__) //(TOPMOST) @@ -143,6 +184,7 @@ //作者に教えて欲しいエラー #define PleaseReportToAuthor(hwnd, format, ...) MessageBoxF (hwnd, MB_OK | MB_ICONSTOP | MB_TOPMOST , _T("作者に教えて欲しいエラー"), format, __VA_ARGS__) +#endif // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // // フラグ等 // Index: sakura_core/doc/CDocListener.h =================================================================== --- sakura_core/doc/CDocListener.h (revision 1562) +++ sakura_core/doc/CDocListener.h (working copy) @@ -177,5 +177,5 @@ #include class CFlowInterruption : public std::exception{ public: - const char* what() const{ return "CFlowInterruption"; } + const char* what() const throw() { return "CFlowInterruption"; } }; Index: sakura_core/doc/CDocOutline.cpp =================================================================== --- sakura_core/doc/CDocOutline.cpp (revision 1562) +++ sakura_core/doc/CDocOutline.cpp (working copy) @@ -106,7 +106,7 @@ wchar_t* pszText; /* ルールファイルの内容をバッファに読み込む */ - auto_array_ptr test = new SOneRule[1024]; // 1024個許可。 2007.11.29 kobake スタック使いすぎなので、ヒープに確保するように修正。 + auto_array_ptr test(new SOneRule[1024]); // 1024個許可。 2007.11.29 kobake スタック使いすぎなので、ヒープに確保するように修正。 int nCount = ReadRuleFile(m_pcDocRef->m_cDocType.GetDocumentAttribute().m_szOutlineRuleFilename, test.get(), 1024 ); if ( nCount < 1 ){ return; Index: sakura_core/doc/CDocListener.cpp =================================================================== --- sakura_core/doc/CDocListener.cpp (revision 1562) +++ sakura_core/doc/CDocListener.cpp (working copy) @@ -21,49 +21,49 @@ } -#define DEF_NOTIFY(NAME) ECallbackResult CDocSubject::Notify##NAME##() \ +#define DEF_NOTIFY(NAME) ECallbackResult CDocSubject::Notify##NAME() \ { \ int n = GetListenerCount(); \ for(int i=0;iOn##NAME##(); \ + ECallbackResult eRet = GetListener(i)->On##NAME(); \ if(eRet!=CALLBACK_CONTINUE)return eRet; \ } \ return CALLBACK_CONTINUE; \ } -#define DEF_NOTIFY2(NAME,ARGTYPE) ECallbackResult CDocSubject::Notify##NAME##(ARGTYPE a) \ +#define DEF_NOTIFY2(NAME,ARGTYPE) ECallbackResult CDocSubject::Notify##NAME(ARGTYPE a) \ { \ int n = GetListenerCount(); \ for(int i=0;iOn##NAME##(a); \ + ECallbackResult eRet = GetListener(i)->On##NAME(a); \ if(eRet!=CALLBACK_CONTINUE)return eRet; \ } \ return CALLBACK_CONTINUE; \ } -#define VOID_NOTIFY(NAME) void CDocSubject::Notify##NAME##() \ +#define VOID_NOTIFY(NAME) void CDocSubject::Notify##NAME() \ { \ int n = GetListenerCount(); \ for(int i=0;iOn##NAME##(); \ + GetListener(i)->On##NAME(); \ } \ } -#define VOID_NOTIFY2(NAME,ARGTYPE) void CDocSubject::Notify##NAME##(ARGTYPE a) \ +#define VOID_NOTIFY2(NAME,ARGTYPE) void CDocSubject::Notify##NAME(ARGTYPE a) \ { \ int n = GetListenerCount(); \ for(int i=0;iOn##NAME##(a); \ + GetListener(i)->On##NAME(a); \ } \ } //######仮 -#define CORE_NOTIFY2(NAME,ARGTYPE) ELoadResult CDocSubject::Notify##NAME##(ARGTYPE a) \ +#define CORE_NOTIFY2(NAME,ARGTYPE) ELoadResult CDocSubject::Notify##NAME(ARGTYPE a) \ { \ int n = GetListenerCount(); \ ELoadResult eRet = LOADED_FAILURE; \ for(int i=0;iOn##NAME##(a); \ + ELoadResult e = GetListener(i)->On##NAME(a); \ if(e==LOADED_NOIMPLEMENT)continue; \ if(e==LOADED_FAILURE)return e; \ eRet = e; \ Index: sakura_core/doc/CLayoutMgr.h =================================================================== --- sakura_core/doc/CLayoutMgr.h (revision 1562) +++ sakura_core/doc/CLayoutMgr.h (working copy) @@ -39,7 +39,7 @@ struct STypeConfig;// 2005.11.20 Moca class CColorStrategy; #include "basis/SakuraBasis.h" -enum EColorIndexType; +#include "view/colors/CColorStrategy.h" // EColorIndexType struct LayoutReplaceArg { CLayoutRange sDelRange; //!< 削除範囲。レイアウト単位。 Index: sakura_core/CProcess.h =================================================================== --- sakura_core/CProcess.h (revision 1562) +++ sakura_core/CProcess.h (working copy) @@ -37,7 +37,9 @@ protected: void SetMainWindow(HWND hwnd){ m_hWnd = hwnd; } +#ifndef DISABLE_CRASHDUMP int WriteDump( PEXCEPTION_POINTERS pExceptPtrs ); +#endif public: HINSTANCE GetProcessInstance() const{ return m_hInstance; } CShareData& GetShareData() { return m_cShareData; } @@ -48,6 +50,7 @@ HINSTANCE m_hInstance; HWND m_hWnd; LPTSTR m_CommandLine; +#ifndef DISABLE_CRASHDUMP BOOL (WINAPI *m_pfnMiniDumpWriteDump)( HANDLE hProcess, DWORD ProcessId, @@ -57,6 +60,7 @@ PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, PMINIDUMP_CALLBACK_INFORMATION CallbackParam ); +#endif // 唯一のCShareDateとする。(CProcessが責任を持ってnew/deleteする) CShareData m_cShareData; Index: sakura_core/mem/CMemory.h =================================================================== --- sakura_core/mem/CMemory.h (revision 1562) +++ sakura_core/mem/CMemory.h (working copy) @@ -107,12 +107,12 @@ // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // // inline関数の実装 // // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // -__forceinline const void* CMemory::GetRawPtr(int* pnLength) const //!< データへのポインタと長さ返す +inline const void* CMemory::GetRawPtr(int* pnLength) const //!< データへのポインタと長さ返す { if(pnLength) *pnLength = GetRawLength(); return m_pRawData; } -__forceinline void* CMemory::GetRawPtr(int* pnLength) //!< データへのポインタと長さ返す +inline void* CMemory::GetRawPtr(int* pnLength) //!< データへのポインタと長さ返す { if(pnLength) *pnLength = GetRawLength(); return m_pRawData; Index: sakura_core/prop/CPropComMacro.cpp =================================================================== --- sakura_core/prop/CPropComMacro.cpp (revision 1562) +++ sakura_core/prop/CPropComMacro.cpp (working copy) @@ -245,7 +245,7 @@ sItem.iItem = index; sItem.mask = LVIF_TEXT; sItem.iSubItem = 3; - sItem.pszText = m_pShareData->m_Common.m_sMacro.m_MacroTable[index].m_bReloadWhenExecute ? _T("on") : _T("off"); + sItem.pszText = const_cast(m_pShareData->m_Common.m_sMacro.m_MacroTable[index].m_bReloadWhenExecute ? _T("on") : _T("off")); ListView_SetItem( hListView, &sItem ); } @@ -326,12 +326,13 @@ return TRUE; } +struct ColumnData { + TCHAR *title; + int width; +}; void CPropCommon::InitDialog_PROP_Macro( HWND hwndDlg ) { - struct ColumnData { - TCHAR *title; - int width; - } ColumnList[] = { + ColumnData ColumnList[] = { { _T("番号"), 40 }, { _T("マクロ名"), 180 }, { _T("ファイル名"), 180 }, @@ -442,7 +443,7 @@ sItem.iItem = index; sItem.mask = LVIF_TEXT; sItem.iSubItem = 3; - sItem.pszText = ::IsDlgButtonChecked( hwndDlg, IDC_CHECK_RELOADWHENEXECUTE ) ? _T("on") : _T("off"); + sItem.pszText = const_cast(::IsDlgButtonChecked( hwndDlg, IDC_CHECK_RELOADWHENEXECUTE ) ? _T("on") : _T("off")); ListView_SetItem( hListView, &sItem ); } Index: sakura_core/CDllHandler.h =================================================================== --- sakura_core/CDllHandler.h (revision 1562) +++ sakura_core/CDllHandler.h (working copy) @@ -59,7 +59,7 @@ DLLIMP* operator->(){ return m_pcDllImp; } //! 利用状態のチェック(operator版) - bool operator!() const { return IsAvailable(); } + bool operator!() const { return m_pcDllImp->IsAvailable(); } private: DLLIMP* m_pcDllImp; Index: sakura_core/CDataProfile.h =================================================================== --- sakura_core/CDataProfile.h (revision 1562) +++ sakura_core/CDataProfile.h (working copy) @@ -5,32 +5,34 @@ #include "types/CType.h" //文字列バッファの型 -struct StringBufferW{ +struct StringBufferW_{ WCHAR* pData; const int nDataCount; - StringBufferW() : pData(L""), nDataCount(0) { } - StringBufferW(WCHAR* _pData, int _nDataCount) : pData(_pData), nDataCount(_nDataCount) { } + StringBufferW_() : pData(L""), nDataCount(0) { } + StringBufferW_(WCHAR* _pData, int _nDataCount) : pData(_pData), nDataCount(_nDataCount) { } - StringBufferW& operator = (const StringBufferW& rhs) + StringBufferW_& operator = (const StringBufferW_& rhs) { auto_strcpy_s(pData,nDataCount,rhs.pData); return *this; } }; -struct StringBufferA{ +struct StringBufferA_{ ACHAR* pData; int nDataCount; - StringBufferA() : pData(""), nDataCount(0) { } - StringBufferA(ACHAR* _pData, int _nDataCount) : pData(_pData), nDataCount(_nDataCount) { } + StringBufferA_() : pData(""), nDataCount(0) { } + StringBufferA_(ACHAR* _pData, int _nDataCount) : pData(_pData), nDataCount(_nDataCount) { } - StringBufferA& operator = (const StringBufferA& rhs) + StringBufferA_& operator = (const StringBufferA_& rhs) { auto_strcpy_s(pData,nDataCount,rhs.pData); return *this; } }; +typedef const StringBufferA_ StringBufferA; +typedef const StringBufferW_ StringBufferW; #ifdef _UNICODE typedef StringBufferW StringBufferT; #else Index: sakura_core/env/CAppNodeManager.h =================================================================== --- sakura_core/env/CAppNodeManager.h (revision 1562) +++ sakura_core/env/CAppNodeManager.h (working copy) @@ -97,7 +97,7 @@ }; -inline CAppNodeGroupHandle EditNode::GetGroup() const{ if(this)return m_nGroup; else return NULL; } +inline CAppNodeGroupHandle EditNode::GetGroup() const{ if(this)return m_nGroup; else return CAppNodeGroupHandle(0); } inline bool EditNode::IsTopInGroup() const{ return this && (CAppNodeGroupHandle(m_nGroup).GetEditNodeAt(0) == this); } Index: sakura_core/basis/CStrictInteger.h =================================================================== --- sakura_core/basis/CStrictInteger.h (revision 1562) +++ sakura_core/basis/CStrictInteger.h (working copy) @@ -71,6 +71,13 @@ CDummy(); CDummy(int); }; + template struct ChooseIntOrDummy { + typedef int Type; + }; + // クラス内でテンプレートの特殊化をするとG++に怒られるので部分特殊化にする + template struct ChooseIntOrDummy { + typedef CDummy Type; + }; public: //コンストラクタ・デストラクタ CStrictInteger(){ m_value=0; } @@ -129,26 +136,23 @@ // -- -- -- -- 別種のCStrictIntegerとの演算は絶対許さん(やりたきゃintでも介してください) -- -- -- -- // private: - template Me& operator += (const CStrictInteger&){ DAMEDAYO; } - template Me& operator -= (const CStrictInteger&){ DAMEDAYO; } - template Me operator + (const CStrictInteger&) const{ DAMEDAYO; } - template Me operator - (const CStrictInteger&) const{ DAMEDAYO; } - template Me& operator = (const CStrictInteger&){ DAMEDAYO; } - template bool operator < (const CStrictInteger&) const{ DAMEDAYO; } - template bool operator <= (const CStrictInteger&) const{ DAMEDAYO; } - template bool operator > (const CStrictInteger&) const{ DAMEDAYO; } - template bool operator >= (const CStrictInteger&) const{ DAMEDAYO; } - template bool operator == (const CStrictInteger&) const{ DAMEDAYO; } - template bool operator != (const CStrictInteger&) const{ DAMEDAYO; } + template Me& operator += (const CStrictInteger&); + template Me& operator -= (const CStrictInteger&); + template Me operator + (const CStrictInteger&) const; + template Me operator - (const CStrictInteger&) const; + template Me& operator = (const CStrictInteger&); + template bool operator < (const CStrictInteger&) const; + template bool operator <= (const CStrictInteger&) const; + template bool operator > (const CStrictInteger&) const; + template bool operator >= (const CStrictInteger&) const; + template bool operator == (const CStrictInteger&) const; + template bool operator != (const CStrictInteger&) const; // -- -- -- -- ALLOW_ADDSUB_INTがtrueの場合は、intとの加減算を許す -- -- -- -- // private: - template struct AddsubInteger{}; - template<> struct AddsubInteger{ typedef int Type; }; - template<> struct AddsubInteger{ typedef CDummy Type; }; - typedef typename AddsubInteger< ALLOW_ADDSUB_INT>::Type AddsubIntegerType; - typedef typename AddsubInteger::Type NotAddsubIntegerType; + typedef typename ChooseIntOrDummy< ALLOW_ADDSUB_INT>::Type AddsubIntegerType; + typedef typename ChooseIntOrDummy::Type NotAddsubIntegerType; public: Me& operator += (AddsubIntegerType rhs) { m_value += rhs; return *this; } Me& operator -= (AddsubIntegerType rhs) { m_value -= rhs; return *this; } @@ -164,11 +168,8 @@ // -- -- -- -- ALLOW_CMP_INTがtrueの場合は、intとの比較を許す -- -- -- -- // private: - template struct CmpInteger{}; - template<> struct CmpInteger{ typedef int Type; }; - template<> struct CmpInteger{ typedef CDummy Type; }; - typedef typename CmpInteger< ALLOW_CMP_INT>::Type CmpIntegerType; - typedef typename CmpInteger::Type NotCmpIntegerType; + typedef typename ChooseIntOrDummy< ALLOW_CMP_INT>::Type CmpIntegerType; + typedef typename ChooseIntOrDummy::Type NotCmpIntegerType; public: bool operator < (CmpIntegerType rhs) const{ return m_value < rhs; } bool operator <= (CmpIntegerType rhs) const{ return m_value <= rhs; } @@ -188,25 +189,19 @@ // -- -- -- -- ALLOW_CAST_INTがtrueの場合は、intへの暗黙の変換を許す -- -- -- -- // private: - template struct CastInteger{}; - template<> struct CastInteger{ typedef int Type; }; - template<> struct CastInteger{ typedef CDummy Type; }; - typedef typename CastInteger< ALLOW_CAST_INT>::Type CastIntegerType; - typedef typename CastInteger::Type NotCastIntegerType; + typedef typename ChooseIntOrDummy< ALLOW_CAST_INT>::Type CastIntegerType; + typedef typename ChooseIntOrDummy::Type NotCastIntegerType; public: operator CastIntegerType() const{ return m_value; } private: //※ALLOW_CAST_INTがfalseの場合は、privateメンバを置くことにより、「明示的に」暗黙変換を禁止する。 - operator NotCastIntegerType() const{ DAMEDAYO; } + operator NotCastIntegerType() const; // -- -- -- -- ALLOW_ASSIGNOP_INTがtrueの場合は、intの代入を許す -- -- -- -- // private: - template struct AssignInteger{}; - template<> struct AssignInteger{ typedef int Type; }; - template<> struct AssignInteger{ typedef CDummy Type; }; - typedef typename AssignInteger< ALLOW_ASSIGNOP_INT>::Type AssignIntegerType; - typedef typename AssignInteger::Type NotAssignIntegerType; + typedef typename ChooseIntOrDummy< ALLOW_ASSIGNOP_INT>::Type AssignIntegerType; + typedef typename ChooseIntOrDummy::Type NotAssignIntegerType; public: Me& operator = (const AssignIntegerType& rhs){ m_value = rhs; return *this; } private: Index: sakura_core/basis/SakuraBasis.h =================================================================== --- sakura_core/basis/SakuraBasis.h (revision 1562) +++ sakura_core/basis/SakuraBasis.h (working copy) @@ -68,6 +68,7 @@ #include "CMyPoint.h" typedef CRangeBase SelectionRange; +#include "CMyRect.h" // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // Index: sakura_core/basis/CStrictPoint.h =================================================================== --- sakura_core/basis/CStrictPoint.h (revision 1562) +++ sakura_core/basis/CStrictPoint.h (working copy) @@ -20,6 +20,8 @@ typedef INT_TYPE IntType; typedef SUPER_INT_TYPE SuperIntType; public: + using SUPER::x; + using SUPER::y; //コンストラクタ・デストラクタ CStrictPoint(){ x=SuperIntType(0); y=SuperIntType(0); } CStrictPoint(int _x,int _y){ x=SuperIntType(_x); y=SuperIntType(_y); } Index: sakura_core/convert/CConvert_Base64Decode.h =================================================================== --- sakura_core/convert/CConvert_Base64Decode.h (revision 1562) +++ sakura_core/convert/CConvert_Base64Decode.h (working copy) @@ -1,19 +0,0 @@ -#pragma once - -#include "CConvert.h" - -class CConvert_Base64Decode : public CConvert{ -public: - //CConvertインターフェース - bool DoConvert(CNativeW* pcData) - { - //$$$ 未実装につき、falseを返す - return false; - } - -public: - //実装 - static void BASE64Decode(const CNativeW* pcSrc, CMemory* pcDst); // Base64デコード - template - static long MemBASE64_Decode( const CHAR_TYPE* pszSrc, long nSrcLen, BYTE* pDst ); /* Base64デコード */ -}; Index: sakura_core/convert/CConvert_Base64Decode.cpp =================================================================== --- sakura_core/convert/CConvert_Base64Decode.cpp (revision 1562) +++ sakura_core/convert/CConvert_Base64Decode.cpp (working copy) @@ -1,144 +0,0 @@ -#include "stdafx.h" -#include "CConvert_Base64Decode.h" -#include "charset/charcode.h" -#include "charset/CBase64.h" - -#if 1 //$$$保留 - -/* 文字がBase64のデータか */ -int IsBASE64Char( wchar_t cData ) -{ - char buf[4]={0}; - int n=wctomb(buf,cData); - - int nret = -1; - if( n==1 && (unsigned char)buf[0] < 0x80 ){ - nret = CBase64::BASE64VAL[cData]; - if( nret == 0xff ){ - nret = -1; - } - } - return nret; -} -int IsBASE64Char( char cData ) -{ - int nret = -1; - if( (unsigned char)cData < 0x80 ){ - nret = CBase64::BASE64VAL[cData]; - if( nret == 0xff ){ - nret = -1; - } - } - return nret; -} - - -/* Base64デコード */ -void CConvert_Base64Decode::BASE64Decode( const CNativeW* pcSrc, CMemory* pcDst ) -{ - //データ取得 - int nSrcLen; - const wchar_t* pszSrc = pcSrc->GetStringPtr(&nSrcLen); - - int nBgn; - int nPos; - CMemory cmemBuf; - - nBgn = 0; - nPos = 0; - while( nBgn < nSrcLen ){ - while( nBgn < nSrcLen && 0 > IsBASE64Char( pszSrc[nBgn] ) ){ - nBgn++; - } - nPos = nBgn + 1; - while( nPos < nSrcLen && 0 <= IsBASE64Char( pszSrc[nPos] ) ){ - nPos++; - } - if( nBgn < nSrcLen && nPos - nBgn > 0 ){ - BYTE* pBin = new BYTE[nPos - nBgn]; - - // Base64デコード - int nBinLen = MemBASE64_Decode( &pszSrc[nBgn], nPos - nBgn, pBin ); - cmemBuf.AppendRawData( pBin, nBinLen ); - delete [] pBin; - } - nBgn = nPos; - } - pcDst->SetRawData( cmemBuf.GetRawPtr(), cmemBuf.GetRawLength() ); - return; -} - - - - -// BASE64 => デコード後 -// 4文字 => 3文字 - -// Base64デコード -template -long CConvert_Base64Decode::MemBASE64_Decode( const CHAR_TYPE* pszSrc, long nSrcLen, BYTE* pDst ) -{ - long nSrcSize; - long lData; - long nDesLen; - long lDesSize; - int sMax; - - //Srcの有効長の算出 -> nSrcSize - { - int i; - for( i = 0; i < nSrcLen; i++ ){ - if( sizeof(CHAR_TYPE)==1 && pszSrc[i]=='=' ){ - break; - } - else if( sizeof(CHAR_TYPE)==2 && pszSrc[i]==L'=' ){ - break; - } - } - nSrcSize = i; - } - - //変換先確保 -> pszDes, nDesLen - nDesLen = (nSrcSize / 4) * 3; - nDesLen += ((nSrcSize % 4) * 6) / 8; - BYTE* pszDes; - pszDes = new BYTE[nDesLen + 1]; - memset( pszDes, 0, nDesLen + 1 ); - - lDesSize = 0; - for( int i = 0; i < nSrcSize; i++ ){ - if( i < nSrcSize - (nSrcSize % 4) ){ - sMax = 4; - }else{ - sMax = (nSrcSize % 4); - } - lData = 0; - for( int j = 0; j < sMax; j++ ){ - int k = IsBASE64Char( pszSrc[i + j] ); - if( k >= 0 ){ - lData |= (((long)k) << ((4 - j - 1) * 6)); - } - } - for( int j = 0; j < (sMax * 6)/ 8 ; j++ ){ - pszDes[lDesSize] = (unsigned char)((lData >> (8 * (2 - j))) & 0x0000ff); - lDesSize++; - } - i+= 3; - } - pszDes[lDesSize] = 0; - - //バッファコピー - memcpy( pDst, pszDes, lDesSize ); - - delete [] pszDes; - return lDesSize; -} - - - -//インスタンス化 -template long CConvert_Base64Decode::MemBASE64_Decode( const WCHAR* pszSrc, long nSrcLen, BYTE* pDst ); /* Base64デコード */ -template long CConvert_Base64Decode::MemBASE64_Decode( const ACHAR* pszSrc, long nSrcLen, BYTE* pDst ); /* Base64デコード */ - -#endif - Index: sakura_core/convert/convert_util2.h =================================================================== --- sakura_core/convert/convert_util2.h (revision 1562) +++ sakura_core/convert/convert_util2.h (working copy) @@ -32,7 +32,9 @@ #include "parse/CWordParse.h" #include "mem/CMemory.h" +#include "charset/charcode.h" +namespace WCODE{} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: sakura_core/recent/CRecentImp.cpp =================================================================== --- sakura_core/recent/CRecentImp.cpp (revision 1562) +++ sakura_core/recent/CRecentImp.cpp (working copy) @@ -476,8 +476,8 @@ template class CRecentImp; template class CRecentImp; template class CRecentImp; -template class CRecentImp; -template class CRecentImp; +//template class CRecentImp; +//template class CRecentImp; template class CRecentImp; -template class CRecentImp; -template class CRecentImp; +//template class CRecentImp; +//template class CRecentImp; Index: sakura_core/CControlTray.cpp =================================================================== --- sakura_core/CControlTray.cpp (revision 1562) +++ sakura_core/CControlTray.cpp (working copy) @@ -169,7 +169,7 @@ NULL, _T("CControlTray::CControlTray()\n") _T("アクセラレータ テーブルが作成できません。\n") - _T("システムリソースが不足しています。"), + _T("システムリソースが不足しています。") ); } @@ -585,7 +585,7 @@ NULL, _T("CControlTray::DispatchEvent()\n") _T("アクセラレータ テーブルが作成できません。\n") - _T("システムリソースが不足しています。"), + _T("システムリソースが不足しています。") ); } Index: sakura_core/docplus/CDiffManager.h =================================================================== --- sakura_core/docplus/CDiffManager.h (revision 1562) +++ sakura_core/docplus/CDiffManager.h (working copy) @@ -6,7 +6,7 @@ #include "util/design_template.h" //TSingleton class CDocLine; class CDocLineMgr; -enum EColorIndexType; +#include "view/colors/CColorStrategy.h" // EColorIndexType class CTypeSupport; //! DIFF情報定数 Index: sakura_core/StdAfx.h =================================================================== --- sakura_core/StdAfx.h (revision 1562) +++ sakura_core/StdAfx.h (working copy) @@ -11,7 +11,6 @@ #endif // _MSC_VER > 1000 // この位置にヘッダーを挿入してください -#define WIN32_LEAN_AND_MEAN // Windows ヘッダーから殆ど使用されないスタッフを除外します #if _MSC_VER >= 1400 #pragma warning( disable : 4996 ) Index: sakura_core/window/CEditWnd.cpp =================================================================== --- sakura_core/window/CEditWnd.cpp (revision 1562) +++ sakura_core/window/CEditWnd.cpp (working copy) @@ -1680,7 +1680,8 @@ CMRU cMRU; EditInfo checkEditInfo; cMRU.GetEditInfo(wID - IDM_SELMRU, &checkEditInfo); - GetDocument().m_cDocFileOperation.FileLoad( &SLoadInfo(checkEditInfo.m_szPath, checkEditInfo.m_nCharCode, false) ); // Oct. 9, 2004 genta 共通関数化 + SLoadInfo sLoadInfo(checkEditInfo.m_szPath, checkEditInfo.m_nCharCode, false); + GetDocument().m_cDocFileOperation.FileLoad( &sLoadInfo ); // Oct. 9, 2004 genta 共通関数化 } //最近使ったフォルダ else if( wID - IDM_SELOPENFOLDER >= 0 && wID - IDM_SELOPENFOLDER < 999){ Index: sakura_core/Makefile =================================================================== --- sakura_core/Makefile (revision 0) +++ sakura_core/Makefile (revision 0) @@ -0,0 +1,374 @@ +# charset=utf-8 + +# 縺薙l縺ッ繧ッ繝ュ繧ケ繧ウ繝ウ繝代う繝ォ逕ィ +PREFIX= i386-mingw32- + +CC= $(PREFIX)gcc +CXX= $(PREFIX)g++ +RC= $(PREFIX)windres + +# Windows縺ョ繝舌シ繧ク繝ァ繝ウ縺ッ驕ゥ蠖 +DEFINES= \ + -DWIN32 \ + -DWINVER=0x500 \ + -D_WIN32_WINNT=0x500 \ + -D_WIN32_IE=0x400 \ + -DNOMINMAX \ + -DSAKURA_NO_DLL \ + -DNDEBUG \ + -DDISABLE_CRASHDUMP +CFLAGS= -O2 \ + -finput-charset=cp932 -fexec-charset=cp932 \ + -I../include -I. \ + $(DEFINES) $(MYCFLAGS) +CXXFLAGS= $(CFLAGS) $(MYCXXFLAGS) +LIBS= \ + -lkernel32 -luser32 -lgdi32 \ + -lwinspool -lcomdlg32 -ladvapi32 \ + -lshell32 -lole32 -loleaut32 \ + -luuid -lcomctl32 -limm32 \ + -lmpr -limagehlp + +exe= sakura.exe + +# ls *.C *.cpp */*.cpp */*/*.cpp | sed -E -e "s/([[:alnum:]_]+)\.[[:alnum:]]+/\1.o \\\\/" +OBJS= \ +CAppMode.o \ +CAutoReloadAgent.o \ +CAutoSaveAgent.o \ +CBackupAgent.o \ +CBregexp.o \ +CBregexpDll2.o \ +CClipboard.o \ +CCodeChecker.o \ +CCommandLine.o \ +CControlProcess.o \ +CControlTray.o \ +CDataProfile.o \ +CDicMgr.o \ +CDllHandler.o \ +CDropTarget.o \ +CEditApp.o \ +CEol.o \ +CFileExt.o \ +CGraphics.o \ +CGrepAgent.o \ +CHokanMgr.o \ +CHtmlHelp.o \ +CImageListMgr.o \ +CKeyWordSetMgr.o \ +CLoadAgent.o \ +CMarkMgr.o \ +CMenuDrawer.o \ +CMigemo.o \ +CNormalProcess.o \ +COpe.o \ +COpeBlk.o \ +COpeBuf.o \ +CPrint.o \ +CPrintPreview.o \ +CProcess.o \ +CProcessFactory.o \ +CProfile.o \ +CPropertyManager.o \ +CReadHelper.o \ +CReadManager.o \ +CRegexKeyword.o \ +CSaveAgent.o \ +CSearchAgent.o \ +CSortedTagJumpList.o \ +CSoundSet.o \ +CUxTheme.o \ +CViewCommander.o \ +CViewCommander_Diff.o \ +CViewCommander_Grep.o \ +CViewCommander_Hokan.o \ +CViewCommander_New.o \ +CVisualProgress.o \ +CWaitCursor.o \ +CWriteManager.o \ +StdAfx.o \ +WinMain.o \ +apiwrap/StdApi.o \ +apiwrap/StdControl.o \ +basis/CLaxInteger.o \ +basis/CMyPoint.o \ +basis/CMyRect.o \ +basis/CMySize.o \ +basis/CMyString.o \ +basis/CStrictInteger.o \ +basis/CStrictPoint.o \ +basis/CStrictRange.o \ +basis/CStrictRect.o \ +basis/SakuraBasis.o \ +charset/CCodeBase.o \ +charset/CCodeFactory.o \ +charset/CCodeMediator.o \ +charset/CESI.o \ +charset/CEuc.o \ +charset/CJis.o \ +charset/CShiftJis.o \ +charset/CUnicode.o \ +charset/CUnicodeBe.o \ +charset/CUtf7.o \ +charset/CUtf8.o \ +charset/charcode.o \ +charset/charset.o \ +charset/codechecker.o \ +charset/codeutil.o \ +convert/CConvert.o \ +convert/CConvert_HaneisuToZeneisu.o \ +convert/CConvert_HankanaToZenhira.o \ +convert/CConvert_HankanaToZenkana.o \ +convert/CConvert_SpaceToTab.o \ +convert/CConvert_TabToSpace.o \ +convert/CConvert_ToHankaku.o \ +convert/CConvert_ToLower.o \ +convert/CConvert_ToUpper.o \ +convert/CConvert_ToZenhira.o \ +convert/CConvert_ToZenkana.o \ +convert/CConvert_Trim.o \ +convert/CConvert_UuDecode.o \ +convert/CConvert_ZeneisuToHaneisu.o \ +convert/CConvert_ZenkanaToHankana.o \ +convert/CDecode_Base64Decode.o \ +convert/CDecode_UuDecode.o \ +convert/convert_util.o \ +convert/convert_util2.o \ +debug/CRunningTimer.o \ +debug/Debug.o \ +debug/Debug2.o \ +debug/Debug3.o \ +dlg/CDialog.o \ +dlg/CDlgAbout.o \ +dlg/CDlgCancel.o \ +dlg/CDlgCompare.o \ +dlg/CDlgCtrlCode.o \ +dlg/CDlgDebug.o \ +dlg/CDlgDiff.o \ +dlg/CDlgExec.o \ +dlg/CDlgFavorite.o \ +dlg/CDlgFileUpdateQuery.o \ +dlg/CDlgFind.o \ +dlg/CDlgGrep.o \ +dlg/CDlgInput1.o \ +dlg/CDlgJump.o \ +dlg/CDlgOpenFile.o \ +dlg/CDlgPrintPage.o \ +dlg/CDlgPrintSetting.o \ +dlg/CDlgProperty.o \ +dlg/CDlgReplace.o \ +dlg/CDlgTagJumpList.o \ +dlg/CDlgTagsMake.o \ +dlg/CDlgTypeList.o \ +dlg/CDlgWinSize.o \ +doc/CBlockComment.o \ +doc/CDocEditor.o \ +doc/CDocFile.o \ +doc/CDocFileOperation.o \ +doc/CDocLine.o \ +doc/CDocLineMgr.o \ +doc/CDocListener.o \ +doc/CDocLocker.o \ +doc/CDocOutline.o \ +doc/CDocReader.o \ +doc/CDocType.o \ +doc/CDocTypeSetting.o \ +doc/CDocVisitor.o \ +doc/CEditDoc.o \ +doc/CLayout.o \ +doc/CLayoutMgr.o \ +doc/CLayoutMgr_Color.o \ +doc/CLayoutMgr_DoLayout.o \ +doc/CLayoutMgr_New.o \ +doc/CLayoutMgr_New2.o \ +doc/CLineComment.o \ +docplus/CBookmarkManager.o \ +docplus/CDiffManager.o \ +docplus/CModifyManager.o \ +env/CAppNodeManager.o \ +env/CDocTypeManager.o \ +env/CFileNameManager.o \ +env/CFormatManager.o \ +env/CHelpManager.o \ +env/CSakuraEnvironment.o \ +env/CSearchKeywordManager.o \ +env/CShareData.o \ +env/CShareData_IO.o \ +env/CTagJumpManager.o \ +env/CommonSetting.o \ +env/DLLSHAREDATA.o \ +func/CFuncKeyWnd.o \ +func/CFuncLookup.o \ +func/CKeyBind.o \ +func/Funccode.o \ +global.o \ +io/CBinaryStream.o \ +io/CFile.o \ +io/CFileLoad.o \ +io/CIoBridge.o \ +io/CStream.o \ +io/CTextStream.o \ +macro/CKeyMacroMgr.o \ +macro/CMacro.o \ +macro/CMacroFactory.o \ +macro/CMacroManagerBase.o \ +macro/CPPA.o \ +macro/CPPAMacroMgr.o \ +macro/CSMacroMgr.o \ +macro/CWSH.o \ +mem/CMemory.o \ +mem/CNative.o \ +mem/CNativeA.o \ +mem/CNativeW.o \ +mem/CRecycledBuffer.o \ +mfclike/CMyWnd.o \ +outline/CDlgFuncList.o \ +outline/CFuncInfo.o \ +outline/CFuncInfoArr.o \ +parse/CWordParse.o \ +prop/CPropComBackup.o \ +prop/CPropComCustmenu.o \ +prop/CPropComEdit.o \ +prop/CPropComFile.o \ +prop/CPropComFileName.o \ +prop/CPropComFormat.o \ +prop/CPropComGrep.o \ +prop/CPropComHelper.o \ +prop/CPropComKeybind.o \ +prop/CPropComKeyword.o \ +prop/CPropComMacro.o \ +prop/CPropComStatusbar.o \ +prop/CPropComTab.o \ +prop/CPropComToolbar.o \ +prop/CPropComWin.o \ +prop/CPropCommon.o \ +recent/CMRU.o \ +recent/CMRUFolder.o \ +recent/CMruListener.o \ +recent/CRecent.o \ +recent/CRecentCmd.o \ +recent/CRecentEditNode.o \ +recent/CRecentFile.o \ +recent/CRecentFolder.o \ +recent/CRecentGrepFile.o \ +recent/CRecentGrepFolder.o \ +recent/CRecentImp.o \ +recent/CRecentReplace.o \ +recent/CRecentSearch.o \ +recent/CRecentTagjumpKeyword.o \ +types/CDlgKeywordSelect.o \ +types/CDlgSameColor.o \ +types/CPropTypes.o \ +types/CPropTypes_P1_Screen.o \ +types/CPropTypes_P2_Color.o \ +types/CPropTypes_P3_Support.o \ +types/CPropTypes_P4_Regex.o \ +types/CPropTypes_P5_KeyHelp.o \ +types/CType.o \ +types/CTypeSupport.o \ +types/CType_Asm.o \ +types/CType_Awk.o \ +types/CType_Basis.o \ +types/CType_Cobol.o \ +types/CType_CorbaIdl.o \ +types/CType_Cpp.o \ +types/CType_Dos.o \ +types/CType_Html.o \ +types/CType_Ini.o \ +types/CType_Java.o \ +types/CType_Others.o \ +types/CType_Pascal.o \ +types/CType_Perl.o \ +types/CType_Python.o \ +types/CType_Rich.o \ +types/CType_Sql.o \ +types/CType_Tex.o \ +types/CType_Text.o \ +types/CType_Vb.o \ +util/file.o \ +util/format.o \ +util/input.o \ +util/module.o \ +util/os.o \ +util/other_util.o \ +util/relation_tool.o \ +util/shell.o \ +util/string_ex.o \ +util/string_ex2.o \ +util/tchar_convert.o \ +util/tchar_printf.o \ +util/tchar_receive.o \ +util/tchar_template.o \ +util/window.o \ +view/CCaret.o \ +view/CEditView.o \ +view/CEditView_CmdHokan.o \ +view/CEditView_Cmdgrep.o \ +view/CEditView_Cmdisrch.o \ +view/CEditView_Command.o \ +view/CEditView_Command_New.o \ +view/CEditView_Diff.o \ +view/CEditView_ExecCmd.o \ +view/CEditView_Ime.o \ +view/CEditView_Mouse.o \ +view/CEditView_Paint.o \ +view/CEditView_Paint_Bracket.o \ +view/CEditView_Scroll.o \ +view/CEditView_Search.o \ +view/CRuler.o \ +view/CTextArea.o \ +view/CTextDrawer.o \ +view/CTextMetrics.o \ +view/CViewCalc.o \ +view/CViewFont.o \ +view/CViewParser.o \ +view/CViewSelect.o \ +view/DispPos.o \ +view/colors/CColorStrategy.o \ +view/colors/CColor_Comment.o \ +view/colors/CColor_Found.o \ +view/colors/CColor_KeywordSet.o \ +view/colors/CColor_Numeric.o \ +view/colors/CColor_Quote.o \ +view/colors/CColor_RegexKeyword.o \ +view/colors/CColor_Url.o \ +view/figures/CFigureManager.o \ +view/figures/CFigureStrategy.o \ +view/figures/CFigure_CtrlCode.o \ +view/figures/CFigure_Eol.o \ +view/figures/CFigure_HanSpace.o \ +view/figures/CFigure_Tab.o \ +view/figures/CFigure_ZenSpace.o \ +window/CEditWnd.o \ +window/CMainStatusBar.o \ +window/CMainToolBar.o \ +window/CSplitBoxWnd.o \ +window/CSplitterWnd.o \ +window/CTabWnd.o \ +window/CTipWnd.o \ +window/CWnd.o \ +sakura_rc.o + + +all: $(exe) + +$(exe): $(OBJS) + $(CXX) -o $@ $(OBJS) $(LIBS) + +.cpp.o: + $(CXX) $(CXXFLAGS) -o $@ -c $< + +.rc.o: + $(RC) --language=0411 $(DEFINES) -J rc -O coff -i $< -o $@ + +clean: + $(RM) $(exe) $(OBJS) + +depend: + $(CXX) -E -MM -w $(DEFINES) $(CXXFLAGS) *.cpp */*.cpp */*/*.cpp > depend.mak + +.SUFFIXES: .cpp .o .rc +.PHONY: all clean depend + +include depend.mak Index: sakura_core/CViewCommander.cpp =================================================================== --- sakura_core/CViewCommander.cpp (revision 1562) +++ sakura_core/CViewCommander.cpp (working copy) @@ -3161,6 +3161,8 @@ CLayoutRange sSelect_Old; CLayoutInt nLineNumOld; + bool bRedo = TRUE; // hor + bSelecting = FALSE; // 2004.05.30 Moca bChangeCurRegexpに応じて対象文字列を変える if( bChangeCurRegexp && L'\0' == GetDllShareData().m_sSearchKeywords.m_aSearchKeys[0][0] @@ -3232,7 +3234,6 @@ // 2004.05.30 Moca CEditViewの現在設定されている検索パターンを使えるように if(bChangeCurRegexp && !m_pCommanderView->ChangeCurRegexp())return; - bool bRedo = TRUE; // hor nLineNumOld = nLineNum; // hor int nIdxOld = nIdx; // hor @@ -8664,7 +8665,7 @@ try{ // ファイルを開く - cfl.FileOpen( to_tchar(filename), nSaveCharCode, NULL ); + cfl.FileOpen( to_tchar(filename), nSaveCharCode, 0 ); /* ファイルサイズが65KBを越えたら進捗ダイアログ表示 */ if ( 0x10000 < cfl.GetFileSize() ) { Index: sakura_core/global.h =================================================================== --- sakura_core/global.h (revision 1562) +++ sakura_core/global.h (working copy) @@ -42,7 +42,7 @@ #define SAKURA_CORE_API #endif //SAKURA_NO_DLL -#if defined(__BORLANDC__) +#if defined(__BORLANDC__) || defined(__GNUC__) #define __forceinline #define _itoa itoa #define _stricmp stricmp Index: sakura_core/CProcess.cpp =================================================================== --- sakura_core/CProcess.cpp (revision 1562) +++ sakura_core/CProcess.cpp (working copy) @@ -33,7 +33,9 @@ : m_hInstance( hInstance ) , m_CommandLine( lpCmdLine ) , m_hWnd( 0 ) +#ifndef DISABLE_CRASHDUMP , m_pfnMiniDumpWriteDump(NULL) +#endif { } @@ -69,6 +71,7 @@ { if( InitializeProcess() ) { +#ifndef DISABLE_CRASHDUMP HMODULE hDllDbgHelp = ::LoadLibrary( _T("dbghelp.dll") ); m_pfnMiniDumpWriteDump = NULL; if( hDllDbgHelp ){ @@ -76,8 +79,10 @@ } __try { +#endif MainLoop() ; OnExitProcess(); +#ifndef DISABLE_CRASHDUMP } __except( WriteDump( GetExceptionInformation() ) ){ } @@ -86,11 +91,13 @@ ::FreeLibrary( hDllDbgHelp ); m_pfnMiniDumpWriteDump = NULL; } +#endif return true; } return false; } +#ifndef DISABLE_CRASHDUMP /*! @brief クラッシュダンプ @@ -134,3 +141,4 @@ return EXCEPTION_CONTINUE_SEARCH; } +#endif Index: sakura_core/util/string_ex.cpp =================================================================== --- sakura_core/util/string_ex.cpp (revision 1562) +++ sakura_core/util/string_ex.cpp (working copy) @@ -1,7 +1,9 @@ #include "stdafx.h" #include "string_ex.h" #include "charset/charcode.h" -#include +#include +#include +namespace { using std::max; } SAKURA_CORE_API int __cdecl my_internal_icmp( const char *s1, const char *s2, unsigned int n, unsigned int dcount, bool flag ); @@ -221,8 +223,8 @@ // 互換 // // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // -#if _MSC_VER<1400 //VS2005より前なら -error_t wcscat_s(wchar_t* szDst, size_t nDstCount, const wchar_t* szSrc) +#if !defined(_MSC_VER) || _MSC_VER<1400 //VS2005より前なら +errno_t wcscat_s(wchar_t* szDst, size_t nDstCount, const wchar_t* szSrc) { if(!szDst)return EINVAL; if(!szSrc)return EINVAL; @@ -246,7 +248,69 @@ return 0; } - + +errno_t strcat_s(char *dest, size_t num, const char *src) +{ + if(!dest || !src) return EINVAL; + size_t size1 = strnlen(dest, num); + if(size1 == num) return EINVAL; // destが未終了 + if(num <= size1+strlen(src)) return ERANGE; + strcat(dest, src); + return 0; +} +errno_t strcpy_s(char *dest, size_t num, const char *src) +{ + if(!dest || !src) return EINVAL; + if(num <= strlen(src)) return ERANGE; + strcpy(dest, src); + return 0; +} +errno_t wcscpy_s(wchar_t *dest, size_t num, const wchar_t *src) +{ + if(!dest || !src) return EINVAL; + if(num <= wcslen(src)) return ERANGE; + wcscpy(dest, src); + return 0; +} +// FIXME: countが_TRUNCATEの場合を考慮する +errno_t wcsncpy_s(wchar_t *dest, size_t num, const wchar_t *src, size_t count) +{ + if(!dest || !src) return EINVAL; + if(num == 0) return EINVAL; + if(num <= count) { *dest = L'\0'; return EINVAL; } + wmemcpy(dest, src, count+1); + return 0; +} +size_t strnlen(const char *str, size_t num) +{ + for(size_t i = 0; i < num; ++i) + { + if(str[i] == '\0') return i; + } + return num; +} +size_t wcsnlen(const wchar_t *str, size_t num) +{ + for(size_t i = 0; i < num; ++i) + { + if(str[i] == L'\0') return i; + } + return num; +} +int vsprintf_s(char *buf, size_t num, const char *fmt, va_list vaarg) +{ + // 手抜き + if(!buf || num == 0 || !fmt) { errno = EINVAL; return -1; } + buf[num-1] = '\0'; + return _vsnprintf(buf, num-1, fmt, vaarg); +} +int vswprintf_s(wchar_t *buf, size_t num, const wchar_t *fmt, va_list vaarg) +{ + // 手抜き + if(!buf || num == 0 || !fmt) { errno = EINVAL; return -1; } + buf[num-1] = L'\0'; + return _vsnwprintf(buf, num-1, fmt, vaarg); +} #endif Index: sakura_core/util/container.h =================================================================== --- sakura_core/util/container.h (revision 1562) +++ sakura_core/util/container.h (working copy) @@ -13,27 +13,17 @@ template class vector_ex : public std::vector{ public: - // -- -- 定数 -- -- // - static const size_t INVALID_INDEX = (size_t)-1; + using std::vector::begin; + using std::vector::end; + using std::vector::push_back; public: // -- -- インターフェース -- -- // - //!要素を探す。見つけたらそのインデックスを返す。見つからなかったらINVALID_INDEXを返す。 - size_t index_of(const T& t) const - { - const_iterator p = find(begin(),end(),t); - if(p!=end()){ - return p-begin(); - } - else{ - return INVALID_INDEX; - } - } //!要素を探す。見つかればtrue。 bool exist(const T& t) const { - return index_of(t)!=INVALID_INDEX; + return std::find(begin(), end(), t) != end(); } //!要素を追加。ただし重複した要素は弾く。 Index: sakura_core/CGraphics.cpp =================================================================== --- sakura_core/CGraphics.cpp (revision 1562) +++ sakura_core/CGraphics.cpp (working copy) @@ -14,7 +14,7 @@ //ブラシ m_hbrOrg = NULL; m_hbrCurrent = NULL; - m_bDynamicBrush = NULL; + m_bDynamicBrush = false; } CGraphics::~CGraphics() Index: sakura_core/charset/codechecker.h =================================================================== --- sakura_core/charset/codechecker.h (revision 1562) +++ sakura_core/charset/codechecker.h (working copy) @@ -483,7 +483,7 @@ #define UC_RESERVED_CP 2 /* --- Unicode 系コードチェック */ -inline int _CheckUtf16Char( const wchar_t*, const int, ECharSet*, const int nOption, const bool bBigEndian ); +int _CheckUtf16Char( const wchar_t*, const int, ECharSet*, const int nOption, const bool bBigEndian ); inline int CheckUtf16leChar( const wchar_t* p, const int n, ECharSet* e, const int o ) { return _CheckUtf16Char( p, n, e, o, false ); } inline int CheckUtf16beChar( const wchar_t* p, const int n, ECharSet* e, const int o ) { return _CheckUtf16Char( p, n, e, o, true ); } Index: sakura_core/charset/codechecker.cpp =================================================================== --- sakura_core/charset/codechecker.cpp (revision 1562) +++ sakura_core/charset/codechecker.cpp (working copy) @@ -488,7 +488,7 @@ /*! UTF-16 LE/BE 文字をチェック (組み合わせ文字列考慮なし) */ -inline int _CheckUtf16Char( const wchar_t* pS, const int nLen, ECharSet *peCharset, const int nOption, const bool bBigEndian ) +int _CheckUtf16Char( const wchar_t* pS, const int nLen, ECharSet *peCharset, const int nOption, const bool bBigEndian ) { wchar_t wc1, wc2; int ncwidth; Index: sakura_core/view/figures/CFigure_Eol.cpp =================================================================== --- sakura_core/view/figures/CFigure_Eol.cpp (revision 1562) +++ sakura_core/view/figures/CFigure_Eol.cpp (working copy) @@ -54,7 +54,7 @@ // 改行が存在した場合は、改行記号を表示 if(cEol.GetLen()){ m_cEol = cEol; - __super::DrawImp(pInfo); + CFigureSpace::DrawImp(pInfo); pInfo->nPosInLogic+=cEol.GetLen(); } // 最終行の場合は、EOFを表示 Index: sakura_core/view/DispPos.h =================================================================== --- sakura_core/view/DispPos.h (revision 1562) +++ sakura_core/view/DispPos.h (working copy) @@ -1,19 +1,10 @@ #pragma once +class CLayout; + struct DispPos{ public: - DispPos(int nDx,int nDy) - : m_nDx(nDx) - , m_nDy(nDy) - { - m_ptDrawOrigin.x=0; - m_ptDrawOrigin.y=0; - m_ptDrawLayout.x=CLayoutInt(0); - m_ptDrawLayout.y=CLayoutInt(0); - m_nLineRef=CLayoutInt(0); - //キャッシュ - m_pcLayoutRef = CEditDoc::GetInstance(0)->m_cLayoutMgr.SearchLineByLayoutY( m_nLineRef ); - } + DispPos(int nDx,int nDy); // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // // 描画位置 // @@ -50,12 +41,7 @@ // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // //変更 - void SetLayoutLineRef(CLayoutInt nOffsetLine) - { - m_nLineRef = nOffsetLine; - //キャッシュ更新 - m_pcLayoutRef = CEditDoc::GetInstance(0)->m_cLayoutMgr.SearchLineByLayoutY( m_nLineRef ); - } + void SetLayoutLineRef(CLayoutInt nOffsetLine); void ForwardLayoutLineRef(int nOffsetLine); Index: sakura_core/view/CEditView.h =================================================================== --- sakura_core/view/CEditView.h (revision 1562) +++ sakura_core/view/CEditView.h (working copy) @@ -28,7 +28,7 @@ #include #include // LPDATAOBJECT #include "env/CShareData.h" -#include "CTipWnd.h" +#include "window/CTipWnd.h" #include "CDicMgr.h" #include "CHokanMgr.h" // Jun. 26, 2001 genta 正規表現ライブラリの差し替え Index: sakura_core/view/colors/CColorStrategy.cpp =================================================================== --- sakura_core/view/colors/CColorStrategy.cpp (revision 1562) +++ sakura_core/view/colors/CColorStrategy.cpp (working copy) @@ -34,6 +34,11 @@ return pDispPos->GetLayoutRef(); } +void SColorStrategyInfo::ChangeColor(EColorIndexType eNewColor) +{ + this->pcView->SetCurrentColor( this->gr, eNewColor ); +} + void SColorStrategyInfo::DoChangeColor(const CStringRef& cLineStr) { CColorStrategyPool* pool = CColorStrategyPool::Instance(); Index: sakura_core/view/colors/CColorStrategy.h =================================================================== --- sakura_core/view/colors/CColorStrategy.h (revision 1562) +++ sakura_core/view/colors/CColorStrategy.h (working copy) @@ -119,6 +119,7 @@ class CColorStrategy; #include "view/DispPos.h" #include //auto_ptr +class CEditView; struct SColorStrategyInfo{ SColorStrategyInfo() : sDispPosBegin(0,0), pStrategy(NULL), pStrategyFound(NULL) {} @@ -140,10 +141,7 @@ CColorStrategy* pStrategyFound; //! 色の切り替え - void ChangeColor(EColorIndexType eNewColor) - { - this->pcView->SetCurrentColor( this->gr, eNewColor ); - } + void ChangeColor(EColorIndexType eNewColor); void DoChangeColor(const CStringRef& cLineStr); EColorIndexType GetCurrentColor() const; Index: sakura_core/view/DispPos.cpp =================================================================== --- sakura_core/view/DispPos.cpp (revision 1562) +++ sakura_core/view/DispPos.cpp (working copy) @@ -2,6 +2,28 @@ #include "DispPos.h" #include "doc/CLayout.h" +DispPos::DispPos(int nDx,int nDy) +: m_nDx(nDx) +, m_nDy(nDy) +{ + m_ptDrawOrigin.x=0; + m_ptDrawOrigin.y=0; + m_ptDrawLayout.x=CLayoutInt(0); + m_ptDrawLayout.y=CLayoutInt(0); + m_nLineRef=CLayoutInt(0); + //キャッシュ + m_pcLayoutRef = CEditDoc::GetInstance(0)->m_cLayoutMgr.SearchLineByLayoutY( m_nLineRef ); +} + +void DispPos::SetLayoutLineRef(CLayoutInt nOffsetLine) +{ + m_nLineRef = nOffsetLine; + //キャッシュ更新 + m_pcLayoutRef = CEditDoc::GetInstance(0)->m_cLayoutMgr.SearchLineByLayoutY( m_nLineRef ); +} + + + //$$$高速化 void DispPos::ForwardLayoutLineRef(int nOffsetLine) { Index: sakura_core/func/CFuncKeyWnd.h =================================================================== --- sakura_core/func/CFuncKeyWnd.h (revision 1562) +++ sakura_core/func/CFuncKeyWnd.h (working copy) @@ -17,7 +17,7 @@ #ifndef _CFUNCKEYWND_H_ #define _CFUNCKEYWND_H_ -#include "CWnd.h" +#include "window/CWnd.h" #include "env/CShareData.h" class CEditDoc; // 2002/2/10 aroka Index: sakura_core/macro/CPPA.cpp =================================================================== --- sakura_core/macro/CPPA.cpp (revision 1562) +++ sakura_core/macro/CPPA.cpp (working copy) @@ -162,15 +162,15 @@ if( ! RegisterEntries(table) ) return false; - SetIntFunc(CPPA::stdIntFunc); // 2003.02.24 Moca - SetStrFunc(CPPA::stdStrFunc); - SetProc(CPPA::stdProc); + SetIntFunc((void*)CPPA::stdIntFunc); // 2003.02.24 Moca + SetStrFunc((void*)CPPA::stdStrFunc); + SetProc((void*)CPPA::stdProc); // 2003.06.01 Moca エラーメッセージを追加 - SetErrProc(CPPA::stdError); - SetStrObj(CPPA::stdStrObj); // UserErrorMes用 + SetErrProc((void*)CPPA::stdError); + SetStrObj((void*)CPPA::stdStrObj); // UserErrorMes用 #if PPADLL_VER >= 123 - SetFinishProc(CPPA::stdFinishProc); + SetFinishProc((void*)CPPA::stdFinishProc); #endif SetDefine( "sakura-editor" ); // 2003.06.01 Moca SAKURAエディタ用独自関数を準備