This commit is contained in:
@ -10,12 +10,12 @@
|
||||
#include <ase/cmn/mem.h>
|
||||
#include <ase/cmn/str.h>
|
||||
#include <ase/cmn/map.h>
|
||||
#include <ase/cmn/rex.h>
|
||||
|
||||
typedef struct ase_awk_chain_t ase_awk_chain_t;
|
||||
typedef struct ase_awk_tree_t ase_awk_tree_t;
|
||||
|
||||
#include <ase/awk/awk.h>
|
||||
#include <ase/awk/rex.h>
|
||||
#include <ase/awk/tree.h>
|
||||
#include <ase/awk/val.h>
|
||||
#include <ase/awk/func.h>
|
||||
@ -365,4 +365,12 @@ struct ase_awk_run_t
|
||||
ase_awk_runcbs_t* cbs;
|
||||
};
|
||||
|
||||
|
||||
#define ASE_AWK_FREEREX(awk,code) ase_freerex(&(awk)->prmfns.mmgr,code)
|
||||
#define ASE_AWK_ISEMPTYREX(awk,code) ase_isemptyrex(code)
|
||||
#define ASE_AWK_BUILDREX(awk,ptn,len,errnum) \
|
||||
ase_awk_buildrex(awk,ptn,len,errnum)
|
||||
#define ASE_AWK_MATCHREX(awk,code,option,str,len,match_ptr,match_len,errnum) \
|
||||
ase_awk_matchrex(awk,code,option,str,len,match_ptr,match_len,errnum)
|
||||
|
||||
#endif
|
||||
|
@ -260,9 +260,9 @@ int ase_awk_readextio (
|
||||
|
||||
ASE_ASSERT (run->global.rs != ASE_NULL);
|
||||
|
||||
n = ase_awk_matchrex (
|
||||
n = ASE_AWK_MATCHREX (
|
||||
run->awk, run->global.rs,
|
||||
((run->global.ignorecase)? ASE_AWK_REX_IGNORECASE: 0),
|
||||
((run->global.ignorecase)? ASE_REX_IGNORECASE: 0),
|
||||
ASE_STR_BUF(buf), ASE_STR_LEN(buf),
|
||||
&match_ptr, &match_len, &run->errnum);
|
||||
if (n == -1)
|
||||
@ -348,9 +348,9 @@ int ase_awk_readextio (
|
||||
|
||||
ASE_ASSERT (run->global.rs != ASE_NULL);
|
||||
|
||||
n = ase_awk_matchrex (
|
||||
n = ASE_AWK_MATCHREX (
|
||||
run->awk, run->global.rs,
|
||||
((run->global.ignorecase)? ASE_AWK_REX_IGNORECASE: 0),
|
||||
((run->global.ignorecase)? ASE_REX_IGNORECASE: 0),
|
||||
ASE_STR_BUF(buf), ASE_STR_LEN(buf),
|
||||
&match_ptr, &match_len, &run->errnum);
|
||||
if (n == -1)
|
||||
|
@ -702,7 +702,7 @@ static int bfn_split (
|
||||
|
||||
if (fs_len > 1)
|
||||
{
|
||||
fs_rex = ase_awk_buildrex (
|
||||
fs_rex = ASE_AWK_BUILDREX (
|
||||
run->awk, fs_ptr, fs_len, &errnum);
|
||||
if (fs_rex == ASE_NULL)
|
||||
{
|
||||
@ -725,7 +725,7 @@ static int bfn_split (
|
||||
if (fs_free != ASE_NULL)
|
||||
ASE_AWK_FREE (run->awk, fs_free);
|
||||
if (fs_rex_free != ASE_NULL)
|
||||
ase_awk_freerex (run->awk, fs_rex_free);
|
||||
ASE_AWK_FREEREX (run->awk, fs_rex_free);
|
||||
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
|
||||
return -1;
|
||||
}
|
||||
@ -756,7 +756,7 @@ static int bfn_split (
|
||||
if (fs_free != ASE_NULL)
|
||||
ASE_AWK_FREE (run->awk, fs_free);
|
||||
if (fs_rex_free != ASE_NULL)
|
||||
ase_awk_freerex (run->awk, fs_rex_free);
|
||||
ASE_AWK_FREEREX (run->awk, fs_rex_free);
|
||||
ase_awk_setrunerrnum (run, errnum);
|
||||
return -1;
|
||||
}
|
||||
@ -780,7 +780,7 @@ static int bfn_split (
|
||||
if (fs_free != ASE_NULL)
|
||||
ASE_AWK_FREE (run->awk, fs_free);
|
||||
if (fs_rex_free != ASE_NULL)
|
||||
ase_awk_freerex (run->awk, fs_rex_free);
|
||||
ASE_AWK_FREEREX (run->awk, fs_rex_free);
|
||||
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
|
||||
return -1;
|
||||
}
|
||||
@ -807,7 +807,7 @@ static int bfn_split (
|
||||
if (fs_free != ASE_NULL)
|
||||
ASE_AWK_FREE (run->awk, fs_free);
|
||||
if (fs_rex_free != ASE_NULL)
|
||||
ase_awk_freerex (run->awk, fs_rex_free);
|
||||
ASE_AWK_FREEREX (run->awk, fs_rex_free);
|
||||
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
|
||||
return -1;
|
||||
}
|
||||
@ -818,7 +818,7 @@ static int bfn_split (
|
||||
|
||||
if (str_free != ASE_NULL) ASE_AWK_FREE (run->awk, str_free);
|
||||
if (fs_free != ASE_NULL) ASE_AWK_FREE (run->awk, fs_free);
|
||||
if (fs_rex_free != ASE_NULL) ase_awk_freerex (run->awk, fs_rex_free);
|
||||
if (fs_rex_free != ASE_NULL) ASE_AWK_FREEREX (run->awk, fs_rex_free);
|
||||
|
||||
if (sta == 1) num--;
|
||||
|
||||
@ -946,7 +946,7 @@ static int __substitute (ase_awk_run_t* run, ase_long_t max_count)
|
||||
} while (0)
|
||||
#define FREE_A0_REX(awk,rex) \
|
||||
do { \
|
||||
if (a0->type != ASE_AWK_VAL_REX) ase_awk_freerex (awk, rex); \
|
||||
if (a0->type != ASE_AWK_VAL_REX) ASE_AWK_FREEREX (awk, rex); \
|
||||
} while (0)
|
||||
|
||||
if (a0->type == ASE_AWK_VAL_REX)
|
||||
@ -1053,7 +1053,7 @@ static int __substitute (ase_awk_run_t* run, ase_long_t max_count)
|
||||
|
||||
if (a0->type != ASE_AWK_VAL_REX)
|
||||
{
|
||||
rex = ase_awk_buildrex (run->awk, a0_ptr, a0_len, &run->errnum);
|
||||
rex = ASE_AWK_BUILDREX (run->awk, a0_ptr, a0_len, &run->errnum);
|
||||
if (rex == ASE_NULL)
|
||||
{
|
||||
ase_str_close (&new);
|
||||
@ -1062,7 +1062,7 @@ static int __substitute (ase_awk_run_t* run, ase_long_t max_count)
|
||||
}
|
||||
}
|
||||
|
||||
opt = (run->global.ignorecase)? ASE_AWK_REX_IGNORECASE: 0;
|
||||
opt = (run->global.ignorecase)? ASE_REX_IGNORECASE: 0;
|
||||
cur_ptr = a2_ptr;
|
||||
cur_len = a2_len;
|
||||
sub_count = 0;
|
||||
@ -1071,7 +1071,7 @@ static int __substitute (ase_awk_run_t* run, ase_long_t max_count)
|
||||
{
|
||||
if (max_count == 0 || sub_count < max_count)
|
||||
{
|
||||
n = ase_awk_matchrex (
|
||||
n = ASE_AWK_MATCHREX (
|
||||
run->awk, rex, opt, cur_ptr, cur_len,
|
||||
&mat_ptr, &mat_len, &run->errnum);
|
||||
}
|
||||
@ -1270,7 +1270,7 @@ static int bfn_match (
|
||||
}
|
||||
}
|
||||
|
||||
rex = ase_awk_buildrex (run->awk, str1, len1, &run->errnum);
|
||||
rex = ASE_AWK_BUILDREX (run->awk, str1, len1, &run->errnum);
|
||||
if (rex == ASE_NULL)
|
||||
{
|
||||
if (a0->type != ASE_AWK_VAL_STR)
|
||||
@ -1281,13 +1281,13 @@ static int bfn_match (
|
||||
if (a1->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str1);
|
||||
}
|
||||
|
||||
opt = (run->global.ignorecase)? ASE_AWK_REX_IGNORECASE: 0;
|
||||
n = ase_awk_matchrex (
|
||||
opt = (run->global.ignorecase)? ASE_REX_IGNORECASE: 0;
|
||||
n = ASE_AWK_MATCHREX (
|
||||
run->awk, rex, opt, str0, len0,
|
||||
&mat_ptr, &mat_len, &run->errnum);
|
||||
|
||||
if (a0->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str0);
|
||||
if (a1->type != ASE_AWK_VAL_REX) ase_awk_freerex (run->awk, rex);
|
||||
if (a1->type != ASE_AWK_VAL_REX) ASE_AWK_FREEREX (run->awk, rex);
|
||||
|
||||
if (n == -1) return -1;
|
||||
|
||||
|
@ -52,8 +52,7 @@ OBJ_FILES_LIB = \
|
||||
$(TMP_DIR)/val.o \
|
||||
$(TMP_DIR)/func.o \
|
||||
$(TMP_DIR)/misc.o \
|
||||
$(TMP_DIR)/extio.o \
|
||||
$(TMP_DIR)/rex.o
|
||||
$(TMP_DIR)/extio.o
|
||||
|
||||
OBJ_FILES_JNI = $(TMP_DIR)/jni.o
|
||||
|
||||
@ -150,9 +149,6 @@ $(TMP_DIR)/misc.o: misc.c
|
||||
$(TMP_DIR)/extio.o: extio.c
|
||||
$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) -o $@ -c extio.c
|
||||
|
||||
$(TMP_DIR)/rex.o: rex.c
|
||||
$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) -o $@ -c rex.c
|
||||
|
||||
$(TMP_DIR)/jni.o: jni.c
|
||||
$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(CFLAGS_JNI) -o $@ -c jni.c
|
||||
|
||||
|
@ -828,9 +828,9 @@ ase_char_t* ase_awk_strxntokbyrex (
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
n = ase_awk_matchrex (
|
||||
n = ASE_AWK_MATCHREX (
|
||||
run->awk, rex,
|
||||
((run->global.ignorecase)? ASE_AWK_REX_IGNORECASE: 0),
|
||||
((run->global.ignorecase)? ASE_REX_IGNORECASE: 0),
|
||||
ptr, left, (const ase_char_t**)&match_ptr, &match_len,
|
||||
errnum);
|
||||
if (n == -1) return ASE_NULL;
|
||||
@ -908,3 +908,45 @@ exit_loop:
|
||||
ASE_NULL: (match_ptr+match_len);
|
||||
}
|
||||
}
|
||||
|
||||
#define ASE_AWK_REXERRTOERR(err) \
|
||||
((err == ASE_REX_ENOERR)? ASE_AWK_ENOERR: \
|
||||
(err == ASE_REX_ENOMEM)? ASE_AWK_ENOMEM: \
|
||||
(err == ASE_REX_ERECUR)? ASE_AWK_EREXRECUR: \
|
||||
(err == ASE_REX_ERPAREN)? ASE_AWK_EREXRPAREN: \
|
||||
(err == ASE_REX_ERBRACKET)? ASE_AWK_EREXRBRACKET: \
|
||||
(err == ASE_REX_ERBRACE)? ASE_AWK_EREXRBRACE: \
|
||||
(err == ASE_REX_EUNBALPAR)? ASE_AWK_EREXUNBALPAR: \
|
||||
(err == ASE_REX_ECOLON)? ASE_AWK_EREXCOLON: \
|
||||
(err == ASE_REX_ECRANGE)? ASE_AWK_EREXCRANGE: \
|
||||
(err == ASE_REX_ECCLASS)? ASE_AWK_EREXCCLASS: \
|
||||
(err == ASE_REX_EBRANGE)? ASE_AWK_EREXBRANGE: \
|
||||
(err == ASE_REX_EEND)? ASE_AWK_EREXEND: \
|
||||
(err == ASE_REX_EGARBAGE)? ASE_AWK_EREXGARBAGE: \
|
||||
ASE_AWK_EINTERN)
|
||||
|
||||
void* ase_awk_buildrex (
|
||||
ase_awk_t* awk, const ase_char_t* ptn, ase_size_t len, int* errnum)
|
||||
{
|
||||
int err;
|
||||
void* p;
|
||||
|
||||
p = ase_buildrex (
|
||||
&awk->prmfns.mmgr, awk->rex.depth.max.build, ptn, len, &err);
|
||||
if (p == ASE_NULL) *errnum = ASE_AWK_REXERRTOERR(err);
|
||||
return p;
|
||||
}
|
||||
|
||||
int ase_awk_matchrex (
|
||||
ase_awk_t* awk, void* code, int option,
|
||||
const ase_char_t* str, ase_size_t len,
|
||||
const ase_char_t** match_ptr, ase_size_t* match_len, int* errnum)
|
||||
{
|
||||
int err, x;
|
||||
|
||||
x = ase_matchrex (
|
||||
&awk->prmfns.mmgr, &awk->prmfns.ccls, awk->rex.depth.max.match,
|
||||
code, option, str, len, match_ptr, match_len, &err);
|
||||
if (x < 0) *errnum = ASE_AWK_REXERRTOERR(err);
|
||||
return x;
|
||||
}
|
||||
|
@ -37,6 +37,15 @@ ase_char_t* ase_awk_strxntokbyrex (
|
||||
ase_awk_run_t* run, const ase_char_t* s, ase_size_t len,
|
||||
void* rex, ase_char_t** tok, ase_size_t* tok_len, int* errnum);
|
||||
|
||||
|
||||
void* ase_awk_buildrex (
|
||||
ase_awk_t* awk, const ase_char_t* ptn, ase_size_t len, int* errnum);
|
||||
|
||||
int ase_awk_matchrex (
|
||||
ase_awk_t* awk, void* code, int option,
|
||||
const ase_char_t* str, ase_size_t len,
|
||||
const ase_char_t** match_ptr, ase_size_t* match_len, int* errnum);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -2868,7 +2868,7 @@ static ase_awk_nde_t* parse_primary (ase_awk_t* awk, ase_size_t line)
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
nde->code = ase_awk_buildrex (awk,
|
||||
nde->code = ASE_AWK_BUILDREX (awk,
|
||||
ASE_STR_BUF(&awk->token.name),
|
||||
ASE_STR_LEN(&awk->token.name),
|
||||
&errnum);
|
||||
|
1997
ase/awk/rex.c
1997
ase/awk/rex.c
File diff suppressed because it is too large
Load Diff
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* $Id: rex.h,v 1.3 2007/04/30 05:47:33 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_REX_H_
|
||||
#define _ASE_AWK_REX_H_
|
||||
|
||||
#ifndef _ASE_AWK_AWK_H_
|
||||
#error Never include this file directly. Include <ase/awk/awk.h> instead
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Regular Esseression Syntax
|
||||
* A regular expression is zero or more branches, separated by '|'.
|
||||
* ......
|
||||
* ......
|
||||
*
|
||||
* Compiled form of a regular expression:
|
||||
*
|
||||
* | expression |
|
||||
* | header | branch | branch | branch |
|
||||
* | nb | el | na | bl | cmd | arg | cmd | arg | na | bl | cmd | arg | na | bl | cmd |
|
||||
*
|
||||
* nb: the number of branches
|
||||
* el: the length of a expression including the length of nb and el
|
||||
* na: the number of atoms
|
||||
* bl: the length of a branch including the length of na and bl
|
||||
* cmd: The command and repetition info encoded together.
|
||||
* Some commands require an argument to follow them but some other don't.
|
||||
* It is encoded as follows:
|
||||
*
|
||||
* Subexpressions can be nested by having the command "GROUP"
|
||||
* and a subexpression as its argument.
|
||||
*
|
||||
* Examples:
|
||||
* a.c -> |1|6|5|ORD_CHAR(no bound)|a|ANY_CHAR(no bound)|ORD_CHAR(no bound)|c|
|
||||
* ab|xy -> |2|10|4|ORD_CHAR(no bound)|a|ORD_CHAR(no bound)|b|4|ORD_CHAR(no bound)|x|ORD_CHAR(no bound)|y|
|
||||
*/
|
||||
|
||||
#define ASE_AWK_REX_NA(code) (*(ase_size_t*)(code))
|
||||
|
||||
#define ASE_AWK_REX_LEN(code) \
|
||||
(*(ase_size_t*)((ase_byte_t*)(code)+ASE_SIZEOF(ase_size_t)))
|
||||
|
||||
enum ase_awk_rex_opt_t
|
||||
{
|
||||
ASE_AWK_REX_IGNORECASE = (1 << 0)
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void* ase_awk_buildrex (
|
||||
ase_awk_t* awk, const ase_char_t* ptn,
|
||||
ase_size_t len, int* errnum);
|
||||
|
||||
int ase_awk_matchrex (
|
||||
ase_awk_t* awk, void* code, int option,
|
||||
const ase_char_t* str, ase_size_t len,
|
||||
const ase_char_t** match_ptr, ase_size_t* match_len, int* errnum);
|
||||
|
||||
void ase_awk_freerex (ase_awk_t* awk, void* code);
|
||||
|
||||
ase_bool_t ase_awk_isemptyrex (ase_awk_t* awk, void* code);
|
||||
|
||||
void ase_awk_dprintrex (ase_awk_t* awk, void* rex);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -354,7 +354,7 @@ static int set_global (
|
||||
|
||||
/* compile the regular expression */
|
||||
/* TODO: use safebuild */
|
||||
rex = ase_awk_buildrex (
|
||||
rex = ASE_AWK_BUILDREX (
|
||||
run->awk, fs_ptr, fs_len, &run->errnum);
|
||||
if (rex == ASE_NULL)
|
||||
{
|
||||
@ -365,7 +365,7 @@ static int set_global (
|
||||
|
||||
if (run->global.fs != ASE_NULL)
|
||||
{
|
||||
ase_awk_freerex (run->awk, run->global.fs);
|
||||
ASE_AWK_FREEREX (run->awk, run->global.fs);
|
||||
}
|
||||
run->global.fs = rex;
|
||||
}
|
||||
@ -499,7 +499,7 @@ static int set_global (
|
||||
|
||||
/* compile the regular expression */
|
||||
/* TODO: use safebuild */
|
||||
rex = ase_awk_buildrex (
|
||||
rex = ASE_AWK_BUILDREX (
|
||||
run->awk, rs_ptr, rs_len, &run->errnum);
|
||||
if (rex == ASE_NULL)
|
||||
{
|
||||
@ -510,7 +510,7 @@ static int set_global (
|
||||
|
||||
if (run->global.rs != ASE_NULL)
|
||||
{
|
||||
ase_awk_freerex (run->awk, run->global.rs);
|
||||
ASE_AWK_FREEREX (run->awk, run->global.rs);
|
||||
}
|
||||
run->global.rs = rex;
|
||||
}
|
||||
@ -3079,8 +3079,7 @@ static ase_awk_val_t* eval_expression (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
/* the record has never been read.
|
||||
* probably, this functions has been triggered
|
||||
* by the statements in the BEGIN block */
|
||||
n = ase_awk_isemptyrex (
|
||||
run->awk, ((ase_awk_val_rex_t*)v)->code)? 1: 0;
|
||||
n = ASE_AWK_ISEMPTYREX(run->awk,((ase_awk_val_rex_t*)v)->code)? 1: 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3088,10 +3087,10 @@ static ase_awk_val_t* eval_expression (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||
run->inrec.d0->type == ASE_AWK_VAL_STR,
|
||||
"the internal value representing $0 should always be of the string type once it has been set/updated. it is nil initially.");
|
||||
|
||||
n = ase_awk_matchrex (
|
||||
n = ASE_AWK_MATCHREX (
|
||||
((ase_awk_run_t*)run)->awk,
|
||||
((ase_awk_val_rex_t*)v)->code,
|
||||
((((ase_awk_run_t*)run)->global.ignorecase)? ASE_AWK_REX_IGNORECASE: 0),
|
||||
((((ase_awk_run_t*)run)->global.ignorecase)? ASE_REX_IGNORECASE: 0),
|
||||
((ase_awk_val_str_t*)run->inrec.d0)->buf,
|
||||
((ase_awk_val_str_t*)run->inrec.d0)->len,
|
||||
ASE_NULL, ASE_NULL, &errnum);
|
||||
@ -4723,7 +4722,7 @@ static ase_awk_val_t* eval_binop_match0 (
|
||||
}
|
||||
else if (right->type == ASE_AWK_VAL_STR)
|
||||
{
|
||||
rex_code = ase_awk_buildrex (
|
||||
rex_code = ASE_AWK_BUILDREX (
|
||||
run->awk,
|
||||
((ase_awk_val_str_t*)right)->buf,
|
||||
((ase_awk_val_str_t*)right)->len, &errnum);
|
||||
@ -4739,7 +4738,7 @@ static ase_awk_val_t* eval_binop_match0 (
|
||||
run, right, ASE_AWK_VALTOSTR_CLEAR, ASE_NULL, &len);
|
||||
if (str == ASE_NULL) return ASE_NULL;
|
||||
|
||||
rex_code = ase_awk_buildrex (run->awk, str, len, &errnum);
|
||||
rex_code = ASE_AWK_BUILDREX (run->awk, str, len, &errnum);
|
||||
if (rex_code == ASE_NULL)
|
||||
{
|
||||
ASE_AWK_FREE (run->awk, str);
|
||||
@ -4753,9 +4752,9 @@ static ase_awk_val_t* eval_binop_match0 (
|
||||
|
||||
if (left->type == ASE_AWK_VAL_STR)
|
||||
{
|
||||
n = ase_awk_matchrex (
|
||||
n = ASE_AWK_MATCHREX (
|
||||
run->awk, rex_code,
|
||||
((run->global.ignorecase)? ASE_AWK_REX_IGNORECASE: 0),
|
||||
((run->global.ignorecase)? ASE_REX_IGNORECASE: 0),
|
||||
((ase_awk_val_str_t*)left)->buf,
|
||||
((ase_awk_val_str_t*)left)->len,
|
||||
ASE_NULL, ASE_NULL, &errnum);
|
||||
@ -4790,9 +4789,9 @@ static ase_awk_val_t* eval_binop_match0 (
|
||||
return ASE_NULL;
|
||||
}
|
||||
|
||||
n = ase_awk_matchrex (
|
||||
n = ASE_AWK_MATCHREX (
|
||||
run->awk, rex_code,
|
||||
((run->global.ignorecase)? ASE_AWK_REX_IGNORECASE: 0),
|
||||
((run->global.ignorecase)? ASE_REX_IGNORECASE: 0),
|
||||
str, len, ASE_NULL, ASE_NULL, &errnum);
|
||||
if (n == -1)
|
||||
{
|
||||
|
@ -320,7 +320,7 @@ ase_awk_val_t* ase_awk_makerexval (
|
||||
|
||||
val = (ase_awk_val_rex_t*) ASE_AWK_MALLOC (
|
||||
run->awk, ASE_SIZEOF(ase_awk_val_rex_t) +
|
||||
(ASE_SIZEOF(*buf)*len+1) + ASE_AWK_REX_LEN(code));
|
||||
(ASE_SIZEOF(*buf)*len+1) + ASE_REX_LEN(code));
|
||||
if (val == ASE_NULL) return ASE_NULL;
|
||||
|
||||
val->type = ASE_AWK_VAL_REX;
|
||||
@ -338,7 +338,7 @@ ase_awk_val_t* ase_awk_makerexval (
|
||||
ase_strncpy (val->buf, buf, len);
|
||||
|
||||
/*
|
||||
val->code = ASE_AWK_MALLOC (run->awk, ASE_AWK_REX_LEN(code));
|
||||
val->code = ASE_AWK_MALLOC (run->awk, ASE_REX_LEN(code));
|
||||
if (val->code == ASE_NULL)
|
||||
{
|
||||
ASE_AWK_FREE (run->awk, val->buf);
|
||||
@ -348,7 +348,7 @@ ase_awk_val_t* ase_awk_makerexval (
|
||||
}
|
||||
*/
|
||||
val->code = val->buf + len + 1;
|
||||
ase_memcpy (val->code, code, ASE_AWK_REX_LEN(code));
|
||||
ase_memcpy (val->code, code, ASE_REX_LEN(code));
|
||||
|
||||
return (ase_awk_val_t*)val;
|
||||
}
|
||||
@ -506,7 +506,7 @@ void ase_awk_freeval (ase_awk_run_t* run, ase_awk_val_t* val, ase_bool_t cache)
|
||||
{
|
||||
/*
|
||||
ASE_AWK_FREE (run->awk, ((ase_awk_val_rex_t*)val)->buf);
|
||||
ase_awk_freerex (run->awk, ((ase_awk_val_rex_t*)val)->code);
|
||||
ASE_AWK_FREEREX (run->awk, ((ase_awk_val_rex_t*)val)->code);
|
||||
*/
|
||||
ASE_AWK_FREE (run->awk, val);
|
||||
}
|
||||
|
Reference in New Issue
Block a user