- fixed a bug of not handling nextfile and nextofile when no files are specified in the standard console handler

(awk/std.c)
- enhanced the console handler for StdAwk
This commit is contained in:
2009-07-08 07:05:10 +00:00
parent 8a61d58b7b
commit b682392d5f
7 changed files with 394 additions and 650 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp 223 2009-07-06 12:37:25Z hyunghwan.chung $
* $Id: Awk.hpp 224 2009-07-07 13:05:10Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -206,6 +206,7 @@ public:
operator Awk* () const;
operator awk_t* () const;
operator rio_arg_t* () const;
operator Run* () const;
operator rtx_t* () const;
protected:
@ -1061,12 +1062,19 @@ protected:
bool runCallback;
struct
struct xstrs_t
{
xstrs_t (): ptr (QSE_NULL), len (0), capa (0) {}
int add (awk_t* awk, const char_t* arg, size_t len);
void clear (awk_t* awk);
qse_xstr_t* ptr;
size_t len;
size_t capa;
} runarg;
};
xstrs_t runarg;
private:
static const char_t* xerrstr (awk_t* a, errnum_t num) throw ();

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.hpp 220 2009-07-01 13:14:39Z hyunghwan.chung $
* $Id: StdAwk.hpp 224 2009-07-07 13:05:10Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -39,6 +39,11 @@ class StdAwk: public Awk
{
public:
int open ();
void close ();
virtual int addConsoleOutput (const char_t* arg, size_t len);
virtual int addConsoleOutput (const char_t* arg);
virtual void clearConsoleOutputs ();
protected:
@ -82,7 +87,6 @@ protected:
ssize_t writeFile (File& io, const char_t* buf, size_t len);
int flushFile (File& io);
#if 0
// console io handlers
int openConsole (Console& io);
int closeConsole (Console& io);
@ -90,7 +94,6 @@ protected:
ssize_t writeConsole (Console& io, const char_t* buf, size_t len);
int flushConsole (Console& io);
int nextConsole (Console& io);
#endif
// primitive handlers
void* allocMem (size_t n) throw ();
@ -103,7 +106,19 @@ protected:
protected:
unsigned int seed;
/* standard input console - reuse runarg */
size_t runarg_index;
size_t runarg_count;
/* standard output console */
xstrs_t ofile;
size_t ofile_index;
size_t ofile_count;
private:
int open_console_in (Console& io);
int open_console_out (Console& io);
};
/////////////////////////////////