separated slmb from mbwc

This commit is contained in:
2012-01-03 14:41:15 +00:00
parent dd02292cc4
commit 42431d2642
39 changed files with 890 additions and 331 deletions

View File

@ -25,6 +25,7 @@ pkginclude_HEADERS = \
rex.h \
sio.h \
sll.h \
slmb.h \
stdio.h \
str.h \
time.h \

View File

@ -53,8 +53,9 @@ SOURCES =
DIST_SOURCES =
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 \
opt.h path.h pio.h pma.h rbt.h rex.h sio.h sll.h stdio.h str.h \
time.h tio.h tre.h utf8.h xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
opt.h path.h pio.h pma.h rbt.h rex.h sio.h sll.h slmb.h \
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 = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -225,8 +226,8 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
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 \
pio.h pma.h rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h \
tre.h utf8.h xma.h $(am__append_1)
pio.h pma.h rbt.h rex.h sio.h sll.h slmb.h stdio.h str.h \
time.h tio.h tre.h utf8.h xma.h $(am__append_1)
all: all-am
.SUFFIXES:

View File

@ -24,26 +24,12 @@
#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
};
#ifdef __cplusplus
extern "C" {
#endif
extern qse_cmgr_t* qse_utf8cmgr;
extern qse_cmgr_t* qse_loccmgr;
extern qse_cmgr_t* qse_slmbcmgr;
qse_cmgr_t* qse_getdflcmgr (
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 */
/* --------------------------------------------------- */

126
qse/include/qse/cmn/slmb.h Normal file
View 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