added QSE_SIO_KEEPPATH and qse_sio_getpath().
fixed a file inclusion bug in awk and xli
This commit is contained in:
@ -207,21 +207,19 @@ public:
|
||||
return this->mode;
|
||||
}
|
||||
|
||||
int getFlags () const
|
||||
{
|
||||
return arg->flags;
|
||||
}
|
||||
|
||||
const char_t* getName() const
|
||||
{
|
||||
return this->arg->name;
|
||||
}
|
||||
|
||||
// since it doesn't copy the contents,
|
||||
// it should point to something that outlives this object.
|
||||
void setName (const char_t* name)
|
||||
const char_t* getPrevName() const
|
||||
{
|
||||
this->arg->name = name;
|
||||
return this->arg->prev->name;
|
||||
}
|
||||
|
||||
const void* getPrevHandle() const
|
||||
{
|
||||
return this->arg->prev->handle;
|
||||
}
|
||||
|
||||
void* getHandle () const
|
||||
|
@ -505,21 +505,10 @@ enum qse_awk_sio_arg_flag_t
|
||||
typedef struct qse_awk_sio_arg_t qse_awk_sio_arg_t;
|
||||
struct qse_awk_sio_arg_t
|
||||
{
|
||||
/**
|
||||
* [IN] bitwise-ORed of #qse_awk_sio_arg_flag_t.
|
||||
* The field is set with #QSE_AWK_SIO_INCLUDED if an included file
|
||||
* is handled.
|
||||
*/
|
||||
int flags;
|
||||
|
||||
/**
|
||||
* [IN/OUT] name of I/O object.
|
||||
* if #QSE_AWK_SIO_INCLUDED is not set, the name is set to #QSE_NULL.
|
||||
* the source stream handler(#qse_awk_sio_impl_t) can change this field
|
||||
* to give useful information back to the parser.
|
||||
*
|
||||
* if #QSE_AWK_SIO_INCLUDED is set in the flags field,
|
||||
* the name field is set to the name of the included file.
|
||||
* It is #QSE_NULL for the top-level stream. It points to a stream name
|
||||
* for an included stream.
|
||||
*/
|
||||
const qse_char_t* name;
|
||||
|
||||
@ -531,6 +520,12 @@ struct qse_awk_sio_arg_t
|
||||
*/
|
||||
void* handle;
|
||||
|
||||
/**
|
||||
* [IN] points to the includer. #QSE_NULL for the toplevel.
|
||||
*
|
||||
*/
|
||||
qse_awk_sio_arg_t* prev;
|
||||
|
||||
/*-- from here down, internal use only --*/
|
||||
struct
|
||||
{
|
||||
@ -543,7 +538,6 @@ struct qse_awk_sio_arg_t
|
||||
qse_size_t colm;
|
||||
|
||||
qse_awk_sio_lxc_t last;
|
||||
qse_awk_sio_arg_t* next;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,7 @@ enum qse_sio_flag_t
|
||||
* the range is represented by QSE_FIO_RESERVED. */
|
||||
QSE_SIO_IGNOREMBWCERR = (1 << 1),
|
||||
QSE_SIO_NOAUTOFLUSH = (1 << 2),
|
||||
QSE_SIO_KEEPPATH = (1 << 3),
|
||||
|
||||
/* ensure that the following enumerators are one of
|
||||
* qse_fio_flags_t enumerators */
|
||||
@ -112,6 +113,8 @@ struct qse_sio_t
|
||||
qse_mchar_t inbuf[2048];
|
||||
qse_mchar_t outbuf[2048];
|
||||
|
||||
qse_char_t* path;
|
||||
|
||||
#if defined(_WIN32)
|
||||
int status;
|
||||
#endif
|
||||
@ -195,6 +198,15 @@ QSE_EXPORT qse_ubi_t qse_sio_gethandleasubi (
|
||||
const qse_sio_t* sio
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sio_getpath() returns the file path used to open the stream.
|
||||
* It returns #QSE_NULL if #QSE_SIO_HANDLE was on or #QSE_SIO_KEEPPATH
|
||||
* was off at the time of opening.
|
||||
*/
|
||||
QSE_EXPORT const qse_char_t* qse_sio_getpath (
|
||||
qse_sio_t* sio
|
||||
);
|
||||
|
||||
QSE_EXPORT qse_ssize_t qse_sio_flush (
|
||||
qse_sio_t* sio
|
||||
);
|
||||
|
@ -614,6 +614,12 @@ typedef int qse_mcint_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef struct qse_link_t qse_link_t;
|
||||
struct qse_link_t
|
||||
{
|
||||
qse_link_t* link;
|
||||
};
|
||||
|
||||
/**
|
||||
* The qse_mxstr_t type defines a structure combining a pointer to a character
|
||||
* string and the number of characters. It is designed to be interchangeable
|
||||
|
@ -227,29 +227,13 @@ struct qse_xli_io_lxc_t
|
||||
const qse_char_t* file; /**< file */
|
||||
};
|
||||
|
||||
enum qse_xli_io_arg_flag_t
|
||||
{
|
||||
QSE_XLI_IO_INCLUDED = (1 << 0)
|
||||
};
|
||||
|
||||
typedef struct qse_xli_io_arg_t qse_xli_io_arg_t;
|
||||
struct qse_xli_io_arg_t
|
||||
{
|
||||
/**
|
||||
* [IN] bitwise-ORed of #qse_xli_io_arg_flag_t.
|
||||
* The field is set with #QSE_XLI_SIO_INCLUDED if an included file
|
||||
* is handled.
|
||||
*/
|
||||
int flags;
|
||||
|
||||
/**
|
||||
* [IN/OUT] name of I/O object.
|
||||
* if #QSE_XLI_SIO_INCLUDED is not set, the name is set to #QSE_NULL.
|
||||
* the source stream handler(#qse_xli_io_impl_t) can change this field
|
||||
* to give useful information back to the parser.
|
||||
*
|
||||
* if #QSE_XLI_SIO_INCLUDED is set in the flags field,
|
||||
* the name field is set to the name of the included file.
|
||||
* [IN] name of I/O object.
|
||||
* It is #QSE_NULL for the top-level stream. It points to a stream name
|
||||
* for an included stream.
|
||||
*/
|
||||
const qse_char_t* name;
|
||||
|
||||
@ -261,6 +245,11 @@ struct qse_xli_io_arg_t
|
||||
*/
|
||||
void* handle;
|
||||
|
||||
/**
|
||||
* [IN] points to the includer
|
||||
*/
|
||||
qse_xli_io_arg_t* prev;
|
||||
|
||||
/*-- from here down, internal use only --*/
|
||||
struct
|
||||
{
|
||||
@ -273,7 +262,6 @@ struct qse_xli_io_arg_t
|
||||
qse_size_t colm;
|
||||
|
||||
qse_xli_io_lxc_t last;
|
||||
qse_xli_io_arg_t* next;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user