*** empty log message ***
This commit is contained in:
parent
1ecd0723c7
commit
596059efb5
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tree.h,v 1.84 2006-12-16 14:43:51 bacon Exp $
|
||||
* $Id: tree.h,v 1.85 2007-01-14 15:07:21 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_TREE_H_
|
||||
@ -89,18 +89,25 @@ enum ase_awk_out_type_t
|
||||
};
|
||||
|
||||
/* afn (awk function defined with the keyword function) */
|
||||
typedef struct ase_awk_afn_t ase_awk_afn_t;
|
||||
|
||||
typedef struct ase_awk_nde_t ase_awk_nde_t;
|
||||
|
||||
typedef struct ase_awk_afn_t ase_awk_afn_t;
|
||||
typedef struct ase_awk_nde_t ase_awk_nde_t;
|
||||
typedef struct ase_awk_nde_blk_t ase_awk_nde_blk_t;
|
||||
typedef struct ase_awk_nde_grp_t ase_awk_nde_grp_t;
|
||||
typedef struct ase_awk_nde_ass_t ase_awk_nde_ass_t;
|
||||
typedef struct ase_awk_nde_exp_t ase_awk_nde_exp_t;
|
||||
typedef struct ase_awk_nde_cnd_t ase_awk_nde_cnd_t;
|
||||
typedef struct ase_awk_nde_pos_t ase_awk_nde_pos_t;
|
||||
|
||||
#ifndef ASE_AWK_NDE_INT_DEFINED
|
||||
#define ASE_AWK_NDE_INT_DEFINED
|
||||
typedef struct ase_awk_nde_int_t ase_awk_nde_int_t;
|
||||
#endif
|
||||
|
||||
#ifndef ASE_AWK_NDE_REAL_DEFINED
|
||||
#define ASE_AWK_NDE_REAL_DEFINED
|
||||
typedef struct ase_awk_nde_real_t ase_awk_nde_real_t;
|
||||
#endif
|
||||
|
||||
typedef struct ase_awk_nde_str_t ase_awk_nde_str_t;
|
||||
typedef struct ase_awk_nde_rex_t ase_awk_nde_rex_t;
|
||||
typedef struct ase_awk_nde_var_t ase_awk_nde_var_t;
|
||||
|
@ -1,14 +1,17 @@
|
||||
/*
|
||||
* $Id: val.h,v 1.57 2006-12-16 14:43:51 bacon Exp $
|
||||
* $Id: val.h,v 1.58 2007-01-14 15:07:22 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_VAL_H_
|
||||
#define _ASE_AWK_VAL_H_
|
||||
|
||||
#ifndef _ASE_AWK_AWK_H_
|
||||
#error Never include this file directly. Include <ase/awk/awk.h> instead
|
||||
#error Include <ase/awk/awk.h> first
|
||||
#endif
|
||||
|
||||
#include <ase/awk/str.h>
|
||||
#include <ase/awk/map.h>
|
||||
|
||||
enum ase_awk_val_type_t
|
||||
{
|
||||
/* the values between ASE_AWK_VAL_NIL and ASE_AWK_VAL_STR inclusive
|
||||
@ -63,6 +66,17 @@ typedef struct ase_awk_val_ref_t ase_awk_val_ref_t;
|
||||
unsigned int ref: 29
|
||||
#endif
|
||||
|
||||
#ifndef ASE_AWK_NDE_INT_DEFINED
|
||||
#define ASE_AWK_NDE_INT_DEFINED
|
||||
typedef struct ase_awk_nde_int_t ase_awk_nde_int_t;
|
||||
#endif
|
||||
|
||||
#ifndef ASE_AWK_NDE_REAL_DEFINED
|
||||
#define ASE_AWK_NDE_REAL_DEFINED
|
||||
typedef struct ase_awk_nde_real_t ase_awk_nde_real_t;
|
||||
#endif
|
||||
|
||||
|
||||
struct ase_awk_val_t
|
||||
{
|
||||
ASE_AWK_VAL_HDR;
|
||||
@ -126,7 +140,7 @@ struct ase_awk_val_ref_t
|
||||
|
||||
int id;
|
||||
/* if id is ASE_AWK_VAL_REF_POS, adr holds an index of the
|
||||
* positionalvariable. Otherwise, adr points to the value
|
||||
* positional variable. Otherwise, adr points to the value
|
||||
* directly. */
|
||||
ase_awk_val_t** adr;
|
||||
};
|
||||
|
120
ase/com/Awk.cpp
120
ase/com/Awk.cpp
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.16 2007-01-11 03:55:35 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.17 2007-01-14 15:06:58 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -128,13 +128,7 @@ static void awk_aprintf (const ase_char_t* fmt, ...)
|
||||
n = _vsntprintf (buf, ASE_COUNTOF(buf), fmt, ap);
|
||||
if (n < 0) buf[ASE_COUNTOF(buf)-1] = ASE_T('\0');
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
MessageBox (NULL, buf,
|
||||
ASE_T("Assertion Failure"), MB_OK|MB_ICONERROR);
|
||||
#else
|
||||
MessageBox (NULL, buf,
|
||||
ASE_T("\uB2DD\uAE30\uB9AC \uC870\uB610"), MB_OK|MB_ICONERROR);
|
||||
#endif
|
||||
MessageBox (NULL, buf, ASE_T("Assertion Failure"), MB_OK|MB_ICONERROR);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
@ -259,6 +253,101 @@ static ase_ssize_t __write_source (
|
||||
return -1;
|
||||
}
|
||||
|
||||
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);
|
||||
long nargs = (long)ase_awk_getnargs (run);
|
||||
ase_awk_val_t* v;
|
||||
|
||||
SAFEARRAY* aa;
|
||||
SAFEARRAYBOUND bound[1];
|
||||
|
||||
bound[0].lLbound = 0;
|
||||
bound[0].cElements = nargs;
|
||||
|
||||
aa = SafeArrayCreate (VT_VARIANT, ASE_COUNTOF(bound), bound);
|
||||
if (aa == NULL)
|
||||
{
|
||||
ase_char_t buf[128];
|
||||
_sntprintf (buf, ASE_COUNTOF(buf),
|
||||
_T("out of memory in create argument array for %.*s\n"),
|
||||
fnl, fnm);
|
||||
ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (long i = 0; i < nargs; i++)
|
||||
{
|
||||
VARIANT arg;
|
||||
|
||||
VariantInit (&arg);
|
||||
|
||||
v = ase_awk_getarg (run, i);
|
||||
|
||||
if (v->type == ASE_AWK_VAL_INT)
|
||||
{
|
||||
//arg.vt = VT_I8;
|
||||
//arg.llVal = ((ase_awk_val_int_t*)v)->val;
|
||||
arg.vt = VT_I4;
|
||||
arg.lVal = (LONG)((ase_awk_val_int_t*)v)->val;
|
||||
}
|
||||
else if (v->type == ASE_AWK_VAL_REAL)
|
||||
{
|
||||
arg.vt = VT_R8;
|
||||
arg.dblVal = ((ase_awk_val_real_t*)v)->val;
|
||||
}
|
||||
else if (v->type == ASE_AWK_VAL_STR)
|
||||
{
|
||||
BSTR tmp = SysAllocStringLen (
|
||||
((ase_awk_val_str_t*)v)->buf,
|
||||
((ase_awk_val_str_t*)v)->len);
|
||||
|
||||
if (arg.bstrVal == NULL)
|
||||
{
|
||||
VariantClear (&arg);
|
||||
SafeArrayDestroy (aa);
|
||||
return -1;
|
||||
}
|
||||
|
||||
arg.vt = VT_BSTR;
|
||||
arg.bstrVal = tmp;
|
||||
}
|
||||
else if (v->type == ASE_AWK_VAL_NIL)
|
||||
{
|
||||
arg.vt = VT_EMPTY;
|
||||
}
|
||||
|
||||
HRESULT hr = SafeArrayPutElement (aa, &i, &arg);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear (&arg);
|
||||
SafeArrayDestroy (aa);
|
||||
|
||||
/* TODO: handle error properly */
|
||||
return -1;
|
||||
}
|
||||
|
||||
VariantClear (&arg);
|
||||
}
|
||||
|
||||
BSTR name = SysAllocStringLen (fnm, fnl);
|
||||
if (name == NULL)
|
||||
{
|
||||
/* TODO: handle error properly */
|
||||
SafeArrayDestroy (aa);
|
||||
return -1;
|
||||
}
|
||||
|
||||
INT n = awk->Fire_HandleBuiltinFunction (name, aa);
|
||||
|
||||
/* name and aa are destroyed in HandleBuiltinFunction */
|
||||
//SafeArrayDestroy (aa);
|
||||
//SysFreeString (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT CAwk::Parse (int* ret)
|
||||
{
|
||||
if (handle == NULL)
|
||||
@ -323,6 +412,15 @@ HRESULT CAwk::Parse (int* ret)
|
||||
ASE_AWK_DEPTH_REX_MATCH, max_depth.rex.match);
|
||||
}
|
||||
|
||||
ase_awk_addbfn (handle, _T("abc"), 3, 0, 5, 5, ASE_NULL, __handle_bfn);
|
||||
/*
|
||||
for (each buitlin function name... )
|
||||
{
|
||||
ase_awk_addbfn (handle,
|
||||
ptr, len, 0, min_args, max_args, __handle_bfn);
|
||||
}
|
||||
*/
|
||||
|
||||
ase_awk_srcios_t srcios;
|
||||
|
||||
srcios.in = __read_source;
|
||||
@ -551,6 +649,12 @@ HRESULT CAwk::Run (int* ret)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::AddBuiltinFunction(BSTR name)
|
||||
{
|
||||
/* TODO: remember names */
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_ErrorCode(int *pVal)
|
||||
{
|
||||
*pVal = errnum;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.h,v 1.10 2007-01-11 03:55:35 bacon Exp $
|
||||
* $Id: Awk.h,v 1.11 2007-01-14 15:06:58 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_COM_AWK_H_
|
||||
@ -13,6 +13,7 @@
|
||||
#include "ase.h"
|
||||
#include "awk_cp.h"
|
||||
#include <ase/awk/awk.h>
|
||||
#include <ase/awk/val.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAwk
|
||||
@ -135,6 +136,7 @@ public:
|
||||
STDMETHOD(get_ErrorMessage)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(get_ErrorLine)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(get_ErrorCode)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(AddBuiltinFunction)(BSTR name);
|
||||
HRESULT __stdcall Parse (int* ret);
|
||||
HRESULT __stdcall Run (int* ret);
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: ase.idl,v 1.11 2007-01-11 03:55:35 bacon Exp $
|
||||
* $Id: ase.idl,v 1.12 2007-01-14 15:06:58 bacon Exp $
|
||||
*/
|
||||
|
||||
import "oaidl.idl";
|
||||
@ -21,119 +21,121 @@ interface IAwk : IDispatch
|
||||
[id(2), helpstring("method Run")]
|
||||
HRESULT Run([out, retval] int* ret);
|
||||
|
||||
[propget, id(3), helpstring("property ErrorCode")]
|
||||
[id(3), helpstring("method AddBuiltinFunction")]
|
||||
HRESULT AddBuiltinFunction(BSTR name);
|
||||
|
||||
[propget, id(4), helpstring("property ErrorCode")]
|
||||
HRESULT ErrorCode([out, retval] int *pVal);
|
||||
|
||||
[propget, id(4), helpstring("property ErrorLine")]
|
||||
[propget, id(5), helpstring("property ErrorLine")]
|
||||
HRESULT ErrorLine([out, retval] int *pVal);
|
||||
|
||||
[propget, id(5), helpstring("property ErrorMessage")]
|
||||
[propget, id(6), helpstring("property ErrorMessage")]
|
||||
HRESULT ErrorMessage([out, retval] BSTR *pVal);
|
||||
|
||||
[propget, id(6), helpstring("property ImplicitVariable")]
|
||||
[propget, id(7), helpstring("property ImplicitVariable")]
|
||||
HRESULT ImplicitVariable([out, retval] BOOL *pVal);
|
||||
[propput, id(6), helpstring("property ImplicitVariable")]
|
||||
[propput, id(7), helpstring("property ImplicitVariable")]
|
||||
HRESULT ImplicitVariable([in] BOOL newVal);
|
||||
|
||||
[propget, id(7), helpstring("property ExplicitVariable")]
|
||||
[propget, id(8), helpstring("property ExplicitVariable")]
|
||||
HRESULT ExplicitVariable([out, retval] BOOL *pVal);
|
||||
[propput, id(7), helpstring("property ExplicitVariable")]
|
||||
[propput, id(8), helpstring("property ExplicitVariable")]
|
||||
HRESULT ExplicitVariable([in] BOOL newVal);
|
||||
|
||||
[propget, id(8), helpstring("property UniqueFunction")]
|
||||
[propget, id(9), helpstring("property UniqueFunction")]
|
||||
HRESULT UniqueFunction([out, retval] BOOL *pVal);
|
||||
|
||||
[propput, id(8), helpstring("property UniqueFunction")]
|
||||
[propput, id(9), helpstring("property UniqueFunction")]
|
||||
HRESULT UniqueFunction([in] BOOL newVal);
|
||||
|
||||
[propget, id(9), helpstring("property VariableShading")]
|
||||
[propget, id(10), helpstring("property VariableShading")]
|
||||
HRESULT VariableShading([out, retval] BOOL *pVal);
|
||||
[propput, id(9), helpstring("property VariableShading")]
|
||||
[propput, id(10), helpstring("property VariableShading")]
|
||||
HRESULT VariableShading([in] BOOL newVal);
|
||||
|
||||
[propget, id(10), helpstring("property ShiftOperators")]
|
||||
[propget, id(11), helpstring("property ShiftOperators")]
|
||||
HRESULT ShiftOperators([out, retval] BOOL *pVal);
|
||||
[propput, id(10), helpstring("property ShiftOperators")]
|
||||
[propput, id(11), helpstring("property ShiftOperators")]
|
||||
HRESULT ShiftOperators([in] BOOL newVal);
|
||||
|
||||
[propget, id(11), helpstring("property IdivOperator")]
|
||||
[propget, id(12), helpstring("property IdivOperator")]
|
||||
HRESULT IdivOperator([out, retval] BOOL *pVal);
|
||||
[propput, id(11), helpstring("property IdivOperator")]
|
||||
[propput, id(12), helpstring("property IdivOperator")]
|
||||
HRESULT IdivOperator([in] BOOL newVal);
|
||||
|
||||
[propget, id(12), helpstring("property ConcatString")]
|
||||
[propget, id(13), helpstring("property ConcatString")]
|
||||
HRESULT ConcatString([out, retval] BOOL *pVal);
|
||||
[propput, id(12), helpstring("property ConcatString")]
|
||||
[propput, id(13), helpstring("property ConcatString")]
|
||||
HRESULT ConcatString([in] BOOL newVal);
|
||||
|
||||
[propget, id(13), helpstring("property SupportExtio")]
|
||||
[propget, id(14), helpstring("property SupportExtio")]
|
||||
HRESULT SupportExtio([out, retval] BOOL *pVal);
|
||||
[propput, id(13), helpstring("property SupportExtio")]
|
||||
[propput, id(14), helpstring("property SupportExtio")]
|
||||
HRESULT SupportExtio([in] BOOL newVal);
|
||||
|
||||
[propget, id(14), helpstring("property SupportBlockless")]
|
||||
[propget, id(15), helpstring("property SupportBlockless")]
|
||||
HRESULT SupportBlockless([out, retval] BOOL *pVal);
|
||||
[propput, id(14), helpstring("property SupportBlockless")]
|
||||
[propput, id(15), helpstring("property SupportBlockless")]
|
||||
HRESULT SupportBlockless([in] BOOL newVal);
|
||||
|
||||
[propget, id(15), helpstring("property StringIndexOne")]
|
||||
[propget, id(16), helpstring("property StringIndexOne")]
|
||||
HRESULT StringIndexOne([out, retval] BOOL *pVal);
|
||||
[propput, id(15), helpstring("property StringIndexOne")]
|
||||
[propput, id(16), helpstring("property StringIndexOne")]
|
||||
HRESULT StringIndexOne([in] BOOL newVal);
|
||||
|
||||
[propget, id(16), helpstring("property StripSpaces")]
|
||||
[propget, id(17), helpstring("property StripSpaces")]
|
||||
HRESULT StripSpaces([out, retval] BOOL *pVal);
|
||||
[propput, id(16), helpstring("property StripSpaces")]
|
||||
[propput, id(17), helpstring("property StripSpaces")]
|
||||
HRESULT StripSpaces([in] BOOL newVal);
|
||||
|
||||
[propget, id(17), helpstring("property Nextofile")]
|
||||
[propget, id(18), helpstring("property Nextofile")]
|
||||
HRESULT Nextofile([out, retval] BOOL *pVal);
|
||||
[propput, id(17), helpstring("property Nextofile")]
|
||||
[propput, id(18), helpstring("property Nextofile")]
|
||||
HRESULT Nextofile([in] BOOL newVal);
|
||||
|
||||
[propget, id(18), helpstring("property UseCrlf")]
|
||||
[propget, id(19), helpstring("property UseCrlf")]
|
||||
HRESULT UseCrlf([out, retval] BOOL *pVal);
|
||||
[propput, id(18), helpstring("property UseCrlf")]
|
||||
[propput, id(19), helpstring("property UseCrlf")]
|
||||
HRESULT UseCrlf([in] BOOL newVal);
|
||||
|
||||
[propget, id(19), helpstring("property MaxDepthForBlockParse")]
|
||||
[propget, id(20), helpstring("property MaxDepthForBlockParse")]
|
||||
HRESULT MaxDepthForBlockParse([out, retval] int *pVal);
|
||||
[propput, id(19), helpstring("property MaxDepthForBlockParse")]
|
||||
[propput, id(20), helpstring("property MaxDepthForBlockParse")]
|
||||
HRESULT MaxDepthForBlockParse([in] int newVal);
|
||||
|
||||
[propget, id(20), helpstring("property MaxDepthForBlockRun")]
|
||||
[propget, id(21), helpstring("property MaxDepthForBlockRun")]
|
||||
HRESULT MaxDepthForBlockRun([out, retval] int *pVal);
|
||||
[propput, id(20), helpstring("property MaxDepthForBlockRun")]
|
||||
[propput, id(21), helpstring("property MaxDepthForBlockRun")]
|
||||
HRESULT MaxDepthForBlockRun([in] int newVal);
|
||||
|
||||
[propget, id(21), helpstring("property MaxDepthForExprParse")]
|
||||
[propget, id(22), helpstring("property MaxDepthForExprParse")]
|
||||
HRESULT MaxDepthForExprParse([out, retval] int *pVal);
|
||||
[propput, id(21), helpstring("property MaxDepthForExprParse")]
|
||||
[propput, id(22), helpstring("property MaxDepthForExprParse")]
|
||||
HRESULT MaxDepthForExprParse([in] int newVal);
|
||||
|
||||
[propget, id(22), helpstring("property MaxDepthForExprRun")]
|
||||
[propget, id(23), helpstring("property MaxDepthForExprRun")]
|
||||
HRESULT MaxDepthForExprRun([out, retval] int *pVal);
|
||||
[propput, id(22), helpstring("property MaxDepthForExprRun")]
|
||||
[propput, id(23), helpstring("property MaxDepthForExprRun")]
|
||||
HRESULT MaxDepthForExprRun([in] int newVal);
|
||||
|
||||
[propget, id(23), helpstring("property MaxDepthForRexBuild")]
|
||||
[propget, id(24), helpstring("property MaxDepthForRexBuild")]
|
||||
HRESULT MaxDepthForRexBuild([out, retval] int *pVal);
|
||||
[propput, id(23), helpstring("property MaxDepthForRexBuild")]
|
||||
[propput, id(24), helpstring("property MaxDepthForRexBuild")]
|
||||
HRESULT MaxDepthForRexBuild([in] int newVal);
|
||||
|
||||
[propget, id(24), helpstring("property MaxDepthForRexMatch")]
|
||||
[propget, id(25), helpstring("property MaxDepthForRexMatch")]
|
||||
HRESULT MaxDepthForRexMatch([out, retval] int *pVal);
|
||||
[propput, id(24), helpstring("property MaxDepthForRexMatch")]
|
||||
[propput, id(25), helpstring("property MaxDepthForRexMatch")]
|
||||
HRESULT MaxDepthForRexMatch([in] int newVal);
|
||||
|
||||
[propget, id(25), helpstring("property EntryPoint")]
|
||||
[propget, id(26), helpstring("property EntryPoint")]
|
||||
HRESULT EntryPoint([out, retval] BSTR *pVal);
|
||||
[propput, id(25), helpstring("property EntryPoint")]
|
||||
[propput, id(26), helpstring("property EntryPoint")]
|
||||
HRESULT EntryPoint([in] BSTR newVal);
|
||||
|
||||
[propget, id(26), helpstring("property Debug")]
|
||||
[propget, id(27), helpstring("property Debug")]
|
||||
HRESULT Debug([out, retval] BOOL *pVal);
|
||||
[propput, id(26), helpstring("property Debug")]
|
||||
[propput, id(27), helpstring("property Debug")]
|
||||
HRESULT Debug([in] BOOL newVal);
|
||||
};
|
||||
|
||||
@ -255,6 +257,9 @@ library ASELib
|
||||
|
||||
[id(10), helpstring("method NextExtio")]
|
||||
int NextExtio([in] IAwkExtio* extio);
|
||||
|
||||
[id(11), helpstring("method HandleBuiltinFunction")]
|
||||
int HandleBuiltinFunction([in] BSTR name, [in] VARIANT argarray);
|
||||
};
|
||||
|
||||
/* Awk */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk_cp.h,v 1.5 2006-12-11 14:58:25 bacon Exp $
|
||||
* $Id: awk_cp.h,v 1.6 2007-01-14 15:06:58 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _AWK_CP_H_
|
||||
@ -504,6 +504,69 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
INT Fire_HandleBuiltinFunction (BSTR name, SAFEARRAY* argarray)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int i, nconns = m_vec.GetSize();
|
||||
CComVariant ret;
|
||||
VARIANT args[2];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
hr = ret.ChangeType (VT_I4);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
/* TODO: set the error code properly... */
|
||||
/* invalid value returned... */
|
||||
VariantClear (&args[1]);
|
||||
VariantClear (&args[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
VariantClear (&args[1]);
|
||||
VariantClear (&args[0]);
|
||||
return ret.lVal;
|
||||
}
|
||||
|
||||
/* TODO; clear name and aa */
|
||||
VariantClear (&args[1]);
|
||||
VariantClear (&args[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -238,19 +238,19 @@ Function Awk_OpenExtio(ByVal extio As ASELib.AwkExtio) As Long
|
||||
If extio.mode = ASELib.AWK_EXTIO_FILE_READ Then
|
||||
extio.Handle = FreeFile
|
||||
On Error GoTo ErrorTrap
|
||||
Open extio.Name For Input As #extio.Handle
|
||||
Open extio.name For Input As #extio.Handle
|
||||
On Error GoTo 0
|
||||
Awk_OpenExtio = 1
|
||||
ElseIf extio.mode = ASELib.AWK_EXTIO_FILE_WRITE Then
|
||||
extio.Handle = FreeFile
|
||||
On Error GoTo ErrorTrap
|
||||
Open extio.Name For Output As #extio.Handle
|
||||
Open extio.name For Output As #extio.Handle
|
||||
On Error GoTo 0
|
||||
Awk_OpenExtio = 1
|
||||
ElseIf extio.mode = ASELib.AWK_EXTIO_FILE_APPEND Then
|
||||
extio.Handle = FreeFile
|
||||
On Error GoTo ErrorTrap
|
||||
Open extio.Name For Append As #extio.Handle
|
||||
Open extio.name For Append As #extio.Handle
|
||||
On Error GoTo 0
|
||||
Awk_OpenExtio = 1
|
||||
End If
|
||||
@ -387,6 +387,22 @@ ErrorTrap:
|
||||
Exit Function
|
||||
End Function
|
||||
|
||||
Function Awk_HandleBuiltinFunction(ByVal name As String, ByVal args As Variant) As Long
|
||||
|
||||
Dim i As Integer
|
||||
Dim xxx As String
|
||||
|
||||
MsgBox name
|
||||
|
||||
For i = LBound(args) To UBound(args)
|
||||
xxx = xxx & "," & args(i)
|
||||
Next i
|
||||
|
||||
MsgBox xxx
|
||||
|
||||
Awk_HandleBuiltinFunction = 0
|
||||
End Function
|
||||
|
||||
Private Sub Form_Load()
|
||||
SourceIn.Text = ""
|
||||
SourceOut.Text = ""
|
||||
|
Loading…
Reference in New Issue
Block a user