*** empty log message ***
This commit is contained in:
parent
e1d050a3bb
commit
d08f469091
110
ase/com/Awk.cpp
110
ase/com/Awk.cpp
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.14 2007-01-07 07:30:40 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.15 2007-01-10 14:30:43 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -29,17 +29,12 @@ STDMETHODIMP CAwk::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
}
|
||||
|
||||
CAwk::CAwk ():
|
||||
handle(NULL),
|
||||
read_src_buf(NULL),
|
||||
write_src_buf(NULL),
|
||||
write_extio_buf(NULL)
|
||||
handle (NULL),
|
||||
read_src_buf (NULL),
|
||||
write_src_buf (NULL),
|
||||
write_extio_buf (NULL),
|
||||
entry_point (NULL)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TCHAR x[128];
|
||||
_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 |
|
||||
@ -58,31 +53,16 @@ CAwk::CAwk ():
|
||||
|
||||
errnum = 0;
|
||||
errlin = 0;
|
||||
errmsg[0] = _T('\0');
|
||||
errmsg[0] = ASE_T('\0');
|
||||
}
|
||||
|
||||
CAwk::~CAwk ()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TCHAR x[128];
|
||||
_sntprintf (x, 128, _T("CAwk::~CAwk %p"), this);
|
||||
MessageBox (NULL, x, x, MB_OK);
|
||||
#endif
|
||||
if (entry_point != NULL) SysFreeString (entry_point);
|
||||
|
||||
if (write_extio_buf != NULL)
|
||||
{
|
||||
write_extio_buf->Release ();
|
||||
}
|
||||
|
||||
if (write_src_buf != NULL)
|
||||
{
|
||||
write_src_buf->Release ();
|
||||
}
|
||||
|
||||
if (read_src_buf != NULL)
|
||||
{
|
||||
read_src_buf->Release ();
|
||||
}
|
||||
if (write_extio_buf != NULL) write_extio_buf->Release ();
|
||||
if (write_src_buf != NULL) write_src_buf->Release ();
|
||||
if (read_src_buf != NULL) read_src_buf->Release ();
|
||||
|
||||
if (handle != NULL)
|
||||
{
|
||||
@ -204,11 +184,7 @@ static ase_ssize_t __read_source (
|
||||
HRESULT hr = CoCreateInstance (
|
||||
CLSID_Buffer, NULL, CLSCTX_ALL,
|
||||
IID_IBuffer, (void**)&awk->read_src_buf);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
MessageBox (NULL, _T("COCREATEINSTANCE FAILED"), _T("FUCK"), MB_OK);
|
||||
return -1;
|
||||
}
|
||||
if (FAILED(hr)) return -1;
|
||||
|
||||
awk->read_src_pos = 0;
|
||||
awk->read_src_len = 0;
|
||||
@ -275,15 +251,11 @@ static ase_ssize_t __write_source (
|
||||
hr = CoCreateInstance (
|
||||
CLSID_Buffer, NULL, CLSCTX_ALL,
|
||||
IID_IBuffer, (void**)&awk->write_src_buf);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
MessageBox (NULL, _T("COCREATEINSTANCE FAILED"), _T("FUCK"), MB_OK);
|
||||
return -1;
|
||||
}
|
||||
if (FAILED(hr)) return -1;
|
||||
}
|
||||
|
||||
CBuffer* tmp = (CBuffer*)awk->write_src_buf;
|
||||
if (tmp->PutValue (data, count) == FALSE) return -1; /* TODO: better error handling */
|
||||
if (tmp->PutValue (data, count) == FALSE) return -1;
|
||||
|
||||
INT n = awk->Fire_WriteSource (awk->write_src_buf);
|
||||
if (n > (INT)count) return -1;
|
||||
@ -390,7 +362,7 @@ static ase_ssize_t __process_extio (
|
||||
HRESULT hr = CoCreateInstance (
|
||||
CLSID_AwkExtio, NULL, CLSCTX_ALL,
|
||||
IID_IAwkExtio, (void**)&extio);
|
||||
if (FAILED(hr)) return -1; /* TODO: better error handling.. */
|
||||
if (FAILED(hr)) return -1;
|
||||
|
||||
hr = CoCreateInstance (
|
||||
CLSID_Buffer, NULL, CLSCTX_ALL,
|
||||
@ -406,7 +378,7 @@ static ase_ssize_t __process_extio (
|
||||
{
|
||||
read_buf->Release ();
|
||||
extio->Release ();
|
||||
return -1; /* TODO: better error handling */
|
||||
return -1;
|
||||
}
|
||||
extio2->type = epa->type & 0xFF;
|
||||
extio2->mode = epa->mode;
|
||||
@ -506,7 +478,7 @@ static ase_ssize_t __process_extio (
|
||||
}
|
||||
|
||||
CBuffer* tmp = (CBuffer*)awk->write_extio_buf;
|
||||
if (tmp->PutValue (data, size) == FALSE) return -1; /* TODO: better error handling */
|
||||
if (tmp->PutValue (data, size) == FALSE) return -1;
|
||||
|
||||
INT n = awk->Fire_WriteExtio (extio, awk->write_extio_buf);
|
||||
if (n > (INT)size) return -1;
|
||||
@ -530,10 +502,14 @@ static ase_ssize_t __process_extio (
|
||||
|
||||
HRESULT CAwk::Run (int* ret)
|
||||
{
|
||||
const ase_char_t* entry = NULL;
|
||||
|
||||
if (handle == NULL)
|
||||
{
|
||||
/* TODO: better error handling... */
|
||||
/* call parse first... */
|
||||
errnum = ASE_AWK_EINTERN;
|
||||
errlin = 0;
|
||||
_tcscpy (errmsg, _T("parse not called yet"));
|
||||
|
||||
*ret = -1;
|
||||
return S_OK;
|
||||
}
|
||||
@ -545,7 +521,10 @@ HRESULT CAwk::Run (int* ret)
|
||||
runios.console = __process_extio;
|
||||
runios.custom_data = this;
|
||||
|
||||
if (ase_awk_run (handle, NULL, &runios, NULL, NULL, this) == -1)
|
||||
if (entry_point != NULL &&
|
||||
SysStringLen(entry_point) > 0) entry = entry_point;
|
||||
|
||||
if (ase_awk_run (handle, entry, &runios, NULL, NULL, this) == -1)
|
||||
{
|
||||
const ase_char_t* msg;
|
||||
|
||||
@ -819,7 +798,7 @@ STDMETHODIMP CAwk::put_MaxDepthForBlockRun(int newVal)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_MaxDepthForExpressionParse(int *pVal)
|
||||
STDMETHODIMP CAwk::get_MaxDepthForExprParse(int *pVal)
|
||||
{
|
||||
if (handle != NULL)
|
||||
{
|
||||
@ -830,7 +809,7 @@ STDMETHODIMP CAwk::get_MaxDepthForExpressionParse(int *pVal)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_MaxDepthForExpressionParse(int newVal)
|
||||
STDMETHODIMP CAwk::put_MaxDepthForExprParse(int newVal)
|
||||
{
|
||||
max_depth.expr.parse = newVal;
|
||||
if (handle != NULL)
|
||||
@ -841,7 +820,7 @@ STDMETHODIMP CAwk::put_MaxDepthForExpressionParse(int newVal)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_MaxDepthForExpressionRun(int *pVal)
|
||||
STDMETHODIMP CAwk::get_MaxDepthForExprRun(int *pVal)
|
||||
{
|
||||
if (handle != NULL)
|
||||
{
|
||||
@ -852,7 +831,7 @@ STDMETHODIMP CAwk::get_MaxDepthForExpressionRun(int *pVal)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_MaxDepthForExpressionRun(int newVal)
|
||||
STDMETHODIMP CAwk::put_MaxDepthForExprRun(int newVal)
|
||||
{
|
||||
max_depth.expr.run = newVal;
|
||||
if (handle != NULL)
|
||||
@ -906,3 +885,30 @@ STDMETHODIMP CAwk::put_MaxDepthForRexMatch(int newVal)
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_EntryPoint(BSTR *pVal)
|
||||
{
|
||||
if (entry_point == NULL) *pVal = NULL;
|
||||
else
|
||||
{
|
||||
BSTR tmp = SysAllocStringLen (
|
||||
entry_point, SysStringLen(entry_point));
|
||||
if (tmp == NULL) return E_OUTOFMEMORY;
|
||||
*pVal = tmp;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_EntryPoint(BSTR newVal)
|
||||
{
|
||||
if (entry_point != NULL) SysFreeString (entry_point);
|
||||
if (newVal == NULL) entry_point = newVal;
|
||||
else
|
||||
{
|
||||
entry_point = SysAllocStringLen (newVal, SysStringLen(newVal));
|
||||
if (entry_point == NULL) return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.h,v 1.8 2007-01-06 15:45:50 bacon Exp $
|
||||
* $Id: Awk.h,v 1.9 2007-01-10 14:30:44 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_COM_AWK_H_
|
||||
@ -53,12 +53,15 @@ public:
|
||||
int match;
|
||||
} rex;
|
||||
} max_depth;
|
||||
|
||||
IBuffer* read_src_buf;
|
||||
IBuffer* write_src_buf;
|
||||
ase_size_t read_src_pos;
|
||||
ase_size_t read_src_len;
|
||||
|
||||
IBuffer* write_extio_buf;
|
||||
|
||||
BSTR entry_point;
|
||||
public:
|
||||
CAwk();
|
||||
~CAwk ();
|
||||
@ -86,14 +89,16 @@ DECLARE_REGISTRY_RESOURCEID(IDR_AWK)
|
||||
|
||||
// IAwk
|
||||
public:
|
||||
STDMETHOD(get_EntryPoint)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_EntryPoint)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(get_MaxDepthForRexMatch)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(put_MaxDepthForRexMatch)(/*[in]*/ int newVal);
|
||||
STDMETHOD(get_MaxDepthForRexBuild)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(put_MaxDepthForRexBuild)(/*[in]*/ int newVal);
|
||||
STDMETHOD(get_MaxDepthForExpressionRun)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(put_MaxDepthForExpressionRun)(/*[in]*/ int newVal);
|
||||
STDMETHOD(get_MaxDepthForExpressionParse)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(put_MaxDepthForExpressionParse)(/*[in]*/ int newVal);
|
||||
STDMETHOD(get_MaxDepthForExprRun)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(put_MaxDepthForExprRun)(/*[in]*/ int newVal);
|
||||
STDMETHOD(get_MaxDepthForExprParse)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(put_MaxDepthForExprParse)(/*[in]*/ int newVal);
|
||||
STDMETHOD(get_MaxDepthForBlockRun)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(put_MaxDepthForBlockRun)(/*[in]*/ int newVal);
|
||||
STDMETHOD(get_MaxDepthForBlockParse)(/*[out, retval]*/ int *pVal);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: AwkExtio.cpp,v 1.7 2006-12-15 06:47:08 bacon Exp $
|
||||
* $Id: AwkExtio.cpp,v 1.8 2007-01-10 14:30:44 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -12,21 +12,11 @@
|
||||
|
||||
CAwkExtio::CAwkExtio (): name (NULL)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TCHAR x[128];
|
||||
_sntprintf (x, 128, _T("CAwkExtio::CAwkExtio %p"), this);
|
||||
MessageBox (NULL, x, x, MB_OK);
|
||||
#endif
|
||||
VariantInit (&handle);
|
||||
}
|
||||
|
||||
CAwkExtio::~CAwkExtio ()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TCHAR x[128];
|
||||
_sntprintf (x, 128, _T("CAwkExtio::~CAwkExtio %p"), this);
|
||||
MessageBox (NULL, x, x, MB_OK);
|
||||
#endif
|
||||
if (name != NULL) SysFreeString (name);
|
||||
VariantClear (&handle);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Buffer.cpp,v 1.4 2006-12-10 16:13:50 bacon Exp $
|
||||
* $Id: Buffer.cpp,v 1.5 2007-01-10 14:30:44 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -7,21 +7,11 @@
|
||||
|
||||
CBuffer::CBuffer ()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TCHAR x[128];
|
||||
_sntprintf (x, 128, _T("CBuffer::CBuffer %p"), this);
|
||||
MessageBox (NULL, x, x, MB_OK);
|
||||
#endif
|
||||
str = NULL;
|
||||
}
|
||||
|
||||
CBuffer::~CBuffer ()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TCHAR x[128];
|
||||
_sntprintf (x, 128, _T("CBuffer::~CBuffer %p"), this);
|
||||
MessageBox (NULL, x, x, MB_OK);
|
||||
#endif
|
||||
if (str != NULL) SysFreeString (str);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: ase.idl,v 1.8 2007-01-07 07:30:40 bacon Exp $
|
||||
* $Id: ase.idl,v 1.9 2007-01-10 14:30:44 bacon Exp $
|
||||
*/
|
||||
|
||||
import "oaidl.idl";
|
||||
@ -106,15 +106,15 @@ interface IAwk : IDispatch
|
||||
[propput, id(20), helpstring("property MaxDepthForBlockRun")]
|
||||
HRESULT MaxDepthForBlockRun([in] int newVal);
|
||||
|
||||
[propget, id(21), helpstring("property MaxDepthForExpressionParse")]
|
||||
HRESULT MaxDepthForExpressionParse([out, retval] int *pVal);
|
||||
[propput, id(21), helpstring("property MaxDepthForExpressionParse")]
|
||||
HRESULT MaxDepthForExpressionParse([in] int newVal);
|
||||
[propget, id(21), helpstring("property MaxDepthForExprParse")]
|
||||
HRESULT MaxDepthForExprParse([out, retval] int *pVal);
|
||||
[propput, id(21), helpstring("property MaxDepthForExprParse")]
|
||||
HRESULT MaxDepthForExprParse([in] int newVal);
|
||||
|
||||
[propget, id(22), helpstring("property MaxDepthForExpressionRun")]
|
||||
HRESULT MaxDepthForExpressionRun([out, retval] int *pVal);
|
||||
[propput, id(22), helpstring("property MaxDepthForExpressionRun")]
|
||||
HRESULT MaxDepthForExpressionRun([in] int newVal);
|
||||
[propget, id(22), helpstring("property MaxDepthForExprRun")]
|
||||
HRESULT MaxDepthForExprRun([out, retval] int *pVal);
|
||||
[propput, id(22), helpstring("property MaxDepthForExprRun")]
|
||||
HRESULT MaxDepthForExprRun([in] int newVal);
|
||||
|
||||
[propget, id(23), helpstring("property MaxDepthForRexBuild")]
|
||||
HRESULT MaxDepthForRexBuild([out, retval] int *pVal);
|
||||
@ -125,6 +125,8 @@ interface IAwk : IDispatch
|
||||
HRESULT MaxDepthForRexMatch([out, retval] int *pVal);
|
||||
[propput, id(24), helpstring("property MaxDepthForRexMatch")]
|
||||
HRESULT MaxDepthForRexMatch([in] int newVal);
|
||||
[propget, id(25), helpstring("property EntryPoint")] HRESULT EntryPoint([out, retval] BSTR *pVal);
|
||||
[propput, id(25), helpstring("property EntryPoint")] HRESULT EntryPoint([in] BSTR newVal);
|
||||
};
|
||||
|
||||
/* ASELib */
|
||||
|
Loading…
Reference in New Issue
Block a user