added qse_fmtulongtombs()/qse_fmtulongtowcs()

This commit is contained in:
2011-11-03 14:56:26 +00:00
parent e5a9693411
commit 6ee7a71b8d
27 changed files with 402 additions and 65 deletions

View File

@ -1,4 +1,4 @@
SUBDIRS = cmn awk cut sed stx fs
SUBDIRS = cmn awk cut sed fs net stx
pkgincludedir = $(includedir)/qse

View File

@ -259,7 +259,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = cmn awk cut sed stx fs
SUBDIRS = cmn awk cut sed fs net stx
pkginclude_HEADERS = conf_msw.h conf_os2.h conf_dos.h conf_vms.h \
types.h macros.h pack1.h unpack.h $(am__append_1)
all: config.h

View File

@ -7,6 +7,7 @@ pkginclude_HEADERS = \
env.h \
fio.h \
fma.h \
fmt.h \
gdl.h \
htb.h \
lda.h \

View File

@ -52,9 +52,9 @@ CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__pkginclude_HEADERS_DIST = alg.h chr.h dll.h env.h fio.h fma.h \
gdl.h htb.h lda.h main.h map.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 \
xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
fmt.h gdl.h htb.h lda.h main.h map.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 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/||"`;; \
@ -223,9 +223,9 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkginclude_HEADERS = alg.h chr.h dll.h env.h fio.h fma.h gdl.h htb.h \
lda.h main.h map.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 xma.h \
pkginclude_HEADERS = alg.h chr.h dll.h env.h fio.h fma.h fmt.h gdl.h \
htb.h lda.h main.h map.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 xma.h \
$(am__append_1)
all: all-am

View File

@ -147,6 +147,21 @@ typedef qse_ctype_t qse_wctype_t;
# define QSE_TOLOWER(c) QSE_TOWLOWER(c)
#endif
#define QSE_XDIGITTONUM(c) \
(((c) >= QSE_T('0') && (c) <= QSE_T('9'))? ((c) - QSE_T('0')): \
((c) >= QSE_T('A') && (c) <= QSE_T('F'))? ((c) - QSE_T('A') + 10): \
((c) >= QSE_T('a') && (c) <= QSE_T('f'))? ((c) - QSE_T('a') + 10): -1)
#define QSE_MXDIGITTONUM(c) \
(((c) >= QSE_MT('0') && (c) <= QSE_MT('9'))? ((c) - QSE_MT('0')): \
((c) >= QSE_MT('A') && (c) <= QSE_MT('F'))? ((c) - QSE_MT('A') + 10): \
((c) >= QSE_MT('a') && (c) <= QSE_MT('f'))? ((c) - QSE_MT('a') + 10): -1)
#define QSE_WXDIGITTONUM(c) \
(((c) >= QSE_WT('0') && (c) <= QSE_WT('9'))? ((c) - QSE_WT('0')): \
((c) >= QSE_WT('A') && (c) <= QSE_WT('F'))? ((c) - QSE_WT('A') + 10): \
((c) >= QSE_WT('a') && (c) <= QSE_WT('f'))? ((c) - QSE_WT('a') + 10): -1)
/**
* The qse_mbstate_t type defines a structure large enough to hold
* the standard mbstate_t.

85
qse/include/qse/cmn/fmt.h Normal file
View File

@ -0,0 +1,85 @@
/*
* $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_FMT_H_
#define _QSE_CMN_FMT_H_
#include <qse/types.h>
#include <qse/macros.h>
/** @file
* This file defines various formatting functions.
*/
enum qse_fmtulongtowcs_flag_t
{
QSE_FMTULONGTOWCS_UPPERCASE = (0x100 << 0),
#define QSE_FMTULONGTOWCS_UPPERCASE QSE_FMTULONGTOWCS_UPPERCASE
QSE_FMTULONGTOWCS_FILLRIGHT = (0x100 << 1)
#define QSE_FMTULONGTOWCS_FILLRIGHT QSE_FMTULONGTOWCS_FILLRIGHT
};
enum qse_fmtulongtombs_flag_t
{
QSE_FMTULONGTOMBS_UPPERCASE = (0x100 << 0),
#define QSE_FMTULONGTOMBS_UPPERCASE QSE_FMTULONGTOMBS_UPPERCASE
QSE_FMTULONGTOMBS_FILLRIGHT = (0x100 << 1)
#define QSE_FMTULONGTOMBS_FILLRIGHT QSE_FMTULONGTOMBS_FILLRIGHT
};
#ifdef QSE_CHAR_IS_MCHAR
# define QSE_FMTULONG_UPPERCASE QSE_FMTULONGTOMBS_UPPERCASE
# define QSE_FMTULONG_FILLRIGHT QSE_FMTULONGTOMBS_FILLRIGHT
#else
# define QSE_FMTULONG_UPPERCASE QSE_FMTULONGTOWCS_UPPERCASE
# define QSE_FMTULONG_FILLRIGHT QSE_FMTULONGTOWCS_FILLRIGHT
#endif
#ifdef __cplusplus
extern "C" {
#endif
qse_size_t qse_fmtulongtombs (
qse_mchar_t* buf,
qse_size_t size,
qse_long_t value,
int base_and_flags,
qse_mchar_t fill_char
);
qse_size_t qse_fmtulongtowcs (
qse_wchar_t* buf,
qse_size_t size,
qse_long_t value,
int base_and_flags,
qse_wchar_t fill_char
);
#ifdef QSE_CHAR_IS_MCHAR
# define qse_fmtulong(b,sz,v,bf,fc) qse_fmtulongtombs(b,sz,v,bf,fc)
#else
# define qse_fmtulong(b,sz,v,bf,fc) qse_fmtulongtowcs(b,sz,v,bf,fc)
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -297,7 +297,9 @@ typedef qse_wchar_t* (*qse_wcsxsubst_subst_t) (
enum qse_mbstrmx_op_t
{
QSE_MBSTRMX_LEFT = (1 << 0), /**< trim leading spaces */
#define QSE_MBSTRMX_LEFT QSE_MBSTRMX_LEFT
QSE_MBSTRMX_RIGHT = (1 << 1) /**< trim trailing spaces */
#define QSE_MBSTRMX_RIGHT QSE_MBSTRMX_RIGHT
};
/**
@ -306,7 +308,9 @@ enum qse_mbstrmx_op_t
enum qse_wcstrmx_op_t
{
QSE_WCSTRMX_LEFT = (1 << 0), /**< trim leading spaces */
#define QSE_WCSTRMX_LEFT QSE_WCSTRMX_LEFT
QSE_WCSTRMX_RIGHT = (1 << 1) /**< trim trailing spaces */
#define QSE_WCSTRMX_RIGHT QSE_WCSTRMX_RIGHT
};
#ifdef QSE_CHAR_IS_MCHAR
@ -320,17 +324,25 @@ enum qse_wcstrmx_op_t
enum qse_mbsfnmat_flag_t
{
QSE_MBSFNMAT_PATHNAME = (1 << 0),
#define QSE_MBSFNMAT_PATHNAME QSE_MBSFNMAT_PATHNAME
QSE_MBSFNMAT_NOESCAPE = (1 << 1),
#define QSE_MBSFNMAT_NOESCAPE QSE_MBSFNMAT_NOESCAPE
QSE_MBSFNMAT_PERIOD = (1 << 2),
#define QSE_MBSFNMAT_PERIOD QSE_MBSFNMAT_PERIOD
QSE_MBSFNMAT_IGNORECASE = (1 << 3)
#define QSE_MBSFNMAT_IGNORECASE QSE_MBSFNMAT_IGNORECASE
};
enum qse_wcsfnmat_flag_t
{
QSE_WCSFNMAT_PATHNAME = (1 << 0),
#define QSE_WCSFNMAT_PATHNAME QSE_WCSFNMAT_PATHNAME
QSE_WCSFNMAT_NOESCAPE = (1 << 1),
#define QSE_WCSFNMAT_NOESCAPE QSE_WCSFNMAT_NOESCAPE
QSE_WCSFNMAT_PERIOD = (1 << 2),
#define QSE_WCSFNMAT_PERIOD QSE_WCSFNMAT_PERIOD
QSE_WCSFNMAT_IGNORECASE = (1 << 3)
#define QSE_WCSFNMAT_IGNORECASE QSE_WCSFNMAT_IGNORECASE
};
#ifdef QSE_CHAR_IS_MCHAR

View File

@ -49,13 +49,13 @@ enum qse_dir_ent_flag_t
enum qse_dir_ent_type_t
{
QSE_DIR_ENT_UNKNOWN,
QSE_DIR_ENT_SUBDIR,
QSE_DIR_ENT_REGULAR,
QSE_DIR_ENT_CHRDEV,
QSE_DIR_ENT_BLKDEV,
QSE_DIR_ENT_SYMLINK,
QSE_DIR_ENT_PIPE
QSE_DIR_ENT_UNKNOWN,
QSE_DIR_ENT_SUBDIR,
QSE_DIR_ENT_REGULAR,
QSE_DIR_ENT_CHRDEV,
QSE_DIR_ENT_BLKDEV,
QSE_DIR_ENT_SYMLINK,
QSE_DIR_ENT_PIPE
};
typedef enum qse_dir_ent_type_t qse_dir_ent_type_t;