*** empty log message ***
This commit is contained in:
parent
dac7c6d222
commit
c9d7ebfd1c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: run.c,v 1.348 2007-04-15 15:26:57 bacon Exp $
|
* $Id: run.c,v 1.349 2007-04-21 12:40:44 bacon Exp $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -1177,8 +1177,7 @@ static int run_main (
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runarg == ASE_NULL) nrunargs = 0;
|
if (__build_runarg (run, runarg, &nrunargs) == -1)
|
||||||
else if (__build_runarg (run, runarg, &nrunargs) == -1)
|
|
||||||
{
|
{
|
||||||
/* it can simply restore the top of the stack this way
|
/* it can simply restore the top of the stack this way
|
||||||
* because the values pused onto the stack so far are
|
* because the values pused onto the stack so far are
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: Awk.cpp,v 1.34 2007-04-15 15:26:57 bacon Exp $
|
* $Id: Awk.cpp,v 1.35 2007-04-21 12:40:44 bacon Exp $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -748,9 +748,11 @@ static ase_ssize_t __process_extio (
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CAwk::Run (VARIANT_BOOL* ret)
|
HRESULT CAwk::Run (VARIANT argarray, VARIANT_BOOL* ret)
|
||||||
{
|
{
|
||||||
const ase_char_t* entry = NULL;
|
const ase_char_t* entry = NULL;
|
||||||
|
ase_awk_runarg_t* runarg;
|
||||||
|
long nrunargs;
|
||||||
|
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
{
|
{
|
||||||
@ -772,7 +774,79 @@ HRESULT CAwk::Run (VARIANT_BOOL* ret)
|
|||||||
if (entry_point != NULL &&
|
if (entry_point != NULL &&
|
||||||
SysStringLen(entry_point) > 0) entry = entry_point;
|
SysStringLen(entry_point) > 0) entry = entry_point;
|
||||||
|
|
||||||
if (ase_awk_run (handle, entry, &runios, NULL, NULL, this) == -1)
|
if (argarray.vt == VT_EMPTY || argarray.vt == VT_NULL)
|
||||||
|
{
|
||||||
|
/* no run-time argument specified */
|
||||||
|
runarg = NULL;
|
||||||
|
}
|
||||||
|
else if (argarray.vt == (VT_ARRAY|VT_BSTR))
|
||||||
|
{
|
||||||
|
SAFEARRAY* sa = argarray.parray;
|
||||||
|
UINT dim = SafeArrayGetDim (sa);
|
||||||
|
if (dim != 1)
|
||||||
|
{
|
||||||
|
/* arguments should not be multi-dimensional */
|
||||||
|
errnum = ASE_AWK_EINTERN;
|
||||||
|
errlin = 0;
|
||||||
|
_tcscpy (errmsg, _T("multi-dimensional run-time argument array not allowed"));
|
||||||
|
|
||||||
|
*ret = VARIANT_FALSE;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
long lbound, ubound;
|
||||||
|
SafeArrayGetLBound (sa, 1, &lbound);
|
||||||
|
SafeArrayGetUBound (sa, 1, &ubound);
|
||||||
|
|
||||||
|
nrunargs = ubound - lbound + 1;
|
||||||
|
runarg = (ase_awk_runarg_t*) malloc (sizeof(*runarg) * (nrunargs+1));
|
||||||
|
if (runarg == NULL)
|
||||||
|
{
|
||||||
|
errnum = ASE_AWK_ENOMEM;
|
||||||
|
errlin = 0;
|
||||||
|
ase_strxcpy (
|
||||||
|
errmsg, ASE_COUNTOF(errmsg),
|
||||||
|
ase_awk_geterrstr(NULL, errnum));
|
||||||
|
|
||||||
|
*ret = VARIANT_FALSE;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (long i = lbound, j = 0; i <= ubound; i++, j++)
|
||||||
|
{
|
||||||
|
BSTR bstr;
|
||||||
|
HRESULT hr = SafeArrayGetElement (sa, &i, (void**)&bstr);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
errnum = ASE_AWK_EINTERN;
|
||||||
|
errlin = 0;
|
||||||
|
_tcscpy (errmsg, _T("cannot get run-time argument array element"));
|
||||||
|
|
||||||
|
for (long i = 0; i < j; i++) SysFreeString (runarg[i].ptr);
|
||||||
|
free (runarg);
|
||||||
|
|
||||||
|
*ret = VARIANT_FALSE;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
runarg[j].ptr = bstr;
|
||||||
|
runarg[j].len = SysStringLen (bstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
runarg[j].ptr = NULL;
|
||||||
|
runarg[j].len = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errnum = ASE_AWK_EINTERN;
|
||||||
|
errlin = 0;
|
||||||
|
_tcscpy (errmsg, _T("invalid arguments"));
|
||||||
|
|
||||||
|
*ret = VARIANT_FALSE;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ase_awk_run (handle, entry, &runios, NULL, runarg, this) == -1)
|
||||||
{
|
{
|
||||||
const ase_char_t* msg;
|
const ase_char_t* msg;
|
||||||
|
|
||||||
@ -780,11 +854,25 @@ HRESULT CAwk::Run (VARIANT_BOOL* ret)
|
|||||||
ase_strxcpy (errmsg, ASE_COUNTOF(errmsg), msg);
|
ase_strxcpy (errmsg, ASE_COUNTOF(errmsg), msg);
|
||||||
|
|
||||||
DBGOUT (_T("cannot run the program"));
|
DBGOUT (_T("cannot run the program"));
|
||||||
|
|
||||||
|
if (runarg != NULL)
|
||||||
|
{
|
||||||
|
for (long j = 0; j < nrunargs; j++) SysFreeString (runarg[j].ptr);
|
||||||
|
free (runarg);
|
||||||
|
}
|
||||||
|
|
||||||
*ret = VARIANT_FALSE;
|
*ret = VARIANT_FALSE;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
else DBGOUT (_T("run the program successfully"));
|
else DBGOUT (_T("run the program successfully"));
|
||||||
|
|
||||||
|
|
||||||
|
if (runarg != NULL)
|
||||||
|
{
|
||||||
|
for (long j = 0; j < nrunargs; j++) SysFreeString (runarg[j].ptr);
|
||||||
|
free (runarg);
|
||||||
|
}
|
||||||
|
|
||||||
*ret = VARIANT_TRUE;
|
*ret = VARIANT_TRUE;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -1103,14 +1191,14 @@ STDMETHODIMP CAwk::put_UseCrlf(VARIANT_BOOL newVal)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_ArgsToMain(VARIANT_BOOL *pVal)
|
STDMETHODIMP CAwk::get_ArgumentsToEntryPoint(VARIANT_BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getoption (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_ARGSTOMAIN) == 1;
|
*pVal = (option & ASE_AWK_ARGSTOMAIN) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::put_ArgsToMain(VARIANT_BOOL newVal)
|
STDMETHODIMP CAwk::put_ArgumentsToEntryPoint(VARIANT_BOOL newVal)
|
||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_ARGSTOMAIN;
|
if (newVal) option = option | ASE_AWK_ARGSTOMAIN;
|
||||||
else option = option & ~ASE_AWK_ARGSTOMAIN;
|
else option = option & ~ASE_AWK_ARGSTOMAIN;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: Awk.h,v 1.21 2007-04-15 15:26:58 bacon Exp $
|
* $Id: Awk.h,v 1.22 2007-04-21 12:40:44 bacon Exp $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -124,8 +124,8 @@ public:
|
|||||||
STDMETHOD(put_MaxDepthForBlockRun)(/*[in]*/ int newVal);
|
STDMETHOD(put_MaxDepthForBlockRun)(/*[in]*/ int newVal);
|
||||||
STDMETHOD(get_MaxDepthForBlockParse)(/*[out, retval]*/ int *pVal);
|
STDMETHOD(get_MaxDepthForBlockParse)(/*[out, retval]*/ int *pVal);
|
||||||
STDMETHOD(put_MaxDepthForBlockParse)(/*[in]*/ int newVal);
|
STDMETHOD(put_MaxDepthForBlockParse)(/*[in]*/ int newVal);
|
||||||
STDMETHOD(get_ArgsToMain)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
STDMETHOD(get_ArgumentsToEntryPoint)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||||
STDMETHOD(put_ArgsToMain)(/*[in]*/ VARIANT_BOOL newVal);
|
STDMETHOD(put_ArgumentsToEntryPoint)(/*[in]*/ VARIANT_BOOL newVal);
|
||||||
STDMETHOD(get_UseCrlf)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
STDMETHOD(get_UseCrlf)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||||
STDMETHOD(put_UseCrlf)(/*[in]*/ VARIANT_BOOL newVal);
|
STDMETHOD(put_UseCrlf)(/*[in]*/ VARIANT_BOOL newVal);
|
||||||
STDMETHOD(get_Nextofile)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
STDMETHOD(get_Nextofile)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||||
@ -156,6 +156,7 @@ public:
|
|||||||
STDMETHOD(get_ErrorLine)(/*[out, retval]*/ int *pVal);
|
STDMETHOD(get_ErrorLine)(/*[out, retval]*/ int *pVal);
|
||||||
STDMETHOD(get_ErrorCode)(/*[out, retval]*/ int *pVal);
|
STDMETHOD(get_ErrorCode)(/*[out, retval]*/ int *pVal);
|
||||||
|
|
||||||
|
|
||||||
HRESULT __stdcall DeleteFunction (
|
HRESULT __stdcall DeleteFunction (
|
||||||
/*[in]*/ BSTR name, /*[out, retval]*/ VARIANT_BOOL* ret);
|
/*[in]*/ BSTR name, /*[out, retval]*/ VARIANT_BOOL* ret);
|
||||||
HRESULT __stdcall AddFunction (
|
HRESULT __stdcall AddFunction (
|
||||||
@ -163,7 +164,8 @@ public:
|
|||||||
/*[in]*/ int maxArgs, /*[out, retval]*/ VARIANT_BOOL* ret);
|
/*[in]*/ int maxArgs, /*[out, retval]*/ VARIANT_BOOL* ret);
|
||||||
|
|
||||||
HRESULT __stdcall Parse (/*[out, retval]*/ VARIANT_BOOL* ret);
|
HRESULT __stdcall Parse (/*[out, retval]*/ VARIANT_BOOL* ret);
|
||||||
HRESULT __stdcall Run (/*[out, retval]*/ VARIANT_BOOL* ret);
|
HRESULT __stdcall Run (
|
||||||
|
/*[in]*/ VARIANT argarray, /*[out, retval]*/ VARIANT_BOOL* ret);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: asecom.idl,v 1.5 2007-04-15 15:26:58 bacon Exp $
|
* $Id: asecom.idl,v 1.6 2007-04-21 12:40:44 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import "oaidl.idl";
|
import "oaidl.idl";
|
||||||
@ -19,7 +19,7 @@ interface IAwk : IDispatch
|
|||||||
HRESULT Parse([out,retval] VARIANT_BOOL* ret);
|
HRESULT Parse([out,retval] VARIANT_BOOL* ret);
|
||||||
|
|
||||||
[id(2), helpstring("method Run")]
|
[id(2), helpstring("method Run")]
|
||||||
HRESULT Run([out,retval] VARIANT_BOOL* ret);
|
HRESULT Run([in] VARIANT argarray, [out,retval] VARIANT_BOOL* ret);
|
||||||
|
|
||||||
[id(3), helpstring("method AddFunction")]
|
[id(3), helpstring("method AddFunction")]
|
||||||
HRESULT AddFunction([in] BSTR name, [in] int minArgs, [in] int maxArgs, [out,retval] VARIANT_BOOL* ret);
|
HRESULT AddFunction([in] BSTR name, [in] int minArgs, [in] int maxArgs, [out,retval] VARIANT_BOOL* ret);
|
||||||
@ -101,10 +101,10 @@ interface IAwk : IDispatch
|
|||||||
[propput, id(20), helpstring("property UseCrlf")]
|
[propput, id(20), helpstring("property UseCrlf")]
|
||||||
HRESULT UseCrlf([in] VARIANT_BOOL newVal);
|
HRESULT UseCrlf([in] VARIANT_BOOL newVal);
|
||||||
|
|
||||||
[propget, id(21), helpstring("property ArgsToMain")]
|
[propget, id(21), helpstring("property ArgumentsToEntryPoint")]
|
||||||
HRESULT ArgsToMain([out,retval] VARIANT_BOOL *pVal);
|
HRESULT ArgumentsToEntryPoint([out,retval] VARIANT_BOOL *pVal);
|
||||||
[propput, id(21), helpstring("property ArgsToMain")]
|
[propput, id(21), helpstring("property ArgumentsToEntryPoint")]
|
||||||
HRESULT ArgsToMain([in] VARIANT_BOOL newVal);
|
HRESULT ArgumentsToEntryPoint([in] VARIANT_BOOL newVal);
|
||||||
|
|
||||||
[propget, id(22), helpstring("property MaxDepthForBlockParse")]
|
[propget, id(22), helpstring("property MaxDepthForBlockParse")]
|
||||||
HRESULT MaxDepthForBlockParse([out,retval] int *pVal);
|
HRESULT MaxDepthForBlockParse([out,retval] int *pVal);
|
||||||
|
@ -1,22 +1,53 @@
|
|||||||
VERSION 5.00
|
VERSION 5.00
|
||||||
Begin VB.Form AwkForm
|
Begin VB.Form AwkForm
|
||||||
Caption = "ASE.COM.AWK"
|
Caption = "ASE.COM.AWK"
|
||||||
ClientHeight = 7635
|
ClientHeight = 8100
|
||||||
ClientLeft = 60
|
ClientLeft = 60
|
||||||
ClientTop = 345
|
ClientTop = 345
|
||||||
ClientWidth = 10335
|
ClientWidth = 12900
|
||||||
LinkTopic = "AwkForm"
|
LinkTopic = "AwkForm"
|
||||||
ScaleHeight = 7635
|
MaxButton = 0 'False
|
||||||
ScaleWidth = 10335
|
ScaleHeight = 8100
|
||||||
|
ScaleWidth = 12900
|
||||||
StartUpPosition = 3 'Windows Default
|
StartUpPosition = 3 'Windows Default
|
||||||
|
Begin VB.CommandButton btnClearAll
|
||||||
|
Caption = "Clear All"
|
||||||
|
Height = 375
|
||||||
|
Left = 240
|
||||||
|
TabIndex = 14
|
||||||
|
Top = 4560
|
||||||
|
Width = 2295
|
||||||
|
End
|
||||||
|
Begin VB.CommandButton btnAddArgument
|
||||||
|
Caption = "Add"
|
||||||
|
Height = 375
|
||||||
|
Left = 1920
|
||||||
|
TabIndex = 12
|
||||||
|
Top = 4080
|
||||||
|
Width = 615
|
||||||
|
End
|
||||||
|
Begin VB.TextBox txtArgument
|
||||||
|
Height = 375
|
||||||
|
Left = 240
|
||||||
|
TabIndex = 11
|
||||||
|
Top = 4080
|
||||||
|
Width = 1575
|
||||||
|
End
|
||||||
|
Begin VB.ListBox lstArguments
|
||||||
|
Height = 2595
|
||||||
|
Left = 240
|
||||||
|
TabIndex = 10
|
||||||
|
Top = 1320
|
||||||
|
Width = 2295
|
||||||
|
End
|
||||||
Begin VB.ComboBox EntryPoint
|
Begin VB.ComboBox EntryPoint
|
||||||
Height = 315
|
Height = 315
|
||||||
ItemData = "AwkForm.frx":0000
|
ItemData = "AwkForm.frx":0000
|
||||||
Left = 1080
|
Left = 240
|
||||||
List = "AwkForm.frx":0007
|
List = "AwkForm.frx":0007
|
||||||
TabIndex = 9
|
TabIndex = 9
|
||||||
Top = 120
|
Top = 480
|
||||||
Width = 3495
|
Width = 2295
|
||||||
End
|
End
|
||||||
Begin VB.TextBox ConsoleIn
|
Begin VB.TextBox ConsoleIn
|
||||||
BeginProperty Font
|
BeginProperty Font
|
||||||
@ -28,12 +59,12 @@ Begin VB.Form AwkForm
|
|||||||
Italic = 0 'False
|
Italic = 0 'False
|
||||||
Strikethrough = 0 'False
|
Strikethrough = 0 'False
|
||||||
EndProperty
|
EndProperty
|
||||||
Height = 2895
|
Height = 3735
|
||||||
Left = 120
|
Left = 2760
|
||||||
MultiLine = -1 'True
|
MultiLine = -1 'True
|
||||||
ScrollBars = 3 'Both
|
ScrollBars = 3 'Both
|
||||||
TabIndex = 2
|
TabIndex = 2
|
||||||
Top = 3960
|
Top = 4320
|
||||||
Width = 5055
|
Width = 5055
|
||||||
End
|
End
|
||||||
Begin VB.TextBox SourceIn
|
Begin VB.TextBox SourceIn
|
||||||
@ -46,12 +77,12 @@ Begin VB.Form AwkForm
|
|||||||
Italic = 0 'False
|
Italic = 0 'False
|
||||||
Strikethrough = 0 'False
|
Strikethrough = 0 'False
|
||||||
EndProperty
|
EndProperty
|
||||||
Height = 2775
|
Height = 3615
|
||||||
Left = 120
|
Left = 2760
|
||||||
MultiLine = -1 'True
|
MultiLine = -1 'True
|
||||||
ScrollBars = 3 'Both
|
ScrollBars = 3 'Both
|
||||||
TabIndex = 0
|
TabIndex = 0
|
||||||
Top = 840
|
Top = 360
|
||||||
Width = 5055
|
Width = 5055
|
||||||
End
|
End
|
||||||
Begin VB.TextBox SourceOut
|
Begin VB.TextBox SourceOut
|
||||||
@ -64,21 +95,21 @@ Begin VB.Form AwkForm
|
|||||||
Italic = 0 'False
|
Italic = 0 'False
|
||||||
Strikethrough = 0 'False
|
Strikethrough = 0 'False
|
||||||
EndProperty
|
EndProperty
|
||||||
Height = 2775
|
Height = 3615
|
||||||
Left = 5280
|
Left = 7920
|
||||||
Locked = -1 'True
|
Locked = -1 'True
|
||||||
MultiLine = -1 'True
|
MultiLine = -1 'True
|
||||||
ScrollBars = 3 'Both
|
ScrollBars = 3 'Both
|
||||||
TabIndex = 1
|
TabIndex = 1
|
||||||
Top = 840
|
Top = 360
|
||||||
Width = 4935
|
Width = 4935
|
||||||
End
|
End
|
||||||
Begin VB.CommandButton Execute
|
Begin VB.CommandButton btnExecute
|
||||||
Caption = "Execute"
|
Caption = "Execute"
|
||||||
Height = 375
|
Height = 375
|
||||||
Left = 9000
|
Left = 1440
|
||||||
TabIndex = 5
|
TabIndex = 5
|
||||||
Top = 7080
|
Top = 7680
|
||||||
Width = 1215
|
Width = 1215
|
||||||
End
|
End
|
||||||
Begin VB.TextBox ConsoleOut
|
Begin VB.TextBox ConsoleOut
|
||||||
@ -91,52 +122,68 @@ Begin VB.Form AwkForm
|
|||||||
Italic = 0 'False
|
Italic = 0 'False
|
||||||
Strikethrough = 0 'False
|
Strikethrough = 0 'False
|
||||||
EndProperty
|
EndProperty
|
||||||
Height = 2895
|
Height = 3735
|
||||||
Left = 5280
|
Left = 7920
|
||||||
MultiLine = -1 'True
|
MultiLine = -1 'True
|
||||||
ScrollBars = 3 'Both
|
ScrollBars = 3 'Both
|
||||||
TabIndex = 3
|
TabIndex = 3
|
||||||
Top = 3960
|
Top = 4320
|
||||||
Width = 4935
|
Width = 4935
|
||||||
End
|
End
|
||||||
Begin VB.Label Label5
|
Begin VB.Frame Frame1
|
||||||
Caption = "Entry Point:"
|
Caption = "Arguments"
|
||||||
Height = 255
|
Height = 4335
|
||||||
Left = 120
|
Left = 120
|
||||||
TabIndex = 10
|
TabIndex = 13
|
||||||
|
Top = 1080
|
||||||
|
Width = 2535
|
||||||
|
Begin VB.CheckBox chkPassToEntryPoint
|
||||||
|
Caption = "Pass To Entry Point"
|
||||||
|
Height = 255
|
||||||
|
Left = 360
|
||||||
|
TabIndex = 16
|
||||||
|
Top = 3960
|
||||||
|
Width = 1815
|
||||||
|
End
|
||||||
|
End
|
||||||
|
Begin VB.Frame Frame2
|
||||||
|
Caption = "Entry Point"
|
||||||
|
Height = 855
|
||||||
|
Left = 120
|
||||||
|
TabIndex = 15
|
||||||
Top = 120
|
Top = 120
|
||||||
Width = 1455
|
Width = 2535
|
||||||
End
|
End
|
||||||
Begin VB.Label Label4
|
Begin VB.Label Label4
|
||||||
Caption = "Console Out"
|
Caption = "Console Out"
|
||||||
Height = 255
|
Height = 255
|
||||||
Left = 5280
|
Left = 7920
|
||||||
TabIndex = 8
|
TabIndex = 8
|
||||||
Top = 3720
|
Top = 4080
|
||||||
Width = 3735
|
Width = 3735
|
||||||
End
|
End
|
||||||
Begin VB.Label Label3
|
Begin VB.Label Label3
|
||||||
Caption = "Console In"
|
Caption = "Console In"
|
||||||
Height = 255
|
Height = 255
|
||||||
Left = 120
|
Left = 2760
|
||||||
TabIndex = 7
|
TabIndex = 7
|
||||||
Top = 3720
|
Top = 4080
|
||||||
Width = 3735
|
Width = 3735
|
||||||
End
|
End
|
||||||
Begin VB.Label Label2
|
Begin VB.Label Label2
|
||||||
Caption = "Source Out"
|
Caption = "Source Out"
|
||||||
Height = 255
|
Height = 255
|
||||||
Left = 5280
|
Left = 7920
|
||||||
TabIndex = 6
|
TabIndex = 6
|
||||||
Top = 600
|
Top = 120
|
||||||
Width = 3735
|
Width = 3735
|
||||||
End
|
End
|
||||||
Begin VB.Label Label1
|
Begin VB.Label Label1
|
||||||
Caption = "Source In"
|
Caption = "Source In"
|
||||||
Height = 255
|
Height = 255
|
||||||
Left = 120
|
Left = 2760
|
||||||
TabIndex = 4
|
TabIndex = 4
|
||||||
Top = 600
|
Top = 120
|
||||||
Width = 2415
|
Width = 2415
|
||||||
End
|
End
|
||||||
End
|
End
|
||||||
@ -146,11 +193,27 @@ Attribute VB_Creatable = False
|
|||||||
Attribute VB_PredeclaredId = True
|
Attribute VB_PredeclaredId = True
|
||||||
Attribute VB_Exposed = False
|
Attribute VB_Exposed = False
|
||||||
Option Explicit
|
Option Explicit
|
||||||
|
Option Base 0
|
||||||
Dim source_first As Boolean
|
Dim source_first As Boolean
|
||||||
Public WithEvents Awk As ASELib.Awk
|
Public WithEvents Awk As ASELib.Awk
|
||||||
Attribute Awk.VB_VarHelpID = -1
|
Attribute Awk.VB_VarHelpID = -1
|
||||||
|
|
||||||
Private Sub Execute_Click()
|
Private Sub btnAddArgument_Click()
|
||||||
|
Dim arg As String
|
||||||
|
|
||||||
|
arg = txtArgument.Text
|
||||||
|
If Len(arg) > 0 Then
|
||||||
|
lstArguments.AddItem (arg)
|
||||||
|
txtArgument.Text = ""
|
||||||
|
txtArgument.SetFocus
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub btnClearAll_Click()
|
||||||
|
lstArguments.Clear
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub btnExecute_Click()
|
||||||
|
|
||||||
source_first = True
|
source_first = True
|
||||||
|
|
||||||
@ -191,8 +254,26 @@ Private Sub Execute_Click()
|
|||||||
If Not Awk.Parse() Then
|
If Not Awk.Parse() Then
|
||||||
MsgBox "PARSE ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
MsgBox "PARSE ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
||||||
Else
|
Else
|
||||||
|
Dim n As Boolean
|
||||||
|
|
||||||
Awk.EntryPoint = Trim(EntryPoint.Text)
|
Awk.EntryPoint = Trim(EntryPoint.Text)
|
||||||
If Not Awk.Run() Then
|
|
||||||
|
If lstArguments.ListCount = 0 Then
|
||||||
|
n = Awk.Run(Null)
|
||||||
|
Else
|
||||||
|
ReDim Args(lstArguments.ListCount - 1) As String
|
||||||
|
Dim i As Integer
|
||||||
|
|
||||||
|
Awk.ArgumentsToEntryPoint = chkPassToEntryPoint.value
|
||||||
|
|
||||||
|
For i = 0 To lstArguments.ListCount - 1
|
||||||
|
Args(i) = lstArguments.List(i)
|
||||||
|
Next i
|
||||||
|
|
||||||
|
n = Awk.Run(Args)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not n Then
|
||||||
MsgBox "RUN ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
MsgBox "RUN ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@ -409,42 +490,42 @@ ErrorTrap:
|
|||||||
Exit Function
|
Exit Function
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Function Awk_HandleBuiltinFunction(ByVal name As String, ByVal args As Variant) As Variant
|
Function Awk_HandleBuiltinFunction(ByVal name As String, ByVal Args As Variant) As Variant
|
||||||
|
|
||||||
If name = "sin" Then
|
If name = "sin" Then
|
||||||
If IsNull(args(0)) Then
|
If IsNull(Args(0)) Then
|
||||||
Awk_HandleBuiltinFunction = Sin(0)
|
Awk_HandleBuiltinFunction = Sin(0)
|
||||||
ElseIf IsNumeric(args(0)) Then
|
ElseIf IsNumeric(Args(0)) Then
|
||||||
Awk_HandleBuiltinFunction = Sin(args(0))
|
Awk_HandleBuiltinFunction = Sin(Args(0))
|
||||||
Else
|
Else
|
||||||
Awk_HandleBuiltinFunction = Sin(Val(args(0)))
|
Awk_HandleBuiltinFunction = Sin(Val(Args(0)))
|
||||||
End If
|
End If
|
||||||
ElseIf name = "cos" Then
|
ElseIf name = "cos" Then
|
||||||
If TypeName(args(0)) = "Long" Or TypeName(args(0)) = "Double" Then
|
If TypeName(Args(0)) = "Long" Or TypeName(Args(0)) = "Double" Then
|
||||||
Awk_HandleBuiltinFunction = Cos(args(0))
|
Awk_HandleBuiltinFunction = Cos(Args(0))
|
||||||
ElseIf TypeName(args(0)) = "String" Then
|
ElseIf TypeName(Args(0)) = "String" Then
|
||||||
Awk_HandleBuiltinFunction = Cos(Val(args(0)))
|
Awk_HandleBuiltinFunction = Cos(Val(Args(0)))
|
||||||
ElseIf TypeName(args(0)) = "Null" Then
|
ElseIf TypeName(Args(0)) = "Null" Then
|
||||||
Awk_HandleBuiltinFunction = Cos(0)
|
Awk_HandleBuiltinFunction = Cos(0)
|
||||||
End If
|
End If
|
||||||
ElseIf name = "tan" Then
|
ElseIf name = "tan" Then
|
||||||
If TypeName(args(0)) = "Long" Or TypeName(args(0)) = "Double" Then
|
If TypeName(Args(0)) = "Long" Or TypeName(Args(0)) = "Double" Then
|
||||||
Awk_HandleBuiltinFunction = Tan(args(0))
|
Awk_HandleBuiltinFunction = Tan(Args(0))
|
||||||
ElseIf TypeName(args(0)) = "String" Then
|
ElseIf TypeName(Args(0)) = "String" Then
|
||||||
Awk_HandleBuiltinFunction = Tan(Val(args(0)))
|
Awk_HandleBuiltinFunction = Tan(Val(Args(0)))
|
||||||
ElseIf TypeName(args(0)) = "Null" Then
|
ElseIf TypeName(Args(0)) = "Null" Then
|
||||||
Awk_HandleBuiltinFunction = Tan(0)
|
Awk_HandleBuiltinFunction = Tan(0)
|
||||||
End If
|
End If
|
||||||
ElseIf name = "sqrt" Then
|
ElseIf name = "sqrt" Then
|
||||||
If IsNull(args(0)) Then
|
If IsNull(Args(0)) Then
|
||||||
Awk_HandleBuiltinFunction = Sqr(0)
|
Awk_HandleBuiltinFunction = Sqr(0)
|
||||||
ElseIf IsNumeric(args(0)) Then
|
ElseIf IsNumeric(Args(0)) Then
|
||||||
Awk_HandleBuiltinFunction = Sqr(args(0))
|
Awk_HandleBuiltinFunction = Sqr(Args(0))
|
||||||
Else
|
Else
|
||||||
Awk_HandleBuiltinFunction = Sqr(Val(args(0)))
|
Awk_HandleBuiltinFunction = Sqr(Val(Args(0)))
|
||||||
End If
|
End If
|
||||||
ElseIf name = "trim" Then
|
ElseIf name = "trim" Then
|
||||||
Awk_HandleBuiltinFunction = Trim(args(0))
|
Awk_HandleBuiltinFunction = Trim(Args(0))
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Dim i As Integer
|
'Dim i As Integer
|
||||||
@ -459,6 +540,7 @@ Function Awk_HandleBuiltinFunction(ByVal name As String, ByVal args As Variant)
|
|||||||
'MsgBox xxx
|
'MsgBox xxx
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Private Sub Form_Load()
|
Private Sub Form_Load()
|
||||||
SourceIn.Text = ""
|
SourceIn.Text = ""
|
||||||
SourceOut.Text = ""
|
SourceOut.Text = ""
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
AwkForm = 13, 12, 735, 661, C, 22, 22, 753, 640, C
|
AwkForm = 13, 12, 735, 661, , 22, 22, 753, 640, C
|
||||||
AwkExtioConsole = 0, 0, 547, 460, C
|
AwkExtioConsole = 0, 0, 547, 460, C
|
||||||
|
Loading…
Reference in New Issue
Block a user