Recovered from cvs revision 2007-10-11 13:33:00

This commit is contained in:
2007-10-12 00:13:00 +00:00
parent 3cfcc8b0c9
commit 917d2fe1ff
23 changed files with 373 additions and 283 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp,v 1.9 2007/09/30 15:12:20 bacon Exp $
* $Id: Awk.cpp,v 1.11 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -55,17 +55,13 @@ CAwk::CAwk ():
/* TODO: what is the best default option? */
option =
ASE_AWK_IMPLICIT |
ASE_AWK_EXPLICIT |
ASE_AWK_UNIQUEFN |
ASE_AWK_IDIV |
ASE_AWK_SHADING |
ASE_AWK_SHIFT |
ASE_AWK_EXTIO |
ASE_AWK_BLOCKLESS |
ASE_AWK_BASEONE |
ASE_AWK_STRIPSPACES |
ASE_AWK_NEXTOFILE |
ASE_AWK_CRLF;
ASE_AWK_CRLF |
ASE_AWK_PABLOCK;
memset (&max_depth, 0, sizeof(max_depth));
errnum = 0;
@ -232,7 +228,7 @@ static void custom_awk_dprintf (void* custom, const ase_char_t* fmt, ...)
va_end (ap);
}
static ase_ssize_t __read_source (
static ase_ssize_t read_source (
int cmd, void* arg, ase_char_t* data, ase_size_t count)
{
CAwk* awk = (CAwk*)arg;
@ -300,7 +296,7 @@ static ase_ssize_t __read_source (
return -1;
}
static ase_ssize_t __write_source (
static ase_ssize_t write_source (
int cmd, void* arg, ase_char_t* data, ase_size_t count)
{
CAwk* awk = (CAwk*)arg;
@ -344,7 +340,7 @@ static ase_ssize_t __write_source (
return -1;
}
static int __handle_bfn (
static int handle_bfn (
ase_awk_run_t* run, const ase_char_t* fnm, ase_size_t fnl)
{
CAwk* awk = (CAwk*)ase_awk_getruncustomdata (run);
@ -558,7 +554,7 @@ HRESULT CAwk::Parse (VARIANT_BOOL* ret)
if (ase_awk_addfunc (
handle, bfn->name.ptr, bfn->name.len, 0,
bfn->min_args, bfn->max_args, NULL,
__handle_bfn) == NULL)
handle_bfn) == NULL)
{
const ase_char_t* msg;
@ -593,8 +589,8 @@ HRESULT CAwk::Parse (VARIANT_BOOL* ret)
ase_awk_srcios_t srcios;
srcios.in = __read_source;
srcios.out = __write_source;
srcios.in = read_source;
srcios.out = write_source;
srcios.custom_data = this;
if (ase_awk_parse (handle, &srcios) == -1)
@ -615,7 +611,7 @@ HRESULT CAwk::Parse (VARIANT_BOOL* ret)
return S_OK;
}
static ase_ssize_t __process_extio (
static ase_ssize_t process_extio (
int cmd, void* arg, ase_char_t* data, ase_size_t size)
{
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
@ -796,8 +792,8 @@ HRESULT CAwk::Run (VARIANT argarray, VARIANT_BOOL* ret)
ase_awk_runios_t runios;
runios.pipe = NULL;
runios.coproc = NULL;
runios.file = __process_extio;
runios.console = __process_extio;
runios.file = process_extio;
runios.console = process_extio;
runios.custom_data = this;
if (entry_point != NULL &&
@ -907,6 +903,21 @@ HRESULT CAwk::Run (VARIANT argarray, VARIANT_BOOL* ret)
return S_OK;
}
STDMETHODIMP CAwk::AddGlobal (BSTR name, VARIANT_BOOL* ret)
{
// TODO:
*ret = VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP CAwk::DeleteGlobal (BSTR name, VARIANT_BOOL* ret)
{
// TODO:
*ret = VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP CAwk::AddFunction (
BSTR name, int minArgs, int maxArgs, VARIANT_BOOL* ret)
{
@ -1352,6 +1363,21 @@ STDMETHODIMP CAwk::put_AllowMapToVar(VARIANT_BOOL newVal)
return S_OK;
}
STDMETHODIMP CAwk::get_SupportPatternActionBlock(VARIANT_BOOL *pVal)
{
if (handle != NULL) option = ase_awk_getoption (handle);
*pVal = (option & ASE_AWK_PABLOCK) == 1;
return S_OK;
}
STDMETHODIMP CAwk::put_SupportPatternActionBlock(VARIANT_BOOL newVal)
{
if (newVal) option = option | ASE_AWK_PABLOCK;
else option = option & ~ASE_AWK_PABLOCK;
if (handle != NULL) ase_awk_setoption (handle, option);
return S_OK;
}
STDMETHODIMP CAwk::get_MaxDepthForBlockParse(int *pVal)
{
if (handle != NULL)

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.h,v 1.8 2007/09/30 15:12:20 bacon Exp $
* $Id: Awk.h,v 1.10 2007/10/10 13:22:12 bacon Exp $
*
* {License}
*/
@ -141,6 +141,8 @@ public:
STDMETHOD(put_MaxDepthForBlockRun)(/*[in]*/ int newVal);
STDMETHOD(get_MaxDepthForBlockParse)(/*[out, retval]*/ int *pVal);
STDMETHOD(put_MaxDepthForBlockParse)(/*[in]*/ int newVal);
STDMETHOD(get_SupportPatternActionBlock)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_SupportPatternActionBlock)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_AllowMapToVar)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_AllowMapToVar)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_EnableReset)(/*[out, retval]*/ VARIANT_BOOL *pVal);
@ -190,6 +192,11 @@ public:
/*[in]*/ BSTR name, /*[in]*/ int minArgs,
/*[in]*/ int maxArgs, /*[out, retval]*/ VARIANT_BOOL* ret);
HRESULT __stdcall DeleteGlobal (
/*[in]*/ BSTR name, /*[out, retval]*/ VARIANT_BOOL* ret);
HRESULT __stdcall AddGlobal (
/*[in]*/ BSTR name, /*[out, retval]*/ VARIANT_BOOL* ret);
HRESULT __stdcall Parse (/*[out, retval]*/ VARIANT_BOOL* ret);
HRESULT __stdcall Run (
/*[in]*/ VARIANT argarray, /*[out, retval]*/ VARIANT_BOOL* ret);

View File

@ -1,5 +1,5 @@
/*
* $Id: asecom.idl,v 1.8 2007/09/30 15:12:20 bacon Exp $
* $Id: asecom.idl,v 1.10 2007/10/10 13:22:12 bacon Exp $
*/
import "oaidl.idl";
@ -21,153 +21,165 @@ interface IAwk : IDispatch
[id(2), helpstring("method Run")]
HRESULT Run([in] VARIANT argarray, [out,retval] VARIANT_BOOL* ret);
[id(3), helpstring("method AddFunction")]
[id(3), helpstring("method AddGlobal")]
HRESULT AddGlobal([in] BSTR name, [out,retval] VARIANT_BOOL* ret);
[id(4), helpstring("method DeleteGlobal")]
HRESULT DeleteGlobal([in] BSTR name, [out,retval] VARIANT_BOOL* ret);
[id(5), helpstring("method AddFunction")]
HRESULT AddFunction([in] BSTR name, [in] int minArgs, [in] int maxArgs, [out,retval] VARIANT_BOOL* ret);
[id(4), helpstring("method DeleteFunction")]
[id(6), helpstring("method DeleteFunction")]
HRESULT DeleteFunction([in] BSTR name, [out,retval] VARIANT_BOOL* ret);
[id(5), helpstring("method SetWord")]
[id(7), helpstring("method SetWord")]
HRESULT SetWord([in] BSTR ow, [in] BSTR nw, [out,retval] VARIANT_BOOL* ret);
[id(6), helpstring("method UnsetWord")]
[id(8), helpstring("method UnsetWord")]
HRESULT UnsetWord([in] BSTR ow, [out,retval] VARIANT_BOOL* ret);
[id(7), helpstring("method UnsetAllWords")]
[id(9), helpstring("method UnsetAllWords")]
HRESULT UnsetAllWords([out,retval] VARIANT_BOOL* ret);
[propget, id(8), helpstring("property ErrorCode")]
[propget, id(10), helpstring("property ErrorCode")]
HRESULT ErrorCode([out,retval] int *pVal);
[propget, id(9), helpstring("property ErrorLine")]
[propget, id(11), helpstring("property ErrorLine")]
HRESULT ErrorLine([out,retval] int *pVal);
[propget, id(10), helpstring("property ErrorMessage")]
[propget, id(12), helpstring("property ErrorMessage")]
HRESULT ErrorMessage([out,retval] BSTR *pVal);
[propget, id(11), helpstring("property ImplicitVariable")]
[propget, id(13), helpstring("property ImplicitVariable")]
HRESULT ImplicitVariable([out,retval] VARIANT_BOOL *pVal);
[propput, id(11), helpstring("property ImplicitVariable")]
[propput, id(13), helpstring("property ImplicitVariable")]
HRESULT ImplicitVariable([in] VARIANT_BOOL newVal);
[propget, id(12), helpstring("property ExplicitVariable")]
[propget, id(14), helpstring("property ExplicitVariable")]
HRESULT ExplicitVariable([out,retval] VARIANT_BOOL *pVal);
[propput, id(12), helpstring("property ExplicitVariable")]
[propput, id(14), helpstring("property ExplicitVariable")]
HRESULT ExplicitVariable([in] VARIANT_BOOL newVal);
[propget, id(13), helpstring("property UniqueFunction")]
[propget, id(15), helpstring("property UniqueFunction")]
HRESULT UniqueFunction([out,retval] VARIANT_BOOL *pVal);
[propput, id(13), helpstring("property UniqueFunction")]
[propput, id(15), helpstring("property UniqueFunction")]
HRESULT UniqueFunction([in] VARIANT_BOOL newVal);
[propget, id(14), helpstring("property VariableShading")]
[propget, id(16), helpstring("property VariableShading")]
HRESULT VariableShading([out,retval] VARIANT_BOOL *pVal);
[propput, id(14), helpstring("property VariableShading")]
[propput, id(16), helpstring("property VariableShading")]
HRESULT VariableShading([in] VARIANT_BOOL newVal);
[propget, id(15), helpstring("property ShiftOperators")]
[propget, id(17), helpstring("property ShiftOperators")]
HRESULT ShiftOperators([out,retval] VARIANT_BOOL *pVal);
[propput, id(15), helpstring("property ShiftOperators")]
[propput, id(17), helpstring("property ShiftOperators")]
HRESULT ShiftOperators([in] VARIANT_BOOL newVal);
[propget, id(16), helpstring("property IdivOperator")]
[propget, id(18), helpstring("property IdivOperator")]
HRESULT IdivOperator([out,retval] VARIANT_BOOL *pVal);
[propput, id(16), helpstring("property IdivOperator")]
[propput, id(18), helpstring("property IdivOperator")]
HRESULT IdivOperator([in] VARIANT_BOOL newVal);
[propget, id(17), helpstring("property ConcatString")]
[propget, id(19), helpstring("property ConcatString")]
HRESULT ConcatString([out,retval] VARIANT_BOOL *pVal);
[propput, id(17), helpstring("property ConcatString")]
[propput, id(19), helpstring("property ConcatString")]
HRESULT ConcatString([in] VARIANT_BOOL newVal);
[propget, id(18), helpstring("property SupportExtio")]
[propget, id(20), helpstring("property SupportExtio")]
HRESULT SupportExtio([out,retval] VARIANT_BOOL *pVal);
[propput, id(18), helpstring("property SupportExtio")]
[propput, id(20), helpstring("property SupportExtio")]
HRESULT SupportExtio([in] VARIANT_BOOL newVal);
[propget, id(19), helpstring("property SupportBlockless")]
[propget, id(21), helpstring("property SupportBlockless")]
HRESULT SupportBlockless([out,retval] VARIANT_BOOL *pVal);
[propput, id(19), helpstring("property SupportBlockless")]
[propput, id(21), helpstring("property SupportBlockless")]
HRESULT SupportBlockless([in] VARIANT_BOOL newVal);
[propget, id(20), helpstring("property BaseOne")]
[propget, id(22), helpstring("property BaseOne")]
HRESULT BaseOne([out,retval] VARIANT_BOOL *pVal);
[propput, id(20), helpstring("property BaseOne")]
[propput, id(22), helpstring("property BaseOne")]
HRESULT BaseOne([in] VARIANT_BOOL newVal);
[propget, id(21), helpstring("property StripSpaces")]
[propget, id(23), helpstring("property StripSpaces")]
HRESULT StripSpaces([out,retval] VARIANT_BOOL *pVal);
[propput, id(21), helpstring("property StripSpaces")]
[propput, id(23), helpstring("property StripSpaces")]
HRESULT StripSpaces([in] VARIANT_BOOL newVal);
[propget, id(22), helpstring("property EnableNextofile")]
[propget, id(24), helpstring("property EnableNextofile")]
HRESULT EnableNextofile([out,retval] VARIANT_BOOL *pVal);
[propput, id(22), helpstring("property EnableNextofile")]
[propput, id(24), helpstring("property EnableNextofile")]
HRESULT EnableNextofile([in] VARIANT_BOOL newVal);
[propget, id(23), helpstring("property UseCrlf")]
[propget, id(25), helpstring("property UseCrlf")]
HRESULT UseCrlf([out,retval] VARIANT_BOOL *pVal);
[propput, id(23), helpstring("property UseCrlf")]
[propput, id(25), helpstring("property UseCrlf")]
HRESULT UseCrlf([in] VARIANT_BOOL newVal);
[propget, id(24), helpstring("property ArgumentsToEntryPoint")]
[propget, id(26), helpstring("property ArgumentsToEntryPoint")]
HRESULT ArgumentsToEntryPoint([out,retval] VARIANT_BOOL *pVal);
[propput, id(24), helpstring("property ArgumentsToEntryPoint")]
[propput, id(26), helpstring("property ArgumentsToEntryPoint")]
HRESULT ArgumentsToEntryPoint([in] VARIANT_BOOL newVal);
[propget, id(25), helpstring("property EnableReset")]
[propget, id(27), helpstring("property EnableReset")]
HRESULT EnableReset([out,retval] VARIANT_BOOL *pVal);
[propput, id(25), helpstring("property EnableReset")]
[propput, id(27), helpstring("property EnableReset")]
HRESULT EnableReset([in] VARIANT_BOOL newVal);
[propget, id(26), helpstring("property AllowMapToVar")]
[propget, id(28), helpstring("property AllowMapToVar")]
HRESULT AllowMapToVar([out,retval] VARIANT_BOOL *pVal);
[propput, id(26), helpstring("property AllowMapToVar")]
[propput, id(28), helpstring("property AllowMapToVar")]
HRESULT AllowMapToVar([in] VARIANT_BOOL newVal);
[propget, id(27), helpstring("property MaxDepthForBlockParse")]
[propget, id(29), helpstring("property SupportPatternActionBlock")]
HRESULT SupportPatternActionBlock([out,retval] VARIANT_BOOL *pVal);
[propput, id(29), helpstring("property SupportPatternActioinBlock")]
HRESULT SupportPatternActionBlock([in] VARIANT_BOOL newVal);
[propget, id(30), helpstring("property MaxDepthForBlockParse")]
HRESULT MaxDepthForBlockParse([out,retval] int *pVal);
[propput, id(27), helpstring("property MaxDepthForBlockParse")]
[propput, id(30), helpstring("property MaxDepthForBlockParse")]
HRESULT MaxDepthForBlockParse([in] int newVal);
[propget, id(28), helpstring("property MaxDepthForBlockRun")]
[propget, id(31), helpstring("property MaxDepthForBlockRun")]
HRESULT MaxDepthForBlockRun([out,retval] int *pVal);
[propput, id(28), helpstring("property MaxDepthForBlockRun")]
[propput, id(31), helpstring("property MaxDepthForBlockRun")]
HRESULT MaxDepthForBlockRun([in] int newVal);
[propget, id(29), helpstring("property MaxDepthForExprParse")]
[propget, id(32), helpstring("property MaxDepthForExprParse")]
HRESULT MaxDepthForExprParse([out,retval] int *pVal);
[propput, id(29), helpstring("property MaxDepthForExprParse")]
[propput, id(32), helpstring("property MaxDepthForExprParse")]
HRESULT MaxDepthForExprParse([in] int newVal);
[propget, id(30), helpstring("property MaxDepthForExprRun")]
[propget, id(33), helpstring("property MaxDepthForExprRun")]
HRESULT MaxDepthForExprRun([out,retval] int *pVal);
[propput, id(30), helpstring("property MaxDepthForExprRun")]
[propput, id(33), helpstring("property MaxDepthForExprRun")]
HRESULT MaxDepthForExprRun([in] int newVal);
[propget, id(31), helpstring("property MaxDepthForRexBuild")]
[propget, id(34), helpstring("property MaxDepthForRexBuild")]
HRESULT MaxDepthForRexBuild([out,retval] int *pVal);
[propput, id(31), helpstring("property MaxDepthForRexBuild")]
[propput, id(34), helpstring("property MaxDepthForRexBuild")]
HRESULT MaxDepthForRexBuild([in] int newVal);
[propget, id(32), helpstring("property MaxDepthForRexMatch")]
[propget, id(35), helpstring("property MaxDepthForRexMatch")]
HRESULT MaxDepthForRexMatch([out,retval] int *pVal);
[propput, id(32), helpstring("property MaxDepthForRexMatch")]
[propput, id(35), helpstring("property MaxDepthForRexMatch")]
HRESULT MaxDepthForRexMatch([in] int newVal);
[propget, id(33), helpstring("property EntryPoint")]
[propget, id(36), helpstring("property EntryPoint")]
HRESULT EntryPoint([out,retval] BSTR *pVal);
[propput, id(33), helpstring("property EntryPoint")]
[propput, id(36), helpstring("property EntryPoint")]
HRESULT EntryPoint([in] BSTR newVal);
[propget, id(34), helpstring("property Debug")]
[propget, id(37), helpstring("property Debug")]
HRESULT Debug([out,retval] VARIANT_BOOL *pVal);
[propput, id(34), helpstring("property Debug")]
[propput, id(37), helpstring("property Debug")]
HRESULT Debug([in] VARIANT_BOOL newVal);
[propget, id(35), helpstring("property UseLongLong")]
[propget, id(38), helpstring("property UseLongLong")]
HRESULT UseLongLong([out,retval] VARIANT_BOOL *pVal);
[propput, id(35), helpstring("property UseLongLong")]
[propput, id(38), helpstring("property UseLongLong")]
HRESULT UseLongLong([in] VARIANT_BOOL newVal);
};