*** empty log message ***

This commit is contained in:
hyung-hwan 2006-05-10 16:02:39 +00:00
parent cb87b084ce
commit 131dc2f77f
4 changed files with 37 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c,v 1.47 2006-04-24 15:34:52 bacon Exp $
* $Id: awk.c,v 1.48 2006-05-10 16:02:38 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -75,6 +75,8 @@ xp_awk_t* xp_awk_open (void)
awk->lex.curc = XP_CHAR_EOF;
awk->lex.ungotc_count = 0;
awk->lex.buf_pos = 0;
awk->lex.buf_len = 0;
return awk;
}
@ -165,6 +167,8 @@ int xp_awk_attsrc (xp_awk_t* awk, xp_awk_io_t src, void* arg)
awk->srcio_arg = arg;
awk->lex.curc = XP_CHAR_EOF;
awk->lex.ungotc_count = 0;
awk->lex.buf_pos = 0;
awk->lex.buf_len = 0;
return 0;
}
@ -185,6 +189,8 @@ int xp_awk_detsrc (xp_awk_t* awk)
awk->srcio_arg = XP_NULL;
awk->lex.curc = XP_CHAR_EOF;
awk->lex.ungotc_count = 0;
awk->lex.buf_pos = 0;
awk->lex.buf_len = 0;
}
return 0;

View File

@ -1,5 +1,5 @@
/*
* $Id: awk_i.h,v 1.8 2006-04-22 13:54:52 bacon Exp $
* $Id: awk_i.h,v 1.9 2006-05-10 16:02:39 bacon Exp $
*/
#ifndef _XP_AWK_AWKI_H_
@ -96,6 +96,10 @@ struct xp_awk_t
xp_cint_t curc;
xp_cint_t ungotc[5];
xp_size_t ungotc_count;
xp_char_t buf[512];
xp_size_t buf_pos;
xp_size_t buf_len;
} lex;
/* token */

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c,v 1.102 2006-05-07 17:45:08 bacon Exp $
* $Id: parse.c,v 1.103 2006-05-10 16:02:39 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -3131,6 +3131,7 @@ static int __get_char (xp_awk_t* awk)
return 0;
}
/*
n = awk->srcio (XP_AWK_INPUT_DATA, awk->srcio_arg, &c, 1);
if (n == -1)
{
@ -3138,7 +3139,28 @@ static int __get_char (xp_awk_t* awk)
return -1;
}
awk->lex.curc = (n == 0)? XP_CHAR_EOF: c;
*/
if (awk->lex.buf_pos >= awk->lex.buf_len)
{
n = awk->srcio (XP_AWK_INPUT_DATA,
awk->srcio_arg, awk->lex.buf, xp_countof(awk->lex.buf));
if (n == -1)
{
awk->errnum = XP_AWK_ESRCINDATA;
return -1;
}
if (n == 0)
{
awk->lex.curc = XP_CHAR_EOF;
return 0;
}
awk->lex.buf_pos = 0;
awk->lex.buf_len = n;
}
awk->lex.curc = awk->lex.buf[awk->lex.buf_pos++];
return 0;
}

View File

@ -17,3 +17,4 @@ BEGIN {
s = sum (100);
}