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

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

View File

@ -101,7 +101,7 @@ struct arg_t
struct gvmv_t
{
int idx;
qse_cstr_t str;
qse_xstr_t str;
};
static void dprint (const qse_char_t* fmt, ...)
@ -280,7 +280,7 @@ static qse_htb_walk_t set_global (
qse_awk_rtx_t* rtx = (qse_awk_rtx_t*)arg;
struct gvmv_t* gvmv = (struct gvmv_t*)QSE_HTB_VPTR(pair);
v = qse_awk_rtx_makenstrvalwithcstr (rtx, &gvmv->str);
v = qse_awk_rtx_makenstrvalwithxstr (rtx, &gvmv->str);
if (v == QSE_NULL) return QSE_HTB_WALK_STOP;
qse_awk_rtx_refupval (rtx, v);
@ -434,7 +434,7 @@ static void print_usage (qse_sio_t* out, const qse_char_t* argv0)
/* ---------------------------------------------------------------------- */
static int collect_into_xarg (const qse_cstr_t* path, void* ctx)
static int collect_into_xarg (const qse_xstr_t* path, void* ctx)
{
xarg_t* xarg = (xarg_t*)ctx;
@ -477,7 +477,7 @@ static void purge_xarg (xarg_t* xarg)
static int expand_wildcard (int argc, qse_char_t* argv[], int glob, xarg_t* xarg)
{
int i;
qse_cstr_t tmp;
qse_xstr_t tmp;
for (i = 0; i < argc; i++)
{

View File

@ -603,7 +603,7 @@ struct xarg_t
typedef struct xarg_t xarg_t;
static int collect_into_xarg (const qse_cstr_t* path, void* ctx)
static int collect_into_xarg (const qse_xstr_t* path, void* ctx)
{
xarg_t* xarg = (xarg_t*)ctx;
@ -644,7 +644,7 @@ static void purge_xarg (xarg_t* xarg)
static int expand_wildcards (int argc, qse_char_t* argv[], int glob, xarg_t* xarg)
{
int i;
qse_cstr_t tmp;
qse_xstr_t tmp;
for (i = 0; i < argc; i++)
{

View File

@ -516,7 +516,7 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
}
{
static qse_cstr_t strs[] =
static const qse_xstr_t strs[] =
{
{ QSE_T("hello"), 5 },
{ QSE_T("xli"), 3 },

View File

@ -70,8 +70,6 @@ public:
/** redefines a floating-point number */
typedef qse_flt_t flt_t;
/** redefines a structure of a constant character pointer and length */
typedef qse_cstr_t cstr_t;
/** redefines a structure of a character pointer and length */
typedef qse_xstr_t xstr_t;
};

View File

@ -146,7 +146,7 @@ public:
///
void setError (
errnum_t code, ///< error code
const cstr_t* args = QSE_NULL, ///< message formatting
const xstr_t* args = QSE_NULL, ///< message formatting
/// argument array
const loc_t* loc = QSE_NULL ///< error location
);
@ -525,7 +525,7 @@ public:
///
/// The Index class encapsulates an index of an arrayed value.
///
class QSE_EXPORT Index: protected qse_cstr_t
class QSE_EXPORT Index: protected qse_xstr_t
{
public:
friend class Value;
@ -533,35 +533,23 @@ public:
/// The Index() function creates an empty array index.
Index ()
{
this->ptr = Value::getEmptyStr();
this->ptr = (char_t*)Value::getEmptyStr();
this->len = 0;
}
/// The Index() function creates a string array index.
Index (const char_t* ptr, size_t len)
{
this->ptr = ptr;
this->ptr = (char_t*)ptr;
this->len = len;
}
void set (const qse_cstr_t* x)
{
this->ptr = x->ptr;
this->len = x->len;
}
void set (const qse_xstr_t* x)
{
this->ptr = x->ptr;
this->len = x->len;
}
Index& operator= (const qse_cstr_t* x)
{
this->set (x);
return *this;
}
Index& operator= (const qse_xstr_t* x)
{
this->set (x);
@ -870,7 +858,7 @@ public:
void setError (
errnum_t code,
const cstr_t* args = QSE_NULL,
const xstr_t* args = QSE_NULL,
const loc_t* loc = QSE_NULL
);

View File

@ -59,7 +59,7 @@ public:
protected:
const char_t* name;
qse_cstr_t dir;
qse_xstr_t dir;
qse_cmgr_t* cmgr;
};

View File

@ -271,7 +271,7 @@ typedef struct qse_awk_val_map_itr_t qse_awk_val_map_itr_t;
* of a map value.
*/
#define QSE_AWK_VAL_MAP_ITR_KEY(itr) \
((const qse_cstr_t*)QSE_HTB_KPTL((itr)->pair))
((const qse_xstr_t*)QSE_HTB_KPTL((itr)->pair))
/**
* The #QSE_AWK_VAL_MAP_ITR_VAL macro get the pointer to the value part
@ -308,7 +308,7 @@ typedef enum qse_awk_val_map_data_type_t qse_awk_val_map_data_type_t;
*/
struct qse_awk_val_map_data_t
{
qse_cstr_t key;
qse_xstr_t key;
qse_awk_val_map_data_type_t type;
void* vptr;
};
@ -1411,7 +1411,7 @@ struct qse_awk_rtx_valtostr_out_t
union
{
qse_cstr_t cpl;
qse_xstr_t cpl;
qse_xstr_t cplcpy;
qse_xstr_t cpldup; /* need to free cpldup.ptr */
qse_str_t* strp;
@ -1600,7 +1600,7 @@ QSE_EXPORT void qse_awk_geterrinf (
QSE_EXPORT void qse_awk_seterrnum (
qse_awk_t* awk, /**< awk */
qse_awk_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg /**< argument array for formatting
const qse_xstr_t* errarg /**< argument array for formatting
* an error message */
);
@ -1630,7 +1630,7 @@ QSE_EXPORT void qse_awk_geterror (
QSE_EXPORT void qse_awk_seterror (
qse_awk_t* awk, /**< awk */
qse_awk_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg, /**< argument array for formatting
const qse_xstr_t* errarg, /**< argument array for formatting
* an error message */
const qse_awk_loc_t* errloc /**< error location */
);
@ -1851,7 +1851,7 @@ QSE_EXPORT qse_char_t* qse_awk_strxdup (
*/
QSE_EXPORT qse_char_t* qse_awk_cstrdup (
qse_awk_t* awk, /**< awk */
const qse_cstr_t* str /**< string */
const qse_xstr_t* str /**< string */
);
/**
@ -2223,7 +2223,7 @@ QSE_EXPORT void qse_awk_rtx_geterror (
QSE_EXPORT void qse_awk_rtx_seterrnum (
qse_awk_rtx_t* rtx, /**< runtime context */
qse_awk_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg /**< arguments to format error message */
const qse_xstr_t* errarg /**< arguments to format error message */
);
/**
@ -2240,7 +2240,7 @@ QSE_EXPORT void qse_awk_rtx_seterrinf (
QSE_EXPORT void qse_awk_rtx_seterror (
qse_awk_rtx_t* rtx, /**< runtime context */
qse_awk_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg, /**< argument array for formatting
const qse_xstr_t* errarg, /**< argument array for formatting
* an error message */
const qse_awk_loc_t* errloc /**< error line */
);
@ -2261,7 +2261,7 @@ QSE_EXPORT int qse_awk_rtx_clrrec (
QSE_EXPORT int qse_awk_rtx_setrec (
qse_awk_rtx_t* rtx, /**< runtime context */
qse_size_t idx, /**< 0 for $0, N for $N */
const qse_cstr_t* str /**< string */
const qse_xstr_t* str /**< string */
);
/**
@ -2339,23 +2339,14 @@ QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithxstr (
const qse_xstr_t* str
);
/**
* The qse_awk_rtx_makestrvalwithcstr() function creates a string value.
* \return value on success, #QSE_NULL on failure
*/
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithcstr (
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithmxstr (
qse_awk_rtx_t* rtx,
const qse_cstr_t* str
const qse_mxstr_t* mxstr
);
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithmcstr (
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithwxstr (
qse_awk_rtx_t* rtx,
const qse_mcstr_t* mcstr
);
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithwcstr (
qse_awk_rtx_t* rtx,
const qse_wcstr_t* wcstr
const qse_wxstr_t* wxstr
);
/**
@ -2399,9 +2390,9 @@ QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makenstrvalwithstr (
* \b nstr is 1.
* \return value on success, #QSE_NULL on failure
*/
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makenstrvalwithcstr (
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makenstrvalwithxstr (
qse_awk_rtx_t* rtx,
const qse_cstr_t* str
const qse_xstr_t* str
);
/**
@ -2410,7 +2401,7 @@ QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makenstrvalwithcstr (
*/
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makerexval (
qse_awk_rtx_t* rtx,
const qse_cstr_t* str,
const qse_xstr_t* str,
void* code[2]
);

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

View File

@ -186,7 +186,7 @@ QSE_EXPORT int qse_htrd_halt (
QSE_EXPORT int qse_htrd_scanqparam (
qse_htrd_t* http,
const qse_mcstr_t* cstr
const qse_mxstr_t* cstr
);
#ifdef __cplusplus

View File

@ -169,7 +169,7 @@ QSE_EXPORT void qse_htre_clear (
QSE_EXPORT int qse_htre_setstrfromcstr (
qse_htre_t* re,
qse_mbs_t* str,
const qse_mcstr_t* cstr
const qse_mxstr_t* cstr
);
QSE_EXPORT int qse_htre_setstrfromxstr (

View File

@ -176,7 +176,7 @@ QSE_EXPORT qse_http_method_t qse_mbstohttpmethod (
);
QSE_EXPORT qse_http_method_t qse_mcstrtohttpmethod (
const qse_mcstr_t* name
const qse_mxstr_t* name
);
QSE_EXPORT int qse_parsehttprange (

View File

@ -76,7 +76,7 @@ struct qse_httpd_serverstd_realm_t
typedef struct qse_httpd_serverstd_auth_t qse_httpd_serverstd_auth_t;
struct qse_httpd_serverstd_auth_t
{
qse_mcstr_t key;
qse_mxstr_t key;
int authok;
};

View File

@ -246,7 +246,7 @@ public:
///
void setError (
errnum_t num, ///< error number
const cstr_t* args = QSE_NULL, ///< string array for formatting
const xstr_t* args = QSE_NULL, ///< string array for formatting
/// an error message
const loc_t* loc = QSE_NULL ///< error location
);

View File

@ -561,7 +561,7 @@ QSE_EXPORT void qse_sed_geterror (
QSE_EXPORT void qse_sed_seterrnum (
qse_sed_t* sed, /**< stream editor */
qse_sed_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg /**< argument for formatting error message */
const qse_xstr_t* errarg /**< argument for formatting error message */
);
/**
@ -583,7 +583,7 @@ QSE_EXPORT void qse_sed_seterrmsg (
QSE_EXPORT void qse_sed_seterror (
qse_sed_t* sed, /**< stream editor */
qse_sed_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg, /**< array of arguments for formatting
const qse_xstr_t* errarg, /**< array of arguments for formatting
* an error message */
const qse_sed_loc_t* errloc /**< error location */
);
@ -722,7 +722,7 @@ QSE_EXPORT void qse_sed_freemem (
QSE_EXPORT void qse_sed_getspace (
qse_sed_t* sed,
qse_sed_space_t space,
qse_cstr_t* str
qse_xstr_t* str
);
#ifdef __cplusplus

View File

@ -618,8 +618,7 @@ struct qse_link_t
/**
* 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
* with the #qse_mcstr_t type except the constness on the @a ptr field.
* string and the number of characters.
*/
struct qse_mxstr_t
{
@ -630,8 +629,7 @@ typedef struct qse_mxstr_t qse_mxstr_t;
/**
* The qse_wxstr_t type defines a structure combining a pointer to a character
* string and the number of characters. It is designed to be interchangeable
* with the #qse_wcstr_t type except the constness on the @a ptr field.
* string and the number of characters.
*/
struct qse_wxstr_t
{
@ -640,50 +638,12 @@ struct qse_wxstr_t
};
typedef struct qse_wxstr_t qse_wxstr_t;
/**
* The qse_mcstr_t type defines a structure combining a pointer to
* a constant character string and the number of characters.
* It is designed to be interchangeable with the #qse_mxstr_t type
* except the constness on the @a ptr field.
*/
struct qse_mcstr_t
{
const qse_mchar_t* ptr; /**< pointer to a const character string */
qse_size_t len; /**< the number of characters */
};
typedef struct qse_mcstr_t qse_mcstr_t;
/**
* The qse_wcstr_t type defines a structure combining a pointer to
* a constant character string and the number of characters.
* It is designed to be interchangeable with the #qse_wxstr_t type
* except the constness on the @a ptr field.
*/
struct qse_wcstr_t
{
const qse_wchar_t* ptr; /**< pointer to a const character string */
qse_size_t len; /**< the number of characters */
};
typedef struct qse_wcstr_t qse_wcstr_t;
#if defined(QSE_CHAR_IS_MCHAR)
typedef qse_mxstr_t qse_xstr_t;
typedef qse_mcstr_t qse_cstr_t;
#else
typedef qse_wxstr_t qse_xstr_t;
typedef qse_wcstr_t qse_cstr_t;
#endif
/**
* The qse_cptl_t type defines a pair type of a constant pointer and a length.
*/
struct qse_cptl_t
{
const void* ptr; /**< pointer */
qse_size_t len; /**< length */
};
typedef struct qse_cptl_t qse_cptl_t;
/**
* The qse_xptl_t type defines a pair type of a pointer and a length.
*/

View File

@ -490,7 +490,7 @@ QSE_EXPORT void qse_xli_geterror (
QSE_EXPORT void qse_xli_seterrnum (
qse_xli_t* xli, /**< stream editor */
qse_xli_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg /**< argument for formatting error message */
const qse_xstr_t* errarg /**< argument for formatting error message */
);
/**
@ -512,7 +512,7 @@ QSE_EXPORT void qse_xli_seterrmsg (
QSE_EXPORT void qse_xli_seterror (
qse_xli_t* xli, /**< stream editor */
qse_xli_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg, /**< array of arguments for formatting
const qse_xstr_t* errarg, /**< array of arguments for formatting
* an error message */
const qse_xli_loc_t* errloc /**< error location */
);
@ -558,7 +558,7 @@ QSE_EXPORT qse_xli_pair_t* qse_xli_insertpairwithstr (
const qse_char_t* key,
const qse_char_t* alias,
const qse_char_t* keytag,
const qse_cstr_t* value,
const qse_xstr_t* value,
const qse_char_t* strtag
);
@ -569,7 +569,7 @@ QSE_EXPORT qse_xli_pair_t* qse_xli_insertpairwithstrs (
const qse_char_t* key,
const qse_char_t* alias,
const qse_char_t* keytag,
const qse_cstr_t value[],
const qse_xstr_t value[],
qse_size_t count
);
@ -614,7 +614,7 @@ QSE_EXPORT qse_xli_str_t* qse_xli_addsegtostr (
qse_xli_t* xli,
qse_xli_str_t* str,
const qse_char_t* tag,
const qse_cstr_t* value
const qse_xstr_t* value
);
/**

View File

@ -594,12 +594,12 @@ int Awk::Value::setStr (Run* r, const char_t* str, size_t len, bool numeric)
{
val_t* tmp;
cstr_t cstr;
cstr.ptr = str;
xstr_t cstr;
cstr.ptr = (char_t*)str;
cstr.len = len;
tmp = numeric? qse_awk_rtx_makenstrvalwithcstr (r->rtx, &cstr):
qse_awk_rtx_makestrvalwithcstr (r->rtx, &cstr);
tmp = numeric? qse_awk_rtx_makenstrvalwithxstr (r->rtx, &cstr):
qse_awk_rtx_makestrvalwithxstr (r->rtx, &cstr);
if (tmp == QSE_NULL)
{
r->awk->retrieveError (r);
@ -757,12 +757,12 @@ int Awk::Value::setIndexedStr (
{
val_t* tmp;
cstr_t cstr;
cstr.ptr = str;
xstr_t cstr;
cstr.ptr = (char_t*)str;
cstr.len = len;
tmp = numeric? qse_awk_rtx_makenstrvalwithcstr (r->rtx, &cstr):
qse_awk_rtx_makestrvalwithcstr (r->rtx, &cstr);
tmp = numeric? qse_awk_rtx_makenstrvalwithxstr (r->rtx, &cstr):
qse_awk_rtx_makestrvalwithxstr (r->rtx, &cstr);
if (tmp == QSE_NULL)
{
r->awk->retrieveError (r);
@ -928,7 +928,7 @@ const Awk::char_t* Awk::Run::getErrorMessage () const
return qse_awk_rtx_geterrmsg (this->rtx);
}
void Awk::Run::setError (errnum_t code, const cstr_t* args, const loc_t* loc)
void Awk::Run::setError (errnum_t code, const xstr_t* args, const loc_t* loc)
{
QSE_ASSERT (this->rtx != QSE_NULL);
qse_awk_rtx_seterror (this->rtx, code, args, loc);
@ -1049,7 +1049,7 @@ const Awk::char_t* Awk::getErrorMessage () const
return this->errinf.msg;
}
void Awk::setError (errnum_t code, const cstr_t* args, const loc_t* loc)
void Awk::setError (errnum_t code, const xstr_t* args, const loc_t* loc)
{
if (awk != QSE_NULL)
{
@ -1371,7 +1371,7 @@ int Awk::dispatch_function (Run* run, const fnc_info_t* fi)
pair = qse_htb_search (functionMap, fi->name.ptr, fi->name.len);
if (pair == QSE_NULL)
{
run->setError (QSE_AWK_EFUNNF, (cstr_t*)&fi->name);
run->setError (QSE_AWK_EFUNNF, &fi->name);
return -1;
}

View File

@ -81,8 +81,8 @@ static qse_sio_t* open_sio (Awk* awk, StdAwk::Run* run, const qse_char_t* file,
sio = qse_sio_open ((run? ((Awk*)*run)->getMmgr(): awk->getMmgr()), 0, file, flags);
if (sio == QSE_NULL)
{
qse_cstr_t ea;
ea.ptr = file;
qse_xstr_t ea;
ea.ptr = (StdAwk::char_t*)file;
ea.len = qse_strlen (file);
if (run) run->setError (QSE_AWK_EOPEN, &ea);
else awk->setError (QSE_AWK_EOPEN, &ea);
@ -93,7 +93,7 @@ static qse_sio_t* open_sio (Awk* awk, StdAwk::Run* run, const qse_char_t* file,
static qse_sio_t* open_sio_std (Awk* awk, StdAwk::Run* run, qse_sio_std_t std, int flags)
{
qse_sio_t* sio;
static const qse_char_t* std_names[] =
static const StdAwk::char_t* std_names[] =
{
QSE_T("stdin"),
QSE_T("stdout"),
@ -104,8 +104,8 @@ static qse_sio_t* open_sio_std (Awk* awk, StdAwk::Run* run, qse_sio_std_t std, i
sio = qse_sio_openstd ((run? ((Awk*)*run)->getMmgr(): awk->getMmgr()), 0, std, flags);
if (sio == QSE_NULL)
{
qse_cstr_t ea;
ea.ptr = std_names[std];
qse_xstr_t ea;
ea.ptr = (StdAwk::char_t*)std_names[std];
ea.len = qse_strlen (std_names[std]);
if (run) run->setError (QSE_AWK_EOPEN, &ea);
else awk->setError (QSE_AWK_EOPEN, &ea);
@ -898,8 +898,8 @@ int StdAwk::open_console_in (Console& io)
if (qse_strlen(file) != this->runarg.ptr[this->runarg_index].len)
{
cstr_t arg;
arg.ptr = file;
xstr_t arg;
arg.ptr = (char_t*)file;
arg.len = qse_strlen (arg.ptr);
((Run*)io)->setError (QSE_AWK_EIONMNL, &arg);
return -1;
@ -947,7 +947,7 @@ int StdAwk::open_console_in (Console& io)
if (qse_strlen(as.ptr) < as.len)
{
/* the name contains one or more '\0' */
cstr_t arg;
xstr_t arg;
arg.ptr = as.ptr;
arg.len = qse_strlen (as.ptr);
((Run*)io)->setError (QSE_AWK_EIONMNL, &arg);
@ -1031,8 +1031,8 @@ int StdAwk::open_console_out (Console& io)
if (qse_strlen(file) != this->ofile.ptr[this->ofile_index].len)
{
cstr_t arg;
arg.ptr = file;
xstr_t arg;
arg.ptr = (char_t*)file;
arg.len = qse_strlen (arg.ptr);
((Run*)io)->setError (QSE_AWK_EIONMNL, &arg);
return -1;

View File

@ -88,7 +88,7 @@ struct qse_awk_tree_t
{
qse_size_t ngbls; /* total number of globals */
qse_size_t ngbls_base; /* number of intrinsic globals */
qse_cstr_t cur_fun;
qse_xstr_t cur_fun;
qse_htb_t* funs; /* awk function map */
qse_awk_nde_t* begin;

View File

@ -214,7 +214,7 @@ void qse_awk_geterror (
}
void qse_awk_seterrnum (
qse_awk_t* awk, qse_awk_errnum_t errnum, const qse_cstr_t* errarg)
qse_awk_t* awk, qse_awk_errnum_t errnum, const qse_xstr_t* errarg)
{
qse_awk_seterror (awk, errnum, errarg, QSE_NULL);
}
@ -225,7 +225,7 @@ void qse_awk_seterrinf (qse_awk_t* awk, const qse_awk_errinf_t* errinf)
}
void qse_awk_seterror (
qse_awk_t* awk, qse_awk_errnum_t errnum, const qse_cstr_t* errarg,
qse_awk_t* awk, qse_awk_errnum_t errnum, const qse_xstr_t* errarg,
const qse_awk_loc_t* errloc)
{
const qse_char_t* errfmt;
@ -283,7 +283,7 @@ void qse_awk_rtx_geterror (
}
void qse_awk_rtx_seterrnum (
qse_awk_rtx_t* rtx, qse_awk_errnum_t errnum, const qse_cstr_t* errarg)
qse_awk_rtx_t* rtx, qse_awk_errnum_t errnum, const qse_xstr_t* errarg)
{
qse_awk_rtx_seterror (rtx, errnum, errarg, 0);
}
@ -294,7 +294,7 @@ void qse_awk_rtx_seterrinf (qse_awk_rtx_t* rtx, const qse_awk_errinf_t* errinf)
}
void qse_awk_rtx_seterror (
qse_awk_rtx_t* rtx, qse_awk_errnum_t errnum, const qse_cstr_t* errarg,
qse_awk_rtx_t* rtx, qse_awk_errnum_t errnum, const qse_xstr_t* errarg,
const qse_awk_loc_t* errloc)
{
const qse_char_t* errfmt;

View File

@ -80,9 +80,9 @@ qse_awk_fnc_t* qse_awk_addfnc (qse_awk_t* awk, const qse_char_t* name, const qse
qse_awk_fnc_t* fnc;
qse_size_t fnc_size;
qse_size_t speclen;
qse_cstr_t ncs;
qse_xstr_t ncs;
ncs.ptr = name;
ncs.ptr = (qse_char_t*)name;
ncs.len = qse_strlen (name);
if (ncs.len <= 0)
@ -134,9 +134,9 @@ qse_awk_fnc_t* qse_awk_addfnc (qse_awk_t* awk, const qse_char_t* name, const qse
int qse_awk_delfnc (qse_awk_t* awk, const qse_char_t* name)
{
qse_cstr_t ncs;
qse_xstr_t ncs;
ncs.ptr = name;
ncs.ptr = (qse_char_t*)name;
ncs.len = qse_strlen (name);
if (qse_htb_delete (awk->fnc.user, ncs.ptr, ncs.len) <= -1)
@ -153,7 +153,7 @@ void qse_awk_clrfnc (qse_awk_t* awk)
qse_htb_clear (awk->fnc.user);
}
qse_awk_fnc_t* qse_awk_findfnc (qse_awk_t* awk, const qse_cstr_t* name)
qse_awk_fnc_t* qse_awk_findfnc (qse_awk_t* awk, const qse_xstr_t* name)
{
qse_htb_pair_t* pair;
int i;
@ -598,14 +598,14 @@ int qse_awk_fnc_split (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
qse_size_t nargs;
qse_awk_val_t* a0, * a1, * a2, * t1, * t2;
qse_cstr_t str, fs;
qse_xstr_t str, fs;
qse_char_t* str_free = QSE_NULL, * fs_free = QSE_NULL;
const qse_char_t* p;
qse_size_t str_left, org_len;
void* fs_rex = QSE_NULL;
void* fs_rex_free = QSE_NULL;
qse_cstr_t tok;
qse_xstr_t tok;
qse_awk_int_t nflds;
qse_awk_errnum_t errnum;
@ -743,8 +743,8 @@ int qse_awk_fnc_split (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
/* create the field string - however, the split function must
* create a numeric string if the string is a number */
/*t2 = qse_awk_rtx_makestrvalwithcstr (rtx, &tok);*/
t2 = qse_awk_rtx_makenstrvalwithcstr (rtx, &tok);
/*t2 = qse_awk_rtx_makestrvalwithxstr (rtx, &tok);*/
t2 = qse_awk_rtx_makenstrvalwithxstr (rtx, &tok);
if (t2 == QSE_NULL) goto oops;
/* put it into the map */
@ -811,7 +811,7 @@ int qse_awk_fnc_tolower (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
for (i = 0; i < str.len; i++) str.ptr[i] = QSE_AWK_TOLOWER (rtx->awk, str.ptr[i]);
r = qse_awk_rtx_makestrvalwithcstr (rtx, (qse_cstr_t*)&str);
r = qse_awk_rtx_makestrvalwithxstr (rtx, &str);
if (r == QSE_NULL)
{
qse_awk_rtx_freevalstr (rtx, a0, str.ptr);
@ -840,7 +840,7 @@ int qse_awk_fnc_toupper (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
for (i = 0; i < str.len; i++) str.ptr[i] = QSE_AWK_TOUPPER (rtx->awk, str.ptr[i]);
r = qse_awk_rtx_makestrvalwithcstr (rtx, (qse_cstr_t*)&str);
r = qse_awk_rtx_makestrvalwithxstr (rtx, &str);
if (r == QSE_NULL)
{
qse_awk_rtx_freevalstr (rtx, a0, str.ptr);
@ -857,7 +857,7 @@ static int __substitute (qse_awk_rtx_t* run, qse_awk_int_t max_count)
qse_size_t nargs;
qse_awk_val_t* a0, * a1, * a2, * v;
qse_cstr_t s0, s1, s2;
qse_xstr_t s0, s1, s2;
const qse_char_t* s2_end;
qse_char_t* s0_free = QSE_NULL;
@ -870,7 +870,7 @@ static int __substitute (qse_awk_rtx_t* run, qse_awk_int_t max_count)
qse_str_t new;
int new_inited = 0;
qse_cstr_t mat, pmat, cur;
qse_xstr_t mat, pmat, cur;
qse_awk_int_t sub_count;
@ -1070,14 +1070,14 @@ static int __substitute (qse_awk_rtx_t* run, qse_awk_int_t max_count)
if (a2 == QSE_NULL)
{
int n;
n = qse_awk_rtx_setrec (run, 0, QSE_STR_CSTR(&new));
n = qse_awk_rtx_setrec (run, 0, QSE_STR_XSTR(&new));
if (n <= -1) goto oops;
}
else
{
int n;
v = qse_awk_rtx_makestrvalwithcstr (run, QSE_STR_CSTR(&new));
v = qse_awk_rtx_makestrvalwithxstr (run, QSE_STR_XSTR(&new));
if (v == QSE_NULL) goto oops;
qse_awk_rtx_refupval (run, v);
n = qse_awk_rtx_setrefval (run, (qse_awk_val_ref_t*)a2, v);
@ -1131,7 +1131,7 @@ int qse_awk_fnc_match (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
qse_size_t len0;
qse_awk_int_t idx, start = 1;
int n;
qse_cstr_t mat;
qse_xstr_t mat;
nargs = qse_awk_rtx_getnargs (rtx);
QSE_ASSERT (nargs >= 2 && nargs <= 3);
@ -1173,7 +1173,7 @@ int qse_awk_fnc_match (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
if (start > len0 || start <= 0) n = 0;
else
{
qse_cstr_t tmp;
qse_xstr_t tmp;
/*TODO: must use str0,len0? */
tmp.ptr = str0 + start - 1;
@ -1258,7 +1258,7 @@ int qse_awk_fnc_sprintf (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
qse_awk_rtx_freevalstr (rtx, a0, cs0.ptr);
if (x.ptr == QSE_NULL) goto oops;
a0 = qse_awk_rtx_makestrvalwithcstr (rtx, (qse_cstr_t*)&x);
a0 = qse_awk_rtx_makestrvalwithxstr (rtx, &x);
if (a0 == QSE_NULL) goto oops;
qse_str_fini (&fbu);

View File

@ -42,7 +42,7 @@ struct qse_awk_fnc_t
extern "C" {
#endif
qse_awk_fnc_t* qse_awk_findfnc (qse_awk_t* awk, const qse_cstr_t* name);
qse_awk_fnc_t* qse_awk_findfnc (qse_awk_t* awk, const qse_xstr_t* name);
int qse_awk_fnc_index (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi);
int qse_awk_fnc_rindex (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi);

View File

@ -69,7 +69,7 @@ qse_char_t* qse_awk_strxdup (qse_awk_t* awk, const qse_char_t* s, qse_size_t l)
return ptr;
}
qse_char_t* qse_awk_cstrdup (qse_awk_t* awk, const qse_cstr_t* s)
qse_char_t* qse_awk_cstrdup (qse_awk_t* awk, const qse_xstr_t* s)
{
qse_char_t* ptr = qse_cstrdup (s, awk->mmgr);
if (ptr == QSE_NULL) qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
@ -661,7 +661,7 @@ qse_size_t qse_awk_inttostr (
qse_char_t* qse_awk_rtx_strtok (
qse_awk_rtx_t* rtx, const qse_char_t* s,
const qse_char_t* delim, qse_cstr_t* tok)
const qse_char_t* delim, qse_xstr_t* tok)
{
return qse_awk_rtx_strxntok (
rtx, s, qse_strlen(s), delim, qse_strlen(delim), tok);
@ -669,7 +669,7 @@ qse_char_t* qse_awk_rtx_strtok (
qse_char_t* qse_awk_rtx_strxtok (
qse_awk_rtx_t* rtx, const qse_char_t* s, qse_size_t len,
const qse_char_t* delim, qse_cstr_t* tok)
const qse_char_t* delim, qse_xstr_t* tok)
{
return qse_awk_rtx_strxntok (
rtx, s, len, delim, qse_strlen(delim), tok);
@ -678,7 +678,7 @@ qse_char_t* qse_awk_rtx_strxtok (
qse_char_t* qse_awk_rtx_strntok (
qse_awk_rtx_t* rtx, const qse_char_t* s,
const qse_char_t* delim, qse_size_t delim_len,
qse_cstr_t* tok)
qse_xstr_t* tok)
{
return qse_awk_rtx_strxntok (
rtx, s, qse_strlen(s), delim, delim_len, tok);
@ -686,7 +686,7 @@ qse_char_t* qse_awk_rtx_strntok (
qse_char_t* qse_awk_rtx_strxntok (
qse_awk_rtx_t* rtx, const qse_char_t* s, qse_size_t len,
const qse_char_t* delim, qse_size_t delim_len, qse_cstr_t* tok)
const qse_char_t* delim, qse_size_t delim_len, qse_xstr_t* tok)
{
const qse_char_t* p = s, *d;
const qse_char_t* end = s + len;
@ -865,7 +865,7 @@ exit_loop:
}
else
{
tok->ptr = sp;
tok->ptr = (qse_char_t*)sp;
tok->len = ep - sp + 1;
}
@ -880,20 +880,20 @@ qse_char_t* qse_awk_rtx_strxntokbyrex (
qse_awk_rtx_t* rtx,
const qse_char_t* str, qse_size_t len,
const qse_char_t* substr, qse_size_t sublen,
void* rex, qse_cstr_t* tok,
void* rex, qse_xstr_t* tok,
qse_awk_errnum_t* errnum)
{
int n;
qse_size_t i;
qse_cstr_t match, s, cursub, realsub;
qse_xstr_t match, s, cursub, realsub;
s.ptr = str;
s.ptr = (qse_char_t*)str;
s.len = len;
cursub.ptr = substr;
cursub.ptr = (qse_char_t*)substr;
cursub.len = sublen;
realsub.ptr = substr;
realsub.ptr = (qse_char_t*)substr;
realsub.len = sublen;
while (cursub.len > 0)
@ -938,7 +938,7 @@ qse_char_t* qse_awk_rtx_strxntokbyrex (
/* adjust the substring by skipping the leading
* spaces and retry matching */
realsub.ptr = substr + match.len;
realsub.ptr = (qse_char_t*)substr + match.len;
realsub.len -= match.len;
}
else break;
@ -989,7 +989,7 @@ exit_loop:
qse_char_t* qse_awk_rtx_strxnfld (
qse_awk_rtx_t* rtx, qse_char_t* str, qse_size_t len,
qse_char_t fs, qse_char_t ec, qse_char_t lq, qse_char_t rq,
qse_cstr_t* tok)
qse_xstr_t* tok)
{
qse_char_t* p = str;
qse_char_t* end = str + len;
@ -1191,8 +1191,8 @@ int qse_awk_buildrex (
static int matchtre (
qse_awk_t* awk, qse_tre_t* tre, int opt,
const qse_cstr_t* str, qse_cstr_t* mat,
qse_cstr_t submat[9], qse_awk_errnum_t* errnum)
const qse_xstr_t* str, qse_xstr_t* mat,
qse_xstr_t submat[9], qse_awk_errnum_t* errnum)
{
int n;
qse_tre_match_t match[10] = { { 0, 0 }, };
@ -1240,8 +1240,8 @@ static int matchtre (
int qse_awk_matchrex (
qse_awk_t* awk, void* code, int icase,
const qse_cstr_t* str, const qse_cstr_t* substr,
qse_cstr_t* match, qse_awk_errnum_t* errnum)
const qse_xstr_t* str, const qse_xstr_t* substr,
qse_xstr_t* match, qse_awk_errnum_t* errnum)
{
#if defined(USE_REX)
int x;
@ -1288,7 +1288,7 @@ void qse_awk_freerex (qse_awk_t* awk, void* code, void* icode)
int qse_awk_rtx_matchrex (
qse_awk_rtx_t* rtx, qse_awk_val_t* val,
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)
{
void* code;
int icase, x;

View File

@ -27,19 +27,19 @@ extern "C" {
qse_char_t* qse_awk_rtx_strtok (
qse_awk_rtx_t* rtx, const qse_char_t* s,
const qse_char_t* delim, qse_cstr_t* tok);
const qse_char_t* delim, qse_xstr_t* tok);
qse_char_t* qse_awk_rtx_strxtok (
qse_awk_rtx_t* rtx, const qse_char_t* s, qse_size_t len,
const qse_char_t* delim, qse_cstr_t* tok);
const qse_char_t* delim, qse_xstr_t* tok);
qse_char_t* qse_awk_rtx_strntok (
qse_awk_rtx_t* rtx, const qse_char_t* s,
const qse_char_t* delim, qse_size_t delim_len, qse_cstr_t* tok);
const qse_char_t* delim, qse_size_t delim_len, qse_xstr_t* tok);
qse_char_t* qse_awk_rtx_strxntok (
qse_awk_rtx_t* rtx, const qse_char_t* s, qse_size_t len,
const qse_char_t* delim, qse_size_t delim_len, qse_cstr_t* tok);
const qse_char_t* delim, qse_size_t delim_len, qse_xstr_t* tok);
qse_char_t* qse_awk_rtx_strxntokbyrex (
qse_awk_rtx_t* rtx,
@ -48,7 +48,7 @@ qse_char_t* qse_awk_rtx_strxntokbyrex (
const qse_char_t* substr,
qse_size_t sublen,
void* rex,
qse_cstr_t* tok,
qse_xstr_t* tok,
qse_awk_errnum_t* errnum
);
@ -60,7 +60,7 @@ qse_char_t* qse_awk_rtx_strxnfld (
qse_char_t lq,
qse_char_t rq,
qse_char_t ec,
qse_cstr_t* tok
qse_xstr_t* tok
);
int qse_awk_buildrex (
@ -74,16 +74,16 @@ int qse_awk_buildrex (
int qse_awk_matchrex (
qse_awk_t* awk, void* code, int icase,
const qse_cstr_t* str, const qse_cstr_t* substr,
qse_cstr_t* match, qse_awk_errnum_t* errnum
const qse_xstr_t* str, const qse_xstr_t* substr,
qse_xstr_t* match, qse_awk_errnum_t* errnum
);
void qse_awk_freerex (qse_awk_t* awk, void* code, void* icode);
int qse_awk_rtx_matchrex (
qse_awk_rtx_t* rtx, qse_awk_val_t* val,
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
);
#ifdef __cplusplus

View File

@ -504,7 +504,7 @@ static int fnc_dir_read (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
}
else
{
ret = read_byid (rtx, list, id, qse_awk_rtx_getarg (rtx, 1));
ret = read_byid (rtx, list, id, (qse_awk_val_ref_t*)qse_awk_rtx_getarg (rtx, 1));
if (ret == -9999) return -1;
}
@ -551,7 +551,7 @@ static inttab_t inttab[] =
static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_sym_t* sym)
{
qse_cstr_t ea;
qse_xstr_t ea;
int left, right, mid, n;
left = 0; right = QSE_COUNTOF(fnctab) - 1;
@ -587,7 +587,7 @@ static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qs
}
}
ea.ptr = name;
ea.ptr = (qse_char_t*)name;
ea.len = qse_strlen(name);
qse_awk_seterror (awk, QSE_AWK_ENOENT, &ea, QSE_NULL);
return -1;

View File

@ -488,7 +488,7 @@ static fnctab_t fnctab[] =
static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_sym_t* sym)
{
qse_cstr_t ea;
qse_xstr_t ea;
int left, right, mid, n;
left = 0; right = QSE_COUNTOF(fnctab) - 1;
@ -526,7 +526,7 @@ static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qs
}
#endif
ea.ptr = name;
ea.ptr = (qse_char_t*)name;
ea.len = qse_strlen(name);
qse_awk_seterror (awk, QSE_AWK_ENOENT, &ea, QSE_NULL);
return -1;

View File

@ -193,7 +193,7 @@ static inttab_t inttab[] =
static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_sym_t* sym)
{
qse_cstr_t ea;
qse_xstr_t ea;
int left, right, mid, n;
left = 0; right = QSE_COUNTOF(fnctab) - 1;

View File

@ -186,7 +186,7 @@ static int fnc_str_to_str (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
}
qse_awk_rtx_refupval (rtx, tmp);
n = qse_awk_rtx_setrefval (rtx, qse_awk_rtx_getarg (rtx, 2), tmp);
n = qse_awk_rtx_setrefval (rtx, (qse_awk_val_ref_t*)qse_awk_rtx_getarg (rtx, 2), tmp);
qse_awk_rtx_refdownval (rtx, tmp);
if (n <= -1)
{
@ -225,7 +225,7 @@ static fnctab_t fnctab[] =
static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_sym_t* sym)
{
qse_cstr_t ea;
qse_xstr_t ea;
int left, right, mid, n;
left = 0; right = QSE_COUNTOF(fnctab) - 1;
@ -245,7 +245,7 @@ static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qs
}
}
ea.ptr = name;
ea.ptr = (qse_char_t*)name;
ea.len = qse_strlen(name);
qse_awk_seterror (awk, QSE_AWK_ENOENT, &ea, QSE_NULL);
return -1;

View File

@ -248,7 +248,7 @@ static fnctab_t fnctab[] =
static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_sym_t* sym)
{
qse_cstr_t ea;
qse_xstr_t ea;
int left, right, mid, n;
left = 0; right = QSE_COUNTOF(fnctab) - 1;
@ -286,7 +286,7 @@ static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qs
}
#endif
ea.ptr = name;
ea.ptr = (qse_char_t*)name;
ea.len = qse_strlen(name);
qse_awk_seterror (awk, QSE_AWK_ENOENT, &ea, QSE_NULL);
return -1;

View File

@ -461,13 +461,18 @@ static int fnc_settime (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
{
qse_awk_val_t* retv;
qse_ntime_t now;
qse_awk_int_t tmp;
int rx;
now.nsec = 0;
if (qse_awk_rtx_valtoint (rtx, qse_awk_rtx_getarg (rtx, 0), &now.sec) <= -1 ||
qse_settime (&now) <= -1) rx = -1;
if (qse_awk_rtx_valtoint (rtx, qse_awk_rtx_getarg (rtx, 0), &tmp) <= -1) rx = -1;
else
{
now.sec = tmp;
if (qse_settime (&now) <= -1) rx = -1;
else rx = 0;
}
retv = qse_awk_rtx_makeintval (rtx, rx);
if (retv == QSE_NULL) return -1;
@ -578,7 +583,7 @@ static int fnc_getnwifcfg (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
{
int x;
qse_awk_rtx_refupval (rtx, tmp);
x = qse_awk_rtx_setrefval (rtx, qse_awk_rtx_getarg (rtx, 2), tmp);
x = qse_awk_rtx_setrefval (rtx, (qse_awk_val_ref_t*)qse_awk_rtx_getarg (rtx, 2), tmp);
qse_awk_rtx_refdownval (rtx, tmp);
if (x <= -1) return -1;
ret = 0;
@ -676,7 +681,7 @@ static inttab_t inttab[] =
static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_sym_t* sym)
{
qse_cstr_t ea;
qse_xstr_t ea;
int left, right, mid, n;
left = 0; right = QSE_COUNTOF(fnctab) - 1;
@ -712,7 +717,7 @@ static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qs
}
}
ea.ptr = name;
ea.ptr = (qse_char_t*)name;
ea.len = qse_strlen(name);
qse_awk_seterror (awk, QSE_AWK_ENOENT, &ea, QSE_NULL);
return -1;

View File

@ -574,7 +574,7 @@ static int getoption_byid (
uci_foreach_element(&uo->v.list, tmp)
{
const qse_xstr_t* subsep;
qse_cstr_t k[4];
qse_xstr_t k[4];
qse_char_t idxbuf[64];
qse_char_t* kp;
qse_size_t kl;
@ -1329,7 +1329,7 @@ static fnctab_t fnctab[] =
static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_sym_t* sym)
{
qse_cstr_t ea;
qse_xstr_t ea;
int left, right, mid, n;
left = 0; right = QSE_COUNTOF(fnctab) - 1;

View File

@ -177,7 +177,7 @@ struct binmap_t
static int parse_progunit (qse_awk_t* awk);
static qse_awk_t* collect_globals (qse_awk_t* awk);
static void adjust_static_globals (qse_awk_t* awk);
static qse_size_t find_global (qse_awk_t* awk, const qse_cstr_t* name);
static qse_size_t find_global (qse_awk_t* awk, const qse_xstr_t* name);
static qse_awk_t* collect_locals (
qse_awk_t* awk, qse_size_t nlcls, int istop);
@ -252,7 +252,7 @@ static int get_rexstr (qse_awk_t* awk, qse_awk_tok_t* tok);
static int skip_spaces (qse_awk_t* awk);
static int skip_comment (qse_awk_t* awk);
static int classify_ident (qse_awk_t* awk, const qse_cstr_t* name);
static int classify_ident (qse_awk_t* awk, const qse_xstr_t* name);
static int deparse (qse_awk_t* awk);
static qse_htb_walk_t deparse_func (
@ -268,7 +268,7 @@ typedef struct kwent_t kwent_t;
struct kwent_t
{
qse_cstr_t name;
qse_xstr_t name;
int type;
int trait; /* the entry is valid when this option is set */
};
@ -409,7 +409,7 @@ static global_t gtab[] =
qse_awk_seterror (awk, QSE_AWK_ENOERR, QSE_NULL, QSE_NULL)
#define SETERR_TOK(awk,code) \
qse_awk_seterror (awk, code, QSE_STR_CSTR((awk)->tok.name), &(awk)->tok.loc)
qse_awk_seterror (awk, code, QSE_STR_XSTR((awk)->tok.name), &(awk)->tok.loc)
#define SETERR_COD(awk,code) \
qse_awk_seterror (awk, code, QSE_NULL, QSE_NULL)
@ -419,7 +419,7 @@ static global_t gtab[] =
#define SETERR_ARG_LOC(awk,code,ep,el,loc) \
do { \
qse_cstr_t __ea; \
qse_xstr_t __ea; \
__ea.len = (el); __ea.ptr = (ep); \
qse_awk_seterror ((awk), (code), &__ea, (loc)); \
} while (0)
@ -523,7 +523,7 @@ const qse_char_t* qse_awk_getgblname (
return QSE_LDA_DPTR(awk->parse.gbls,idx);
}
void qse_awk_getkwname (qse_awk_t* awk, qse_awk_kwid_t id, qse_cstr_t* s)
void qse_awk_getkwname (qse_awk_t* awk, qse_awk_kwid_t id, qse_xstr_t* s)
{
*s = kwtab[id].name;
}
@ -1101,15 +1101,15 @@ static qse_awk_nde_t* parse_function (qse_awk_t* awk)
/* note that i'm assigning to rederr in the 'if' conditions below.
* i'm not checking equality */
/* check if it is a builtin function */
if ((qse_awk_findfnc (awk, (const qse_cstr_t*)&name) != QSE_NULL && (rederr = QSE_AWK_EFNCRED)) ||
if ((qse_awk_findfnc (awk, &name) != QSE_NULL && (rederr = QSE_AWK_EFNCRED)) ||
/* check if it has already been defined as a function */
(qse_htb_search (awk->tree.funs, name.ptr, name.len) != QSE_NULL && (rederr = QSE_AWK_EFUNRED)) ||
/* check if it conflicts with a named variable */
(qse_htb_search (awk->parse.named, name.ptr, name.len) != QSE_NULL && (rederr = QSE_AWK_EVARRED)) ||
/* check if it coincides to be a global variable name */
(((g = find_global (awk, (const qse_cstr_t*)&name)) != QSE_LDA_NIL) && (rederr = QSE_AWK_EGBLRED)))
(((g = find_global (awk, &name)) != QSE_LDA_NIL) && (rederr = QSE_AWK_EGBLRED)))
{
qse_awk_seterror (awk, rederr, (const qse_cstr_t*)&name, &awk->tok.loc);
qse_awk_seterror (awk, rederr, &name, &awk->tok.loc);
return QSE_NULL;
}
@ -1683,7 +1683,7 @@ static qse_size_t get_global (qse_awk_t* awk, const qse_xstr_t* name)
return QSE_LDA_NIL;
}
static qse_size_t find_global (qse_awk_t* awk, const qse_cstr_t* name)
static qse_size_t find_global (qse_awk_t* awk, const qse_xstr_t* name)
{
qse_size_t i;
qse_lda_t* gbls = awk->parse.gbls;
@ -1699,7 +1699,7 @@ static qse_size_t find_global (qse_awk_t* awk, const qse_cstr_t* name)
}
static int add_global (
qse_awk_t* awk, const qse_cstr_t* name,
qse_awk_t* awk, const qse_xstr_t* name,
qse_awk_loc_t* xloc, int disabled)
{
qse_size_t ngbls;
@ -1785,9 +1785,9 @@ static int add_global (
int qse_awk_addgbl (qse_awk_t* awk, const qse_char_t* name)
{
int n;
qse_cstr_t ncs;
qse_xstr_t ncs;
ncs.ptr = name;
ncs.ptr = (qse_char_t*)name;
ncs.len = qse_strlen(name);;
if (ncs.len <= 0)
{
@ -1817,9 +1817,9 @@ int qse_awk_addgbl (qse_awk_t* awk, const qse_char_t* name)
int qse_awk_delgbl (qse_awk_t* awk, const qse_char_t* name)
{
qse_size_t n;
qse_cstr_t ncs;
qse_xstr_t ncs;
ncs.ptr = name;
ncs.ptr = (qse_char_t*)name;
ncs.len = qse_strlen (name);
if (awk->tree.ngbls > awk->tree.ngbls_base)
@ -1855,9 +1855,9 @@ int qse_awk_delgbl (qse_awk_t* awk, const qse_char_t* name)
int qse_awk_findgbl (qse_awk_t* awk, const qse_char_t* name)
{
qse_size_t n;
qse_cstr_t ncs;
qse_xstr_t ncs;
ncs.ptr = name;
ncs.ptr = (qse_char_t*)name;
ncs.len = qse_strlen (name);
n = qse_lda_search (awk->parse.gbls,
@ -1890,7 +1890,7 @@ static qse_awk_t* collect_globals (qse_awk_t* awk)
}
if (add_global (
awk, QSE_STR_CSTR(awk->tok.name),
awk, QSE_STR_XSTR(awk->tok.name),
&awk->tok.loc, 0) <= -1) return QSE_NULL;
if (get_token(awk) <= -1) return QSE_NULL;
@ -1951,7 +1951,7 @@ static qse_awk_t* collect_locals (
/* check if it conflicts with a builtin function name
* function f() { local length; } */
if (qse_awk_findfnc (awk, (const qse_cstr_t*)&lcl) != QSE_NULL)
if (qse_awk_findfnc (awk, &lcl) != QSE_NULL)
{
SETERR_ARG_LOC (
awk, QSE_AWK_EFNCRED,
@ -2004,7 +2004,7 @@ static qse_awk_t* collect_locals (
}
/* check if it conflicts with global variable names */
n = find_global (awk, (const qse_cstr_t*)&lcl);
n = find_global (awk, &lcl);
if (n != QSE_LDA_NIL)
{
if (n < awk->tree.ngbls_base)
@ -4216,7 +4216,7 @@ static QSE_INLINE int isfunname (qse_awk_t* awk, const qse_xstr_t* name)
static QSE_INLINE int isfnname (qse_awk_t* awk, const qse_xstr_t* name)
{
if (qse_awk_findfnc (awk, (const qse_cstr_t*)name) != QSE_NULL)
if (qse_awk_findfnc (awk, name) != QSE_NULL)
{
/* implicit function */
return FNTYPE_FNC;
@ -4248,7 +4248,7 @@ static qse_awk_nde_t* parse_primary_int (qse_awk_t* awk, const qse_awk_loc_t* x
/* remember the literal in the original form */
nde->len = QSE_STR_LEN(awk->tok.name);
nde->str = qse_awk_cstrdup (awk, QSE_STR_CSTR(awk->tok.name));
nde->str = qse_awk_cstrdup (awk, QSE_STR_XSTR(awk->tok.name));
if (nde->str == QSE_NULL || get_token(awk) <= -1) goto oops;
return (qse_awk_nde_t*)nde;
@ -4282,7 +4282,7 @@ static qse_awk_nde_t* parse_primary_flt (qse_awk_t* awk, const qse_awk_loc_t* x
/* remember the literal in the original form */
nde->len = QSE_STR_LEN(awk->tok.name);
nde->str = qse_awk_cstrdup (awk, QSE_STR_CSTR(awk->tok.name));
nde->str = qse_awk_cstrdup (awk, QSE_STR_XSTR(awk->tok.name));
if (nde->str == QSE_NULL || get_token(awk) <= -1) goto oops;
return (qse_awk_nde_t*)nde;
@ -4308,7 +4308,7 @@ static qse_awk_nde_t* parse_primary_str (qse_awk_t* awk, const qse_awk_loc_t* x
nde->type = QSE_AWK_NDE_STR;
nde->loc = *xloc;
nde->len = QSE_STR_LEN(awk->tok.name);
nde->ptr = qse_awk_cstrdup (awk, QSE_STR_CSTR(awk->tok.name));
nde->ptr = qse_awk_cstrdup (awk, QSE_STR_XSTR(awk->tok.name));
if (nde->ptr == QSE_NULL || get_token(awk) <= -1) goto oops;
return (qse_awk_nde_t*)nde;
@ -4353,7 +4353,7 @@ static qse_awk_nde_t* parse_primary_rex (qse_awk_t* awk, const qse_awk_loc_t* x
nde->type = QSE_AWK_NDE_REX;
nde->loc = *xloc;
nde->str.len = QSE_STR_LEN(awk->tok.name);
nde->str.ptr = qse_awk_cstrdup (awk, QSE_STR_CSTR(awk->tok.name));
nde->str.ptr = qse_awk_cstrdup (awk, QSE_STR_XSTR(awk->tok.name));
if (nde->str.ptr == QSE_NULL) goto oops;
if (qse_awk_buildrex (awk, QSE_STR_PTR(awk->tok.name), QSE_STR_LEN(awk->tok.name), &errnum, &nde->code[0], &nde->code[1]) <= -1)
@ -4861,7 +4861,7 @@ static qse_awk_nde_t* parse_primary_ident_noseg (
qse_awk_nde_t* nde = QSE_NULL;
/* check if name is an intrinsic function name */
fnc = qse_awk_findfnc (awk, (const qse_cstr_t*)name);
fnc = qse_awk_findfnc (awk, name);
if (fnc)
{
if (MATCH(awk,TOK_LPAREN) || fnc->dfl0)
@ -6046,7 +6046,7 @@ retry:
QSE_AWK_ISALPHA (awk, c) ||
QSE_AWK_ISDIGIT (awk, c));
type = classify_ident (awk, QSE_STR_CSTR(tok->name));
type = classify_ident (awk, QSE_STR_XSTR(tok->name));
if (type == TOK_IDENT)
{
SETERR_TOK (awk, QSE_AWK_EXKWNR);
@ -6068,7 +6068,7 @@ retry:
QSE_AWK_ISALPHA (awk, c) ||
QSE_AWK_ISDIGIT (awk, c));
type = classify_ident (awk, QSE_STR_CSTR(tok->name));
type = classify_ident (awk, QSE_STR_XSTR(tok->name));
SET_TOKEN_TYPE (awk, tok, type);
}
else if (c == QSE_T('\"'))
@ -6138,7 +6138,7 @@ retry:
{
/* semiclon has not been skipped yet and the
* newline option is not set. */
qse_awk_seterror (awk, QSE_AWK_ESCOLON, QSE_STR_CSTR(tok->name), &tok->loc);
qse_awk_seterror (awk, QSE_AWK_ESCOLON, QSE_STR_XSTR(tok->name), &tok->loc);
return -1;
}
@ -6213,7 +6213,7 @@ static int preget_token (qse_awk_t* awk)
}
}
static int classify_ident (qse_awk_t* awk, const qse_cstr_t* name)
static int classify_ident (qse_awk_t* awk, const qse_xstr_t* name)
{
/* perform binary search */
@ -6265,7 +6265,7 @@ static int deparse (qse_awk_t* awk)
struct deparse_func_t df;
int n = 0;
qse_ssize_t op;
qse_cstr_t kw;
qse_xstr_t kw;
QSE_ASSERT (awk->sio.outf != QSE_NULL);
@ -6375,7 +6375,7 @@ static int deparse (qse_awk_t* awk)
for (nde = awk->tree.begin; nde != QSE_NULL; nde = nde->next)
{
qse_cstr_t kw;
qse_xstr_t kw;
qse_awk_getkwname (awk, QSE_AWK_KWID_BEGIN, &kw);
@ -6437,7 +6437,7 @@ static int deparse (qse_awk_t* awk)
for (nde = awk->tree.end; nde != QSE_NULL; nde = nde->next)
{
qse_cstr_t kw;
qse_xstr_t kw;
qse_awk_getkwname (awk, QSE_AWK_KWID_END, &kw);
@ -6479,7 +6479,7 @@ static qse_htb_walk_t deparse_func (
struct deparse_func_t* df = (struct deparse_func_t*)arg;
qse_awk_fun_t* fun = (qse_awk_fun_t*)QSE_HTB_VPTR(pair);
qse_size_t i, n;
qse_cstr_t kw;
qse_xstr_t kw;
QSE_ASSERT (qse_strxncmp (QSE_HTB_KPTR(pair), QSE_HTB_KLEN(pair), fun->name.ptr, fun->name.len) == 0);
@ -6646,7 +6646,7 @@ static qse_awk_mod_t* query_module (
qse_rbt_pair_t* pair;
qse_awk_mod_data_t* mdp;
qse_cstr_t ea;
qse_xstr_t ea;
int n;
QSE_ASSERT (nsegs == 2);

View File

@ -77,7 +77,7 @@ const qse_char_t* qse_awk_getgblname (
void qse_awk_getkwname (
qse_awk_t* awk,
qse_awk_kwid_t id,
qse_cstr_t* s
qse_xstr_t* s
);
int qse_awk_initgbls (

View File

@ -22,10 +22,10 @@
static int split_record (qse_awk_rtx_t* run);
static int recomp_record_fields (
qse_awk_rtx_t* run, qse_size_t lv, const qse_cstr_t* str);
qse_awk_rtx_t* run, qse_size_t lv, const qse_xstr_t* str);
int qse_awk_rtx_setrec (
qse_awk_rtx_t* run, qse_size_t idx, const qse_cstr_t* str)
qse_awk_rtx_t* run, qse_size_t idx, const qse_xstr_t* str)
{
qse_awk_val_t* v;
@ -48,7 +48,7 @@ int qse_awk_rtx_setrec (
}
}
v = qse_awk_rtx_makenstrvalwithcstr (run, str);
v = qse_awk_rtx_makenstrvalwithxstr (run, str);
if (v == QSE_NULL)
{
@ -77,7 +77,7 @@ int qse_awk_rtx_setrec (
}
/* recompose $0 */
v = qse_awk_rtx_makestrvalwithcstr (run, QSE_STR_CSTR(&run->inrec.line));
v = qse_awk_rtx_makestrvalwithxstr (run, QSE_STR_XSTR(&run->inrec.line));
if (v == QSE_NULL)
{
qse_awk_rtx_clrrec (run, 0);
@ -94,7 +94,7 @@ int qse_awk_rtx_setrec (
static int split_record (qse_awk_rtx_t* rtx)
{
qse_cstr_t tok;
qse_xstr_t tok;
qse_char_t* p, * px;
qse_size_t len, nflds;
qse_awk_val_t* v, * fs;
@ -319,7 +319,7 @@ static int split_record (qse_awk_rtx_t* rtx)
rtx->inrec.flds[rtx->inrec.nflds].ptr = tok.ptr;
rtx->inrec.flds[rtx->inrec.nflds].len = tok.len;
rtx->inrec.flds[rtx->inrec.nflds].val = qse_awk_rtx_makenstrvalwithcstr (rtx, &tok);
rtx->inrec.flds[rtx->inrec.nflds].val = qse_awk_rtx_makenstrvalwithxstr (rtx, &tok);
if (rtx->inrec.flds[rtx->inrec.nflds].val == QSE_NULL)
{
@ -390,7 +390,7 @@ int qse_awk_rtx_clrrec (qse_awk_rtx_t* run, int skip_inrec_line)
}
static int recomp_record_fields (
qse_awk_rtx_t* run, qse_size_t lv, const qse_cstr_t* str)
qse_awk_rtx_t* run, qse_size_t lv, const qse_xstr_t* str)
{
qse_awk_val_t* v;
qse_size_t max, i, nflds;
@ -453,7 +453,7 @@ static int recomp_record_fields (
return -1;
}
tmp = qse_awk_rtx_makestrvalwithcstr (run, str);
tmp = qse_awk_rtx_makestrvalwithxstr (run, str);
if (tmp == QSE_NULL) return -1;
if (i < nflds)

View File

@ -219,7 +219,7 @@ static QSE_INLINE int resolve_rs (
static QSE_INLINE int match_long_rs (
qse_awk_rtx_t* run, qse_str_t* buf, qse_awk_rio_arg_t* p)
{
qse_cstr_t match;
qse_xstr_t match;
qse_awk_errnum_t errnum;
int ret;
@ -228,7 +228,7 @@ static QSE_INLINE int match_long_rs (
ret = qse_awk_matchrex (
run->awk, run->gbl.rs[run->gbl.ignorecase],
run->gbl.ignorecase, QSE_STR_CSTR(buf), QSE_STR_CSTR(buf),
run->gbl.ignorecase, QSE_STR_XSTR(buf), QSE_STR_XSTR(buf),
&match, &errnum);
if (ret <= -1)
{

View File

@ -77,7 +77,7 @@ struct pafv
#define SETERR_ARG_LOC(rtx,code,ep,el,loc) \
do { \
qse_cstr_t __ea; \
qse_xstr_t __ea; \
__ea.len = (el); __ea.ptr = (ep); \
qse_awk_rtx_seterror ((rtx), (code), &__ea, (loc)); \
} while (0)
@ -261,19 +261,6 @@ typedef qse_awk_val_t* (*binop_func_t) (
qse_awk_rtx_t* run, qse_awk_val_t* left, qse_awk_val_t* right);
typedef qse_awk_val_t* (*eval_expr_t) (qse_awk_rtx_t* run, qse_awk_nde_t* nde);
#ifdef NDEBUG
# define xstr_to_cstr(xstr) ((qse_cstr_t*)xstr)
#else
static QSE_INLINE qse_cstr_t* xstr_to_cstr (qse_xstr_t* xstr)
{
/* i use this function to typecast qse_cstr_t* to
* qse_xstr_t* instead of direct typecasting.
* it is just to let the compiler emit some warnings
* if the data type of the actual parameter happened to
* haved changed to something else. */
return (qse_cstr_t*)xstr;
}
#endif
QSE_INLINE qse_size_t qse_awk_rtx_getnargs (qse_awk_rtx_t* run)
{
@ -355,13 +342,13 @@ static int set_global (
if (var)
{
/* global variable */
SETERR_ARGX_LOC (rtx, errnum, xstr_to_cstr(&var->id.name), &var->loc);
SETERR_ARGX_LOC (rtx, errnum, &var->id.name, &var->loc);
}
else
{
/* qse_awk_rtx_setgbl() has been called */
qse_cstr_t ea;
ea.ptr = qse_awk_getgblname (rtx->awk, idx, &ea.len);
qse_xstr_t ea;
ea.ptr = (qse_char_t*)qse_awk_getgblname (rtx->awk, idx, &ea.len);
SETERR_ARGX (rtx, errnum, &ea);
}
@ -380,8 +367,8 @@ static int set_global (
/* TODO: use global variable attribute. can it be a map? can it be a scalar? is it read-only???? */
qse_cstr_t ea;
ea.ptr = qse_awk_getgblname (rtx->awk, idx, &ea.len);
qse_xstr_t ea;
ea.ptr = (qse_char_t*)qse_awk_getgblname (rtx->awk, idx, &ea.len);
SETERR_ARGX (rtx, QSE_AWK_ENSCALARTOMAP, &ea);
return -1;
}
@ -1540,9 +1527,9 @@ qse_awk_fun_t* qse_awk_rtx_findfun (qse_awk_rtx_t* rtx, const qse_char_t* name)
if (pair == QSE_NULL)
{
qse_cstr_t nm;
qse_xstr_t nm;
nm.ptr = name;
nm.ptr = (qse_char_t*)name;
nm.len = qse_strlen(name);
SETERR_ARGX (rtx, QSE_AWK_EFUNNF, &nm);
@ -2618,7 +2605,7 @@ static int run_delete_named (qse_awk_rtx_t* rtx, qse_awk_nde_var_t* var)
{
SETERR_ARGX_LOC (
rtx, QSE_AWK_ENOTDEL,
xstr_to_cstr(&var->id.name), &var->loc);
&var->id.name, &var->loc);
return -1;
}
@ -2717,7 +2704,7 @@ static int run_delete_unnamed (qse_awk_rtx_t* rtx, qse_awk_nde_var_t* var)
{
SETERR_ARGX_LOC (
rtx, QSE_AWK_ENOTDEL,
xstr_to_cstr(&var->id.name), &var->loc);
&var->id.name, &var->loc);
return -1;
}
@ -3227,7 +3214,7 @@ static qse_awk_val_t* eval_expression (qse_awk_rtx_t* rtx, qse_awk_nde_t* nde)
if (v->type == QSE_AWK_VAL_REX)
{
qse_cstr_t vs;
qse_xstr_t vs;
int opt = 0;
/* special case where a regular expression is used in
@ -3526,14 +3513,14 @@ static qse_awk_val_t* do_assignment_nonidx (
qse_awk_errnum_t errnum;
errnum = (val->type == QSE_AWK_VAL_MAP)?
QSE_AWK_ENMAPTOMAP: QSE_AWK_ENMAPTOSCALAR;
SETERR_ARGX_LOC (run, errnum, xstr_to_cstr(&var->id.name), &var->loc);
SETERR_ARGX_LOC (run, errnum, &var->id.name, &var->loc);
return QSE_NULL;
}
else if (val->type == QSE_AWK_VAL_MAP)
{
/* old value is not a map but a new value is a map.
* a map cannot be assigned to a variable if FLEXMAP is off. */
SETERR_ARGX_LOC (run, QSE_AWK_EMAPTONVAR, xstr_to_cstr(&var->id.name), &var->loc);
SETERR_ARGX_LOC (run, QSE_AWK_EMAPTONVAR, &var->id.name, &var->loc);
return QSE_NULL;
}
}
@ -3572,14 +3559,14 @@ static qse_awk_val_t* do_assignment_nonidx (
qse_awk_errnum_t errnum;
errnum = (val->type == QSE_AWK_VAL_MAP)?
QSE_AWK_ENMAPTOMAP: QSE_AWK_ENMAPTOSCALAR;
SETERR_ARGX_LOC (run, errnum, xstr_to_cstr(&var->id.name), &var->loc);
SETERR_ARGX_LOC (run, errnum, &var->id.name, &var->loc);
return QSE_NULL;
}
else if (val->type == QSE_AWK_VAL_MAP)
{
/* old value is not a map but a new value is a map.
* a map cannot be assigned to a variable if FLEXMAP is off. */
SETERR_ARGX_LOC (run, QSE_AWK_EMAPTONVAR, xstr_to_cstr(&var->id.name), &var->loc);
SETERR_ARGX_LOC (run, QSE_AWK_EMAPTONVAR, &var->id.name, &var->loc);
return QSE_NULL;
}
}
@ -3602,14 +3589,14 @@ static qse_awk_val_t* do_assignment_nonidx (
qse_awk_errnum_t errnum;
errnum = (val->type == QSE_AWK_VAL_MAP)?
QSE_AWK_ENMAPTOMAP: QSE_AWK_ENMAPTOSCALAR;
SETERR_ARGX_LOC (run, errnum, xstr_to_cstr(&var->id.name), &var->loc);
SETERR_ARGX_LOC (run, errnum, &var->id.name, &var->loc);
return QSE_NULL;
}
else if (val->type == QSE_AWK_VAL_MAP)
{
/* old value is not a map but a new value is a map.
* a map cannot be assigned to a variable if FLEXMAP is off. */
SETERR_ARGX_LOC (run, QSE_AWK_EMAPTONVAR, xstr_to_cstr(&var->id.name), &var->loc);
SETERR_ARGX_LOC (run, QSE_AWK_EMAPTONVAR, &var->id.name, &var->loc);
return QSE_NULL;
}
}
@ -5573,7 +5560,7 @@ static qse_awk_val_t* eval_fun_ex (
{
SETERR_ARGX_LOC (
rtx, QSE_AWK_EFUNNF,
xstr_to_cstr(&call->u.fun.name), &nde->loc);
&call->u.fun.name, &nde->loc);
return QSE_NULL;
}
@ -5784,8 +5771,7 @@ static qse_awk_val_t* __eval_call (
* fix it */
SETERR_ARGX_LOC (
run, QSE_AWK_EFNCIMPL,
xstr_to_cstr(&call->u.fnc.info.name),
&nde->loc
&call->u.fnc.info.name, &nde->loc
);
}
else
@ -6472,14 +6458,14 @@ read_console_again:
if (p->var == QSE_NULL)
{
/* set $0 with the input value */
x = qse_awk_rtx_setrec (rtx, 0, QSE_STR_CSTR(buf));
x = qse_awk_rtx_setrec (rtx, 0, QSE_STR_XSTR(buf));
if (x <= -1) return QSE_NULL;
}
else
{
qse_awk_val_t* v;
v = qse_awk_rtx_makestrvalwithcstr (rtx, QSE_STR_CSTR(buf));
v = qse_awk_rtx_makestrvalwithxstr (rtx, QSE_STR_XSTR(buf));
if (v == QSE_NULL)
{
ADJERR_LOC (rtx, &nde->loc);
@ -6578,7 +6564,7 @@ read_again:
}
}
if (qse_awk_rtx_setrec (rtx, 0, QSE_STR_CSTR(buf)) <= -1 ||
if (qse_awk_rtx_setrec (rtx, 0, QSE_STR_XSTR(buf)) <= -1 ||
update_fnr (rtx, rtx->gbl.fnr + 1, rtx->gbl.nr + 1) <= -1) return -1;
return 1;
@ -6660,7 +6646,7 @@ static int shorten_record (qse_awk_rtx_t* run, qse_size_t nflds)
if (ofs_free != QSE_NULL) QSE_AWK_FREE (run->awk, ofs_free);
if (nflds > 1) qse_awk_rtx_refdownval (run, v);
v = (qse_awk_val_t*) qse_awk_rtx_makestrvalwithcstr (run, QSE_STR_CSTR(&tmp));
v = (qse_awk_val_t*) qse_awk_rtx_makestrvalwithxstr (run, QSE_STR_XSTR(&tmp));
if (v == QSE_NULL)
{
qse_str_fini (&tmp);

View File

@ -455,8 +455,8 @@ static qse_sio_t* open_sio (qse_awk_t* awk, const qse_char_t* file, int flags)
sio = qse_sio_open (awk->mmgr, 0, file, flags);
if (sio == QSE_NULL)
{
qse_cstr_t errarg;
errarg.ptr = file;
qse_xstr_t errarg;
errarg.ptr = (qse_char_t*)file;
errarg.len = qse_strlen(file);
qse_awk_seterrnum (awk, QSE_AWK_EOPEN, &errarg);
}
@ -469,15 +469,15 @@ static qse_sio_t* open_sio_rtx (qse_awk_rtx_t* rtx, const qse_char_t* file, int
sio = qse_sio_open (rtx->awk->mmgr, 0, file, flags);
if (sio == QSE_NULL)
{
qse_cstr_t errarg;
errarg.ptr = file;
qse_xstr_t errarg;
errarg.ptr = (qse_char_t*)file;
errarg.len = qse_strlen(file);
qse_awk_rtx_seterrnum (rtx, QSE_AWK_EOPEN, &errarg);
}
return sio;
}
static qse_cstr_t sio_std_names[] =
static qse_xstr_t sio_std_names[] =
{
{ QSE_T("stdin"), 5 },
{ QSE_T("stdout"), 6 },
@ -632,8 +632,8 @@ static qse_ssize_t sf_in_open (
if (dbuf) QSE_MMGR_FREE (awk->mmgr, dbuf);
if (arg->handle == QSE_NULL)
{
qse_cstr_t ea;
ea.ptr = arg->name;
qse_xstr_t ea;
ea.ptr = (qse_char_t*)arg->name;
ea.len = qse_strlen(ea.ptr);
qse_awk_seterrnum (awk, QSE_AWK_EOPEN, &ea);
return -1;
@ -692,8 +692,8 @@ static qse_ssize_t sf_in_read (
n = qse_sio_getstrn (arg->handle, data, size);
if (n <= -1)
{
qse_cstr_t ea;
ea.ptr = xtn->s.in.x[xtn->s.in.xindex].u.file.path;
qse_xstr_t ea;
ea.ptr = (qse_char_t*)xtn->s.in.x[xtn->s.in.xindex].u.file.path;
if (ea.ptr == QSE_NULL) ea.ptr = sio_std_names[QSE_SIO_STDIN].ptr;
ea.len = qse_strlen(ea.ptr);
qse_awk_seterrnum (awk, QSE_AWK_EREAD, &ea);
@ -756,8 +756,8 @@ static qse_ssize_t sf_in_read (
n = qse_sio_getstrn (arg->handle, data, size);
if (n <= -1)
{
qse_cstr_t ea;
ea.ptr = arg->name;
qse_xstr_t ea;
ea.ptr = (qse_char_t*)arg->name;
ea.len = qse_strlen(ea.ptr);
qse_awk_seterrnum (awk, QSE_AWK_EREAD, &ea);
}
@ -870,8 +870,8 @@ static qse_ssize_t sf_out (
n = qse_sio_putstrn (xtn->s.out.u.file.sio, data, size);
if (n <= -1)
{
qse_cstr_t ea;
ea.ptr = xtn->s.out.x->u.file.path;
qse_xstr_t ea;
ea.ptr = (qse_char_t*)xtn->s.out.x->u.file.path;
if (ea.ptr == QSE_NULL) ea.ptr = sio_std_names[QSE_SIO_STDOUT].ptr;
ea.len = qse_strlen(ea.ptr);
qse_awk_seterrnum (awk, QSE_AWK_EWRITE, &ea);
@ -1249,7 +1249,7 @@ static qse_ssize_t awk_rio_file (
handle = qse_sio_open (rtx->awk->mmgr, 0, riod->name, flags);
if (handle == QSE_NULL)
{
qse_cstr_t errarg;
qse_xstr_t errarg;
errarg.ptr = riod->name;
errarg.len = qse_strlen(riod->name);
qse_awk_rtx_seterrnum (rtx, QSE_AWK_EOPEN, &errarg);
@ -1422,7 +1422,7 @@ static int open_rio_console (qse_awk_rtx_t* rtx, qse_awk_rio_arg_t* riod)
if (qse_strlen(as.ptr) < as.len)
{
/* the name contains one or more '\0' */
qse_cstr_t errarg;
qse_xstr_t errarg;
errarg.ptr = as.ptr;
/* use this length not to contains '\0'
@ -2353,7 +2353,7 @@ done:
if (rv)
{
qse_awk_rtx_refupval (rtx, rv);
ret = qse_awk_rtx_setrefval (rtx, qse_awk_rtx_getarg (rtx, 2), rv);
ret = qse_awk_rtx_setrefval (rtx, (qse_awk_val_ref_t*)qse_awk_rtx_getarg (rtx, 2), rv);
qse_awk_rtx_refdownval (rtx, rv);
if (ret >= 0) qse_awk_rtx_setretval (rtx, qse_awk_val_zero);
}

View File

@ -156,7 +156,7 @@ static int print_tabs (qse_awk_t* awk, int depth)
static int print_printx (qse_awk_t* awk, qse_awk_nde_print_t* px)
{
qse_cstr_t kw;
qse_xstr_t kw;
if (px->type == QSE_AWK_NDE_PRINT)
{
@ -188,7 +188,7 @@ static int print_printx (qse_awk_t* awk, qse_awk_nde_print_t* px)
static int print_expr (qse_awk_t* awk, qse_awk_nde_t* nde)
{
qse_cstr_t kw;
qse_xstr_t kw;
switch (nde->type)
{
@ -727,7 +727,7 @@ static int print_expr_list (qse_awk_t* awk, qse_awk_nde_t* tree)
static int print_stmt (qse_awk_t* awk, qse_awk_nde_t* p, int depth)
{
qse_size_t i;
qse_cstr_t kw;
qse_xstr_t kw;
switch (p->type)
{

View File

@ -249,12 +249,6 @@ init:
return (qse_awk_val_t*)val;
}
QSE_INLINE qse_awk_val_t* qse_awk_rtx_makestrvalwithcstr (
qse_awk_rtx_t* rtx, const qse_cstr_t* str)
{
return qse_awk_rtx_makestrvalwithxstr (rtx, (const qse_xstr_t*)str);
}
qse_awk_val_t* qse_awk_rtx_makestrvalwithmbs (
qse_awk_rtx_t* rtx, const qse_mchar_t* mbs)
{
@ -305,18 +299,18 @@ qse_awk_val_t* qse_awk_rtx_makestrvalwithstr (
return qse_awk_rtx_makestrval (rtx, str, qse_strlen(str));
}
qse_awk_val_t* qse_awk_rtx_makestrvalwithmcstr (
qse_awk_rtx_t* rtx, const qse_mcstr_t* mcstr)
qse_awk_val_t* qse_awk_rtx_makestrvalwithmxstr (
qse_awk_rtx_t* rtx, const qse_mxstr_t* mxstr)
{
#if defined(QSE_CHAR_IS_MCHAR)
return qse_awk_rtx_makestrvalwithcstr (rtx, mcstr);
return qse_awk_rtx_makestrvalwithxstr (rtx, mxstr);
#else
qse_awk_val_t* v;
qse_wxstr_t tmp;
qse_size_t mbslen;
mbslen = mcstr->len;
tmp.ptr = qse_mbsntowcsdup (mcstr->ptr, &mbslen, &tmp.len, rtx->awk->mmgr);
mbslen = mxstr->len;
tmp.ptr = qse_mbsntowcsdup (mxstr->ptr, &mbslen, &tmp.len, rtx->awk->mmgr);
if (tmp.ptr == QSE_NULL)
{
qse_awk_rtx_seterrnum (rtx, QSE_AWK_ENOMEM, QSE_NULL);
@ -329,16 +323,16 @@ qse_awk_val_t* qse_awk_rtx_makestrvalwithmcstr (
#endif
}
qse_awk_val_t* qse_awk_rtx_makestrvalwithwcstr (
qse_awk_rtx_t* rtx, const qse_wcstr_t* wcstr)
qse_awk_val_t* qse_awk_rtx_makestrvalwithwxstr (
qse_awk_rtx_t* rtx, const qse_wxstr_t* wxstr)
{
#if defined(QSE_CHAR_IS_MCHAR)
qse_awk_val_t* v;
qse_mxstr_t tmp;
qse_size_t wcslen;
wcslen = wcstr->len;
tmp.ptr = qse_wcsntombsdup (wcstr->ptr, &wcslen, &tmp.len, rtx->awk->mmgr);
wcslen = wxstr->len;
tmp.ptr = qse_wcsntombsdup (wxstr->ptr, &wcslen, &tmp.len, rtx->awk->mmgr);
if (tmp.ptr == QSE_NULL)
{
qse_awk_rtx_seterrnum (rtx, QSE_AWK_ENOMEM, QSE_NULL);
@ -349,17 +343,17 @@ qse_awk_val_t* qse_awk_rtx_makestrvalwithwcstr (
QSE_AWK_FREE (rtx->awk, tmp.ptr);
return v;
#else
return qse_awk_rtx_makestrvalwithcstr (rtx, wcstr);
return qse_awk_rtx_makestrvalwithxstr (rtx, wxstr);
#endif
}
qse_awk_val_t* qse_awk_rtx_makestrval (
qse_awk_rtx_t* rtx, const qse_char_t* str, qse_size_t len)
{
qse_cstr_t cstr;
cstr.ptr = str;
cstr.len = len;
return qse_awk_rtx_makestrvalwithcstr (rtx, &cstr);
qse_xstr_t xstr;
xstr.ptr = (qse_char_t*)str;
xstr.len = len;
return qse_awk_rtx_makestrvalwithxstr (rtx, &xstr);
}
qse_awk_val_t* qse_awk_rtx_makestrval2 (
@ -415,13 +409,13 @@ init:
qse_awk_val_t* qse_awk_rtx_makenstrvalwithstr (qse_awk_rtx_t* rtx, const qse_char_t* str)
{
qse_cstr_t cstr;
cstr.ptr = str;
cstr.len = qse_strlen(str);
return qse_awk_rtx_makenstrvalwithcstr (rtx, &cstr);
qse_xstr_t xstr;
xstr.ptr = (qse_char_t*)str;
xstr.len = qse_strlen(str);
return qse_awk_rtx_makenstrvalwithxstr (rtx, &xstr);
}
qse_awk_val_t* qse_awk_rtx_makenstrvalwithcstr (qse_awk_rtx_t* rtx, const qse_cstr_t* str)
qse_awk_val_t* qse_awk_rtx_makenstrvalwithxstr (qse_awk_rtx_t* rtx, const qse_xstr_t* str)
{
int x;
qse_awk_val_t* v;
@ -429,7 +423,7 @@ qse_awk_val_t* qse_awk_rtx_makenstrvalwithcstr (qse_awk_rtx_t* rtx, const qse_cs
qse_awk_flt_t r;
x = qse_awk_rtx_strtonum (rtx, 1, str->ptr, str->len, &l, &r);
v = qse_awk_rtx_makestrvalwithcstr (rtx, str);
v = qse_awk_rtx_makestrvalwithxstr (rtx, str);
if (v == QSE_NULL) return QSE_NULL;
@ -445,7 +439,7 @@ qse_awk_val_t* qse_awk_rtx_makenstrvalwithcstr (qse_awk_rtx_t* rtx, const qse_cs
}
qse_awk_val_t* qse_awk_rtx_makerexval (
qse_awk_rtx_t* rtx, const qse_cstr_t* str, void* code[2])
qse_awk_rtx_t* rtx, const qse_xstr_t* str, void* code[2])
{
qse_awk_val_rex_t* val;
qse_size_t totsz;
@ -615,17 +609,17 @@ qse_awk_val_t* qse_awk_rtx_makemapvalwithdata (qse_awk_rtx_t* rtx, qse_awk_val_m
case QSE_AWK_VAL_MAP_DATA_XSTR:
case QSE_AWK_VAL_MAP_DATA_CSTR:
tmp = qse_awk_rtx_makestrvalwithcstr (rtx, (qse_cstr_t*)p->vptr);
tmp = qse_awk_rtx_makestrvalwithxstr (rtx, (qse_xstr_t*)p->vptr);
break;
case QSE_AWK_VAL_MAP_DATA_MXSTR:
case QSE_AWK_VAL_MAP_DATA_MCSTR:
tmp = qse_awk_rtx_makestrvalwithmcstr (rtx, (qse_mcstr_t*)p->vptr);
tmp = qse_awk_rtx_makestrvalwithmxstr (rtx, (qse_mxstr_t*)p->vptr);
break;
case QSE_AWK_VAL_MAP_DATA_WXSTR:
case QSE_AWK_VAL_MAP_DATA_WCSTR:
tmp = qse_awk_rtx_makestrvalwithwcstr (rtx, (qse_wcstr_t*)p->vptr);
tmp = qse_awk_rtx_makestrvalwithwxstr (rtx, (qse_wxstr_t*)p->vptr);
break;
default:
@ -753,7 +747,7 @@ qse_awk_val_t* qse_awk_rtx_makefunval (
}
val->type = QSE_AWK_VAL_FUN;
val->fun = fun;
val->fun = (qse_awk_fun_t*)fun;
return (qse_awk_val_t*)val;
}
@ -1016,7 +1010,7 @@ static int str_to_str (
case QSE_AWK_RTX_VALTOSTR_CPL:
{
out->u.cpl.len = str_len;
out->u.cpl.ptr = str;
out->u.cpl.ptr = (qse_char_t*)str;
return 0;
}
@ -1768,7 +1762,7 @@ int qse_awk_rtx_setrefval (qse_awk_rtx_t* rtx, qse_awk_val_ref_t* ref, qse_awk_v
qse_awk_rtx_refupval (rtx, val);
x = qse_awk_rtx_setrec (
rtx, (qse_size_t)ref->adr,
(qse_cstr_t*)&((qse_awk_val_str_t*)val)->val
&((qse_awk_val_str_t*)val)->val
);
qse_awk_rtx_refdownval (rtx, val);
return x;
@ -1781,7 +1775,7 @@ int qse_awk_rtx_setrefval (qse_awk_rtx_t* rtx, qse_awk_val_ref_t* ref, qse_awk_v
str.ptr = qse_awk_rtx_valtostrdup (rtx, val, &str.len);
qse_awk_rtx_refupval (rtx, val);
x = qse_awk_rtx_setrec (rtx, (qse_size_t)ref->adr, (qse_cstr_t*)&str);
x = qse_awk_rtx_setrec (rtx, (qse_size_t)ref->adr, &str);
qse_awk_rtx_refdownval (rtx, val);
QSE_AWK_FREE (rtx->awk, str.ptr);
return x;

View File

@ -386,7 +386,7 @@ static int handle_non_wild_segments (glob_t* g, segment_t* seg)
if (!seg->next && path_exists(g, QSE_STR_PTR(&g->path)) > 0)
{
/* reached the last segment. match if the path exists */
if (g->cbimpl (QSE_STR_CSTR(&g->path), g->cbctx) <= -1) return -1;
if (g->cbimpl (QSE_STR_XSTR(&g->path), g->cbctx) <= -1) return -1;
g->expanded = 1;
}
}
@ -492,7 +492,7 @@ entry:
}
else
{
if (g->cbimpl (QSE_STR_CSTR(&g->path), g->cbctx) <= -1) goto oops;
if (g->cbimpl (QSE_STR_XSTR(&g->path), g->cbctx) <= -1) goto oops;
g->expanded = 1;
}
}

View File

@ -577,7 +577,7 @@ qse_mchar_t* qse_wcsatombsdupwithcmgr (
}
qse_mchar_t* qse_wcsnatombsdupwithcmgr (
const qse_wcstr_t wcs[], qse_size_t* mbslen, qse_mmgr_t* mmgr, qse_cmgr_t* cmgr)
const qse_wxstr_t wcs[], qse_size_t* mbslen, qse_mmgr_t* mmgr, qse_cmgr_t* cmgr)
{
qse_size_t wl, ml, capa, pos, i;
qse_mchar_t* mbs;

View File

@ -234,7 +234,7 @@ qse_mchar_t* qse_wcsatombsdup (
}
qse_mchar_t* qse_wcsnatombsdup (
const qse_wcstr_t wcs[], qse_size_t* mbslen, qse_mmgr_t* mmgr)
const qse_wxstr_t wcs[], qse_size_t* mbslen, qse_mmgr_t* mmgr)
{
return qse_wcsnatombsdupwithcmgr (wcs, mbslen, mmgr, dfl_cmgr);
}

View File

@ -61,7 +61,7 @@ int qse_mbsntonwad (const qse_mchar_t* str, qse_size_t len, qse_nwad_t* nwad)
{
const qse_mchar_t* p;
const qse_mchar_t* end;
qse_mcstr_t tmp;
qse_mxstr_t tmp;
qse_nwad_t tmpad;
QSE_MEMSET (&tmpad, 0, QSE_SIZEOF(tmpad));
@ -227,7 +227,7 @@ int qse_wcsntonwad (const qse_wchar_t* str, qse_size_t len, qse_nwad_t* nwad)
{
const qse_wchar_t* p;
const qse_wchar_t* end;
qse_wcstr_t tmp;
qse_wxstr_t tmp;
qse_nwad_t tmpad;
QSE_MEMSET (&tmpad, 0, QSE_SIZEOF(tmpad));

View File

@ -33,7 +33,7 @@ struct comp_t
{
qse_rex_t* rex;
qse_cstr_t re;
qse_xstr_t re;
const qse_char_t* ptr;
const qse_char_t* end;
@ -490,7 +490,7 @@ else qse_printf (QSE_T("getc => %c\n"), com->c);
struct ccinfo_t
{
qse_cstr_t name;
qse_xstr_t name;
int (*func) (exec_t* e, qse_char_t c);
};
@ -1982,8 +1982,8 @@ static void fini_exec_dds (exec_t* e)
}
int qse_rex_exec (
qse_rex_t* rex, const qse_cstr_t* str,
const qse_cstr_t* substr, qse_cstr_t* matstr)
qse_rex_t* rex, const qse_xstr_t* str,
const qse_xstr_t* substr, qse_xstr_t* matstr)
{
exec_t e;
int n = 0;
@ -2061,8 +2061,8 @@ void* qse_buildrex (
int qse_matchrex (
qse_mmgr_t* mmgr, qse_size_t depth,
void* code, int option,
const qse_cstr_t* str, const qse_cstr_t* substr,
qse_cstr_t* match, qse_rex_errnum_t* errnum)
const qse_xstr_t* str, const qse_xstr_t* substr,
qse_xstr_t* match, qse_rex_errnum_t* errnum)
{
qse_rex_t rex;
int n;

View File

@ -92,7 +92,7 @@ qse_mchar_t* qse_mbsadup (const qse_mchar_t* str[], qse_size_t* len, qse_mmgr_t*
return buf;
}
qse_mchar_t* qse_mcstrdup (const qse_mcstr_t* str, qse_mmgr_t* mmgr)
qse_mchar_t* qse_mcstrdup (const qse_mxstr_t* str, qse_mmgr_t* mmgr)
{
qse_mchar_t* buf;
@ -106,7 +106,7 @@ qse_mchar_t* qse_mcstrdup (const qse_mcstr_t* str, qse_mmgr_t* mmgr)
return buf;
}
qse_mchar_t* qse_mcstradup (const qse_mcstr_t str[], qse_size_t* len, qse_mmgr_t* mmgr)
qse_mchar_t* qse_mcstradup (const qse_mxstr_t str[], qse_size_t* len, qse_mmgr_t* mmgr)
{
qse_mchar_t* buf, * ptr;
qse_size_t i;
@ -201,7 +201,7 @@ qse_wchar_t* qse_wcsadup (const qse_wchar_t* str[], qse_size_t* len, qse_mmgr_t*
return buf;
}
qse_wchar_t* qse_wcstrdup (const qse_wcstr_t* str, qse_mmgr_t* mmgr)
qse_wchar_t* qse_wcstrdup (const qse_wxstr_t* str, qse_mmgr_t* mmgr)
{
qse_wchar_t* buf;
@ -215,7 +215,7 @@ qse_wchar_t* qse_wcstrdup (const qse_wcstr_t* str, qse_mmgr_t* mmgr)
return buf;
}
qse_wchar_t* qse_wcstradup (const qse_wcstr_t str[], qse_size_t* len, qse_mmgr_t* mmgr)
qse_wchar_t* qse_wcstradup (const qse_wxstr_t str[], qse_size_t* len, qse_mmgr_t* mmgr)
{
qse_wchar_t* buf, * ptr;
qse_size_t i;

View File

@ -22,7 +22,7 @@
#undef T
#undef char_t
#undef cstr_t
#undef xstr_t
#undef strfcpy
#undef strfncpy
#undef strxfcpy
@ -30,7 +30,7 @@
#define T(x) QSE_MT(x)
#define char_t qse_mchar_t
#define cstr_t qse_mcstr_t
#define xstr_t qse_mxstr_t
#define strfcpy qse_mbsfcpy
#define strfncpy qse_mbsfncpy
#define strxfcpy qse_mbsxfcpy
@ -41,7 +41,7 @@
#undef T
#undef char_t
#undef cstr_t
#undef xstr_t
#undef strfcpy
#undef strfncpy
#undef strxfcpy
@ -49,7 +49,7 @@
#define T(x) QSE_WT(x)
#define char_t qse_wchar_t
#define cstr_t qse_wcstr_t
#define xstr_t qse_wxstr_t
#define strfcpy qse_wcsfcpy
#define strfncpy qse_wcsfncpy
#define strxfcpy qse_wcsxfcpy

View File

@ -64,7 +64,7 @@ qse_size_t strfcpy (
}
qse_size_t strfncpy (
char_t* buf, const char_t* fmt, const cstr_t str[])
char_t* buf, const char_t* fmt, const xstr_t str[])
{
char_t* b = buf;
const char_t* f = fmt;
@ -181,7 +181,7 @@ fini:
qse_size_t strxfncpy (
char_t* buf, qse_size_t bsz,
const char_t* fmt, const cstr_t str[])
const char_t* fmt, const xstr_t str[])
{
char_t* b = buf;
char_t* end = buf + bsz - 1;

View File

@ -23,7 +23,7 @@
/* ----------------------------------- */
#undef char_t
#undef cstr_t
#undef xstr_t
#undef T
#undef NOBUF
#undef strlen
@ -34,7 +34,7 @@
#undef strxnsubst
#define char_t qse_mchar_t
#define cstr_t qse_mcstr_t
#define xstr_t qse_mxstr_t
#define T(x) QSE_MT(x)
#define NOBUF QSE_MBSSUBST_NOBUF
#define strlen qse_mbslen
@ -48,7 +48,7 @@
/* ----------------------------------- */
#undef char_t
#undef cstr_t
#undef xstr_t
#undef T
#undef NOBUF
#undef strlen
@ -59,7 +59,7 @@
#undef strxnsubst
#define char_t qse_wchar_t
#define cstr_t qse_wcstr_t
#define xstr_t qse_wxstr_t
#define T(x) QSE_WT(x)
#define NOBUF QSE_WCSSUBST_NOBUF
#define strlen qse_wcslen

View File

@ -18,12 +18,12 @@
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(char_t) && !defined(cstr_t) && !defined(strxsubst)
#if !defined(char_t) && !defined(xstr_t) && !defined(strxsubst)
# error Never include this file
#endif
static const char_t* scan_dollar (
const char_t* f, qse_size_t l, cstr_t* ident, cstr_t* dfl, int depth)
const char_t* f, qse_size_t l, xstr_t* ident, xstr_t* dfl, int depth)
{
const char_t* end = f + l;
@ -89,7 +89,7 @@ static const char_t* scan_dollar (
}
static char_t* expand_dollar (
char_t* buf, qse_size_t bsz, const cstr_t* ident, const cstr_t* dfl,
char_t* buf, qse_size_t bsz, const xstr_t* ident, const xstr_t* dfl,
subst_t subst, void* ctx)
{
char_t* tmp;
@ -138,7 +138,7 @@ qse_size_t strxnsubst (
if (*(f + 1) == T('{'))
{
const char_t* tmp;
cstr_t ident, dfl;
xstr_t ident, dfl;
tmp = scan_dollar (f, fend - f, &ident, &dfl, 0);
if (tmp == QSE_NULL || ident.len <= 0) goto normal;

View File

@ -22,7 +22,7 @@
#include <qse/cmn/chr.h>
qse_mchar_t* qse_mbstok (
const qse_mchar_t* s, const qse_mchar_t* delim, qse_mcstr_t* tok)
const qse_mchar_t* s, const qse_mchar_t* delim, qse_mxstr_t* tok)
{
const qse_mchar_t* p = s, *d;
const qse_mchar_t* sp = QSE_NULL, * ep = QSE_NULL;
@ -98,7 +98,7 @@ exit_loop:
qse_mchar_t* qse_mbsxtok (
const qse_mchar_t* s, qse_size_t len,
const qse_mchar_t* delim, qse_mcstr_t* tok)
const qse_mchar_t* delim, qse_mxstr_t* tok)
{
const qse_mchar_t* p = s, *d;
const qse_mchar_t* end = s + len;
@ -178,7 +178,7 @@ exit_loop:
qse_mchar_t* qse_mbsxntok (
const qse_mchar_t* s, qse_size_t len,
const qse_mchar_t* delim, qse_size_t delim_len, qse_mcstr_t* tok)
const qse_mchar_t* delim, qse_size_t delim_len, qse_mxstr_t* tok)
{
const qse_mchar_t* p = s, *d;
const qse_mchar_t* end = s + len;
@ -259,7 +259,7 @@ exit_loop:
qse_wchar_t* qse_wcstok (
const qse_wchar_t* s, const qse_wchar_t* delim, qse_wcstr_t* tok)
const qse_wchar_t* s, const qse_wchar_t* delim, qse_wxstr_t* tok)
{
const qse_wchar_t* p = s, *d;
const qse_wchar_t* sp = QSE_NULL, * ep = QSE_NULL;
@ -335,7 +335,7 @@ exit_loop:
qse_wchar_t* qse_wcsxtok (
const qse_wchar_t* s, qse_size_t len,
const qse_wchar_t* delim, qse_wcstr_t* tok)
const qse_wchar_t* delim, qse_wxstr_t* tok)
{
const qse_wchar_t* p = s, *d;
const qse_wchar_t* end = s + len;
@ -415,7 +415,7 @@ exit_loop:
qse_wchar_t* qse_wcsxntok (
const qse_wchar_t* s, qse_size_t len,
const qse_wchar_t* delim, qse_size_t delim_len, qse_wcstr_t* tok)
const qse_wchar_t* delim, qse_size_t delim_len, qse_wxstr_t* tok)
{
const qse_wchar_t* p = s, *d;
const qse_wchar_t* end = s + len;

View File

@ -294,7 +294,7 @@ static qse_mchar_t* parse_initial_line (qse_htrd_t* htrd, qse_mchar_t* line)
#if 0
qse_mchar_t* out;
#endif
qse_mcstr_t param;
qse_mxstr_t param;
/* skip spaces */
do p++; while (is_space_octet(*p));
@ -1501,9 +1501,9 @@ int qse_htrd_halt (qse_htrd_t* htrd)
}
#if 0
int qse_htrd_scanqparam (qse_htrd_t* htrd, const qse_mcstr_t* cstr)
int qse_htrd_scanqparam (qse_htrd_t* htrd, const qse_mxstr_t* cstr)
{
qse_mcstr_t key, val;
qse_mxstr_t key, val;
const qse_mchar_t* p, * end;
qse_mchar_t* out;

View File

@ -108,7 +108,7 @@ void qse_htre_clear (qse_htre_t* re)
}
int qse_htre_setstrfromcstr (
qse_htre_t* re, qse_mbs_t* str, const qse_mcstr_t* cstr)
qse_htre_t* re, qse_mbs_t* str, const qse_mxstr_t* cstr)
{
return (qse_mbs_ncpy (str, cstr->ptr, cstr->len) == (qse_size_t)-1)? -1: 0;
}

View File

@ -169,7 +169,7 @@ qse_http_method_t qse_mbstohttpmethod (const qse_mchar_t* name)
return QSE_HTTP_OTHER;
}
qse_http_method_t qse_mcstrtohttpmethod (const qse_mcstr_t* name)
qse_http_method_t qse_mcstrtohttpmethod (const qse_mxstr_t* name)
{
/* perform binary search */

View File

@ -33,11 +33,11 @@
typedef struct task_cgi_arg_t task_cgi_arg_t;
struct task_cgi_arg_t
{
qse_mcstr_t path;
qse_mcstr_t script;
qse_mcstr_t suffix;
qse_mcstr_t root;
qse_mcstr_t shebang;
qse_mxstr_t path;
qse_mxstr_t script;
qse_mxstr_t suffix;
qse_mxstr_t root;
qse_mxstr_t shebang;
int nph;
qse_htre_t* req;
};

View File

@ -31,10 +31,10 @@
typedef struct task_dir_t task_dir_t;
struct task_dir_t
{
qse_mcstr_t path;
qse_mcstr_t qpath;
qse_mcstr_t head;
qse_mcstr_t foot;
qse_mxstr_t path;
qse_mxstr_t qpath;
qse_mxstr_t head;
qse_mxstr_t foot;
qse_http_version_t version;
int keepalive;
int method;
@ -48,10 +48,10 @@ struct task_dseg_t
int keepalive;
int chunked;
qse_mcstr_t path;
qse_mcstr_t qpath;
qse_mcstr_t head;
qse_mcstr_t foot;
qse_mxstr_t path;
qse_mxstr_t qpath;
qse_mxstr_t head;
qse_mxstr_t foot;
qse_ubi_t handle;
qse_httpd_dirent_t dent;

View File

@ -31,7 +31,7 @@
typedef struct task_file_t task_file_t;
struct task_file_t
{
qse_mcstr_t path;
qse_mxstr_t path;
qse_http_version_t version;
int keepalive;
@ -41,7 +41,7 @@ struct task_file_t
{
struct
{
qse_mcstr_t mime;
qse_mxstr_t mime;
qse_mchar_t if_none_match[ETAG_LEN_MAX + 1];
qse_ntime_t if_modified_since;
qse_http_range_t range;

View File

@ -112,7 +112,7 @@ Sed::errnum_t Sed::getErrorNumber () const
return (sed == QSE_NULL)? QSE_SED_ENOERR: qse_sed_geterrnum (sed);
}
void Sed::setError (errnum_t err, const cstr_t* args, const loc_t* loc)
void Sed::setError (errnum_t err, const xstr_t* args, const loc_t* loc)
{
QSE_ASSERT (sed != QSE_NULL);
qse_sed_seterror (sed, err, args, loc);

View File

@ -35,8 +35,8 @@ static qse_sio_t* open_sio (StdSed::Stream::Data& io, const qse_char_t* file, in
sio = qse_sio_open (((StdSed::sed_t*)io)->mmgr, 0, file, flags);
if (sio == QSE_NULL)
{
qse_cstr_t ea;
ea.ptr = file;
qse_xstr_t ea;
ea.ptr = (StdSed::char_t*)file;
ea.len = qse_strlen (file);
((Sed*)io)->setError (QSE_SED_EIOFIL, &ea);
}
@ -46,7 +46,7 @@ static qse_sio_t* open_sio (StdSed::Stream::Data& io, const qse_char_t* file, in
static qse_sio_t* open_sio_std (StdSed::Stream::Data& io, qse_sio_std_t std, int flags)
{
qse_sio_t* sio;
static const qse_char_t* std_names[] =
static const StdSed::char_t* std_names[] =
{
QSE_T("stdin"),
QSE_T("stdout"),
@ -56,8 +56,8 @@ static qse_sio_t* open_sio_std (StdSed::Stream::Data& io, qse_sio_std_t std, int
sio = qse_sio_openstd (((StdSed::sed_t*)io)->mmgr, 0, std, flags);
if (sio == QSE_NULL)
{
qse_cstr_t ea;
ea.ptr = std_names[std];
qse_xstr_t ea;
ea.ptr = (StdSed::char_t*)std_names[std];
ea.len = qse_strlen (std_names[std]);
((Sed*)io)->setError (QSE_SED_EIOFIL, &ea);
}
@ -124,8 +124,8 @@ StdSed::ssize_t StdSed::FileStream::read (Data& io, char_t* buf, size_t len)
// if writing to outfile, set the error message
// explicitly. other cases are handled by
// the caller in sed.c.
qse_cstr_t ea;
ea.ptr = infile;
qse_xstr_t ea;
ea.ptr = (char_t*)infile;
ea.len = qse_strlen (infile);
((Sed*)io)->setError (QSE_SED_EIOFIL, &ea);
}
@ -145,8 +145,8 @@ StdSed::ssize_t StdSed::FileStream::write (Data& io, const char_t* buf, size_t l
// if writing to outfile, set the error message
// explicitly. other cases are handled by
// the caller in sed.c.
qse_cstr_t ea;
ea.ptr = outfile;
qse_xstr_t ea;
ea.ptr = (char_t*)outfile;
ea.len = qse_strlen (outfile);
((Sed*)io)->setError (QSE_SED_EIOFIL, &ea);
}

View File

@ -111,7 +111,7 @@ void qse_sed_geterror (
}
void qse_sed_seterrnum (
qse_sed_t* sed, qse_sed_errnum_t errnum, const qse_cstr_t* errarg)
qse_sed_t* sed, qse_sed_errnum_t errnum, const qse_xstr_t* errarg)
{
qse_sed_seterror (sed, errnum, errarg, QSE_NULL);
}
@ -128,7 +128,7 @@ void qse_sed_seterrmsg (
void qse_sed_seterror (
qse_sed_t* sed, qse_sed_errnum_t errnum,
const qse_cstr_t* errarg, const qse_sed_loc_t* errloc)
const qse_xstr_t* errarg, const qse_sed_loc_t* errloc)
{
const qse_char_t* errfmt;

View File

@ -50,7 +50,7 @@ do { qse_sed_seterror (sed, num, QSE_NULL, loc); } while (0)
#define SETERR1(sed,num,argp,argl,loc) \
do { \
qse_cstr_t __ea__; \
qse_xstr_t __ea__; \
__ea__.ptr = argp; __ea__.len = argl; \
qse_sed_seterror (sed, num, &__ea__, loc); \
} while (0)
@ -216,7 +216,7 @@ int qse_sed_getopt (qse_sed_t* sed, qse_sed_opt_t id, void* value)
}
static void* build_rex (
qse_sed_t* sed, const qse_cstr_t* str,
qse_sed_t* sed, const qse_xstr_t* str,
int ignorecase, const qse_sed_loc_t* loc)
{
#if defined(USE_REX)
@ -317,8 +317,8 @@ static QSE_INLINE void free_rex (qse_sed_t* sed, void* rex)
#if !defined(USE_REX)
static int matchtre (
qse_sed_t* sed, qse_tre_t* tre, int opt,
const qse_cstr_t* str, qse_cstr_t* mat,
qse_cstr_t submat[9], const qse_sed_loc_t* loc)
const qse_xstr_t* str, qse_xstr_t* mat,
qse_xstr_t submat[9], const qse_sed_loc_t* loc)
{
#if defined(QSE_CHAR_IS_MCHAR) && defined(USE_REGEX)
regmatch_t match[10];
@ -912,7 +912,7 @@ static QSE_INLINE void* compile_rex_address (qse_sed_t* sed, qse_char_t rxend)
NXTSC (sed, peeped, QSE_NULL); /* consume the character peeped */
}
return build_rex (sed, QSE_STR_CSTR(&sed->tmp.rex), ignorecase, &sed->src.loc);
return build_rex (sed, QSE_STR_XSTR(&sed->tmp.rex), ignorecase, &sed->src.loc);
}
static qse_sed_adr_t* get_address (qse_sed_t* sed, qse_sed_adr_t* a, int extended)
@ -1441,7 +1441,7 @@ static int get_subst (qse_sed_t* sed, qse_sed_cmd_t* cmd)
else
{
cmd->u.subst.rex = build_rex (
sed, QSE_STR_CSTR(t[0]),
sed, QSE_STR_XSTR(t[0]),
cmd->u.subst.i, &sed->src.loc);
if (cmd->u.subst.rex == QSE_NULL) goto oops;
}
@ -2728,7 +2728,7 @@ static int emit_appends (qse_sed_t* sed)
return 0;
}
static const qse_char_t* trim_line (qse_sed_t* sed, qse_cstr_t* str)
static const qse_char_t* trim_line (qse_sed_t* sed, qse_xstr_t* str)
{
const qse_char_t* lineterm;
@ -2756,14 +2756,14 @@ static const qse_char_t* trim_line (qse_sed_t* sed, qse_cstr_t* str)
static int do_subst (qse_sed_t* sed, qse_sed_cmd_t* cmd)
{
qse_cstr_t mat, pmat;
qse_xstr_t mat, pmat;
int opt = 0, repl = 0, n;
#if defined(USE_REX)
qse_rex_errnum_t errnum;
#endif
const qse_char_t* lineterm;
qse_cstr_t str, cur;
qse_xstr_t str, cur;
const qse_char_t* str_end;
qse_size_t m, i, max_count, sub_count;
@ -2790,7 +2790,7 @@ static int do_subst (qse_sed_t* sed, qse_sed_cmd_t* cmd)
while (cur.ptr <= str_end)
{
#ifndef USE_REX
qse_cstr_t submat[9];
qse_xstr_t submat[9];
QSE_MEMSET (submat, 0, QSE_SIZEOF(submat));
#endif
@ -3017,7 +3017,7 @@ static int do_subst (qse_sed_t* sed, qse_sed_cmd_t* cmd)
}
static int split_into_fields_for_cut (
qse_sed_t* sed, qse_sed_cmd_t* cmd, const qse_cstr_t* str)
qse_sed_t* sed, qse_sed_cmd_t* cmd, const qse_xstr_t* str)
{
qse_size_t i, x = 0, xl = 0;
@ -3058,7 +3058,7 @@ static int split_into_fields_for_cut (
if (x >= sed->e.cutf.cflds)
{
qse_cstr_t* tmp;
qse_xstr_t* tmp;
qse_size_t nsz;
nsz = sed->e.cutf.cflds;
@ -3100,7 +3100,7 @@ static int do_cut (qse_sed_t* sed, qse_sed_cmd_t* cmd)
{
qse_sed_cut_sel_t* b;
const qse_char_t* lineterm;
qse_cstr_t str;
qse_xstr_t str;
int out_state;
qse_str_clear (&sed->e.txt.scratch);
@ -3245,9 +3245,9 @@ static int match_a (qse_sed_t* sed, qse_sed_cmd_t* cmd, qse_sed_adr_t* a)
#if defined(USE_REX)
int n;
qse_rex_errnum_t errnum;
qse_cstr_t match;
qse_xstr_t match;
#endif
qse_cstr_t line;
qse_xstr_t line;
void* rex;
QSE_ASSERT (a->u.rex != QSE_NULL);
@ -4188,7 +4188,7 @@ void qse_sed_freemem (qse_sed_t* sed, void* ptr)
}
void qse_sed_getspace (qse_sed_t* sed, qse_sed_space_t space, qse_cstr_t* str)
void qse_sed_getspace (qse_sed_t* sed, qse_sed_space_t space, qse_xstr_t* str)
{
switch (space)
{

View File

@ -201,8 +201,8 @@ struct qse_sed_t
{
qse_size_t nflds; /**< the number of fields */
qse_size_t cflds; /**< capacity of flds field */
qse_cstr_t sflds[128]; /**< static field buffer */
qse_cstr_t* flds;
qse_xstr_t sflds[128]; /**< static field buffer */
qse_xstr_t* flds;
int delimited;
} cutf;

View File

@ -142,7 +142,7 @@ static qse_sio_t* open_sio_file (qse_sed_t* sed, const qse_char_t* file, int fla
sio = qse_sio_open (sed->mmgr, 0, file, flags);
if (sio == QSE_NULL)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = file;
ea.len = qse_strlen (file);
qse_sed_seterrnum (sed, QSE_SED_EIOFIL, &ea);
@ -170,7 +170,7 @@ static qse_sio_t* open_sio_std (qse_sed_t* sed, qse_sio_std_t std, int flags)
sio = qse_sio_openstd (sed->mmgr, 0, std, flags);
if (sio == QSE_NULL)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = sio_std_names[std].ptr;
ea.len = sio_std_names[std].len;
qse_sed_seterrnum (sed, QSE_SED_EIOFIL, &ea);
@ -389,7 +389,7 @@ static qse_ssize_t read_input_stream (
{
if (io->type == QSE_SED_IOSTD_FILE)
{
qse_cstr_t ea;
qse_xstr_t ea;
if (io->u.file.path)
{
ea.ptr = io->u.file.path;
@ -440,7 +440,7 @@ static qse_ssize_t read_input_stream (
/* failed to open the next input stream */
if (next->type == QSE_SED_IOSTD_FILE)
{
qse_cstr_t ea;
qse_xstr_t ea;
if (next->u.file.path)
{
ea.ptr = next->u.file.path;
@ -578,7 +578,7 @@ static qse_ssize_t x_in (
n = qse_sio_getstrn (arg->handle, buf, len);
if (n <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = sio_std_names[QSE_SIO_STDIN].ptr;
ea.len = sio_std_names[QSE_SIO_STDIN].len;
qse_sed_seterrnum (sed, QSE_SED_EIOFIL, &ea);
@ -594,7 +594,7 @@ static qse_ssize_t x_in (
n = qse_sio_getstrn (arg->handle, buf, len);
if (n <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = arg->path;
ea.len = qse_strlen (arg->path);
qse_sed_seterrnum (sed, QSE_SED_EIOFIL, &ea);
@ -691,7 +691,7 @@ static qse_ssize_t x_out (
n = qse_sio_putstrn (arg->handle, dat, len);
if (n <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = sio_std_names[QSE_SIO_STDOUT].ptr;
ea.len = sio_std_names[QSE_SIO_STDOUT].len;
qse_sed_seterrnum (sed, QSE_SED_EIOFIL, &ea);
@ -719,7 +719,7 @@ static qse_ssize_t x_out (
n = qse_sio_putstrn (arg->handle, dat, len);
if (n <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
if (io->u.file.path)
{
ea.ptr = io->u.file.path;
@ -742,7 +742,7 @@ static qse_ssize_t x_out (
n = qse_sio_putstrn (arg->handle, dat, len);
if (n <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = arg->path;
ea.len = qse_strlen(arg->path);
qse_sed_seterrnum (sed, QSE_SED_EIOFIL, &ea);

View File

@ -105,7 +105,7 @@ void qse_xli_geterror (
}
void qse_xli_seterrnum (
qse_xli_t* xli, qse_xli_errnum_t errnum, const qse_cstr_t* errarg)
qse_xli_t* xli, qse_xli_errnum_t errnum, const qse_xstr_t* errarg)
{
qse_xli_seterror (xli, errnum, errarg, QSE_NULL);
}
@ -122,7 +122,7 @@ void qse_xli_seterrmsg (
void qse_xli_seterror (
qse_xli_t* xli, qse_xli_errnum_t errnum,
const qse_cstr_t* errarg, const qse_xli_loc_t* errloc)
const qse_xstr_t* errarg, const qse_xli_loc_t* errloc)
{
const qse_char_t* errfmt;

View File

@ -101,7 +101,7 @@ typedef struct kwent_t kwent_t;
struct kwent_t
{
qse_cstr_t name;
qse_xstr_t name;
int type;
};
@ -198,7 +198,7 @@ static int skip_comment (qse_xli_t* xli, qse_xli_tok_t* tok)
return 0;
}
static int classify_ident (qse_xli_t* xli, const qse_cstr_t* name)
static int classify_ident (qse_xli_t* xli, const qse_xstr_t* name)
{
/* perform binary search */
@ -445,11 +445,11 @@ retry:
}
while (QSE_ISALPHA (c));
type = classify_ident (xli, QSE_STR_CSTR(tok->name));
type = classify_ident (xli, QSE_STR_XSTR(tok->name));
if (type == TOK_IDENT)
{
/* this keyword/directive is not recognized */
qse_xli_seterror (xli, QSE_XLI_EXKWNR, QSE_STR_CSTR(tok->name), &tok->loc);
qse_xli_seterror (xli, QSE_XLI_EXKWNR, QSE_STR_XSTR(tok->name), &tok->loc);
return -1;
}
SET_TOKEN_TYPE (xli, tok, type);
@ -485,7 +485,7 @@ retry:
if (lead_digit && all_digits)
{
/* if an identifier begins with a digit, it must contain a non-digits character */
qse_xli_seterror (xli, QSE_XLI_EIDENT, QSE_STR_CSTR(tok->name), &tok->loc);
qse_xli_seterror (xli, QSE_XLI_EIDENT, QSE_STR_XSTR(tok->name), &tok->loc);
return -1;
}
@ -601,7 +601,7 @@ retry:
c != QSE_T(',') && c != QSE_T('.') && c != QSE_T('|'))
{
qse_char_t cc = (qse_char_t)c;
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = &cc;
ea.len = 1;
qse_xli_seterror (xli, QSE_XLI_ETAGCHR, &ea, &tok->loc);
@ -620,7 +620,7 @@ retry:
/* not handled yet */
if (c == QSE_T('\0'))
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = QSE_T("<NUL>");
ea.len = 5;
qse_xli_seterror (xli, QSE_XLI_ELXCHR, &ea, &tok->loc);
@ -628,7 +628,7 @@ retry:
else
{
qse_char_t cc = (qse_char_t)c;
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = &cc;
ea.len = 1;
qse_xli_seterror (xli, QSE_XLI_ELXCHR, &ea, &tok->loc);
@ -648,7 +648,7 @@ retry:
if (skip_semicolon_after_include)
{
/* semiclon has not been skipped yet */
qse_xli_seterror (xli, QSE_XLI_ESCOLON, QSE_STR_CSTR(tok->name), &tok->loc);
qse_xli_seterror (xli, QSE_XLI_ESCOLON, QSE_STR_XSTR(tok->name), &tok->loc);
return -1;
}
@ -707,7 +707,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
pair = qse_rbt_search (xli->schema, QSE_STR_PTR(xli->dotted_curkey), QSE_STR_LEN(xli->dotted_curkey));
if (pair == QSE_NULL)
{
qse_xli_seterror (xli, QSE_XLI_EUDKEY, (const qse_cstr_t*)&key, &kloc);
qse_xli_seterror (xli, QSE_XLI_EUDKEY, (const qse_xstr_t*)&key, &kloc);
goto oops;
}
@ -729,7 +729,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
if (atom->type == QSE_XLI_PAIR &&
qse_strcmp (((qse_xli_pair_t*)atom)->key, QSE_STR_PTR(xli->tok.name)) == 0)
{
qse_xli_seterror (xli, QSE_XLI_EEXIST, QSE_STR_CSTR(xli->tok.name), &xli->tok.loc);
qse_xli_seterror (xli, QSE_XLI_EEXIST, QSE_STR_XSTR(xli->tok.name), &xli->tok.loc);
goto oops;
}
@ -757,7 +757,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
qse_strcmp (((qse_xli_pair_t*)atom)->key, key.ptr) == 0 &&
qse_strcmp (((qse_xli_pair_t*)atom)->alias, QSE_STR_PTR(xli->tok.name)) == 0)
{
qse_xli_seterror (xli, QSE_XLI_EEXIST, QSE_STR_CSTR(xli->tok.name), &xli->tok.loc);
qse_xli_seterror (xli, QSE_XLI_EEXIST, QSE_STR_XSTR(xli->tok.name), &xli->tok.loc);
goto oops;
}
atom = atom->prev;
@ -776,7 +776,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
{
/* SCM_KEYALIAS is specified for this particular item. Let the alias be required.
* If KEYALIAS is globally specified with the specific one, it's optional. */
qse_xli_seterrnum (xli, QSE_XLI_ENOALI, (const qse_cstr_t*)&key);
qse_xli_seterrnum (xli, QSE_XLI_ENOALI, (const qse_xstr_t*)&key);
goto oops;
}
}
@ -805,12 +805,12 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
if (scm && !(scm->flags & QSE_XLI_SCM_VALSTR))
{
/* check the value type */
qse_xli_seterror (xli, QSE_XLI_EILVAL, (const qse_cstr_t*)&key, &kloc);
qse_xli_seterror (xli, QSE_XLI_EILVAL, (const qse_xstr_t*)&key, &kloc);
goto oops;
}
/* add a new pair with the initial string segment */
pair = qse_xli_insertpairwithstr (xli, parlist, QSE_NULL, key.ptr, name, keytag, QSE_STR_CSTR(xli->tok.name), strtag);
pair = qse_xli_insertpairwithstr (xli, parlist, QSE_NULL, key.ptr, name, keytag, QSE_STR_XSTR(xli->tok.name), strtag);
if (pair == QSE_NULL) goto oops;
segcount++;
@ -849,7 +849,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
}
/* add an additional segment to the string */
curstrseg = qse_xli_addsegtostr (xli, curstrseg, strtag, QSE_STR_CSTR(xli->tok.name));
curstrseg = qse_xli_addsegtostr (xli, curstrseg, strtag, QSE_STR_XSTR(xli->tok.name));
if (curstrseg == QSE_NULL) goto oops;
segcount++;
@ -861,14 +861,14 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
/* semicolon is mandatory for a string */
if (!MATCH (xli, TOK_SEMICOLON))
{
qse_xli_seterror (xli, QSE_XLI_ESCOLON, QSE_STR_CSTR(xli->tok.name), &xli->tok.loc);
qse_xli_seterror (xli, QSE_XLI_ESCOLON, QSE_STR_XSTR(xli->tok.name), &xli->tok.loc);
goto oops;
}
if (scm && (segcount < scm->str_minseg || segcount > scm->str_maxseg))
{
/* too many string segments for the key */
qse_xli_seterror (xli, QSE_XLI_ESTRSEG, (const qse_cstr_t*)&key, &kloc);
qse_xli_seterror (xli, QSE_XLI_ESTRSEG, (const qse_xstr_t*)&key, &kloc);
goto oops;
}
@ -878,7 +878,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
}
else
{
qse_xli_seterror (xli, QSE_XLI_EPAVAL, QSE_STR_CSTR(xli->tok.name), &xli->tok.loc);
qse_xli_seterror (xli, QSE_XLI_EPAVAL, QSE_STR_XSTR(xli->tok.name), &xli->tok.loc);
goto oops;
}
@ -891,7 +891,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
if (scm && !(scm->flags & QSE_XLI_SCM_VALLIST))
{
/* check the value type */
qse_xli_seterror (xli, QSE_XLI_EILVAL, (const qse_cstr_t*)&key, &kloc);
qse_xli_seterror (xli, QSE_XLI_EILVAL, (const qse_xstr_t*)&key, &kloc);
goto oops;
}
@ -905,7 +905,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
if (!MATCH (xli, TOK_RBRACE))
{
qse_xli_seterror (xli, QSE_XLI_ERBRCE, QSE_STR_CSTR(xli->tok.name), &xli->tok.loc);
qse_xli_seterror (xli, QSE_XLI_ERBRCE, QSE_STR_XSTR(xli->tok.name), &xli->tok.loc);
goto oops;
}
@ -924,7 +924,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
{
if (xli->opt.trait & QSE_XLI_NONIL)
{
qse_xli_seterror (xli, QSE_XLI_ENOVAL, (const qse_cstr_t*)&key, &kloc);
qse_xli_seterror (xli, QSE_XLI_ENOVAL, (const qse_xstr_t*)&key, &kloc);
goto oops;
}
@ -932,7 +932,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
!((scm->flags & QSE_XLI_SCM_VALSTR) && scm->str_minseg <= 0))
{
/* check the value type */
qse_xli_seterror (xli, QSE_XLI_ENOVAL, (const qse_cstr_t*)&key, &kloc);
qse_xli_seterror (xli, QSE_XLI_ENOVAL, (const qse_xstr_t*)&key, &kloc);
goto oops;
}
@ -949,7 +949,7 @@ static int read_pair (qse_xli_t* xli, const qse_char_t* keytag)
}
else
{
qse_xli_seterror (xli, QSE_XLI_ELBREQ, QSE_STR_CSTR(xli->tok.name), &xli->tok.loc);
qse_xli_seterror (xli, QSE_XLI_ELBREQ, QSE_STR_XSTR(xli->tok.name), &xli->tok.loc);
goto oops;
}

View File

@ -114,7 +114,7 @@ static qse_sio_t* open_sio (qse_xli_t* xli, const qse_char_t* file, int flags)
sio = qse_sio_open (xli->mmgr, 0, file, flags);
if (sio == QSE_NULL)
{
qse_cstr_t errarg;
qse_xstr_t errarg;
errarg.ptr = file;
errarg.len = qse_strlen(file);
qse_xli_seterrnum (xli, QSE_XLI_EIOFIL, &errarg);
@ -122,7 +122,7 @@ static qse_sio_t* open_sio (qse_xli_t* xli, const qse_char_t* file, int flags)
return sio;
}
static qse_cstr_t sio_std_names[] =
static qse_xstr_t sio_std_names[] =
{
{ QSE_T("stdin"), 5 },
{ QSE_T("stdout"), 6 },
@ -232,7 +232,7 @@ static qse_ssize_t sf_in_open (qse_xli_t* xli, qse_xli_io_arg_t* arg, xtn_t* xtn
if (dbuf) QSE_MMGR_FREE (xli->mmgr, dbuf);
if (arg->handle == QSE_NULL)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = arg->name;
ea.len = qse_strlen(ea.ptr);
qse_xli_seterrnum (xli, QSE_XLI_EIOFIL, &ea);
@ -290,7 +290,7 @@ static qse_ssize_t sf_in_read (
n = qse_sio_getstrn (arg->handle, data, size);
if (n <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = xtn->s.in.x->u.file.path;
if (ea.ptr == QSE_NULL) ea.ptr = sio_std_names[QSE_SIO_STDIN].ptr;
ea.len = qse_strlen(ea.ptr);
@ -326,7 +326,7 @@ static qse_ssize_t sf_in_read (
n = qse_sio_getstrn (arg->handle, data, size);
if (n <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = arg->name;
ea.len = qse_strlen(ea.ptr);
qse_xli_seterrnum (xli, QSE_XLI_EIOFIL, &ea);
@ -459,7 +459,7 @@ static qse_ssize_t sf_out_open (qse_xli_t* xli, qse_xli_io_arg_t* arg, xtn_t* xt
if (dbuf) QSE_MMGR_FREE (xli->mmgr, dbuf);
if (arg->handle == QSE_NULL)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = arg->name;
ea.len = qse_strlen(ea.ptr);
qse_xli_seterrnum (xli, QSE_XLI_EIOFIL, &ea);
@ -517,7 +517,7 @@ static qse_ssize_t sf_out_write (
n = qse_sio_putstrn (arg->handle, data, size);
if (n <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = xtn->s.out.x->u.file.path;
if (ea.ptr == QSE_NULL) ea.ptr = sio_std_names[QSE_SIO_STDOUT].ptr;
ea.len = qse_strlen(ea.ptr);
@ -555,7 +555,7 @@ static qse_ssize_t sf_out_write (
n = qse_sio_putstrn (arg->handle, data, size);
if (n <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = arg->name;
ea.len = qse_strlen(ea.ptr);
qse_xli_seterrnum (xli, QSE_XLI_EIOFIL, &ea);

View File

@ -225,7 +225,7 @@ static void insert_atom (
static qse_xli_pair_t* insert_pair (
qse_xli_t* xli, qse_xli_list_t* parent, qse_xli_atom_t* peer,
const qse_cstr_t* key, const qse_cstr_t* alias, const qse_cstr_t* keytag, qse_xli_val_t* value)
const qse_xstr_t* key, const qse_xstr_t* alias, const qse_xstr_t* keytag, qse_xli_val_t* value)
{
qse_xli_pair_t* pair;
qse_size_t alen, tlen;
@ -270,9 +270,9 @@ qse_xli_pair_t* qse_xli_insertpair (
const qse_char_t* key, const qse_char_t* alias,
const qse_char_t* keytag, qse_xli_val_t* value)
{
qse_cstr_t k;
qse_cstr_t a, * ap = QSE_NULL;
qse_cstr_t t, * tp = QSE_NULL;
qse_xstr_t k;
qse_xstr_t a, * ap = QSE_NULL;
qse_xstr_t t, * tp = QSE_NULL;
k.ptr = key;
k.len = qse_strlen (key);
@ -312,7 +312,7 @@ qse_xli_pair_t* qse_xli_insertpairwithemptylist (
qse_xli_pair_t* qse_xli_insertpairwithstr (
qse_xli_t* xli, qse_xli_list_t* parent, qse_xli_atom_t* peer,
const qse_char_t* key, const qse_char_t* alias, const qse_char_t* keytag,
const qse_cstr_t* value, const qse_char_t* strtag)
const qse_xstr_t* value, const qse_char_t* strtag)
{
qse_xli_str_t* val;
qse_xli_pair_t* tmp;
@ -344,7 +344,7 @@ qse_xli_pair_t* qse_xli_insertpairwithstr (
qse_xli_pair_t* qse_xli_insertpairwithstrs (
qse_xli_t* xli, qse_xli_list_t* parent, qse_xli_atom_t* peer,
const qse_char_t* key, const qse_char_t* alias, const qse_char_t* keytag,
const qse_cstr_t value[], qse_size_t count)
const qse_xstr_t value[], qse_size_t count)
{
qse_xli_pair_t* tmp;
qse_xli_str_t* str;
@ -534,7 +534,7 @@ qse_xli_list_t* qse_xli_yieldroot (qse_xli_t* xli)
/* ------------------------------------------------------ */
static qse_size_t count_pairs_by_key (
qse_xli_t* xli, const qse_xli_list_t* list, const qse_cstr_t* key)
qse_xli_t* xli, const qse_xli_list_t* list, const qse_xstr_t* key)
{
qse_xli_atom_t* p;
qse_size_t count = 0;
@ -557,7 +557,7 @@ static qse_size_t count_pairs_by_key (
static qse_xli_pair_t* find_pair_by_key_and_alias (
qse_xli_t* xli, const qse_xli_list_t* list,
const qse_cstr_t* key, const qse_cstr_t* alias)
const qse_xstr_t* key, const qse_xstr_t* alias)
{
qse_xli_atom_t* p;
@ -583,7 +583,7 @@ static qse_xli_pair_t* find_pair_by_key_and_alias (
static qse_xli_pair_t* find_pair_by_key_and_index (
qse_xli_t* xli, const qse_xli_list_t* list,
const qse_cstr_t* key, qse_size_t index)
const qse_xstr_t* key, qse_size_t index)
{
qse_xli_atom_t* p;
qse_size_t count = 0;
@ -611,8 +611,8 @@ static qse_xli_pair_t* find_pair_by_key_and_index (
struct fqpn_seg_t
{
qse_cstr_t ki; /* key + index */
qse_cstr_t key;
qse_xstr_t ki; /* key + index */
qse_xstr_t key;
enum
{
FQPN_SEG_IDX_NONE,
@ -623,7 +623,7 @@ struct fqpn_seg_t
union
{
qse_size_t number;
qse_cstr_t alias;
qse_xstr_t alias;
} idx;
};
@ -835,7 +835,7 @@ noent:
}
qse_xli_str_t* qse_xli_addsegtostr (
qse_xli_t* xli, qse_xli_str_t* str, const qse_char_t* tag, const qse_cstr_t* value)
qse_xli_t* xli, qse_xli_str_t* str, const qse_char_t* tag, const qse_xstr_t* value)
{
qse_xli_str_t* val;
qse_size_t reqlen;
@ -917,7 +917,7 @@ int qse_xli_undefinepair (qse_xli_t* xli, const qse_char_t* fqpn)
{
if (qse_rbt_delete (xli->schema, fqpn, qse_strlen(fqpn)) <= -1)
{
qse_cstr_t ea;
qse_xstr_t ea;
ea.ptr = fqpn;
ea.len = qse_strlen (ea.ptr);
qse_xli_seterrnum (xli, QSE_XLI_ENOENT, &ea);

View File

@ -15,8 +15,8 @@ static int rex_main (int argc, qse_char_t* argv[])
{
qse_rex_t* rex;
qse_rex_node_t* start;
qse_cstr_t str;
qse_cstr_t matstr;
qse_xstr_t str;
qse_xstr_t matstr;
int n;
if (argc != 3)

View File

@ -236,7 +236,7 @@ static int test12 (void)
return 0;
}
qse_char_t* subst (qse_char_t* buf, qse_size_t bsz, const qse_cstr_t* ident, void* ctx)
qse_char_t* subst (qse_char_t* buf, qse_size_t bsz, const qse_xstr_t* ident, void* ctx)
{
if (qse_strxcmp (ident->ptr, ident->len, QSE_T("USER")) == 0)
{

View File

@ -1,6 +1,6 @@
#include <qse/http/httpd.h>
#include <qse/cmn/stdio.h>
#include <qse/cmn/sio.h>
#include <qse/cmn/main.h>
#include <qse/cmn/str.h>
#include <qse/cmn/mem.h>
@ -104,7 +104,10 @@ int qse_main (int argc, qse_achar_t* argv[])
{
int ret;
qse_openstdsios ();
#if defined(_WIN32)
{
char locale[100];
UINT codepage;
WSADATA wsadata;
@ -127,7 +130,7 @@ int qse_main (int argc, qse_achar_t* argv[])
qse_fprintf (QSE_STDERR, QSE_T("Failed to start up winsock\n"));
return -1;
}
}
#else
setlocale (LC_ALL, "");
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
@ -152,6 +155,7 @@ int qse_main (int argc, qse_achar_t* argv[])
WSACleanup ();
#endif
qse_closestdsios ();
return ret;
}

View File

@ -5,7 +5,7 @@
static void trace_exec (qse_sed_t* sed, qse_sed_tracer_op_t op, qse_sed_cmd_t* cmd)
{
qse_cstr_t h, p;
qse_xstr_t h, p;
qse_sed_getspace (sed, QSE_SED_SPACE_HOLD, &h);
qse_sed_getspace (sed, QSE_SED_SPACE_PATTERN, &p);