*** empty log message ***

This commit is contained in:
hyung-hwan 2006-06-13 04:26:24 +00:00
parent 8dd2ceb931
commit 6ddd8df782
2 changed files with 69 additions and 51 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: tree.c,v 1.50 2006-06-12 15:11:02 bacon Exp $
* $Id: tree.c,v 1.51 2006-06-13 04:26:24 bacon Exp $
*/
#include <xp/awk/awk_i.h>

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c,v 1.34 2006-05-13 16:33:07 bacon Exp $
* $Id: awk.c,v 1.35 2006-06-13 04:26:24 bacon Exp $
*/
#include <xp/awk/awk.h>
@ -35,13 +35,17 @@ static xp_ssize_t process_source (
{
xp_char_t c;
switch (cmd) {
switch (cmd)
{
case XP_AWK_INPUT_OPEN:
case XP_AWK_INPUT_CLOSE:
case XP_AWK_INPUT_NEXT:
{
return 0;
}
case XP_AWK_INPUT_DATA:
{
if (size <= 0) return -1;
#ifdef XP_CHAR_IS_MCHAR
c = fgetc (stdin);
@ -51,13 +55,16 @@ static xp_ssize_t process_source (
if (c == XP_CHAR_EOF) return 0;
*data = c;
return 1;
}
case XP_AWK_OUTPUT_OPEN:
case XP_AWK_OUTPUT_CLOSE:
case XP_AWK_OUTPUT_NEXT:
case XP_AWK_OUTPUT_DATA:
{
return 0;
}
}
return -1;
}
@ -74,22 +81,30 @@ static xp_ssize_t process_data (
struct data_io* io = (struct data_io*)arg;
xp_char_t c;
switch (cmd) {
switch (cmd)
{
case XP_AWK_INPUT_OPEN:
{
io->input_handle = fopen (io->input_file, "r");
if (io->input_handle == NULL) return -1;
return 0;
}
case XP_AWK_INPUT_CLOSE:
{
fclose (io->input_handle);
io->input_handle = NULL;
return 0;
}
case XP_AWK_INPUT_NEXT:
{
/* input switching not supported for the time being... */
return -1;
}
case XP_AWK_INPUT_DATA:
{
if (size <= 0) return -1;
#ifdef XP_CHAR_IS_MCHAR
c = fgetc (io->input_handle);
@ -99,13 +114,16 @@ static xp_ssize_t process_data (
if (c == XP_CHAR_EOF) return 0;
*data = c;
return 1;
}
case XP_AWK_OUTPUT_OPEN:
case XP_AWK_OUTPUT_CLOSE:
case XP_AWK_OUTPUT_NEXT:
case XP_AWK_OUTPUT_DATA:
{
return -1;
}
}
return -1;
}