remove qse_cstr_t and related types. switched all existing references to qse_cstr_t and its family

This commit is contained in:
2014-07-02 12:28:58 +00:00
parent 7423092c39
commit a3453e5bd0
75 changed files with 485 additions and 565 deletions

View File

@ -30,7 +30,7 @@
*/
typedef int (*qse_glob_cbimpl_t) (
const qse_cstr_t* path,
const qse_xstr_t* path,
void* cbctx
);

View File

@ -240,7 +240,7 @@ QSE_EXPORT qse_mchar_t* qse_wcsatombsdupwithcmgr (
QSE_EXPORT qse_mchar_t* qse_wcsnatombsdupwithcmgr (
const qse_wcstr_t wcs[],
const qse_wxstr_t wcs[],
qse_size_t* mbslen,
qse_mmgr_t* mmgr,
qse_cmgr_t* cmgr
@ -454,7 +454,7 @@ QSE_EXPORT qse_mchar_t* qse_wcsatombsdup (
);
QSE_EXPORT qse_mchar_t* qse_wcsnatombsdup (
const qse_wcstr_t wcs[],
const qse_wxstr_t wcs[],
qse_size_t* mbslen,
qse_mmgr_t* mmgr
);

View File

@ -276,9 +276,9 @@ QSE_EXPORT qse_rex_node_t* qse_rex_comp (
QSE_EXPORT int qse_rex_exec (
qse_rex_t* rex,
const qse_cstr_t* str,
const qse_cstr_t* substr,
qse_cstr_t* matstr
const qse_xstr_t* str,
const qse_xstr_t* substr,
qse_xstr_t* matstr
);
@ -296,9 +296,9 @@ QSE_EXPORT int qse_matchrex (
qse_size_t depth,
void* code,
int option,
const qse_cstr_t* str,
const qse_cstr_t* substr,
qse_cstr_t* match,
const qse_xstr_t* str,
const qse_xstr_t* substr,
qse_xstr_t* match,
qse_rex_errnum_t* errnum
);

View File

@ -28,14 +28,12 @@
/** \file
* This file provides various functions, types, macros for string manipulation.
*
* The #qse_cstr_t type and the #qse_xstr_t defined in <qse/types.h> help you
* The #qse_xstr_t type and the #qse_xstr_t defined in <qse/types.h> help you
* deal with a string pointer and length in a structure.
*/
/** string pointer and length as a aggregate */
#define QSE_MBS_XSTR(s) (&((s)->val))
/** constant string pointer and length as a aggregate */
#define QSE_MBS_CSTR(s) ((qse_mcstr_t*)&((s)->val))
/** string length */
#define QSE_MBS_LEN(s) ((s)->val.len)
/** string pointer */
@ -51,8 +49,6 @@
/** string pointer and length as a aggregate */
#define QSE_WCS_XSTR(s) (&((s)->val))
/** constant string pointer and length as a aggregate */
#define QSE_WCS_CSTR(s) ((qse_wcstr_t*)&((s)->val))
/** string length */
#define QSE_WCS_LEN(s) ((s)->val.len)
/** string pointer */
@ -81,7 +77,6 @@ typedef qse_size_t (*qse_wcs_sizer_t) (
#if defined(QSE_CHAR_IS_MCHAR)
# define QSE_STR_XSTR(s) ((qse_xstr_t*)QSE_MBS_XSTR(s))
# define QSE_STR_CSTR(s) ((qse_cstr_t*)QSE_MBS_XSTR(s))
# define QSE_STR_LEN(s) QSE_MBS_LEN(s)
# define QSE_STR_PTR(s) QSE_MBS_PTR(s)
# define QSE_STR_CPTR(s,idx) QSE_MBS_CPTR(s,idx)
@ -92,7 +87,6 @@ typedef qse_size_t (*qse_wcs_sizer_t) (
# define qse_str_sizer_t qse_mbs_sizer_t
#else
# define QSE_STR_XSTR(s) ((qse_xstr_t*)QSE_WCS_XSTR(s))
# define QSE_STR_CSTR(s) ((qse_cstr_t*)QSE_WCS_XSTR(s))
# define QSE_STR_LEN(s) QSE_WCS_LEN(s)
# define QSE_STR_PTR(s) QSE_WCS_PTR(s)
# define QSE_STR_CPTR(s,idx) QSE_WCS_CPTR(s,idx)
@ -137,7 +131,7 @@ struct qse_wcs_t
typedef qse_mchar_t* (*qse_mbssubst_t) (
qse_mchar_t* buf,
qse_size_t bsz,
const qse_mcstr_t* ident,
const qse_mxstr_t* ident,
void* ctx
);
@ -148,7 +142,7 @@ typedef qse_mchar_t* (*qse_mbssubst_t) (
typedef qse_wchar_t* (*qse_wcssubst_t) (
qse_wchar_t* buf,
qse_size_t bsz,
const qse_wcstr_t* ident,
const qse_wxstr_t* ident,
void* ctx
);
@ -591,25 +585,25 @@ QSE_EXPORT qse_size_t qse_wcsfcpy (
/**
* The qse_mbsfncpy() function formats a string by position.
* It differs from qse_mbsfcpy() in that \a str is an array of the
* #qse_mcstr_t type.
* #qse_mxstr_t type.
* \sa qse_mbsfcpy, qse_mbsxfcpy, qse_mbsxfncpy
*/
QSE_EXPORT qse_size_t qse_mbsfncpy (
qse_mchar_t* buf,
const qse_mchar_t* fmt,
const qse_mcstr_t str[]
const qse_mxstr_t str[]
);
/**
* The qse_wcsfncpy() function formats a string by position.
* It differs from qse_wcsfcpy() in that \a str is an array of the
* #qse_wcstr_t type.
* #qse_wxstr_t type.
* \sa qse_wcsfcpy, qse_wcsxfcpy, qse_wcsxfncpy
*/
QSE_EXPORT qse_size_t qse_wcsfncpy (
qse_wchar_t* buf,
const qse_wchar_t* fmt,
const qse_wcstr_t str[]
const qse_wxstr_t str[]
);
/**
@ -651,27 +645,27 @@ QSE_EXPORT qse_size_t qse_wcsxfcpy (
/**
* The qse_mbsxfncpy() function formats a string by position.
* It differs from qse_strfcpy() in that \a buf is length-bounded of \a bsz
* characters and \a str is an array of the #qse_mcstr_t type.
* characters and \a str is an array of the #qse_mxstr_t type.
* \sa qse_mbsfcpy, qse_mbsfncpy, qse_mbsxfcpy
*/
QSE_EXPORT qse_size_t qse_mbsxfncpy (
qse_mchar_t* buf,
qse_size_t bsz,
const qse_mchar_t* fmt,
const qse_mcstr_t str[]
const qse_mxstr_t str[]
);
/**
* The qse_wcsxfncpy() function formats a string by position.
* It differs from qse_strfcpy() in that \a buf is length-bounded of \a bsz
* characters and \a str is an array of the #qse_wcstr_t type.
* characters and \a str is an array of the #qse_wxstr_t type.
* \sa qse_wcsfcpy, qse_wcsfncpy, qse_wcsxfcpy
*/
QSE_EXPORT qse_size_t qse_wcsxfncpy (
qse_wchar_t* buf,
qse_size_t bsz,
const qse_wchar_t* fmt,
const qse_wcstr_t str[]
const qse_wxstr_t str[]
);
#if defined(QSE_CHAR_IS_MCHAR)
@ -787,7 +781,7 @@ QSE_EXPORT qse_size_t qse_wcsxvfmt (
* \a bsz by substituting new values for ${} segments within it. The actual
* substitution is made by invoking the callback function \a subst.
* \code
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_mcstr_t* ident, void* ctx)
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_mxstr_t* ident, void* ctx)
* {
* if (qse_mbsxcmp (ident->ptr, ident->len, QSE_MT("USER")) == 0)
* return buf + qse_mbsxput (buf, bsz, QSE_MT("sam"));
@ -809,7 +803,7 @@ QSE_EXPORT qse_size_t qse_wcsxvfmt (
* if the buffer points to #QSE_MBSSUBST_NOBUF as shown belown.
*
* \code
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_mcstr_t* ident, void* ctx)
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_mxstr_t* ident, void* ctx)
* {
* if (qse_mcsxcmp (ident->ptr, ident->len, QSE_MT("USER")) == 0)
* return buf + (buf == QSE_MBSSUBST_NOBUF? 3: qse_mcsxput (buf, bsz, QSE_MT("sam")));
@ -829,7 +823,7 @@ QSE_EXPORT qse_size_t qse_wcsxvfmt (
* recursively.
*
* \code
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_mcstr_t* ident, void* ctx)
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_mxstr_t* ident, void* ctx)
* {
* if (qse_mbsxcmp (ident->ptr, ident->len, QSE_MT("USER")) == 0)
* return QSE_NULL;
@ -861,7 +855,7 @@ QSE_EXPORT qse_size_t qse_mbsxnsubst (
* \a bsz by substituting new values for ${} segments within it. The actual
* substitution is made by invoking the callback function \a subst.
* \code
* qse_wchar_t* subst (qse_wchar_t* buf, qse_size_t bsz, const qse_wcstr_t* ident, void* ctx)
* qse_wchar_t* subst (qse_wchar_t* buf, qse_size_t bsz, const qse_wxstr_t* ident, void* ctx)
* {
* if (qse_wcsxcmp (ident->ptr, ident->len, QSE_WT("USER")) == 0)
* return buf + qse_wcsxput (buf, bsz, QSE_WT("sam"));
@ -882,7 +876,7 @@ QSE_EXPORT qse_size_t qse_mbsxnsubst (
* above can be extended to return the buffer pointer without actual copying
*
* \code
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_wcstr_t* ident, void* ctx)
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_wxstr_t* ident, void* ctx)
* {
* if (qse_wcsxcmp (ident->ptr, ident->len, QSE_WT("USER")) == 0)
* return buf + (buf == QSE_WCSSUBST_NOBUF? 3: qse_wcsxput (buf, bsz, QSE_WT("sam")));
@ -902,7 +896,7 @@ QSE_EXPORT qse_size_t qse_mbsxnsubst (
* recursively.
*
* \code
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_wcstr_t* ident, void* ctx)
* qse_mchar_t* subst (qse_mchar_t* buf, qse_size_t bsz, const qse_wxstr_t* ident, void* ctx)
* {
* if (qse_wcsxcmp (ident->ptr, ident->len, QSE_WT("USER")) == 0)
* return QSE_NULL;
@ -1294,23 +1288,23 @@ QSE_EXPORT qse_wchar_t* qse_wcsadup (
#endif
QSE_EXPORT qse_mchar_t* qse_mcstrdup (
const qse_mcstr_t* str,
const qse_mxstr_t* str,
qse_mmgr_t* mmgr
);
QSE_EXPORT qse_mchar_t* qse_mcstradup (
const qse_mcstr_t str[],
const qse_mxstr_t str[],
qse_size_t* len,
qse_mmgr_t* mmgr
);
QSE_EXPORT qse_wchar_t* qse_wcstrdup (
const qse_wcstr_t* str,
const qse_wxstr_t* str,
qse_mmgr_t* mmgr
);
QSE_EXPORT qse_wchar_t* qse_wcstradup (
const qse_wcstr_t str[],
const qse_wxstr_t str[],
qse_size_t* len,
qse_mmgr_t* mmgr
);
@ -2290,14 +2284,14 @@ QSE_EXPORT int qse_wcsspltrn (
QSE_EXPORT qse_mchar_t* qse_mbstok (
const qse_mchar_t* s,
const qse_mchar_t* delim,
qse_mcstr_t* tok
qse_mxstr_t* tok
);
QSE_EXPORT qse_mchar_t* qse_mbsxtok (
const qse_mchar_t* s,
qse_size_t len,
const qse_mchar_t* delim,
qse_mcstr_t* tok
qse_mxstr_t* tok
);
QSE_EXPORT qse_mchar_t* qse_mbsxntok (
@ -2305,20 +2299,20 @@ QSE_EXPORT qse_mchar_t* qse_mbsxntok (
qse_size_t len,
const qse_mchar_t* delim,
qse_size_t delim_len,
qse_mcstr_t* tok
qse_mxstr_t* tok
);
QSE_EXPORT qse_wchar_t* qse_wcstok (
const qse_wchar_t* s,
const qse_wchar_t* delim,
qse_wcstr_t* tok
qse_wxstr_t* tok
);
QSE_EXPORT qse_wchar_t* qse_wcsxtok (
const qse_wchar_t* s,
qse_size_t len,
const qse_wchar_t* delim,
qse_wcstr_t* tok
qse_wxstr_t* tok
);
QSE_EXPORT qse_wchar_t* qse_wcsxntok (
@ -2326,7 +2320,7 @@ QSE_EXPORT qse_wchar_t* qse_wcsxntok (
qse_size_t len,
const qse_wchar_t* delim,
qse_size_t delim_len,
qse_wcstr_t* tok
qse_wxstr_t* tok
);
#if defined(QSE_CHAR_IS_MCHAR)

View File

@ -29,32 +29,32 @@ typedef struct qse_wuri_t qse_wuri_t;
struct qse_muri_t
{
qse_mcstr_t scheme;
qse_mxstr_t scheme;
struct
{
qse_mcstr_t user;
qse_mcstr_t pass;
qse_mxstr_t user;
qse_mxstr_t pass;
} auth;
qse_mcstr_t host;
qse_mcstr_t port;
qse_mcstr_t path;
qse_mcstr_t query;
qse_mcstr_t frag;
qse_mxstr_t host;
qse_mxstr_t port;
qse_mxstr_t path;
qse_mxstr_t query;
qse_mxstr_t frag;
};
struct qse_wuri_t
{
qse_wcstr_t scheme;
qse_wxstr_t scheme;
struct
{
qse_wcstr_t user;
qse_wcstr_t pass;
qse_wxstr_t user;
qse_wxstr_t pass;
} auth;
qse_wcstr_t host;
qse_wcstr_t port;
qse_wcstr_t path;
qse_wcstr_t query;
qse_wcstr_t frag;
qse_wxstr_t host;
qse_wxstr_t port;
qse_wxstr_t path;
qse_wxstr_t query;
qse_wxstr_t frag;
};
enum qse_mbstouri_flag_t