fixed bugs in handling @include

This commit is contained in:
2009-08-10 21:29:59 +00:00
parent 8059913da3
commit 9eb2c2da4c
11 changed files with 252 additions and 91 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp 249 2009-08-07 13:35:24Z hyunghwan.chung $
* $Id: Awk.hpp 250 2009-08-10 03:29:59Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -275,17 +275,15 @@ public:
* The Awk::Source::Data class is used to deliver information
* needed for source script I/O.
*/
class Data: protected qse_awk_sio_arg_t
class Data: protected sio_arg_t
{
public:
friend class Awk;
protected:
Data (Awk* awk, Mode mode):
awk (awk), mode (mode)
Data (Awk* awk, Mode mode, sio_arg_t* arg):
awk (awk), mode (mode), arg (arg)
{
this->name = QSE_NULL;
this->handle = QSE_NULL;
}
public:
@ -296,17 +294,17 @@ public:
const char_t* getName() const
{
return this->name;
return arg->name;
}
const void* getHandle () const
{
return this->handle;
return arg->handle;
}
void setHandle (void* handle)
{
this->handle = handle;
arg->handle = handle;
}
operator Awk* () const
@ -322,6 +320,7 @@ public:
protected:
Awk* awk;
Mode mode;
sio_arg_t* arg;
};
Source () {}
@ -1090,9 +1089,6 @@ protected:
map_t* functionMap;
Source::Data sourceIn;
Source::Data sourceOut;
Source* sourceReader;
Source* sourceWriter;

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.hpp 235 2009-07-15 10:43:31Z hyunghwan.chung $
* $Id: StdAwk.hpp 250 2009-08-10 03:29:59Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -45,7 +45,10 @@ public:
class SourceFile: public Source
{
public:
SourceFile (const char_t* name): name (name) {}
SourceFile (const char_t* name): name (name)
{
dir.ptr = QSE_NULL; dir.len = 0;
}
int open (Data& io);
int close (Data& io);
@ -54,6 +57,7 @@ public:
protected:
const char_t* name;
qse_cstr_t dir;
};
class SourceString: public Source

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h 249 2009-08-07 13:35:24Z hyunghwan.chung $
* $Id: awk.h 250 2009-08-10 03:29:59Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -271,12 +271,21 @@ enum qse_awk_sio_cmd_t
};
typedef enum qse_awk_sio_cmd_t qse_awk_sio_cmd_t;
typedef struct qse_awk_sio_lxc_t qse_awk_sio_lxc_t;
struct qse_awk_sio_lxc_t
{
qse_cint_t c;
qse_size_t lin;
qse_size_t col;
const qse_char_t* file;
};
struct qse_awk_sio_arg_t
{
const qse_char_t* name; /**< [IN] name of I/O object */
void* handle; /**< [OUT] I/O handle set by a handler */
/*-- from here down, internal use only --*/
/*-- from here down, internal use only --*/
struct
{
qse_char_t buf[1024];
@ -287,6 +296,7 @@ struct qse_awk_sio_arg_t
qse_size_t lin;
qse_size_t col;
qse_awk_sio_lxc_t last;
struct qse_awk_sio_arg_t* next;
};
typedef struct qse_awk_sio_arg_t qse_awk_sio_arg_t;