*** empty log message ***
This commit is contained in:
parent
108ec7863b
commit
80626d9d9a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: map.c,v 1.32 2006-11-29 02:54:15 bacon Exp $
|
||||
* $Id: map.c,v 1.33 2006-12-11 08:44:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -79,6 +79,11 @@ void ase_awk_map_clear (ase_awk_map_t* map)
|
||||
"the map should not contain any pairs of a key and a value after it has been cleared");
|
||||
}
|
||||
|
||||
ase_size_t ase_awk_map_getsize (ase_awk_map_t* map)
|
||||
{
|
||||
return map->size;
|
||||
}
|
||||
|
||||
ase_awk_pair_t* ase_awk_map_get (
|
||||
ase_awk_map_t* map, const ase_char_t* key, ase_size_t key_len)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: map.h,v 1.17 2006-10-24 04:10:12 bacon Exp $
|
||||
* $Id: map.h,v 1.18 2006-12-11 08:44:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_MAP_H_
|
||||
@ -43,6 +43,8 @@ void ase_awk_map_close (ase_awk_map_t* map);
|
||||
|
||||
void ase_awk_map_clear (ase_awk_map_t* map);
|
||||
|
||||
ase_size_t ase_awk_map_getsize (ase_awk_map_t* map);
|
||||
|
||||
ase_awk_pair_t* ase_awk_map_get (
|
||||
ase_awk_map_t* map, const ase_char_t* key, ase_size_t key_len);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parse.c,v 1.219 2006-12-09 11:51:01 bacon Exp $
|
||||
* $Id: parse.c,v 1.220 2006-12-11 08:44:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -360,6 +360,7 @@ int ase_awk_parse (ase_awk_t* awk, ase_awk_srcios_t* srcios)
|
||||
ASE_AWK_ASSERT (awk, awk->parse.depth.cur.loop == 0);
|
||||
ASE_AWK_ASSERT (awk, awk->parse.depth.cur.expr == 0);
|
||||
|
||||
if (n == -1) ase_awk_clear (awk);
|
||||
return n;
|
||||
}
|
||||
|
||||
@ -4408,37 +4409,37 @@ static int __deparse (ase_awk_t* awk)
|
||||
|
||||
for (i = awk->tree.nbglobals; i < awk->tree.nglobals - 1; i++)
|
||||
{
|
||||
/*
|
||||
len = ase_awk_longtostr ((ase_long_t)i,
|
||||
10, ASE_T("__global"), tmp, ASE_COUNTOF(tmp));
|
||||
ASE_AWK_ASSERT (awk, len != (ase_size_t)-1);
|
||||
if (ase_awk_putsrcstrx (awk, tmp, len) == -1)
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
/*
|
||||
*/
|
||||
if (ase_awk_putsrcstrx (awk,
|
||||
awk->parse.globals.buf[i].name,
|
||||
awk->parse.globals.buf[i].name_len) == -1)
|
||||
{
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
}
|
||||
*/
|
||||
|
||||
if (ase_awk_putsrcstr (awk, ASE_T(", ")) == -1)
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
}
|
||||
|
||||
/*
|
||||
len = ase_awk_longtostr ((ase_long_t)i,
|
||||
10, ASE_T("__global"), tmp, ASE_COUNTOF(tmp));
|
||||
ASE_AWK_ASSERT (awk, len != (ase_size_t)-1);
|
||||
if (ase_awk_putsrcstrx (awk, tmp, len) == -1)
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
/*
|
||||
*/
|
||||
if (ase_awk_putsrcstrx (awk,
|
||||
awk->parse.globals.buf[i].name,
|
||||
awk->parse.globals.buf[i].name_len) == -1)
|
||||
{
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
}
|
||||
*/
|
||||
|
||||
if (ase_awk_putsrcstr (awk, ASE_T(";\n\n")) == -1)
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: run.c,v 1.295 2006-12-09 17:36:27 bacon Exp $
|
||||
* $Id: run.c,v 1.296 2006-12-11 08:44:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -562,6 +562,16 @@ int ase_awk_run (ase_awk_t* awk,
|
||||
|
||||
awk->errnum = ASE_AWK_ENOERR;
|
||||
|
||||
if (awk->tree.nglobals == 0 &&
|
||||
awk->tree.begin == ASE_NULL &&
|
||||
awk->tree.end == ASE_NULL &&
|
||||
awk->tree.chain_size == 0 &&
|
||||
ase_awk_map_getsize(&awk->tree.afns) == 0)
|
||||
{
|
||||
/* no code to execute */
|
||||
return 0;
|
||||
}
|
||||
|
||||
run = (ase_awk_run_t*) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_run_t));
|
||||
if (run == ASE_NULL)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tree.c,v 1.94 2006-12-04 11:25:21 bacon Exp $
|
||||
* $Id: tree.c,v 1.95 2006-12-11 08:44:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -380,12 +380,14 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
|
||||
if (px->id.idxa != (ase_size_t)-1)
|
||||
{
|
||||
/*
|
||||
PUT_SRCSTR (awk, ASE_T("__global"));
|
||||
n = ase_awk_longtostr (
|
||||
px->id.idxa, 10,
|
||||
ASE_NULL, tmp, ASE_COUNTOF(tmp));
|
||||
PUT_SRCSTRX (awk, tmp, n);
|
||||
/*PUT_SRCSTRX (awk, px->id.name, px->id.name_len);*/
|
||||
*/
|
||||
PUT_SRCSTRX (awk, px->id.name, px->id.name_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -403,12 +405,14 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
|
||||
if (px->id.idxa != (ase_size_t)-1)
|
||||
{
|
||||
/*
|
||||
PUT_SRCSTR (awk, ASE_T("__global"));
|
||||
n = ase_awk_longtostr (
|
||||
px->id.idxa, 10,
|
||||
ASE_NULL, tmp, ASE_COUNTOF(tmp));
|
||||
PUT_SRCSTRX (awk, tmp, n);
|
||||
/*PUT_SRCSTRX (awk, px->id.name, px->id.name_len);*/
|
||||
*/
|
||||
PUT_SRCSTRX (awk, px->id.name, px->id.name_len);
|
||||
PUT_SRCSTR (awk, ASE_T("["));
|
||||
}
|
||||
else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.5 2006-12-11 06:29:18 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.6 2006-12-11 08:44:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -306,11 +306,11 @@ HRESULT CAwk::Parse (int* ret)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int opt = /*ASE_AWK_IMPLICIT |
|
||||
int opt = ASE_AWK_IMPLICIT |
|
||||
ASE_AWK_EXPLICIT |
|
||||
ASE_AWK_UNIQUEAFN |
|
||||
ASE_AWK_HASHSIGN |
|
||||
ASE_AWK_IDIV |
|
||||
/*ASE_AWK_IDIV |
|
||||
ASE_AWK_SHADING |
|
||||
ASE_AWK_SHIFT | */
|
||||
ASE_AWK_EXTIO /*|
|
||||
@ -423,7 +423,7 @@ static ase_ssize_t __process_extio (
|
||||
CBuffer* tmp = (CBuffer*)extio2->read_buf;
|
||||
if (extio2->read_buf_pos >= extio2->read_buf_len)
|
||||
{
|
||||
INT n = awk->Fire_ReadSource (extio2->read_buf);
|
||||
INT n = awk->Fire_ReadExtio (extio, extio2->read_buf);
|
||||
if (n <= 0) return (ase_ssize_t)n;
|
||||
|
||||
if (SysStringLen(tmp->str) < (UINT)n) return -1;
|
||||
|
@ -1,11 +1,12 @@
|
||||
/*
|
||||
* $Id: AwkExtio.h,v 1.5 2006-12-11 06:29:19 bacon Exp $
|
||||
* $Id: AwkExtio.h,v 1.6 2006-12-11 08:44:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_COM_AWKEXTIO_H_
|
||||
#define _ASE_COM_AWKEXTIO_H_
|
||||
|
||||
#include "resource.h"
|
||||
#include <ase/awk/awk.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAwkExtio
|
||||
|
@ -1,14 +1,13 @@
|
||||
/*
|
||||
* $Id: awk_cp.h,v 1.3 2006-12-09 17:36:27 bacon Exp $
|
||||
* $Id: awk_cp.h,v 1.4 2006-12-11 08:44:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _AWK_CP_H_
|
||||
#define _AWK_CP_H_
|
||||
|
||||
/*#import "C:\projects\ase\debug\win32\vs60\aseawk.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids*/
|
||||
|
||||
template <class T>
|
||||
class CProxyIAwkEvents : public IConnectionPointImpl<T, &DIID_IAwkEvents, CComDynamicUnkArray>
|
||||
class CProxyIAwkEvents:
|
||||
public IConnectionPointImpl<T, &DIID_IAwkEvents, CComDynamicUnkArray>
|
||||
{
|
||||
public:
|
||||
INT Fire_OpenSource(INT mode)
|
||||
@ -306,6 +305,58 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
INT Fire_ReadExtio (IAwkExtio* extio, IBuffer* buf)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int i, nconns = m_vec.GetSize();
|
||||
CComVariant args[2], 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]);
|
||||
VariantClear (&args[1]);
|
||||
|
||||
args[1] = (IUnknown*)extio;
|
||||
args[0] = (IUnknown*)buf;
|
||||
|
||||
DISPPARAMS disp = { args, NULL, 2, 0 };
|
||||
HRESULT hr = pDispatch->Invoke (
|
||||
0x7, 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_WriteExtio (IAwkExtio* extio, IBuffer* buf)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
|
@ -1,13 +1,13 @@
|
||||
VERSION 5.00
|
||||
Begin VB.Form AwkForm
|
||||
Caption = "ASE COM AWK"
|
||||
ClientHeight = 7695
|
||||
ClientHeight = 7770
|
||||
ClientLeft = 60
|
||||
ClientTop = 345
|
||||
ClientWidth = 9435
|
||||
ClientWidth = 10335
|
||||
LinkTopic = "AwkForm"
|
||||
ScaleHeight = 7695
|
||||
ScaleWidth = 9435
|
||||
ScaleHeight = 7770
|
||||
ScaleWidth = 10335
|
||||
StartUpPosition = 3 'Windows Default
|
||||
Begin VB.TextBox ConsoleIn
|
||||
BeginProperty Font
|
||||
@ -20,11 +20,11 @@ Begin VB.Form AwkForm
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 2895
|
||||
Left = 360
|
||||
Left = 120
|
||||
MultiLine = -1 'True
|
||||
TabIndex = 4
|
||||
Top = 3600
|
||||
Width = 4095
|
||||
Width = 5055
|
||||
End
|
||||
Begin VB.TextBox SourceIn
|
||||
BeginProperty Font
|
||||
@ -37,11 +37,11 @@ Begin VB.Form AwkForm
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 2775
|
||||
Left = 480
|
||||
Left = 120
|
||||
MultiLine = -1 'True
|
||||
TabIndex = 3
|
||||
Top = 480
|
||||
Width = 3975
|
||||
Width = 5055
|
||||
End
|
||||
Begin VB.TextBox SourceOut
|
||||
BeginProperty Font
|
||||
@ -54,11 +54,11 @@ Begin VB.Form AwkForm
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 2775
|
||||
Left = 4680
|
||||
Left = 5280
|
||||
MultiLine = -1 'True
|
||||
TabIndex = 2
|
||||
Top = 480
|
||||
Width = 4095
|
||||
Width = 4935
|
||||
End
|
||||
Begin VB.CommandButton Execute
|
||||
Caption = "Execute"
|
||||
@ -79,11 +79,11 @@ Begin VB.Form AwkForm
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 2895
|
||||
Left = 4680
|
||||
Left = 5280
|
||||
MultiLine = -1 'True
|
||||
TabIndex = 0
|
||||
Top = 3600
|
||||
Width = 4095
|
||||
Width = 4935
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "AwkForm"
|
||||
@ -109,8 +109,12 @@ Private Sub Execute_Click()
|
||||
SourceOut.Text = ""
|
||||
|
||||
Set abc = New ASELib.Awk
|
||||
Call abc.Parse
|
||||
Call abc.Run
|
||||
If abc.Parse() = -1 Then
|
||||
MsgBox "PARSE ERROR OCCURRED!!!"
|
||||
End If
|
||||
If abc.Run() = -1 Then
|
||||
MsgBox "RUN ERROR OCCURRED!!!"
|
||||
End If
|
||||
Set abc = Nothing
|
||||
End Sub
|
||||
|
||||
@ -159,8 +163,16 @@ End Function
|
||||
|
||||
Function abc_OpenExtio(ByVal extio As ASELib.AwkExtio) As Long
|
||||
MsgBox "abc_OpenExtio"
|
||||
If extio.mode = 0 Then
|
||||
extio_first = True
|
||||
abc_OpenExtio = 1
|
||||
Exit Function
|
||||
ElseIf extio.mode = 1 Then
|
||||
abc_OpenExtio = 1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
abc_OpenExtio = -1
|
||||
End Function
|
||||
|
||||
Function abc_CloseExtio(ByVal extio As ASELib.AwkExtio) As Long
|
||||
@ -169,13 +181,33 @@ MsgBox "abc_CloseExtio"
|
||||
End Function
|
||||
|
||||
Function abc_ReadExtio(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buffer) As Long
|
||||
Dim value As String
|
||||
Dim value As String, value2 As String
|
||||
Dim l As Integer, i As Integer
|
||||
|
||||
If extio.mode <> 0 Then
|
||||
abc_ReadExtio = -1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If extio_first Then
|
||||
value = ConsoleIn.Text
|
||||
l = Len(value)
|
||||
|
||||
For i = 1 To l - 1
|
||||
If Mid(value, i, 2) = vbCrLf Then
|
||||
value2 = value2 + vbLf
|
||||
i = i + 1
|
||||
Else
|
||||
value2 = value2 + Mid(value, i, 1)
|
||||
End If
|
||||
Next
|
||||
If i = l Then
|
||||
value2 = value2 + Mid(value, i, 1)
|
||||
End If
|
||||
|
||||
extio_first = False
|
||||
buf.value = value
|
||||
abc_ReadExtio = Len(value)
|
||||
buf.value = value2
|
||||
abc_ReadExtio = Len(value2)
|
||||
Else
|
||||
abc_ReadExtio = 0
|
||||
End If
|
||||
@ -184,6 +216,11 @@ End Function
|
||||
Function abc_WriteExtio(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buffer) As Long
|
||||
Dim value As String, i As Long, value2 As String
|
||||
|
||||
If extio.mode <> 1 Then
|
||||
abc_WriteExtio = -1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
value = buf.value
|
||||
|
||||
'For i = 0 To 5000000
|
||||
|
Loading…
x
Reference in New Issue
Block a user