reorganizing some string functions

This commit is contained in:
hyung-hwan 2022-06-13 13:55:22 +00:00
parent d2564be683
commit 34d52e208b
6 changed files with 1359 additions and 1298 deletions

View File

@ -129,6 +129,7 @@ libhawk_la_SOURCES = \
utl-sort.c \ utl-sort.c \
utl-str.c \ utl-str.c \
utl-sys.c \ utl-sys.c \
utl-xstr.c \
utl.c \ utl.c \
val-prv.h \ val-prv.h \
val.c \ val.c \

View File

@ -242,12 +242,12 @@ am__libhawk_la_SOURCES_DIST = hawk.h hawk-arr.h hawk-chr.h hawk-cmn.h \
tre-match-ut.h tre-mem.c tre-mem.h tre-parse.c tre-parse.h \ tre-match-ut.h tre-mem.c tre-mem.h tre-parse.c tre-parse.h \
tre-stack.h tre-stack.c tre.c tree-prv.h tree.c uch-prop.h \ tre-stack.h tre-stack.c tre.c tree-prv.h tree.c uch-prop.h \
uch-case.h utf16.c utf8.c utl-ass.c utl-cmgr.c utl-rnd.c \ uch-case.h utf16.c utf8.c utl-ass.c utl-cmgr.c utl-rnd.c \
utl-sort.c utl-str.c utl-sys.c utl.c val-prv.h val.c xma.c \ utl-sort.c utl-str.c utl-sys.c utl-xstr.c utl.c val-prv.h \
hawk-cli.h hawk-fio.h hawk-mtx.h hawk-pio.h hawk-sio.h \ val.c xma.c hawk-cli.h hawk-fio.h hawk-mtx.h hawk-pio.h \
hawk-tio.h cli-imp.h cli.c fio.c mtx.c pio.c sio.c syscall.h \ hawk-sio.h hawk-tio.h cli-imp.h cli.c fio.c mtx.c pio.c sio.c \
tio.c std.c std-sed.c Hawk.cpp Std.cpp Sed.cpp Std-Sed.cpp \ syscall.h tio.c std.c std-sed.c Hawk.cpp Std.cpp Sed.cpp \
mod-hawk.c mod-hawk.h mod-math.c mod-math.h mod-str.c \ Std-Sed.cpp mod-hawk.c mod-hawk.h mod-math.c mod-math.h \
mod-str.h mod-sys.c mod-sys.h mod-str.c mod-str.h mod-sys.c mod-sys.h
am__objects_1 = am__objects_1 =
am__objects_2 = $(am__objects_1) am__objects_2 = $(am__objects_1)
@ENABLE_CXX_TRUE@am__objects_3 = libhawk_la-Hawk.lo libhawk_la-Std.lo \ @ENABLE_CXX_TRUE@am__objects_3 = libhawk_la-Hawk.lo libhawk_la-Std.lo \
@ -272,11 +272,11 @@ am_libhawk_la_OBJECTS = $(am__objects_2) libhawk_la-arr.lo \
libhawk_la-utf8.lo libhawk_la-utl-ass.lo \ libhawk_la-utf8.lo libhawk_la-utl-ass.lo \
libhawk_la-utl-cmgr.lo libhawk_la-utl-rnd.lo \ libhawk_la-utl-cmgr.lo libhawk_la-utl-rnd.lo \
libhawk_la-utl-sort.lo libhawk_la-utl-str.lo \ libhawk_la-utl-sort.lo libhawk_la-utl-str.lo \
libhawk_la-utl-sys.lo libhawk_la-utl.lo libhawk_la-val.lo \ libhawk_la-utl-sys.lo libhawk_la-utl-xstr.lo libhawk_la-utl.lo \
libhawk_la-xma.lo libhawk_la-cli.lo libhawk_la-fio.lo \ libhawk_la-val.lo libhawk_la-xma.lo libhawk_la-cli.lo \
libhawk_la-mtx.lo libhawk_la-pio.lo libhawk_la-sio.lo \ libhawk_la-fio.lo libhawk_la-mtx.lo libhawk_la-pio.lo \
libhawk_la-tio.lo libhawk_la-std.lo libhawk_la-std-sed.lo \ libhawk_la-sio.lo libhawk_la-tio.lo libhawk_la-std.lo \
$(am__objects_3) $(am__objects_4) libhawk_la-std-sed.lo $(am__objects_3) $(am__objects_4)
libhawk_la_OBJECTS = $(am_libhawk_la_OBJECTS) libhawk_la_OBJECTS = $(am_libhawk_la_OBJECTS)
AM_V_P = $(am__v_P_@AM_V@) AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@ -335,6 +335,7 @@ am__depfiles_remade = ./$(DEPDIR)/libhawk_hawk_la-mod-hawk.Plo \
./$(DEPDIR)/libhawk_la-utl-sort.Plo \ ./$(DEPDIR)/libhawk_la-utl-sort.Plo \
./$(DEPDIR)/libhawk_la-utl-str.Plo \ ./$(DEPDIR)/libhawk_la-utl-str.Plo \
./$(DEPDIR)/libhawk_la-utl-sys.Plo \ ./$(DEPDIR)/libhawk_la-utl-sys.Plo \
./$(DEPDIR)/libhawk_la-utl-xstr.Plo \
./$(DEPDIR)/libhawk_la-utl.Plo ./$(DEPDIR)/libhawk_la-val.Plo \ ./$(DEPDIR)/libhawk_la-utl.Plo ./$(DEPDIR)/libhawk_la-val.Plo \
./$(DEPDIR)/libhawk_la-xma.Plo \ ./$(DEPDIR)/libhawk_la-xma.Plo \
./$(DEPDIR)/libhawk_math_la-mod-math.Plo \ ./$(DEPDIR)/libhawk_math_la-mod-math.Plo \
@ -617,10 +618,11 @@ libhawk_la_SOURCES = $(pkginclude_HEADERS) arr.c chr.c dir.c ecs-imp.h \
tre-match-ut.h tre-mem.c tre-mem.h tre-parse.c tre-parse.h \ tre-match-ut.h tre-mem.c tre-mem.h tre-parse.c tre-parse.h \
tre-stack.h tre-stack.c tre.c tree-prv.h tree.c uch-prop.h \ tre-stack.h tre-stack.c tre.c tree-prv.h tree.c uch-prop.h \
uch-case.h utf16.c utf8.c utl-ass.c utl-cmgr.c utl-rnd.c \ uch-case.h utf16.c utf8.c utl-ass.c utl-cmgr.c utl-rnd.c \
utl-sort.c utl-str.c utl-sys.c utl.c val-prv.h val.c xma.c \ utl-sort.c utl-str.c utl-sys.c utl-xstr.c utl.c val-prv.h \
hawk-cli.h hawk-fio.h hawk-mtx.h hawk-pio.h hawk-sio.h \ val.c xma.c hawk-cli.h hawk-fio.h hawk-mtx.h hawk-pio.h \
hawk-tio.h cli-imp.h cli.c fio.c mtx.c pio.c sio.c syscall.h \ hawk-sio.h hawk-tio.h cli-imp.h cli.c fio.c mtx.c pio.c sio.c \
tio.c std.c std-sed.c $(am__append_8) $(am__append_9) syscall.h tio.c std.c std-sed.c $(am__append_8) \
$(am__append_9)
libhawk_la_CPPFLAGS = $(CPPFLAGS_ALL_COMMON) $(CPPFLAGS_PFMOD) \ libhawk_la_CPPFLAGS = $(CPPFLAGS_ALL_COMMON) $(CPPFLAGS_PFMOD) \
$(am__append_3) $(am__append_3)
libhawk_la_CFLAGS = $(CFLAGS_ALL_COMMON) libhawk_la_CFLAGS = $(CFLAGS_ALL_COMMON)
@ -835,6 +837,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-utl-sort.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-utl-sort.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-utl-str.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-utl-str.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-utl-sys.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-utl-sys.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-utl-xstr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-utl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-utl.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-val.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-val.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-xma.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_la-xma.Plo@am__quote@ # am--include-marker
@ -1173,6 +1176,13 @@ libhawk_la-utl-sys.lo: utl-sys.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_la_CFLAGS) $(CFLAGS) -c -o libhawk_la-utl-sys.lo `test -f 'utl-sys.c' || echo '$(srcdir)/'`utl-sys.c @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_la_CFLAGS) $(CFLAGS) -c -o libhawk_la-utl-sys.lo `test -f 'utl-sys.c' || echo '$(srcdir)/'`utl-sys.c
libhawk_la-utl-xstr.lo: utl-xstr.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_la_CFLAGS) $(CFLAGS) -MT libhawk_la-utl-xstr.lo -MD -MP -MF $(DEPDIR)/libhawk_la-utl-xstr.Tpo -c -o libhawk_la-utl-xstr.lo `test -f 'utl-xstr.c' || echo '$(srcdir)/'`utl-xstr.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhawk_la-utl-xstr.Tpo $(DEPDIR)/libhawk_la-utl-xstr.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utl-xstr.c' object='libhawk_la-utl-xstr.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_la_CFLAGS) $(CFLAGS) -c -o libhawk_la-utl-xstr.lo `test -f 'utl-xstr.c' || echo '$(srcdir)/'`utl-xstr.c
libhawk_la-utl.lo: utl.c libhawk_la-utl.lo: utl.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_la_CFLAGS) $(CFLAGS) -MT libhawk_la-utl.lo -MD -MP -MF $(DEPDIR)/libhawk_la-utl.Tpo -c -o libhawk_la-utl.lo `test -f 'utl.c' || echo '$(srcdir)/'`utl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_la_CFLAGS) $(CFLAGS) -MT libhawk_la-utl.lo -MD -MP -MF $(DEPDIR)/libhawk_la-utl.Tpo -c -o libhawk_la-utl.lo `test -f 'utl.c' || echo '$(srcdir)/'`utl.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhawk_la-utl.Tpo $(DEPDIR)/libhawk_la-utl.Plo @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhawk_la-utl.Tpo $(DEPDIR)/libhawk_la-utl.Plo
@ -1541,6 +1551,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/libhawk_la-utl-sort.Plo -rm -f ./$(DEPDIR)/libhawk_la-utl-sort.Plo
-rm -f ./$(DEPDIR)/libhawk_la-utl-str.Plo -rm -f ./$(DEPDIR)/libhawk_la-utl-str.Plo
-rm -f ./$(DEPDIR)/libhawk_la-utl-sys.Plo -rm -f ./$(DEPDIR)/libhawk_la-utl-sys.Plo
-rm -f ./$(DEPDIR)/libhawk_la-utl-xstr.Plo
-rm -f ./$(DEPDIR)/libhawk_la-utl.Plo -rm -f ./$(DEPDIR)/libhawk_la-utl.Plo
-rm -f ./$(DEPDIR)/libhawk_la-val.Plo -rm -f ./$(DEPDIR)/libhawk_la-val.Plo
-rm -f ./$(DEPDIR)/libhawk_la-xma.Plo -rm -f ./$(DEPDIR)/libhawk_la-xma.Plo
@ -1649,6 +1660,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/libhawk_la-utl-sort.Plo -rm -f ./$(DEPDIR)/libhawk_la-utl-sort.Plo
-rm -f ./$(DEPDIR)/libhawk_la-utl-str.Plo -rm -f ./$(DEPDIR)/libhawk_la-utl-str.Plo
-rm -f ./$(DEPDIR)/libhawk_la-utl-sys.Plo -rm -f ./$(DEPDIR)/libhawk_la-utl-sys.Plo
-rm -f ./$(DEPDIR)/libhawk_la-utl-xstr.Plo
-rm -f ./$(DEPDIR)/libhawk_la-utl.Plo -rm -f ./$(DEPDIR)/libhawk_la-utl.Plo
-rm -f ./$(DEPDIR)/libhawk_la-val.Plo -rm -f ./$(DEPDIR)/libhawk_la-val.Plo
-rm -f ./$(DEPDIR)/libhawk_la-xma.Plo -rm -f ./$(DEPDIR)/libhawk_la-xma.Plo

View File

@ -755,50 +755,6 @@ HAWK_EXPORT hawk_bch_t* hawk_tokenize_bchars (
int ignorecase int ignorecase
); );
HAWK_EXPORT void hawk_unescape_ucstr (
hawk_uch_t* str
);
HAWK_EXPORT void hawk_unescape_bcstr (
hawk_bch_t* str
);
HAWK_EXPORT hawk_oow_t hawk_subst_for_uchars_to_ucstr (
hawk_uch_t* buf,
hawk_oow_t bsz,
const hawk_uch_t* fmt,
hawk_oow_t fsz,
hawk_subst_for_ucs_t subst,
void* ctx
);
HAWK_EXPORT hawk_oow_t hawk_subst_for_ucstr_to_ucstr (
hawk_uch_t* buf,
hawk_oow_t bsz,
const hawk_uch_t* fmt,
hawk_subst_for_ucs_t subst,
void* ctx
);
HAWK_EXPORT hawk_oow_t hawk_subst_for_bchars_to_bcstr (
hawk_bch_t* buf,
hawk_oow_t bsz,
const hawk_bch_t* fmt,
hawk_oow_t fsz,
hawk_subst_for_bcs_t subst,
void* ctx
);
HAWK_EXPORT hawk_oow_t hawk_subst_for_bcstr_to_bcstr (
hawk_bch_t* buf,
hawk_oow_t bsz,
const hawk_bch_t* fmt,
hawk_subst_for_bcs_t subst,
void* ctx
);
#if defined(HAWK_OOCH_IS_UCH) #if defined(HAWK_OOCH_IS_UCH)
# define hawk_equal_oochars hawk_equal_uchars # define hawk_equal_oochars hawk_equal_uchars
# define hawk_comp_oochars hawk_comp_uchars # define hawk_comp_oochars hawk_comp_uchars
@ -841,9 +797,7 @@ HAWK_EXPORT hawk_oow_t hawk_subst_for_bcstr_to_bcstr (
# define hawk_split_oocstr hawk_split_ucstr # define hawk_split_oocstr hawk_split_ucstr
# define hawk_tokenize_oochars hawk_tokenize_uchars # define hawk_tokenize_oochars hawk_tokenize_uchars
# define hawk_unescape_oocstr hawk_unescape_ucstr
# define hawk_subst_for_oochars_to_oocstr hawk_subst_for_uchars_to_ucstr
# define hawk_subst_for_oocstr_to_oocstr hawk_subst_for_ucstr_to_ucstr (
#else #else
# define hawk_equal_oochars hawk_equal_bchars # define hawk_equal_oochars hawk_equal_bchars
# define hawk_comp_oochars hawk_comp_bchars # define hawk_comp_oochars hawk_comp_bchars
@ -886,9 +840,60 @@ HAWK_EXPORT hawk_oow_t hawk_subst_for_bcstr_to_bcstr (
# define hawk_split_oocstr hawk_split_bcstr # define hawk_split_oocstr hawk_split_bcstr
# define hawk_tokenize_oochars hawk_tokenize_bchars # define hawk_tokenize_oochars hawk_tokenize_bchars
# define hawk_unescape_oocstr hawk_unescape_bcstr #endif
/* ------------------------------------------------------------------------- */
HAWK_EXPORT hawk_oow_t hawk_subst_for_uchars_to_ucstr (
hawk_uch_t* buf,
hawk_oow_t bsz,
const hawk_uch_t* fmt,
hawk_oow_t fsz,
hawk_subst_for_ucs_t subst,
void* ctx
);
HAWK_EXPORT hawk_oow_t hawk_subst_for_bchars_to_bcstr (
hawk_bch_t* buf,
hawk_oow_t bsz,
const hawk_bch_t* fmt,
hawk_oow_t fsz,
hawk_subst_for_bcs_t subst,
void* ctx
);
HAWK_EXPORT hawk_oow_t hawk_subst_for_ucstr_to_ucstr (
hawk_uch_t* buf,
hawk_oow_t bsz,
const hawk_uch_t* fmt,
hawk_subst_for_ucs_t subst,
void* ctx
);
HAWK_EXPORT hawk_oow_t hawk_subst_for_bcstr_to_bcstr (
hawk_bch_t* buf,
hawk_oow_t bsz,
const hawk_bch_t* fmt,
hawk_subst_for_bcs_t subst,
void* ctx
);
HAWK_EXPORT void hawk_unescape_ucstr (
hawk_uch_t* str
);
HAWK_EXPORT void hawk_unescape_bcstr (
hawk_bch_t* str
);
#if defined(HAWK_OOCH_IS_UCH)
# define hawk_subst_for_oochars_to_oocstr hawk_subst_for_uchars_to_ucstr
# define hawk_subst_for_oocstr_to_oocstr hawk_subst_for_ucstr_to_ucstr
# define hawk_unescape_oocstr hawk_unescape_ucstr
#else
# define hawk_subst_for_oochars_to_oocstr hawk_subst_for_bchars_to_bcstr # define hawk_subst_for_oochars_to_oocstr hawk_subst_for_bchars_to_bcstr
# define hawk_subst_for_oocstr_to_oocstr hawk_subst_for_bcstr_to_bcstr ( # define hawk_subst_for_oocstr_to_oocstr hawk_subst_for_bcstr_to_bcstr
# define hawk_unescape_oocstr hawk_unescape_bcstr
#endif #endif
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

File diff suppressed because it is too large Load Diff

1276
hawk/lib/utl-xstr.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -550,7 +550,7 @@ int hawk_conv_bchars_to_uchars_upto_stopper_with_cmgr (
return ret; return ret;
} }
/* ----------------------------------------------------------------------- */ /* ------------------------------------------------------------------------ */
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) #if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
# define IS_PATH_SEP(c) ((c) == '/' || (c) == '\\') # define IS_PATH_SEP(c) ((c) == '/' || (c) == '\\')