Skip to content

Commit

Permalink
refactoring function.
Browse files Browse the repository at this point in the history
  • Loading branch information
activesys committed Nov 8, 2012
1 parent f4a42b0 commit cd341d0
Show file tree
Hide file tree
Showing 11 changed files with 5,894 additions and 2,394 deletions.
866 changes: 382 additions & 484 deletions cstl/cstl_function.h

Large diffs are not rendered by default.

38 changes: 29 additions & 9 deletions cstl/cstl_function_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ extern "C" {
/** constant declaration and macro section **/

/** data type declaration and struct, union, enum section **/
typedef enum _tagfununarytype {
typedef enum _tag_fun_type {
_INVALID_FUN,

/*
* unary funtion type
*/
_NEGATE_FUN,
_LOGICAL_NOT_FUN,
_INCREASE_FUN,
_RANDOM_NUMBER_FUN
} fun_unary_type_t;
_RANDOM_NUMBER_FUN,

typedef enum _tagfunbinarytype {
/*
* binary function type
*/
/* arithmetic */
_PLUS_FUN,
_MINUS_FUN,
Expand All @@ -56,22 +62,36 @@ typedef enum _tagfunbinarytype {
/* logical */
_LOGICAL_AND_FUN,
_LOGICAL_OR_FUN
} fun_binary_type_t;
} fun_type_t;

/** exported global variable declaration section **/

/** exported function prototype section **/
/**
* Select unary function accroding to unary function type.
* @param it_iter A iterator addressing the element.
* @param uftype_type Unary function type.
* @param ftype_type Unary function type.
* @return Unary function.
* @remarks The iterator and unary function type must be valid, otherwise the behavior is undefine.
*/
extern unary_function_t _fun_get_unary(iterator_t it_iter, fun_unary_type_t uftype_type);
extern binary_function_t _fun_get_binary(iterator_t t_iter, fun_binary_type_t t_funtype);
extern unary_function_t _fun_get_unary(iterator_t it_iter, fun_type_t ftype_type);

/* increase */
/**
* Select binary function accroding to binary function type.
* @param it_iter A iterator addressing the element.
* @param ftype_type Binary function type.
* @return Binary function.
* @remarks The iterator and binary function type must be valid, otherwise the behavior is undefine.
*/
extern binary_function_t _fun_get_binary(iterator_t it_iter, fun_type_t ftype_type);

/**
* Increase.
* @param cpv_input Input.
* @param pv_output Output.
* @return void.
* @remarks The input and output must not be NULL, otherwise the behavior is undefined.
*/
extern void _fun_increase_char(const void* cpv_input, void* pv_output);
extern void _fun_increase_uchar(const void* cpv_input, void* pv_output);
extern void _fun_increase_short(const void* cpv_input, void* pv_output);
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ libcstl_la_SOURCES = \
cstl_map.c cstl_map_iterator.c cstl_map_private.c cstl_map_aux.c cstl_map_aux.h \
cstl_multimap.c cstl_multimap_iterator.c cstl_multimap_private.c cstl_multimap_aux.c cstl_multimap_aux.h \
cstl_multiset.c cstl_multiset_iterator.c cstl_multiset_private.c cstl_multiset_aux.c cstl_multiset_aux.h \
cstl_numeric.c \
cstl_numeric.c cstl_numeric_private.c \
cstl_pair.c cstl_pair_private.c cstl_pair_aux.c cstl_pair_aux.h \
cstl_priority_queue.c cstl_priority_queue_private.c \
cstl_queue.c cstl_queue_private.c \
Expand Down
20 changes: 16 additions & 4 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ am_libcstl_la_OBJECTS = libcstl_la-cstl_algo_nonmutating.lo \
libcstl_la-cstl_multiset_iterator.lo \
libcstl_la-cstl_multiset_private.lo \
libcstl_la-cstl_multiset_aux.lo libcstl_la-cstl_numeric.lo \
libcstl_la-cstl_pair.lo libcstl_la-cstl_pair_private.lo \
libcstl_la-cstl_pair_aux.lo libcstl_la-cstl_priority_queue.lo \
libcstl_la-cstl_numeric_private.lo libcstl_la-cstl_pair.lo \
libcstl_la-cstl_pair_private.lo libcstl_la-cstl_pair_aux.lo \
libcstl_la-cstl_priority_queue.lo \
libcstl_la-cstl_priority_queue_private.lo \
libcstl_la-cstl_queue.lo libcstl_la-cstl_queue_private.lo \
libcstl_la-cstl_rb_tree.lo libcstl_la-cstl_rb_tree_iterator.lo \
Expand Down Expand Up @@ -175,6 +176,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
Expand All @@ -198,6 +200,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
Expand All @@ -210,6 +213,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
Expand All @@ -222,6 +226,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
Expand Down Expand Up @@ -254,7 +259,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
Expand Down Expand Up @@ -294,7 +298,7 @@ libcstl_la_SOURCES = \
cstl_map.c cstl_map_iterator.c cstl_map_private.c cstl_map_aux.c cstl_map_aux.h \
cstl_multimap.c cstl_multimap_iterator.c cstl_multimap_private.c cstl_multimap_aux.c cstl_multimap_aux.h \
cstl_multiset.c cstl_multiset_iterator.c cstl_multiset_private.c cstl_multiset_aux.c cstl_multiset_aux.h \
cstl_numeric.c \
cstl_numeric.c cstl_numeric_private.c \
cstl_pair.c cstl_pair_private.c cstl_pair_aux.c cstl_pair_aux.h \
cstl_priority_queue.c cstl_priority_queue_private.c \
cstl_queue.c cstl_queue_private.c \
Expand Down Expand Up @@ -448,6 +452,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcstl_la-cstl_multiset_iterator.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcstl_la-cstl_multiset_private.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcstl_la-cstl_numeric.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcstl_la-cstl_numeric_private.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcstl_la-cstl_pair.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcstl_la-cstl_pair_aux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcstl_la-cstl_pair_private.Plo@am__quote@
Expand Down Expand Up @@ -956,6 +961,13 @@ libcstl_la-cstl_numeric.lo: cstl_numeric.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcstl_la_CPPFLAGS) $(CPPFLAGS) $(libcstl_la_CFLAGS) $(CFLAGS) -c -o libcstl_la-cstl_numeric.lo `test -f 'cstl_numeric.c' || echo '$(srcdir)/'`cstl_numeric.c

libcstl_la-cstl_numeric_private.lo: cstl_numeric_private.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcstl_la_CPPFLAGS) $(CPPFLAGS) $(libcstl_la_CFLAGS) $(CFLAGS) -MT libcstl_la-cstl_numeric_private.lo -MD -MP -MF $(DEPDIR)/libcstl_la-cstl_numeric_private.Tpo -c -o libcstl_la-cstl_numeric_private.lo `test -f 'cstl_numeric_private.c' || echo '$(srcdir)/'`cstl_numeric_private.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcstl_la-cstl_numeric_private.Tpo $(DEPDIR)/libcstl_la-cstl_numeric_private.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cstl_numeric_private.c' object='libcstl_la-cstl_numeric_private.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcstl_la_CPPFLAGS) $(CPPFLAGS) $(libcstl_la_CFLAGS) $(CFLAGS) -c -o libcstl_la-cstl_numeric_private.lo `test -f 'cstl_numeric_private.c' || echo '$(srcdir)/'`cstl_numeric_private.c

libcstl_la-cstl_pair.lo: cstl_pair.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcstl_la_CPPFLAGS) $(CPPFLAGS) $(libcstl_la_CFLAGS) $(CFLAGS) -MT libcstl_la-cstl_pair.lo -MD -MP -MF $(DEPDIR)/libcstl_la-cstl_pair.Tpo -c -o libcstl_la-cstl_pair.lo `test -f 'cstl_pair.c' || echo '$(srcdir)/'`cstl_pair.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libcstl_la-cstl_pair.Tpo $(DEPDIR)/libcstl_la-cstl_pair.Plo
Expand Down
Loading

0 comments on commit cd341d0

Please sign in to comment.