fixed a bug in configure.ac and bugs in awk sample programs
This commit is contained in:
parent
d40eb87b85
commit
4bb71a765e
2
qse/configure
vendored
2
qse/configure
vendored
@ -20676,7 +20676,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
test "${HAVE_CXX}" = "yes" || enable_cxx_is="no"
|
test "${HAVE_CXX}" = "yes" || enable_cxx_is="no"
|
||||||
test "${HAVE_CXX_NAMESPACE_STD}" = "yes" || enable_cxx_is="no"
|
test "${ax_cv_cxx_have_std_namespace}" = "yes" || enable_cxx_is="no"
|
||||||
|
|
||||||
if test "${enable_cxx_is}" = "yes" ; then
|
if test "${enable_cxx_is}" = "yes" ; then
|
||||||
ENABLE_CXX_TRUE=
|
ENABLE_CXX_TRUE=
|
||||||
|
@ -578,9 +578,9 @@ AC_ARG_ENABLE([cxx],
|
|||||||
)
|
)
|
||||||
|
|
||||||
dnl disable c++ if no c++ compiler was found
|
dnl disable c++ if no c++ compiler was found
|
||||||
[test "${HAVE_CXX}" = "yes" || enable_cxx_is="no"]
|
test "${HAVE_CXX}" = "yes" || enable_cxx_is="no"
|
||||||
dnl disable c++ if the compiler is too old.
|
dnl disable c++ if the compiler is too old.
|
||||||
[test "${HAVE_CXX_NAMESPACE_STD}" = "yes" || enable_cxx_is="no"]
|
test "${ax_cv_cxx_have_std_namespace}" = "yes" || enable_cxx_is="no"
|
||||||
|
|
||||||
AM_CONDITIONAL(ENABLE_CXX, test "${enable_cxx_is}" = "yes" )
|
AM_CONDITIONAL(ENABLE_CXX, test "${enable_cxx_is}" = "yes" )
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#define _QSE_AWK_STDAWK_H_
|
#define _QSE_AWK_STDAWK_H_
|
||||||
|
|
||||||
#include <qse/awk/awk.h>
|
#include <qse/awk/awk.h>
|
||||||
#include <qse/cmn/sio.h>
|
|
||||||
|
|
||||||
/** \file
|
/** \file
|
||||||
* This file defines functions and data types that help you create
|
* This file defines functions and data types that help you create
|
||||||
|
@ -449,6 +449,7 @@ QSE_EXPORT qse_ssize_t qse_errputwcsvf (
|
|||||||
#define qse_vprintf qse_putstrvf
|
#define qse_vprintf qse_putstrvf
|
||||||
#define qse_fprintf qse_sio_putstrf
|
#define qse_fprintf qse_sio_putstrf
|
||||||
#define qse_vfprintf qse_sio_putstrvf
|
#define qse_vfprintf qse_sio_putstrvf
|
||||||
|
#define qse_fflush qse_sio_flush
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -31,8 +31,11 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#if defined(HAVE_QUADMATH_H)
|
#if defined(HAVE_QUADMATH_H)
|
||||||
|
extern "C" { // some gcc distros don't have extern "C" declared in the header file.
|
||||||
# include <quadmath.h>
|
# include <quadmath.h>
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
|
|
||||||
static const qse_char_t* script = QSE_T("BEGIN { print \"hello, world\"; }");
|
static const qse_char_t* script = QSE_T("BEGIN { print \"hello, world\"; }");
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include "awk00.h"
|
#include "awk00.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include "awk00.h"
|
#include "awk00.h"
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include "awk00.h"
|
#include "awk00.h"
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include "awk00.h"
|
#include "awk00.h"
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include "awk00.h"
|
#include "awk00.h"
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include "awk00.h"
|
#include "awk00.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/stdio.h>
|
|
||||||
#include "awk00.h"
|
#include "awk00.h"
|
||||||
|
|
||||||
static const qse_char_t* src = QSE_T(
|
static const qse_char_t* src = QSE_T(
|
||||||
@ -126,7 +126,11 @@ oops:
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
|
int x;
|
||||||
|
qse_openstdsios ();
|
||||||
init_awk_sample_locale ();
|
init_awk_sample_locale ();
|
||||||
return qse_runmain (argc, argv, awk_main);
|
x = qse_runmain (argc, argv, awk_main);
|
||||||
|
qse_closestdsios ();
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
#include <qse/cmn/path.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
|
||||||
#include "awk00.h"
|
#include "awk00.h"
|
||||||
|
|
||||||
static const qse_char_t* src = QSE_T(
|
static const qse_char_t* src = QSE_T(
|
||||||
@ -133,7 +133,11 @@ oops:
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
|
int x;
|
||||||
|
qse_openstdsios ();
|
||||||
init_awk_sample_locale ();
|
init_awk_sample_locale ();
|
||||||
return qse_runmain (argc, argv, awk_main);
|
x = qse_runmain (argc, argv, awk_main);
|
||||||
|
qse_closestdsios ();
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
#include <qse/cmn/path.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
|
||||||
#include "awk00.h"
|
#include "awk00.h"
|
||||||
|
|
||||||
static const qse_char_t* src = QSE_T(
|
static const qse_char_t* src = QSE_T(
|
||||||
@ -146,6 +146,10 @@ oops:
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
|
int x;
|
||||||
|
qse_openstdsios ();
|
||||||
init_awk_sample_locale ();
|
init_awk_sample_locale ();
|
||||||
return qse_runmain (argc, argv, awk_main);
|
x = qse_runmain (argc, argv, awk_main);
|
||||||
|
qse_closestdsios ();
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
|
|
||||||
const qse_char_t* src = QSE_T("BEGIN { print \"hello, world\" | \"dir\"; }");
|
const qse_char_t* src = QSE_T("BEGIN { print \"hello, world\" | \"dir\"; }");
|
||||||
|
|
||||||
@ -72,6 +72,8 @@ int main ()
|
|||||||
qse_awk_parsestd_t psin[2];
|
qse_awk_parsestd_t psin[2];
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
qse_openstdsios ();
|
||||||
|
|
||||||
awk = qse_awk_openstd (0);
|
awk = qse_awk_openstd (0);
|
||||||
if (awk == QSE_NULL)
|
if (awk == QSE_NULL)
|
||||||
{
|
{
|
||||||
@ -122,6 +124,8 @@ int main ()
|
|||||||
oops:
|
oops:
|
||||||
if (rtx != QSE_NULL) qse_awk_rtx_close (rtx);
|
if (rtx != QSE_NULL) qse_awk_rtx_close (rtx);
|
||||||
if (awk != QSE_NULL) qse_awk_close (awk);
|
if (awk != QSE_NULL) qse_awk_close (awk);
|
||||||
|
|
||||||
|
qse_closestdsios ();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
|
|
||||||
/* this sample produces 8 text files containing multiplication chart. */
|
/* this sample produces 8 text files containing multiplication chart. */
|
||||||
|
|
||||||
@ -25,17 +25,19 @@ int main ()
|
|||||||
|
|
||||||
const qse_char_t* output_files[] =
|
const qse_char_t* output_files[] =
|
||||||
{
|
{
|
||||||
QSE_T("awk09.out.2"),
|
QSE_T("awk12.out.2"),
|
||||||
QSE_T("awk09.out.3"),
|
QSE_T("awk12.out.3"),
|
||||||
QSE_T("awk09.out.4"),
|
QSE_T("awk12.out.4"),
|
||||||
QSE_T("awk09.out.5"),
|
QSE_T("awk12.out.5"),
|
||||||
QSE_T("awk09.out.6"),
|
QSE_T("awk12.out.6"),
|
||||||
QSE_T("awk09.out.7"),
|
QSE_T("awk12.out.7"),
|
||||||
QSE_T("awk09.out.8"),
|
QSE_T("awk12.out.8"),
|
||||||
QSE_T("awk09.out.9"),
|
QSE_T("awk12.out.9"),
|
||||||
QSE_NULL
|
QSE_NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
qse_openstdsios ();
|
||||||
|
|
||||||
awk = qse_awk_openstd (0);
|
awk = qse_awk_openstd (0);
|
||||||
if (awk == QSE_NULL)
|
if (awk == QSE_NULL)
|
||||||
{
|
{
|
||||||
@ -62,7 +64,7 @@ int main ()
|
|||||||
rtx = qse_awk_rtx_openstd (
|
rtx = qse_awk_rtx_openstd (
|
||||||
awk,
|
awk,
|
||||||
0,
|
0,
|
||||||
QSE_T("awk09"),
|
QSE_T("awk12"),
|
||||||
QSE_NULL, /* stdin */
|
QSE_NULL, /* stdin */
|
||||||
output_files,
|
output_files,
|
||||||
QSE_NULL /* default cmgr */
|
QSE_NULL /* default cmgr */
|
||||||
@ -88,6 +90,8 @@ int main ()
|
|||||||
oops:
|
oops:
|
||||||
if (rtx != QSE_NULL) qse_awk_rtx_close (rtx);
|
if (rtx != QSE_NULL) qse_awk_rtx_close (rtx);
|
||||||
if (awk != QSE_NULL) qse_awk_close (awk);
|
if (awk != QSE_NULL) qse_awk_close (awk);
|
||||||
|
|
||||||
|
qse_closestdsios ();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <qse/awk/awk.h>
|
#include <qse/awk/awk.h>
|
||||||
#include <qse/awk/stdawk.h>
|
#include <qse/awk/stdawk.h>
|
||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
|
|
||||||
static const qse_char_t* src = QSE_T(
|
static const qse_char_t* src = QSE_T(
|
||||||
"BEGIN {"
|
"BEGIN {"
|
||||||
@ -45,6 +45,8 @@ int main ()
|
|||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
qse_openstdsios ();
|
||||||
|
|
||||||
awk = qse_awk_openstd (0);
|
awk = qse_awk_openstd (0);
|
||||||
if (awk == QSE_NULL)
|
if (awk == QSE_NULL)
|
||||||
{
|
{
|
||||||
@ -104,6 +106,8 @@ int main ()
|
|||||||
oops:
|
oops:
|
||||||
if (rtx != QSE_NULL) qse_awk_rtx_close (rtx);
|
if (rtx != QSE_NULL) qse_awk_rtx_close (rtx);
|
||||||
if (awk != QSE_NULL) qse_awk_close (awk);
|
if (awk != QSE_NULL) qse_awk_close (awk);
|
||||||
|
|
||||||
|
qse_closestdsios ();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_WCHAR)
|
#if defined(QSE_CHAR_IS_WCHAR)
|
||||||
@ -117,6 +117,7 @@ int main (int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
MyAwk awk;
|
MyAwk awk;
|
||||||
|
|
||||||
|
qse_openstdsios ();
|
||||||
int ret = awk.open ();
|
int ret = awk.open ();
|
||||||
if (ret >= 0) ret = run_awk (awk);
|
if (ret >= 0) ret = run_awk (awk);
|
||||||
|
|
||||||
@ -127,6 +128,7 @@ int main (int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
awk.close ();
|
awk.close ();
|
||||||
|
qse_closestdsios ();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_WCHAR)
|
#if defined(QSE_CHAR_IS_WCHAR)
|
||||||
@ -170,6 +170,7 @@ int main (int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
MyAwk awk;
|
MyAwk awk;
|
||||||
|
|
||||||
|
qse_openstdsios ();
|
||||||
int ret = awk.open ();
|
int ret = awk.open ();
|
||||||
if (ret >= 0) ret = run_awk (awk);
|
if (ret >= 0) ret = run_awk (awk);
|
||||||
|
|
||||||
@ -180,6 +181,7 @@ int main (int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
awk.close ();
|
awk.close ();
|
||||||
|
qse_closestdsios ();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/mbwc.h>
|
#include <qse/cmn/mbwc.h>
|
||||||
|
|
||||||
@ -151,23 +151,32 @@ static int awk_main (int argc, qse_char_t* argv[])
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
int x;
|
||||||
char locale[100];
|
|
||||||
UINT codepage = GetConsoleOutputCP();
|
qse_openstdsios ();
|
||||||
if (codepage == CP_UTF8)
|
|
||||||
{
|
{
|
||||||
/*SetConsoleOUtputCP (CP_UTF8);*/
|
#if defined(_WIN32)
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
char locale[100];
|
||||||
}
|
UINT codepage = GetConsoleOutputCP();
|
||||||
else
|
if (codepage == CP_UTF8)
|
||||||
{
|
{
|
||||||
sprintf (locale, ".%u", (unsigned int)codepage);
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
setlocale (LC_ALL, locale);
|
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
setlocale (LC_ALL, "");
|
x = qse_runmain (argc,argv,awk_main);
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
qse_closestdsios ();
|
||||||
#endif
|
return x;
|
||||||
return qse_runmain (argc,argv,awk_main);
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <qse/cmn/opt.h>
|
#include <qse/cmn/opt.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/mbwc.h>
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
@ -84,7 +84,7 @@ public:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
long_t x = args[0].toInt();
|
Awk::int_t x = args[0].toInt();
|
||||||
|
|
||||||
/*Value arg;
|
/*Value arg;
|
||||||
if (run.getGlobal(idLastSleep, arg) == 0)
|
if (run.getGlobal(idLastSleep, arg) == 0)
|
||||||
@ -263,7 +263,7 @@ static void unset_signal (void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_usage (QSE_FILE* out, const qse_char_t* argv0)
|
static void print_usage (qse_sio_t* out, const qse_char_t* argv0)
|
||||||
{
|
{
|
||||||
qse_fprintf (out, QSE_T("USAGE: %s [options] -f sourcefile [ -- ] [datafile]*\n"), argv0);
|
qse_fprintf (out, QSE_T("USAGE: %s [options] -f sourcefile [ -- ] [datafile]*\n"), argv0);
|
||||||
qse_fprintf (out, QSE_T(" %s [options] [ -- ] sourcestring [datafile]*\n"), argv0);
|
qse_fprintf (out, QSE_T(" %s [options] [ -- ] sourcestring [datafile]*\n"), argv0);
|
||||||
@ -444,40 +444,45 @@ int qse_main (int argc, qse_achar_t* argv[])
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
qse_openstdsios ();
|
||||||
char locale[100];
|
|
||||||
UINT codepage;
|
|
||||||
WSADATA wsadata;
|
|
||||||
|
|
||||||
codepage = GetConsoleOutputCP();
|
|
||||||
if (codepage == CP_UTF8)
|
|
||||||
{
|
{
|
||||||
/*SetConsoleOUtputCP (CP_UTF8);*/
|
#if defined(_WIN32)
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
char locale[100];
|
||||||
}
|
UINT codepage;
|
||||||
else
|
WSADATA wsadata;
|
||||||
{
|
|
||||||
sprintf (locale, ".%u", (unsigned int)codepage);
|
codepage = GetConsoleOutputCP();
|
||||||
setlocale (LC_ALL, locale);
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WSAStartup (MAKEWORD(2,0), &wsadata) != 0)
|
||||||
|
{
|
||||||
|
print_error (QSE_T("Failed to start up winsock\n"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WSAStartup (MAKEWORD(2,0), &wsadata) != 0)
|
|
||||||
{
|
|
||||||
print_error (QSE_T("Failed to start up winsock\n"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
setlocale (LC_ALL, "");
|
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = qse_runmain (argc, argv, awk_main);
|
ret = qse_runmain (argc, argv, awk_main);
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
WSACleanup ();
|
WSACleanup ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
qse_closestdsios ();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/mbwc.h>
|
#include <qse/cmn/mbwc.h>
|
||||||
|
|
||||||
@ -82,24 +82,31 @@ static int awk_main (int argc, qse_char_t* argv[])
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
int x;
|
||||||
char locale[100];
|
|
||||||
UINT codepage = GetConsoleOutputCP();
|
|
||||||
if (codepage == CP_UTF8)
|
|
||||||
{
|
|
||||||
/*SetConsoleOUtputCP (CP_UTF8);*/
|
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf (locale, ".%u", (unsigned int)codepage);
|
|
||||||
setlocale (LC_ALL, locale);
|
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
setlocale (LC_ALL, "");
|
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return qse_runmain (argc,argv,awk_main);
|
qse_openstdsios ();
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
x = qse_runmain (argc,argv,awk_main);
|
||||||
|
qse_closestdsios ();
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/mbwc.h>
|
#include <qse/cmn/mbwc.h>
|
||||||
|
|
||||||
@ -109,23 +109,32 @@ static int awk_main (int argc, qse_char_t* argv[])
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
int x;
|
||||||
char locale[100];
|
|
||||||
UINT codepage = GetConsoleOutputCP();
|
qse_openstdsios ();
|
||||||
if (codepage == CP_UTF8)
|
|
||||||
{
|
{
|
||||||
/*SetConsoleOUtputCP (CP_UTF8);*/
|
#if defined(_WIN32)
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
char locale[100];
|
||||||
}
|
UINT codepage = GetConsoleOutputCP();
|
||||||
else
|
if (codepage == CP_UTF8)
|
||||||
{
|
{
|
||||||
sprintf (locale, ".%u", (unsigned int)codepage);
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
setlocale (LC_ALL, locale);
|
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
setlocale (LC_ALL, "");
|
x = qse_runmain (argc,argv,awk_main);
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
qse_closestdsios ();
|
||||||
#endif
|
return x;
|
||||||
return qse_runmain (argc,argv,awk_main);
|
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/mbwc.h>
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
||||||
@ -95,7 +95,7 @@ protected:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t read (StdAwk::Console& io, StdAwk::char_t* data, size_t size)
|
StdAwk::ssize_t read (StdAwk::Console& io, StdAwk::char_t* data, size_t size)
|
||||||
{
|
{
|
||||||
if (this->inptr >= this->inend) return 0; // EOF
|
if (this->inptr >= this->inend) return 0; // EOF
|
||||||
size_t x = qse_strxncpy (data, size, inptr, inend - inptr);
|
size_t x = qse_strxncpy (data, size, inptr, inend - inptr);
|
||||||
@ -103,7 +103,7 @@ protected:
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t write (StdAwk::Console& io, const StdAwk::char_t* data, size_t size)
|
StdAwk::ssize_t write (StdAwk::Console& io, const StdAwk::char_t* data, size_t size)
|
||||||
{
|
{
|
||||||
try { this->output.append (data, size); }
|
try { this->output.append (data, size); }
|
||||||
catch (...)
|
catch (...)
|
||||||
@ -217,24 +217,31 @@ static int awk_main (int argc, qse_char_t* argv[])
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
int x;
|
||||||
char locale[100];
|
qse_openstdsios ();
|
||||||
UINT codepage = GetConsoleOutputCP();
|
|
||||||
if (codepage == CP_UTF8)
|
|
||||||
{
|
|
||||||
/*SetConsoleOUtputCP (CP_UTF8);*/
|
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf (locale, ".%u", (unsigned int)codepage);
|
|
||||||
setlocale (LC_ALL, locale);
|
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
setlocale (LC_ALL, "");
|
|
||||||
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return qse_runmain (argc,argv,awk_main);
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
x = qse_runmain (argc,argv,awk_main);
|
||||||
|
qse_closestdsios ();
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user