added qse_cmgr_t. still in primitive stage.

added qse_tio_getcmgr()/qse_tio_setcmgr()
added qse_pio_getcmgr()/qse_pio_setcmgr()
added qse_fio_getcmgr()/qse_fio_setcmgr()
added qse_fio_getcmgr()/qse_fio_setcmgr()
added mbs/wcs conversion functions using cmgr
This commit is contained in:
2011-12-30 14:44:21 +00:00
parent bd7fd49a72
commit a0fc992c65
21 changed files with 626 additions and 54 deletions

View File

@ -200,6 +200,22 @@ void qse_fio_fini (
qse_fio_t* fio
);
/**
* The qse_fio_getcmgr() funcfion returns the current character manager.
* It returns #QSE_NULL is @a fio is not opened with #QSE_FIO_TEXT.
*/
qse_cmgr_t* qse_fio_getcmgr (
qse_fio_t* fio
);
/**
* The qse_fio_setcmgr() funcfion changes the character manager to @a cmgr.
* The character manager is used only if @a fio is opened with #QSE_FIO_TEXT.
*/
void qse_fio_setcmgr (
qse_fio_t* fio,
qse_cmgr_t* cmgr
);
/**
* The qse_fio_gethandle() function returns the native file handle.

View File

@ -77,7 +77,6 @@ enum qse_pio_flag_t
QSE_PIO_DROPERR = (1 << 18)
};
/**
* The qse_pio_hid_t type defines pipe IDs established to a child process.
*/
@ -138,7 +137,7 @@ typedef enum qse_pio_errnum_t qse_pio_errnum_t;
/* <os2def.h> => typedef LHANDLE HFILE;
typedef LHANDLE PID;
typedef unsigned long LHANDLE; */
typedef unsigned long qse_pio_hnd_t; /**< defines a pipe handle type */
typedef unsigned long qse_pio_hnd_t; /**< defines a pipe handle type */
typedef unsigned long qse_pio_pid_t; /**< defined a process handle type */
# define QSE_PIO_HND_NIL ((qse_pio_hnd_t)-1)
# define QSE_PIO_PID_NIL ((qse_pio_pid_t)-1)
@ -280,6 +279,25 @@ const qse_char_t* qse_pio_geterrmsg (
qse_pio_t* pio /**< pio object */
);
/**
* The qse_pio_getcmgr() function returns the current character manager.
* It returns #QSE_NULL is @a pio is not opened with #QSE_PIO_TEXT.
*/
qse_cmgr_t* qse_pio_getcmgr (
qse_pio_t* pio,
qse_pio_hid_t hid
);
/**
* The qse_pio_setcmgr() function changes the character manager to @a cmgr.
* The character manager is used only if @a pio is opened with #QSE_PIO_TEXT.
*/
void qse_pio_setcmgr (
qse_pio_t* pio,
qse_pio_hid_t hid,
qse_cmgr_t* cmgr
);
/**
* The qse_pio_gethandle() function gets a pipe handle.
* @return pipe handle
@ -303,9 +321,9 @@ qse_pio_pid_t qse_pio_getchild (
*/
qse_ssize_t qse_pio_read (
qse_pio_t* pio, /**< pio object */
qse_pio_hid_t hid, /**< handle ID */
void* buf, /**< buffer to fill */
qse_size_t size, /**< buffer size */
qse_pio_hid_t hid /**< handle ID */
qse_size_t size /**< buffer size */
);
/**
@ -316,9 +334,9 @@ qse_ssize_t qse_pio_read (
*/
qse_ssize_t qse_pio_write (
qse_pio_t* pio, /**< pio object */
qse_pio_hid_t hid, /**< handle ID */
const void* data, /**< data to write */
qse_size_t size, /**< data size */
qse_pio_hid_t hid /**< handle ID */
qse_size_t size /**< data size */
);
/**

View File

@ -144,6 +144,15 @@ qse_sio_errnum_t qse_sio_geterrnum (
qse_sio_t* sio
);
qse_cmgr_t* qse_sio_getcmgr (
qse_sio_t* sio
);
void qse_sio_setcmgr (
qse_sio_t* sio,
qse_cmgr_t* cmgr
);
qse_sio_hnd_t qse_sio_gethandle (
qse_sio_t* sio
);

View File

@ -110,16 +110,17 @@ struct qse_tio_t
{
QSE_DEFINE_COMMON_FIELDS (tio)
qse_tio_errnum_t errnum;
int flags;
int flags;
qse_cmgr_t* cmgr;
qse_tio_io_t in;
qse_tio_io_t out;
qse_tio_io_t in;
qse_tio_io_t out;
/* for house keeping from here */
int input_status;
qse_size_t inbuf_cur;
qse_size_t inbuf_len;
qse_size_t outbuf_len;
int input_status;
qse_size_t inbuf_cur;
qse_size_t inbuf_len;
qse_size_t outbuf_len;
};
#ifdef __cplusplus
@ -176,6 +177,21 @@ const qse_char_t* qse_tio_geterrmsg (
qse_tio_t* tio
);
/**
* The qse_tio_getcmgr() function returns the character manager.
*/
qse_cmgr_t* qse_tio_getcmgr (
qse_tio_t* tio
);
/**
* The qse_tio_setcmgr() function changes the character manager.
*/
void qse_tio_setcmgr (
qse_tio_t* tio,
qse_cmgr_t* cmgr
);
/**
* The qse_tio_attachin() function attachs an input handler .
* @return 0 on success, -1 on failure

View File

@ -716,6 +716,30 @@ struct qse_mmgr_t
};
typedef struct qse_mmgr_t qse_mmgr_t;
typedef qse_size_t (*qse_cmgr_mbtowc_t) (
const qse_mchar_t* mb,
qse_size_t size,
qse_wchar_t* wc
);
typedef qse_size_t (*qse_cmgr_wctomb_t) (
qse_wchar_t wc,
qse_mchar_t* mb,
qse_size_t size
);
/**
* The qse_cmgr_t type defines the interface to various character handling.
*/
struct qse_cmgr_t
{
qse_cmgr_mbtowc_t mbtowc;
qse_cmgr_wctomb_t wctomb;
};
typedef struct qse_cmgr_t qse_cmgr_t;
/**
* The #qse_foff_t type defines an integer that can represent a file offset.
* Depending on your system, it's defined to one of #qse_int64_t, #qse_int32_t,