changed qse_runmain() to ignore mbwc error by calling qse_mbstowcsalldup().

added qse_mbstowcsalldup() and its variants
This commit is contained in:
hyung-hwan 2012-01-15 15:25:28 +00:00
parent 52710a87c9
commit fa850168ee
16 changed files with 246 additions and 46 deletions

View File

@ -58,7 +58,8 @@ public:
class SourceFile: public Source class SourceFile: public Source
{ {
public: public:
SourceFile (const char_t* name): name (name) SourceFile (const char_t* name, qse_cmgr_t* cmgr = QSE_NULL):
name (name), cmgr (cmgr)
{ {
dir.ptr = QSE_NULL; dir.len = 0; dir.ptr = QSE_NULL; dir.len = 0;
} }
@ -71,6 +72,7 @@ public:
protected: protected:
const char_t* name; const char_t* name;
qse_cstr_t dir; qse_cstr_t dir;
qse_cmgr_t* cmgr;
}; };
/// ///

View File

@ -39,8 +39,12 @@
* This programs shows how to specify multiple console output files. * This programs shows how to specify multiple console output files.
*/ */
/**
* The qse_awk_parsestd_type_t type defines the types of source I/O.
*/
enum qse_awk_parsestd_type_t enum qse_awk_parsestd_type_t
{ {
QSE_AWK_PARSESTD_NULL = 0, /* invalid type */
QSE_AWK_PARSESTD_FILE = 1, QSE_AWK_PARSESTD_FILE = 1,
QSE_AWK_PARSESTD_STR = 2 QSE_AWK_PARSESTD_STR = 2
}; };
@ -56,12 +60,30 @@ struct qse_awk_parsestd_t
union union
{ {
/**
* You can create a sio stream in advance and pass it to
* qse_awk_parsestd() via this field. */
qse_sio_t* sio; qse_sio_t* sio;
struct struct
{ {
/** file path to open. QSE_NULL or '-' for stdin/stdout. */
const qse_char_t* path; const qse_char_t* path;
/* the streams created with the file path is set with this
* cmgr if it is not #QSE_NULL. */
qse_cmgr_t* cmgr; qse_cmgr_t* cmgr;
} file; } file;
/**
* For input, the ptr and the len field of str indicates the
* pointer and the length of a string to read.
*
* For output, the ptr and the len field of str indicates the
* pointer and the length of a deparsed source string. The output
* string is dynamically allocated. You must free this output
* pointer using #QSE_MMGR_FREE once you're done with it to avoid
* memory leaks.
*/
qse_xstr_t str; qse_xstr_t str;
} u; } u;
}; };
@ -107,18 +129,19 @@ void* qse_awk_getxtnstd (
* and deparses it out to a buffer 'buf'. * and deparses it out to a buffer 'buf'.
* @code * @code
* int n; * int n;
* qse_awk_parsestd_in_t in; * qse_awk_parsestd_t in;
* qse_awk_parsestd_out_t out; * qse_awk_parsestd_t out;
* qse_char_t buf[1000];
*
* qse_memset (buf, QSE_T(' '), QSE_COUNTOF(buf));
* buf[QSE_COUNTOF(buf)-1] = QSE_T('\0');
* in.type = QSE_AWK_PARSESTD_CP;
* in.u.cp = QSE_T("BEGIN { print 10; }");
* out.type = QSE_AWK_PARSESTD_CP;
* out.u.cp = buf;
* *
* in.type = QSE_AWK_PARSESTD_STR;
* in.u.str.ptr = QSE_T("BEGIN { print 10; }");
* in.u.str.len = qse_strlen(in.u.str.ptr);
* out.type = QSE_AWK_PARSESTD_STR;
* n = qse_awk_parsestd (awk, &in, &out); * n = qse_awk_parsestd (awk, &in, &out);
* if (n >= 0)
* {
* qse_printf (QSE_T("%s\n"), out.u.str.ptr);
* QSE_MMGR_FREE (out.u.str.ptr);
* }
* @endcode * @endcode
*/ */
int qse_awk_parsestd ( int qse_awk_parsestd (
@ -130,7 +153,8 @@ int qse_awk_parsestd (
/** /**
* The qse_awk_rtx_openstd() function creates a standard runtime context. * The qse_awk_rtx_openstd() function creates a standard runtime context.
* The caller should keep the contents of @a icf and @a ocf valid throughout * The caller should keep the contents of @a icf and @a ocf valid throughout
* the lifetime of the runtime context created. * the lifetime of the runtime context created. The @a cmgr is set to the
* streams created with @a icf and @a ocf if it is not #QSE_NULL.
*/ */
qse_awk_rtx_t* qse_awk_rtx_openstd ( qse_awk_rtx_t* qse_awk_rtx_openstd (
qse_awk_t* awk, qse_awk_t* awk,

View File

@ -52,6 +52,14 @@ int qse_mbstowcswithcmgr (
qse_cmgr_t* cmgr qse_cmgr_t* cmgr
); );
int qse_mbstowcsallwithcmgr (
const qse_mchar_t* mbs,
qse_size_t* mbslen,
qse_wchar_t* wcs,
qse_size_t* wcslen,
qse_cmgr_t* cmgr
);
int qse_mbsntowcsnwithcmgr ( int qse_mbsntowcsnwithcmgr (
const qse_mchar_t* mbs, const qse_mchar_t* mbs,
qse_size_t* mbslen, qse_size_t* mbslen,
@ -60,6 +68,14 @@ int qse_mbsntowcsnwithcmgr (
qse_cmgr_t* cmgr qse_cmgr_t* cmgr
); );
int qse_mbsntowcsnallwithcmgr (
const qse_mchar_t* mbs,
qse_size_t* mbslen,
qse_wchar_t* wcs,
qse_size_t* wcslen,
qse_cmgr_t* cmgr
);
int qse_mbsntowcsnuptowithcmgr ( int qse_mbsntowcsnuptowithcmgr (
const qse_mchar_t* mbs, const qse_mchar_t* mbs,
qse_size_t* mbslen, qse_size_t* mbslen,
@ -75,12 +91,24 @@ qse_wchar_t* qse_mbstowcsdupwithcmgr (
qse_cmgr_t* cmgr qse_cmgr_t* cmgr
); );
qse_wchar_t* qse_mbstowcsalldupwithcmgr (
const qse_mchar_t* mbs,
qse_mmgr_t* mmgr,
qse_cmgr_t* cmgr
);
qse_wchar_t* qse_mbsatowcsdupwithcmgr ( qse_wchar_t* qse_mbsatowcsdupwithcmgr (
const qse_mchar_t* mbs[], const qse_mchar_t* mbs[],
qse_mmgr_t* mmgr, qse_mmgr_t* mmgr,
qse_cmgr_t* cmgr qse_cmgr_t* cmgr
); );
qse_wchar_t* qse_mbsatowcsalldupwithcmgr (
const qse_mchar_t* mbs[],
qse_mmgr_t* mmgr,
qse_cmgr_t* cmgr
);
int qse_wcstombswithcmgr ( int qse_wcstombswithcmgr (
const qse_wchar_t* wcs, /**< [in] wide-character string to convert*/ const qse_wchar_t* wcs, /**< [in] wide-character string to convert*/
qse_size_t* wcslen, /**< [out] number of wide-characters handled */ qse_size_t* wcslen, /**< [out] number of wide-characters handled */
@ -147,6 +175,15 @@ int qse_mbstowcs (
number of characters in the buffer for out */ number of characters in the buffer for out */
); );
int qse_mbstowcsall (
const qse_mchar_t* mbs, /**< [in] multibyte string to convert */
qse_size_t* mbslen, /**< [out] number of multibyte characters
handled */
qse_wchar_t* wcs, /**< [out] wide-character string buffer */
qse_size_t* wcslen /**< [in,out] buffer size for in,
number of characters in the buffer for out */
);
/** /**
* The qse_mbsntowcsn() function converts a multibyte string to a * The qse_mbsntowcsn() function converts a multibyte string to a
* wide character string. * wide character string.
@ -165,6 +202,13 @@ int qse_mbsntowcsn (
qse_size_t* wcslen qse_size_t* wcslen
); );
int qse_mbsntowcsnall (
const qse_mchar_t* mbs,
qse_size_t* mbslen,
qse_wchar_t* wcs,
qse_size_t* wcslen
);
/** /**
* The qse_mbsntowcsnupto() function is the same as qse_mbsntowcsn() * The qse_mbsntowcsnupto() function is the same as qse_mbsntowcsn()
* except that it stops once it has processed the @a stopper character. * except that it stops once it has processed the @a stopper character.
@ -182,11 +226,21 @@ qse_wchar_t* qse_mbstowcsdup (
qse_mmgr_t* mmgr qse_mmgr_t* mmgr
); );
qse_wchar_t* qse_mbstowcsalldup (
const qse_mchar_t* mbs,
qse_mmgr_t* mmgr
);
qse_wchar_t* qse_mbsatowcsdup ( qse_wchar_t* qse_mbsatowcsdup (
const qse_mchar_t* mbs[], const qse_mchar_t* mbs[],
qse_mmgr_t* mmgr qse_mmgr_t* mmgr
); );
qse_wchar_t* qse_mbsatowcsalldup (
const qse_mchar_t* mbs[],
qse_mmgr_t* mmgr
);
/** /**
* The qse_wcstombs() function converts a null-terminated wide character * The qse_wcstombs() function converts a null-terminated wide character
* string @a wcs to a multibyte string and writes it into the buffer pointed to * string @a wcs to a multibyte string and writes it into the buffer pointed to

View File

@ -48,8 +48,9 @@ public:
{ {
public: public:
FileStream (const char_t* infile = QSE_NULL, FileStream (const char_t* infile = QSE_NULL,
const char_t* outfile = QSE_NULL): const char_t* outfile = QSE_NULL,
infile(infile), outfile(outfile) qse_cmgr_t* cmgr = QSE_NULL):
infile(infile), outfile(outfile), cmgr(cmgr)
{ {
} }
@ -61,6 +62,7 @@ public:
protected: protected:
const char_t* infile; const char_t* infile;
const char_t* outfile; const char_t* outfile;
qse_cmgr_t* cmgr;
}; };
class StringStream: public Stream class StringStream: public Stream

View File

@ -799,6 +799,7 @@ int StdAwk::SourceFile::open (Data& io)
); );
if (sio == QSE_NULL) return -1; if (sio == QSE_NULL) return -1;
if (this->cmgr) qse_sio_setcmgr (sio, this->cmgr);
base = qse_basename (this->name); base = qse_basename (this->name);
if (base != this->name) if (base != this->name)
{ {
@ -848,6 +849,7 @@ int StdAwk::SourceFile::open (Data& io)
); );
if (dbuf) QSE_MMGR_FREE (((Awk*)io)->getMmgr(), dbuf); if (dbuf) QSE_MMGR_FREE (((Awk*)io)->getMmgr(), dbuf);
if (sio == QSE_NULL) return -1; if (sio == QSE_NULL) return -1;
if (this->cmgr) qse_sio_setcmgr (sio, this->cmgr);
} }
io.setHandle (sio); io.setHandle (sio);

View File

@ -44,8 +44,7 @@ int qse_runmain (
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
{ {
/* TODO: ignore MBWCERR */ v[i]= qse_mbstowcsalldup (argv[i], mmgr);
v[i]= qse_mbstowcsdup (argv[i], mmgr);
if (v[i] == QSE_NULL) if (v[i] == QSE_NULL)
{ {
ret = -1; ret = -1;
@ -98,8 +97,7 @@ int qse_runmainwithenv (
else if (i == argc) continue; else if (i == argc) continue;
else x = envp[i - argc - 1]; else x = envp[i - argc - 1];
/* TODO: ignore MBWCERR */ v[i]= qse_mbstowcsalldup (x, mmgr);
v[i]= qse_mbstowcsdup (x, mmgr);
if (v[i] == QSE_NULL) if (v[i] == QSE_NULL)
{ {
ret = -1; ret = -1;

View File

@ -21,9 +21,13 @@
#include <qse/cmn/mbwc.h> #include <qse/cmn/mbwc.h>
#include "mem.h" #include "mem.h"
int qse_mbstowcswithcmgr ( static int mbsn_to_wcsn_with_cmgr (
const qse_mchar_t* mbs, qse_size_t* mbslen, const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen, qse_cmgr_t* cmgr) qse_wchar_t* wcs, qse_size_t* wcslen, qse_cmgr_t* cmgr, int all);
static int mbs_to_wcs_with_cmgr (
const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen, qse_cmgr_t* cmgr, int all)
{ {
const qse_mchar_t* mp; const qse_mchar_t* mp;
qse_size_t mlen, wlen; qse_size_t mlen, wlen;
@ -32,7 +36,7 @@ int qse_mbstowcswithcmgr (
for (mp = mbs; *mp != QSE_MT('\0'); mp++); for (mp = mbs; *mp != QSE_MT('\0'); mp++);
mlen = mp - mbs; wlen = *wcslen; mlen = mp - mbs; wlen = *wcslen;
n = qse_mbsntowcsnwithcmgr (mbs, &mlen, wcs, &wlen, cmgr); n = mbsn_to_wcsn_with_cmgr (mbs, &mlen, wcs, &wlen, cmgr, all);
if (wcs) if (wcs)
{ {
if (wlen < *wcslen) wcs[wlen] = QSE_WT('\0'); if (wlen < *wcslen) wcs[wlen] = QSE_WT('\0');
@ -43,9 +47,23 @@ int qse_mbstowcswithcmgr (
return n; return n;
} }
int qse_mbsntowcsnwithcmgr ( int qse_mbstowcswithcmgr (
const qse_mchar_t* mbs, qse_size_t* mbslen, const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen, qse_cmgr_t* cmgr) qse_wchar_t* wcs, qse_size_t* wcslen, qse_cmgr_t* cmgr)
{
return mbs_to_wcs_with_cmgr (mbs, mbslen, wcs, wcslen, cmgr, 0);
}
int qse_mbstowcsallwithcmgr (
const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen, qse_cmgr_t* cmgr)
{
return mbs_to_wcs_with_cmgr (mbs, mbslen, wcs, wcslen, cmgr, 1);
}
static int mbsn_to_wcsn_with_cmgr (
const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen, qse_cmgr_t* cmgr, int all)
{ {
const qse_mchar_t* p; const qse_mchar_t* p;
int ret = 0; int ret = 0;
@ -75,14 +93,30 @@ int qse_mbsntowcsnwithcmgr (
if (n == 0) if (n == 0)
{ {
/* invalid sequence */ /* invalid sequence */
ret = -1; if (all)
break; {
n = 1;
*q = QSE_WT('?');
}
else
{
ret = -1;
break;
}
} }
if (n > mlen) if (n > mlen)
{ {
/* incomplete sequence */ /* incomplete sequence */
ret = -3; if (all)
break; {
n = 1;
*q = QSE_WT('?');
}
else
{
ret = -3;
break;
}
} }
q++; q++;
@ -109,14 +143,22 @@ int qse_mbsntowcsnwithcmgr (
if (n == 0) if (n == 0)
{ {
/* invalid sequence */ /* invalid sequence */
ret = -1; if (all) n = 1;
break; else
{
ret = -1;
break;
}
} }
if (n > mlen) if (n > mlen)
{ {
/* incomplete sequence */ /* incomplete sequence */
ret = -3; if (all) n = 1;
break; else
{
ret = -3;
break;
}
} }
p += n; p += n;
@ -131,6 +173,20 @@ int qse_mbsntowcsnwithcmgr (
return ret; return ret;
} }
int qse_mbsntowcsnwithcmgr (
const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen, qse_cmgr_t* cmgr)
{
return mbsn_to_wcsn_with_cmgr (mbs, mbslen, wcs, wcslen, cmgr, 0);
}
int qse_mbsntowcsnallwithcmgr (
const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen, qse_cmgr_t* cmgr)
{
return mbsn_to_wcsn_with_cmgr (mbs, mbslen, wcs, wcslen, cmgr, 1);
}
int qse_mbsntowcsnuptowithcmgr ( int qse_mbsntowcsnuptowithcmgr (
const qse_mchar_t* mbs, qse_size_t* mbslen, const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen, qse_wchar_t stopper, qse_cmgr_t* cmgr) qse_wchar_t* wcs, qse_size_t* wcslen, qse_wchar_t stopper, qse_cmgr_t* cmgr)
@ -189,24 +245,37 @@ int qse_mbsntowcsnuptowithcmgr (
return ret; return ret;
} }
qse_wchar_t* qse_mbstowcsdupwithcmgr ( static qse_wchar_t* mbs_to_wcs_dup_with_cmgr (
const qse_mchar_t* mbs, qse_mmgr_t* mmgr, qse_cmgr_t* cmgr) const qse_mchar_t* mbs, qse_mmgr_t* mmgr, qse_cmgr_t* cmgr, int all)
{ {
qse_size_t mbslen, wcslen; qse_size_t mbslen, wcslen;
qse_wchar_t* wcs; qse_wchar_t* wcs;
if (qse_mbstowcswithcmgr (mbs, &mbslen, QSE_NULL, &wcslen, cmgr) <= -1) return QSE_NULL; if (mbs_to_wcs_with_cmgr (
mbs, &mbslen, QSE_NULL, &wcslen, cmgr, all) <= -1) return QSE_NULL;
wcslen++; /* for terminating null */ wcslen++; /* for terminating null */
wcs = QSE_MMGR_ALLOC (mmgr, wcslen * QSE_SIZEOF(*wcs)); wcs = QSE_MMGR_ALLOC (mmgr, wcslen * QSE_SIZEOF(*wcs));
if (wcs == QSE_NULL) return QSE_NULL; if (wcs == QSE_NULL) return QSE_NULL;
qse_mbstowcswithcmgr (mbs, &mbslen, wcs, &wcslen, cmgr); mbs_to_wcs_with_cmgr (mbs, &mbslen, wcs, &wcslen, cmgr, all);
return wcs; return wcs;
} }
qse_wchar_t* qse_mbsatowcsdupwithcmgr ( qse_wchar_t* qse_mbstowcsdupwithcmgr (
const qse_mchar_t* mbs[], qse_mmgr_t* mmgr, qse_cmgr_t* cmgr) const qse_mchar_t* mbs, qse_mmgr_t* mmgr, qse_cmgr_t* cmgr)
{
return mbs_to_wcs_dup_with_cmgr (mbs, mmgr, cmgr, 0);
}
qse_wchar_t* qse_mbstowcsalldupwithcmgr (
const qse_mchar_t* mbs, qse_mmgr_t* mmgr, qse_cmgr_t* cmgr)
{
return mbs_to_wcs_dup_with_cmgr (mbs, mmgr, cmgr, 1);
}
static qse_wchar_t* mbsa_to_wcs_dup_with_cmgr (
const qse_mchar_t* mbs[], qse_mmgr_t* mmgr, qse_cmgr_t* cmgr, int all)
{ {
qse_wchar_t* buf, * ptr; qse_wchar_t* buf, * ptr;
qse_size_t i; qse_size_t i;
@ -217,7 +286,8 @@ qse_wchar_t* qse_mbsatowcsdupwithcmgr (
for (i = 0; mbs[i]; i++) for (i = 0; mbs[i]; i++)
{ {
if (qse_mbstowcswithcmgr (mbs[i], &ml, QSE_NULL, &wl, cmgr) <= -1) return QSE_NULL; if (mbs_to_wcs_with_cmgr (mbs[i], &ml, QSE_NULL, &wl, cmgr, all) <= -1)
return QSE_NULL;
capa += wl; capa += wl;
} }
@ -229,7 +299,7 @@ qse_wchar_t* qse_mbsatowcsdupwithcmgr (
for (i = 0; mbs[i]; i++) for (i = 0; mbs[i]; i++)
{ {
wl = capa + 1; wl = capa + 1;
qse_mbstowcswithcmgr (mbs[i], &ml, ptr, &wl, cmgr); mbs_to_wcs_with_cmgr (mbs[i], &ml, ptr, &wl, cmgr, all);
ptr += wl; ptr += wl;
capa -= wl; capa -= wl;
} }
@ -237,6 +307,20 @@ qse_wchar_t* qse_mbsatowcsdupwithcmgr (
return buf; return buf;
} }
qse_wchar_t* qse_mbsatowcsdupwithcmgr (
const qse_mchar_t* mbs[], qse_mmgr_t* mmgr, qse_cmgr_t* cmgr)
{
return mbsa_to_wcs_dup_with_cmgr (mbs, mmgr, cmgr, 0);
}
qse_wchar_t* qse_mbsatowcsalldupwithcmgr (
const qse_mchar_t* mbs[], qse_mmgr_t* mmgr, qse_cmgr_t* cmgr)
{
return mbsa_to_wcs_dup_with_cmgr (mbs, mmgr, cmgr, 1);
}
/* ======================================================================== */
int qse_wcstombswithcmgr ( int qse_wcstombswithcmgr (
const qse_wchar_t* wcs, qse_size_t* wcslen, const qse_wchar_t* wcs, qse_size_t* wcslen,
qse_mchar_t* mbs, qse_size_t* mbslen, qse_cmgr_t* cmgr) qse_mchar_t* mbs, qse_size_t* mbslen, qse_cmgr_t* cmgr)

View File

@ -66,6 +66,13 @@ int qse_mbstowcs (
return qse_mbstowcswithcmgr (mbs, mbslen, wcs, wcslen, dfl_cmgr); return qse_mbstowcswithcmgr (mbs, mbslen, wcs, wcslen, dfl_cmgr);
} }
int qse_mbstowcsall (
const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen)
{
return qse_mbstowcsallwithcmgr (mbs, mbslen, wcs, wcslen, dfl_cmgr);
}
int qse_mbsntowcsn ( int qse_mbsntowcsn (
const qse_mchar_t* mbs, qse_size_t* mbslen, const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen) qse_wchar_t* wcs, qse_size_t* wcslen)
@ -73,6 +80,13 @@ int qse_mbsntowcsn (
return qse_mbsntowcsnwithcmgr (mbs, mbslen, wcs, wcslen, dfl_cmgr); return qse_mbsntowcsnwithcmgr (mbs, mbslen, wcs, wcslen, dfl_cmgr);
} }
int qse_mbsntowcsnall (
const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen)
{
return qse_mbsntowcsnallwithcmgr (mbs, mbslen, wcs, wcslen, dfl_cmgr);
}
int qse_mbsntowcsnupto ( int qse_mbsntowcsnupto (
const qse_mchar_t* mbs, qse_size_t* mbslen, const qse_mchar_t* mbs, qse_size_t* mbslen,
qse_wchar_t* wcs, qse_size_t* wcslen, qse_wchar_t stopper) qse_wchar_t* wcs, qse_size_t* wcslen, qse_wchar_t stopper)
@ -86,11 +100,23 @@ qse_wchar_t* qse_mbstowcsdup (const qse_mchar_t* mbs, qse_mmgr_t* mmgr)
return qse_mbstowcsdupwithcmgr (mbs, mmgr, dfl_cmgr); return qse_mbstowcsdupwithcmgr (mbs, mmgr, dfl_cmgr);
} }
qse_wchar_t* qse_mbstowcsalldup (const qse_mchar_t* mbs, qse_mmgr_t* mmgr)
{
return qse_mbstowcsalldupwithcmgr (mbs, mmgr, dfl_cmgr);
}
qse_wchar_t* qse_mbsatowcsdup (const qse_mchar_t* mbs[], qse_mmgr_t* mmgr) qse_wchar_t* qse_mbsatowcsdup (const qse_mchar_t* mbs[], qse_mmgr_t* mmgr)
{ {
return qse_mbsatowcsdupwithcmgr (mbs, mmgr, dfl_cmgr); return qse_mbsatowcsdupwithcmgr (mbs, mmgr, dfl_cmgr);
} }
qse_wchar_t* qse_mbsatowcsalldup (const qse_mchar_t* mbs[], qse_mmgr_t* mmgr)
{
return qse_mbsatowcsalldupwithcmgr (mbs, mmgr, dfl_cmgr);
}
/* -------------------------------------------------------------- */
int qse_wcstombs ( int qse_wcstombs (
const qse_wchar_t* wcs, qse_size_t* wcslen, const qse_wchar_t* wcs, qse_size_t* wcslen,
qse_mchar_t* mbs, qse_size_t* mbslen) qse_mchar_t* mbs, qse_size_t* mbslen)

View File

@ -102,6 +102,7 @@ int StdSed::FileStream::open (Data& io)
} }
if (sio == QSE_NULL) return -1; if (sio == QSE_NULL) return -1;
if (this->cmgr) qse_sio_setcmgr (sio, this->cmgr);
io.setHandle (sio); io.setHandle (sio);
return 1; return 1;
} }

View File

@ -63,7 +63,8 @@ int main ()
0, 0,
QSE_T("awk01"), QSE_T("awk01"),
QSE_NULL, /* stdin */ QSE_NULL, /* stdin */
QSE_NULL /* stdout */ QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
); );
if (rtx == QSE_NULL) if (rtx == QSE_NULL)
{ {

View File

@ -79,7 +79,8 @@ int main ()
0, 0,
QSE_T("awk02"), QSE_T("awk02"),
QSE_NULL, /* stdin */ QSE_NULL, /* stdin */
QSE_NULL /* stdout */ QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
); );
if (rtx == QSE_NULL) if (rtx == QSE_NULL)
{ {

View File

@ -76,7 +76,8 @@ int main ()
0, 0,
QSE_T("awk03"), QSE_T("awk03"),
QSE_NULL, /* stdin */ QSE_NULL, /* stdin */
QSE_NULL /* stdout */ QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
); );
if (rtx == QSE_NULL) if (rtx == QSE_NULL)
{ {

View File

@ -76,7 +76,8 @@ int main ()
0, 0,
QSE_T("awk04"), QSE_T("awk04"),
QSE_NULL, /* stdin */ QSE_NULL, /* stdin */
QSE_NULL /* stdout */ QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
); );
if (rtx == QSE_NULL) if (rtx == QSE_NULL)
{ {

View File

@ -44,7 +44,7 @@ static int run_awk (QSE::StdAwk& awk)
if (awk.addArgument (QSE_T("awk05")) <= -1) return -1; if (awk.addArgument (QSE_T("awk05")) <= -1) return -1;
// ARGV[1] and/or the first console input file // ARGV[1] and/or the first console input file
if (awk.addArgument (QSE_T("awk05.cpp")) <= -1) return -1; if (awk.addArgument (QSE_T("Makefile")) <= -1) return -1;
const qse_char_t* script = QSE_T( const qse_char_t* script = QSE_T(
"BEGIN { print \">> PRINT ALL LINES WHOSE LENGTH IS GREATER THAN 0\"; }\n" "BEGIN { print \">> PRINT ALL LINES WHOSE LENGTH IS GREATER THAN 0\"; }\n"

View File

@ -81,7 +81,8 @@ int main ()
0, 0,
QSE_T("awk09"), QSE_T("awk09"),
QSE_NULL, /* stdin */ QSE_NULL, /* stdin */
output_files output_files,
QSE_NULL /* default cmgr */
); );
if (rtx == QSE_NULL) if (rtx == QSE_NULL)
{ {

View File

@ -83,7 +83,9 @@ int main ()
0, 0,
QSE_T("awk10"), QSE_T("awk10"),
QSE_NULL, /* stdin */ QSE_NULL, /* stdin */
QSE_NULL /* stdout */ QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
); );
if (rtx == QSE_NULL) if (rtx == QSE_NULL)
{ {