separated slmb from mbwc
This commit is contained in:
parent
dd02292cc4
commit
42431d2642
@ -27,12 +27,15 @@
|
|||||||
#include <qse/cmn/path.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/xma.h>
|
#include <qse/cmn/xma.h>
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#define ENABLE_CALLBACK
|
#define ENABLE_CALLBACK
|
||||||
#define ABORT(label) goto label
|
#define ABORT(label) goto label
|
||||||
@ -1008,6 +1011,24 @@ oops:
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc, argv, awk_main);
|
return qse_runmain (argc, argv, awk_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@
|
|||||||
#include <qse/cmn/fs.h>
|
#include <qse/cmn/fs.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
@ -815,5 +818,23 @@ oops:
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc, argv, sed_main);
|
return qse_runmain (argc, argv, sed_main);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ pkginclude_HEADERS = \
|
|||||||
rex.h \
|
rex.h \
|
||||||
sio.h \
|
sio.h \
|
||||||
sll.h \
|
sll.h \
|
||||||
|
slmb.h \
|
||||||
stdio.h \
|
stdio.h \
|
||||||
str.h \
|
str.h \
|
||||||
time.h \
|
time.h \
|
||||||
|
@ -53,8 +53,9 @@ SOURCES =
|
|||||||
DIST_SOURCES =
|
DIST_SOURCES =
|
||||||
am__pkginclude_HEADERS_DIST = alg.h chr.h dll.h env.h fio.h fma.h \
|
am__pkginclude_HEADERS_DIST = alg.h chr.h dll.h env.h fio.h fma.h \
|
||||||
fmt.h fs.h gdl.h htb.h lda.h main.h map.h mbwc.h mem.h oht.h \
|
fmt.h fs.h gdl.h htb.h lda.h main.h map.h mbwc.h mem.h oht.h \
|
||||||
opt.h path.h pio.h pma.h rbt.h rex.h sio.h sll.h stdio.h str.h \
|
opt.h path.h pio.h pma.h rbt.h rex.h sio.h sll.h slmb.h \
|
||||||
time.h tio.h tre.h utf8.h xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
|
stdio.h str.h time.h tio.h tre.h utf8.h xma.h Mmgr.hpp \
|
||||||
|
StdMmgr.hpp Mmged.hpp
|
||||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||||
am__vpath_adj = case $$p in \
|
am__vpath_adj = case $$p in \
|
||||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||||
@ -225,8 +226,8 @@ top_builddir = @top_builddir@
|
|||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
pkginclude_HEADERS = alg.h chr.h dll.h env.h fio.h fma.h fmt.h fs.h \
|
pkginclude_HEADERS = alg.h chr.h dll.h env.h fio.h fma.h fmt.h fs.h \
|
||||||
gdl.h htb.h lda.h main.h map.h mbwc.h mem.h oht.h opt.h path.h \
|
gdl.h htb.h lda.h main.h map.h mbwc.h mem.h oht.h opt.h path.h \
|
||||||
pio.h pma.h rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h \
|
pio.h pma.h rbt.h rex.h sio.h sll.h slmb.h stdio.h str.h \
|
||||||
tre.h utf8.h xma.h $(am__append_1)
|
time.h tio.h tre.h utf8.h xma.h $(am__append_1)
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
@ -24,26 +24,12 @@
|
|||||||
#include <qse/types.h>
|
#include <qse/types.h>
|
||||||
#include <qse/macros.h>
|
#include <qse/macros.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* The qse_mbstate_t type defines a structure large enough to hold
|
|
||||||
* the standard mbstate_t.
|
|
||||||
*/
|
|
||||||
typedef struct qse_mbstate_t qse_mbstate_t;
|
|
||||||
struct qse_mbstate_t
|
|
||||||
{
|
|
||||||
#if defined(QSE_SIZEOF_MBSTATE_T) && (QSE_SIZEOF_MBSTATE_T > 0)
|
|
||||||
char dummy[QSE_SIZEOF_MBSTATE_T];
|
|
||||||
#else
|
|
||||||
char dummy[1];
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern qse_cmgr_t* qse_utf8cmgr;
|
extern qse_cmgr_t* qse_utf8cmgr;
|
||||||
extern qse_cmgr_t* qse_loccmgr;
|
extern qse_cmgr_t* qse_slmbcmgr;
|
||||||
|
|
||||||
qse_cmgr_t* qse_getdflcmgr (
|
qse_cmgr_t* qse_getdflcmgr (
|
||||||
void
|
void
|
||||||
@ -54,81 +40,6 @@ void qse_setdflcmgr (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------- */
|
|
||||||
/* CHARACTER CONVERSION */
|
|
||||||
/* --------------------------------------------------- */
|
|
||||||
|
|
||||||
qse_size_t qse_mbrlen (
|
|
||||||
const qse_mchar_t* mb,
|
|
||||||
qse_size_t mblen,
|
|
||||||
qse_mbstate_t* state
|
|
||||||
);
|
|
||||||
|
|
||||||
qse_size_t qse_mbrtowc (
|
|
||||||
const qse_mchar_t* mb,
|
|
||||||
qse_size_t mblen,
|
|
||||||
qse_wchar_t* wc,
|
|
||||||
qse_mbstate_t* state
|
|
||||||
);
|
|
||||||
|
|
||||||
qse_size_t qse_wcrtomb (
|
|
||||||
qse_wchar_t wc,
|
|
||||||
qse_mchar_t* mb,
|
|
||||||
qse_size_t mblen,
|
|
||||||
qse_mbstate_t* state
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The qse_mblen() function scans a multibyte sequence to get the number of
|
|
||||||
* bytes needed to form a wide character. It does not scan more than @a mblen
|
|
||||||
* bytes.
|
|
||||||
* @return number of bytes processed on success,
|
|
||||||
* 0 for invalid sequences,
|
|
||||||
* mblen + 1 for incomplete sequences
|
|
||||||
* @note This function can not handle conversion producing non-initial
|
|
||||||
* states. For each call, it assumes initial state.
|
|
||||||
*/
|
|
||||||
qse_size_t qse_mblen (
|
|
||||||
const qse_mchar_t* mb,
|
|
||||||
qse_size_t mblen
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The qse_mbtowc() function converts a multibyte sequence to a wide character.
|
|
||||||
* It returns 0 if an invalid multibyte sequence is detected, mblen + 1 if the
|
|
||||||
* sequence is incomplete. It returns the number of bytes processed to form a
|
|
||||||
* wide character.
|
|
||||||
* @note This function can not handle conversion producing non-initial
|
|
||||||
* states. For each call, it assumes initial state.
|
|
||||||
*/
|
|
||||||
qse_size_t qse_mbtowc (
|
|
||||||
const qse_mchar_t* mb,
|
|
||||||
qse_size_t mblen,
|
|
||||||
qse_wchar_t* wc
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The qse_wctomb() function converts a wide character to a multibyte sequence.
|
|
||||||
* It returns 0 if the wide character is illegal, mblen + 1 if mblen is not
|
|
||||||
* large enough to hold the multibyte sequence. On successful conversion, it
|
|
||||||
* returns the number of bytes in the sequence.
|
|
||||||
* @note This function can not handle conversion producing non-initial
|
|
||||||
* states. For each call, it assumes initial state.
|
|
||||||
*/
|
|
||||||
qse_size_t qse_wctomb (
|
|
||||||
qse_wchar_t wc,
|
|
||||||
qse_mchar_t* mb,
|
|
||||||
qse_size_t mblen
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The qse_getmbcurmax() function returns the value of MB_CUR_MAX.
|
|
||||||
* Note that QSE_MBLEN_MAX defines MB_LEN_MAX.
|
|
||||||
*/
|
|
||||||
int qse_getmbcurmax (
|
|
||||||
void
|
|
||||||
);
|
|
||||||
|
|
||||||
/* --------------------------------------------------- */
|
/* --------------------------------------------------- */
|
||||||
/* STRING CONVERSION USING CMGR */
|
/* STRING CONVERSION USING CMGR */
|
||||||
/* --------------------------------------------------- */
|
/* --------------------------------------------------- */
|
||||||
|
126
qse/include/qse/cmn/slmb.h
Normal file
126
qse/include/qse/cmn/slmb.h
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||||
|
This file is part of QSE.
|
||||||
|
|
||||||
|
QSE is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
QSE is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _QSE_CMN_SLMB_H_
|
||||||
|
#define _QSE_CMN_SLMB_H_
|
||||||
|
|
||||||
|
#include <qse/types.h>
|
||||||
|
#include <qse/macros.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_mbstate_t type defines a structure large enough to hold
|
||||||
|
* the standard mbstate_t.
|
||||||
|
*/
|
||||||
|
typedef struct qse_mbstate_t qse_mbstate_t;
|
||||||
|
struct qse_mbstate_t
|
||||||
|
{
|
||||||
|
#if defined(QSE_SIZEOF_MBSTATE_T) && (QSE_SIZEOF_MBSTATE_T > 0)
|
||||||
|
char dummy[QSE_SIZEOF_MBSTATE_T];
|
||||||
|
#else
|
||||||
|
char dummy[1];
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/* --------------------------------------------------- */
|
||||||
|
/* SYSTEM LOCALE BASED CHARACTER CONVERSION */
|
||||||
|
/* --------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qse_size_t qse_slmbrlen (
|
||||||
|
const qse_mchar_t* mb,
|
||||||
|
qse_size_t mblen,
|
||||||
|
qse_mbstate_t* state
|
||||||
|
);
|
||||||
|
|
||||||
|
qse_size_t qse_slmbrtoslwc (
|
||||||
|
const qse_mchar_t* mb,
|
||||||
|
qse_size_t mblen,
|
||||||
|
qse_wchar_t* wc,
|
||||||
|
qse_mbstate_t* state
|
||||||
|
);
|
||||||
|
|
||||||
|
qse_size_t qse_slwcrtoslmb (
|
||||||
|
qse_wchar_t wc,
|
||||||
|
qse_mchar_t* mb,
|
||||||
|
qse_size_t mblen,
|
||||||
|
qse_mbstate_t* state
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_slmbtoslwc() function converts a multibyte sequence to a wide character.
|
||||||
|
* It returns 0 if an invalid multibyte sequence is detected, mblen + 1 if the
|
||||||
|
* sequence is incomplete. It returns the number of bytes processed to form a
|
||||||
|
* wide character.
|
||||||
|
* @note This function can not handle conversion producing non-initial
|
||||||
|
* states. For each call, it assumes initial state.
|
||||||
|
*/
|
||||||
|
qse_size_t qse_slmbtoslwc (
|
||||||
|
const qse_mchar_t* mb,
|
||||||
|
qse_size_t mblen,
|
||||||
|
qse_wchar_t* wc
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_slwctoslmb() function converts a wide character to a multibyte sequence.
|
||||||
|
* It returns 0 if the wide character is illegal, mblen + 1 if mblen is not
|
||||||
|
* large enough to hold the multibyte sequence. On successful conversion, it
|
||||||
|
* returns the number of bytes in the sequence.
|
||||||
|
* @note This function can not handle conversion producing non-initial
|
||||||
|
* states. For each call, it assumes initial state.
|
||||||
|
*/
|
||||||
|
qse_size_t qse_slwctoslmb (
|
||||||
|
qse_wchar_t wc,
|
||||||
|
qse_mchar_t* mb,
|
||||||
|
qse_size_t mblen
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_slmblen() function scans a multibyte sequence to get the number of
|
||||||
|
* bytes needed to form a wide character. It does not scan more than @a mblen
|
||||||
|
* bytes.
|
||||||
|
* @return number of bytes processed on success,
|
||||||
|
* 0 for invalid sequences,
|
||||||
|
* mblen + 1 for incomplete sequences
|
||||||
|
* @note This function can not handle conversion producing non-initial
|
||||||
|
* states. For each call, it assumes initial state.
|
||||||
|
*/
|
||||||
|
qse_size_t qse_slmblen (
|
||||||
|
const qse_mchar_t* mb,
|
||||||
|
qse_size_t mblen
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_slmblenmax() function returns the value of MB_CUR_MAX.
|
||||||
|
* Note that QSE_MBLEN_MAX defines MB_LEN_MAX.
|
||||||
|
*/
|
||||||
|
int qse_slmblenmax (
|
||||||
|
void
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -38,7 +38,6 @@ libqsecmn_la_SOURCES = \
|
|||||||
fs-move.c \
|
fs-move.c \
|
||||||
main.c \
|
main.c \
|
||||||
mbwc.c \
|
mbwc.c \
|
||||||
mbwc-chr.c \
|
|
||||||
mbwc-str.c \
|
mbwc-str.c \
|
||||||
mem.c \
|
mem.c \
|
||||||
oht.c \
|
oht.c \
|
||||||
@ -51,6 +50,7 @@ libqsecmn_la_SOURCES = \
|
|||||||
rex.c \
|
rex.c \
|
||||||
sio.c \
|
sio.c \
|
||||||
sll.c \
|
sll.c \
|
||||||
|
slmb.c \
|
||||||
stdio.c \
|
stdio.c \
|
||||||
str-beg.c \
|
str-beg.c \
|
||||||
str-cat.c \
|
str-cat.c \
|
||||||
|
@ -78,9 +78,9 @@ libqsecmn_la_DEPENDENCIES =
|
|||||||
am_libqsecmn_la_OBJECTS = alg-rand.lo alg-search.lo alg-sort.lo \
|
am_libqsecmn_la_OBJECTS = alg-rand.lo alg-search.lo alg-sort.lo \
|
||||||
assert.lo chr.lo dll.lo env.lo gdl.lo htb.lo lda.lo fio.lo \
|
assert.lo chr.lo dll.lo env.lo gdl.lo htb.lo lda.lo fio.lo \
|
||||||
fma.lo fmt.lo fs.lo fs-err.lo fs-move.lo main.lo mbwc.lo \
|
fma.lo fmt.lo fs.lo fs-err.lo fs-move.lo main.lo mbwc.lo \
|
||||||
mbwc-chr.lo mbwc-str.lo mem.lo oht.lo opt.lo path-basename.lo \
|
mbwc-str.lo mem.lo oht.lo opt.lo path-basename.lo \
|
||||||
path-canon.lo pio.lo pma.lo rbt.lo rex.lo sio.lo sll.lo \
|
path-canon.lo pio.lo pma.lo rbt.lo rex.lo sio.lo sll.lo \
|
||||||
stdio.lo str-beg.lo str-cat.lo str-chr.lo str-cnv.lo \
|
slmb.lo stdio.lo str-beg.lo str-cat.lo str-chr.lo str-cnv.lo \
|
||||||
str-cmp.lo str-cpy.lo str-del.lo str-dup.lo str-dynm.lo \
|
str-cmp.lo str-cpy.lo str-del.lo str-dup.lo str-dynm.lo \
|
||||||
str-dynw.lo str-end.lo str-excl.lo str-fcpy.lo str-fnmat.lo \
|
str-dynw.lo str-end.lo str-excl.lo str-fcpy.lo str-fnmat.lo \
|
||||||
str-incl.lo str-len.lo str-pac.lo str-pbrk.lo str-put.lo \
|
str-incl.lo str-len.lo str-pac.lo str-pbrk.lo str-put.lo \
|
||||||
@ -308,7 +308,6 @@ libqsecmn_la_SOURCES = \
|
|||||||
fs-move.c \
|
fs-move.c \
|
||||||
main.c \
|
main.c \
|
||||||
mbwc.c \
|
mbwc.c \
|
||||||
mbwc-chr.c \
|
|
||||||
mbwc-str.c \
|
mbwc-str.c \
|
||||||
mem.c \
|
mem.c \
|
||||||
oht.c \
|
oht.c \
|
||||||
@ -321,6 +320,7 @@ libqsecmn_la_SOURCES = \
|
|||||||
rex.c \
|
rex.c \
|
||||||
sio.c \
|
sio.c \
|
||||||
sll.c \
|
sll.c \
|
||||||
|
slmb.c \
|
||||||
stdio.c \
|
stdio.c \
|
||||||
str-beg.c \
|
str-beg.c \
|
||||||
str-cat.c \
|
str-cat.c \
|
||||||
@ -466,7 +466,6 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htb.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htb.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lda.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lda.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbwc-chr.Plo@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbwc-str.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbwc-str.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbwc.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbwc.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
|
||||||
@ -480,6 +479,7 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rex.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rex.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sll.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sll.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slmb.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdio.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdio.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str-beg.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str-beg.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str-cat.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str-cat.Plo@am__quote@
|
||||||
|
@ -352,9 +352,9 @@ int qse_env_insertm (
|
|||||||
qse_wchar_t* namedup, * valuedup;
|
qse_wchar_t* namedup, * valuedup;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
namedup = qse_mbstowcsdup (name, env->mmgr);
|
namedup = qse_mbstowcsdup (name, env->mmgr); /* TODO: ignroe mbwcerr */
|
||||||
if (namedup == QSE_NULL) return -1;
|
if (namedup == QSE_NULL) return -1;
|
||||||
valuedup = qse_mbstowcsdup (value, env->mmgr);
|
valuedup = qse_mbstowcsdup (value, env->mmgr); /* TODO: ignroe mbwcerr */
|
||||||
if (valuedup == QSE_NULL)
|
if (valuedup == QSE_NULL)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (env->mmgr, namedup);
|
QSE_MMGR_FREE (env->mmgr, namedup);
|
||||||
@ -398,7 +398,7 @@ int qse_env_deletem (qse_env_t* env, const qse_mchar_t* name)
|
|||||||
qse_wchar_t* namedup;
|
qse_wchar_t* namedup;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
namedup = qse_mbstowcsdup (name, env->mmgr);
|
namedup = qse_mbstowcsdup (name, env->mmgr); /* TODO: ignroe mbwcerr */
|
||||||
if (namedup == QSE_NULL) return -1;
|
if (namedup == QSE_NULL) return -1;
|
||||||
|
|
||||||
n = deletew (env, namedup);
|
n = deletew (env, namedup);
|
||||||
@ -466,7 +466,7 @@ static qse_wchar_t* get_env (qse_env_t* env, const qse_wchar_t* name, int* free)
|
|||||||
qse_wchar_t* dup;
|
qse_wchar_t* dup;
|
||||||
qse_wchar_t* eq;
|
qse_wchar_t* eq;
|
||||||
|
|
||||||
dup = qse_mbstowcsdup (*p, env->mmgr);
|
dup = qse_mbstowcsdup (*p, env->mmgr); /* TODO: ignroe mbwcerr */
|
||||||
if (dup == QSE_NULL) return QSE_NULL;
|
if (dup == QSE_NULL) return QSE_NULL;
|
||||||
|
|
||||||
eq = qse_wcsbeg (dup, name);
|
eq = qse_wcsbeg (dup, name);
|
||||||
@ -544,7 +544,7 @@ int qse_env_insertsysm (qse_env_t* env, const qse_mchar_t* name)
|
|||||||
qse_wchar_t* namedup;
|
qse_wchar_t* namedup;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
namedup = qse_mbstowcsdup (name, env->mmgr);
|
namedup = qse_mbstowcsdup (name, env->mmgr); /* TODO: ignroe mbwcerr */
|
||||||
if (namedup)
|
if (namedup)
|
||||||
{
|
{
|
||||||
ret = qse_env_insertsysw (env, namedup);
|
ret = qse_env_insertsysw (env, namedup);
|
||||||
@ -627,7 +627,7 @@ done:
|
|||||||
qse_wchar_t* dup;
|
qse_wchar_t* dup;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
dup = qse_mbstowcsdup (*p, env->mmgr);
|
dup = qse_mbstowcsdup (*p, env->mmgr); /* TODO: ignroe mbwcerr */
|
||||||
if (dup == QSE_NULL) return -1;
|
if (dup == QSE_NULL) return -1;
|
||||||
n = add_envstrw (env, dup);
|
n = add_envstrw (env, dup);
|
||||||
QSE_MMGR_FREE (env->mmgr, dup);
|
QSE_MMGR_FREE (env->mmgr, dup);
|
||||||
|
@ -20,15 +20,11 @@
|
|||||||
|
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
||||||
#include <locale.h>
|
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
int qse_runmain (
|
int qse_runmain (
|
||||||
int argc, qse_achar_t* argv[], qse_runmain_handler_t handler)
|
int argc, qse_achar_t* argv[], qse_runmain_handler_t handler)
|
||||||
{
|
{
|
||||||
/* TODO: remove dependency on setlocale */
|
|
||||||
setlocale (LC_ALL, "");
|
|
||||||
|
|
||||||
#if (defined(QSE_ACHAR_IS_MCHAR) && defined(QSE_CHAR_IS_MCHAR)) || \
|
#if (defined(QSE_ACHAR_IS_MCHAR) && defined(QSE_CHAR_IS_MCHAR)) || \
|
||||||
(defined(QSE_ACHAR_IS_WCHAR) && defined(QSE_CHAR_IS_WCHAR))
|
(defined(QSE_ACHAR_IS_WCHAR) && defined(QSE_CHAR_IS_WCHAR))
|
||||||
{
|
{
|
||||||
@ -75,8 +71,6 @@ int qse_runmainwithenv (
|
|||||||
int argc, qse_achar_t* argv[],
|
int argc, qse_achar_t* argv[],
|
||||||
qse_achar_t* envp[], qse_runmainwithenv_handler_t handler)
|
qse_achar_t* envp[], qse_runmainwithenv_handler_t handler)
|
||||||
{
|
{
|
||||||
setlocale (LC_ALL, ""); /* TODO: remove dependency on setlocale */
|
|
||||||
|
|
||||||
#if (defined(QSE_ACHAR_IS_MCHAR) && defined(QSE_CHAR_IS_MCHAR)) || \
|
#if (defined(QSE_ACHAR_IS_MCHAR) && defined(QSE_CHAR_IS_MCHAR)) || \
|
||||||
(defined(QSE_ACHAR_IS_WCHAR) && defined(QSE_CHAR_IS_WCHAR))
|
(defined(QSE_ACHAR_IS_WCHAR) && defined(QSE_CHAR_IS_WCHAR))
|
||||||
{
|
{
|
||||||
|
@ -19,13 +19,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/cmn/mbwc.h>
|
#include <qse/cmn/mbwc.h>
|
||||||
|
#include <qse/cmn/slmb.h>
|
||||||
#include <qse/cmn/utf8.h>
|
#include <qse/cmn/utf8.h>
|
||||||
|
|
||||||
|
/* TODO: there is no guarantee that slwc is a unicode charater or vice versa.
|
||||||
|
* the ctype handling functions should be made wide-character
|
||||||
|
* dependent.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* TODO: binary cmgr -> simply expands a byte to wchar and vice versa. */
|
||||||
|
|
||||||
static qse_cmgr_t builtin_cmgr[] =
|
static qse_cmgr_t builtin_cmgr[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
qse_mbtowc,
|
qse_slmbtoslwc,
|
||||||
qse_wctomb
|
qse_slwctoslmb
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -34,7 +42,7 @@ static qse_cmgr_t builtin_cmgr[] =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
qse_cmgr_t* qse_loccmgr = &builtin_cmgr[0];
|
qse_cmgr_t* qse_slmbcmgr = &builtin_cmgr[0];
|
||||||
qse_cmgr_t* qse_utf8cmgr = &builtin_cmgr[1];
|
qse_cmgr_t* qse_utf8cmgr = &builtin_cmgr[1];
|
||||||
|
|
||||||
static qse_cmgr_t* dfl_cmgr = &builtin_cmgr[0];
|
static qse_cmgr_t* dfl_cmgr = &builtin_cmgr[0];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: chr-cnv.c 556 2011-08-31 15:43:46Z hyunghwan.chung $
|
* $Id$
|
||||||
*
|
*
|
||||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||||
This file is part of QSE.
|
This file is part of QSE.
|
||||||
@ -18,8 +18,7 @@
|
|||||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/cmn/mbwc.h>
|
#include <qse/cmn/slmb.h>
|
||||||
#include <qse/cmn/utf8.h>
|
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
#if !defined(QSE_HAVE_CONFIG_H)
|
#if !defined(QSE_HAVE_CONFIG_H)
|
||||||
@ -39,7 +38,7 @@
|
|||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qse_size_t qse_mbrlen (
|
qse_size_t qse_slmbrlen (
|
||||||
const qse_mchar_t* mb, qse_size_t mbl, qse_mbstate_t* state)
|
const qse_mchar_t* mb, qse_size_t mbl, qse_mbstate_t* state)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_MBRLEN)
|
#if defined(HAVE_MBRLEN)
|
||||||
@ -64,7 +63,7 @@ qse_size_t qse_mbrlen (
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_size_t qse_mbrtowc (
|
qse_size_t qse_slmbrtoslwc (
|
||||||
const qse_mchar_t* mb, qse_size_t mbl,
|
const qse_mchar_t* mb, qse_size_t mbl,
|
||||||
qse_wchar_t* wc, qse_mbstate_t* state)
|
qse_wchar_t* wc, qse_mbstate_t* state)
|
||||||
{
|
{
|
||||||
@ -86,7 +85,7 @@ qse_size_t qse_mbrtowc (
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_size_t qse_wcrtomb (
|
qse_size_t qse_slwcrtoslmb (
|
||||||
qse_wchar_t wc, qse_mchar_t* mb,
|
qse_wchar_t wc, qse_mchar_t* mb,
|
||||||
qse_size_t mbl, qse_mbstate_t* state)
|
qse_size_t mbl, qse_mbstate_t* state)
|
||||||
{
|
{
|
||||||
@ -132,26 +131,25 @@ qse_size_t qse_wcrtomb (
|
|||||||
* mbrtowc(3) do produce non-initial states when interrupted in the middle
|
* mbrtowc(3) do produce non-initial states when interrupted in the middle
|
||||||
* of a character.
|
* of a character.
|
||||||
*/
|
*/
|
||||||
qse_size_t qse_mblen (const qse_mchar_t* mb, qse_size_t mbl)
|
qse_size_t qse_slmblen (const qse_mchar_t* mb, qse_size_t mbl)
|
||||||
{
|
{
|
||||||
qse_mbstate_t state = { { 0, } };
|
qse_mbstate_t state = { { 0, } };
|
||||||
return qse_mbrlen (mb, mbl, &state);
|
return qse_slmbrlen (mb, mbl, &state);
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_size_t qse_mbtowc (const qse_mchar_t* mb, qse_size_t mbl, qse_wchar_t* wc)
|
qse_size_t qse_slmbtoslwc (const qse_mchar_t* mb, qse_size_t mbl, qse_wchar_t* wc)
|
||||||
{
|
{
|
||||||
qse_mbstate_t state = { { 0, } };
|
qse_mbstate_t state = { { 0, } };
|
||||||
return qse_mbrtowc (mb, mbl, wc, &state);
|
return qse_slmbrtoslwc (mb, mbl, wc, &state);
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_size_t qse_wctomb (qse_wchar_t wc, qse_mchar_t* mb, qse_size_t mbl)
|
qse_size_t qse_slwctoslmb (qse_wchar_t wc, qse_mchar_t* mb, qse_size_t mbl)
|
||||||
{
|
{
|
||||||
qse_mbstate_t state = { { 0, } };
|
qse_mbstate_t state = { { 0, } };
|
||||||
return qse_wcrtomb (wc, mb, mbl, &state);
|
return qse_slwcrtoslmb (wc, mb, mbl, &state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_mbcurmax (void)
|
int qse_slmblenmax (void)
|
||||||
{
|
{
|
||||||
/* TODO: consider other encodings */
|
return MB_CUR_MAX;
|
||||||
return (QSE_UTF8LEN_MAX > MB_CUR_MAX)? QSE_UTF8LEN_MAX: MB_CUR_MAX;
|
|
||||||
}
|
}
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/cmn/tio.h>
|
#include <qse/cmn/tio.h>
|
||||||
#include <qse/cmn/utf8.h>
|
#include <qse/cmn/mbwc.h>
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
QSE_IMPLEMENT_COMMON_FUNCTIONS (tio)
|
QSE_IMPLEMENT_COMMON_FUNCTIONS (tio)
|
||||||
@ -52,18 +52,10 @@ int qse_tio_close (qse_tio_t* tio)
|
|||||||
|
|
||||||
int qse_tio_init (qse_tio_t* tio, qse_mmgr_t* mmgr, int flags)
|
int qse_tio_init (qse_tio_t* tio, qse_mmgr_t* mmgr, int flags)
|
||||||
{
|
{
|
||||||
/* TODO: set this default_cmgr differently depending on
|
|
||||||
* build options and platforms */
|
|
||||||
static qse_cmgr_t default_cmgr =
|
|
||||||
{
|
|
||||||
qse_utf8touc,
|
|
||||||
qse_uctoutf8
|
|
||||||
};
|
|
||||||
|
|
||||||
QSE_MEMSET (tio, 0, QSE_SIZEOF(*tio));
|
QSE_MEMSET (tio, 0, QSE_SIZEOF(*tio));
|
||||||
|
|
||||||
tio->mmgr = mmgr;
|
tio->mmgr = mmgr;
|
||||||
tio->cmgr = &default_cmgr;
|
tio->cmgr = qse_getdflcmgr();
|
||||||
|
|
||||||
/* mask off internal bits when storing the flags for safety */
|
/* mask off internal bits when storing the flags for safety */
|
||||||
tio->flags = flags & ~(QSE_TIO_DYNINBUF | QSE_TIO_DYNOUTBUF);
|
tio->flags = flags & ~(QSE_TIO_DYNINBUF | QSE_TIO_DYNOUTBUF);
|
||||||
|
@ -2083,6 +2083,9 @@ int tre_compile (regex_t *preg, const tre_char_t *regex, size_t n, int cflags)
|
|||||||
/* If in eight bit mode, compute a table of characters that can be the
|
/* If in eight bit mode, compute a table of characters that can be the
|
||||||
first character of a match. */
|
first character of a match. */
|
||||||
tnfa->first_char = -1;
|
tnfa->first_char = -1;
|
||||||
|
|
||||||
|
/* QSE: deleted */
|
||||||
|
/*
|
||||||
if (TRE_MB_CUR_MAX == 1 && !tmp_ast_l->nullable)
|
if (TRE_MB_CUR_MAX == 1 && !tmp_ast_l->nullable)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -2125,6 +2128,8 @@ int tre_compile (regex_t *preg, const tre_char_t *regex, size_t n, int cflags)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
tnfa->firstpos_chars = NULL;
|
tnfa->firstpos_chars = NULL;
|
||||||
|
*/
|
||||||
|
/* END QSE */
|
||||||
|
|
||||||
|
|
||||||
p = tree->firstpos;
|
p = tree->firstpos;
|
||||||
@ -2273,8 +2278,12 @@ void tre_free (regex_t *preg)
|
|||||||
|
|
||||||
if (tnfa->tag_directions)
|
if (tnfa->tag_directions)
|
||||||
xfree(preg->mmgr,tnfa->tag_directions);
|
xfree(preg->mmgr,tnfa->tag_directions);
|
||||||
|
/* QSE: deleted */
|
||||||
|
/*
|
||||||
if (tnfa->firstpos_chars)
|
if (tnfa->firstpos_chars)
|
||||||
xfree(preg->mmgr,tnfa->firstpos_chars);
|
xfree(preg->mmgr,tnfa->firstpos_chars);
|
||||||
|
*/
|
||||||
|
/* END QSE */
|
||||||
if (tnfa->minimal_tags)
|
if (tnfa->minimal_tags)
|
||||||
xfree(preg->mmgr,tnfa->minimal_tags);
|
xfree(preg->mmgr,tnfa->minimal_tags);
|
||||||
xfree(preg->mmgr,tnfa);
|
xfree(preg->mmgr,tnfa);
|
||||||
|
@ -166,6 +166,7 @@ tre_new_item(tre_mem_t mem, int min, int max, int *i, int *max_i,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
/* Expands a character class to character ranges. */
|
/* Expands a character class to character ranges. */
|
||||||
static reg_errcode_t
|
static reg_errcode_t
|
||||||
tre_expand_ctype(tre_mem_t mem, tre_ctype_t class, tre_ast_node_t ***items,
|
tre_expand_ctype(tre_mem_t mem, tre_ctype_t class, tre_ast_node_t ***items,
|
||||||
@ -174,7 +175,9 @@ tre_expand_ctype(tre_mem_t mem, tre_ctype_t class, tre_ast_node_t ***items,
|
|||||||
reg_errcode_t status = REG_OK;
|
reg_errcode_t status = REG_OK;
|
||||||
tre_cint_t c;
|
tre_cint_t c;
|
||||||
int j, min = -1, max = 0;
|
int j, min = -1, max = 0;
|
||||||
assert(TRE_MB_CUR_MAX == 1);
|
/* QSE: deleted */
|
||||||
|
/*assert(TRE_MB_CUR_MAX == 1);*/
|
||||||
|
/* END QSE */
|
||||||
|
|
||||||
DPRINT((" expanding class to character ranges\n"));
|
DPRINT((" expanding class to character ranges\n"));
|
||||||
for (j = 0; (j < 256) && (status == REG_OK); j++)
|
for (j = 0; (j < 256) && (status == REG_OK); j++)
|
||||||
@ -198,6 +201,7 @@ tre_expand_ctype(tre_mem_t mem, tre_ctype_t class, tre_ast_node_t ***items,
|
|||||||
status = tre_new_item(mem, min, max, i, max_i, items);
|
status = tre_new_item(mem, min, max, i, max_i, items);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -294,13 +298,20 @@ tre_parse_bracket_items(tre_parse_ctx_t *ctx, int negate,
|
|||||||
if (qse_getctypebyxname (re + 2, len, &class) <= -1) status = REG_ECTYPE;
|
if (qse_getctypebyxname (re + 2, len, &class) <= -1) status = REG_ECTYPE;
|
||||||
|
|
||||||
/* Optimize character classes for 8 bit character sets. */
|
/* Optimize character classes for 8 bit character sets. */
|
||||||
if (status == REG_OK && TRE_MB_CUR_MAX == 1)
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
|
/* QSE: not possible to count on MB_CUR_MAX since
|
||||||
|
* this library is designed to support per-object
|
||||||
|
* or per-context character encoding using qse_cmgr_t */
|
||||||
|
/* if (status == REG_OK && TRE_MB_CUR_MAX == 1) */
|
||||||
|
/* END QSE */
|
||||||
|
if (status == REG_OK)
|
||||||
{
|
{
|
||||||
status = tre_expand_ctype(ctx->mem, class, items,
|
status = tre_expand_ctype(ctx->mem, class, items,
|
||||||
&i, &max_i, ctx->cflags);
|
&i, &max_i, ctx->cflags);
|
||||||
class = (tre_ctype_t)0;
|
class = (tre_ctype_t)0;
|
||||||
skip = 1;
|
skip = 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
re = endptr + 2;
|
re = endptr + 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,10 +135,9 @@ SUBMATCH[4] = [defg]
|
|||||||
|
|
||||||
#ifdef QSE_CHAR_IS_WCHAR
|
#ifdef QSE_CHAR_IS_WCHAR
|
||||||
# define TRE_WCHAR
|
# define TRE_WCHAR
|
||||||
/*
|
|
||||||
# define TRE_MULTIBYTE
|
/*# define TRE_MULTIBYTE*/
|
||||||
# define TRE_MBSTATE
|
/*# define TRE_MBSTATE*/
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TRE_REGEX_T_FIELD value
|
#define TRE_REGEX_T_FIELD value
|
||||||
@ -261,14 +260,16 @@ typedef qse_pma_t* tre_mem_t;
|
|||||||
/* Define the character types and functions. */
|
/* Define the character types and functions. */
|
||||||
#ifdef TRE_WCHAR
|
#ifdef TRE_WCHAR
|
||||||
# define TRE_CHAR_MAX QSE_TYPE_MAX(qse_wchar_t)
|
# define TRE_CHAR_MAX QSE_TYPE_MAX(qse_wchar_t)
|
||||||
|
/*
|
||||||
# ifdef TRE_MULTIBYTE
|
# ifdef TRE_MULTIBYTE
|
||||||
# define TRE_MB_CUR_MAX (qse_getmbcurmax())
|
# define TRE_MB_CUR_MAX (qse_getmbcurmax())
|
||||||
# else /* !TRE_MULTIBYTE */
|
# else
|
||||||
# define TRE_MB_CUR_MAX 1
|
# define TRE_MB_CUR_MAX 1
|
||||||
# endif /* !TRE_MULTIBYTE */
|
# endif
|
||||||
|
*/
|
||||||
#else /* !TRE_WCHAR */
|
#else /* !TRE_WCHAR */
|
||||||
# define TRE_CHAR_MAX 255
|
# define TRE_CHAR_MAX 255
|
||||||
# define TRE_MB_CUR_MAX 1
|
/*# define TRE_MB_CUR_MAX 1*/
|
||||||
#endif /* !TRE_WCHAR */
|
#endif /* !TRE_WCHAR */
|
||||||
|
|
||||||
#define DPRINT(msg)
|
#define DPRINT(msg)
|
||||||
@ -394,7 +395,9 @@ struct tnfa
|
|||||||
tre_tnfa_transition_t *initial;
|
tre_tnfa_transition_t *initial;
|
||||||
tre_tnfa_transition_t *final;
|
tre_tnfa_transition_t *final;
|
||||||
tre_submatch_data_t *submatch_data;
|
tre_submatch_data_t *submatch_data;
|
||||||
|
#if 0
|
||||||
char *firstpos_chars;
|
char *firstpos_chars;
|
||||||
|
#endif
|
||||||
int first_char;
|
int first_char;
|
||||||
unsigned int num_submatches;
|
unsigned int num_submatches;
|
||||||
tre_tag_direction_t *tag_directions;
|
tre_tag_direction_t *tag_directions;
|
||||||
|
@ -21,6 +21,12 @@
|
|||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void print_error (
|
static void print_error (
|
||||||
const QSE::StdAwk::loc_t& loc, const QSE::StdAwk::char_t* msg)
|
const QSE::StdAwk::loc_t& loc, const QSE::StdAwk::char_t* msg)
|
||||||
@ -76,5 +82,23 @@ 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)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc,argv,awk_main);
|
return qse_runmain (argc,argv,awk_main);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,12 @@
|
|||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void print_error (
|
static void print_error (
|
||||||
const QSE::StdAwk::loc_t& loc, const QSE::StdAwk::char_t* msg)
|
const QSE::StdAwk::loc_t& loc, const QSE::StdAwk::char_t* msg)
|
||||||
@ -103,5 +109,23 @@ 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)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc,argv,awk_main);
|
return qse_runmain (argc,argv,awk_main);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,13 @@
|
|||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void print_error (
|
static void print_error (
|
||||||
const QSE::StdAwk::loc_t& loc, const QSE::StdAwk::char_t* msg)
|
const QSE::StdAwk::loc_t& loc, const QSE::StdAwk::char_t* msg)
|
||||||
@ -147,5 +154,23 @@ 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)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc,argv,awk_main);
|
return qse_runmain (argc,argv,awk_main);
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,12 @@
|
|||||||
#include <qse/awk/StdAwk.hpp>
|
#include <qse/awk/StdAwk.hpp>
|
||||||
#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/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
@ -7,46 +7,70 @@ AM_CPPFLAGS = \
|
|||||||
|
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
bin_PROGRAMS = \
|
||||||
xma fma pma chr \
|
chr01 \
|
||||||
|
env \
|
||||||
|
dll \
|
||||||
|
fio01 \
|
||||||
|
fio02 \
|
||||||
|
fma \
|
||||||
|
fmt01 \
|
||||||
|
fmt02 \
|
||||||
|
fs01 \
|
||||||
|
htb \
|
||||||
|
lda \
|
||||||
|
main01 \
|
||||||
|
main02 \
|
||||||
|
mbwc01 \
|
||||||
|
mbwc02 \
|
||||||
|
oht \
|
||||||
|
path01 \
|
||||||
|
pio \
|
||||||
|
pma \
|
||||||
|
rex01 \
|
||||||
|
rbt \
|
||||||
|
sio01 \
|
||||||
|
sio02 \
|
||||||
|
sio03 \
|
||||||
|
sll \
|
||||||
|
slmb01 \
|
||||||
str01 \
|
str01 \
|
||||||
mbwc01 mbwc02 \
|
time \
|
||||||
sll dll lda oht htb rbt fio01 fio02 pio \
|
tre01 \
|
||||||
sio01 sio02 sio03 \
|
xma
|
||||||
time main main2 rex01 env path01 tre01 \
|
|
||||||
fmt01 fmt02 fs01
|
|
||||||
|
|
||||||
LDFLAGS = -L../../lib/cmn
|
LDFLAGS = -L../../lib/cmn
|
||||||
LDADD = -lqsecmn
|
LDADD = -lqsecmn
|
||||||
|
|
||||||
xma_SOURCES = xma.c
|
chr01_SOURCES = chr01.c
|
||||||
fma_SOURCES = fma.c
|
env_SOURCES = env.c
|
||||||
pma_SOURCES = pma.c
|
|
||||||
chr_SOURCES = chr.c
|
|
||||||
str01_SOURCES = str01.c
|
|
||||||
mbwc01_SOURCES = mbwc01.c
|
|
||||||
mbwc02_SOURCES = mbwc02.c
|
|
||||||
sll_SOURCES = sll.c
|
|
||||||
dll_SOURCES = dll.c
|
dll_SOURCES = dll.c
|
||||||
lda_SOURCES = lda.c
|
|
||||||
oht_SOURCES = oht.c
|
|
||||||
htb_SOURCES = htb.c
|
|
||||||
rbt_SOURCES = rbt.c
|
|
||||||
fio01_SOURCES = fio01.c
|
fio01_SOURCES = fio01.c
|
||||||
fio02_SOURCES = fio02.c
|
fio02_SOURCES = fio02.c
|
||||||
pio_SOURCES = pio.c
|
fma_SOURCES = fma.c
|
||||||
sio01_SOURCES = sio01.c
|
|
||||||
sio02_SOURCES = sio02.c
|
|
||||||
sio03_SOURCES = sio03.c
|
|
||||||
time_SOURCES = time.c
|
|
||||||
main_SOURCES = main.c
|
|
||||||
main2_SOURCES = main2.c
|
|
||||||
rex01_SOURCES = rex01.c
|
|
||||||
env_SOURCES = env.c
|
|
||||||
path01_SOURCES = path01.c
|
|
||||||
tre01_SOURCES = tre01.c
|
|
||||||
fmt01_SOURCES = fmt01.c
|
fmt01_SOURCES = fmt01.c
|
||||||
fmt02_SOURCES = fmt02.c
|
fmt02_SOURCES = fmt02.c
|
||||||
fs01_SOURCES = fs01.c
|
fs01_SOURCES = fs01.c
|
||||||
|
htb_SOURCES = htb.c
|
||||||
|
lda_SOURCES = lda.c
|
||||||
|
main01_SOURCES = main01.c
|
||||||
|
main02_SOURCES = main02.c
|
||||||
|
mbwc01_SOURCES = mbwc01.c
|
||||||
|
mbwc02_SOURCES = mbwc02.c
|
||||||
|
oht_SOURCES = oht.c
|
||||||
|
path01_SOURCES = path01.c
|
||||||
|
pio_SOURCES = pio.c
|
||||||
|
pma_SOURCES = pma.c
|
||||||
|
rex01_SOURCES = rex01.c
|
||||||
|
rbt_SOURCES = rbt.c
|
||||||
|
sio01_SOURCES = sio01.c
|
||||||
|
sio02_SOURCES = sio02.c
|
||||||
|
sio03_SOURCES = sio03.c
|
||||||
|
sll_SOURCES = sll.c
|
||||||
|
slmb01_SOURCES = slmb01.c
|
||||||
|
str01_SOURCES = str01.c
|
||||||
|
time_SOURCES = time.c
|
||||||
|
tre01_SOURCES = tre01.c
|
||||||
|
xma_SOURCES = xma.c
|
||||||
|
|
||||||
if ENABLE_CXX
|
if ENABLE_CXX
|
||||||
|
|
||||||
|
@ -34,14 +34,14 @@ PRE_UNINSTALL = :
|
|||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
bin_PROGRAMS = xma$(EXEEXT) fma$(EXEEXT) pma$(EXEEXT) chr$(EXEEXT) \
|
bin_PROGRAMS = chr01$(EXEEXT) env$(EXEEXT) dll$(EXEEXT) fio01$(EXEEXT) \
|
||||||
str01$(EXEEXT) mbwc01$(EXEEXT) mbwc02$(EXEEXT) sll$(EXEEXT) \
|
fio02$(EXEEXT) fma$(EXEEXT) fmt01$(EXEEXT) fmt02$(EXEEXT) \
|
||||||
dll$(EXEEXT) lda$(EXEEXT) oht$(EXEEXT) htb$(EXEEXT) \
|
fs01$(EXEEXT) htb$(EXEEXT) lda$(EXEEXT) main01$(EXEEXT) \
|
||||||
rbt$(EXEEXT) fio01$(EXEEXT) fio02$(EXEEXT) pio$(EXEEXT) \
|
main02$(EXEEXT) mbwc01$(EXEEXT) mbwc02$(EXEEXT) oht$(EXEEXT) \
|
||||||
sio01$(EXEEXT) sio02$(EXEEXT) sio03$(EXEEXT) time$(EXEEXT) \
|
path01$(EXEEXT) pio$(EXEEXT) pma$(EXEEXT) rex01$(EXEEXT) \
|
||||||
main$(EXEEXT) main2$(EXEEXT) rex01$(EXEEXT) env$(EXEEXT) \
|
rbt$(EXEEXT) sio01$(EXEEXT) sio02$(EXEEXT) sio03$(EXEEXT) \
|
||||||
path01$(EXEEXT) tre01$(EXEEXT) fmt01$(EXEEXT) fmt02$(EXEEXT) \
|
sll$(EXEEXT) slmb01$(EXEEXT) str01$(EXEEXT) time$(EXEEXT) \
|
||||||
fs01$(EXEEXT)
|
tre01$(EXEEXT) xma$(EXEEXT)
|
||||||
subdir = samples/cmn
|
subdir = samples/cmn
|
||||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
@ -58,10 +58,10 @@ CONFIG_CLEAN_FILES =
|
|||||||
CONFIG_CLEAN_VPATH_FILES =
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||||
PROGRAMS = $(bin_PROGRAMS)
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
am_chr_OBJECTS = chr.$(OBJEXT)
|
am_chr01_OBJECTS = chr01.$(OBJEXT)
|
||||||
chr_OBJECTS = $(am_chr_OBJECTS)
|
chr01_OBJECTS = $(am_chr01_OBJECTS)
|
||||||
chr_LDADD = $(LDADD)
|
chr01_LDADD = $(LDADD)
|
||||||
chr_DEPENDENCIES =
|
chr01_DEPENDENCIES =
|
||||||
am_dll_OBJECTS = dll.$(OBJEXT)
|
am_dll_OBJECTS = dll.$(OBJEXT)
|
||||||
dll_OBJECTS = $(am_dll_OBJECTS)
|
dll_OBJECTS = $(am_dll_OBJECTS)
|
||||||
dll_LDADD = $(LDADD)
|
dll_LDADD = $(LDADD)
|
||||||
@ -102,14 +102,14 @@ am_lda_OBJECTS = lda.$(OBJEXT)
|
|||||||
lda_OBJECTS = $(am_lda_OBJECTS)
|
lda_OBJECTS = $(am_lda_OBJECTS)
|
||||||
lda_LDADD = $(LDADD)
|
lda_LDADD = $(LDADD)
|
||||||
lda_DEPENDENCIES =
|
lda_DEPENDENCIES =
|
||||||
am_main_OBJECTS = main.$(OBJEXT)
|
am_main01_OBJECTS = main01.$(OBJEXT)
|
||||||
main_OBJECTS = $(am_main_OBJECTS)
|
main01_OBJECTS = $(am_main01_OBJECTS)
|
||||||
main_LDADD = $(LDADD)
|
main01_LDADD = $(LDADD)
|
||||||
main_DEPENDENCIES =
|
main01_DEPENDENCIES =
|
||||||
am_main2_OBJECTS = main2.$(OBJEXT)
|
am_main02_OBJECTS = main02.$(OBJEXT)
|
||||||
main2_OBJECTS = $(am_main2_OBJECTS)
|
main02_OBJECTS = $(am_main02_OBJECTS)
|
||||||
main2_LDADD = $(LDADD)
|
main02_LDADD = $(LDADD)
|
||||||
main2_DEPENDENCIES =
|
main02_DEPENDENCIES =
|
||||||
am_mbwc01_OBJECTS = mbwc01.$(OBJEXT)
|
am_mbwc01_OBJECTS = mbwc01.$(OBJEXT)
|
||||||
mbwc01_OBJECTS = $(am_mbwc01_OBJECTS)
|
mbwc01_OBJECTS = $(am_mbwc01_OBJECTS)
|
||||||
mbwc01_LDADD = $(LDADD)
|
mbwc01_LDADD = $(LDADD)
|
||||||
@ -158,6 +158,10 @@ am_sll_OBJECTS = sll.$(OBJEXT)
|
|||||||
sll_OBJECTS = $(am_sll_OBJECTS)
|
sll_OBJECTS = $(am_sll_OBJECTS)
|
||||||
sll_LDADD = $(LDADD)
|
sll_LDADD = $(LDADD)
|
||||||
sll_DEPENDENCIES =
|
sll_DEPENDENCIES =
|
||||||
|
am_slmb01_OBJECTS = slmb01.$(OBJEXT)
|
||||||
|
slmb01_OBJECTS = $(am_slmb01_OBJECTS)
|
||||||
|
slmb01_LDADD = $(LDADD)
|
||||||
|
slmb01_DEPENDENCIES =
|
||||||
am_str01_OBJECTS = str01.$(OBJEXT)
|
am_str01_OBJECTS = str01.$(OBJEXT)
|
||||||
str01_OBJECTS = $(am_str01_OBJECTS)
|
str01_OBJECTS = $(am_str01_OBJECTS)
|
||||||
str01_LDADD = $(LDADD)
|
str01_LDADD = $(LDADD)
|
||||||
@ -187,24 +191,26 @@ CCLD = $(CC)
|
|||||||
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||||
$(LDFLAGS) -o $@
|
$(LDFLAGS) -o $@
|
||||||
SOURCES = $(chr_SOURCES) $(dll_SOURCES) $(env_SOURCES) \
|
SOURCES = $(chr01_SOURCES) $(dll_SOURCES) $(env_SOURCES) \
|
||||||
$(fio01_SOURCES) $(fio02_SOURCES) $(fma_SOURCES) \
|
$(fio01_SOURCES) $(fio02_SOURCES) $(fma_SOURCES) \
|
||||||
$(fmt01_SOURCES) $(fmt02_SOURCES) $(fs01_SOURCES) \
|
$(fmt01_SOURCES) $(fmt02_SOURCES) $(fs01_SOURCES) \
|
||||||
$(htb_SOURCES) $(lda_SOURCES) $(main_SOURCES) $(main2_SOURCES) \
|
$(htb_SOURCES) $(lda_SOURCES) $(main01_SOURCES) \
|
||||||
$(mbwc01_SOURCES) $(mbwc02_SOURCES) $(oht_SOURCES) \
|
$(main02_SOURCES) $(mbwc01_SOURCES) $(mbwc02_SOURCES) \
|
||||||
$(path01_SOURCES) $(pio_SOURCES) $(pma_SOURCES) $(rbt_SOURCES) \
|
$(oht_SOURCES) $(path01_SOURCES) $(pio_SOURCES) $(pma_SOURCES) \
|
||||||
$(rex01_SOURCES) $(sio01_SOURCES) $(sio02_SOURCES) \
|
$(rbt_SOURCES) $(rex01_SOURCES) $(sio01_SOURCES) \
|
||||||
$(sio03_SOURCES) $(sll_SOURCES) $(str01_SOURCES) \
|
$(sio02_SOURCES) $(sio03_SOURCES) $(sll_SOURCES) \
|
||||||
$(time_SOURCES) $(tre01_SOURCES) $(xma_SOURCES)
|
$(slmb01_SOURCES) $(str01_SOURCES) $(time_SOURCES) \
|
||||||
DIST_SOURCES = $(chr_SOURCES) $(dll_SOURCES) $(env_SOURCES) \
|
$(tre01_SOURCES) $(xma_SOURCES)
|
||||||
|
DIST_SOURCES = $(chr01_SOURCES) $(dll_SOURCES) $(env_SOURCES) \
|
||||||
$(fio01_SOURCES) $(fio02_SOURCES) $(fma_SOURCES) \
|
$(fio01_SOURCES) $(fio02_SOURCES) $(fma_SOURCES) \
|
||||||
$(fmt01_SOURCES) $(fmt02_SOURCES) $(fs01_SOURCES) \
|
$(fmt01_SOURCES) $(fmt02_SOURCES) $(fs01_SOURCES) \
|
||||||
$(htb_SOURCES) $(lda_SOURCES) $(main_SOURCES) $(main2_SOURCES) \
|
$(htb_SOURCES) $(lda_SOURCES) $(main01_SOURCES) \
|
||||||
$(mbwc01_SOURCES) $(mbwc02_SOURCES) $(oht_SOURCES) \
|
$(main02_SOURCES) $(mbwc01_SOURCES) $(mbwc02_SOURCES) \
|
||||||
$(path01_SOURCES) $(pio_SOURCES) $(pma_SOURCES) $(rbt_SOURCES) \
|
$(oht_SOURCES) $(path01_SOURCES) $(pio_SOURCES) $(pma_SOURCES) \
|
||||||
$(rex01_SOURCES) $(sio01_SOURCES) $(sio02_SOURCES) \
|
$(rbt_SOURCES) $(rex01_SOURCES) $(sio01_SOURCES) \
|
||||||
$(sio03_SOURCES) $(sll_SOURCES) $(str01_SOURCES) \
|
$(sio02_SOURCES) $(sio03_SOURCES) $(sll_SOURCES) \
|
||||||
$(time_SOURCES) $(tre01_SOURCES) $(xma_SOURCES)
|
$(slmb01_SOURCES) $(str01_SOURCES) $(time_SOURCES) \
|
||||||
|
$(tre01_SOURCES) $(xma_SOURCES)
|
||||||
ETAGS = etags
|
ETAGS = etags
|
||||||
CTAGS = ctags
|
CTAGS = ctags
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
@ -356,35 +362,36 @@ AM_CPPFLAGS = \
|
|||||||
-I$(includedir)
|
-I$(includedir)
|
||||||
|
|
||||||
LDADD = -lqsecmn
|
LDADD = -lqsecmn
|
||||||
xma_SOURCES = xma.c
|
chr01_SOURCES = chr01.c
|
||||||
fma_SOURCES = fma.c
|
env_SOURCES = env.c
|
||||||
pma_SOURCES = pma.c
|
|
||||||
chr_SOURCES = chr.c
|
|
||||||
str01_SOURCES = str01.c
|
|
||||||
mbwc01_SOURCES = mbwc01.c
|
|
||||||
mbwc02_SOURCES = mbwc02.c
|
|
||||||
sll_SOURCES = sll.c
|
|
||||||
dll_SOURCES = dll.c
|
dll_SOURCES = dll.c
|
||||||
lda_SOURCES = lda.c
|
|
||||||
oht_SOURCES = oht.c
|
|
||||||
htb_SOURCES = htb.c
|
|
||||||
rbt_SOURCES = rbt.c
|
|
||||||
fio01_SOURCES = fio01.c
|
fio01_SOURCES = fio01.c
|
||||||
fio02_SOURCES = fio02.c
|
fio02_SOURCES = fio02.c
|
||||||
pio_SOURCES = pio.c
|
fma_SOURCES = fma.c
|
||||||
sio01_SOURCES = sio01.c
|
|
||||||
sio02_SOURCES = sio02.c
|
|
||||||
sio03_SOURCES = sio03.c
|
|
||||||
time_SOURCES = time.c
|
|
||||||
main_SOURCES = main.c
|
|
||||||
main2_SOURCES = main2.c
|
|
||||||
rex01_SOURCES = rex01.c
|
|
||||||
env_SOURCES = env.c
|
|
||||||
path01_SOURCES = path01.c
|
|
||||||
tre01_SOURCES = tre01.c
|
|
||||||
fmt01_SOURCES = fmt01.c
|
fmt01_SOURCES = fmt01.c
|
||||||
fmt02_SOURCES = fmt02.c
|
fmt02_SOURCES = fmt02.c
|
||||||
fs01_SOURCES = fs01.c
|
fs01_SOURCES = fs01.c
|
||||||
|
htb_SOURCES = htb.c
|
||||||
|
lda_SOURCES = lda.c
|
||||||
|
main01_SOURCES = main01.c
|
||||||
|
main02_SOURCES = main02.c
|
||||||
|
mbwc01_SOURCES = mbwc01.c
|
||||||
|
mbwc02_SOURCES = mbwc02.c
|
||||||
|
oht_SOURCES = oht.c
|
||||||
|
path01_SOURCES = path01.c
|
||||||
|
pio_SOURCES = pio.c
|
||||||
|
pma_SOURCES = pma.c
|
||||||
|
rex01_SOURCES = rex01.c
|
||||||
|
rbt_SOURCES = rbt.c
|
||||||
|
sio01_SOURCES = sio01.c
|
||||||
|
sio02_SOURCES = sio02.c
|
||||||
|
sio03_SOURCES = sio03.c
|
||||||
|
sll_SOURCES = sll.c
|
||||||
|
slmb01_SOURCES = slmb01.c
|
||||||
|
str01_SOURCES = str01.c
|
||||||
|
time_SOURCES = time.c
|
||||||
|
tre01_SOURCES = tre01.c
|
||||||
|
xma_SOURCES = xma.c
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@ -462,9 +469,9 @@ clean-binPROGRAMS:
|
|||||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||||
echo " rm -f" $$list; \
|
echo " rm -f" $$list; \
|
||||||
rm -f $$list
|
rm -f $$list
|
||||||
chr$(EXEEXT): $(chr_OBJECTS) $(chr_DEPENDENCIES)
|
chr01$(EXEEXT): $(chr01_OBJECTS) $(chr01_DEPENDENCIES)
|
||||||
@rm -f chr$(EXEEXT)
|
@rm -f chr01$(EXEEXT)
|
||||||
$(LINK) $(chr_OBJECTS) $(chr_LDADD) $(LIBS)
|
$(LINK) $(chr01_OBJECTS) $(chr01_LDADD) $(LIBS)
|
||||||
dll$(EXEEXT): $(dll_OBJECTS) $(dll_DEPENDENCIES)
|
dll$(EXEEXT): $(dll_OBJECTS) $(dll_DEPENDENCIES)
|
||||||
@rm -f dll$(EXEEXT)
|
@rm -f dll$(EXEEXT)
|
||||||
$(LINK) $(dll_OBJECTS) $(dll_LDADD) $(LIBS)
|
$(LINK) $(dll_OBJECTS) $(dll_LDADD) $(LIBS)
|
||||||
@ -495,12 +502,12 @@ htb$(EXEEXT): $(htb_OBJECTS) $(htb_DEPENDENCIES)
|
|||||||
lda$(EXEEXT): $(lda_OBJECTS) $(lda_DEPENDENCIES)
|
lda$(EXEEXT): $(lda_OBJECTS) $(lda_DEPENDENCIES)
|
||||||
@rm -f lda$(EXEEXT)
|
@rm -f lda$(EXEEXT)
|
||||||
$(LINK) $(lda_OBJECTS) $(lda_LDADD) $(LIBS)
|
$(LINK) $(lda_OBJECTS) $(lda_LDADD) $(LIBS)
|
||||||
main$(EXEEXT): $(main_OBJECTS) $(main_DEPENDENCIES)
|
main01$(EXEEXT): $(main01_OBJECTS) $(main01_DEPENDENCIES)
|
||||||
@rm -f main$(EXEEXT)
|
@rm -f main01$(EXEEXT)
|
||||||
$(LINK) $(main_OBJECTS) $(main_LDADD) $(LIBS)
|
$(LINK) $(main01_OBJECTS) $(main01_LDADD) $(LIBS)
|
||||||
main2$(EXEEXT): $(main2_OBJECTS) $(main2_DEPENDENCIES)
|
main02$(EXEEXT): $(main02_OBJECTS) $(main02_DEPENDENCIES)
|
||||||
@rm -f main2$(EXEEXT)
|
@rm -f main02$(EXEEXT)
|
||||||
$(LINK) $(main2_OBJECTS) $(main2_LDADD) $(LIBS)
|
$(LINK) $(main02_OBJECTS) $(main02_LDADD) $(LIBS)
|
||||||
mbwc01$(EXEEXT): $(mbwc01_OBJECTS) $(mbwc01_DEPENDENCIES)
|
mbwc01$(EXEEXT): $(mbwc01_OBJECTS) $(mbwc01_DEPENDENCIES)
|
||||||
@rm -f mbwc01$(EXEEXT)
|
@rm -f mbwc01$(EXEEXT)
|
||||||
$(LINK) $(mbwc01_OBJECTS) $(mbwc01_LDADD) $(LIBS)
|
$(LINK) $(mbwc01_OBJECTS) $(mbwc01_LDADD) $(LIBS)
|
||||||
@ -537,6 +544,9 @@ sio03$(EXEEXT): $(sio03_OBJECTS) $(sio03_DEPENDENCIES)
|
|||||||
sll$(EXEEXT): $(sll_OBJECTS) $(sll_DEPENDENCIES)
|
sll$(EXEEXT): $(sll_OBJECTS) $(sll_DEPENDENCIES)
|
||||||
@rm -f sll$(EXEEXT)
|
@rm -f sll$(EXEEXT)
|
||||||
$(LINK) $(sll_OBJECTS) $(sll_LDADD) $(LIBS)
|
$(LINK) $(sll_OBJECTS) $(sll_LDADD) $(LIBS)
|
||||||
|
slmb01$(EXEEXT): $(slmb01_OBJECTS) $(slmb01_DEPENDENCIES)
|
||||||
|
@rm -f slmb01$(EXEEXT)
|
||||||
|
$(LINK) $(slmb01_OBJECTS) $(slmb01_LDADD) $(LIBS)
|
||||||
str01$(EXEEXT): $(str01_OBJECTS) $(str01_DEPENDENCIES)
|
str01$(EXEEXT): $(str01_OBJECTS) $(str01_DEPENDENCIES)
|
||||||
@rm -f str01$(EXEEXT)
|
@rm -f str01$(EXEEXT)
|
||||||
$(LINK) $(str01_OBJECTS) $(str01_LDADD) $(LIBS)
|
$(LINK) $(str01_OBJECTS) $(str01_LDADD) $(LIBS)
|
||||||
@ -556,7 +566,7 @@ mostlyclean-compile:
|
|||||||
distclean-compile:
|
distclean-compile:
|
||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chr.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chr01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dll.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dll.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fio01.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fio01.Po@am__quote@
|
||||||
@ -567,8 +577,8 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs01.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htb.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htb.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lda.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lda.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main2.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main02.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbwc01.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbwc01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbwc02.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbwc02.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oht.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oht.Po@am__quote@
|
||||||
@ -581,6 +591,7 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio02.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio02.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio03.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio03.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sll.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sll.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slmb01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str01.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre01.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre01.Po@am__quote@
|
||||||
|
53
qse/samples/cmn/chr01.c
Normal file
53
qse/samples/cmn/chr01.c
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#include <qse/cmn/chr.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define R(f) \
|
||||||
|
do { \
|
||||||
|
qse_printf (QSE_T("== %s ==\n"), QSE_T(#f)); \
|
||||||
|
if (f() == -1) return -1; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
static int test1 (void)
|
||||||
|
{
|
||||||
|
qse_char_t c;
|
||||||
|
|
||||||
|
for (c = QSE_T('a'); c <= QSE_T('z'); c++)
|
||||||
|
{
|
||||||
|
qse_printf (QSE_T("%c => %c\n"), c, QSE_TOUPPER(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
R (test1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -1,7 +1,13 @@
|
|||||||
#include <qse/cmn/fmt.h>
|
#include <qse/cmn/fmt.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
||||||
{
|
{
|
||||||
qse_char_t buf[19];
|
qse_char_t buf[19];
|
||||||
@ -50,6 +56,24 @@ static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[], qse_achar_t* envp[])
|
int qse_main (int argc, qse_achar_t* argv[], qse_achar_t* envp[])
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmainwithenv (argc, argv, envp, test_main);
|
return qse_runmainwithenv (argc, argv, envp, test_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
#include <qse/cmn/fmt.h>
|
#include <qse/cmn/fmt.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
||||||
{
|
{
|
||||||
qse_char_t buf[129];
|
qse_char_t buf[129];
|
||||||
@ -69,6 +76,24 @@ static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[], qse_achar_t* envp[])
|
int qse_main (int argc, qse_achar_t* argv[], qse_achar_t* envp[])
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmainwithenv (argc, argv, envp, test_main);
|
return qse_runmainwithenv (argc, argv, envp, test_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
#include <qse/cmn/fs.h>
|
#include <qse/cmn/fs.h>
|
||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
#include <qse/cmn/stdio.h>
|
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void list (qse_fs_t* fs, const qse_char_t* name)
|
static void list (qse_fs_t* fs, const qse_char_t* name)
|
||||||
{
|
{
|
||||||
@ -68,6 +75,24 @@ int fs_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)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc, argv, fs_main);
|
return qse_runmain (argc, argv, fs_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
#include <qse/cmn/main.h>
|
|
||||||
#include <qse/cmn/stdio.h>
|
|
||||||
|
|
||||||
static int test_main (int argc, qse_char_t* argv[])
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
qse_printf (QSE_T("%d => [%s]\n"), i, argv[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
|
||||||
{
|
|
||||||
return qse_runmain (argc, argv, test_main);
|
|
||||||
}
|
|
||||||
|
|
47
qse/samples/cmn/main01.c
Normal file
47
qse/samples/cmn/main01.c
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static int test_main (int argc, qse_char_t* argv[])
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
|
qse_printf (QSE_T("%d => [%s]\n"), i, argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return qse_runmain (argc, argv, test_main);
|
||||||
|
}
|
||||||
|
|
51
qse/samples/cmn/main02.c
Normal file
51
qse/samples/cmn/main02.c
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
|
qse_printf (QSE_T("ARG %d => [%s]\n"), i, argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; envp[i]; i++)
|
||||||
|
{
|
||||||
|
qse_printf (QSE_T("ENV %d => [%s]\n"), i, envp[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int qse_main (int argc, qse_achar_t* argv[], qse_achar_t* envp[])
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return qse_runmainwithenv (argc, argv, envp, test_main);
|
||||||
|
}
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
#include <qse/cmn/main.h>
|
|
||||||
#include <qse/cmn/stdio.h>
|
|
||||||
|
|
||||||
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
qse_printf (QSE_T("ARG %d => [%s]\n"), i, argv[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; envp[i]; i++)
|
|
||||||
{
|
|
||||||
qse_printf (QSE_T("ENV %d => [%s]\n"), i, envp[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[], qse_achar_t* envp[])
|
|
||||||
{
|
|
||||||
return qse_runmainwithenv (argc, argv, envp, test_main);
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
|||||||
|
|
||||||
#include <qse/cmn/path.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int path_main (int argc, qse_char_t* argv[])
|
int path_main (int argc, qse_char_t* argv[])
|
||||||
{
|
{
|
||||||
qse_char_t* canon;
|
qse_char_t* canon;
|
||||||
@ -60,6 +65,24 @@ int path_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)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc, argv, path_main);
|
return qse_runmain (argc, argv, path_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,15 @@
|
|||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/path.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static int rex_main (int argc, qse_char_t* argv[])
|
static int rex_main (int argc, qse_char_t* argv[])
|
||||||
{
|
{
|
||||||
qse_rex_t* rex;
|
qse_rex_t* rex;
|
||||||
@ -27,7 +33,7 @@ static int rex_main (int argc, qse_char_t* argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_rex_setoption (rex, QSE_REX_STRICT);
|
qse_rex_setoption (rex, QSE_REX_STRICT);
|
||||||
|
|
||||||
start = qse_rex_comp (rex, argv[1], qse_strlen(argv[1]));
|
start = qse_rex_comp (rex, argv[1], qse_strlen(argv[1]));
|
||||||
if (start == QSE_NULL)
|
if (start == QSE_NULL)
|
||||||
@ -64,6 +70,24 @@ qse_rex_setoption (rex, QSE_REX_STRICT);
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc, argv, rex_main);
|
return qse_runmain (argc, argv, rex_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,11 +157,11 @@ int main ()
|
|||||||
{
|
{
|
||||||
sprintf (locale, ".%u", (unsigned int)codepage);
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
setlocale (LC_ALL, locale);
|
setlocale (LC_ALL, locale);
|
||||||
qse_setdflcmgr (qse_loccmgr);
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
qse_setdflcmgr (qse_loccmgr);
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
|
@ -72,6 +72,8 @@ static int test1 (void)
|
|||||||
|
|
||||||
static int test2 (void)
|
static int test2 (void)
|
||||||
{
|
{
|
||||||
|
/* this file is in utf8, the following strings may not be shown properly
|
||||||
|
* if your locale/codepage is not utf8 */
|
||||||
const qse_mchar_t* x[] =
|
const qse_mchar_t* x[] =
|
||||||
{
|
{
|
||||||
QSE_MT("\0\0\0"),
|
QSE_MT("\0\0\0"),
|
||||||
@ -100,6 +102,8 @@ static int test2 (void)
|
|||||||
|
|
||||||
static int test3 (void)
|
static int test3 (void)
|
||||||
{
|
{
|
||||||
|
/* this file is in utf8, the following strings may not be shown properly
|
||||||
|
* if your locale/codepage is not utf8 */
|
||||||
const qse_mchar_t* x[] =
|
const qse_mchar_t* x[] =
|
||||||
{
|
{
|
||||||
QSE_MT("\0\0\0"),
|
QSE_MT("\0\0\0"),
|
||||||
@ -141,11 +145,11 @@ int main ()
|
|||||||
{
|
{
|
||||||
sprintf (locale, ".%u", (unsigned int)codepage);
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
setlocale (LC_ALL, locale);
|
setlocale (LC_ALL, locale);
|
||||||
qse_setdflcmgr (qse_loccmgr);
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
qse_setdflcmgr (qse_loccmgr);
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qse_printf (QSE_T("--------------------------------------------------------------------------------\n"));
|
qse_printf (QSE_T("--------------------------------------------------------------------------------\n"));
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
|
#include <qse/cmn/slmb.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
#include <qse/cmn/chr.h>
|
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define R(f) \
|
#define R(f) \
|
||||||
do { \
|
do { \
|
||||||
qse_printf (QSE_T("== %s ==\n"), QSE_T(#f)); \
|
qse_printf (QSE_T("== %s ==\n"), QSE_T(#f)); \
|
||||||
@ -12,24 +17,12 @@
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static int test1 (void)
|
static int test1 (void)
|
||||||
{
|
|
||||||
qse_char_t c;
|
|
||||||
|
|
||||||
for (c = QSE_T('a'); c <= QSE_T('z'); c++)
|
|
||||||
{
|
|
||||||
qse_printf (QSE_T("%c => %c\n"), c, QSE_TOUPPER(c));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int test2 (void)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const qse_mchar_t* x[] =
|
const qse_mchar_t* x[] =
|
||||||
{
|
{
|
||||||
"\0",
|
"\0",
|
||||||
"뛰어 올라봐",
|
"뛰어 올라봐", /* this text is in utf8. so some conversions fail on a non-utf8 locale */
|
||||||
"Fly to the universe"
|
"Fly to the universe"
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,7 +37,7 @@ static int test2 (void)
|
|||||||
qse_printf (QSE_T("["));
|
qse_printf (QSE_T("["));
|
||||||
while (j < k)
|
while (j < k)
|
||||||
{
|
{
|
||||||
qse_size_t y = qse_mblen (&x[i][j], k-j);
|
qse_size_t y = qse_slmblen (&x[i][j], k-j);
|
||||||
|
|
||||||
if (y == 0)
|
if (y == 0)
|
||||||
{
|
{
|
||||||
@ -58,7 +51,7 @@ static int test2 (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qse_size_t y2 = qse_mbtowc (&x[i][j], y, &wc);
|
qse_size_t y2 = qse_slmbtoslwc (&x[i][j], y, &wc);
|
||||||
if (y2 != y)
|
if (y2 != y)
|
||||||
{
|
{
|
||||||
qse_printf (QSE_T("***y(%d) != y2(%d). something is wrong*** "), (int)y, (int)y2);
|
qse_printf (QSE_T("***y(%d) != y2(%d). something is wrong*** "), (int)y, (int)y2);
|
||||||
@ -87,26 +80,44 @@ static int test2 (void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int test3 (void)
|
static int test2 (void)
|
||||||
{
|
{
|
||||||
|
const qse_wchar_t unistr[] =
|
||||||
|
{
|
||||||
|
/*L"\uB108 \uBB50\uAC00 \uC798\uB0AC\uC5B4!",*/
|
||||||
|
0xB108,
|
||||||
|
L' ',
|
||||||
|
0xBB50,
|
||||||
|
0xAC00,
|
||||||
|
L' ',
|
||||||
|
0xC798,
|
||||||
|
0xB0AC,
|
||||||
|
0xC5B4,
|
||||||
|
L'!',
|
||||||
|
L'\0'
|
||||||
|
};
|
||||||
|
|
||||||
const qse_wchar_t* x[] =
|
const qse_wchar_t* x[] =
|
||||||
{
|
{
|
||||||
L"\0",
|
L"\0",
|
||||||
L"\uB108 \uBB50\uAC00 \uC798\uB0AC\uC5B4?",
|
L"",
|
||||||
L"Fly to the universe"
|
L"Fly to the universe"
|
||||||
};
|
};
|
||||||
char buf[100];
|
char buf[100];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
x[1] = unistr;
|
||||||
|
|
||||||
for (i = 0; i < QSE_COUNTOF(x); i++)
|
for (i = 0; i < QSE_COUNTOF(x); i++)
|
||||||
{
|
{
|
||||||
|
int nbytes = 0;
|
||||||
int len = qse_wcslen (x[i]);
|
int len = qse_wcslen (x[i]);
|
||||||
if (len == 0) len++; /* for x[0] */
|
if (len == 0) len++; /* for x[0] */
|
||||||
|
|
||||||
qse_printf (QSE_T("["));
|
qse_printf (QSE_T("["));
|
||||||
for (j = 0; j < len; j++)
|
for (j = 0; j < len; j++)
|
||||||
{
|
{
|
||||||
qse_size_t n = qse_wctomb (x[i][j], buf, sizeof(buf));
|
qse_size_t n = qse_slwctoslmb (x[i][j], buf, sizeof(buf) - 1);
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
@ -124,30 +135,40 @@ static int test3 (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef QSE_CHAR_IS_MCHAR
|
buf[n] = QSE_MT('\0');
|
||||||
qse_printf (QSE_T("%.*s"), (int)n, buf);
|
qse_printf (QSE_T("%hs"), buf);
|
||||||
#else
|
|
||||||
qse_printf (QSE_T("%.*S"), (int)n, buf);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
nbytes += n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qse_printf (QSE_T("] => %d chars\n"), (int)len);
|
qse_printf (QSE_T("] => %d chars, %d bytes\n"), (int)len, (int)nbytes);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
setlocale (LC_ALL, "");
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
qse_printf (QSE_T("--------------------------------------------------------------------------------\n"));
|
UINT codepage = GetConsoleOutputCP();
|
||||||
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"));
|
if (codepage == CP_UTF8)
|
||||||
qse_printf (QSE_T("--------------------------------------------------------------------------------\n"));
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
|
|
||||||
R (test1);
|
R (test1);
|
||||||
R (test2);
|
R (test2);
|
||||||
R (test3);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -1,10 +1,17 @@
|
|||||||
|
|
||||||
#include <qse/cmn/main.h>
|
|
||||||
#include <qse/cmn/tre.h>
|
#include <qse/cmn/tre.h>
|
||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
#include <qse/cmn/path.h>
|
#include <qse/cmn/path.h>
|
||||||
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
||||||
{
|
{
|
||||||
qse_tre_t tre;
|
qse_tre_t tre;
|
||||||
@ -70,6 +77,24 @@ oops:
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[], qse_achar_t* envp[])
|
int qse_main (int argc, qse_achar_t* argv[], qse_achar_t* envp[])
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmainwithenv (argc, argv, envp, test_main);
|
return qse_runmainwithenv (argc, argv, envp, test_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,14 @@
|
|||||||
|
|
||||||
#include <qse/sed/std.h>
|
#include <qse/sed/std.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int sed_main (int argc, qse_char_t* argv[])
|
int sed_main (int argc, qse_char_t* argv[])
|
||||||
{
|
{
|
||||||
qse_sed_t* sed = QSE_NULL;
|
qse_sed_t* sed = QSE_NULL;
|
||||||
@ -64,6 +70,25 @@ oops:
|
|||||||
|
|
||||||
int qse_main (int argc, qse_achar_t* argv[])
|
int qse_main (int argc, qse_achar_t* argv[])
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
|
|
||||||
return qse_runmain (argc, argv, sed_main);
|
return qse_runmain (argc, argv, sed_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,15 @@
|
|||||||
|
|
||||||
#include <qse/sed/StdSed.hpp>
|
#include <qse/sed/StdSed.hpp>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef QSE_CHAR_IS_MCHAR
|
#ifdef QSE_CHAR_IS_MCHAR
|
||||||
# define xcout std::cout
|
# define xcout std::cout
|
||||||
#else
|
#else
|
||||||
@ -71,5 +78,23 @@ int sed_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)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc, argv, sed_main);
|
return qse_runmain (argc, argv, sed_main);
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,16 @@
|
|||||||
|
|
||||||
#include <qse/sed/StdSed.hpp>
|
#include <qse/sed/StdSed.hpp>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
#include <qse/cmn/sio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef QSE_CHAR_IS_MCHAR
|
#ifdef QSE_CHAR_IS_MCHAR
|
||||||
# define xcout std::cout
|
# define xcout std::cout
|
||||||
#else
|
#else
|
||||||
@ -86,5 +93,23 @@ int sed_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)
|
||||||
|
char locale[100];
|
||||||
|
UINT codepage = GetConsoleOutputCP();
|
||||||
|
if (codepage == CP_UTF8)
|
||||||
|
{
|
||||||
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||||
|
qse_setdflcmgr (qse_utf8cmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||||
|
setlocale (LC_ALL, locale);
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
qse_setdflcmgr (qse_slmbcmgr);
|
||||||
|
#endif
|
||||||
return qse_runmain (argc, argv, sed_main);
|
return qse_runmain (argc, argv, sed_main);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user