OSDN Git Service

SetCallbackProcをLoadLibraryに統合。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Mon, 21 Feb 2011 11:28:01 +0000 (11:28 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Mon, 21 Feb 2011 11:28:01 +0000 (11:28 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@499 9df91469-1e22-0410-86e7-ea8537beb833

13 files changed:
src/common/handle/TPIHandle.cpp
src/common/handle/TPIHandle.h
src/common/header/plugin.def
src/common/header/plugin.h
src/lychee/frm_main.cpp
src/plugin/7zArc/7zArc.cpp
src/plugin/calLibrary/calLibrary.cpp
src/plugin/cuiWrapper/cuiWrapper.cpp
src/plugin/eggArc/eggArc.cpp
src/plugin/rarArc/rarArc.cpp
src/plugin/spiLibrary/spiLibrary.cpp
src/plugin/sqxArc/sqxArc.cpp
src/plugin/xpiLibrary/xpiLibrary.cpp

index c54bdcf..e761cf5 100644 (file)
@@ -53,7 +53,7 @@ TPIHandle::~TPIHandle(void)
        this->FreeLibrary();\r
 }\r
 \r
-bool TPIHandle::InitLibrary(const wxString & _szLibName, const wxString & _szArcName, wxULongLong_t _llTypeId)\r
+bool TPIHandle::InitLibrary(const wxString & _szLibName, const wxString & _szArcName, TPI_PROC _prProc, wxULongLong_t _llTypeId)\r
 {\r
        this->nErrorCode = TPI_ERROR_SUCCESS;\r
        if (! this->lib.Load(_szLibName))\r
@@ -67,7 +67,7 @@ bool TPIHandle::InitLibrary(const wxString & _szLibName, const wxString & _szArc
        }\r
 \r
        GetAPIAddress("LoadPlugin", p);\r
-       this->nErrorCode = ((int (__stdcall *)(const wxString &, wxULongLong_t)) p)(_szArcName, _llTypeId);\r
+       this->nErrorCode = ((int (__stdcall *)(const wxString &, TPI_PROC, wxULongLong_t)) p)(_szArcName, _prProc, _llTypeId);\r
        return this->nErrorCode == TPI_ERROR_SUCCESS;\r
 }\r
 \r
@@ -242,11 +242,3 @@ bool TPIHandle::Command(wxULongLong_t _eCommand, TPI_SWITCHES * _swInfo, const w
        this->nErrorCode = ((int (__stdcall *)(wxULongLong_t, TPI_SWITCHES *, const wxString &, const wxArrayString &)) p)(_eCommand, _swInfo, _szArcName, _szFiles);\r
        return this->nErrorCode == TPI_ERROR_SUCCESS;\r
 }\r
-\r
-bool TPIHandle::SetCallbackProc(TPI_PROC _prProc)\r
-{\r
-       this->nErrorCode = TPI_ERROR_SUCCESS;\r
-       GetAPIAddress("SetCallbackProc", p);\r
-       this->nErrorCode = ((int (__stdcall *)(TPI_PROC)) p)(_prProc);\r
-       return this->nErrorCode == TPI_ERROR_SUCCESS;\r
-}\r
index 75674de..5ecda73 100644 (file)
@@ -34,7 +34,7 @@ class TPIHandle
        public:\r
                TPIHandle(void);\r
                ~TPIHandle(void);\r
-               bool InitLibrary(const wxString & _szLibName, const wxString & _szArcName, wxULongLong_t _llTypeId = 0);\r
+               bool InitLibrary(const wxString & _szLibName, const wxString & _szArcName, TPI_PROC _prProc = NULL, wxULongLong_t _llTypeId = 0);\r
                bool FreeLibrary(void);\r
 \r
                bool GetPluginInformation(unsigned int _uInfoId, wxULongLong_t _llSubOption, void * _pPtr);\r
@@ -47,8 +47,6 @@ class TPIHandle
 \r
                bool Command(wxULongLong_t _eCommand, TPI_SWITCHES * _swInfo, const wxString & _szArcName, const wxArrayString & _szFiles);\r
 \r
-               bool SetCallbackProc(TPI_PROC _prProc);\r
-\r
                int nErrorCode;\r
 \r
        private:\r
index ce4cb1e..8ec61ce 100644 (file)
@@ -11,4 +11,3 @@ EXPORTS
        GetFileInformation                      @22
        GetArchiveInformation           @23
        Command                                         @40
-       SetCallbackProc                         @41
index 6c1a5ea..db8e19f 100644 (file)
@@ -422,12 +422,14 @@ int __stdcall GetFormatInformation
 \r
 /** プラグインを使用するための初期化を行う。\r
  * @param  _szArcName   これから操作する対象となる書庫名。不明な場合はNULLを指定。\r
+ * @param  _prProc   コールバック関数へのポインタ。\r
  * @param  _nTypeId    書庫を作成する場合には、その格納形式IDを指定。それ以外の場合は0。\r
  * @return エラーコード。\r
  */\r
 int __stdcall LoadPlugin\r
 (\r
        const wxString & _szArcName,\r
+       TPI_PROC _prProc,\r
        wxULongLong_t _nTypeId = 0\r
 );\r
 \r
@@ -502,15 +504,6 @@ int __stdcall Command
        const wxArrayString & _szFiles\r
 );\r
 \r
-/** Command() 実行中に処理の進捗状況を送信するコールバック関数を指定する。\r
- * @param  _prArcProc   コールバック関数へのポインタ。\r
- * @return エラーコード。\r
- */\r
-int __stdcall SetCallbackProc\r
-(\r
-       TPI_PROC _prArcProc\r
-);\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index 5b146f9..d3527a1 100644 (file)
@@ -268,16 +268,12 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
 \r
        // TPIを読み込み。\r
        this->fnArchive = wxFileName(mkDlg.cbDir->GetValue(), mkDlg.cbFileName->GetValue());\r
-       if (! tpi.InitLibrary(mkDlg.afInfo[nSelected].szTPIName, this->fnArchive.GetFullPath(), mkDlg.afInfo[nSelected].nTypeId))\r
+       if (! tpi.InitLibrary(mkDlg.afInfo[nSelected].szTPIName, this->fnArchive.GetFullPath(), TPICallbackProc, mkDlg.afInfo[nSelected].nTypeId))\r
        {\r
                this->ErrorCheck(tpi.nErrorCode, wxT("InitLibrary"));\r
                return;\r
        }\r
 \r
-       // コールバック関数を設定。\r
-       tpi.SetCallbackProc(TPICallbackProc);\r
-       this->ErrorCheck(tpi.nErrorCode, wxT("SetCallbackProc"));\r
-\r
        // 処理を行う。\r
        {\r
                ProcessDialog procDlg;\r
@@ -1112,15 +1108,12 @@ bool MainFrame::LoadTPI(const wxString & szFileName, wxULongLong_t * llFileCount
                do\r
                {\r
                        // 初期化。\r
-                       if (! tpi.InitLibrary(L_DIR_B_LIB + szTPIName, szFileName))\r
+                       if (! tpi.InitLibrary(L_DIR_B_LIB + szTPIName, szFileName, TPICallbackProc))\r
                        {\r
                                tpi.FreeLibrary();\r
                                continue;\r
                        }\r
 \r
-                       // コールバック関数を設定。\r
-                       tpi.SetCallbackProc(TPICallbackProc);\r
-\r
                        // 対応確認。\r
                        if (! tpi.OpenArchive(szFileName, llFileCount))\r
                        {\r
index d1c8885..efacb00 100644 (file)
@@ -667,6 +667,7 @@ int __stdcall GetFormatInformation(TPI_FORMATINFO * _fiInfo, bool _bFirst)
 int __stdcall LoadPlugin\r
 (\r
        const wxString & _szArcName,\r
+       TPI_PROC _prProc,\r
        wxULongLong_t _nTypeId\r
 )\r
 {\r
@@ -704,9 +705,13 @@ int __stdcall LoadPlugin
                }\r
                g_LibInfo.node = * xmlLibrary;\r
                g_LibInfo.nLibIndex = _nTypeId;\r
-               return TPI_ERROR_SUCCESS;\r
        }\r
 \r
+       // コールバック関数を設定。\r
+       if (_prProc != NULL)\r
+       {\r
+               g_prProc = * _prProc;\r
+       }\r
        return TPI_ERROR_SUCCESS;\r
 }\r
 \r
@@ -1012,21 +1017,6 @@ int __stdcall Command
        return nErrorCode;\r
 }\r
 \r
-int __stdcall SetCallbackProc\r
-(\r
-       TPI_PROC _prArcProc\r
-)\r
-{\r
-       // ポインタを保存。\r
-       if (_prArcProc == NULL)\r
-       {\r
-               return TPI_ERROR_D_PARAMETER;\r
-       }\r
-       g_prProc = * _prArcProc;\r
-\r
-       return TPI_ERROR_SUCCESS;\r
-}\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index 333fbf6..0dde981 100644 (file)
@@ -589,6 +589,7 @@ int __stdcall GetFormatInformation(TPI_FORMATINFO * _fiInfo, bool _bFirst)
 int __stdcall LoadPlugin\r
 (\r
        const wxString & _szArcName,\r
+       TPI_PROC _prProc,\r
        wxULongLong_t _nTypeId\r
 )\r
 {\r
@@ -623,6 +624,14 @@ int __stdcall LoadPlugin
                g_LibInfoAlt.szPrefix = xmlLibrary->GetAttribute(wxT("prefix-alt"), wxEmptyString);\r
                g_LibInfoAlt.fUnicode = myGetAttributeBool(xmlLibrary, wxT("unicode-alt"));\r
                g_LibInfoAlt.hLib = ::LoadLibrary(xmlLibrary->GetAttribute(wxT("name-alt"), wxEmptyString).wchar_str());\r
+\r
+               // コールバック関数を設定。\r
+               if (_prProc != NULL)\r
+               {\r
+                       g_prProc = * _prProc;\r
+                       CalSetCallbackProc(true);\r
+                       CalSetCallbackProc(false);\r
+               }\r
                return TPI_ERROR_SUCCESS;\r
        }\r
 \r
@@ -659,6 +668,13 @@ int __stdcall LoadPlugin
                                ? ((BOOL (__stdcall *)(const wchar_t *, const int)) fpProc)(_szArcName.wchar_str(), 0)\r
                                : ((BOOL (__stdcall *)(const char    *, const int)) fpProc)(_szArcName.ToUTF8(),    0)))\r
                {\r
+                       // コールバック関数を設定。\r
+                       if (_prProc != NULL)\r
+                       {\r
+                               g_prProc = * _prProc;\r
+                               CalSetCallbackProc(true);\r
+                               CalSetCallbackProc(false);\r
+                       }\r
                        return TPI_ERROR_SUCCESS;\r
                }\r
                ::FreeLibrary(g_LibInfo.hLib);\r
@@ -959,23 +975,6 @@ int __stdcall Command
        return ErrorCodeConvert(nErrorCode);\r
 }\r
 \r
-int __stdcall SetCallbackProc\r
-(\r
-       TPI_PROC _prArcProc\r
-)\r
-{\r
-       // ポインタを保存。\r
-       if (_prArcProc == NULL)\r
-       {\r
-               return TPI_ERROR_D_PARAMETER;\r
-       }\r
-       g_prProc = * _prArcProc;\r
-\r
-       // コールバック関数を設定。\r
-       CalSetCallbackProc(true);\r
-       return CalSetCallbackProc(false);\r
-}\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index 42aec89..4d64dab 100644 (file)
@@ -172,6 +172,7 @@ int __stdcall GetFormatInformation(TPI_FORMATINFO * _fiInfo, bool _bFirst)
 int __stdcall LoadPlugin\r
 (\r
        const wxString & _szArcName,\r
+       TPI_PROC _prProc,\r
        wxULongLong_t _nTypeId\r
 )\r
 {\r
@@ -179,6 +180,12 @@ int __stdcall LoadPlugin
        wxXmlDocument xmlDoc(myMakeXMLName(wxT("cuiWrapper")));\r
        wxXmlNode * xmlLibrary;\r
 \r
+       // コールバック関数を設定。\r
+       if (_prProc != NULL)\r
+       {\r
+               g_prProc = * _prProc;\r
+       }\r
+\r
        // 対象が存在するならば対応するライブラリを調査、\r
        // 対象が存在しないならば指示されたライブラリをロード。\r
        if (! ::wxFileExists(_szArcName))\r
@@ -469,21 +476,6 @@ int __stdcall Command
        return TPI_ERROR_SUCCESS;\r
 }\r
 \r
-int __stdcall SetCallbackProc\r
-(\r
-       TPI_PROC _prArcProc\r
-)\r
-{\r
-       // ポインタを保存。\r
-       if (_prArcProc == NULL)\r
-       {\r
-               return TPI_ERROR_D_PARAMETER;\r
-       }\r
-       g_prProc = * _prArcProc;\r
-\r
-       return TPI_ERROR_SUCCESS;\r
-}\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index 2763956..3830937 100644 (file)
@@ -265,6 +265,7 @@ int __stdcall GetFormatInformation(TPI_FORMATINFO * _fiInfo, bool _bFirst)
 int __stdcall LoadPlugin\r
 (\r
        const wxString &,\r
+       TPI_PROC _prProc,\r
        wxULongLong_t\r
 )\r
 {\r
@@ -276,6 +277,11 @@ int __stdcall LoadPlugin
                return TPI_ERROR_U_LOAD_LIBRARY;\r
        }\r
 \r
+       // コールバック関数を設定。\r
+       if (_prProc != NULL)\r
+       {\r
+               g_prProc = * _prProc;\r
+       }\r
        return TPI_ERROR_SUCCESS;\r
 }\r
 \r
@@ -452,21 +458,6 @@ int __stdcall Command
        return CloseArchive(hArc);\r
 }\r
 \r
-int __stdcall SetCallbackProc\r
-(\r
-       TPI_PROC _prArcProc\r
-)\r
-{\r
-       // ポインタを保存。\r
-       if (_prArcProc == NULL)\r
-       {\r
-               return TPI_ERROR_D_PARAMETER;\r
-       }\r
-       g_prProc = * _prArcProc;\r
-\r
-       return TPI_ERROR_SUCCESS;\r
-}\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index edf75e8..8adaf48 100644 (file)
@@ -187,6 +187,7 @@ int __stdcall GetFormatInformation(TPI_FORMATINFO * _fiInfo, bool _bFirst)
 int __stdcall LoadPlugin\r
 (\r
        const wxString &,\r
+       TPI_PROC _prProc,\r
        wxULongLong_t\r
 )\r
 {\r
@@ -198,6 +199,11 @@ int __stdcall LoadPlugin
                return TPI_ERROR_U_LOAD_LIBRARY;\r
        }\r
 \r
+       // コールバック関数を設定。\r
+       if (_prProc != NULL)\r
+       {\r
+               g_prProc = * _prProc;\r
+       }\r
        return TPI_ERROR_SUCCESS;\r
 }\r
 \r
@@ -419,21 +425,6 @@ int __stdcall Command
        return nErrorCode;\r
 }\r
 \r
-int __stdcall SetCallbackProc\r
-(\r
-       TPI_PROC _prArcProc\r
-)\r
-{\r
-       // ポインタを保存。\r
-       if (_prArcProc == NULL)\r
-       {\r
-               return TPI_ERROR_D_PARAMETER;\r
-       }\r
-       g_prProc = * _prArcProc;\r
-\r
-       return TPI_ERROR_SUCCESS;\r
-}\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index 6e614f4..7171ded 100644 (file)
@@ -116,6 +116,7 @@ int __stdcall GetFormatInformation(TPI_FORMATINFO *, bool)
 int __stdcall LoadPlugin\r
 (\r
        const wxString & _szArcName,\r
+       TPI_PROC _prProc,\r
        wxULongLong_t\r
 )\r
 {\r
@@ -171,7 +172,11 @@ int __stdcall LoadPlugin
 \r
                        if (((BOOL (PASCAL *)(const char *, unsigned long)) fpProc)(_szArcName.ToUTF8(), (unsigned long) buffer))\r
                        {\r
-                               // 対応していれば処理を終了。\r
+                               // コールバック関数を設定。\r
+                               if (_prProc != NULL)\r
+                               {\r
+                                       g_prProc = * _prProc;\r
+                               }\r
                                return TPI_ERROR_SUCCESS;\r
                        }\r
                }\r
@@ -431,21 +436,6 @@ int __stdcall Command
        return nErrorCode;\r
 }\r
 \r
-int __stdcall SetCallbackProc\r
-(\r
-       TPI_PROC _prArcProc\r
-)\r
-{\r
-       // ポインタを保存。\r
-       if (_prArcProc == NULL)\r
-       {\r
-               return TPI_ERROR_D_PARAMETER;\r
-       }\r
-       g_prProc = * _prArcProc;\r
-\r
-       return TPI_ERROR_SUCCESS;\r
-}\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index db13eb4..fea616e 100644 (file)
@@ -16,7 +16,7 @@
   with this library; if not, write to the Free Software Foundation, Inc.,\r
   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\r
 \r
-  $Id: eggArc.cpp 482 2011-02-09 13:29:52Z sirakaba $\r
+  $Id$\r
 *******************************************************************************/\r
 \r
 //******************************************************************************\r
@@ -295,6 +295,7 @@ int __stdcall GetFormatInformation(TPI_FORMATINFO * _fiInfo, bool _bFirst)
 int __stdcall LoadPlugin\r
 (\r
        const wxString &,\r
+       TPI_PROC _prProc,\r
        wxULongLong_t\r
 )\r
 {\r
@@ -306,6 +307,11 @@ int __stdcall LoadPlugin
                return TPI_ERROR_U_LOAD_LIBRARY;\r
        }\r
 \r
+       // コールバック関数を設定。\r
+       if (_prProc != NULL)\r
+       {\r
+               g_prProc = * _prProc;\r
+       }\r
        return TPI_ERROR_SUCCESS;\r
 }\r
 \r
@@ -740,21 +746,6 @@ int __stdcall Command
        return CloseArchive(hArc);\r
 }\r
 \r
-int __stdcall SetCallbackProc\r
-(\r
-       TPI_PROC _prArcProc\r
-)\r
-{\r
-       // ポインタを保存。\r
-       if (_prArcProc == NULL)\r
-       {\r
-               return TPI_ERROR_D_PARAMETER;\r
-       }\r
-       g_prProc = * _prArcProc;\r
-\r
-       return TPI_ERROR_SUCCESS;\r
-}\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r
index 829e0be..80e2566 100644 (file)
@@ -121,6 +121,7 @@ int __stdcall GetFormatInformation(TPI_FORMATINFO *, bool)
 int __stdcall LoadPlugin\r
 (\r
        const wxString & _szArcName,\r
+       TPI_PROC _prProc,\r
        wxULongLong_t\r
 )\r
 {\r
@@ -176,7 +177,11 @@ int __stdcall LoadPlugin
 \r
                        if (((BOOL (PASCAL *)(const char *, unsigned long)) fpProc)(_szArcName.ToUTF8(), (unsigned long) buffer))\r
                        {\r
-                               // 対応していれば処理を終了。\r
+                               // コールバック関数を設定。\r
+                               if (_prProc != NULL)\r
+                               {\r
+                                       g_prProc = * _prProc;\r
+                               }\r
                                return TPI_ERROR_SUCCESS;\r
                        }\r
                }\r
@@ -495,21 +500,6 @@ int __stdcall Command
        return TPI_ERROR_SUCCESS;\r
 }\r
 \r
-int __stdcall SetCallbackProc\r
-(\r
-       TPI_PROC _prArcProc\r
-)\r
-{\r
-       // ポインタを保存。\r
-       if (_prArcProc == NULL)\r
-       {\r
-               return TPI_ERROR_D_PARAMETER;\r
-       }\r
-       g_prProc = * _prArcProc;\r
-\r
-       return TPI_ERROR_SUCCESS;\r
-}\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r