2006-12-09 11:50:08 +00:00
|
|
|
/*
|
2007-02-03 10:52:36 +00:00
|
|
|
* $Id: awk_cp.h,v 1.9 2007-02-03 10:52:12 bacon Exp $
|
|
|
|
*
|
|
|
|
* {License}
|
2006-12-09 11:50:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _AWK_CP_H_
|
|
|
|
#define _AWK_CP_H_
|
|
|
|
|
|
|
|
template <class T>
|
2006-12-11 08:44:52 +00:00
|
|
|
class CProxyIAwkEvents:
|
|
|
|
public IConnectionPointImpl<T, &DIID_IAwkEvents, CComDynamicUnkArray>
|
2006-12-09 11:50:08 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-12-09 17:36:27 +00:00
|
|
|
INT Fire_OpenSource(INT mode)
|
2006-12-09 11:50:08 +00:00
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
2006-12-09 12:09:42 +00:00
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[1], ret;
|
2006-12-09 11:50:08 +00:00
|
|
|
|
2006-12-09 12:09:42 +00:00
|
|
|
for (i = 0; i < nconns; i++)
|
2006-12-09 11:50:08 +00:00
|
|
|
{
|
|
|
|
pT->Lock();
|
2006-12-09 12:09:42 +00:00
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
2006-12-09 11:50:08 +00:00
|
|
|
pT->Unlock();
|
2006-12-09 12:09:42 +00:00
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
|
|
|
|
args[0] = mode;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 1, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0x1, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr)) continue;
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
2006-12-09 11:50:08 +00:00
|
|
|
{
|
2006-12-09 12:09:42 +00:00
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
continue;
|
2006-12-09 11:50:08 +00:00
|
|
|
}
|
2006-12-09 12:09:42 +00:00
|
|
|
|
|
|
|
hr = ret.ChangeType (VT_I4);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
/* TODO: set the error code properly... */
|
|
|
|
/* invalid value returned... */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret.lVal;
|
2006-12-09 11:50:08 +00:00
|
|
|
}
|
2006-12-09 12:09:42 +00:00
|
|
|
|
|
|
|
return -1;
|
2006-12-09 11:50:08 +00:00
|
|
|
}
|
2006-12-09 12:09:42 +00:00
|
|
|
|
2006-12-09 17:36:27 +00:00
|
|
|
INT Fire_CloseSource(INT mode)
|
2006-12-09 11:50:08 +00:00
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
2006-12-09 12:09:42 +00:00
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[1], ret;
|
2006-12-09 11:50:08 +00:00
|
|
|
|
2006-12-09 12:09:42 +00:00
|
|
|
for (i = 0; i < nconns; i++)
|
2006-12-09 11:50:08 +00:00
|
|
|
{
|
|
|
|
pT->Lock();
|
2006-12-09 12:09:42 +00:00
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
2006-12-09 11:50:08 +00:00
|
|
|
pT->Unlock();
|
2006-12-09 12:09:42 +00:00
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
|
|
|
|
args[0] = mode;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 1, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0x2, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr)) continue;
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
2006-12-09 11:50:08 +00:00
|
|
|
{
|
2006-12-09 12:09:42 +00:00
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
continue;
|
2006-12-09 11:50:08 +00:00
|
|
|
}
|
2006-12-09 12:09:42 +00:00
|
|
|
|
|
|
|
hr = ret.ChangeType (VT_I4);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
/* TODO: set the error code properly... */
|
|
|
|
/* invalid value returned... */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret.lVal;
|
2006-12-09 11:50:08 +00:00
|
|
|
}
|
2006-12-09 12:09:42 +00:00
|
|
|
|
|
|
|
return -1;
|
2006-12-09 11:50:08 +00:00
|
|
|
}
|
2006-12-09 12:09:42 +00:00
|
|
|
|
2006-12-09 17:36:27 +00:00
|
|
|
INT Fire_ReadSource (IBuffer* buf)
|
2006-12-09 11:50:08 +00:00
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[1], ret;
|
|
|
|
|
|
|
|
for (i = 0; i < nconns; i++)
|
|
|
|
{
|
|
|
|
pT->Lock();
|
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
|
|
|
pT->Unlock();
|
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
|
|
|
|
args[0] = (IUnknown*)buf;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 1, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0x3, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
|
|
|
{
|
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ret.ChangeType (VT_I4);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
/* TODO: set the error code properly... */
|
|
|
|
/* invalid value returned... */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret.lVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no event handler attached for the source code read. */
|
|
|
|
/* TODO: set error code ... */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2006-12-09 17:36:27 +00:00
|
|
|
INT Fire_WriteSource (IBuffer* buf)
|
2006-12-09 11:50:08 +00:00
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[1], ret;
|
|
|
|
|
|
|
|
for (i = 0; i < nconns; i++)
|
|
|
|
{
|
|
|
|
pT->Lock();
|
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
|
|
|
pT->Unlock();
|
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
|
|
|
|
args[0] = (IUnknown*)buf;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 1, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0x4, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
|
|
|
{
|
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ret.ChangeType (VT_I4);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
/* TODO: set the error code properly... */
|
|
|
|
/* invalid value returned... */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret.lVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no event handler attached for the source code write.
|
|
|
|
* make the operation succeed by returning the reqested
|
|
|
|
* data length. */
|
|
|
|
CComBSTR bstr;
|
|
|
|
buf->get_Value (&bstr);
|
|
|
|
return bstr.Length();
|
|
|
|
}
|
2006-12-09 17:36:27 +00:00
|
|
|
|
|
|
|
INT Fire_OpenExtio (IAwkExtio* extio)
|
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[1], ret;
|
|
|
|
|
|
|
|
for (i = 0; i < nconns; i++)
|
|
|
|
{
|
|
|
|
pT->Lock();
|
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
|
|
|
pT->Unlock();
|
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
|
|
|
|
args[0] = (IUnknown*)extio;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 1, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0x5, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr)) continue;
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
|
|
|
{
|
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
INT Fire_CloseExtio (IAwkExtio* extio)
|
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[1], ret;
|
|
|
|
|
|
|
|
for (i = 0; i < nconns; i++)
|
|
|
|
{
|
|
|
|
pT->Lock();
|
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
|
|
|
pT->Unlock();
|
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
|
|
|
|
args[0] = (IUnknown*)extio;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 1, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0x6, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr)) continue;
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
|
|
|
{
|
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2006-12-11 08:44:52 +00:00
|
|
|
INT Fire_ReadExtio (IAwkExtio* extio, IBuffer* buf)
|
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[2], ret;
|
|
|
|
|
|
|
|
for (i = 0; i < nconns; i++)
|
|
|
|
{
|
|
|
|
pT->Lock();
|
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
|
|
|
pT->Unlock();
|
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
VariantClear (&args[1]);
|
|
|
|
|
|
|
|
args[1] = (IUnknown*)extio;
|
|
|
|
args[0] = (IUnknown*)buf;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 2, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0x7, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
|
|
|
{
|
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2006-12-09 17:36:27 +00:00
|
|
|
INT Fire_WriteExtio (IAwkExtio* extio, IBuffer* buf)
|
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[2], ret;
|
|
|
|
|
|
|
|
for (i = 0; i < nconns; i++)
|
|
|
|
{
|
|
|
|
pT->Lock();
|
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
|
|
|
pT->Unlock();
|
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
VariantClear (&args[1]);
|
|
|
|
|
|
|
|
args[1] = (IUnknown*)extio;
|
|
|
|
args[0] = (IUnknown*)buf;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 2, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0x8, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
|
|
|
{
|
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
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;
|
|
|
|
}
|
2006-12-11 14:58:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
INT Fire_FlushExtio (IAwkExtio* extio)
|
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[1], ret;
|
|
|
|
|
|
|
|
for (i = 0; i < nconns; i++)
|
|
|
|
{
|
|
|
|
pT->Lock();
|
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
|
|
|
pT->Unlock();
|
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
|
|
|
|
args[0] = (IUnknown*)extio;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 1, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0x9, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr)) continue;
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
|
|
|
{
|
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
INT Fire_NextExtio (IAwkExtio* extio)
|
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant args[1], ret;
|
|
|
|
|
|
|
|
for (i = 0; i < nconns; i++)
|
|
|
|
{
|
|
|
|
pT->Lock();
|
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
|
|
|
pT->Unlock();
|
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
VariantClear (&args[0]);
|
|
|
|
|
|
|
|
args[0] = (IUnknown*)extio;
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 1, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0xA, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr)) continue;
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
|
|
|
{
|
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2007-01-16 06:09:07 +00:00
|
|
|
int Fire_HandleBuiltinFunction (
|
|
|
|
ase_awk_run_t* run, BSTR name, SAFEARRAY* argarray, ase_awk_val_t** retv)
|
2007-01-14 15:08:01 +00:00
|
|
|
{
|
|
|
|
T* pT = static_cast<T*>(this);
|
|
|
|
int i, nconns = m_vec.GetSize();
|
|
|
|
CComVariant ret;
|
|
|
|
VARIANT args[2];
|
2007-01-16 06:09:07 +00:00
|
|
|
ase_awk_val_t* v;
|
2007-01-14 15:08:01 +00:00
|
|
|
|
|
|
|
VariantInit (&args[0]);
|
|
|
|
VariantInit (&args[1]);
|
|
|
|
|
|
|
|
args[1].vt = VT_BSTR;
|
|
|
|
args[1].bstrVal = name;
|
|
|
|
|
|
|
|
args[0].vt = VT_ARRAY | VT_VARIANT;
|
|
|
|
args[0].parray = argarray;
|
|
|
|
|
|
|
|
for (i = 0; i < nconns; i++)
|
|
|
|
{
|
|
|
|
pT->Lock();
|
|
|
|
CComPtr<IUnknown> sp = m_vec.GetAt(i);
|
|
|
|
pT->Unlock();
|
|
|
|
|
|
|
|
IDispatch* pDispatch =
|
|
|
|
reinterpret_cast<IDispatch*>(sp.p);
|
|
|
|
if (pDispatch == NULL) continue;
|
|
|
|
|
|
|
|
VariantClear (&ret);
|
|
|
|
|
|
|
|
DISPPARAMS disp = { args, NULL, 2, 0 };
|
|
|
|
HRESULT hr = pDispatch->Invoke (
|
|
|
|
0xB, IID_NULL, LOCALE_USER_DEFAULT,
|
|
|
|
DISPATCH_METHOD, &disp, &ret, NULL, NULL);
|
|
|
|
if (FAILED(hr)) continue;
|
|
|
|
|
|
|
|
if (ret.vt == VT_EMPTY)
|
|
|
|
{
|
|
|
|
/* probably, the handler has not been implemeted*/
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
VariantClear (&args[1]);
|
|
|
|
VariantClear (&args[0]);
|
2007-01-16 06:09:07 +00:00
|
|
|
|
|
|
|
if (ret.vt == VT_I1)
|
|
|
|
v = ase_awk_makeintval (run, ret.cVal);
|
|
|
|
else if (ret.vt == VT_I2)
|
|
|
|
v = ase_awk_makeintval (run, ret.iVal);
|
|
|
|
else if (ret.vt == VT_I4)
|
|
|
|
v = ase_awk_makeintval (run, ret.lVal);
|
|
|
|
else if (ret.vt == VT_I8)
|
|
|
|
v = ase_awk_makeintval (run, ret.llVal);
|
|
|
|
else if (ret.vt == VT_UI1)
|
|
|
|
v = ase_awk_makeintval (run, ret.bVal);
|
|
|
|
else if (ret.vt == VT_UI2)
|
|
|
|
v = ase_awk_makeintval (run, ret.uiVal);
|
|
|
|
else if (ret.vt == VT_UI4)
|
|
|
|
v = ase_awk_makeintval (run, ret.ulVal);
|
|
|
|
else if (ret.vt == VT_UI8)
|
|
|
|
v = ase_awk_makeintval (run, ret.ullVal);
|
|
|
|
else if (ret.vt == VT_INT)
|
|
|
|
v = ase_awk_makeintval (run, ret.intVal);
|
|
|
|
else if (ret.vt == VT_UINT)
|
|
|
|
v = ase_awk_makeintval (run, ret.uintVal);
|
|
|
|
else if (ret.vt == VT_BOOL)
|
|
|
|
v = ase_awk_makeintval (run, ((ret.boolVal == 0)? 0: 1));
|
|
|
|
else if (ret.vt == VT_R4)
|
|
|
|
v = ase_awk_makerealval (run, ret.fltVal);
|
|
|
|
else if (ret.vt == VT_R8)
|
|
|
|
v = ase_awk_makerealval (run, ret.dblVal);
|
|
|
|
else if (ret.vt == VT_BSTR)
|
|
|
|
v = ase_awk_makestrval (run, ret.bstrVal, SysStringLen(ret.bstrVal));
|
2007-01-17 14:09:49 +00:00
|
|
|
else if (ret.vt == VT_NULL)
|
|
|
|
|
|
|
|
v = ase_awk_val_nil;
|
2007-01-16 06:09:07 +00:00
|
|
|
else return 3; /* wrong return value */
|
|
|
|
|
|
|
|
if (v == ASE_NULL) return 1; /* out of memory */
|
|
|
|
|
|
|
|
*retv = v;
|
|
|
|
return 0; /* success */
|
2007-01-14 15:08:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VariantClear (&args[1]);
|
|
|
|
VariantClear (&args[0]);
|
2007-01-16 06:09:07 +00:00
|
|
|
return 2; /* no proper handler */
|
2007-01-14 15:08:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-09 11:50:08 +00:00
|
|
|
};
|
2006-12-09 12:09:42 +00:00
|
|
|
|
2006-12-09 11:50:08 +00:00
|
|
|
#endif
|