From 8536529c43f70f9875401f7b352d2295532ce1e7 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 15 Apr 2007 13:15:35 +0000 Subject: [PATCH] *** empty log message *** --- ase/com/Awk.cpp | 15 ++++++++------- ase/com/Awk.h | 5 +++-- ase/com/AwkExtio.cpp | 6 +++--- ase/com/AwkExtio.h | 10 +++++----- ase/com/asecom.dsp | 26 +++++++++++--------------- ase/com/asecom.idl | 9 ++++++--- ase/com/asecom.rc | 24 ++++++++++++++---------- ase/com/awk_cp.h | 39 ++++++++++++++++++++++++++++++++++++++- ase/com/resource.h | 2 +- ase/test/com/AwkForm.frm | 12 ++++++------ 10 files changed, 95 insertions(+), 53 deletions(-) diff --git a/ase/com/Awk.cpp b/ase/com/Awk.cpp index 46592795..7d9ee74e 100644 --- a/ase/com/Awk.cpp +++ b/ase/com/Awk.cpp @@ -1,5 +1,5 @@ /* - * $Id: Awk.cpp,v 1.31 2007-04-14 15:30:14 bacon Exp $ + * $Id: Awk.cpp,v 1.32 2007-04-15 13:15:35 bacon Exp $ * * {License} */ @@ -70,6 +70,7 @@ CAwk::CAwk (): CAwk::~CAwk () { + while (bfn_list != NULL) { bfn_t* next = bfn_list->next; @@ -228,11 +229,11 @@ static ase_ssize_t __read_source ( if (cmd == ASE_AWK_IO_OPEN) { - return (ase_ssize_t)awk->Fire_OpenSource (0); + return (ase_ssize_t)awk->Fire_OpenSource (AWK_SOURCE_READ); } else if (cmd == ASE_AWK_IO_CLOSE) { - return (ase_ssize_t)awk->Fire_CloseSource (0); + return (ase_ssize_t)awk->Fire_CloseSource (AWK_SOURCE_READ); } else if (cmd == ASE_AWK_IO_READ) { @@ -296,11 +297,11 @@ static ase_ssize_t __write_source ( if (cmd == ASE_AWK_IO_OPEN) { - return (ase_ssize_t)awk->Fire_OpenSource (1); + return (ase_ssize_t)awk->Fire_OpenSource (AWK_SOURCE_WRITE); } else if (cmd == ASE_AWK_IO_CLOSE) { - return (ase_ssize_t)awk->Fire_CloseSource (1); + return (ase_ssize_t)awk->Fire_CloseSource (AWK_SOURCE_WRITE); } else if (cmd == ASE_AWK_IO_WRITE) { @@ -624,8 +625,8 @@ static ase_ssize_t __process_extio ( DBGOUT2 (awk, _T("cannot set the name of the extio input buffer")); return -1; } - extio2->type = epa->type & 0xFF; - extio2->mode = epa->mode; + extio2->type = (AwkExtioType)(epa->type & 0xFF); + extio2->mode = (AwkExtioMode)(epa->mode); read_buf->AddRef (); extio2->read_buf = read_buf; diff --git a/ase/com/Awk.h b/ase/com/Awk.h index 77d5c964..62c7fa90 100644 --- a/ase/com/Awk.h +++ b/ase/com/Awk.h @@ -1,5 +1,5 @@ /* - * $Id: Awk.h,v 1.18 2007-04-14 15:30:14 bacon Exp $ + * $Id: Awk.h,v 1.19 2007-04-15 13:15:35 bacon Exp $ * * {License} */ @@ -106,6 +106,7 @@ DECLARE_REGISTRY_RESOURCEID(IDR_AWK) // IAwk public: + STDMETHOD(get_UseLongLong)(/*[out, retval]*/ BOOL *pVal); STDMETHOD(put_UseLongLong)(/*[in]*/ BOOL newVal); STDMETHOD(get_Debug)(/*[out, retval]*/ BOOL *pVal); STDMETHOD(put_Debug)(/*[in]*/ BOOL newVal); @@ -152,9 +153,9 @@ public: STDMETHOD(get_ErrorMessage)(/*[out, retval]*/ BSTR *pVal); STDMETHOD(get_ErrorLine)(/*[out, retval]*/ int *pVal); STDMETHOD(get_ErrorCode)(/*[out, retval]*/ int *pVal); + STDMETHOD(DeleteFunction)(/*[in]*/ BSTR name, /*[out, retval]*/ int* ret); STDMETHOD(AddFunction)(/*[in]*/ BSTR name, /*[in]*/ int min_args, /*[in]*/ int max_args, /*[out, retval]*/ int* ret); - STDMETHOD(get_UseLongLong)(/*[out, retval]*/ BOOL *pVal); HRESULT __stdcall Parse (/*[out, retval]*/ int* ret); HRESULT __stdcall Run (/*[out, retval]*/ int* ret); }; diff --git a/ase/com/AwkExtio.cpp b/ase/com/AwkExtio.cpp index ae30392c..643e714a 100644 --- a/ase/com/AwkExtio.cpp +++ b/ase/com/AwkExtio.cpp @@ -1,5 +1,5 @@ /* - * $Id: AwkExtio.cpp,v 1.10 2007-03-24 05:18:32 bacon Exp $ + * $Id: AwkExtio.cpp,v 1.11 2007-04-15 13:15:35 bacon Exp $ * * {License} */ @@ -43,13 +43,13 @@ BOOL CAwkExtio::PutName (const TCHAR* val) return (name == NULL)? FALSE: TRUE; } -STDMETHODIMP CAwkExtio::get_Type(int *pVal) +STDMETHODIMP CAwkExtio::get_Type(AwkExtioType *pVal) { *pVal = type; return S_OK; } -STDMETHODIMP CAwkExtio::get_Mode(int *pVal) +STDMETHODIMP CAwkExtio::get_Mode(AwkExtioMode *pVal) { *pVal = mode; return S_OK; diff --git a/ase/com/AwkExtio.h b/ase/com/AwkExtio.h index 5bd28e27..907b0d1c 100644 --- a/ase/com/AwkExtio.h +++ b/ase/com/AwkExtio.h @@ -1,5 +1,5 @@ /* - * $Id: AwkExtio.h,v 1.9 2007-02-03 10:52:12 bacon Exp $ + * $Id: AwkExtio.h,v 1.10 2007-04-15 13:15:35 bacon Exp $ * * {License} */ @@ -19,8 +19,8 @@ class ATL_NO_VTABLE CAwkExtio : { public: BSTR name; - int type; - int mode; + AwkExtioType type; + AwkExtioMode mode; VARIANT handle; IBuffer* read_buf; @@ -45,8 +45,8 @@ END_COM_MAP() public: STDMETHOD(get_Handle)(/*[out, retval]*/ VARIANT *pVal); STDMETHOD(put_Handle)(/*[in]*/ VARIANT newVal); - STDMETHOD(get_Mode)(/*[out, retval]*/ int *pVal); - STDMETHOD(get_Type)(/*[out, retval]*/ int *pVal); + STDMETHOD(get_Mode)(/*[out, retval]*/ AwkExtioMode *pVal); + STDMETHOD(get_Type)(/*[out, retval]*/ AwkExtioType *pVal); STDMETHOD(get_Name)(/*[out, retval]*/ BSTR *pVal); }; diff --git a/ase/com/asecom.dsp b/ase/com/asecom.dsp index 48767653..ece491be 100644 --- a/ase/com/asecom.dsp +++ b/ase/com/asecom.dsp @@ -53,11 +53,11 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 aseawk.lib asecmn.lib aseutl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /implib:"debug/asecom.lib" /pdbtype:sept /libpath:"$(OutDir)" # Begin Custom Build - Performing registration -IntDir=./debug -OutDir=./../debug/lib -#TargetPath=\projects\ase\debug\lib\asecom.dll -#InputPath=\projects\ase\debug\lib\asecom.dll -#SOURCE="$(InputPath)" +IntDir=.\debug +OutDir=.\../debug/lib +TargetPath=\projects\ase\debug\lib\asecom.dll +InputPath=\projects\ase\debug\lib\asecom.dll +SOURCE="$(InputPath)" "$(IntDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" copy .\asecom.tlb "$(OUTDIR)\asecom.tlb" @@ -94,13 +94,13 @@ BSC32=bscmake.exe # ADD BSC32 /nologo /o"release/awk.bsc" LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 aseawk.lib asecmn.lib aseutl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /implib:"release/asecom.lib" /libpath:"$(OutDir)" +# ADD LINK32 aseawk.lib asecmn.lib aseutl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /implib:"release/asecom.lib" /libpath:"$(OutDir)" # Begin Custom Build - Performing registration -IntDir=./release -OutDir=./../release/lib -#TargetPath=\projects\ase\release\lib\asecom.dll -#InputPath=\projects\ase\release\lib\asecom.dll -#SOURCE="$(InputPath)" +IntDir=.\release +OutDir=.\../release/lib +TargetPath=\projects\ase\release\lib\asecom.dll +InputPath=\projects\ase\release\lib\asecom.dll +SOURCE="$(InputPath)" "$(IntDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" copy .\asecom.tlb "$(OUTDIR)\asecom.tlb" @@ -186,10 +186,6 @@ SOURCE=.\resource.h SOURCE=.\stdafx.h # End Source File -# Begin Source File - -SOURCE=.\xxx.h -# End Source File # End Group # Begin Group "Resource Files" diff --git a/ase/com/asecom.idl b/ase/com/asecom.idl index ba50562c..ad4bc065 100644 --- a/ase/com/asecom.idl +++ b/ase/com/asecom.idl @@ -1,5 +1,5 @@ /* - * $Id: asecom.idl,v 1.2 2007-04-14 15:30:14 bacon Exp $ + * $Id: asecom.idl,v 1.3 2007-04-15 13:15:35 bacon Exp $ */ import "oaidl.idl"; @@ -223,10 +223,10 @@ library ASELib HRESULT Name([out,retval] BSTR *pVal); [propget, id(2), helpstring("property Type")] - HRESULT Type([out,retval] int *pVal); + HRESULT Type([out,retval] AwkExtioType *pVal); [propget, id(3), helpstring("property Mode")] - HRESULT Mode([out,retval] int *pVal); + HRESULT Mode([out,retval] AwkExtioMode *pVal); [propget, id(4), helpstring("property Handle")] HRESULT Handle([out,retval] VARIANT *pVal); @@ -275,6 +275,9 @@ library ASELib [id(11), helpstring("method HandleFunction")] HRESULT HandleFunction([in] BSTR name, [in] VARIANT argarray, [out,retval] VARIANT* ret); + + /*[id(12), helpstring("method OnClose")] + HRESULT OnClose([out,retval] int* ret);*/ }; /* Awk */ diff --git a/ase/com/asecom.rc b/ase/com/asecom.rc index df9571c1..1ab1e224 100644 --- a/ase/com/asecom.rc +++ b/ase/com/asecom.rc @@ -54,8 +54,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,17 +68,21 @@ VS_VERSION_INFO VERSIONINFO BEGIN BLOCK "StringFileInfo" BEGIN - BLOCK "040904B0" + BLOCK "040904b0" BEGIN + VALUE "Comments", "\0" VALUE "CompanyName", "\0" VALUE "FileDescription", "ASE COM Module\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "ASE\0" - VALUE "LegalCopyright", "Copyright 2006\0" - VALUE "OriginalFilename", "asecom.dll\0" - VALUE "ProductName", "ASE COM Module\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "FileVersion", "1, 0, 0, 0\0" + VALUE "InternalName", "ASECOM\0" + VALUE "LegalCopyright", "Hyung-Hwan Chung. All rights reserved\0" + VALUE "LegalTrademarks", "\0" VALUE "OLESelfRegister", "\0" + VALUE "OriginalFilename", "asecom.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "ASE COM Module\0" + VALUE "ProductVersion", "1, 0, 0, 0\0" + VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" @@ -97,7 +101,7 @@ END IDR_AWK REGISTRY DISCARDABLE "Awk.rgs" IDR_AWKEXTIO REGISTRY DISCARDABLE "AwkExtio.rgs" -IDR_BUFFER REGISTRY DISCARDABLE "Buffer.rgs" +IDR_BUFFER REGISTRY DISCARDABLE "Buffer.rgs" ///////////////////////////////////////////////////////////////////////////// // diff --git a/ase/com/awk_cp.h b/ase/com/awk_cp.h index 596fafe8..0da3bc69 100644 --- a/ase/com/awk_cp.h +++ b/ase/com/awk_cp.h @@ -1,5 +1,5 @@ /* - * $Id: awk_cp.h,v 1.10 2007-04-14 15:30:14 bacon Exp $ + * $Id: awk_cp.h,v 1.11 2007-04-15 13:15:35 bacon Exp $ * * {License} */ @@ -595,6 +595,43 @@ public: return 2; /* no proper handler */ } + INT Fire_OnClose () + { + T* pT = static_cast(this); + int i, nconns = m_vec.GetSize(); + CComVariant ret; + + for (i = 0; i < nconns; i++) + { + pT->Lock(); + CComPtr sp = m_vec.GetAt(i); + pT->Unlock(); + + IDispatch* pDispatch = reinterpret_cast(sp.p); + if (pDispatch == NULL) continue; + + VariantClear (&ret); + + HRESULT hr = pDispatch->Invoke( + 0xC, IID_NULL, LOCALE_USER_DEFAULT, + DISPATCH_METHOD, NULL, &ret, NULL, NULL); + + if (FAILED(hr)) continue; + if (ret.vt == VT_EMPTY) continue; + + hr = ret.ChangeType (VT_I4); + if (FAILED(hr)) + { + /* TODO: set the error code properly... */ + /* invalid value returned... */ + return -1; + } + + return ret.lVal; + } + + return -1; + } }; #endif diff --git a/ase/com/resource.h b/ase/com/resource.h index 0c5f206a..77c83f7a 100644 --- a/ase/com/resource.h +++ b/ase/com/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. -// Used by ase.rc +// Used by asecom.rc // #define IDS_PROJNAME 100 #define IDR_AWK 101 diff --git a/ase/test/com/AwkForm.frm b/ase/test/com/AwkForm.frm index c3af9d0d..b843503c 100644 --- a/ase/test/com/AwkForm.frm +++ b/ase/test/com/AwkForm.frm @@ -175,18 +175,18 @@ Private Sub Execute_Click() Awk.UseLongLong = False Awk.Debug = True - If Awk.AddBuiltinFunction("sin", 1, 1) = -1 Then + If Awk.AddFunction("sin", 1, 1) = -1 Then MsgBox "Cannot add builtin function - " + Awk.ErrorMessage Exit Sub End If - If Awk.AddBuiltinFunction("cos", 1, 1) = -1 Then + If Awk.AddFunction("cos", 1, 1) = -1 Then MsgBox "Cannot add builtin function - " + Awk.ErrorMessage Exit Sub End If - Call Awk.AddBuiltinFunction("tan", 1, 1) - Call Awk.AddBuiltinFunction("sqrt", 1, 1) - Call Awk.AddBuiltinFunction("trim", 1, 1) - 'Call Awk.DeleteBuiltinFunction("tan") + Call Awk.AddFunction("tan", 1, 1) + Call Awk.AddFunction("sqrt", 1, 1) + Call Awk.AddFunction("trim", 1, 1) + 'Call Awk.DeleteFunction("tan") If Awk.Parse() = -1 Then MsgBox "PARSE ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage