*** empty log message ***
This commit is contained in:
parent
d535f5cd2a
commit
e1d050a3bb
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c,v 1.103 2007-01-06 15:45:50 bacon Exp $
|
* $Id: awk.c,v 1.104 2007-01-07 07:30:39 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__BORLANDC__)
|
#if defined(__BORLANDC__)
|
||||||
@ -253,12 +253,12 @@ int ase_awk_clear (ase_awk_t* awk)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ase_awk_getopt (ase_awk_t* awk)
|
int ase_awk_getoption (ase_awk_t* awk)
|
||||||
{
|
{
|
||||||
return awk->option;
|
return awk->option;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ase_awk_setopt (ase_awk_t* awk, int opt)
|
void ase_awk_setoption (ase_awk_t* awk, int opt)
|
||||||
{
|
{
|
||||||
awk->option = opt;
|
awk->option = opt;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.h,v 1.181 2007-01-06 15:45:50 bacon Exp $
|
* $Id: awk.h,v 1.182 2007-01-07 07:30:39 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ASE_AWK_AWK_H_
|
#ifndef _ASE_AWK_AWK_H_
|
||||||
@ -419,12 +419,12 @@ void ase_awk_seterror (
|
|||||||
ase_awk_t* run, int errnum,
|
ase_awk_t* run, int errnum,
|
||||||
ase_size_t errlin, const ase_char_t* errmsg);
|
ase_size_t errlin, const ase_char_t* errmsg);
|
||||||
|
|
||||||
int ase_awk_getopt (ase_awk_t* awk);
|
int ase_awk_getoption (ase_awk_t* awk);
|
||||||
void ase_awk_setopt (ase_awk_t* awk, int opt);
|
void ase_awk_setoption (ase_awk_t* awk, int opt);
|
||||||
|
|
||||||
|
ase_size_t ase_awk_getmaxdepth (ase_awk_t* awk, int type);
|
||||||
void ase_awk_setmaxdepth (ase_awk_t* awk, int types, ase_size_t depth);
|
void ase_awk_setmaxdepth (ase_awk_t* awk, int types, ase_size_t depth);
|
||||||
|
|
||||||
|
|
||||||
int ase_awk_parse (ase_awk_t* awk, ase_awk_srcios_t* srcios);
|
int ase_awk_parse (ase_awk_t* awk, ase_awk_srcios_t* srcios);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: func.c,v 1.88 2007-01-05 13:38:58 bacon Exp $
|
* $Id: func.c,v 1.89 2007-01-07 07:30:39 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ase/awk/awk_i.h>
|
#include <ase/awk/awk_i.h>
|
||||||
@ -408,7 +408,7 @@ static int __bfn_index (
|
|||||||
ptr = ase_awk_strxnstr (str0, len0, str1, len1);
|
ptr = ase_awk_strxnstr (str0, len0, str1, len1);
|
||||||
idx = (ptr == ASE_NULL)? -1: (ase_long_t)(ptr - str0);
|
idx = (ptr == ASE_NULL)? -1: (ase_long_t)(ptr - str0);
|
||||||
|
|
||||||
if (ase_awk_getopt(run->awk) & ASE_AWK_STRIDXONE) idx = idx + 1;
|
if (ase_awk_getoption(run->awk) & ASE_AWK_STRIDXONE) idx = idx + 1;
|
||||||
|
|
||||||
if (a0->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str0);
|
if (a0->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str0);
|
||||||
if (a1->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str1);
|
if (a1->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str1);
|
||||||
@ -510,7 +510,7 @@ static int __bfn_substr (
|
|||||||
if (n == 1) lcount = (ase_long_t)rcount;
|
if (n == 1) lcount = (ase_long_t)rcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ase_awk_getopt(run->awk) & ASE_AWK_STRIDXONE) lindex = lindex - 1;
|
if (ase_awk_getoption(run->awk) & ASE_AWK_STRIDXONE) lindex = lindex - 1;
|
||||||
if (lindex >= len) lindex = len;
|
if (lindex >= len) lindex = len;
|
||||||
else if (lindex < 0) lindex = 0;
|
else if (lindex < 0) lindex = 0;
|
||||||
|
|
||||||
@ -684,7 +684,7 @@ static int __bfn_split (
|
|||||||
ase_awk_refupval (run, *a1_ref);
|
ase_awk_refupval (run, *a1_ref);
|
||||||
|
|
||||||
p = str; str_left = str_len;
|
p = str; str_left = str_len;
|
||||||
sta = (ase_awk_getopt(run->awk) & ASE_AWK_STRIDXONE)? 1: 0;
|
sta = (ase_awk_getoption(run->awk) & ASE_AWK_STRIDXONE)? 1: 0;
|
||||||
num = sta;
|
num = sta;
|
||||||
|
|
||||||
while (p != ASE_NULL)
|
while (p != ASE_NULL)
|
||||||
@ -1240,7 +1240,7 @@ static int __bfn_match (
|
|||||||
if (n == -1) return -1;
|
if (n == -1) return -1;
|
||||||
|
|
||||||
idx = (n == 0)? -1: (ase_long_t)(mat_ptr - str0);
|
idx = (n == 0)? -1: (ase_long_t)(mat_ptr - str0);
|
||||||
if (ase_awk_getopt(run->awk) & ASE_AWK_STRIDXONE) idx = idx + 1;
|
if (ase_awk_getoption(run->awk) & ASE_AWK_STRIDXONE) idx = idx + 1;
|
||||||
|
|
||||||
a0 = ase_awk_makeintval (run, idx);
|
a0 = ase_awk_makeintval (run, idx);
|
||||||
if (a0 == ASE_NULL)
|
if (a0 == ASE_NULL)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: jni.c,v 1.47 2007-01-06 15:45:50 bacon Exp $
|
* $Id: jni.c,v 1.48 2007-01-07 07:30:40 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -238,7 +238,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_open (JNIEnv* env, jobject obj)
|
|||||||
opt = ASE_AWK_EXPLICIT | ASE_AWK_UNIQUEFN | ASE_AWK_SHADING |
|
opt = ASE_AWK_EXPLICIT | ASE_AWK_UNIQUEFN | ASE_AWK_SHADING |
|
||||||
ASE_AWK_IMPLICIT | ASE_AWK_SHIFT | ASE_AWK_IDIV |
|
ASE_AWK_IMPLICIT | ASE_AWK_SHIFT | ASE_AWK_IDIV |
|
||||||
ASE_AWK_EXTIO | ASE_AWK_BLOCKLESS | ASE_AWK_NEXTOFILE;
|
ASE_AWK_EXTIO | ASE_AWK_BLOCKLESS | ASE_AWK_NEXTOFILE;
|
||||||
ase_awk_setopt (awk, opt);
|
ase_awk_setoption (awk, opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_ase_awk_Awk_close (JNIEnv* env, jobject obj)
|
JNIEXPORT void JNICALL Java_ase_awk_Awk_close (JNIEnv* env, jobject obj)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: parse.c,v 1.238 2007-01-06 15:45:14 bacon Exp $
|
* $Id: parse.c,v 1.239 2007-01-07 07:26:16 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ase/awk/awk_i.h>
|
#include <ase/awk/awk_i.h>
|
||||||
@ -342,6 +342,16 @@ static struct __bvent __bvtab[] =
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
ase_size_t ase_awk_getmaxdepth (ase_awk_t* awk, int type)
|
||||||
|
{
|
||||||
|
return (type == ASE_AWK_DEPTH_BLOCK_PARSE)? awk->parse.depth.max.block:
|
||||||
|
(type == ASE_AWK_DEPTH_BLOCK_RUN)? awk->run.depth.max.block:
|
||||||
|
(type == ASE_AWK_DEPTH_EXPR_PARSE)? awk->parse.depth.max.expr:
|
||||||
|
(type == ASE_AWK_DEPTH_EXPR_RUN)? awk->run.depth.max.expr:
|
||||||
|
(type == ASE_AWK_DEPTH_REX_BUILD)? awk->rex.depth.max.build:
|
||||||
|
(type == ASE_AWK_DEPTH_REX_MATCH)? awk->rex.depth.max.match: 0;
|
||||||
|
}
|
||||||
|
|
||||||
void ase_awk_setmaxdepth (ase_awk_t* awk, int types, ase_size_t depth)
|
void ase_awk_setmaxdepth (ase_awk_t* awk, int types, ase_size_t depth)
|
||||||
{
|
{
|
||||||
if (types & ASE_AWK_DEPTH_BLOCK_PARSE)
|
if (types & ASE_AWK_DEPTH_BLOCK_PARSE)
|
||||||
|
117
ase/com/Awk.cpp
117
ase/com/Awk.cpp
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: Awk.cpp,v 1.13 2007-01-06 15:45:50 bacon Exp $
|
* $Id: Awk.cpp,v 1.14 2007-01-07 07:30:40 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
@ -338,7 +338,20 @@ HRESULT CAwk::Parse (int* ret)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ase_awk_setopt (handle, option);
|
ase_awk_setoption (handle, option);
|
||||||
|
|
||||||
|
ase_awk_setmaxdepth (handle,
|
||||||
|
ASE_AWK_DEPTH_BLOCK_PARSE, max_depth.block.parse);
|
||||||
|
ase_awk_setmaxdepth (handle,
|
||||||
|
ASE_AWK_DEPTH_BLOCK_RUN, max_depth.block.run);
|
||||||
|
ase_awk_setmaxdepth (handle,
|
||||||
|
ASE_AWK_DEPTH_EXPR_PARSE, max_depth.expr.parse);
|
||||||
|
ase_awk_setmaxdepth (handle,
|
||||||
|
ASE_AWK_DEPTH_EXPR_RUN, max_depth.expr.run);
|
||||||
|
ase_awk_setmaxdepth (handle,
|
||||||
|
ASE_AWK_DEPTH_REX_BUILD, max_depth.rex.build);
|
||||||
|
ase_awk_setmaxdepth (handle,
|
||||||
|
ASE_AWK_DEPTH_REX_MATCH, max_depth.rex.match);
|
||||||
}
|
}
|
||||||
|
|
||||||
ase_awk_srcios_t srcios;
|
ase_awk_srcios_t srcios;
|
||||||
@ -569,7 +582,7 @@ STDMETHODIMP CAwk::get_ErrorMessage(BSTR *pVal)
|
|||||||
|
|
||||||
STDMETHODIMP CAwk::get_ImplicitVariable(BOOL *pVal)
|
STDMETHODIMP CAwk::get_ImplicitVariable(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_IMPLICIT) == 1;
|
*pVal = (option & ASE_AWK_IMPLICIT) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -578,13 +591,13 @@ STDMETHODIMP CAwk::put_ImplicitVariable(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_IMPLICIT;
|
if (newVal) option = option | ASE_AWK_IMPLICIT;
|
||||||
else option = option & ~ASE_AWK_IMPLICIT;
|
else option = option & ~ASE_AWK_IMPLICIT;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_ExplicitVariable(BOOL *pVal)
|
STDMETHODIMP CAwk::get_ExplicitVariable(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_EXPLICIT) == 1;
|
*pVal = (option & ASE_AWK_EXPLICIT) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -593,13 +606,13 @@ STDMETHODIMP CAwk::put_ExplicitVariable(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_EXPLICIT;
|
if (newVal) option = option | ASE_AWK_EXPLICIT;
|
||||||
else option = option & ~ASE_AWK_EXPLICIT;
|
else option = option & ~ASE_AWK_EXPLICIT;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_UniqueFunction(BOOL *pVal)
|
STDMETHODIMP CAwk::get_UniqueFunction(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_UNIQUEFN) == 1;
|
*pVal = (option & ASE_AWK_UNIQUEFN) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -608,13 +621,13 @@ STDMETHODIMP CAwk::put_UniqueFunction(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_UNIQUEFN;
|
if (newVal) option = option | ASE_AWK_UNIQUEFN;
|
||||||
else option = option & ~ASE_AWK_UNIQUEFN;
|
else option = option & ~ASE_AWK_UNIQUEFN;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_VariableShading(BOOL *pVal)
|
STDMETHODIMP CAwk::get_VariableShading(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_SHADING) == 1;
|
*pVal = (option & ASE_AWK_SHADING) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -623,13 +636,13 @@ STDMETHODIMP CAwk::put_VariableShading(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_SHADING;
|
if (newVal) option = option | ASE_AWK_SHADING;
|
||||||
else option = option & ~ASE_AWK_SHADING;
|
else option = option & ~ASE_AWK_SHADING;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_ShiftOperators(BOOL *pVal)
|
STDMETHODIMP CAwk::get_ShiftOperators(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_SHIFT) == 1;
|
*pVal = (option & ASE_AWK_SHIFT) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -638,13 +651,13 @@ STDMETHODIMP CAwk::put_ShiftOperators(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_SHIFT;
|
if (newVal) option = option | ASE_AWK_SHIFT;
|
||||||
else option = option & ~ASE_AWK_SHIFT;
|
else option = option & ~ASE_AWK_SHIFT;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_IdivOperator(BOOL *pVal)
|
STDMETHODIMP CAwk::get_IdivOperator(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_IDIV) == 1;
|
*pVal = (option & ASE_AWK_IDIV) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -653,13 +666,13 @@ STDMETHODIMP CAwk::put_IdivOperator(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_IDIV;
|
if (newVal) option = option | ASE_AWK_IDIV;
|
||||||
else option = option & ~ASE_AWK_IDIV;
|
else option = option & ~ASE_AWK_IDIV;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_ConcatString(BOOL *pVal)
|
STDMETHODIMP CAwk::get_ConcatString(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_STRCONCAT) == 1;
|
*pVal = (option & ASE_AWK_STRCONCAT) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -668,13 +681,13 @@ STDMETHODIMP CAwk::put_ConcatString(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_STRCONCAT;
|
if (newVal) option = option | ASE_AWK_STRCONCAT;
|
||||||
else option = option & ~ASE_AWK_STRCONCAT;
|
else option = option & ~ASE_AWK_STRCONCAT;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_SupportExtio(BOOL *pVal)
|
STDMETHODIMP CAwk::get_SupportExtio(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_EXTIO) == 1;
|
*pVal = (option & ASE_AWK_EXTIO) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -683,13 +696,13 @@ STDMETHODIMP CAwk::put_SupportExtio(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_EXTIO;
|
if (newVal) option = option | ASE_AWK_EXTIO;
|
||||||
else option = option & ~ASE_AWK_EXTIO;
|
else option = option & ~ASE_AWK_EXTIO;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_SupportBlockless(BOOL *pVal)
|
STDMETHODIMP CAwk::get_SupportBlockless(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_BLOCKLESS) == 1;
|
*pVal = (option & ASE_AWK_BLOCKLESS) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -698,13 +711,13 @@ STDMETHODIMP CAwk::put_SupportBlockless(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_BLOCKLESS;
|
if (newVal) option = option | ASE_AWK_BLOCKLESS;
|
||||||
else option = option & ~ASE_AWK_BLOCKLESS;
|
else option = option & ~ASE_AWK_BLOCKLESS;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_StringIndexOne(BOOL *pVal)
|
STDMETHODIMP CAwk::get_StringIndexOne(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_STRIDXONE) == 1;
|
*pVal = (option & ASE_AWK_STRIDXONE) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -713,13 +726,13 @@ STDMETHODIMP CAwk::put_StringIndexOne(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_STRIDXONE;
|
if (newVal) option = option | ASE_AWK_STRIDXONE;
|
||||||
else option = option & ~ASE_AWK_STRIDXONE;
|
else option = option & ~ASE_AWK_STRIDXONE;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_StripSpaces(BOOL *pVal)
|
STDMETHODIMP CAwk::get_StripSpaces(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_STRIPSPACES) == 1;
|
*pVal = (option & ASE_AWK_STRIPSPACES) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -728,13 +741,13 @@ STDMETHODIMP CAwk::put_StripSpaces(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_STRIPSPACES;
|
if (newVal) option = option | ASE_AWK_STRIPSPACES;
|
||||||
else option = option & ~ASE_AWK_STRIPSPACES;
|
else option = option & ~ASE_AWK_STRIPSPACES;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_Nextofile(BOOL *pVal)
|
STDMETHODIMP CAwk::get_Nextofile(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_NEXTOFILE) == 1;
|
*pVal = (option & ASE_AWK_NEXTOFILE) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -743,13 +756,13 @@ STDMETHODIMP CAwk::put_Nextofile(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_NEXTOFILE;
|
if (newVal) option = option | ASE_AWK_NEXTOFILE;
|
||||||
else option = option & ~ASE_AWK_NEXTOFILE;
|
else option = option & ~ASE_AWK_NEXTOFILE;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_UseCrlf(BOOL *pVal)
|
STDMETHODIMP CAwk::get_UseCrlf(BOOL *pVal)
|
||||||
{
|
{
|
||||||
if (handle != NULL) option = ase_awk_getopt (handle);
|
if (handle != NULL) option = ase_awk_getoption (handle);
|
||||||
*pVal = (option & ASE_AWK_CRLF) == 1;
|
*pVal = (option & ASE_AWK_CRLF) == 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -758,14 +771,18 @@ STDMETHODIMP CAwk::put_UseCrlf(BOOL newVal)
|
|||||||
{
|
{
|
||||||
if (newVal) option = option | ASE_AWK_CRLF;
|
if (newVal) option = option | ASE_AWK_CRLF;
|
||||||
else option = option & ~ASE_AWK_CRLF;
|
else option = option & ~ASE_AWK_CRLF;
|
||||||
if (handle != NULL) ase_awk_setopt (handle, option);
|
if (handle != NULL) ase_awk_setoption (handle, option);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAwk::get_MaxDepthForBlockParse(int *pVal)
|
STDMETHODIMP CAwk::get_MaxDepthForBlockParse(int *pVal)
|
||||||
{
|
{
|
||||||
// TODO: Add your implementation code here
|
if (handle != NULL)
|
||||||
|
{
|
||||||
|
max_depth.block.parse =
|
||||||
|
ase_awk_getmaxdepth (handle, ASE_AWK_DEPTH_BLOCK_PARSE);
|
||||||
|
}
|
||||||
|
*pVal = max_depth.block.parse;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,8 +799,12 @@ STDMETHODIMP CAwk::put_MaxDepthForBlockParse(int newVal)
|
|||||||
|
|
||||||
STDMETHODIMP CAwk::get_MaxDepthForBlockRun(int *pVal)
|
STDMETHODIMP CAwk::get_MaxDepthForBlockRun(int *pVal)
|
||||||
{
|
{
|
||||||
// TODO: Add your implementation code here
|
if (handle != NULL)
|
||||||
|
{
|
||||||
|
max_depth.block.run =
|
||||||
|
ase_awk_getmaxdepth (handle, ASE_AWK_DEPTH_BLOCK_RUN);
|
||||||
|
}
|
||||||
|
*pVal = max_depth.block.run;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,8 +821,12 @@ STDMETHODIMP CAwk::put_MaxDepthForBlockRun(int newVal)
|
|||||||
|
|
||||||
STDMETHODIMP CAwk::get_MaxDepthForExpressionParse(int *pVal)
|
STDMETHODIMP CAwk::get_MaxDepthForExpressionParse(int *pVal)
|
||||||
{
|
{
|
||||||
// TODO: Add your implementation code here
|
if (handle != NULL)
|
||||||
|
{
|
||||||
|
max_depth.expr.parse =
|
||||||
|
ase_awk_getmaxdepth (handle, ASE_AWK_DEPTH_EXPR_PARSE);
|
||||||
|
}
|
||||||
|
*pVal = max_depth.expr.parse;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,8 +843,12 @@ STDMETHODIMP CAwk::put_MaxDepthForExpressionParse(int newVal)
|
|||||||
|
|
||||||
STDMETHODIMP CAwk::get_MaxDepthForExpressionRun(int *pVal)
|
STDMETHODIMP CAwk::get_MaxDepthForExpressionRun(int *pVal)
|
||||||
{
|
{
|
||||||
// TODO: Add your implementation code here
|
if (handle != NULL)
|
||||||
|
{
|
||||||
|
max_depth.expr.run =
|
||||||
|
ase_awk_getmaxdepth (handle, ASE_AWK_DEPTH_EXPR_RUN);
|
||||||
|
}
|
||||||
|
*pVal = max_depth.expr.run;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -836,8 +865,12 @@ STDMETHODIMP CAwk::put_MaxDepthForExpressionRun(int newVal)
|
|||||||
|
|
||||||
STDMETHODIMP CAwk::get_MaxDepthForRexBuild(int *pVal)
|
STDMETHODIMP CAwk::get_MaxDepthForRexBuild(int *pVal)
|
||||||
{
|
{
|
||||||
// TODO: Add your implementation code here
|
if (handle != NULL)
|
||||||
|
{
|
||||||
|
max_depth.rex.build =
|
||||||
|
ase_awk_getmaxdepth (handle, ASE_AWK_DEPTH_REX_BUILD);
|
||||||
|
}
|
||||||
|
*pVal = max_depth.rex.build;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,8 +887,12 @@ STDMETHODIMP CAwk::put_MaxDepthForRexBuild(int newVal)
|
|||||||
|
|
||||||
STDMETHODIMP CAwk::get_MaxDepthForRexMatch(int *pVal)
|
STDMETHODIMP CAwk::get_MaxDepthForRexMatch(int *pVal)
|
||||||
{
|
{
|
||||||
// TODO: Add your implementation code here
|
if (handle != NULL)
|
||||||
|
{
|
||||||
|
max_depth.rex.match =
|
||||||
|
ase_awk_getmaxdepth (handle, ASE_AWK_DEPTH_REX_MATCH);
|
||||||
|
}
|
||||||
|
*pVal = max_depth.rex.match;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: ase.idl,v 1.7 2007-01-06 15:45:50 bacon Exp $
|
* $Id: ase.idl,v 1.8 2007-01-07 07:30:40 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import "oaidl.idl";
|
import "oaidl.idl";
|
||||||
@ -138,24 +138,6 @@ library ASELib
|
|||||||
importlib("stdole32.tlb");
|
importlib("stdole32.tlb");
|
||||||
importlib("stdole2.tlb");
|
importlib("stdole2.tlb");
|
||||||
|
|
||||||
[helpstring("Awk options")]
|
|
||||||
typedef [v1_enum] enum AwkOption
|
|
||||||
{
|
|
||||||
AWK_IMPLICIT = (1 << 0),
|
|
||||||
AWK_EXPLICIT = (1 << 1),
|
|
||||||
AWK_UNIQUEAFN = (1 << 2),
|
|
||||||
AWK_SHADING = (1 << 3),
|
|
||||||
AWK_SHIFT = (1 << 4),
|
|
||||||
AWK_IDIV = (1 << 5),
|
|
||||||
AWK_HASHSIGN = (1 << 6),
|
|
||||||
AWK_STRCONCAT = (1 << 7),
|
|
||||||
AWK_EXTIO = (1 << 8),
|
|
||||||
AWK_BLOCKLESS = (1 << 9),
|
|
||||||
AWK_STRINDEXONE = (1 << 10),
|
|
||||||
AWK_STRIPSPACES = (1 << 11),
|
|
||||||
AWK_NEXTOFILE = (1 << 12)
|
|
||||||
} AwkOption;
|
|
||||||
|
|
||||||
[helpstring("AwkExtio tpe")]
|
[helpstring("AwkExtio tpe")]
|
||||||
typedef [v1_enum] enum AwkExtioType
|
typedef [v1_enum] enum AwkExtioType
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,24 @@
|
|||||||
VERSION 5.00
|
VERSION 5.00
|
||||||
Begin VB.Form AwkForm
|
Begin VB.Form AwkForm
|
||||||
Caption = "ASE COM AWK"
|
Caption = "ASE COM AWK"
|
||||||
ClientHeight = 7770
|
ClientHeight = 7635
|
||||||
ClientLeft = 60
|
ClientLeft = 60
|
||||||
ClientTop = 345
|
ClientTop = 345
|
||||||
ClientWidth = 10335
|
ClientWidth = 10335
|
||||||
LinkTopic = "AwkForm"
|
LinkTopic = "AwkForm"
|
||||||
ScaleHeight = 7770
|
ScaleHeight = 7635
|
||||||
ScaleWidth = 10335
|
ScaleWidth = 10335
|
||||||
StartUpPosition = 3 'Windows Default
|
StartUpPosition = 3 'Windows Default
|
||||||
|
Begin VB.ComboBox EntryFunction
|
||||||
|
Height = 315
|
||||||
|
ItemData = "AwkForm.frx":0000
|
||||||
|
Left = 1320
|
||||||
|
List = "AwkForm.frx":000A
|
||||||
|
TabIndex = 9
|
||||||
|
Text = "None"
|
||||||
|
Top = 120
|
||||||
|
Width = 3495
|
||||||
|
End
|
||||||
Begin VB.TextBox ConsoleIn
|
Begin VB.TextBox ConsoleIn
|
||||||
BeginProperty Font
|
BeginProperty Font
|
||||||
Name = "Courier New"
|
Name = "Courier New"
|
||||||
@ -22,8 +32,9 @@ Begin VB.Form AwkForm
|
|||||||
Height = 2895
|
Height = 2895
|
||||||
Left = 120
|
Left = 120
|
||||||
MultiLine = -1 'True
|
MultiLine = -1 'True
|
||||||
TabIndex = 4
|
ScrollBars = 3 'Both
|
||||||
Top = 3600
|
TabIndex = 2
|
||||||
|
Top = 3960
|
||||||
Width = 5055
|
Width = 5055
|
||||||
End
|
End
|
||||||
Begin VB.TextBox SourceIn
|
Begin VB.TextBox SourceIn
|
||||||
@ -39,8 +50,9 @@ Begin VB.Form AwkForm
|
|||||||
Height = 2775
|
Height = 2775
|
||||||
Left = 120
|
Left = 120
|
||||||
MultiLine = -1 'True
|
MultiLine = -1 'True
|
||||||
TabIndex = 3
|
ScrollBars = 3 'Both
|
||||||
Top = 480
|
TabIndex = 0
|
||||||
|
Top = 840
|
||||||
Width = 5055
|
Width = 5055
|
||||||
End
|
End
|
||||||
Begin VB.TextBox SourceOut
|
Begin VB.TextBox SourceOut
|
||||||
@ -55,17 +67,19 @@ Begin VB.Form AwkForm
|
|||||||
EndProperty
|
EndProperty
|
||||||
Height = 2775
|
Height = 2775
|
||||||
Left = 5280
|
Left = 5280
|
||||||
|
Locked = -1 'True
|
||||||
MultiLine = -1 'True
|
MultiLine = -1 'True
|
||||||
TabIndex = 2
|
ScrollBars = 3 'Both
|
||||||
Top = 480
|
TabIndex = 1
|
||||||
|
Top = 840
|
||||||
Width = 4935
|
Width = 4935
|
||||||
End
|
End
|
||||||
Begin VB.CommandButton Execute
|
Begin VB.CommandButton Execute
|
||||||
Caption = "Execute"
|
Caption = "Execute"
|
||||||
Height = 375
|
Height = 375
|
||||||
Left = 7080
|
Left = 9000
|
||||||
TabIndex = 1
|
TabIndex = 5
|
||||||
Top = 6840
|
Top = 7080
|
||||||
Width = 1215
|
Width = 1215
|
||||||
End
|
End
|
||||||
Begin VB.TextBox ConsoleOut
|
Begin VB.TextBox ConsoleOut
|
||||||
@ -81,10 +95,51 @@ Begin VB.Form AwkForm
|
|||||||
Height = 2895
|
Height = 2895
|
||||||
Left = 5280
|
Left = 5280
|
||||||
MultiLine = -1 'True
|
MultiLine = -1 'True
|
||||||
TabIndex = 0
|
ScrollBars = 3 'Both
|
||||||
Top = 3600
|
TabIndex = 3
|
||||||
|
Top = 3960
|
||||||
Width = 4935
|
Width = 4935
|
||||||
End
|
End
|
||||||
|
Begin VB.Label Label5
|
||||||
|
Caption = "Entry Function:"
|
||||||
|
Height = 255
|
||||||
|
Left = 120
|
||||||
|
TabIndex = 10
|
||||||
|
Top = 120
|
||||||
|
Width = 1455
|
||||||
|
End
|
||||||
|
Begin VB.Label Label4
|
||||||
|
Caption = "Console Out"
|
||||||
|
Height = 255
|
||||||
|
Left = 5280
|
||||||
|
TabIndex = 8
|
||||||
|
Top = 3720
|
||||||
|
Width = 3735
|
||||||
|
End
|
||||||
|
Begin VB.Label Label3
|
||||||
|
Caption = "Console In"
|
||||||
|
Height = 255
|
||||||
|
Left = 120
|
||||||
|
TabIndex = 7
|
||||||
|
Top = 3720
|
||||||
|
Width = 3735
|
||||||
|
End
|
||||||
|
Begin VB.Label Label2
|
||||||
|
Caption = "Deparsed Source Code"
|
||||||
|
Height = 255
|
||||||
|
Left = 5280
|
||||||
|
TabIndex = 6
|
||||||
|
Top = 600
|
||||||
|
Width = 3735
|
||||||
|
End
|
||||||
|
Begin VB.Label Label1
|
||||||
|
Caption = "Source Code"
|
||||||
|
Height = 255
|
||||||
|
Left = 120
|
||||||
|
TabIndex = 4
|
||||||
|
Top = 600
|
||||||
|
Width = 2415
|
||||||
|
End
|
||||||
End
|
End
|
||||||
Attribute VB_Name = "AwkForm"
|
Attribute VB_Name = "AwkForm"
|
||||||
Attribute VB_GlobalNameSpace = False
|
Attribute VB_GlobalNameSpace = False
|
||||||
@ -106,18 +161,23 @@ Private Sub Execute_Click()
|
|||||||
Set Awk = New ASELib.Awk
|
Set Awk = New ASELib.Awk
|
||||||
|
|
||||||
Awk.ExplicitVariable = True
|
Awk.ExplicitVariable = True
|
||||||
Awk.ImplicitVariable = False
|
Awk.ImplicitVariable = True
|
||||||
Awk.UseCrlf = True
|
Awk.UseCrlf = True
|
||||||
Awk.IdivOperator = True
|
Awk.IdivOperator = True
|
||||||
|
Awk.ShiftOperators = True
|
||||||
|
|
||||||
' TODO: debug it....
|
Awk.MaxDepthForBlockParse = 20
|
||||||
Awk.MaxDepthForBlockParse = 3
|
Awk.MaxDepthForBlockRun = 30
|
||||||
|
Awk.MaxDepthForExpressionParse = 20
|
||||||
|
Awk.MaxDepthForExpressionRun = 30
|
||||||
|
'Awk.MaxDepthForRexBuild = 10
|
||||||
|
'Awk.MaxDepthForRexMatch = 10
|
||||||
|
|
||||||
If Awk.Parse() = -1 Then
|
If Awk.Parse() = -1 Then
|
||||||
MsgBox "ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
MsgBox "PARSE ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
||||||
Else
|
Else
|
||||||
If Awk.Run() = -1 Then
|
If Awk.Run() = -1 Then
|
||||||
MsgBox "ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
MsgBox "RUN ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -326,30 +386,9 @@ ErrorTrap:
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Sub Form_Load()
|
Private Sub Form_Load()
|
||||||
'Dim x As ASELib.AwkExtio
|
SourceIn.Text = ""
|
||||||
'Dim i As Long
|
|
||||||
|
|
||||||
SourceIn.Text = "BEGIN { print 123.12; print 995; print 5432.1; }"
|
|
||||||
SourceOut.Text = ""
|
SourceOut.Text = ""
|
||||||
ConsoleIn.Text = ""
|
ConsoleIn.Text = ""
|
||||||
ConsoleOut.Text = ""
|
ConsoleOut.Text = ""
|
||||||
|
|
||||||
'Set x = New ASELib.AwkExtio
|
|
||||||
'For i = 0 To 50000
|
|
||||||
' x.Handle = New AwkExtioConsole
|
|
||||||
'Next i
|
|
||||||
'Set x = Nothing
|
|
||||||
|
|
||||||
'i = FreeFile
|
|
||||||
'On Error GoTo ErrorHandler
|
|
||||||
'Open "c:/projects/ase/ase.xdg" For Input As #i
|
|
||||||
'On Error GoTo 0
|
|
||||||
'MsgBox Input(LOF(i), i)
|
|
||||||
'Close #i
|
|
||||||
'Exit Sub
|
|
||||||
|
|
||||||
'ErrorHandler:
|
|
||||||
' MsgBox "fuck"
|
|
||||||
' Exit Sub
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
AwkForm = 13, 12, 735, 661, , 22, 22, 738, 641, 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