*** empty log message ***

This commit is contained in:
hyung-hwan 2007-01-06 15:45:50 +00:00
parent 38f0ad0fba
commit d535f5cd2a
10 changed files with 253 additions and 62 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c,v 1.102 2006-12-19 14:20:29 bacon Exp $
* $Id: awk.c,v 1.103 2007-01-06 15:45:50 bacon Exp $
*/
#if defined(__BORLANDC__)
@ -147,10 +147,12 @@ ase_awk_t* ase_awk_open (const ase_awk_sysfns_t* sysfns, int* errnum)
awk->parse.depth.cur.loop = 0;
awk->parse.depth.cur.expr = 0;
ase_awk_setmaxparsedepth (awk, ASE_AWK_DEPTH_BLOCK, 0);
ase_awk_setmaxparsedepth (awk, ASE_AWK_DEPTH_EXPR, 0);
ase_awk_setmaxrundepth (awk, ASE_AWK_DEPTH_BLOCK, 0);
ase_awk_setmaxrundepth (awk, ASE_AWK_DEPTH_EXPR, 0);
ase_awk_setmaxdepth (awk, ASE_AWK_DEPTH_BLOCK_PARSE, 0);
ase_awk_setmaxdepth (awk, ASE_AWK_DEPTH_BLOCK_RUN, 0);
ase_awk_setmaxdepth (awk, ASE_AWK_DEPTH_EXPR_PARSE, 0);
ase_awk_setmaxdepth (awk, ASE_AWK_DEPTH_EXPR_RUN, 0);
ase_awk_setmaxdepth (awk, ASE_AWK_DEPTH_REX_BUILD, 0);
ase_awk_setmaxdepth (awk, ASE_AWK_DEPTH_REX_MATCH, 0);
awk->run.count = 0;
awk->run.ptr = ASE_NULL;
@ -261,16 +263,3 @@ void ase_awk_setopt (ase_awk_t* awk, int opt)
awk->option = opt;
}
void ase_awk_setmaxrundepth (ase_awk_t* awk, int types, ase_size_t depth)
{
if (types & ASE_AWK_DEPTH_BLOCK)
{
awk->run.depth.max.block = depth;
}
if (types & ASE_AWK_DEPTH_EXPR)
{
awk->run.depth.max.expr = depth;
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h,v 1.180 2007-01-05 13:38:58 bacon Exp $
* $Id: awk.h,v 1.181 2007-01-06 15:45:50 bacon Exp $
*/
#ifndef _ASE_AWK_AWK_H_
@ -348,9 +348,14 @@ enum
/* depth types */
enum ase_awk_depth_t
{
ASE_AWK_DEPTH_BLOCK = (1 << 0),
ASE_AWK_DEPTH_EXPR = (1 << 1)
ASE_AWK_DEPTH_BLOCK_PARSE = (1 << 0),
ASE_AWK_DEPTH_BLOCK_RUN = (1 << 1),
ASE_AWK_DEPTH_EXPR_PARSE = (1 << 2),
ASE_AWK_DEPTH_EXPR_RUN = (1 << 3),
ASE_AWK_DEPTH_REX_BUILD = (1 << 4),
ASE_AWK_DEPTH_REX_MATCH = (1 << 5)
};
/* extio types */
enum ase_awk_extio_type_t
{
@ -417,8 +422,8 @@ void ase_awk_seterror (
int ase_awk_getopt (ase_awk_t* awk);
void ase_awk_setopt (ase_awk_t* awk, int opt);
void ase_awk_setmaxparsedepth (ase_awk_t*, int types, ase_size_t depth);
void ase_awk_setmaxrundepth (ase_awk_t*, 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);

View File

@ -1,5 +1,5 @@
/*
* $Id: awk_i.h,v 1.96 2006-12-30 08:54:43 bacon Exp $
* $Id: awk_i.h,v 1.97 2007-01-06 15:45:50 bacon Exp $
*/
#ifndef _ASE_AWK_AWKI_H_
@ -194,12 +194,6 @@ struct ase_awk_t
struct
{
struct
{
ase_size_t block;
ase_size_t expr;
} cur;
struct
{
ase_size_t block;
@ -208,6 +202,18 @@ struct ase_awk_t
} depth;
} run;
struct
{
struct
{
struct
{
ase_size_t build;
ase_size_t match;
} max;
} depth;
} rex;
/* housekeeping */
int errnum;
ase_size_t errlin;

View File

@ -1,5 +1,5 @@
/*
* $Id: jni.c,v 1.46 2007-01-05 13:38:59 bacon Exp $
* $Id: jni.c,v 1.47 2007-01-06 15:45:50 bacon Exp $
*/
#include <stdio.h>
@ -317,8 +317,12 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_parse (JNIEnv* env, jobject obj)
depth = __java_get_max_depth (env, obj, "getMaxParseDepth");
if (depth < 0) depth = 0;
ase_awk_setmaxparsedepth (awk,
ASE_AWK_DEPTH_BLOCK | ASE_AWK_DEPTH_EXPR, depth);
ase_awk_setmaxdepth (
awk,
ASE_AWK_DEPTH_BLOCK_PARSE |
ASE_AWK_DEPTH_EXPR_PARSE,
depth);
if (ase_awk_parse (awk, &srcios) == -1)
{

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c,v 1.237 2007-01-05 13:38:59 bacon Exp $
* $Id: parse.c,v 1.238 2007-01-06 15:45:14 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -342,9 +342,9 @@ static struct __bvent __bvtab[] =
} \
} while (0)
void ase_awk_setmaxparsedepth (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)
if (types & ASE_AWK_DEPTH_BLOCK_PARSE)
{
awk->parse.depth.max.block = depth;
if (depth <= 0)
@ -353,10 +353,30 @@ void ase_awk_setmaxparsedepth (ase_awk_t* awk, int types, ase_size_t depth)
awk->parse.parse_block = __parse_block_dc;
}
if (types & ASE_AWK_DEPTH_EXPR)
if (types & ASE_AWK_DEPTH_EXPR_PARSE)
{
awk->parse.depth.max.expr = depth;
}
if (types & ASE_AWK_DEPTH_BLOCK_RUN)
{
awk->run.depth.max.block = depth;
}
if (types & ASE_AWK_DEPTH_EXPR_RUN)
{
awk->run.depth.max.expr = depth;
}
if (types & ASE_AWK_DEPTH_REX_BUILD)
{
awk->rex.depth.max.build = depth;
}
if (types & ASE_AWK_DEPTH_REX_MATCH)
{
awk->rex.depth.max.match = depth;
}
}
int ase_awk_parse (ase_awk_t* awk, ase_awk_srcios_t* srcios)

View File

@ -1,5 +1,5 @@
/*
* $Id: rex.c,v 1.53 2006-12-23 06:33:47 bacon Exp $
* $Id: rex.c,v 1.54 2007-01-06 15:45:50 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -283,9 +283,7 @@ void* ase_awk_buildrex (
builder.ptn.curc.type = CT_EOF;
builder.ptn.curc.value = ASE_T('\0');
/* IMPLEMENT THIS PROPERLY. */
/*builder.depth.max = awk->rex.depth.max;*/
builder.depth.max = 0;
builder.depth.max = awk->rex.depth.max.build;
builder.depth.cur = 0;
if (__next_char (&builder, LEVEL_TOP) == -1)
@ -328,9 +326,7 @@ int ase_awk_matchrex (
matcher.match.str.ptr = str;
matcher.match.str.end = str + len;
/* TODO: implement the maximum depth
matcher.depth.max = awk->max_depth; */
matcher.depth.max = 0;
matcher.depth.max = awk->rex.depth.max.match;
matcher.depth.cur = 0;
matcher.ignorecase = (option & ASE_AWK_REX_IGNORECASE)? 1: 0;

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp,v 1.12 2007-01-05 13:39:37 bacon Exp $
* $Id: Awk.cpp,v 1.13 2007-01-06 15:45:50 bacon Exp $
*/
#include "stdafx.h"
@ -30,9 +30,6 @@ STDMETHODIMP CAwk::InterfaceSupportsErrorInfo(REFIID riid)
CAwk::CAwk ():
handle(NULL),
option(0),
errnum(0),
errlin(0),
read_src_buf(NULL),
write_src_buf(NULL),
write_extio_buf(NULL)
@ -44,7 +41,8 @@ CAwk::CAwk ():
#endif
/* TODO: what is the best default option? */
option = ASE_AWK_IMPLICIT |
option =
ASE_AWK_IMPLICIT |
ASE_AWK_EXPLICIT |
ASE_AWK_UNIQUEFN |
ASE_AWK_IDIV |
@ -56,7 +54,10 @@ CAwk::CAwk ():
ASE_AWK_STRIPSPACES |
ASE_AWK_NEXTOFILE |
ASE_AWK_CRLF;
memset (&max_depth, 0, sizeof(max_depth));
errnum = 0;
errlin = 0;
errmsg[0] = _T('\0');
}
@ -761,3 +762,110 @@ STDMETHODIMP CAwk::put_UseCrlf(BOOL newVal)
return S_OK;
}
STDMETHODIMP CAwk::get_MaxDepthForBlockParse(int *pVal)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP CAwk::put_MaxDepthForBlockParse(int newVal)
{
max_depth.block.parse = newVal;
if (handle != NULL)
{
ase_awk_setmaxdepth (handle,
ASE_AWK_DEPTH_BLOCK_PARSE, max_depth.block.parse);
}
return S_OK;
}
STDMETHODIMP CAwk::get_MaxDepthForBlockRun(int *pVal)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP CAwk::put_MaxDepthForBlockRun(int newVal)
{
max_depth.block.run = newVal;
if (handle != NULL)
{
ase_awk_setmaxdepth (handle,
ASE_AWK_DEPTH_BLOCK_RUN, max_depth.block.run);
}
return S_OK;
}
STDMETHODIMP CAwk::get_MaxDepthForExpressionParse(int *pVal)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP CAwk::put_MaxDepthForExpressionParse(int newVal)
{
max_depth.expr.parse = newVal;
if (handle != NULL)
{
ase_awk_setmaxdepth (handle,
ASE_AWK_DEPTH_EXPR_PARSE, max_depth.expr.parse);
}
return S_OK;
}
STDMETHODIMP CAwk::get_MaxDepthForExpressionRun(int *pVal)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP CAwk::put_MaxDepthForExpressionRun(int newVal)
{
max_depth.expr.run = newVal;
if (handle != NULL)
{
ase_awk_setmaxdepth (handle,
ASE_AWK_DEPTH_EXPR_RUN, max_depth.expr.run);
}
return S_OK;
}
STDMETHODIMP CAwk::get_MaxDepthForRexBuild(int *pVal)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP CAwk::put_MaxDepthForRexBuild(int newVal)
{
max_depth.rex.build = newVal;
if (handle != NULL)
{
ase_awk_setmaxdepth (handle,
ASE_AWK_DEPTH_REX_BUILD, max_depth.rex.build);
}
return S_OK;
}
STDMETHODIMP CAwk::get_MaxDepthForRexMatch(int *pVal)
{
// TODO: Add your implementation code here
return S_OK;
}
STDMETHODIMP CAwk::put_MaxDepthForRexMatch(int newVal)
{
max_depth.rex.match = newVal;
if (handle != NULL)
{
ase_awk_setmaxdepth (handle,
ASE_AWK_DEPTH_REX_MATCH, max_depth.rex.match);
}
return S_OK;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.h,v 1.7 2007-01-05 13:39:37 bacon Exp $
* $Id: Awk.h,v 1.8 2007-01-06 15:45:50 bacon Exp $
*/
#ifndef _ASE_COM_AWK_H_
@ -35,6 +35,24 @@ public:
ase_size_t errlin;
ase_char_t errmsg[256];
struct
{
struct
{
int parse;
int run;
} block;
struct
{
int parse;
int run;
} expr;
struct
{
int build;
int match;
} rex;
} max_depth;
IBuffer* read_src_buf;
IBuffer* write_src_buf;
ase_size_t read_src_pos;
@ -68,6 +86,18 @@ DECLARE_REGISTRY_RESOURCEID(IDR_AWK)
// IAwk
public:
STDMETHOD(get_MaxDepthForRexMatch)(/*[out, retval]*/ int *pVal);
STDMETHOD(put_MaxDepthForRexMatch)(/*[in]*/ int newVal);
STDMETHOD(get_MaxDepthForRexBuild)(/*[out, retval]*/ int *pVal);
STDMETHOD(put_MaxDepthForRexBuild)(/*[in]*/ int newVal);
STDMETHOD(get_MaxDepthForExpressionRun)(/*[out, retval]*/ int *pVal);
STDMETHOD(put_MaxDepthForExpressionRun)(/*[in]*/ int newVal);
STDMETHOD(get_MaxDepthForExpressionParse)(/*[out, retval]*/ int *pVal);
STDMETHOD(put_MaxDepthForExpressionParse)(/*[in]*/ int newVal);
STDMETHOD(get_MaxDepthForBlockRun)(/*[out, retval]*/ int *pVal);
STDMETHOD(put_MaxDepthForBlockRun)(/*[in]*/ int newVal);
STDMETHOD(get_MaxDepthForBlockParse)(/*[out, retval]*/ int *pVal);
STDMETHOD(put_MaxDepthForBlockParse)(/*[in]*/ int newVal);
STDMETHOD(get_UseCrlf)(/*[out, retval]*/ BOOL *pVal);
STDMETHOD(put_UseCrlf)(/*[in]*/ BOOL newVal);
STDMETHOD(get_Nextofile)(/*[out, retval]*/ BOOL *pVal);

View File

@ -1,5 +1,5 @@
/*
* $Id: ase.idl,v 1.6 2007-01-05 13:39:37 bacon Exp $
* $Id: ase.idl,v 1.7 2007-01-06 15:45:50 bacon Exp $
*/
import "oaidl.idl";
@ -95,6 +95,36 @@ interface IAwk : IDispatch
HRESULT UseCrlf([out, retval] BOOL *pVal);
[propput, id(18), helpstring("property UseCrlf")]
HRESULT UseCrlf([in] BOOL newVal);
[propget, id(19), helpstring("property MaxDepthForBlockParse")]
HRESULT MaxDepthForBlockParse([out, retval] int *pVal);
[propput, id(19), helpstring("property MaxDepthForBlockParse")]
HRESULT MaxDepthForBlockParse([in] int newVal);
[propget, id(20), helpstring("property MaxDepthForBlockRun")]
HRESULT MaxDepthForBlockRun([out, retval] int *pVal);
[propput, id(20), helpstring("property MaxDepthForBlockRun")]
HRESULT MaxDepthForBlockRun([in] int newVal);
[propget, id(21), helpstring("property MaxDepthForExpressionParse")]
HRESULT MaxDepthForExpressionParse([out, retval] int *pVal);
[propput, id(21), helpstring("property MaxDepthForExpressionParse")]
HRESULT MaxDepthForExpressionParse([in] int newVal);
[propget, id(22), helpstring("property MaxDepthForExpressionRun")]
HRESULT MaxDepthForExpressionRun([out, retval] int *pVal);
[propput, id(22), helpstring("property MaxDepthForExpressionRun")]
HRESULT MaxDepthForExpressionRun([in] int newVal);
[propget, id(23), helpstring("property MaxDepthForRexBuild")]
HRESULT MaxDepthForRexBuild([out, retval] int *pVal);
[propput, id(23), helpstring("property MaxDepthForRexBuild")]
HRESULT MaxDepthForRexBuild([in] int newVal);
[propget, id(24), helpstring("property MaxDepthForRexMatch")]
HRESULT MaxDepthForRexMatch([out, retval] int *pVal);
[propput, id(24), helpstring("property MaxDepthForRexMatch")]
HRESULT MaxDepthForRexMatch([in] int newVal);
};
/* ASELib */

View File

@ -110,6 +110,9 @@ Private Sub Execute_Click()
Awk.UseCrlf = True
Awk.IdivOperator = True
' TODO: debug it....
Awk.MaxDepthForBlockParse = 3
If Awk.Parse() = -1 Then
MsgBox "ERROR [" + Str(Awk.ErrorLine) + "]" + Awk.ErrorMessage
Else