changed sed03.cpp for the wide character mode
This commit is contained in:
parent
d851798b3c
commit
3148407114
@ -61,7 +61,7 @@ typedef struct qse_sed_t qse_sed_t;
|
|||||||
enum qse_sed_errnum_t
|
enum qse_sed_errnum_t
|
||||||
{
|
{
|
||||||
QSE_SED_ENOERR, /**< no error */
|
QSE_SED_ENOERR, /**< no error */
|
||||||
QSE_SED_ENOMEM, /**< out of memory */
|
QSE_SED_ENOMEM, /**< insufficient memory */
|
||||||
QSE_SED_ECMDNR, /**< command '${0}' not recognized */
|
QSE_SED_ECMDNR, /**< command '${0}' not recognized */
|
||||||
QSE_SED_ECMDMS, /**< command code missing */
|
QSE_SED_ECMDMS, /**< command code missing */
|
||||||
QSE_SED_ECMDIC, /**< command '${0}' incomplete */
|
QSE_SED_ECMDIC, /**< command '${0}' incomplete */
|
||||||
|
@ -44,7 +44,7 @@ static const qse_char_t* dflerrstr (qse_sed_t* sed, qse_sed_errnum_t errnum)
|
|||||||
static const qse_char_t* errstr[] =
|
static const qse_char_t* errstr[] =
|
||||||
{
|
{
|
||||||
QSE_T("no error"),
|
QSE_T("no error"),
|
||||||
QSE_T("out of memory"),
|
QSE_T("insufficient memory"),
|
||||||
QSE_T("command '${0}' not recognized"),
|
QSE_T("command '${0}' not recognized"),
|
||||||
QSE_T("command code missing"),
|
QSE_T("command code missing"),
|
||||||
QSE_T("command '${0}' incomplete"),
|
QSE_T("command '${0}' incomplete"),
|
||||||
|
@ -22,6 +22,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#ifdef QSE_CHAR_IS_MCHAR
|
||||||
|
# define xcout std::cout
|
||||||
|
#else
|
||||||
|
# define xcout std::wcout
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef std::basic_string<QSE::StdSed::char_t> xstring;
|
typedef std::basic_string<QSE::StdSed::char_t> xstring;
|
||||||
typedef QSE::StdSed StdSed; // added for doxygen cross-reference
|
typedef QSE::StdSed StdSed; // added for doxygen cross-reference
|
||||||
|
|
||||||
@ -108,11 +114,11 @@ int sed_main (int argc, qse_char_t* argv[])
|
|||||||
sed.run (
|
sed.run (
|
||||||
QSE_T("y/ABC/abc/;s/abc/def/g"),
|
QSE_T("y/ABC/abc/;s/abc/def/g"),
|
||||||
QSE_T("ABCDEFabcdef"), out);
|
QSE_T("ABCDEFabcdef"), out);
|
||||||
std::cout << QSE_T("OUTPUT: ") << out << std::endl;
|
xcout << QSE_T("OUTPUT: ") << out << std::endl;
|
||||||
}
|
}
|
||||||
catch (MySed::Error& err)
|
catch (MySed::Error& err)
|
||||||
{
|
{
|
||||||
std::cout << QSE_T("ERROR: ") << err.getMessage() << std::endl;
|
xcout << QSE_T("ERROR: ") << err.getMessage() << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user