*** empty log message ***
This commit is contained in:
parent
a926eb0ae7
commit
4b33fba56f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk_i.h,v 1.80 2006-11-16 15:16:24 bacon Exp $
|
||||
* $Id: awk_i.h,v 1.81 2006-11-17 07:04:31 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_AWKI_H_
|
||||
@ -195,9 +195,9 @@ struct ase_awk_run_t
|
||||
ase_size_t stack_limit;
|
||||
int exit_level;
|
||||
|
||||
ase_awk_val_int_t* icache[100]; /* TODO: choose the optimal size */
|
||||
ase_awk_val_real_t* rcache[100]; /* TODO: choose the optimal size */
|
||||
ase_awk_val_ref_t* fcache[100]; /* TODO: choose the optimal size */
|
||||
ase_awk_val_int_t* icache[200]; /* TODO: choose the optimal size */
|
||||
ase_awk_val_real_t* rcache[200]; /* TODO: choose the optimal size */
|
||||
ase_awk_val_ref_t* fcache[200]; /* TODO: choose the optimal size */
|
||||
ase_size_t icache_count;
|
||||
ase_size_t rcache_count;
|
||||
ase_size_t fcache_count;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parse.c,v 1.202 2006-11-13 15:08:17 bacon Exp $
|
||||
* $Id: parse.c,v 1.203 2006-11-17 07:04:31 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -4376,6 +4376,11 @@ static int __deparse (ase_awk_t* awk)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (chain->pattern != ASE_NULL)
|
||||
{
|
||||
if (__put_char (awk, ASE_T(' ')) == -1)
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
}
|
||||
if (ase_awk_prnpt (awk, chain->action) == -1)
|
||||
EXIT_DEPARSE (ASE_AWK_ESRCOUTWRITE);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: run.c,v 1.263 2006-11-16 15:16:25 bacon Exp $
|
||||
* $Id: run.c,v 1.264 2006-11-17 07:04:31 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -1149,7 +1149,8 @@ static int __run_main (ase_awk_run_t* run, ase_awk_runarg_t* runarg)
|
||||
}
|
||||
|
||||
if (n == 0 &&
|
||||
run->awk->tree.chain != ASE_NULL &&
|
||||
(run->awk->tree.chain != ASE_NULL ||
|
||||
run->awk->tree.end != ASE_NULL) &&
|
||||
run->exit_level != EXIT_ABORT)
|
||||
{
|
||||
if (__run_pattern_blocks (run) == -1) n = -1;
|
||||
@ -1197,7 +1198,7 @@ static int __run_main (ase_awk_run_t* run, ase_awk_runarg_t* runarg)
|
||||
}
|
||||
|
||||
/* pops off the global variables */
|
||||
nglobals = run->awk->tree.nglobals; /*run->nglobals */
|
||||
nglobals = run->awk->tree.nglobals;
|
||||
while (nglobals > 0)
|
||||
{
|
||||
--nglobals;
|
||||
@ -1252,15 +1253,19 @@ static int __run_pattern_blocks (ase_awk_run_t* run)
|
||||
|
||||
__update_fnr (run, run->global.fnr + 1);
|
||||
|
||||
if (__run_pattern_block_chain (run, run->awk->tree.chain) == -1)
|
||||
if (run->awk->tree.chain != ASE_NULL)
|
||||
{
|
||||
int saved = run->errnum;
|
||||
if (__run_pattern_block_chain (
|
||||
run, run->awk->tree.chain) == -1)
|
||||
{
|
||||
int saved = run->errnum;
|
||||
|
||||
ase_awk_closeextio_read (
|
||||
run, ASE_AWK_IN_CONSOLE, ASE_T(""));
|
||||
ase_awk_closeextio_read (
|
||||
run, ASE_AWK_IN_CONSOLE, ASE_T(""));
|
||||
|
||||
run->errnum = saved;
|
||||
return -1;
|
||||
run->errnum = saved;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1428,6 +1433,18 @@ static int __run_block (ase_awk_run_t* run, ase_awk_nde_blk_t* nde)
|
||||
else return -1;
|
||||
}
|
||||
|
||||
n = ase_awk_writeextio_str (
|
||||
run, ASE_AWK_OUT_CONSOLE, ASE_T(""),
|
||||
run->global.ors.ptr, run->global.ors.len);
|
||||
if (n == -1)
|
||||
{
|
||||
ase_awk_refdownval (run, run->inrec.d0);
|
||||
|
||||
if (run->errnum == ASE_AWK_EIOHANDLER)
|
||||
PANIC_I (run, ASE_AWK_ECONOUTDATA);
|
||||
else return -1;
|
||||
}
|
||||
|
||||
ase_awk_refdownval (run, run->inrec.d0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tree.c,v 1.86 2006-11-01 04:41:01 bacon Exp $
|
||||
* $Id: tree.c,v 1.87 2006-11-17 07:04:32 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -273,11 +273,36 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde)
|
||||
|
||||
case ASE_AWK_NDE_STR:
|
||||
{
|
||||
/* TODO: ESCAPING */
|
||||
ase_char_t* ptr;
|
||||
ase_size_t len, i;
|
||||
|
||||
PUT_SRCSTR (awk, ASE_T("\""));
|
||||
/*
|
||||
PUT_SRCSTRX (awk,
|
||||
((ase_awk_nde_str_t*)nde)->buf,
|
||||
((ase_awk_nde_str_t*)nde)->len);
|
||||
*/
|
||||
|
||||
ptr = ((ase_awk_nde_str_t*)nde)->buf;
|
||||
len = ((ase_awk_nde_str_t*)nde)->len;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
/* TODO: more deescaping */
|
||||
if (ptr[i] == ASE_T('\n'))
|
||||
PUT_SRCSTR (awk, ASE_T("\\n"));
|
||||
else if (ptr[i] == ASE_T('\r'))
|
||||
PUT_SRCSTR (awk, ASE_T("\\r"));
|
||||
else if (ptr[i] == ASE_T('\f'))
|
||||
PUT_SRCSTR (awk, ASE_T("\\f"));
|
||||
else if (ptr[i] == ASE_T('\b'))
|
||||
PUT_SRCSTR (awk, ASE_T("\\b"));
|
||||
else if (ptr[i] == ASE_T('\v'))
|
||||
PUT_SRCSTR (awk, ASE_T("\\v"));
|
||||
else if (ptr[i] == ASE_T('\a'))
|
||||
PUT_SRCSTR (awk, ASE_T("\\a"));
|
||||
else
|
||||
PUT_SRCSTRX (awk, &ptr[i], 1);
|
||||
}
|
||||
PUT_SRCSTR (awk, ASE_T("\""));
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: val.c,v 1.87 2006-11-16 15:16:25 bacon Exp $
|
||||
* $Id: val.c,v 1.88 2006-11-17 07:04:32 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -631,6 +631,7 @@ static ase_char_t* __val_real_to_str (
|
||||
{
|
||||
ase_awk_str_close (&fbu);
|
||||
ase_awk_str_forfeit (&out);
|
||||
if (len != ASE_NULL) *len = tmp_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
2
ase/test/awk/emp-021.awk
Normal file
2
ase/test/awk/emp-021.awk
Normal file
@ -0,0 +1,2 @@
|
||||
{ names = names $1 " "; }
|
||||
END { print names; }
|
2
ase/test/awk/emp-022.awk
Normal file
2
ase/test/awk/emp-022.awk
Normal file
@ -0,0 +1,2 @@
|
||||
{ last = $0; }
|
||||
END { print last; }
|
1
ase/test/awk/emp-023.awk
Normal file
1
ase/test/awk/emp-023.awk
Normal file
@ -0,0 +1 @@
|
||||
{ print $1, length($1); }
|
4
ase/test/awk/emp-024.awk
Normal file
4
ase/test/awk/emp-024.awk
Normal file
@ -0,0 +1,4 @@
|
||||
{ nc = nc + length($0) + 1;
|
||||
nw = nw + NF;
|
||||
}
|
||||
END { print NR, "lines,", nw, "words,", nc, "characters"; }
|
6
ase/test/awk/emp.data
Normal file
6
ase/test/awk/emp.data
Normal file
@ -0,0 +1,6 @@
|
||||
Beth 4.00 0
|
||||
Dan 3.74 0
|
||||
Kathy 4.00 10
|
||||
Mark 5.00 20
|
||||
Mary 5.50 22
|
||||
Susie 4.25 18
|
Loading…
x
Reference in New Issue
Block a user