fixed wrong htb header documentation

This commit is contained in:
hyung-hwan 2016-09-21 10:18:21 +00:00
parent 735183d5a6
commit 1b4479d437
4 changed files with 36 additions and 42 deletions

View File

@ -40,7 +40,7 @@
* @code * @code
* #include <qse/cmn/htb.h> * #include <qse/cmn/htb.h>
* #include <qse/cmn/mem.h> * #include <qse/cmn/mem.h>
* #include <qse/cmn/stdio.h> * #include <qse/si/sio.h>
* *
* static qse_htb_walk_t walk (qse_htb_t* htb, qse_htb_pair_t* pair, void* ctx) * static qse_htb_walk_t walk (qse_htb_t* htb, qse_htb_pair_t* pair, void* ctx)
* { * {
@ -54,6 +54,7 @@
* qse_htb_t* s1; * qse_htb_t* s1;
* int i; * int i;
* *
* qse_openstdsios ();
* s1 = qse_htb_open (QSE_MMGR_GETDFL(), 0, 30, 75, 1, 1); // error handling skipped * s1 = qse_htb_open (QSE_MMGR_GETDFL(), 0, 30, 75, 1, 1); // error handling skipped
* qse_htb_setstyle (s1, qse_gethtbstyle(QSE_HTB_STYLE_INLINE_COPIERS)); * qse_htb_setstyle (s1, qse_gethtbstyle(QSE_HTB_STYLE_INLINE_COPIERS));
* *
@ -66,6 +67,7 @@
* qse_htb_walk (s1, walk, QSE_NULL); * qse_htb_walk (s1, walk, QSE_NULL);
* *
* qse_htb_close (s1); * qse_htb_close (s1);
* qse_closestdsios ();
* return 0; * return 0;
* } * }
* @endcode * @endcode
@ -482,6 +484,10 @@ QSE_EXPORT qse_htb_pair_t* qse_htb_update (
* existing value delimited by a comma if the key is found. * existing value delimited by a comma if the key is found.
* *
* @code * @code
* #include <qse/cmn/htb.h>
* #include <qse/cmn/mem.h>
* #include <qse/si/sio.h>
*
* qse_htb_walk_t print_map_pair (qse_htb_t* map, qse_htb_pair_t* pair, void* ctx) * qse_htb_walk_t print_map_pair (qse_htb_t* map, qse_htb_pair_t* pair, void* ctx)
* { * {
* qse_printf (QSE_T("%.*s[%d] => %.*s[%d]\n"), * qse_printf (QSE_T("%.*s[%d] => %.*s[%d]\n"),
@ -512,13 +518,13 @@ QSE_EXPORT qse_htb_pair_t* qse_htb_update (
* // allocate a new pair, but without filling the actual value. * // allocate a new pair, but without filling the actual value.
* // note vptr is given QSE_NULL for that purpose * // note vptr is given QSE_NULL for that purpose
* new_pair = qse_htb_allocpair ( * new_pair = qse_htb_allocpair (
* htb, kptr, klen, QSE_NULL, pair->vlen + 1 + v->len); * htb, kptr, klen, QSE_NULL, QSE_HTB_VLEN(pair) + 1 + v->len);
* if (new_pair == QSE_NULL) return QSE_NULL; * if (new_pair == QSE_NULL) return QSE_NULL;
* *
* // fill in the value space * // fill in the value space
* vptr = new_pair->vptr; * vptr = QSE_HTB_VPTR(new_pair);
* qse_memcpy (vptr, pair->vptr, pair->vlen*QSE_SIZEOF(qse_char_t)); * qse_memcpy (vptr, QSE_HTB_VPTR(pair), QSE_HTB_VLEN(pair)*QSE_SIZEOF(qse_char_t));
* vptr += pair->vlen*QSE_SIZEOF(qse_char_t); * vptr += QSE_HTB_VLEN(pair)*QSE_SIZEOF(qse_char_t);
* qse_memcpy (vptr, &comma, QSE_SIZEOF(qse_char_t)); * qse_memcpy (vptr, &comma, QSE_SIZEOF(qse_char_t));
* vptr += QSE_SIZEOF(qse_char_t); * vptr += QSE_SIZEOF(qse_char_t);
* qse_memcpy (vptr, v->ptr, v->len*QSE_SIZEOF(qse_char_t)); * qse_memcpy (vptr, v->ptr, v->len*QSE_SIZEOF(qse_char_t));
@ -538,11 +544,12 @@ QSE_EXPORT qse_htb_pair_t* qse_htb_update (
* qse_char_t* keys[] = { QSE_T("one"), QSE_T("two"), QSE_T("three") }; * qse_char_t* keys[] = { QSE_T("one"), QSE_T("two"), QSE_T("three") };
* qse_char_t* vals[] = { QSE_T("1"), QSE_T("2"), QSE_T("3"), QSE_T("4"), QSE_T("5") }; * qse_char_t* vals[] = { QSE_T("1"), QSE_T("2"), QSE_T("3"), QSE_T("4"), QSE_T("5") };
* *
* qse_openstdsios ();
* s1 = qse_htb_open ( * s1 = qse_htb_open (
* QSE_MMGR_GETDFL(), 0, 10, 70, * QSE_MMGR_GETDFL(), 0, 10, 70,
* QSE_SIZEOF(qse_char_t), QSE_SIZEOF(qse_char_t) * QSE_SIZEOF(qse_char_t), QSE_SIZEOF(qse_char_t)
* ); // note error check is skipped * ); // note error check is skipped
* qse_htb_setstyle (s1, &style1); * qse_htb_setstyle (s1, qse_gethtbstyle(QSE_HTB_STYLE_INLINE_COPIERS));
* *
* for (i = 0; i < QSE_COUNTOF(vals); i++) * for (i = 0; i < QSE_COUNTOF(vals); i++)
* { * {
@ -556,6 +563,7 @@ QSE_EXPORT qse_htb_pair_t* qse_htb_update (
* qse_htb_walk (s1, print_map_pair, QSE_NULL); * qse_htb_walk (s1, print_map_pair, QSE_NULL);
* *
* qse_htb_close (s1); * qse_htb_close (s1);
* qse_closestdsios ();
* return 0; * return 0;
* } * }
* @endcode * @endcode

View File

@ -1,9 +1,9 @@
pkgincludedir = $(includedir)/qse/sys pkgincludedir = $(includedir)/qse/si
pkginclude_HEADERS = \ pkginclude_HEADERS = \
aio.h \ aio.h \
aio-pro.h \ aio-pro.h \
aio-sck.h aio-sck.h \
cnd.h \ cnd.h \
dir.h \ dir.h \
fio.h \ fio.h \

View File

@ -118,8 +118,10 @@ am__can_run_installinfo = \
n|no|NO) false;; \ n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \ *) (install-info --version) >/dev/null 2>&1;; \
esac esac
am__pkginclude_HEADERS_DIST = aio.h aio-pro.h aio-sck.h \ am__pkginclude_HEADERS_DIST = aio.h aio-pro.h aio-sck.h cnd.h dir.h \
SocketAddress.hpp Socket.hpp fio.h fs.h glob.h intr.h mtx.h mux.h nwad.h nwif.h nwio.h \
pio.h rwl.h sck.h sio.h task.h thr.h tio.h SocketAddress.hpp \
Socket.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/||"`;; \
@ -169,7 +171,7 @@ am__define_uniq_tagged_files = \
ETAGS = etags ETAGS = etags
CTAGS = ctags CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = $(includedir)/qse/sys pkgincludedir = $(includedir)/qse/si
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
@ -345,7 +347,9 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
pkginclude_HEADERS = aio.h aio-pro.h aio-sck.h $(am__append_1) pkginclude_HEADERS = aio.h aio-pro.h aio-sck.h cnd.h dir.h fio.h fs.h \
glob.h intr.h mtx.h mux.h nwad.h nwif.h nwio.h pio.h rwl.h \
sck.h sio.h task.h thr.h tio.h $(am__append_1)
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -608,24 +612,6 @@ uninstall-am: uninstall-pkgincludeHEADERS
ps ps-am tags tags-am uninstall uninstall-am \ ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkgincludeHEADERS uninstall-pkgincludeHEADERS
cnd.h \
dir.h \
fio.h \
fs.h \
glob.h \
intr.h \
mtx.h \
mux.h \
nwad.h \
nwif.h \
nwio.h \
pio.h \
rwl.h \
sck.h \
sio.h \
task.h \
thr.h \
tio.h
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -377,7 +377,7 @@ reswitch:
case T('c'): case T('c'):
/* zerpad must not take effect for 'c' */ /* zerpad must not take effect for 'c' */
if (flagc & FLAGC_ZEROPAD) padc = QSE_T(' '); if (flagc & FLAGC_ZEROPAD) padc = T(' ');
if (((lm_flag & LF_H) && (QSE_SIZEOF(char_t) > QSE_SIZEOF(ochar_t))) || if (((lm_flag & LF_H) && (QSE_SIZEOF(char_t) > QSE_SIZEOF(ochar_t))) ||
((lm_flag & LF_L) && (QSE_SIZEOF(char_t) < QSE_SIZEOF(ochar_t)))) goto uppercase_c; ((lm_flag & LF_L) && (QSE_SIZEOF(char_t) < QSE_SIZEOF(ochar_t)))) goto uppercase_c;
lowercase_c: lowercase_c:
@ -399,7 +399,7 @@ reswitch:
case T('C'): case T('C'):
/* zerpad must not take effect for 'C' */ /* zerpad must not take effect for 'C' */
if (flagc & FLAGC_ZEROPAD) padc = QSE_T(' '); if (flagc & FLAGC_ZEROPAD) padc = T(' ');
if (((lm_flag & LF_H) && (QSE_SIZEOF(char_t) < QSE_SIZEOF(ochar_t))) || if (((lm_flag & LF_H) && (QSE_SIZEOF(char_t) < QSE_SIZEOF(ochar_t))) ||
((lm_flag & LF_L) && (QSE_SIZEOF(char_t) > QSE_SIZEOF(ochar_t)))) goto lowercase_c; ((lm_flag & LF_L) && (QSE_SIZEOF(char_t) > QSE_SIZEOF(ochar_t)))) goto lowercase_c;
uppercase_c: uppercase_c:
@ -443,7 +443,7 @@ reswitch:
case T('s'): case T('s'):
/* zerpad must not take effect for 's' */ /* zerpad must not take effect for 's' */
if (flagc & FLAGC_ZEROPAD) padc = QSE_T(' '); if (flagc & FLAGC_ZEROPAD) padc = T(' ');
if (((lm_flag & LF_H) && (QSE_SIZEOF(char_t) > QSE_SIZEOF(ochar_t))) || if (((lm_flag & LF_H) && (QSE_SIZEOF(char_t) > QSE_SIZEOF(ochar_t))) ||
((lm_flag & LF_L) && (QSE_SIZEOF(char_t) < QSE_SIZEOF(ochar_t)))) goto uppercase_s; ((lm_flag & LF_L) && (QSE_SIZEOF(char_t) < QSE_SIZEOF(ochar_t)))) goto uppercase_s;
lowercase_s: lowercase_s:
@ -475,7 +475,7 @@ reswitch:
case T('S'): case T('S'):
/* zerpad must not take effect for 'S' */ /* zerpad must not take effect for 'S' */
if (flagc & FLAGC_ZEROPAD) padc = QSE_T(' '); if (flagc & FLAGC_ZEROPAD) padc = T(' ');
if (((lm_flag & LF_H) && (QSE_SIZEOF(char_t) < QSE_SIZEOF(ochar_t))) || if (((lm_flag & LF_H) && (QSE_SIZEOF(char_t) < QSE_SIZEOF(ochar_t))) ||
((lm_flag & LF_L) && (QSE_SIZEOF(char_t) > QSE_SIZEOF(ochar_t)))) goto lowercase_s; ((lm_flag & LF_L) && (QSE_SIZEOF(char_t) > QSE_SIZEOF(ochar_t)))) goto lowercase_s;
uppercase_s: uppercase_s:
@ -636,21 +636,21 @@ reswitch:
/* compose back the format specifier */ /* compose back the format specifier */
fmtlen = 0; fmtlen = 0;
fltfmt.ptr[fmtlen++] = QSE_MT('%'); fltfmt.ptr[fmtlen++] = QSE_MT('%');
if (flagc & FLAGC_SPACE) fltfmt.ptr[fmtlen++] = QSE_T(' '); if (flagc & FLAGC_SPACE) fltfmt.ptr[fmtlen++] = QSE_MT(' ');
if (flagc & FLAGC_SHARP) fltfmt.ptr[fmtlen++] = QSE_T('#'); if (flagc & FLAGC_SHARP) fltfmt.ptr[fmtlen++] = QSE_MT('#');
if (flagc & FLAGC_SIGN) fltfmt.ptr[fmtlen++] = QSE_T('+'); if (flagc & FLAGC_SIGN) fltfmt.ptr[fmtlen++] = QSE_MT('+');
if (flagc & FLAGC_LEFTADJ) fltfmt.ptr[fmtlen++] = QSE_T('-'); if (flagc & FLAGC_LEFTADJ) fltfmt.ptr[fmtlen++] = QSE_MT('-');
if (flagc & FLAGC_ZEROPAD) fltfmt.ptr[fmtlen++] = QSE_T('0'); if (flagc & FLAGC_ZEROPAD) fltfmt.ptr[fmtlen++] = QSE_MT('0');
if (flagc & FLAGC_STAR1) fltfmt.ptr[fmtlen++] = QSE_T('*'); if (flagc & FLAGC_STAR1) fltfmt.ptr[fmtlen++] = QSE_MT('*');
else if (flagc & FLAGC_WIDTH) else if (flagc & FLAGC_WIDTH)
{ {
fmtlen += qse_fmtuintmaxtombs ( fmtlen += qse_fmtuintmaxtombs (
&fltfmt.ptr[fmtlen], fltfmt.capa - fmtlen, &fltfmt.ptr[fmtlen], fltfmt.capa - fmtlen,
width, 10, -1, QSE_MT('\0'), QSE_NULL); width, 10, -1, QSE_MT('\0'), QSE_NULL);
} }
if (flagc & FLAGC_DOT) fltfmt.ptr[fmtlen++] = QSE_T('.'); if (flagc & FLAGC_DOT) fltfmt.ptr[fmtlen++] = QSE_MT('.');
if (flagc & FLAGC_STAR2) fltfmt.ptr[fmtlen++] = QSE_T('*'); if (flagc & FLAGC_STAR2) fltfmt.ptr[fmtlen++] = QSE_MT('*');
else if (flagc & FLAGC_PRECISION) else if (flagc & FLAGC_PRECISION)
{ {
fmtlen += qse_fmtuintmaxtombs ( fmtlen += qse_fmtuintmaxtombs (