*** empty log message ***
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.6 2006-12-11 08:44:52 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.7 2006-12-11 14:58:25 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -37,6 +37,20 @@ CAwk::CAwk (): handle(NULL),
|
||||
_sntprintf (x, 128, _T("CAwk::CAwk %p"), this);
|
||||
MessageBox (NULL, x, x, MB_OK);
|
||||
#endif
|
||||
|
||||
/* TODO: what is the best default option? */
|
||||
option = ASE_AWK_IMPLICIT |
|
||||
ASE_AWK_EXPLICIT |
|
||||
ASE_AWK_UNIQUEAFN |
|
||||
ASE_AWK_HASHSIGN |
|
||||
/*ASE_AWK_IDIV |
|
||||
ASE_AWK_SHADING |
|
||||
ASE_AWK_SHIFT | */
|
||||
ASE_AWK_EXTIO /*|
|
||||
ASE_AWK_BLOCKLESS |
|
||||
ASE_AWK_STRINDEXONE |
|
||||
ASE_AWK_STRIPSPACES |
|
||||
ASE_AWK_NEXTOFILE*/;
|
||||
}
|
||||
|
||||
CAwk::~CAwk ()
|
||||
@ -306,20 +320,7 @@ HRESULT CAwk::Parse (int* ret)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int opt = ASE_AWK_IMPLICIT |
|
||||
ASE_AWK_EXPLICIT |
|
||||
ASE_AWK_UNIQUEAFN |
|
||||
ASE_AWK_HASHSIGN |
|
||||
/*ASE_AWK_IDIV |
|
||||
ASE_AWK_SHADING |
|
||||
ASE_AWK_SHIFT | */
|
||||
ASE_AWK_EXTIO /*|
|
||||
ASE_AWK_BLOCKLESS |
|
||||
ASE_AWK_STRINDEXONE |
|
||||
ASE_AWK_STRIPSPACES |
|
||||
ASE_AWK_NEXTOFILE*/;
|
||||
|
||||
ase_awk_setopt (handle, opt);
|
||||
ase_awk_setopt (handle, option);
|
||||
}
|
||||
|
||||
ase_awk_srcios_t srcios;
|
||||
@ -477,10 +478,15 @@ static ase_ssize_t __process_extio (
|
||||
}
|
||||
else if (cmd == ASE_AWK_IO_FLUSH)
|
||||
{
|
||||
return 1;
|
||||
IAwkExtio* extio = (IAwkExtio*)epa->handle;
|
||||
ASE_AWK_ASSERT (ase_awk_getrunawk(epa->run), extio != NULL);
|
||||
return awk->Fire_FlushExtio (extio);
|
||||
}
|
||||
else if (cmd == ASE_AWK_IO_NEXT)
|
||||
{
|
||||
IAwkExtio* extio = (IAwkExtio*)epa->handle;
|
||||
ASE_AWK_ASSERT (ase_awk_getrunawk(epa->run), extio != NULL);
|
||||
return awk->Fire_NextExtio (extio);
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -514,3 +520,15 @@ MessageBox (NULL, ase_awk_geterrstr(err), ase_awk_geterrstr(err), MB_OK);
|
||||
*ret = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_Option (int *pVal)
|
||||
{
|
||||
*pVal = option;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_Option (int newVal)
|
||||
{
|
||||
newVal = option;
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.h,v 1.3 2006-12-11 06:29:19 bacon Exp $
|
||||
* $Id: Awk.h,v 1.4 2006-12-11 14:58:25 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_COM_AWK_H_
|
||||
@ -29,6 +29,7 @@ class CAwk :
|
||||
|
||||
{
|
||||
public:
|
||||
int option;
|
||||
ase_awk_t* handle;
|
||||
|
||||
IBuffer* read_src_buf;
|
||||
@ -64,6 +65,8 @@ DECLARE_REGISTRY_RESOURCEID(IDR_AWK)
|
||||
|
||||
// IAwk
|
||||
public:
|
||||
STDMETHOD(get_Option)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(put_Option)(/*[in]*/ int newVal);
|
||||
HRESULT __stdcall Parse (int* ret);
|
||||
HRESULT __stdcall Run (int* ret);
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: AwkExtio.cpp,v 1.3 2006-12-10 16:13:50 bacon Exp $
|
||||
* $Id: AwkExtio.cpp,v 1.4 2006-12-11 14:58:25 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -61,3 +61,14 @@ STDMETHODIMP CAwkExtio::get_Mode(int *pVal)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwkExtio::get_Handle (VARIANT *pVal)
|
||||
{
|
||||
*pVal = handle;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwkExtio::put_Handle (VARIANT newVal)
|
||||
{
|
||||
handle.Copy (&newVal);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: AwkExtio.h,v 1.6 2006-12-11 08:44:52 bacon Exp $
|
||||
* $Id: AwkExtio.h,v 1.7 2006-12-11 14:58:25 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_COM_AWKEXTIO_H_
|
||||
@ -41,6 +41,8 @@ END_COM_MAP()
|
||||
|
||||
// IAwkExtio
|
||||
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_Name)(/*[out, retval]*/ BSTR *pVal);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: ase.idl,v 1.2 2006-12-09 17:36:27 bacon Exp $
|
||||
* $Id: ase.idl,v 1.3 2006-12-11 14:58:25 bacon Exp $
|
||||
*/
|
||||
|
||||
import "oaidl.idl";
|
||||
@ -20,6 +20,12 @@ interface IAwk : IDispatch
|
||||
|
||||
[id(2), helpstring("method Run")]
|
||||
HRESULT Run([out, retval] int* ret);
|
||||
|
||||
[propget, id(3), helpstring("property Option")]
|
||||
HRESULT Option([out, retval] int *pVal);
|
||||
|
||||
[propput, id(3), helpstring("property Option")]
|
||||
HRESULT Option([in] int newVal);
|
||||
};
|
||||
|
||||
/* ASELib */
|
||||
@ -33,6 +39,51 @@ library ASELib
|
||||
importlib("stdole32.tlb");
|
||||
importlib("stdole2.tlb");
|
||||
|
||||
[helpstring("Awk options")]
|
||||
typedef [v1_enum] enum AwkOption
|
||||
{
|
||||
AWK_IMPLICIT = (1 << 0),
|
||||
AWK_EXPLICIT = (1 << 1),
|
||||
AWK_UNIQUEAFN = (1 << 2),
|
||||
AWK_SHADING = (1 << 3),
|
||||
AWK_SHIFT = (1 << 4),
|
||||
AWK_IDIV = (1 << 5),
|
||||
AWK_HASHSIGN = (1 << 6),
|
||||
AWK_STRCONCAT = (1 << 7),
|
||||
AWK_EXTIO = (1 << 8),
|
||||
AWK_BLOCKLESS = (1 << 9),
|
||||
AWK_STRINDEXONE = (1 << 10),
|
||||
AWK_STRIPSPACES = (1 << 11),
|
||||
AWK_NEXTOFILE = (1 << 12)
|
||||
} AwkOption;
|
||||
|
||||
[helpstring("AwkExtio tpe")]
|
||||
typedef [v1_enum] enum AwkExtioType
|
||||
{
|
||||
AWK_EXTIO_PIPE = 0,
|
||||
AWK_EXTIO_COPROC = 1,
|
||||
AWK_EXTIO_FILE = 2,
|
||||
AWK_EXTIO_CONSOLE = 3
|
||||
} AwkExtioType;
|
||||
|
||||
[helpstring("AwkExtio mode")]
|
||||
typedef [v1_enum] enum AwkExtioMode
|
||||
{
|
||||
AWK_EXTIO_PIPE_READ = 0,
|
||||
AWK_EXTIO_PIPE_WRITE = 1,
|
||||
|
||||
AWK_EXTIO_COPROC_READ = 0,
|
||||
AWK_EXTIO_COPROC_WRITE = 1,
|
||||
AWK_EXTIO_COPROC_RDWR = 2,
|
||||
|
||||
AWK_EXTIO_FILE_READ = 0,
|
||||
AWK_EXTIO_FILE_WRITE = 1,
|
||||
AWK_EXTIO_FILE_APPEND = 2,
|
||||
|
||||
AWK_EXTIO_CONSOLE_READ = 0,
|
||||
AWK_EXTIO_CONSOLE_WRITE = 1
|
||||
} AwkExtioMode;
|
||||
|
||||
/* IBuffer */
|
||||
[
|
||||
object,
|
||||
@ -68,6 +119,11 @@ library ASELib
|
||||
|
||||
[propget, id(3), helpstring("property Mode")]
|
||||
HRESULT Mode([out, retval] int *pVal);
|
||||
|
||||
[propget, id(4), helpstring("property Handle")]
|
||||
HRESULT Handle([out, retval] VARIANT *pVal);
|
||||
[propput, id(4), helpstring("property Handle")]
|
||||
HRESULT Handle([in] VARIANT newVal);
|
||||
};
|
||||
|
||||
/* IAwkEvents */
|
||||
@ -102,6 +158,12 @@ library ASELib
|
||||
|
||||
[id(8), helpstring("method WriteExtio")]
|
||||
int WriteExtio([in] IAwkExtio* extio, [in] IBuffer* buf);
|
||||
|
||||
[id(9), helpstring("method FlushExtio")]
|
||||
int FlushExtio([in] IAwkExtio* extio);
|
||||
|
||||
[id(10), helpstring("method NextExtio")]
|
||||
int NextExtio([in] IAwkExtio* extio);
|
||||
};
|
||||
|
||||
/* Awk */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk_cp.h,v 1.4 2006-12-11 08:44:52 bacon Exp $
|
||||
* $Id: awk_cp.h,v 1.5 2006-12-11 14:58:25 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _AWK_CP_H_
|
||||
@ -408,6 +408,102 @@ public:
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user