*** empty log message ***
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user