changed pio for changes in mbwc conversion functions
This commit is contained in:
@ -262,7 +262,8 @@ static void print_usage (QSE_FILE* out, const qse_char_t* argv0)
|
||||
qse_fprintf (out, QSE_T("Where options are:\n"));
|
||||
qse_fprintf (out, QSE_T(" -h print this message\n"));
|
||||
qse_fprintf (out, QSE_T(" -f sourcefile set the source script file\n"));
|
||||
qse_fprintf (out, QSE_T(" -o deparsedfile set the deparsing output file\n"));
|
||||
qse_fprintf (out, QSE_T(" -d deparsedfile set the deparsing output file\n"));
|
||||
qse_fprintf (out, QSE_T(" -o outputfile set the console output file\n"));
|
||||
qse_fprintf (out, QSE_T(" -F string set a field separator(FS)\n"));
|
||||
}
|
||||
|
||||
@ -271,6 +272,7 @@ struct cmdline_t
|
||||
qse_char_t* ins;
|
||||
qse_char_t* inf;
|
||||
qse_char_t* outf;
|
||||
qse_char_t* outc;
|
||||
qse_char_t* fs;
|
||||
};
|
||||
|
||||
@ -279,7 +281,7 @@ static int handle_cmdline (
|
||||
{
|
||||
static qse_opt_t opt =
|
||||
{
|
||||
QSE_T("hF:f:o:"),
|
||||
QSE_T("hF:f:d:o:"),
|
||||
QSE_NULL
|
||||
};
|
||||
qse_cint_t c;
|
||||
@ -301,10 +303,14 @@ static int handle_cmdline (
|
||||
cmdline->inf = opt.arg;
|
||||
break;
|
||||
|
||||
case QSE_T('o'):
|
||||
case QSE_T('d'):
|
||||
cmdline->outf = opt.arg;
|
||||
break;
|
||||
|
||||
case QSE_T('o'):
|
||||
cmdline->outc = opt.arg;
|
||||
break;
|
||||
|
||||
case QSE_T('?'):
|
||||
print_error (QSE_T("illegal option - '%c'\n"), opt.opt);
|
||||
return -1;
|
||||
@ -388,6 +394,15 @@ static int awk_main_2 (MyAwk& awk, int argc, qse_char_t* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (cmdline.outc)
|
||||
{
|
||||
if (awk.addConsoleOutput (cmdline.outc) <= -1)
|
||||
{
|
||||
print_error (awk);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
MyAwk::Value ret;
|
||||
if (awk.loop (&ret) <= -1)
|
||||
{
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
#define R(f) \
|
||||
do { \
|
||||
qse_sio_putstr (qse_sio_out,QSE_T("== ")); \
|
||||
qse_sio_putstr (qse_sio_out,QSE_T(#f)); \
|
||||
qse_sio_putstr (qse_sio_out,QSE_T(" ==\n")); \
|
||||
qse_printf (QSE_T("== ")); \
|
||||
qse_printf (QSE_T(#f)); \
|
||||
qse_printf (QSE_T(" ==\n")); \
|
||||
if (f() == -1) return -1; \
|
||||
} while (0)
|
||||
|
||||
@ -48,15 +48,15 @@ static int test1 (void)
|
||||
|
||||
if (sio == QSE_NULL)
|
||||
{
|
||||
qse_sio_putstr (qse_sio_err, QSE_T("cannot open file\n"));
|
||||
qse_printf (QSE_T("cannot open file\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < QSE_COUNTOF(x); i++)
|
||||
{
|
||||
qse_sio_putstr (qse_sio_out, QSE_T("written: ["));
|
||||
qse_sio_putstr (qse_sio_out, x[i]);
|
||||
qse_sio_putstr (qse_sio_out, QSE_T("]\n"));
|
||||
qse_printf (QSE_T("written: ["));
|
||||
qse_printf (x[i]);
|
||||
qse_printf (QSE_T("]\n"));
|
||||
|
||||
qse_sio_putstr (sio, x[i]);
|
||||
qse_sio_putc (sio, QSE_T('\n'));
|
||||
@ -136,9 +136,9 @@ int main ()
|
||||
{
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
qse_sio_putstr (qse_sio_out, QSE_T("--------------------------------------------------------------------------------\n"));
|
||||
qse_sio_putstr (qse_sio_out, QSE_T("Set the environment LANG to a Unicode locale such as UTF-8 if you see the illegal XXXXX errors. If you see such errors in Unicode locales, this program might be buggy. It is normal to see such messages in non-Unicode locales as it uses Unicode data\n"));
|
||||
qse_sio_putstr (qse_sio_out, QSE_T("--------------------------------------------------------------------------------\n"));
|
||||
qse_printf (QSE_T("--------------------------------------------------------------------------------\n"));
|
||||
qse_printf (QSE_T("Set the environment LANG to a Unicode locale such as UTF-8 if you see the illegal XXXXX errors. If you see such errors in Unicode locales, this program might be buggy. It is normal to see such messages in non-Unicode locales as it uses Unicode data\n"));
|
||||
qse_printf (QSE_T("--------------------------------------------------------------------------------\n"));
|
||||
|
||||
R (test1);
|
||||
R (test2);
|
||||
|
@ -53,11 +53,6 @@ static int test1 (void)
|
||||
((n == -3)? QSE_T("INCOMPLETE-SEQ"): (n == -2)? QSE_T("BUFFER-SMALL"): (n == -1)? QSE_T("ILLEGAL-CHAR"): QSE_T("FULL")),
|
||||
(int)wlen, (int)mlen, (int)wlen1, (int)mlen1, buf2);
|
||||
qse_fflush (QSE_STDOUT);
|
||||
|
||||
qse_sio_putwcs (QSE_SIO_OUT, QSE_T("<<"));
|
||||
qse_sio_putwcs (QSE_SIO_OUT, buf2);
|
||||
qse_sio_putwcs (QSE_SIO_OUT, QSE_T(">>\n"));
|
||||
qse_sio_flush (QSE_SIO_OUT);
|
||||
}
|
||||
|
||||
qse_printf (QSE_T("-----------------\n"));
|
||||
@ -76,10 +71,6 @@ static int test1 (void)
|
||||
(int)wlen, (int)mlen, (int)wlen, (int)wlen1, (int)mlen1, buf2);
|
||||
|
||||
qse_fflush (QSE_STDOUT);
|
||||
qse_sio_putwcs (QSE_SIO_OUT, QSE_T("<<"));
|
||||
qse_sio_putwcs (QSE_SIO_OUT, buf2);
|
||||
qse_sio_putwcs (QSE_SIO_OUT, QSE_T(">>\n"));
|
||||
qse_sio_flush (QSE_SIO_OUT);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user