*** empty log message ***
This commit is contained in:
parent
8226e674d7
commit
b50cd52bbc
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h,v 1.164 2006-12-13 14:13:07 bacon Exp $
|
||||
* $Id: awk.h,v 1.165 2006-12-14 07:55:51 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_AWK_H_
|
||||
@ -21,7 +21,7 @@ typedef struct ase_awk_runarg_t ase_awk_runarg_t;
|
||||
|
||||
typedef void* (*ase_awk_malloc_t) (ase_size_t n, void* custom_data);
|
||||
typedef void* (*ase_awk_realloc_t) (void* ptr, ase_size_t n, void* custom_data);
|
||||
typedef void* (*ase_awk_free_t) (void* ptr, void* custom_data);
|
||||
typedef void (*ase_awk_free_t) (void* ptr, void* custom_data);
|
||||
typedef void* (*ase_awk_memcpy_t) (void* dst, const void* src, ase_size_t n);
|
||||
typedef void* (*ase_awk_memset_t) (void* dst, int val, ase_size_t n);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.7 2006-12-11 14:58:25 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.8 2006-12-14 07:55:51 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -284,36 +284,36 @@ HRESULT CAwk::Parse (int* ret)
|
||||
{
|
||||
if (handle == NULL)
|
||||
{
|
||||
ase_awk_syscas_t syscas;
|
||||
ase_awk_sysfns_t sysfns;
|
||||
|
||||
memset (&syscas, 0, sizeof(syscas));
|
||||
syscas.malloc = __awk_malloc;
|
||||
syscas.realloc = __awk_realloc;
|
||||
syscas.free = __awk_free;
|
||||
memset (&sysfns, 0, sizeof(sysfns));
|
||||
sysfns.malloc = __awk_malloc;
|
||||
sysfns.realloc = __awk_realloc;
|
||||
sysfns.free = __awk_free;
|
||||
|
||||
syscas.is_upper = iswupper;
|
||||
syscas.is_lower = iswlower;
|
||||
syscas.is_alpha = iswalpha;
|
||||
syscas.is_digit = iswdigit;
|
||||
syscas.is_xdigit = iswxdigit;
|
||||
syscas.is_alnum = iswalnum;
|
||||
syscas.is_space = iswspace;
|
||||
syscas.is_print = iswprint;
|
||||
syscas.is_graph = iswgraph;
|
||||
syscas.is_cntrl = iswcntrl;
|
||||
syscas.is_punct = iswpunct;
|
||||
syscas.to_upper = towupper;
|
||||
syscas.to_lower = towlower;
|
||||
sysfns.is_upper = iswupper;
|
||||
sysfns.is_lower = iswlower;
|
||||
sysfns.is_alpha = iswalpha;
|
||||
sysfns.is_digit = iswdigit;
|
||||
sysfns.is_xdigit = iswxdigit;
|
||||
sysfns.is_alnum = iswalnum;
|
||||
sysfns.is_space = iswspace;
|
||||
sysfns.is_print = iswprint;
|
||||
sysfns.is_graph = iswgraph;
|
||||
sysfns.is_cntrl = iswcntrl;
|
||||
sysfns.is_punct = iswpunct;
|
||||
sysfns.to_upper = towupper;
|
||||
sysfns.to_lower = towlower;
|
||||
|
||||
syscas.memcpy = memcpy;
|
||||
syscas.memset = memset;
|
||||
syscas.pow = __awk_pow;
|
||||
syscas.sprintf = __awk_sprintf;
|
||||
syscas.aprintf = __awk_aprintf;
|
||||
syscas.dprintf = __awk_dprintf;
|
||||
syscas.abort = abort;
|
||||
sysfns.memcpy = memcpy;
|
||||
sysfns.memset = memset;
|
||||
sysfns.pow = __awk_pow;
|
||||
sysfns.sprintf = __awk_sprintf;
|
||||
sysfns.aprintf = __awk_aprintf;
|
||||
sysfns.dprintf = __awk_dprintf;
|
||||
sysfns.abort = abort;
|
||||
|
||||
handle = ase_awk_open (&syscas);
|
||||
handle = ase_awk_open (&sysfns);
|
||||
if (handle == NULL)
|
||||
{
|
||||
*ret = -1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: AwkExtio.cpp,v 1.5 2006-12-12 05:54:33 bacon Exp $
|
||||
* $Id: AwkExtio.cpp,v 1.6 2006-12-14 07:55:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -10,22 +10,22 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAwkExtio
|
||||
|
||||
CAwkExtio::CAwkExtio (): name (NULL)
|
||||
CAwkExtio::CAwkExtio (): name (NULL)/*, handle (NULL)*/
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
//#ifdef _DEBUG
|
||||
TCHAR x[128];
|
||||
_sntprintf (x, 128, _T("CAwkExtio::CAwkExtio %p"), this);
|
||||
MessageBox (NULL, x, x, MB_OK);
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
CAwkExtio::~CAwkExtio ()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
//#ifdef _DEBUG
|
||||
TCHAR x[128];
|
||||
_sntprintf (x, 128, _T("CAwkExtio::~CAwkExtio %p"), this);
|
||||
MessageBox (NULL, x, x, MB_OK);
|
||||
#endif
|
||||
//#endif
|
||||
if (name != NULL) SysFreeString (name);
|
||||
}
|
||||
|
||||
|
46
ase/test/com/AwkExtioConsole.cls
Normal file
46
ase/test/com/AwkExtioConsole.cls
Normal file
@ -0,0 +1,46 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
Persistable = 0 'NotPersistable
|
||||
DataBindingBehavior = 0 'vbNone
|
||||
DataSourceBehavior = 0 'vbNone
|
||||
MTSTransactionMode = 0 'NotAnMTSObject
|
||||
END
|
||||
Attribute VB_Name = "AwkExtioConsole"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = True
|
||||
Attribute VB_PredeclaredId = False
|
||||
Attribute VB_Exposed = False
|
||||
Private m_active As Boolean
|
||||
Private m_count As Long
|
||||
|
||||
Public Enum Status
|
||||
STATUS_ON = 1
|
||||
STATUS_OFF = 2
|
||||
End Enum
|
||||
|
||||
Private Sub Class_Initialize()
|
||||
m_active = False
|
||||
m_count = 0
|
||||
MsgBox "AwkExtio Initializeing"
|
||||
End Sub
|
||||
|
||||
Private Sub Class_Terminate()
|
||||
MsgBox "AwkExtio Terminating..."
|
||||
End Sub
|
||||
|
||||
Public Property Let Active(v As Boolean)
|
||||
m_active = v
|
||||
End Property
|
||||
|
||||
Public Property Get Active() As Boolean
|
||||
Active = m_active
|
||||
End Property
|
||||
|
||||
Public Property Let Count(v As Long)
|
||||
m_count = v
|
||||
End Property
|
||||
|
||||
Public Property Get Count() As Long
|
||||
Count = m_count
|
||||
End Property
|
@ -92,15 +92,13 @@ Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Option Explicit
|
||||
|
||||
Dim source_first As Boolean
|
||||
Public WithEvents Awk As ASELib.Awk
|
||||
Attribute Awk.VB_VarHelpID = -1
|
||||
Private first As Boolean
|
||||
|
||||
Private extio_first As Boolean
|
||||
|
||||
Private Sub Execute_Click()
|
||||
first = True
|
||||
|
||||
source_first = True
|
||||
|
||||
ConsoleOut.Text = ""
|
||||
SourceOut.Text = ""
|
||||
@ -127,10 +125,10 @@ Function Awk_CloseSource(ByVal mode As Long) As Long
|
||||
End Function
|
||||
|
||||
Function Awk_ReadSource(ByVal buf As ASELib.Buffer) As Long
|
||||
If first Then
|
||||
If source_first Then
|
||||
buf.value = SourceIn.Text
|
||||
Awk_ReadSource = Len(buf.value)
|
||||
first = False
|
||||
source_first = False
|
||||
Else
|
||||
Awk_ReadSource = 0
|
||||
End If
|
||||
@ -162,22 +160,23 @@ Function Awk_WriteSource(ByVal buf As ASELib.Buffer) As Long
|
||||
End Function
|
||||
|
||||
Function Awk_OpenExtio(ByVal extio As ASELib.AwkExtio) As Long
|
||||
|
||||
Dim console As AwkExtioConsole
|
||||
Awk_OpenExtio = -1
|
||||
|
||||
Select Case extio.Type
|
||||
Case ASELib.AWK_EXTIO_CONSOLE
|
||||
If extio.mode = ASELib.AWK_EXTIO_CONSOLE_READ Then
|
||||
extio_first = True
|
||||
extio.Handle = 1234
|
||||
extio.Handle = New AwkExtioConsole
|
||||
With extio.Handle
|
||||
.Active = True
|
||||
.Count = 0
|
||||
End With
|
||||
Awk_OpenExtio = 1
|
||||
ElseIf extio.mode = ASELib.AWK_EXTIO_CONSOLE_WRITE Then
|
||||
extio_first = True
|
||||
Set console = New AwkExtioConsole
|
||||
console.Active = True
|
||||
console.Count = 0
|
||||
Set extio.Handle = console
|
||||
extio.Handle = New AwkExtioConsole
|
||||
With extio.Handle
|
||||
.Active = True
|
||||
.Count = 0
|
||||
End With
|
||||
Awk_OpenExtio = 1
|
||||
End If
|
||||
Case ASELib.AWK_EXTIO_FILE
|
||||
@ -188,14 +187,15 @@ Function Awk_OpenExtio(ByVal extio As ASELib.AwkExtio) As Long
|
||||
End Function
|
||||
|
||||
Function Awk_CloseExtio(ByVal extio As ASELib.AwkExtio) As Long
|
||||
|
||||
Awk_CloseExtio = -1
|
||||
|
||||
Select Case extio.Type
|
||||
Case ASELib.AWK_EXTIO_CONSOLE
|
||||
If extio.mode = ASELib.AWK_EXTIO_CONSOLE_READ Then
|
||||
extio.Handle = Nothing
|
||||
Awk_CloseExtio = 0
|
||||
ElseIf extio.mode = ASELib.AWK_EXTIO_CONSOLE_WRITE Then
|
||||
extio.Handle = Nothing
|
||||
Awk_CloseExtio = 0
|
||||
End If
|
||||
Case ASELib.AWK_EXTIO_FILE
|
||||
@ -206,17 +206,24 @@ Function Awk_CloseExtio(ByVal extio As ASELib.AwkExtio) As Long
|
||||
End Function
|
||||
|
||||
Function Awk_ReadExtio(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buffer) As Long
|
||||
Dim console As AwkExtioConsole
|
||||
Awk_ReadExtio = -1
|
||||
|
||||
Select Case extio.Type
|
||||
Case ASELib.AWK_EXTIO_CONSOLE
|
||||
If extio.mode = ASELib.AWK_EXTIO_CONSOLE_READ Then
|
||||
Awk_ReadExtio = Awk_ReadExtioConsole(extio, buf)
|
||||
End If
|
||||
Case ASELib.AWK_EXTIO_FILE
|
||||
Case ASELib.AWK_EXTIO_PIPE
|
||||
Case ASELib.AWK_EXTIO_COPROC
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Function Awk_ReadExtioConsole(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buffer) As Long
|
||||
Dim value As String, value2 As String
|
||||
Dim l As Integer, i As Integer
|
||||
|
||||
If extio.mode <> 0 Then
|
||||
Awk_ReadExtio = -1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Set console = extio.Handle
|
||||
If console.Count = 0 Then
|
||||
|
||||
If extio.Handle.Count = 0 Then
|
||||
value = ConsoleIn.Text
|
||||
l = Len(value)
|
||||
|
||||
@ -232,21 +239,30 @@ Function Awk_ReadExtio(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buffe
|
||||
value2 = value2 + Mid(value, i, 1)
|
||||
End If
|
||||
|
||||
console.Count = console.Count + 1
|
||||
extio.Handle.Count = extio.Handle.Count + 1
|
||||
buf.value = value2
|
||||
Awk_ReadExtio = Len(value2)
|
||||
Awk_ReadExtioConsole = Len(value2)
|
||||
Else
|
||||
Awk_ReadExtio = 0
|
||||
Awk_ReadExtioConsole = 0
|
||||
End If
|
||||
End Function
|
||||
|
||||
Function Awk_WriteExtio(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buffer) As Long
|
||||
Dim value As String, i As Long, value2 As String
|
||||
Awk_WriteExtio = -1
|
||||
|
||||
If extio.mode <> 1 Then
|
||||
Awk_WriteExtio = -1
|
||||
Exit Function
|
||||
End If
|
||||
Select Case extio.Type
|
||||
Case ASELib.AWK_EXTIO_CONSOLE
|
||||
If extio.mode = ASELib.AWK_EXTIO_CONSOLE_WRITE Then
|
||||
Awk_WriteExtio = Awk_WriteExtioConsole(extio, buf)
|
||||
End If
|
||||
Case ASELib.AWK_EXTIO_FILE
|
||||
Case ASELib.AWK_EXTIO_PIPE
|
||||
Case ASELib.AWK_EXTIO_COPROC
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Function Awk_WriteExtioConsole(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buffer) As Long
|
||||
Dim value As String, i As Long, value2 As String
|
||||
|
||||
value = buf.value
|
||||
|
||||
@ -257,14 +273,15 @@ Function Awk_WriteExtio(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buff
|
||||
|
||||
If value = vbLf Then
|
||||
ConsoleOut.Text = ConsoleOut.Text + vbCrLf
|
||||
Awk_WriteExtio = 1
|
||||
Awk_WriteExtioConsole = 1
|
||||
Else
|
||||
ConsoleOut.Text = ConsoleOut.Text + value
|
||||
Awk_WriteExtio = Len(value)
|
||||
Awk_WriteExtioConsole = Len(value)
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Sub Form_Load()
|
||||
Dim x As Variant
|
||||
SourceIn.Text = "BEGIN { print 123.12; print 995; print 5432.1; }"
|
||||
SourceOut.Text = ""
|
||||
ConsoleIn.Text = ""
|
||||
|
@ -3,7 +3,11 @@ Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\WINDOWS\Sy
|
||||
Reference=*\G{F9C69806-16A1-4162-998A-876B33C470BF}#1.0#0#..\..\release\win32\vs60\ase.dll#ASE Awk 1.0 Type Library
|
||||
Form=AwkForm.frm
|
||||
Class=AwkExtioConsole; AwkExtioConsole.cls
|
||||
IconForm="AwkForm"
|
||||
Startup="AwkForm"
|
||||
HelpFile=""
|
||||
Title="ase"
|
||||
ExeName32="ase.exe"
|
||||
Command32=""
|
||||
Name="ASECOM"
|
||||
HelpContextID="0"
|
||||
|
@ -1,2 +1,2 @@
|
||||
AwkForm = 44, 44, 644, 582, , 22, 22, 738, 641, C
|
||||
AwkExtioConsole = 0, 0, 547, 460,
|
||||
AwkExtioConsole = 0, 0, 547, 460, C
|
||||
|
Loading…
Reference in New Issue
Block a user