diff --git a/ase/awk/awk.h b/ase/awk/awk.h index 1f4fd39b..baeb8c5a 100644 --- a/ase/awk/awk.h +++ b/ase/awk/awk.h @@ -1,5 +1,5 @@ /* - * $Id: awk.h,v 1.58 2006-04-26 15:49:33 bacon Exp $ + * $Id: awk.h,v 1.59 2006-04-30 15:50:38 bacon Exp $ */ #ifndef _XP_AWK_AWK_H_ @@ -51,6 +51,7 @@ enum XP_AWK_ENOERR, /* no error */ XP_AWK_ENOMEM, /* out of memory */ + XP_AWK_ENOSRCIO, /* no source io handler set */ XP_AWK_ESRCINOPEN, XP_AWK_ESRCINCLOSE, XP_AWK_ESRCINNEXT, diff --git a/ase/awk/err.c b/ase/awk/err.c index ee40ee77..13863664 100644 --- a/ase/awk/err.c +++ b/ase/awk/err.c @@ -1,5 +1,5 @@ /* - * $Id: err.c,v 1.16 2006-04-26 15:49:33 bacon Exp $ + * $Id: err.c,v 1.17 2006-04-30 15:50:38 bacon Exp $ */ #include @@ -16,6 +16,7 @@ const xp_char_t* xp_awk_geterrstr (xp_awk_t* awk) XP_TEXT("no error"), XP_TEXT("out of memory"), + XP_TEXT("no source io handler set"), XP_TEXT("cannot open source input"), XP_TEXT("cannot close source input"), XP_TEXT("cannot switch to next source input"), diff --git a/ase/awk/parse.c b/ase/awk/parse.c index e311dbf7..6deaee2e 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c,v 1.96 2006-04-29 12:41:47 bacon Exp $ + * $Id: parse.c,v 1.97 2006-04-30 15:50:38 bacon Exp $ */ #include @@ -330,6 +330,13 @@ static void __dump (xp_awk_t* awk) int xp_awk_parse (xp_awk_t* awk) { + + if (awk->srcio == XP_NULL) + { + awk->errnum = XP_AWK_ENOSRCIO; + return -1; + } + /* if you want to parse anew, call xp_awk_clear first. * otherwise, the result is appened to the accumulated result */