*** empty log message ***
This commit is contained in:
parent
06a33d01bd
commit
b8729c918a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h,v 1.178 2007-01-03 04:16:14 bacon Exp $
|
||||
* $Id: awk.h,v 1.179 2007-01-03 09:51:50 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_AWK_H_
|
||||
@ -159,7 +159,7 @@ enum
|
||||
ASE_AWK_EXPLICIT = (1 << 1),
|
||||
|
||||
/* a function name should not coincide to be a variable name */
|
||||
ASE_AWK_UNIQUEAFN = (1 << 2),
|
||||
ASE_AWK_UNIQUEFN = (1 << 2),
|
||||
|
||||
/* allow variable shading */
|
||||
ASE_AWK_SHADING = (1 << 3),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: err.c,v 1.68 2007-01-02 12:25:18 bacon Exp $
|
||||
* $Id: err.c,v 1.69 2007-01-03 09:51:51 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -28,7 +28,13 @@ void ase_awk_geterror (
|
||||
{
|
||||
if (errnum != ASE_NULL) *errnum = awk->errnum;
|
||||
if (errlin != ASE_NULL) *errlin = awk->errlin;
|
||||
if (errmsg != ASE_NULL) *errmsg = awk->errmsg;
|
||||
if (errmsg != ASE_NULL)
|
||||
{
|
||||
if (awk->errmsg[0] == ASE_T('\0'))
|
||||
*errmsg = ase_awk_geterrstr (awk->errnum);
|
||||
else
|
||||
*errmsg = awk->errmsg;
|
||||
}
|
||||
}
|
||||
|
||||
void ase_awk_seterror (
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: jni.c,v 1.44 2007-01-02 12:25:18 bacon Exp $
|
||||
* $Id: jni.c,v 1.45 2007-01-03 09:51:51 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -235,7 +235,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_open (JNIEnv* env, jobject obj)
|
||||
|
||||
(*env)->SetLongField (env, obj, fid_handle, (jlong)awk);
|
||||
|
||||
opt = ASE_AWK_EXPLICIT | ASE_AWK_UNIQUEAFN | ASE_AWK_SHADING |
|
||||
opt = ASE_AWK_EXPLICIT | ASE_AWK_UNIQUEFN | ASE_AWK_SHADING |
|
||||
ASE_AWK_IMPLICIT | ASE_AWK_SHIFT | ASE_AWK_IDIV |
|
||||
ASE_AWK_EXTIO | ASE_AWK_BLOCKLESS | ASE_AWK_HASHSIGN |
|
||||
ASE_AWK_NEXTOFILE;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parse.c,v 1.235 2007-01-03 04:16:14 bacon Exp $
|
||||
* $Id: parse.c,v 1.236 2007-01-03 09:51:51 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -719,7 +719,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
if (awk->option & ASE_AWK_UNIQUEAFN)
|
||||
if (awk->option & ASE_AWK_UNIQUEFN)
|
||||
{
|
||||
/* check if it coincides to be a global variable name */
|
||||
ase_size_t g;
|
||||
@ -831,7 +831,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
||||
param = ASE_AWK_STR_BUF(&awk->token.name);
|
||||
param_len = ASE_AWK_STR_LEN(&awk->token.name);
|
||||
|
||||
if (awk->option & ASE_AWK_UNIQUEAFN)
|
||||
if (awk->option & ASE_AWK_UNIQUEFN)
|
||||
{
|
||||
/* check if a parameter conflicts with a function */
|
||||
if (ase_awk_strxncmp (name_dup, name_len, param, param_len) == 0 ||
|
||||
@ -1293,7 +1293,7 @@ static ase_awk_t* __add_global (
|
||||
{
|
||||
if (!force)
|
||||
{
|
||||
if (awk->option & ASE_AWK_UNIQUEAFN)
|
||||
if (awk->option & ASE_AWK_UNIQUEFN)
|
||||
{
|
||||
/* check if it conflict with a builtin function name */
|
||||
if (ase_awk_getbfn (awk, name, len) != ASE_NULL)
|
||||
@ -1441,7 +1441,7 @@ static ase_awk_t* __collect_locals (ase_awk_t* awk, ase_size_t nlocals)
|
||||
|
||||
/* NOTE: it is not checked againt globals names */
|
||||
|
||||
if (awk->option & ASE_AWK_UNIQUEAFN)
|
||||
if (awk->option & ASE_AWK_UNIQUEFN)
|
||||
{
|
||||
/* check if it conflict with a builtin function name */
|
||||
if (ase_awk_getbfn (awk, local, local_len) != ASE_NULL)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: run.c,v 1.318 2007-01-03 04:16:15 bacon Exp $
|
||||
* $Id: run.c,v 1.319 2007-01-03 09:51:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -598,7 +598,13 @@ void ase_awk_getrunerror (
|
||||
{
|
||||
if (errnum != ASE_NULL) *errnum = run->errnum;
|
||||
if (errlin != ASE_NULL) *errlin = run->errlin;
|
||||
if (errmsg != ASE_NULL) *errmsg = run->errmsg;
|
||||
if (errmsg != ASE_NULL)
|
||||
{
|
||||
if (run->errmsg[0] == ASE_T('\0'))
|
||||
*errmsg = ase_awk_geterrstr (run->errnum);
|
||||
else
|
||||
*errmsg = run->errmsg;
|
||||
}
|
||||
}
|
||||
|
||||
void ase_awk_setrunerror (
|
||||
|
167
ase/com/Awk.cpp
167
ase/com/Awk.cpp
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.9 2006-12-15 06:47:07 bacon Exp $
|
||||
* $Id: Awk.cpp,v 1.10 2007-01-03 09:51:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
@ -28,8 +28,13 @@ STDMETHODIMP CAwk::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
CAwk::CAwk (): handle(NULL),
|
||||
read_src_buf(NULL), write_src_buf(NULL),
|
||||
CAwk::CAwk ():
|
||||
handle(NULL),
|
||||
option(0),
|
||||
errnum(0),
|
||||
errlin(0),
|
||||
read_src_buf(NULL),
|
||||
write_src_buf(NULL),
|
||||
write_extio_buf(NULL)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@ -41,7 +46,7 @@ CAwk::CAwk (): handle(NULL),
|
||||
/* TODO: what is the best default option? */
|
||||
option = ASE_AWK_IMPLICIT |
|
||||
ASE_AWK_EXPLICIT |
|
||||
ASE_AWK_UNIQUEAFN |
|
||||
ASE_AWK_UNIQUEFN |
|
||||
ASE_AWK_HASHSIGN |
|
||||
ASE_AWK_IDIV |
|
||||
ASE_AWK_SHADING |
|
||||
@ -50,7 +55,10 @@ CAwk::CAwk (): handle(NULL),
|
||||
ASE_AWK_BLOCKLESS |
|
||||
ASE_AWK_STRINDEXONE |
|
||||
ASE_AWK_STRIPSPACES |
|
||||
ASE_AWK_NEXTOFILE;
|
||||
ASE_AWK_NEXTOFILE |
|
||||
ASE_AWK_CRLF;
|
||||
|
||||
errmsg[0] = _T('\0');
|
||||
}
|
||||
|
||||
CAwk::~CAwk ()
|
||||
@ -83,27 +91,32 @@ CAwk::~CAwk ()
|
||||
}
|
||||
}
|
||||
|
||||
static void* __awk_malloc (ase_size_t n, void* custom_data)
|
||||
static void* awk_malloc (ase_size_t n, void* custom_data)
|
||||
{
|
||||
return malloc (n);
|
||||
}
|
||||
|
||||
static void* __awk_realloc (void* ptr, ase_size_t n, void* custom_data)
|
||||
static void* awk_realloc (void* ptr, ase_size_t n, void* custom_data)
|
||||
{
|
||||
return realloc (ptr, n);
|
||||
}
|
||||
|
||||
static void __awk_free (void* ptr, void* custom_data)
|
||||
static void awk_free (void* ptr, void* custom_data)
|
||||
{
|
||||
free (ptr);
|
||||
}
|
||||
|
||||
static ase_real_t __awk_pow (ase_real_t x, ase_real_t y)
|
||||
static ase_real_t awk_pow (ase_real_t x, ase_real_t y)
|
||||
{
|
||||
return pow (x, y);
|
||||
}
|
||||
|
||||
static int __awk_sprintf (
|
||||
static void awk_abort (void* custom_data)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
|
||||
static int awk_sprintf (
|
||||
ase_char_t* buf, ase_size_t len, const ase_char_t* fmt, ...)
|
||||
{
|
||||
int n;
|
||||
@ -127,7 +140,7 @@ static int __awk_sprintf (
|
||||
return n;
|
||||
}
|
||||
|
||||
static void __awk_aprintf (const ase_char_t* fmt, ...)
|
||||
static void awk_aprintf (const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
#ifdef _WIN32
|
||||
@ -155,7 +168,7 @@ static void __awk_aprintf (const ase_char_t* fmt, ...)
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
static void __awk_dprintf (const ase_char_t* fmt, ...)
|
||||
static void awk_dprintf (const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
@ -287,9 +300,9 @@ HRESULT CAwk::Parse (int* ret)
|
||||
ase_awk_sysfns_t sysfns;
|
||||
|
||||
memset (&sysfns, 0, sizeof(sysfns));
|
||||
sysfns.malloc = __awk_malloc;
|
||||
sysfns.realloc = __awk_realloc;
|
||||
sysfns.free = __awk_free;
|
||||
sysfns.malloc = awk_malloc;
|
||||
sysfns.realloc = awk_realloc;
|
||||
sysfns.free = awk_free;
|
||||
|
||||
sysfns.is_upper = iswupper;
|
||||
sysfns.is_lower = iswlower;
|
||||
@ -307,15 +320,20 @@ HRESULT CAwk::Parse (int* ret)
|
||||
|
||||
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;
|
||||
sysfns.pow = awk_pow;
|
||||
sysfns.sprintf = awk_sprintf;
|
||||
sysfns.aprintf = awk_aprintf;
|
||||
sysfns.dprintf = awk_dprintf;
|
||||
sysfns.abort = awk_abort;
|
||||
|
||||
handle = ase_awk_open (&sysfns);
|
||||
handle = ase_awk_open (&sysfns, &errnum);
|
||||
if (handle == NULL)
|
||||
{
|
||||
errlin = 0;
|
||||
ase_awk_strxcpy (
|
||||
errmsg, ASE_COUNTOF(errmsg),
|
||||
ase_awk_geterrstr(errnum));
|
||||
|
||||
*ret = -1;
|
||||
return S_OK;
|
||||
}
|
||||
@ -331,6 +349,11 @@ HRESULT CAwk::Parse (int* ret)
|
||||
|
||||
if (ase_awk_parse (handle, &srcios) == -1)
|
||||
{
|
||||
const ase_char_t* msg;
|
||||
|
||||
ase_awk_geterror (handle, &errnum, &errlin, &msg);
|
||||
ase_awk_strxcpy (errmsg, ASE_COUNTOF(errmsg), msg);
|
||||
|
||||
*ret = -1;
|
||||
return S_OK;
|
||||
}
|
||||
@ -511,8 +534,11 @@ HRESULT CAwk::Run (int* ret)
|
||||
|
||||
if (ase_awk_run (handle, NULL, &runios, NULL, NULL, this) == -1)
|
||||
{
|
||||
int err = ase_awk_geterrnum (handle);
|
||||
MessageBox (NULL, ase_awk_geterrstr(err), ase_awk_geterrstr(err), MB_OK);
|
||||
const ase_char_t* msg;
|
||||
|
||||
ase_awk_geterror (handle, &errnum, &errlin, &msg);
|
||||
ase_awk_strxcpy (errmsg, ASE_COUNTOF(errmsg), msg);
|
||||
|
||||
*ret = -1;
|
||||
return S_OK;
|
||||
}
|
||||
@ -532,3 +558,98 @@ STDMETHODIMP CAwk::put_Option (int newVal)
|
||||
newVal = option;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_ErrorCode(int *pVal)
|
||||
{
|
||||
*pVal = errnum;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_ErrorLine(int *pVal)
|
||||
{
|
||||
*pVal = errlin;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_ErrorMessage(BSTR *pVal)
|
||||
{
|
||||
BSTR tmp = SysAllocStringLen (errmsg, _tcslen(errmsg));
|
||||
if (tmp == NULL) return E_OUTOFMEMORY;
|
||||
*pVal = tmp;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_ImplicitVariable(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_IMPLICIT) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_ImplicitVariable(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_IMPLICIT;
|
||||
else option = option | ~ASE_AWK_IMPLICIT;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_ExplicitVariable(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_EXPLICIT) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_ExplicitVariable(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_EXPLICIT;
|
||||
else option = option | ~ASE_AWK_EXPLICIT;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_UniqueFunction(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_UNIQUEFN) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_UniqueFunction(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_UNIQUEFN;
|
||||
else option = option | ~ASE_AWK_UNIQUEFN;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_VariableShading(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_SHADING) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_VariableShading(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_SHADING;
|
||||
else option = option | ~ASE_AWK_SHADING;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::get_ShiftOperators(BOOL *pVal)
|
||||
{
|
||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
||||
*pVal = (option & ASE_AWK_SHIFT) == 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CAwk::put_ShiftOperators(BOOL newVal)
|
||||
{
|
||||
if (newVal) option = option | ASE_AWK_SHIFT;
|
||||
else option = option | ~ASE_AWK_SHIFT;
|
||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.h,v 1.4 2006-12-11 14:58:25 bacon Exp $
|
||||
* $Id: Awk.h,v 1.5 2007-01-03 09:51:52 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_COM_AWK_H_
|
||||
@ -29,8 +29,11 @@ class CAwk :
|
||||
|
||||
{
|
||||
public:
|
||||
int option;
|
||||
ase_awk_t* handle;
|
||||
int option;
|
||||
int errnum;
|
||||
ase_size_t errlin;
|
||||
ase_char_t errmsg[256];
|
||||
|
||||
IBuffer* read_src_buf;
|
||||
IBuffer* write_src_buf;
|
||||
@ -65,6 +68,19 @@ DECLARE_REGISTRY_RESOURCEID(IDR_AWK)
|
||||
|
||||
// IAwk
|
||||
public:
|
||||
STDMETHOD(get_ShiftOperators)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_ShiftOperators)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_VariableShading)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_VariableShading)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_UniqueFunction)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_UniqueFunction)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_ExplicitVariable)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_ExplicitVariable)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_ImplicitVariable)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_ImplicitVariable)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_ErrorMessage)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(get_ErrorLine)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(get_ErrorCode)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(get_Option)(/*[out, retval]*/ int *pVal);
|
||||
STDMETHOD(put_Option)(/*[in]*/ int newVal);
|
||||
HRESULT __stdcall Parse (int* ret);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: ase.idl,v 1.3 2006-12-11 14:58:25 bacon Exp $
|
||||
* $Id: ase.idl,v 1.4 2007-01-03 09:51:52 bacon Exp $
|
||||
*/
|
||||
|
||||
import "oaidl.idl";
|
||||
@ -26,6 +26,19 @@ interface IAwk : IDispatch
|
||||
|
||||
[propput, id(3), helpstring("property Option")]
|
||||
HRESULT Option([in] int newVal);
|
||||
[propget, id(4), helpstring("property ErrorCode")] HRESULT ErrorCode([out, retval] int *pVal);
|
||||
[propget, id(5), helpstring("property ErrorLine")] HRESULT ErrorLine([out, retval] int *pVal);
|
||||
[propget, id(6), helpstring("property ErrorMessage")] HRESULT ErrorMessage([out, retval] BSTR *pVal);
|
||||
[propget, id(7), helpstring("property ImplicitVariable")] HRESULT ImplicitVariable([out, retval] BOOL *pVal);
|
||||
[propput, id(7), helpstring("property ImplicitVariable")] HRESULT ImplicitVariable([in] BOOL newVal);
|
||||
[propget, id(8), helpstring("property ExplicitVariable")] HRESULT ExplicitVariable([out, retval] BOOL *pVal);
|
||||
[propput, id(8), helpstring("property ExplicitVariable")] HRESULT ExplicitVariable([in] BOOL newVal);
|
||||
[propget, id(9), helpstring("property UniqueFunction")] HRESULT UniqueFunction([out, retval] BOOL *pVal);
|
||||
[propput, id(9), helpstring("property UniqueFunction")] HRESULT UniqueFunction([in] BOOL newVal);
|
||||
[propget, id(10), helpstring("property VariableShading")] HRESULT VariableShading([out, retval] BOOL *pVal);
|
||||
[propput, id(10), helpstring("property VariableShading")] HRESULT VariableShading([in] BOOL newVal);
|
||||
[propget, id(11), helpstring("property ShiftOperators")] HRESULT ShiftOperators([out, retval] BOOL *pVal);
|
||||
[propput, id(11), helpstring("property ShiftOperators")] HRESULT ShiftOperators([in] BOOL newVal);
|
||||
};
|
||||
|
||||
/* ASELib */
|
||||
|
@ -104,14 +104,15 @@ Private Sub Execute_Click()
|
||||
SourceOut.Text = ""
|
||||
|
||||
Set Awk = New ASELib.Awk
|
||||
'Awk.Option = Awk.Option Or ASELib.AWK_SHADING Or ASELib.AWK_IDIV
|
||||
|
||||
If Awk.Parse() = -1 Then
|
||||
MsgBox "PARSE ERROR OCCURRED!!!"
|
||||
End If
|
||||
If Awk.Run() = -1 Then
|
||||
MsgBox "RUN ERROR OCCURRED!!!"
|
||||
MsgBox "ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
||||
Else
|
||||
If Awk.Run() = -1 Then
|
||||
MsgBox "ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
||||
End If
|
||||
End If
|
||||
|
||||
Set Awk = Nothing
|
||||
|
||||
End Sub
|
||||
@ -135,28 +136,13 @@ Function Awk_ReadSource(ByVal buf As ASELib.Buffer) As Long
|
||||
End Function
|
||||
|
||||
Function Awk_WriteSource(ByVal buf As ASELib.Buffer) As Long
|
||||
Dim value As String, value2 As String, c As String
|
||||
Dim i As Integer, l As Integer
|
||||
Dim value As String
|
||||
Dim l As Integer
|
||||
|
||||
value = buf.value
|
||||
If value = vbLf Then
|
||||
SourceOut.Text = SourceOut.Text + vbCrLf
|
||||
Awk_WriteSource = 1
|
||||
Else
|
||||
l = Len(value)
|
||||
For i = 1 To l
|
||||
c = Mid(value, i, 1)
|
||||
If c = vbLf Then
|
||||
value2 = value2 + vbCrLf
|
||||
Else
|
||||
value2 = value2 + c
|
||||
End If
|
||||
Next i
|
||||
|
||||
SourceOut.Text = SourceOut.Text + value2
|
||||
Awk_WriteSource = l
|
||||
End If
|
||||
|
||||
l = Len(value)
|
||||
SourceOut.Text = SourceOut.Text + value
|
||||
Awk_WriteSource = Len(value)
|
||||
End Function
|
||||
|
||||
Function Awk_OpenExtio(ByVal extio As ASELib.AwkExtio) As Long
|
||||
@ -271,28 +257,13 @@ Function Awk_WriteExtio(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buff
|
||||
End Function
|
||||
|
||||
Function 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
|
||||
Dim value As String
|
||||
|
||||
If Not extio.Handle.EOF 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.Handle.EOF = True
|
||||
buf.value = value2
|
||||
ReadExtioConsole = Len(value2)
|
||||
buf.value = value
|
||||
ReadExtioConsole = Len(value)
|
||||
Else
|
||||
ReadExtioConsole = 0
|
||||
End If
|
||||
@ -333,13 +304,8 @@ Function WriteExtioConsole(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.B
|
||||
' buf.value = "abdkjsdfsafas"
|
||||
'Next i
|
||||
|
||||
If value = vbLf Then
|
||||
ConsoleOut.Text = ConsoleOut.Text + vbCrLf
|
||||
WriteExtioConsole = 1
|
||||
Else
|
||||
ConsoleOut.Text = ConsoleOut.Text + value
|
||||
WriteExtioConsole = Len(value)
|
||||
End If
|
||||
ConsoleOut.Text = ConsoleOut.Text + value
|
||||
WriteExtioConsole = Len(value)
|
||||
End Function
|
||||
|
||||
Function WriteExtioFile(ByVal extio As ASELib.AwkExtio, ByVal buf As ASELib.Buffer) As Long
|
||||
|
@ -1,6 +1,6 @@
|
||||
Type=Exe
|
||||
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\WINDOWS\System32\stdole2.tlb#OLE Automation
|
||||
Reference=*\G{F9C69806-16A1-4162-998A-876B33C470BF}#1.0#0#..\..\release\win32\vs60\ase.dll#ASE Awk 1.0 Type Library
|
||||
Reference=*\G{F9C69806-16A1-4162-998A-876B33C470BF}#1.0#0#..\..\debug\win32\vs60\ase.dll#ASE Awk 1.0 Type Library
|
||||
Form=AwkForm.frm
|
||||
Class=AwkExtioConsole; AwkExtioConsole.cls
|
||||
IconForm="AwkForm"
|
||||
|
@ -1,2 +1,2 @@
|
||||
AwkForm = 13, 12, 545, 559, , 22, 22, 738, 641, C
|
||||
AwkForm = 13, 12, 735, 661, , 22, 22, 738, 641, C
|
||||
AwkExtioConsole = 0, 0, 547, 460, C
|
||||
|
Loading…
x
Reference in New Issue
Block a user