interim commit while writing qse_pio_t functions.

- enhanced qse_pio_init() to handle a wide character string.
- added qse_wcsntombsnlen().
This commit is contained in:
2009-01-11 09:25:33 +00:00
parent c010af38cb
commit cf09e22560
15 changed files with 289 additions and 230 deletions

View File

@ -172,7 +172,7 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkginclude_HEADERS = mem.h chr.h str.h lda.h map.h rex.h sll.h dll.h opt.h fio.h tio.h sio.h time.h
pkginclude_HEADERS = mem.h chr.h str.h lda.h map.h rex.h sll.h dll.h opt.h fio.h pio.h tio.h sio.h time.h
CLEANFILES = *dist
all: all-am

View File

@ -45,7 +45,7 @@ typedef enum qse_lda_walk_t qse_lda_walk_t;
#define QSE_LDA_COPIER_SIMPLE ((qse_lda_copier_t)1)
#define QSE_LDA_COPIER_INLINE ((qse_lda_copier_t)2)
#define QSE_LDA_INVALID ((qse_size_t)-1)
#define QSE_LDA_NIL ((qse_size_t)-1)
#define QSE_LDA_SIZE(lda) ((lda)->size)
#define QSE_LDA_CAPA(lda) ((lda)->capa)

View File

@ -50,13 +50,16 @@ enum qse_pio_hid_t
QSE_PIO_ERR = 2
};
typedef enum qse_pio_hid_t qse_pio_hid_t;
#ifdef _WIN32
/* <winnt.h> => typedef PVOID HANDLE; */
typedef void* qse_pio_hnd_t;
typedef int qse_pio_pid_t; /* TODO */
/* <winnt.h> => typedef PVOID HANDLE; */
typedef void* qse_pio_hnd_t;
typedef int qse_pio_pid_t; /* TODO */
#else
typedef int qse_pio_hnd_t;
typedef int qse_pio_pid_t;
typedef int qse_pio_hnd_t;
typedef int qse_pio_pid_t;
# define QSE_PIO_HND_NIL ((qse_pio_hnd_t)-1)
#endif
typedef struct qse_pio_t qse_pio_t;
@ -68,8 +71,8 @@ struct qse_pio_t
qse_pio_hnd_t handle[3];
};
#define QSE_PIO_MMGR(pio) ((pio)->mmgr)
#define QSE_PIO_HANDLE(pio) ((pio)->handle)
#define QSE_PIO_MMGR(pio) ((pio)->mmgr)
#define QSE_PIO_HANDLE(pio,hid) ((pio)->handle[hid])
#ifdef __cplusplus
extern "C" {
@ -79,12 +82,16 @@ extern "C" {
* NAME
* qse_pio_open - open a pipe to a child process
*
* DESCRIPTION
* QSE_PIO_SHELL drives the function to execute the command via /bin/sh.
* If flags is clear of QSE_PIO_SHELL, you should pass the full program path.
*
* SYNOPSIS
*/
qse_pio_t* qse_pio_open (
qse_mmgr_t* mmgr,
qse_size_t ext,
const qse_char_t* path,
const qse_char_t* cmd,
int flags
);
/******/
@ -124,13 +131,13 @@ int qse_pio_wait (
/****f* qse.cmn.pio/qse_pio_gethandle
* NAME
* qse_pio_gethandle - get system handle
* qse_pio_gethandle - get native handle
*
* SYNOPSIS
*/
qse_pio_hnd_t qse_pio_gethandle (
qse_pio_t* pio,
int hid
qse_pio_t* pio,
qse_pio_hid_t hid
);
/******/
@ -141,10 +148,10 @@ qse_pio_hnd_t qse_pio_gethandle (
* SYNOPSIS
*/
qse_ssize_t qse_pio_read (
qse_pio_t* pio,
void* buf,
qse_size_t size,
int hid
qse_pio_t* pio,
void* buf,
qse_size_t size,
qse_pio_hid_t hid
);
/******/
@ -159,10 +166,10 @@ qse_ssize_t qse_pio_read (
* SYNOPSIS
*/
qse_ssize_t qse_pio_write (
qse_pio_t* pio,
const void* data,
qse_size_t size,
int hid
qse_pio_t* pio,
const void* data,
qse_size_t size,
qse_pio_hid_t hid
);
/******/
@ -173,8 +180,8 @@ qse_ssize_t qse_pio_write (
* SYNOPSIS
*/
void qse_pio_end (
qse_pio_t* pio,
int hid
qse_pio_t* pio,
qse_pio_hid_t hid
);
/******/

View File

@ -403,12 +403,11 @@ qse_size_t qse_str_nccat (
* SYNOPSIS
*/
int qse_strspl (
qse_char_t* s,
qse_char_t* str,
const qse_char_t* delim,
qse_char_t lquote,
qse_char_t rquote,
qse_char_t escape,
qse_size_t* count
qse_char_t escape
);
/******/
@ -464,6 +463,29 @@ qse_size_t qse_wcstombslen (
);
/******/
/****f* qse.cmn.str/qse_wcsntombsnlen
* NAME
* qse_wcsntombsnlen - get the length
*
* DESCRIPTION
* The qse_wcsntombsnlen() function scans a wide character wcs as long as
* wcslen characters to get the get the total number of multibyte characters
* that it can be converted to. The resulting number of characters is stored
* into memory pointed to by mbslen.
*
* RETURN
* The qse_wcsntombsnlen() function returns the number of wide characters
* handled.
*
* SYNOPSIS
*/
qse_size_t qse_wcsntombsnlen (
const qse_wchar_t* wcs,
qse_size_t wcslen,
qse_size_t* mbslen
);
/******/
/****f* qse.cmn.str/qse_wcstombs
* NAME
* qse_wcstombs - convert a wide character string to a multibyte string.