*** empty log message ***

This commit is contained in:
hyung-hwan 2006-08-31 15:22:40 +00:00
parent 43e2f30969
commit c450eb2ac1
5 changed files with 33 additions and 22 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: func.c,v 1.36 2006-08-31 14:52:12 bacon Exp $
* $Id: func.c,v 1.37 2006-08-31 15:22:13 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -509,7 +509,7 @@ static int __bfn_substr (xp_awk_t* awk, void* run)
if (lcount < 0) lcount = 0;
else if (lcount > len - lindex) lcount = len - lindex;
r = xp_awk_makestrval (&str[lindex], (xp_size_t)lcount);
r = xp_awk_makestrval (run, &str[lindex], (xp_size_t)lcount);
if (r == XP_NULL)
{
if (a0->type != XP_AWK_VAL_STR) XP_AWK_FREE (awk, str);
@ -600,7 +600,7 @@ static int __bfn_split (xp_awk_t* awk, void* run)
xp_assert ((tok != XP_NULL && tok_len > 0) || tok_len == 0);
/* create the field string */
t2 = xp_awk_makestrval (tok, tok_len);
t2 = xp_awk_makestrval (run, tok, tok_len);
if (t2 == XP_NULL)
{
if (a0->type != XP_AWK_VAL_STR) XP_AWK_FREE (awk, str);
@ -681,7 +681,7 @@ static int __bfn_tolower (xp_awk_t* awk, void* run)
for (i = 0; i < len; i++) str[i] = xp_tolower(str[i]);
r = xp_awk_makestrval (str, len);
r = xp_awk_makestrval (run, str, len);
if (r == XP_NULL)
{
if (a0->type != XP_AWK_VAL_STR) XP_AWK_FREE (awk, str);
@ -724,7 +724,7 @@ static int __bfn_toupper (xp_awk_t* awk, void* run)
for (i = 0; i < len; i++) str[i] = xp_toupper(str[i]);
r = xp_awk_makestrval (str, len);
r = xp_awk_makestrval (run, str, len);
if (r == XP_NULL)
{
if (a0->type != XP_AWK_VAL_STR) XP_AWK_FREE (awk, str);

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c,v 1.187 2006-08-31 14:52:12 bacon Exp $
* $Id: run.c,v 1.188 2006-08-31 15:22:13 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -1356,7 +1356,8 @@ static int __walk_foreach (xp_awk_pair_t* pair, void* arg)
struct __foreach_walker_t* w = (struct __foreach_walker_t*)arg;
xp_awk_val_t* str;
str = (xp_awk_val_t*)xp_awk_makestrval(pair->key,xp_strlen(pair->key));
str = (xp_awk_val_t*) xp_awk_makestrval (
w->run, pair->key, xp_strlen(pair->key));
if (str == XP_NULL) PANIC_I (w->run, XP_AWK_ENOMEM);
xp_awk_refupval (str);
@ -2260,6 +2261,7 @@ static xp_awk_val_t* __do_assignment_pos (
else
{
v = xp_awk_makestrval (
run,
XP_STR_BUF(&run->inrec.line),
XP_STR_LEN(&run->inrec.line));
if (v == XP_NULL)
@ -2297,6 +2299,7 @@ static xp_awk_val_t* __do_assignment_pos (
/* recompose $0 */
v = xp_awk_makestrval (
run,
XP_STR_BUF(&run->inrec.line),
XP_STR_LEN(&run->inrec.line));
if (v == XP_NULL)
@ -3198,7 +3201,7 @@ static xp_awk_val_t* __eval_binop_concat (
PANIC (run, errnum);
}
res = xp_awk_makestrval2 (strl, strl_len, strr, strr_len);
res = xp_awk_makestrval2 (run, strl, strl_len, strr, strr_len);
if (res == XP_NULL)
{
XP_AWK_FREE (run->awk, strl);
@ -4279,6 +4282,7 @@ static xp_awk_val_t* __eval_str (xp_awk_run_t* run, xp_awk_nde_t* nde)
xp_awk_val_t* val;
val = xp_awk_makestrval (
run,
((xp_awk_nde_str_t*)nde)->buf,
((xp_awk_nde_str_t*)nde)->len);
if (val == XP_NULL) PANIC (run, XP_AWK_ENOMEM);
@ -4291,6 +4295,7 @@ static xp_awk_val_t* __eval_rex (xp_awk_run_t* run, xp_awk_nde_t* nde)
xp_awk_val_t* val;
val = xp_awk_makerexval (
run,
((xp_awk_nde_rex_t*)nde)->buf,
((xp_awk_nde_rex_t*)nde)->len,
((xp_awk_nde_rex_t*)nde)->code);
@ -4534,7 +4539,7 @@ static xp_awk_val_t* __eval_getline (xp_awk_run_t* run, xp_awk_nde_t* nde)
xp_awk_val_t* v;
v = xp_awk_makestrval (
XP_STR_BUF(&buf), XP_STR_LEN(&buf));
run, XP_STR_BUF(&buf), XP_STR_LEN(&buf));
xp_str_close (&buf);
@ -4637,7 +4642,7 @@ static int __set_record (xp_awk_run_t* run, const xp_char_t* str, xp_size_t len)
xp_awk_val_t* v;
int errnum;
v = xp_awk_makestrval (str, len);
v = xp_awk_makestrval (run, str, len);
if (v == XP_NULL)
{
__clear_record (run, xp_false);
@ -4776,7 +4781,7 @@ static int __split_record (xp_awk_run_t* run)
run->inrec.flds[run->inrec.nflds].ptr = tok;
run->inrec.flds[run->inrec.nflds].len = tok_len;
run->inrec.flds[run->inrec.nflds].val =
xp_awk_makestrval (tok, tok_len);
xp_awk_makestrval (run, tok, tok_len);
if (run->inrec.flds[run->inrec.nflds].val == XP_NULL)
PANIC_I (run, XP_AWK_ENOMEM);
@ -4937,7 +4942,7 @@ static int __recomp_record_fields (
return -1;
}
tmp = xp_awk_makestrval (str,len);
tmp = xp_awk_makestrval (run, str,len);
if (tmp == XP_NULL)
{
if (ofsp != XP_NULL) XP_AWK_FREE (run->awk, ofsp);

View File

@ -1,5 +1,5 @@
/*
* $Id: val.c,v 1.52 2006-08-21 02:53:42 bacon Exp $
* $Id: val.c,v 1.53 2006-08-31 15:22:13 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -86,12 +86,13 @@ xp_awk_val_t* xp_awk_makerealval (xp_awk_run_t* run, xp_real_t v)
return (xp_awk_val_t*)val;
}
xp_awk_val_t* xp_awk_makestrval0 (const xp_char_t* str)
xp_awk_val_t* xp_awk_makestrval0 (xp_awk_run_t* run, const xp_char_t* str)
{
return xp_awk_makestrval (str, xp_strlen(str));
return xp_awk_makestrval (run, str, xp_strlen(str));
}
xp_awk_val_t* xp_awk_makestrval (const xp_char_t* str, xp_size_t len)
xp_awk_val_t* xp_awk_makestrval (
xp_awk_run_t* run, const xp_char_t* str, xp_size_t len)
{
xp_awk_val_str_t* val;
@ -113,6 +114,7 @@ xp_awk_val_t* xp_awk_makestrval (const xp_char_t* str, xp_size_t len)
}
xp_awk_val_t* xp_awk_makestrval2 (
xp_awk_run_t* run,
const xp_char_t* str1, xp_size_t len1,
const xp_char_t* str2, xp_size_t len2)
{
@ -136,7 +138,7 @@ xp_awk_val_t* xp_awk_makestrval2 (
}
xp_awk_val_t* xp_awk_makerexval (
const xp_char_t* buf, xp_size_t len, void* code)
xp_awk_run_t* run, const xp_char_t* buf, xp_size_t len, void* code)
{
xp_awk_val_rex_t* val;

View File

@ -1,5 +1,5 @@
/*
* $Id: val.h,v 1.36 2006-08-20 15:49:07 bacon Exp $
* $Id: val.h,v 1.37 2006-08-31 15:22:13 bacon Exp $
*/
#ifndef _XP_AWK_VAL_H_
@ -125,13 +125,17 @@ extern xp_awk_val_t* xp_awk_val_one;
xp_awk_val_t* xp_awk_makeintval (xp_awk_run_t* run, xp_long_t v);
xp_awk_val_t* xp_awk_makerealval (xp_awk_run_t* run, xp_real_t v);
xp_awk_val_t* xp_awk_makestrval0 (const xp_char_t* str);
xp_awk_val_t* xp_awk_makestrval (const xp_char_t* str, xp_size_t len);
xp_awk_val_t* xp_awk_makestrval0 (xp_awk_run_t* run, const xp_char_t* str);
xp_awk_val_t* xp_awk_makestrval (
xp_awk_run_t* run, const xp_char_t* str, xp_size_t len);
xp_awk_val_t* xp_awk_makestrval2 (
xp_awk_run_t* run,
const xp_char_t* str1, xp_size_t len1,
const xp_char_t* str2, xp_size_t len2);
xp_awk_val_t* xp_awk_makerexval (
const xp_char_t* buf, xp_size_t len, void* code);
xp_awk_run_t* run, const xp_char_t* buf, xp_size_t len, void* code);
xp_awk_val_t* xp_awk_makemapval (xp_awk_run_t* run);
xp_awk_val_t* xp_awk_makerefval (
xp_awk_run_t* run, int id, xp_awk_val_t** adr);

View File

@ -1,4 +1,4 @@
//global x, j;
#global x, j;
func func1 (x)
{