diff --git a/hio/lib/hio-utl.h b/hio/lib/hio-utl.h index acc67b0..71c3210 100644 --- a/hio/lib/hio-utl.h +++ b/hio/lib/hio-utl.h @@ -446,6 +446,34 @@ HIO_EXPORT hio_oow_t hio_copy_bcstr_unlimited ( const hio_bch_t* src ); +HIO_EXPORT hio_oow_t hio_copy_fmt_ucstrs_to_ucstr ( + hio_uch_t* buf, + hio_oow_t bsz, + const hio_uch_t* fmt, + const hio_uch_t* str[] +); + +HIO_EXPORT hio_oow_t hio_copy_fmt_bcstrs_to_bcstr ( + hio_bch_t* buf, + hio_oow_t bsz, + const hio_bch_t* fmt, + const hio_bch_t* str[] +); + +HIO_EXPORT hio_oow_t hio_copy_fmt_ucses_to_ucstr ( + hio_uch_t* buf, + hio_oow_t bsz, + const hio_uch_t* fmt, + const hio_ucs_t str[] +); + +HIO_EXPORT hio_oow_t hio_copy_fmt_bcses_to_bcstr ( + hio_bch_t* buf, + hio_oow_t bsz, + const hio_bch_t* fmt, + const hio_bcs_t str[] +); + /* ------------------------------------ */ HIO_EXPORT hio_oow_t hio_count_ucstr ( @@ -456,6 +484,16 @@ HIO_EXPORT hio_oow_t hio_count_bcstr ( const hio_bch_t* str ); +HIO_EXPORT hio_oow_t hio_count_ucstr_limited ( + const hio_uch_t* str, + hio_oow_t maxlen +); + +HIO_EXPORT hio_oow_t hio_count_bcstr_limited ( + const hio_bch_t* str, + hio_oow_t maxlen +); + /* ------------------------------------ */ /** @@ -489,6 +527,8 @@ HIO_EXPORT void hio_fill_bchars ( hio_oow_t len ); +/* ------------------------------------ */ + HIO_EXPORT const hio_bch_t* hio_find_bcstr_word_in_bcstr ( const hio_bch_t* str, const hio_bch_t* word, @@ -503,25 +543,25 @@ HIO_EXPORT const hio_uch_t* hio_find_ucstr_word_in_ucstr ( int ignorecase ); -HIO_EXPORT hio_uch_t* hio_find_uchar ( +HIO_EXPORT hio_uch_t* hio_find_uchar_in_chars ( const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c ); -HIO_EXPORT hio_bch_t* hio_find_bchar ( +HIO_EXPORT hio_bch_t* hio_find_bchar_in_chars ( const hio_bch_t* ptr, hio_oow_t len, hio_bch_t c ); -HIO_EXPORT hio_uch_t* hio_rfind_uchar ( +HIO_EXPORT hio_uch_t* hio_rfind_uchar_in_chars ( const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c ); -HIO_EXPORT hio_bch_t* hio_rfind_bchar ( +HIO_EXPORT hio_bch_t* hio_rfind_bchar_in_chars ( const hio_bch_t* ptr, hio_oow_t len, hio_bch_t c @@ -537,6 +577,8 @@ HIO_EXPORT hio_bch_t* hio_find_bchar_in_bcstr ( hio_bch_t c ); +/* ------------------------------------ */ + HIO_EXPORT hio_oow_t hio_rotate_uchars ( hio_uch_t* str, hio_oow_t len, @@ -583,6 +625,8 @@ HIO_EXPORT int hio_split_bcstr ( #if defined(HIO_OOCH_IS_UCH) # define hio_count_oocstr hio_count_ucstr +# define hio_count_oocstr_limited hio_count_ucstr_limited + # define hio_equal_oochars hio_equal_uchars # define hio_comp_oochars hio_comp_uchars # define hio_comp_oocstr_bcstr hio_comp_ucstr_bcstr @@ -601,20 +645,24 @@ HIO_EXPORT int hio_split_bcstr ( # define hio_copy_oochars_to_oocstr_unlimited hio_copy_uchars_to_ucstr_unlimited # define hio_copy_oocstr hio_copy_ucstr # define hio_copy_oocstr_unlimited hio_copy_ucstr_unlimited +# define hio_copy_fmt_oocses_to_oocstr hio_copy_fmt_ucses_to_ucstr +# define hio_copy_fmt_oocstr_to_oocstr hio_copy_fmt_ucstr_to_ucstr # define hio_concat_oochars_to_ucstr hio_concat_uchars_to_ucstr # define hio_concat_oocstr hio_concat_ucstr # define hio_fill_oochars hio_fill_uchars # define hio_find_oocstr_word_in_oocstr hio_find_ucstr_word_in_ucstr -# define hio_find_oochar hio_find_uchar -# define hio_rfind_oochar hio_rfind_uchar +# define hio_find_oochar_in_oochars hio_find_uchar_in_uchars +# define hio_rfind_oochar_in_oochars hio_rfind_uchar_in_uchars # define hio_find_oochar_in_oocstr hio_find_uchar_in_ucstr # define hio_trim_oochars hio_trim_uchars # define hio_split_oocstr hio_split_ucstr #else # define hio_count_oocstr hio_count_bcstr +# define hio_count_oocstr_limited hio_count_bcstr_limited + # define hio_equal_oochars hio_equal_bchars # define hio_comp_oochars hio_comp_bchars # define hio_comp_oocstr_bcstr hio_comp_bcstr @@ -633,14 +681,16 @@ HIO_EXPORT int hio_split_bcstr ( # define hio_copy_oochars_to_oocstr_unlimited hio_copy_bchars_to_bcstr_unlimited # define hio_copy_oocstr hio_copy_bcstr # define hio_copy_oocstr_unlimited hio_copy_bcstr_unlimited +# define hio_copy_fmt_oocses_to_oocstr hio_copy_fmt_bcses_to_bcstr +# define hio_copy_fmt_oocstr_to_oocstr hio_copy_fmt_bcstr_to_bcstr # define hio_concat_oochars_to_bcstr hio_concat_bchars_to_bcstr # define hio_concat_oocstr hio_concat_bcstr # define hio_fill_oochars hio_fill_bchars # define hio_find_oocstr_word_in_oocstr hio_find_bcstr_word_in_bcstr -# define hio_find_oochar hio_find_bchar -# define hio_rfind_oochar hio_rfind_bchar +# define hio_find_oochar_in_oochars hio_find_bchar_in_bchars +# define hio_rfind_oochar_in_oochars hio_rfind_bchar_in_bchars # define hio_find_oochar_in_oocstr hio_find_bchar_in_bcstr # define hio_trim_oochars hio_trim_bchars diff --git a/hio/lib/hio-utl.h.m4 b/hio/lib/hio-utl.h.m4 index c12eaaa..a6ceadc 100644 --- a/hio/lib/hio-utl.h.m4 +++ b/hio/lib/hio-utl.h.m4 @@ -447,6 +447,34 @@ HIO_EXPORT hio_oow_t hio_copy_bcstr_unlimited ( const hio_bch_t* src ); +HIO_EXPORT hio_oow_t hio_copy_fmt_ucstrs_to_ucstr ( + hio_uch_t* buf, + hio_oow_t bsz, + const hio_uch_t* fmt, + const hio_uch_t* str[] +); + +HIO_EXPORT hio_oow_t hio_copy_fmt_bcstrs_to_bcstr ( + hio_bch_t* buf, + hio_oow_t bsz, + const hio_bch_t* fmt, + const hio_bch_t* str[] +); + +HIO_EXPORT hio_oow_t hio_copy_fmt_ucses_to_ucstr ( + hio_uch_t* buf, + hio_oow_t bsz, + const hio_uch_t* fmt, + const hio_ucs_t str[] +); + +HIO_EXPORT hio_oow_t hio_copy_fmt_bcses_to_bcstr ( + hio_bch_t* buf, + hio_oow_t bsz, + const hio_bch_t* fmt, + const hio_bcs_t str[] +); + /* ------------------------------------ */ HIO_EXPORT hio_oow_t hio_count_ucstr ( @@ -457,6 +485,16 @@ HIO_EXPORT hio_oow_t hio_count_bcstr ( const hio_bch_t* str ); +HIO_EXPORT hio_oow_t hio_count_ucstr_limited ( + const hio_uch_t* str, + hio_oow_t maxlen +); + +HIO_EXPORT hio_oow_t hio_count_bcstr_limited ( + const hio_bch_t* str, + hio_oow_t maxlen +); + /* ------------------------------------ */ /** @@ -490,6 +528,8 @@ HIO_EXPORT void hio_fill_bchars ( hio_oow_t len ); +/* ------------------------------------ */ + HIO_EXPORT const hio_bch_t* hio_find_bcstr_word_in_bcstr ( const hio_bch_t* str, const hio_bch_t* word, @@ -504,25 +544,25 @@ HIO_EXPORT const hio_uch_t* hio_find_ucstr_word_in_ucstr ( int ignorecase ); -HIO_EXPORT hio_uch_t* hio_find_uchar ( +HIO_EXPORT hio_uch_t* hio_find_uchar_in_chars ( const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c ); -HIO_EXPORT hio_bch_t* hio_find_bchar ( +HIO_EXPORT hio_bch_t* hio_find_bchar_in_chars ( const hio_bch_t* ptr, hio_oow_t len, hio_bch_t c ); -HIO_EXPORT hio_uch_t* hio_rfind_uchar ( +HIO_EXPORT hio_uch_t* hio_rfind_uchar_in_chars ( const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c ); -HIO_EXPORT hio_bch_t* hio_rfind_bchar ( +HIO_EXPORT hio_bch_t* hio_rfind_bchar_in_chars ( const hio_bch_t* ptr, hio_oow_t len, hio_bch_t c @@ -538,6 +578,8 @@ HIO_EXPORT hio_bch_t* hio_find_bchar_in_bcstr ( hio_bch_t c ); +/* ------------------------------------ */ + HIO_EXPORT hio_oow_t hio_rotate_uchars ( hio_uch_t* str, hio_oow_t len, @@ -584,6 +626,8 @@ HIO_EXPORT int hio_split_bcstr ( #if defined(HIO_OOCH_IS_UCH) # define hio_count_oocstr hio_count_ucstr +# define hio_count_oocstr_limited hio_count_ucstr_limited + # define hio_equal_oochars hio_equal_uchars # define hio_comp_oochars hio_comp_uchars # define hio_comp_oocstr_bcstr hio_comp_ucstr_bcstr @@ -602,20 +646,24 @@ HIO_EXPORT int hio_split_bcstr ( # define hio_copy_oochars_to_oocstr_unlimited hio_copy_uchars_to_ucstr_unlimited # define hio_copy_oocstr hio_copy_ucstr # define hio_copy_oocstr_unlimited hio_copy_ucstr_unlimited +# define hio_copy_fmt_oocses_to_oocstr hio_copy_fmt_ucses_to_ucstr +# define hio_copy_fmt_oocstr_to_oocstr hio_copy_fmt_ucstr_to_ucstr # define hio_concat_oochars_to_ucstr hio_concat_uchars_to_ucstr # define hio_concat_oocstr hio_concat_ucstr # define hio_fill_oochars hio_fill_uchars # define hio_find_oocstr_word_in_oocstr hio_find_ucstr_word_in_ucstr -# define hio_find_oochar hio_find_uchar -# define hio_rfind_oochar hio_rfind_uchar +# define hio_find_oochar_in_oochars hio_find_uchar_in_uchars +# define hio_rfind_oochar_in_oochars hio_rfind_uchar_in_uchars # define hio_find_oochar_in_oocstr hio_find_uchar_in_ucstr # define hio_trim_oochars hio_trim_uchars # define hio_split_oocstr hio_split_ucstr #else # define hio_count_oocstr hio_count_bcstr +# define hio_count_oocstr_limited hio_count_bcstr_limited + # define hio_equal_oochars hio_equal_bchars # define hio_comp_oochars hio_comp_bchars # define hio_comp_oocstr_bcstr hio_comp_bcstr @@ -634,14 +682,16 @@ HIO_EXPORT int hio_split_bcstr ( # define hio_copy_oochars_to_oocstr_unlimited hio_copy_bchars_to_bcstr_unlimited # define hio_copy_oocstr hio_copy_bcstr # define hio_copy_oocstr_unlimited hio_copy_bcstr_unlimited +# define hio_copy_fmt_oocses_to_oocstr hio_copy_fmt_bcses_to_bcstr +# define hio_copy_fmt_oocstr_to_oocstr hio_copy_fmt_bcstr_to_bcstr # define hio_concat_oochars_to_bcstr hio_concat_bchars_to_bcstr # define hio_concat_oocstr hio_concat_bcstr # define hio_fill_oochars hio_fill_bchars # define hio_find_oocstr_word_in_oocstr hio_find_bcstr_word_in_bcstr -# define hio_find_oochar hio_find_bchar -# define hio_rfind_oochar hio_rfind_bchar +# define hio_find_oochar_in_oochars hio_find_bchar_in_bchars +# define hio_rfind_oochar_in_oochars hio_rfind_bchar_in_bchars # define hio_find_oochar_in_oocstr hio_find_bchar_in_bcstr # define hio_trim_oochars hio_trim_bchars diff --git a/hio/lib/utl-str.c b/hio/lib/utl-str.c index 20c6384..ceb23ec 100644 --- a/hio/lib/utl-str.c +++ b/hio/lib/utl-str.c @@ -759,7 +759,7 @@ hio_oow_t hio_count_ucstr_limited (const hio_uch_t* str, hio_oow_t maxlen) return i; } -hio_oow_t hio_count_bcstr_limited (const hio_uch_t* str, hio_oow_t maxlen) +hio_oow_t hio_count_bcstr_limited (const hio_bch_t* str, hio_oow_t maxlen) { hio_oow_t i; for (i = 0; i < maxlen; i++) @@ -811,7 +811,7 @@ void hio_fill_bchars (hio_bch_t* dst, hio_bch_t ch, hio_oow_t len) for (i = 0; i < len; i++) dst[i] = ch; } -hio_uch_t* hio_find_uchar (const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c) +hio_uch_t* hio_find_uchar_in_uchars (const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c) { const hio_uch_t* end; @@ -825,7 +825,7 @@ hio_uch_t* hio_find_uchar (const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c) return HIO_NULL; } -hio_bch_t* hio_find_bchar (const hio_bch_t* ptr, hio_oow_t len, hio_bch_t c) +hio_bch_t* hio_find_bchar_in_bchars (const hio_bch_t* ptr, hio_oow_t len, hio_bch_t c) { const hio_bch_t* end; @@ -839,7 +839,7 @@ hio_bch_t* hio_find_bchar (const hio_bch_t* ptr, hio_oow_t len, hio_bch_t c) return HIO_NULL; } -hio_uch_t* hio_rfind_uchar (const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c) +hio_uch_t* hio_rfind_uchar_in_uchars (const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c) { const hio_uch_t* cur; @@ -853,7 +853,7 @@ hio_uch_t* hio_rfind_uchar (const hio_uch_t* ptr, hio_oow_t len, hio_uch_t c) return HIO_NULL; } -hio_bch_t* hio_rfind_bchar (const hio_bch_t* ptr, hio_oow_t len, hio_bch_t c) +hio_bch_t* hio_rfind_bchar_in_bchars (const hio_bch_t* ptr, hio_oow_t len, hio_bch_t c) { const hio_bch_t* cur; diff --git a/hio/lib/utl-str.c.m4 b/hio/lib/utl-str.c.m4 index 5e64a8d..197e4cf 100644 --- a/hio/lib/utl-str.c.m4 +++ b/hio/lib/utl-str.c.m4 @@ -90,11 +90,11 @@ dnl -- fn_fill_chars(hio_fill_uchars, hio_uch_t) fn_fill_chars(hio_fill_bchars, hio_bch_t) dnl -- -fn_find_char_in_chars(hio_find_uchar, hio_uch_t) -fn_find_char_in_chars(hio_find_bchar, hio_bch_t) +fn_find_char_in_chars(hio_find_uchar_in_uchars, hio_uch_t) +fn_find_char_in_chars(hio_find_bchar_in_bchars, hio_bch_t) dnl -- -fn_rfind_char_in_chars(hio_rfind_uchar, hio_uch_t) -fn_rfind_char_in_chars(hio_rfind_bchar, hio_bch_t) +fn_rfind_char_in_chars(hio_rfind_uchar_in_uchars, hio_uch_t) +fn_rfind_char_in_chars(hio_rfind_bchar_in_bchars, hio_bch_t) dnl -- fn_find_char_in_cstr(hio_find_uchar_in_ucstr, hio_uch_t) fn_find_char_in_cstr(hio_find_bchar_in_bcstr, hio_bch_t) diff --git a/hio/lib/utl-str.m4 b/hio/lib/utl-str.m4 index 3e0eb13..f34942d 100644 --- a/hio/lib/utl-str.m4 +++ b/hio/lib/utl-str.m4 @@ -406,7 +406,7 @@ popdef([[_fn_name_]])popdef([[_char_type_]])dnl ]])dnl dnl --------------------------------------------------------------------------- define([[fn_count_cstr_limited]], [[pushdef([[_fn_name_]], $1)pushdef([[_char_type_]], $2)dnl -hio_oow_t _fn_name_ (const hio_uch_t* str, hio_oow_t maxlen) +hio_oow_t _fn_name_ (const _char_type_* str, hio_oow_t maxlen) { hio_oow_t i; for (i = 0; i < maxlen; i++)