added qse_dir_t.

added qse_mux_t.
added dir::xxx() for awk
This commit is contained in:
2012-11-09 17:31:33 +00:00
parent a3ee069804
commit 7e509d4daa
40 changed files with 3448 additions and 1167 deletions

View File

@ -1432,11 +1432,6 @@ QSE_EXPORT int qse_awk_close (
qse_awk_t* awk /**< awk */
);
QSE_EXPORT void qse_awk_setmmgr (
qse_awk_t* awk,
qse_mmgr_t* mmgr
);
QSE_EXPORT qse_mmgr_t* qse_awk_getmmgr (
qse_awk_t* awk
);

View File

@ -5,6 +5,7 @@ pkginclude_HEADERS = \
chr.h \
cp949.h \
cp950.h \
dir.h \
dll.h \
env.h \
fio.h \
@ -21,6 +22,7 @@ pkginclude_HEADERS = \
map.h \
mbwc.h \
mem.h \
mux.h \
nwad.h \
nwif.h \
nwio.h \

View File

@ -52,12 +52,12 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__pkginclude_HEADERS_DIST = alg.h chr.h cp949.h cp950.h dll.h env.h \
fio.h fma.h fmt.h fs.h gdl.h glob.h htb.h hton.h ipad.h lda.h \
main.h map.h mbwc.h mem.h nwad.h nwif.h nwio.h oht.h opt.h \
path.h pio.h pma.h rbt.h rex.h sio.h sll.h slmb.h stdio.h \
str.h task.h time.h tio.h tre.h uri.h utf8.h xma.h Mmgr.hpp \
StdMmgr.hpp Mmged.hpp
am__pkginclude_HEADERS_DIST = alg.h chr.h cp949.h cp950.h dir.h dll.h \
env.h fio.h fma.h fmt.h fs.h gdl.h glob.h htb.h hton.h ipad.h \
lda.h main.h map.h mbwc.h mem.h mux.h nwad.h nwif.h nwio.h \
oht.h opt.h path.h pio.h pma.h rbt.h rex.h sio.h sll.h slmb.h \
stdio.h str.h task.h time.h tio.h tre.h uri.h utf8.h xma.h \
Mmgr.hpp StdMmgr.hpp Mmged.hpp
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -262,11 +262,12 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkginclude_HEADERS = alg.h chr.h cp949.h cp950.h dll.h env.h fio.h \
fma.h fmt.h fs.h gdl.h glob.h htb.h hton.h ipad.h lda.h main.h \
map.h mbwc.h mem.h nwad.h nwif.h nwio.h oht.h opt.h path.h \
pio.h pma.h rbt.h rex.h sio.h sll.h slmb.h stdio.h str.h \
task.h time.h tio.h tre.h uri.h utf8.h xma.h $(am__append_1)
pkginclude_HEADERS = alg.h chr.h cp949.h cp950.h dir.h dll.h env.h \
fio.h fma.h fmt.h fs.h gdl.h glob.h htb.h hton.h ipad.h lda.h \
main.h map.h mbwc.h mem.h mux.h nwad.h nwif.h nwio.h oht.h \
opt.h path.h pio.h pma.h rbt.h rex.h sio.h sll.h slmb.h \
stdio.h str.h task.h time.h tio.h tre.h uri.h utf8.h xma.h \
$(am__append_1)
all: all-am
.SUFFIXES:

108
qse/include/qse/cmn/dir.h Normal file
View File

@ -0,0 +1,108 @@
/*
* $Id$
*
Copyright 2006-2012 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _QSE_DIR_H_
#define _QSE_DIR_H_
/** @file
* This file provides functions and data types for I/O multiplexing.
*/
#include <qse/types.h>
#include <qse/macros.h>
#include <qse/cmn/time.h>
typedef struct qse_dir_t qse_dir_t;
typedef struct qse_dir_ent_t qse_dir_ent_t;
enum qse_dir_errnum_t
{
QSE_DIR_ENOERR = 0, /**< no error */
QSE_DIR_EOTHER, /**< other error */
QSE_DIR_ENOIMPL, /**< not implemented */
QSE_DIR_ESYSERR, /**< subsystem(system call) error */
QSE_DIR_EINTERN, /**< internal error */
QSE_DIR_ENOMEM, /**< out of memory */
QSE_DIR_EINVAL, /**< invalid parameter */
QSE_DIR_EACCES, /**< access denied */
QSE_DIR_ENOENT, /**< no such file */
QSE_DIR_EEXIST, /**< already exist */
QSE_DIR_EINTR /**< interrupted */
};
typedef enum qse_dir_errnum_t qse_dir_errnum_t;
enum qse_dir_flag_t
{
QSE_DIR_MBSPATH = (1 << 0),
QSE_DIR_SORT = (1 << 1),
QSE_DIR_STAT = (1 << 2)
};
struct qse_dir_ent_t
{
const qse_char_t* name;
struct
{
int type;
qse_foff_t size;
qse_ntime_t tmmod;
} stat;
};
#ifdef __cplusplus
extern "C" {
#endif
qse_dir_t* qse_dir_open (
qse_mmgr_t* mmgr,
qse_size_t xtnsize,
const qse_char_t* path,
int flags
);
void qse_dir_close (
qse_dir_t* dir
);
qse_mmgr_t* qse_dir_getmmgr (
qse_dir_t* dir
);
void* qse_dir_getxtn (
qse_dir_t* dir
);
int qse_dir_reset (
qse_dir_t* dir,
const qse_char_t* path
);
int qse_dir_read (
qse_dir_t* dir,
qse_dir_ent_t* ent
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -66,15 +66,6 @@ int qse_glob (
qse_mmgr_t* mmgr
);
int qse_globwithcmgr (
const qse_char_t* pattern,
qse_glob_cbimpl_t cbimpl,
void* cbctx,
int flags,
qse_mmgr_t* mmgr,
qse_cmgr_t* cmgr
);
#ifdef __cplusplus
}
#endif

123
qse/include/qse/cmn/mux.h Normal file
View File

@ -0,0 +1,123 @@
/*
* $Id$
*
Copyright 2006-2012 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _QSE_MUX_H_
#define _QSE_MUX_H_
/** @file
* This file provides functions and data types for I/O multiplexing.
*/
#include <qse/types.h>
#include <qse/macros.h>
#include <qse/cmn/time.h>
typedef struct qse_mux_t qse_mux_t;
typedef struct qse_mux_evt_t qse_mux_evt_t;
enum qse_mux_errnum_t
{
QSE_MUX_ENOERR = 0, /**< no error */
QSE_MUX_EOTHER, /**< other error */
QSE_MUX_ENOIMPL, /**< not implemented */
QSE_MUX_ESYSERR, /**< subsystem(system call) error */
QSE_MUX_EINTERN, /**< internal error */
QSE_MUX_ENOMEM, /**< out of memory */
QSE_MUX_EINVAL, /**< invalid parameter */
QSE_MUX_EACCES, /**< access denied */
QSE_MUX_ENOENT, /**< no such file */
QSE_MUX_EEXIST, /**< already exist */
QSE_MUX_EINTR /**< interrupted */
};
typedef enum qse_mux_errnum_t qse_mux_errnum_t;
#if defined(_WIN32)
typedef qse_uintptr_t qse_mux_hnd_t;
#elif defined(__OS2__)
typedef int qse_mux_hnd_t;
#elif defined(__DOS__)
typedef int qse_mux_hnd_t;
#else
typedef int qse_mux_hnd_t;
#endif
enum qse_mux_evtmask_t
{
QSE_MUX_IN = (1 << 0),
QSE_MUX_OUT = (1 << 1)
};
typedef enum qse_mux_evtmask_t qse_mux_evtmask_t;
typedef void (*qse_mux_evtfun_t) (
qse_mux_t* mux,
const qse_mux_evt_t* evt
);
struct qse_mux_evt_t
{
qse_mux_hnd_t hnd;
int mask;
void* data;
};
#ifdef __cplusplus
extern "C" {
#endif
qse_mux_t* qse_mux_open (
qse_mmgr_t* mmgr,
qse_size_t xtnsize,
qse_mux_evtfun_t evtfun,
qse_size_t capahint
);
void qse_mux_close (
qse_mux_t* mux
);
qse_mmgr_t* qse_mux_getmmgr (
qse_mux_t* mux
);
void* qse_mux_getxtn (
qse_mux_t* mux
);
int qse_mux_insert (
qse_mux_t* mux,
const qse_mux_evt_t* evt
);
int qse_mux_delete (
qse_mux_t* mux,
const qse_mux_evt_t* evt
);
int qse_mux_poll (
qse_mux_t* mux,
qse_ntime_t timeout
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -80,13 +80,13 @@ struct qse_nwio_tmout_t
typedef struct qse_nwio_tmout_t qse_nwio_tmout_t;
#if defined(_WIN32)
typedef qse_intptr_t qse_nwio_hnd_t;
typedef qse_uintptr_t qse_nwio_hnd_t;
#elif defined(__OS2__)
typedef int qse_nwio_hnd_t; /**< defines a pipe handle type */
typedef int qse_nwio_hnd_t;
#elif defined(__DOS__)
typedef int qse_nwio_hnd_t; /**< defines a pipe handle type */
typedef int qse_nwio_hnd_t;
#else
typedef int qse_nwio_hnd_t; /**< defines a pipe handle type */
typedef int qse_nwio_hnd_t;
#endif
typedef struct qse_nwio_t qse_nwio_t;

View File

@ -49,6 +49,17 @@ enum qse_canonpath_flag_t
QSE_CANONPATH_DROPTRAILINGSEP = (1 << 2)
};
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
# define QSE_ISPATHSEP(c) ((c) == QSE_T('/') || (c) == QSE_T('\\'))
# define QSE_ISPATHMBSEP(c) ((c) == QSE_MT('/') || (c) == QSE_MT('\\'))
# define QSE_ISPATHWCSEP(c) ((c) == QSE_WT('/') || (c) == QSE_WT('\\'))
#else
# define QSE_ISPATHSEP(c) ((c) == QSE_T('/'))
# define QSE_ISPATHMBSEP(c) ((c) == QSE_MT('/'))
# define QSE_ISPATHWCSEP(c) ((c) == QSE_WT('/'))
#endif
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -329,7 +329,6 @@
* of a relevant object created with an extension size greater than 0.
*/
#define QSE_DEFINE_COMMON_FUNCTIONS(name) \
void qse_##name##_setmmgr (qse_##name##_t* name, qse_mmgr_t* mmgr); \
qse_mmgr_t* qse_##name##_getmmgr (qse_##name##_t* name); \
void* qse_##name##_getxtn (qse_##name##_t* name);
@ -345,10 +344,6 @@ void* qse_##name##_getxtn (qse_##name##_t* name);
* an object.
*/
#define QSE_IMPLEMENT_COMMON_FUNCTIONS(name) \
void qse_##name##_setmmgr (qse_##name##_t* name, qse_mmgr_t* mmgr) \
{ \
(name)->mmgr = mmgr; \
} \
qse_mmgr_t* qse_##name##_getmmgr (qse_##name##_t* name) \
{ \
return (name)->mmgr; \

View File

@ -135,11 +135,6 @@ QSE_EXPORT void qse_htrd_fini (
qse_htrd_t* htrd
);
QSE_EXPORT void qse_htrd_setmmgr (
qse_htrd_t* htrd,
qse_mmgr_t* mmgr
);
QSE_EXPORT qse_mmgr_t* qse_htrd_getmmgr (
qse_htrd_t* htrd
);

View File

@ -29,6 +29,7 @@
#include <qse/cmn/time.h>
typedef struct qse_httpd_t qse_httpd_t;
typedef struct qse_httpd_server_t qse_httpd_server_t;
typedef struct qse_httpd_client_t qse_httpd_client_t;
enum qse_httpd_errnum_t
@ -73,36 +74,6 @@ struct qse_httpd_stat_t
qse_ntime_t mtime;
};
enum qse_httpd_server_flag_t
{
QSE_HTTPD_SERVER_ACTIVE = (1 << 0),
QSE_HTTPD_SERVER_SECURE = (1 << 1),
QSE_HTTPD_SERVER_BINDTONWIF = (1 << 2)
};
typedef struct qse_httpd_server_t qse_httpd_server_t;
typedef void (*qse_httpd_server_predetach_t) (
qse_httpd_t* httpd,
qse_httpd_server_t* server
);
struct qse_httpd_server_t
{
/* ---------------------------------------------- */
int flags;
qse_nwad_t nwad; /* binding address */
unsigned int nwif; /* interface number to bind to */
/* set by server.open callback */
qse_ubi_t handle;
/* private */
qse_httpd_server_predetach_t predetach;
qse_httpd_server_t* next;
qse_httpd_server_t* prev;
};
typedef struct qse_httpd_peer_t qse_httpd_peer_t;
struct qse_httpd_peer_t
{
@ -162,11 +133,9 @@ struct qse_httpd_scb_t
struct
{
void* (*open) (qse_httpd_t* httpd);
void* (*open) (qse_httpd_t* httpd, qse_httpd_muxcb_t muxcb);
void (*close) (qse_httpd_t* httpd, void* mux);
int (*addhnd) (
qse_httpd_t* httpd, void* mux, qse_ubi_t handle,
int mask, qse_httpd_muxcb_t cbfun, void* cbarg);
int (*addhnd) (qse_httpd_t* httpd, void* mux, qse_ubi_t handle, int mask, void* cbarg);
int (*delhnd) (qse_httpd_t* httpd, void* mux, qse_ubi_t handle);
int (*poll) (qse_httpd_t* httpd, void* mux, qse_ntime_t timeout);
@ -266,6 +235,8 @@ struct qse_httpd_rcb_t
qse_mchar_t* buf, int bufsz);
};
/* -------------------------------------------------------------------------- */
typedef struct qse_httpd_task_t qse_httpd_task_t;
typedef int (*qse_httpd_task_init_t) (
@ -286,7 +257,6 @@ typedef int (*qse_httpd_task_main_t) (
qse_httpd_task_t* task
);
enum qse_httpd_task_trigger_mask_t
{
QSE_HTTPD_TASK_TRIGGER_READ = (1 << 0),
@ -322,11 +292,19 @@ struct qse_httpd_task_t
qse_httpd_task_t* next;
};
enum qse_httpd_sctype_t
{
QSE_HTTPD_SERVER,
QSE_HTTPD_CLIENT
};
typedef enum qse_httpd_sctype_t qse_httpd_sctype_t;
struct qse_httpd_client_t
{
/* == PUBLIC == */
/* == PRIVATE == */
qse_httpd_sctype_t type;
/* == PUBLIC == */
qse_ubi_t handle;
qse_ubi_t handle2;
qse_nwad_t remote_addr;
@ -354,6 +332,38 @@ struct qse_httpd_client_t
} task;
};
enum qse_httpd_server_flag_t
{
QSE_HTTPD_SERVER_ACTIVE = (1 << 0),
QSE_HTTPD_SERVER_SECURE = (1 << 1),
QSE_HTTPD_SERVER_BINDTONWIF = (1 << 2)
};
typedef void (*qse_httpd_server_predetach_t) (
qse_httpd_t* httpd,
qse_httpd_server_t* server
);
struct qse_httpd_server_t
{
qse_httpd_sctype_t type;
/* ---------------------------------------------- */
int flags;
qse_nwad_t nwad; /* binding address */
unsigned int nwif; /* interface number to bind to */
/* set by server.open callback */
qse_ubi_t handle;
/* private */
qse_httpd_server_predetach_t predetach;
qse_httpd_server_t* next;
qse_httpd_server_t* prev;
};
/* -------------------------------------------------------------------------- */
/**
* The qse_httpd_rsrc_type_t defines the resource type than can
* be entasked with qse_httpd_entaskrsrc().
@ -523,11 +533,6 @@ QSE_EXPORT void qse_httpd_close (
qse_httpd_t* httpd
);
QSE_EXPORT void qse_httpd_setmmgr (
qse_httpd_t* httpd,
qse_mmgr_t* mmgr
);
QSE_EXPORT qse_mmgr_t* qse_httpd_getmmgr (
qse_httpd_t* httpd
);

View File

@ -152,11 +152,6 @@ QSE_EXPORT void qse_upxd_seterrnum (
qse_upxd_errnum_t errnum
);
QSE_EXPORT void qse_upxd_setmmgr (
qse_upxd_t* upxd,
qse_mmgr_t* mmgr
);
QSE_EXPORT qse_mmgr_t* qse_upxd_getmmgr (
qse_upxd_t* upxd
);

View File

@ -414,11 +414,6 @@ QSE_EXPORT void qse_sed_close (
qse_sed_t* sed /**< stream editor */
);
QSE_EXPORT void qse_sed_setmmgr (
qse_sed_t* sed,
qse_mmgr_t* mmgr
);
QSE_EXPORT qse_mmgr_t* qse_sed_getmmgr (
qse_sed_t* sed
);