*** empty log message ***
This commit is contained in:
parent
79ab50e2eb
commit
7338143d29
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: rex.c,v 1.21 2006-08-16 09:35:21 bacon Exp $
|
* $Id: rex.c,v 1.22 2006-08-16 11:35:53 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -187,6 +187,7 @@ static const xp_byte_t* __match_boundary (
|
|||||||
static xp_bool_t __test_charset (
|
static xp_bool_t __test_charset (
|
||||||
const xp_byte_t* p, xp_size_t csc, xp_char_t c);
|
const xp_byte_t* p, xp_size_t csc, xp_char_t c);
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
static xp_bool_t __cc_isalnum (xp_char_t c);
|
static xp_bool_t __cc_isalnum (xp_char_t c);
|
||||||
static xp_bool_t __cc_isalpha (xp_char_t c);
|
static xp_bool_t __cc_isalpha (xp_char_t c);
|
||||||
static xp_bool_t __cc_isblank (xp_char_t c);
|
static xp_bool_t __cc_isblank (xp_char_t c);
|
||||||
@ -199,11 +200,13 @@ static xp_bool_t __cc_ispunct (xp_char_t c);
|
|||||||
static xp_bool_t __cc_isspace (xp_char_t c);
|
static xp_bool_t __cc_isspace (xp_char_t c);
|
||||||
static xp_bool_t __cc_isupper (xp_char_t c);
|
static xp_bool_t __cc_isupper (xp_char_t c);
|
||||||
static xp_bool_t __cc_isxdigit (xp_char_t c);
|
static xp_bool_t __cc_isxdigit (xp_char_t c);
|
||||||
|
#endif
|
||||||
|
|
||||||
static const xp_byte_t* __print_pattern (const xp_byte_t* p);
|
static const xp_byte_t* __print_pattern (const xp_byte_t* p);
|
||||||
static const xp_byte_t* __print_branch (const xp_byte_t* p);
|
static const xp_byte_t* __print_branch (const xp_byte_t* p);
|
||||||
static const xp_byte_t* __print_atom (const xp_byte_t* p);
|
static const xp_byte_t* __print_atom (const xp_byte_t* p);
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
static struct __char_class_t
|
static struct __char_class_t
|
||||||
{
|
{
|
||||||
const xp_char_t* name;
|
const xp_char_t* name;
|
||||||
@ -237,6 +240,7 @@ static struct __char_class_t __char_class [] =
|
|||||||
|
|
||||||
{ XP_NULL, 0, XP_NULL }
|
{ XP_NULL, 0, XP_NULL }
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
void* xp_awk_buildrex (const xp_char_t* ptn, xp_size_t len, int* errnum)
|
void* xp_awk_buildrex (const xp_char_t* ptn, xp_size_t len, int* errnum)
|
||||||
{
|
{
|
||||||
@ -340,10 +344,9 @@ int xp_awk_safematchrex (void* code,
|
|||||||
return (mat.matched)? 1: 0;
|
return (mat.matched)? 1: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xp_awk_printrex (void* rex)
|
void xp_awk_freerex (void* code)
|
||||||
{
|
{
|
||||||
__print_pattern (rex);
|
xp_free (code);
|
||||||
xp_printf (XP_T("\n"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __build_pattern (__builder_t* builder)
|
static int __build_pattern (__builder_t* builder)
|
||||||
@ -590,6 +593,7 @@ static int __build_charset (__builder_t* builder, struct __code_t* cmd)
|
|||||||
c1 = builder->ptn.curc.value;
|
c1 = builder->ptn.curc.value;
|
||||||
NEXT_CHAR(builder, LEVEL_CHARSET);
|
NEXT_CHAR(builder, LEVEL_CHARSET);
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
if (c1 == XP_T('[') &&
|
if (c1 == XP_T('[') &&
|
||||||
builder->ptn.curc.type == CT_NORMAL &&
|
builder->ptn.curc.type == CT_NORMAL &&
|
||||||
builder->ptn.curc.value == XP_T(':'))
|
builder->ptn.curc.value == XP_T(':'))
|
||||||
@ -597,6 +601,7 @@ static int __build_charset (__builder_t* builder, struct __code_t* cmd)
|
|||||||
if (__build_cclass (builder, &c1) == -1) return -1;
|
if (__build_cclass (builder, &c1) == -1) return -1;
|
||||||
cc = cc | 1;
|
cc = cc | 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
c2 = c1;
|
c2 = c1;
|
||||||
if (builder->ptn.curc.type == CT_NORMAL &&
|
if (builder->ptn.curc.type == CT_NORMAL &&
|
||||||
@ -609,6 +614,7 @@ static int __build_charset (__builder_t* builder, struct __code_t* cmd)
|
|||||||
c2 = builder->ptn.curc.value;
|
c2 = builder->ptn.curc.value;
|
||||||
NEXT_CHAR (builder, LEVEL_CHARSET);
|
NEXT_CHAR (builder, LEVEL_CHARSET);
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
if (c2 == XP_T('[') &&
|
if (c2 == XP_T('[') &&
|
||||||
builder->ptn.curc.type == CT_NORMAL &&
|
builder->ptn.curc.type == CT_NORMAL &&
|
||||||
builder->ptn.curc.value == XP_T(':'))
|
builder->ptn.curc.value == XP_T(':'))
|
||||||
@ -620,6 +626,7 @@ static int __build_charset (__builder_t* builder, struct __code_t* cmd)
|
|||||||
|
|
||||||
cc = cc | 2;
|
cc = cc | 2;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else cc = cc | 4;
|
else cc = cc | 4;
|
||||||
}
|
}
|
||||||
@ -662,6 +669,7 @@ static int __build_charset (__builder_t* builder, struct __code_t* cmd)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
static int __build_cclass (__builder_t* builder, xp_char_t* cc)
|
static int __build_cclass (__builder_t* builder, xp_char_t* cc)
|
||||||
{
|
{
|
||||||
const struct __char_class_t* ccp = __char_class;
|
const struct __char_class_t* ccp = __char_class;
|
||||||
@ -708,6 +716,7 @@ static int __build_cclass (__builder_t* builder, xp_char_t* cc)
|
|||||||
*cc = (xp_char_t)(ccp - __char_class);
|
*cc = (xp_char_t)(ccp - __char_class);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int __build_boundary (__builder_t* builder, struct __code_t* cmd)
|
static int __build_boundary (__builder_t* builder, struct __code_t* cmd)
|
||||||
{
|
{
|
||||||
@ -768,7 +777,8 @@ static int __build_range (__builder_t* builder, struct __code_t* cmd)
|
|||||||
// what if it is not in the raight format? convert it to ordinary characters??
|
// what if it is not in the raight format? convert it to ordinary characters??
|
||||||
bound = 0;
|
bound = 0;
|
||||||
while (builder->ptn.curc.type == CT_NORMAL &&
|
while (builder->ptn.curc.type == CT_NORMAL &&
|
||||||
xp_isdigit(builder->ptn.curc.value))
|
(builder->ptn.curc.value >= XP_T('0') &&
|
||||||
|
builder->ptn.curc.value <= XP_T('9')))
|
||||||
{
|
{
|
||||||
bound = bound * 10 + builder->ptn.curc.value - XP_T('0');
|
bound = bound * 10 + builder->ptn.curc.value - XP_T('0');
|
||||||
NEXT_CHAR (builder, LEVEL_RANGE);
|
NEXT_CHAR (builder, LEVEL_RANGE);
|
||||||
@ -783,7 +793,8 @@ static int __build_range (__builder_t* builder, struct __code_t* cmd)
|
|||||||
|
|
||||||
bound = 0;
|
bound = 0;
|
||||||
while (builder->ptn.curc.type == CT_NORMAL &&
|
while (builder->ptn.curc.type == CT_NORMAL &&
|
||||||
xp_isdigit(builder->ptn.curc.value))
|
(builder->ptn.curc.value >= XP_T('0') &&
|
||||||
|
builder->ptn.curc.value <= XP_T('9')))
|
||||||
{
|
{
|
||||||
bound = bound * 10 + builder->ptn.curc.value - XP_T('0');
|
bound = bound * 10 + builder->ptn.curc.value - XP_T('0');
|
||||||
NEXT_CHAR (builder, LEVEL_RANGE);
|
NEXT_CHAR (builder, LEVEL_RANGE);
|
||||||
@ -872,15 +883,29 @@ static int __add_code (__builder_t* builder, void* data, xp_size_t len)
|
|||||||
xp_size_t capa = builder->code.capa * 2;
|
xp_size_t capa = builder->code.capa * 2;
|
||||||
xp_byte_t* tmp;
|
xp_byte_t* tmp;
|
||||||
|
|
||||||
if (capa == 0) capa = 1;
|
if (capa == 0) capa = 256;
|
||||||
while (len > capa - builder->code.size) { capa = capa * 2; }
|
while (len > capa - builder->code.size) { capa = capa * 2; }
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
tmp = (xp_byte_t*) xp_realloc (builder->code.buf, capa);
|
tmp = (xp_byte_t*) xp_realloc (builder->code.buf, capa);
|
||||||
if (tmp == XP_NULL)
|
if (tmp == XP_NULL)
|
||||||
{
|
{
|
||||||
builder->errnum = XP_AWK_ENOMEM;
|
builder->errnum = XP_AWK_ENOMEM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
tmp = (xp_byte_t*) xp_malloc (capa);
|
||||||
|
if (tmp == XP_NULL)
|
||||||
|
{
|
||||||
|
builder->errnum = XP_AWK_ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (builder->code.buf != XP_NULL)
|
||||||
|
{
|
||||||
|
xp_memcpy (tmp, builder->code.buf, builder->code.capa);
|
||||||
|
xp_free (builder->code.buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
builder->code.buf = tmp;
|
builder->code.buf = tmp;
|
||||||
builder->code.capa = capa;
|
builder->code.capa = capa;
|
||||||
@ -1454,11 +1479,13 @@ xp_bool_t __test_charset (const xp_byte_t* p, xp_size_t csc, xp_char_t c)
|
|||||||
|
|
||||||
if (c >= c1 && c <= c2) return xp_true;
|
if (c >= c1 && c <= c2) return xp_true;
|
||||||
}
|
}
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
else if (c0 == CHARSET_CLASS)
|
else if (c0 == CHARSET_CLASS)
|
||||||
{
|
{
|
||||||
c1 = *(xp_char_t*)p;
|
c1 = *(xp_char_t*)p;
|
||||||
if (__char_class[c1].func (c)) return xp_true;
|
if (__char_class[c1].func (c)) return xp_true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xp_assert (!"should never happen - invalid charset code");
|
xp_assert (!"should never happen - invalid charset code");
|
||||||
@ -1471,6 +1498,8 @@ xp_bool_t __test_charset (const xp_byte_t* p, xp_size_t csc, xp_char_t c)
|
|||||||
return xp_false;
|
return xp_false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
|
|
||||||
static xp_bool_t __cc_isalnum (xp_char_t c)
|
static xp_bool_t __cc_isalnum (xp_char_t c)
|
||||||
{
|
{
|
||||||
return xp_isalnum (c);
|
return xp_isalnum (c);
|
||||||
@ -1531,6 +1560,12 @@ static xp_bool_t __cc_isxdigit (xp_char_t c)
|
|||||||
return xp_isxdigit (c);
|
return xp_isxdigit (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xp_awk_printrex (void* rex)
|
||||||
|
{
|
||||||
|
__print_pattern (rex);
|
||||||
|
xp_printf (XP_T("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
static const xp_byte_t* __print_pattern (const xp_byte_t* p)
|
static const xp_byte_t* __print_pattern (const xp_byte_t* p)
|
||||||
{
|
{
|
||||||
xp_size_t nb, el, i;
|
xp_size_t nb, el, i;
|
||||||
@ -1660,3 +1695,5 @@ static const xp_byte_t* __print_atom (const xp_byte_t* p)
|
|||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: rex.h,v 1.12 2006-08-16 08:55:43 bacon Exp $
|
* $Id: rex.h,v 1.13 2006-08-16 11:35:53 bacon Exp $
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _XP_AWK_REX_H_
|
#ifndef _XP_AWK_REX_H_
|
||||||
@ -60,7 +60,11 @@ int xp_awk_safematchrex (void* code,
|
|||||||
const xp_char_t** match_ptr, xp_size_t* match_len,
|
const xp_char_t** match_ptr, xp_size_t* match_len,
|
||||||
int max_depth, int* errnum);
|
int max_depth, int* errnum);
|
||||||
|
|
||||||
|
void xp_awk_freerex (void* code);
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
void xp_awk_printrex (void* code);
|
void xp_awk_printrex (void* code);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: run.c,v 1.166 2006-08-13 16:04:32 bacon Exp $
|
* $Id: run.c,v 1.167 2006-08-16 11:35:53 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -4248,13 +4248,25 @@ static int __raw_push (xp_awk_run_t* run, void* val)
|
|||||||
{
|
{
|
||||||
if (run->stack_top >= run->stack_limit)
|
if (run->stack_top >= run->stack_limit)
|
||||||
{
|
{
|
||||||
void* tmp;
|
void** tmp;
|
||||||
xp_size_t n;
|
xp_size_t n;
|
||||||
|
|
||||||
n = run->stack_limit + STACK_INCREMENT;
|
n = run->stack_limit + STACK_INCREMENT;
|
||||||
tmp = (void**) xp_realloc (run->stack, n * xp_sizeof(void*));
|
|
||||||
if (tmp == XP_NULL) return -1;
|
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
|
tmp = (void**) xp_realloc (
|
||||||
|
run->stack, n * xp_sizeof(void*));
|
||||||
|
if (tmp == XP_NULL) return -1;
|
||||||
|
#else
|
||||||
|
tmp = (void**) xp_malloc (n * xp_sizeof(void*));
|
||||||
|
if (tmp == XP_NULL) return -1;
|
||||||
|
if (run->stack != XP_NULL)
|
||||||
|
{
|
||||||
|
xp_memcpy (tmp, run->stack,
|
||||||
|
run->stack_limit * xp_sizeof(void*));
|
||||||
|
xp_free (run->stack);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
run->stack = tmp;
|
run->stack = tmp;
|
||||||
run->stack_limit = n;
|
run->stack_limit = n;
|
||||||
}
|
}
|
||||||
@ -4454,13 +4466,30 @@ static int __recomp_record_fields (xp_awk_run_t* run,
|
|||||||
nflds = run->inrec.nflds;
|
nflds = run->inrec.nflds;
|
||||||
if (max > run->inrec.maxflds)
|
if (max > run->inrec.maxflds)
|
||||||
{
|
{
|
||||||
void* tmp = xp_realloc (
|
void* tmp;
|
||||||
|
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
|
tmp = xp_realloc (
|
||||||
run->inrec.flds, xp_sizeof(*run->inrec.flds) * max);
|
run->inrec.flds, xp_sizeof(*run->inrec.flds) * max);
|
||||||
if (tmp == XP_NULL)
|
if (tmp == XP_NULL)
|
||||||
{
|
{
|
||||||
*errnum = XP_AWK_ENOMEM;
|
*errnum = XP_AWK_ENOMEM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
tmp = xp_malloc (xp_sizeof(*run->inrec.flds) * max);
|
||||||
|
if (tmp == XP_NULL)
|
||||||
|
{
|
||||||
|
*errnum = XP_AWK_ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (run->inrec.flds != XP_NULL)
|
||||||
|
{
|
||||||
|
xp_memcpy (tmp, run->inrec.flds,
|
||||||
|
xp_sizeof(*run->inrec.flds) * run->inrec.maxflds);
|
||||||
|
xp_free (run->inrec.flds);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
run->inrec.flds = tmp;
|
run->inrec.flds = tmp;
|
||||||
run->inrec.maxflds = max;
|
run->inrec.maxflds = max;
|
||||||
|
26
ase/awk/sa.c
26
ase/awk/sa.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sa.c,v 1.29 2006-08-13 16:04:32 bacon Exp $
|
* $Id: sa.c,v 1.30 2006-08-16 11:35:53 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -395,22 +395,34 @@ xp_size_t xp_str_cat (xp_str_t* str, const xp_char_t* s)
|
|||||||
|
|
||||||
xp_size_t xp_str_ncat (xp_str_t* str, const xp_char_t* s, xp_size_t len)
|
xp_size_t xp_str_ncat (xp_str_t* str, const xp_char_t* s, xp_size_t len)
|
||||||
{
|
{
|
||||||
xp_char_t* buf;
|
|
||||||
xp_size_t capa;
|
|
||||||
|
|
||||||
if (len > str->capa - str->size)
|
if (len > str->capa - str->size)
|
||||||
{
|
{
|
||||||
|
xp_char_t* tmp;
|
||||||
|
xp_size_t capa;
|
||||||
|
|
||||||
capa = str->size + len;
|
capa = str->size + len;
|
||||||
|
|
||||||
/* double the capa if necessary for concatenation */
|
/* double the capa if necessary for concatenation */
|
||||||
if (capa < str->capa * 2) capa = str->capa * 2;
|
if (capa < str->capa * 2) capa = str->capa * 2;
|
||||||
|
|
||||||
buf = (xp_char_t*) xp_realloc (
|
#ifndef XP_AWK_NTDDK
|
||||||
|
tmp = (xp_char_t*) xp_realloc (
|
||||||
str->buf, xp_sizeof(xp_char_t) * (capa + 1));
|
str->buf, xp_sizeof(xp_char_t) * (capa + 1));
|
||||||
if (buf == XP_NULL) return (xp_size_t)-1;
|
if (tmp == XP_NULL) return (xp_size_t)-1;
|
||||||
|
#else
|
||||||
|
tmp = (xp_char_t*) xp_malloc (
|
||||||
|
xp_sizeof(xp_char_t) * (capa + 1));
|
||||||
|
if (tmp == XP_NULL) return (xp_size_t)-1;
|
||||||
|
if (str->buf != XP_NULL)
|
||||||
|
{
|
||||||
|
xp_memcpy (tmp, str->buf,
|
||||||
|
xp_sizeof(xp_char_t) * (str->capa + 1));
|
||||||
|
xp_free (str->buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
str->capa = capa;
|
str->capa = capa;
|
||||||
str->buf = buf;
|
str->buf = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
str->size += xp_strncpy (&str->buf[str->size], s, len);
|
str->size += xp_strncpy (&str->buf[str->size], s, len);
|
||||||
|
20
ase/awk/sa.h
20
ase/awk/sa.h
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sa.h,v 1.30 2006-08-16 09:35:21 bacon Exp $
|
* $Id: sa.h,v 1.31 2006-08-16 11:35:54 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_AWK_SA_H_
|
#ifndef _XP_AWK_SA_H_
|
||||||
@ -17,23 +17,12 @@
|
|||||||
|
|
||||||
#ifdef XP_AWK_NTDDK
|
#ifdef XP_AWK_NTDDK
|
||||||
#include <ntddk.h>
|
#include <ntddk.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#ifdef XP_CHAR_IS_MCHAR
|
|
||||||
#include <ctype.h>
|
|
||||||
#else
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define xp_assert ASSERT
|
#define xp_assert ASSERT
|
||||||
|
|
||||||
#define xp_malloc malloc
|
#define xp_malloc(size) ExAllocatePool(PagedPool,size)
|
||||||
#define xp_calloc calloc
|
#define xp_free(ptr) ExFreePool(ptr)
|
||||||
#define xp_realloc realloc
|
|
||||||
#define xp_free free
|
|
||||||
|
|
||||||
#define xp_memset(dst,fill,len) RtlFillMemory(dst,len,fill)
|
#define xp_memset(dst,fill,len) RtlFillMemory(dst,len,fill)
|
||||||
#define xp_memcpy(dst,src,len) RtlCopyMemory(dst,src,len)
|
#define xp_memcpy(dst,src,len) RtlCopyMemory(dst,src,len)
|
||||||
@ -65,8 +54,6 @@
|
|||||||
#define xp_memset(dst,fill,len) memset(dst,fill,len)
|
#define xp_memset(dst,fill,len) memset(dst,fill,len)
|
||||||
#define xp_memcpy(dst,src,len) memcpy(dst,src,len)
|
#define xp_memcpy(dst,src,len) memcpy(dst,src,len)
|
||||||
#define xp_memcmp(src1,src2,len) memcmp(src1,src2,len);
|
#define xp_memcmp(src1,src2,len) memcmp(src1,src2,len);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef XP_CHAR_IS_MCHAR
|
#ifdef XP_CHAR_IS_MCHAR
|
||||||
#define xp_isdigit isdigit
|
#define xp_isdigit isdigit
|
||||||
@ -98,6 +85,7 @@
|
|||||||
#define xp_tolower towlower
|
#define xp_tolower towlower
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#define xp_va_start(pvar,param) va_start(pvar,param)
|
#define xp_va_start(pvar,param) va_start(pvar,param)
|
||||||
#define xp_va_list va_list
|
#define xp_va_list va_list
|
||||||
|
@ -2,7 +2,7 @@ TARGETNAME=xpawk
|
|||||||
TARGETPATH=obj
|
TARGETPATH=obj
|
||||||
TARGETTYPE=DRIVER_LIBRARY
|
TARGETTYPE=DRIVER_LIBRARY
|
||||||
|
|
||||||
SOURCES=awk.c err.c tree.c tab.c map.c parse.c run.c sa.c val.c func.c misc.c extio.c rex.c
|
SOURCES=rex.c err.c
|
||||||
|
|
||||||
C_DEFINES=-D_UNICODE -DXP_AWK_STAND_ALONE -DXP_AWK_NTDDK
|
C_DEFINES=-D_UNICODE -DXP_AWK_STAND_ALONE -DXP_AWK_NTDDK
|
||||||
INCLUDES=..\..
|
INCLUDES=..\..
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: tab.c,v 1.10 2006-08-03 06:06:27 bacon Exp $
|
* $Id: tab.c,v 1.11 2006-08-16 11:35:54 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -62,8 +62,20 @@ xp_awk_tab_t* xp_awk_tab_setcapa (xp_awk_tab_t* tab, xp_size_t capa)
|
|||||||
|
|
||||||
if (capa > 0)
|
if (capa > 0)
|
||||||
{
|
{
|
||||||
|
#ifndef XP_AWK_NTDDK
|
||||||
tmp = xp_realloc (tab->buf, xp_sizeof(*tab->buf) * capa);
|
tmp = xp_realloc (tab->buf, xp_sizeof(*tab->buf) * capa);
|
||||||
if (tmp == XP_NULL) return XP_NULL;
|
if (tmp == XP_NULL) return XP_NULL;
|
||||||
|
#else
|
||||||
|
tmp = xp_malloc (xp_sizeof(*tab->buf) * capa);
|
||||||
|
if (tmp == XP_NULL) return XP_NULL;
|
||||||
|
if (tab->buf != XP_NULL)
|
||||||
|
{
|
||||||
|
xp_size_t x;
|
||||||
|
x = (capa > tab->capa)? tab->capa: capa;
|
||||||
|
xp_memcpy (tmp, tab->buf, xp_sizeof(*tab->buf) * x);
|
||||||
|
xp_free (tab->buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: val.c,v 1.49 2006-08-03 05:05:48 bacon Exp $
|
* $Id: val.c,v 1.50 2006-08-16 11:35:54 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/awk/awk_i.h>
|
#include <xp/awk/awk_i.h>
|
||||||
@ -244,7 +244,7 @@ xp_printf (XP_T("\n"));*/
|
|||||||
|
|
||||||
case XP_AWK_VAL_REX:
|
case XP_AWK_VAL_REX:
|
||||||
xp_free (((xp_awk_val_rex_t*)val)->buf);
|
xp_free (((xp_awk_val_rex_t*)val)->buf);
|
||||||
xp_free (((xp_awk_val_rex_t*)val)->code);
|
xp_awk_freerex (((xp_awk_val_rex_t*)val)->code);
|
||||||
xp_free (val);
|
xp_free (val);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
global a;
|
global a;
|
||||||
BEGIN
|
BEGIN {
|
||||||
{
|
|
||||||
local b;
|
local b;
|
||||||
|
|
||||||
//a = 20;
|
//a = 20;
|
||||||
|
Loading…
Reference in New Issue
Block a user