diff --git a/Makefile.in b/Makefile.in index dd7d7e9f19d6adc01ac63ad1532767a21a593fda..94ef2351fee4435c0f9208778e21df5591462a97 100644 --- a/Makefile.in +++ b/Makefile.in @@ -223,9 +223,6 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CHECK_INCLUDE = @CHECK_INCLUDE@ -CHECK_LIBS = @CHECK_LIBS@ -CHECK_ROOT = @CHECK_ROOT@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ diff --git a/configure b/configure index f1d2b8224ccd6edf822d9c22a13b47f1629bc6c8..7ecf761e47483ef375965bfae99d44cabfb8f956 100755 --- a/configure +++ b/configure @@ -681,12 +681,9 @@ DX_ENV DX_DOCDIR DX_CONFIG DX_PROJECT -CHECK_LIBS -CHECK_INCLUDE -CHECK_ROOT +LIBOBJS ENABLE_CHECK_FALSE ENABLE_CHECK_TRUE -LIBOBJS HAVE_RAGEL_FALSE HAVE_RAGEL_TRUE RAGELFLAGS @@ -830,7 +827,7 @@ with_sysroot enable_libtool_lock enable_dependency_tracking enable_silent_rules -with_check +enable_check enable_doxygen_doc enable_doxygen_dot enable_doxygen_man @@ -1500,6 +1497,7 @@ Optional Features: speeds up one-time build --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") + --enable-check Enable unit testing with libcheck --disable-doxygen-doc don't generate any doxygen documentation --enable-doxygen-dot generate graphics for doxygen documentation --disable-doxygen-man don't generate doxygen manual pages @@ -1523,8 +1521,6 @@ Optional Packages: --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). - --with-check=<yes|no|directory> (default=no) - location of CHECK library Some influential environment variables: CC C compiler command @@ -16111,6 +16107,95 @@ fi +# search for libcheck +# Check whether --enable-check was given. +if test "${enable_check+set}" = set; then : + enableval=$enable_check; +fi + + +if test "x$enable_check" = "xyes"; then : + for ac_header in check.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "check.h" "ac_cv_header_check_h" "$ac_includes_default" +if test "x$ac_cv_header_check_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_CHECK_H 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tcase_create" >&5 +$as_echo_n "checking for library containing tcase_create... " >&6; } +if ${ac_cv_search_tcase_create+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char tcase_create (); +int +main () +{ +return tcase_create (); + ; + return 0; +} +_ACEOF +for ac_lib in '' check; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_tcase_create=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_tcase_create+:} false; then : + break +fi +done +if ${ac_cv_search_tcase_create+:} false; then : + +else + ac_cv_search_tcase_create=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tcase_create" >&5 +$as_echo "$ac_cv_search_tcase_create" >&6; } +ac_res=$ac_cv_search_tcase_create +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +else + as_fn_error $? "Cannot link to check library!" "$LINENO" 5 +fi + +fi + + if test "x$enable_check" = "xyes"; then + ENABLE_CHECK_TRUE= + ENABLE_CHECK_FALSE='#' +else + ENABLE_CHECK_TRUE='#' + ENABLE_CHECK_FALSE= +fi + + # Checks for libraries. # Checks for header files. @@ -16352,191 +16437,6 @@ _ACEOF fi -# search for libcheck -CHECK_ROOT='' -CHECK_INCLUDE='' -CHECK_LIBS='' - -# Check whether --with-check was given. -if test "${with_check+set}" = set; then : - withval=$with_check; case "$with_check" in #( - no) : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for check library" >&5 -$as_echo_n "checking for check library... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 -$as_echo "suppressed" >&6; } ;; #( - yes) : - for ac_header in check.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "check.h" "ac_cv_header_check_h" "$ac_includes_default" -if test "x$ac_cv_header_check_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_CHECK_H 1 -_ACEOF - -fi - -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tcase_create" >&5 -$as_echo_n "checking for library containing tcase_create... " >&6; } -if ${ac_cv_search_tcase_create+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char tcase_create (); -int -main () -{ -return tcase_create (); - ; - return 0; -} -_ACEOF -for ac_lib in '' check; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_tcase_create=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_tcase_create+:} false; then : - break -fi -done -if ${ac_cv_search_tcase_create+:} false; then : - -else - ac_cv_search_tcase_create=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tcase_create" >&5 -$as_echo "$ac_cv_search_tcase_create" >&6; } -ac_res=$ac_cv_search_tcase_create -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -else - as_fn_error $? "Cannot link to check library!" "$LINENO" 5 -fi - - CHECK_LIBS=" -lcheck" ;; #( - *) : - if test -d "$with_check"; then : - CHECK_ROOT="$with_check" - LDFLAGS="-L$CHECK_ROOT/lib $LDFLAGS" - CPPFLAGS="-I$CHECK_ROOT/include $CPPFLAGS" - for ac_header in check.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "check.h" "ac_cv_header_check_h" "$ac_includes_default" -if test "x$ac_cv_header_check_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_CHECK_H 1 -_ACEOF - -fi - -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tcase_create" >&5 -$as_echo_n "checking for library containing tcase_create... " >&6; } -if ${ac_cv_search_tcase_create+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char tcase_create (); -int -main () -{ -return tcase_create (); - ; - return 0; -} -_ACEOF -for ac_lib in '' check; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_tcase_create=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_tcase_create+:} false; then : - break -fi -done -if ${ac_cv_search_tcase_create+:} false; then : - -else - ac_cv_search_tcase_create=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tcase_create" >&5 -$as_echo "$ac_cv_search_tcase_create" >&6; } -ac_res=$ac_cv_search_tcase_create -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - CHECK_LIBS=" -L$CHECK_ROOT/lib -lcheck" - CHECK_INCLUDE=" -I$CHECK_ROOT/include" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: $with_check is not a directory! CHECK suppressed" >&5 -$as_echo "$as_me: $with_check is not a directory! CHECK suppressed" >&6;} -fi ;; #( - *) : - ;; -esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for check library" >&5 -$as_echo_n "checking for check library... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 -$as_echo "suppressed" >&6; } -fi - - if test -n "$CHECK_LIBS"; then - ENABLE_CHECK_TRUE= - ENABLE_CHECK_FALSE='#' -else - ENABLE_CHECK_TRUE='#' - ENABLE_CHECK_FALSE= -fi - - - - # Doxygen documentation support diff --git a/configure.ac b/configure.ac index 92886489a0d373d5aaf2633edd393eca72dc7603..d94e03ea1abeefb616e2fcf65d3038a26ef24bc7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. + AC_PREREQ([2.69]) AC_INIT([libmtime], [0.1.0], [luis.kornblueh@zmaw.de]) @@ -31,6 +31,19 @@ AC_SUBST([TAR]) AX_PROG_RAGEL([src/mtime_iso8601.c], [src/mtime_iso8601.rl]) +# search for libcheck +AC_ARG_ENABLE([check], + AS_HELP_STRING([--enable-check], [Enable unit testing with libcheck])) + +AS_IF([test "x$enable_check" = "xyes"], + [AC_CHECK_HEADERS([check.h]) + AC_SEARCH_LIBS([tcase_create], + [check], + [], + [AC_MSG_ERROR([Cannot link to check library!])])]) + +AM_CONDITIONAL([ENABLE_CHECK],[test "x$enable_check" = "xyes"]) + # Checks for libraries. # Checks for header files. @@ -44,38 +57,6 @@ AC_TYPE_INT64_T AC_FUNC_MALLOC AC_CHECK_FUNCS([memset]) AC_CHECK_LIB([m],[roundf]) -# search for libcheck -CHECK_ROOT='' -CHECK_INCLUDE='' -CHECK_LIBS='' -AC_ARG_WITH([check], - [AS_HELP_STRING([--with-check=<yes|no|directory> (default=no)],[location of CHECK library])], - [AS_CASE(["$with_check"], - [no],[AC_MSG_CHECKING([for check library]) - AC_MSG_RESULT([suppressed])], - [yes],[AC_CHECK_HEADERS([check.h]) - AC_SEARCH_LIBS([tcase_create], - [check], - [], - [AC_MSG_ERROR([Cannot link to check library!])]) - CHECK_LIBS=" -lcheck"], - [*],[AS_IF([test -d "$with_check"], - [CHECK_ROOT="$with_check" - LDFLAGS="-L$CHECK_ROOT/lib $LDFLAGS" - CPPFLAGS="-I$CHECK_ROOT/include $CPPFLAGS" - AC_CHECK_HEADERS([check.h]) - AC_SEARCH_LIBS([tcase_create], - [check], - []) - CHECK_LIBS=" -L$CHECK_ROOT/lib -lcheck" - CHECK_INCLUDE=" -I$CHECK_ROOT/include"], - [AC_MSG_NOTICE([$with_check is not a directory! CHECK suppressed])])])], - [AC_MSG_CHECKING([for check library]) - AC_MSG_RESULT([suppressed])]) -AM_CONDITIONAL([ENABLE_CHECK],[test -n "$CHECK_LIBS"]) -AC_SUBST([CHECK_ROOT]) -AC_SUBST([CHECK_INCLUDE]) -AC_SUBST([CHECK_LIBS]) # Doxygen documentation support DX_INIT_DOXYGEN([$PACKAGE_NAME]) diff --git a/doc/Makefile.in b/doc/Makefile.in index 49d7d4ecadfed513245a591d5f150f1bc5c932e8..b83186d6f5b4b422c73c794a6fa2959cbc9b0f86 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -134,9 +134,6 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CHECK_INCLUDE = @CHECK_INCLUDE@ -CHECK_LIBS = @CHECK_LIBS@ -CHECK_ROOT = @CHECK_ROOT@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ diff --git a/examples/Makefile.in b/examples/Makefile.in index ce3c4e40f510a1584f2bf4e446c1a2091b39a7b4..337b58149dfa15ddef081c1bee95ccfbf226fe79 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -322,9 +322,6 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CHECK_INCLUDE = @CHECK_INCLUDE@ -CHECK_LIBS = @CHECK_LIBS@ -CHECK_ROOT = @CHECK_ROOT@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ diff --git a/include/Makefile.in b/include/Makefile.in index 553c126377afcef19d970145ac3e136eb10a946f..4518e2da70921ed6960b691afc6d7061f00d13fa 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -183,9 +183,6 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CHECK_INCLUDE = @CHECK_INCLUDE@ -CHECK_LIBS = @CHECK_LIBS@ -CHECK_ROOT = @CHECK_ROOT@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ diff --git a/src/Makefile.am b/src/Makefile.am index 3c2edb79b5bd0065b7b152eb159a69cd978101d0..7b9035149127d708971d242170951d364039be7c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,21 +20,23 @@ libmtime_la_SOURCES = mtime_calendar.c \ kepler.c \ orbit.c \ error_handling.f90 \ - libmtime.f90 \ + libmtime_c_bindings.f90 \ + libmtime.f90 \ libmtime_hl.f90 -libmtime_hl.o: libmtime_hl.f90 libmtime.o +libmtime_hl.o: libmtime_hl.f90 libmtime.o libmtime_c_bindings.o include_HEADERS = mtime_hl.$(FC_MODEXT) \ mtime.$(FC_MODEXT) \ - mtime_calendar.$(FC_MODEXT) \ + mtime_calendar.$(FC_MODEXT) \ mtime_date.$(FC_MODEXT) \ mtime_datetime.$(FC_MODEXT) \ mtime_eventgroups.$(FC_MODEXT) \ mtime_events.$(FC_MODEXT) \ mtime_julianday.$(FC_MODEXT) \ mtime_time.$(FC_MODEXT) \ - mtime_timedelta.$(FC_MODEXT) + mtime_timedelta.$(FC_MODEXT) \ + libmtime_c_bindings.$(FC_MODEXT) if HAVE_RAGEL @@ -53,6 +55,7 @@ DISTCLEANFILES = mtime_hl.$(FC_MODEXT) \ mtime_julianday.$(FC_MODEXT) \ mtime_time.$(FC_MODEXT) \ mtime_timedelta.$(FC_MODEXT) \ - libmtime.pyc + libmtime_c_bindings.$(FC_MODEXT) \ + libmtime.pyc -EXTRA_DIST = $(srcdir)/mtime_iso8601.rl $(srcdir)/libmtime.py +EXTRA_DIST = $(srcdir)/mtime_iso8601.rl $(srcdir)/libmtime.py diff --git a/src/Makefile.in b/src/Makefile.in index b11f5f36e0df132334b2aacde9f661607ae4a0b5..0cb2c59f9d058ddea398cbad67f552259ccdd4c3 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -139,8 +139,8 @@ am_libmtime_la_OBJECTS = mtime_calendar.lo mtime_calendar360day.lo \ mtime_iso8601.lo mtime_date.lo mtime_datetime.lo \ mtime_julianDay.lo mtime_time.lo mtime_timedelta.lo \ mtime_eventList.lo mtime_eventHandling.lo mtime_utilities.lo \ - vsop87.lo kepler.lo orbit.lo error_handling.lo libmtime.lo \ - libmtime_hl.lo + vsop87.lo kepler.lo orbit.lo error_handling.lo \ + libmtime_c_bindings.lo libmtime.lo libmtime_hl.lo libmtime_la_OBJECTS = $(am_libmtime_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -247,9 +247,6 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CHECK_INCLUDE = @CHECK_INCLUDE@ -CHECK_LIBS = @CHECK_LIBS@ -CHECK_ROOT = @CHECK_ROOT@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -410,19 +407,21 @@ libmtime_la_SOURCES = mtime_calendar.c \ kepler.c \ orbit.c \ error_handling.f90 \ - libmtime.f90 \ + libmtime_c_bindings.f90 \ + libmtime.f90 \ libmtime_hl.f90 include_HEADERS = mtime_hl.$(FC_MODEXT) \ mtime.$(FC_MODEXT) \ - mtime_calendar.$(FC_MODEXT) \ + mtime_calendar.$(FC_MODEXT) \ mtime_date.$(FC_MODEXT) \ mtime_datetime.$(FC_MODEXT) \ mtime_eventgroups.$(FC_MODEXT) \ mtime_events.$(FC_MODEXT) \ mtime_julianday.$(FC_MODEXT) \ mtime_time.$(FC_MODEXT) \ - mtime_timedelta.$(FC_MODEXT) + mtime_timedelta.$(FC_MODEXT) \ + libmtime_c_bindings.$(FC_MODEXT) DISTCLEANFILES = mtime_hl.$(FC_MODEXT) \ mtime.$(FC_MODEXT) \ @@ -434,9 +433,10 @@ DISTCLEANFILES = mtime_hl.$(FC_MODEXT) \ mtime_julianday.$(FC_MODEXT) \ mtime_time.$(FC_MODEXT) \ mtime_timedelta.$(FC_MODEXT) \ - libmtime.pyc + libmtime_c_bindings.$(FC_MODEXT) \ + libmtime.pyc -EXTRA_DIST = $(srcdir)/mtime_iso8601.rl $(srcdir)/libmtime.py +EXTRA_DIST = $(srcdir)/mtime_iso8601.rl $(srcdir)/libmtime.py all: all-am .SUFFIXES: @@ -840,7 +840,7 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES .PRECIOUS: Makefile -libmtime_hl.o: libmtime_hl.f90 libmtime.o +libmtime_hl.o: libmtime_hl.f90 libmtime.o libmtime_c_bindings.o @HAVE_RAGEL_TRUE@mtime_iso8601.c: mtime_iso8601.rl @HAVE_RAGEL_TRUE@ $(RAGEL) -o mtime_iso8601.c mtime_iso8601.rl diff --git a/src/eventwrapper.f90 b/src/eventwrapper.f90 new file mode 100644 index 0000000000000000000000000000000000000000..cd4fd23ceebd79098bf51250eb9dc3d9403bc211 --- /dev/null +++ b/src/eventwrapper.f90 @@ -0,0 +1,124 @@ +MODULE event_wrapper + + !TODO: create type-bound procedures get_c_ptr for t_datetime and t_timedelta + + implicit none + + TYPE t_event + + !private + + TYPE(t_event), POINTER :: nextEventInGroup + + INTEGER(c_int64_t) :: eventId + CHARACTER(len=max_eventname_str_len) :: eventName + + TYPE(t_datetime) :: eventsLastEvaluationDateTime + TYPE(t_datetime) :: eventReferenceDateTime + + TYPE(t_datetime) :: eventFirstDateTime + TYPE(t_datetime) :: eventLastDateTime + + TYPE(t_timedelta) :: eventInterval + TYPE(t_timedelta) :: eventOffset + + LOGICAL :: neverTriggerEvent + + LOGICAL :: triggerCurrentEvent + + LOGICAL :: nextEventIsFirst + LOGICAL :: lastEventWasFinal + + LOGICAL :: eventisFirstInDay + LOGICAL :: eventisFirstInMonth + LOGICAL :: eventisFirstInYear + LOGICAL :: eventisLastInDay + LOGICAL :: eventisLastInMonth + LOGICAL :: eventisLastInYear + + TYPE(t_datetime) :: triggerNextEventDateTime + TYPE(t_datetime) :: triggeredPreviousEventDateTime + + CONTAINS + + !> TODO: implement isAvtive .... + ! PROCEDURE :: trigger => t_event_trigger + PROCEDURE :: getFirstDatetime => t_event_getFirstDatetime + PROCEDURE :: getInterval => t_event_getInterval + PROCEDURE :: getLastDatetime => t_event_getLastDatetime + PROCEDURE :: getNextOccurrenceDatetime => t_event_getNextOccurrenceDatetime + PROCEDURE :: getPrevOccurrenceDatetime => t_event_getPrevOccurrenceDatetime + + PROCEDURE :: getName => t_event_getName + PROCEDURE :: nextEvent => t_event_next_event + + PROCEDURE :: get_c_pointer => t_event_get_c_pointer + + END TYPE t_event + + INTERFACE t_event + MODULE PROCEDURE t_event_assign_raw + MODULE PROCEDURE t_event_assign_types + END INTERFACE t_event + +CONTAINS + + FUNCTION t_event_get_c_pointer(this) RESULT(c_pointer) + + TYPE(c_ptr) :: c_pointer + TYPE(event), POINTER :: event_pointer + + event_pointer => newEvent(! to fill) + + event_pointer%nextEventInGroup = this%nextEventInGroup%get_c_pointer() + event_pointer%eventId = this%eventId + event_pointer%eventName = this%eventName + event_pointer%eventsLastEvaluationDateTime = this%eventsLastEvaluationDateTime%get_c_pointer() + event_pointer%eventReferenceDatetime = this%eventReferenceDatetime%get_c_pointer() + event_pointer%eventFirstDatetime = this%eventFirstDatetime%get_c_pointer() + event_pointer%eventLastDatetime = this%eventLastDatetime%get_c_pointer() + event_pointer%eventInterval = this%eventInterval%get_c_pointer() + event_pointer%triggerCurrentEvent = this%triggerCurrentEvent + event_pointer%nextEventIsFirst = this%nextEventIsFirst + event_pointer%eventisFirstInDay = this%eventisFirstInDay + event_pointer%eventisFirstInMonth = this%eventisFirstInMonth + event_pointer%eventisFirstInYear = this%eventisFirstInYear + event_pointer%eventisLastInDay = this%eventisLastInDay + event_pointer%eventisLastInMonth = this%eventisLastInMonth + event_pointer%eventisLastInYear = this%eventisLastInYear + event_pointer%triggerNextEventDateTime = this%triggerNextEventDateTime%get_c_pointer() + event_pointer%triggeredPreviousEventDateTime = this%triggeredPreviousEventDateTime%get_c_pointer() + + c_pointer = C_LOC(event_pointer) + + END FUNCTION t_event_get_c_pointer + + function isCurrentEventActive(this, my_datetime, plus_slack, minus_slack) result(ret) + type(t_event) :: this + type(t_datetime) :: my_datetime + type(t_timedelta), optional :: plus_slack + type(t_timedelta), optional :: minus_slack + logical :: ret + + type(c_ptr) :: this_ptr + type(c_ptr) :: my_datetime_ptr + type(c_ptr) :: plus_slack_ptr => c_null + type(c_ptr) :: minus_slack_ptr => c_null + + this_ptr = this%get_c_ptr() + my_datetime_ptr = my_Datetime%get_c_ptr() + + if (present(plus_slack)) plus_slack_ptr = plus_slack%get_c_ptr() + if (present(minus_slack)) minus_slack_ptr = minus_slack%get_c_ptr() + + ret = my_isCurrentEventActive(this_ptr, my_datetime_ptr, & + & plus_slack_ptr, minus_slack_ptr) + + CALL my_deallocateevent(this_ptr) + CALL my_deallocatedatetime(my_datetime_ptr) + IF (present(plus_slack) CALL deallocatetimedelta(plus_slack_ptr) + IF (present(minus_slack) CALL deallocatetimedelta(minus_slack_ptr) + + end function isCurrentEventActive + +END MODULE event_wrapper diff --git a/src/libmtime.f90 b/src/libmtime.f90 index 0f6e79d92445079ee25e4106db38a3a79ec625ae..df7cf6133783632e38aa2de759ab167768abb6ea 100644 --- a/src/libmtime.f90 +++ b/src/libmtime.f90 @@ -28,6 +28,7 @@ module mtime_calendar ! use, intrinsic :: iso_c_binding, only: c_int, c_char, c_null_char, c_ptr, c_associated, c_int64_t + use :: libmtime_c_bindings ! implicit none ! @@ -50,31 +51,6 @@ module mtime_calendar !> provides a string length for toString integer, parameter :: max_calendar_str_len = 32 ! - !> @cond DOXYGEN_IGNORE_THIS - interface - ! - subroutine setCalendar(ct) bind(c, name='initCalendar') !TESTED-OK - import :: c_int - integer(c_int), value :: ct - end subroutine setCalendar - ! - subroutine resetCalendar() bind(c, name='freeCalendar') !TESTED-OK - end subroutine resetCalendar - ! - function calendarType() bind(c, name='getCalendarType') !TESTED-OK - import :: c_int - integer(c_int) :: calendarType - end function calendarType - ! - function my_calendartostring(calendar) result(c_pointer) bind(c, name='calendarToString') !TESTED-OK - import :: c_char, c_ptr - type(c_ptr) :: c_pointer - character(c_char), dimension(*) :: calendar - end function my_calendartostring - ! - end interface - !> @endcond DOXYGEN_IGNORE_THIS - ! contains ! #ifdef DOXYGEN_DOCUMENTATION_ONLY @@ -147,6 +123,7 @@ MODULE mtime_juliandelta ! USE, INTRINSIC :: iso_c_binding, ONLY: c_int64_t, c_char, c_ptr, c_loc, & c_associated, c_f_pointer + use :: libmtime_c_bindings ! IMPLICIT NONE ! @@ -162,21 +139,6 @@ MODULE mtime_juliandelta INTEGER(c_int64_t) :: ms END TYPE juliandelta - INTERFACE - FUNCTION my_newjuliandelta(sign, day, ms) RESULT(c_pointer) bind(c, name='newJulianDelta') - import :: c_int64_t, c_char, c_ptr - TYPE(c_ptr) :: c_pointer - CHARACTER(c_char) :: sign - INTEGER(c_int64_t), value :: day - INTEGER(c_int64_t), value :: ms - end function my_newjuliandelta - ! - subroutine my_deallocatejuliandelta(jd) bind(c,name='deallocateJulianDelta') - import :: c_ptr - type(c_ptr), value :: jd - end subroutine my_deallocatejuliandelta - END INTERFACE - CONTAINS FUNCTION newJuliandelta(sign,day, ms, errno) RESULT(ret_juliandelta) !OK-TESTED. @@ -213,6 +175,7 @@ module mtime_julianday ! use, intrinsic :: iso_c_binding, only: c_int64_t, c_char, c_null_char, c_ptr, c_loc, & & c_f_pointer, c_associated + use :: libmtime_c_bindings ! implicit none ! @@ -232,30 +195,6 @@ module mtime_julianday integer(c_int64_t) :: ms !< the milisecond on that particular day end type julianday ! - !> @cond DOXYGEN_IGNORE_THIS - interface - function my_newjulianday(day, ms) result(c_pointer) bind(c, name='newJulianDay') - import :: c_int64_t, c_ptr - type(c_ptr) :: c_pointer - integer(c_int64_t), value :: day - integer(c_int64_t), value :: ms - end function my_newjulianday - ! - subroutine my_deallocatejulianday(jd) bind(c,name='deallocateJulianDay') - import :: c_ptr - type(c_ptr), value :: jd - end subroutine my_deallocatejulianday - ! - function my_juliandaytostring(my_julianday, string) result(string_ptr) bind(c, name='juliandayToString') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: my_julianday - character(c_char), dimension(*) :: string - end function my_juliandaytostring - ! - end interface - !> @endcond DOXYGEN_IGNORE_THIS - ! contains ! !> @@ -319,6 +258,7 @@ module mtime_date ! use, intrinsic :: iso_c_binding, only: c_int, c_int64_t, c_char, c_ptr, c_null_char, & & c_loc, c_f_pointer, c_associated + use :: libmtime_c_bindings ! implicit none ! @@ -348,57 +288,6 @@ module mtime_date module procedure newdatefromconstructandcopy end interface newdate ! - !> @cond DOXYGEN_IGNORE_THIS - interface - ! - function my_newdatefromstring(string) result(c_pointer) bind(c, name='newDate') - import :: c_char, c_ptr - type(c_ptr) :: c_pointer - character(c_char), dimension(*) :: string - end function my_newdatefromstring - ! - function my_newrawdate(year, month, day) result(c_pointer) bind(c, name='newRawDate') - import :: c_int64_t, c_int, c_ptr - type(c_ptr) :: c_pointer - integer(c_int64_t), value :: year - integer(c_int), value :: month, day - end function my_newrawdate - ! - function my_constructandcopydate(d) result(c_pointer) bind(c,name='constructAndCopyDate') - import :: c_ptr - type(c_ptr) :: c_pointer - type(c_ptr), value :: d - end function my_constructandcopydate - ! - subroutine my_deallocatedate(d) bind(c, name='deallocateDate') - import :: c_ptr - type(c_ptr), value :: d - end subroutine my_deallocatedate - ! - function my_replacedate(src, dest) result(ret_dest) bind(c, name='replaceDate') - import :: c_ptr - type(c_ptr) :: ret_dest - type(c_ptr), value :: src , dest - end function my_replacedate - ! - function my_datetostring(my_date, string) result(string_ptr) bind(c, name='dateToString') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: my_date - character(c_char), dimension(*) :: string - end function my_datetostring - ! - function my_datetoposixstring(my_date, string, fmtstr) result(string_ptr) bind(c, name='dateToPosixString') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: my_date - character(c_char), dimension(*) :: string - character(c_char), dimension(*) :: fmtstr - end function my_datetoposixstring - ! - end interface - !> @endcond DOXYGEN_IGNORE_THIS - ! contains ! !> @@ -566,6 +455,7 @@ module mtime_time ! use, intrinsic :: iso_c_binding, only: c_int, c_char, c_ptr, c_null_char, & & c_loc, c_f_pointer, c_associated + use :: libmtime_c_bindings ! implicit none ! @@ -595,56 +485,6 @@ module mtime_time module procedure newtimefromconstructandcopy end interface newtime ! - !> @cond DOXYGEN_IGNORE_THIS - interface - ! - function my_newtimefromstring(string) result(c_pointer) bind(c, name='newTime') - import :: c_char, c_ptr - type(c_ptr) :: c_pointer - character(c_char), dimension(*) :: string - end function my_newtimefromstring - ! - function my_newrawtime(hour, minute, second, ms) result(c_pointer) bind(c, name='newRawTime') - import :: c_int, c_ptr - type(c_ptr) :: c_pointer - integer(c_int), value :: hour, minute, second, ms - end function my_newrawtime - ! - function my_constructandcopytime(t) result(c_pointer) bind(c,name='constructAndCopyTime') - import :: c_ptr - type(c_ptr) :: c_pointer - type(c_ptr), value :: t - end function my_constructandcopytime - ! - subroutine my_deallocatetime(t) bind(c,name='deallocateTime') - import :: c_ptr - type(c_ptr), value :: t - end subroutine my_deallocatetime - ! - function my_replacetime(src, dest) result(ret_dest) bind(c, name='replaceTime') - import :: c_ptr - type(c_ptr) :: ret_dest - type(c_ptr), value :: src , dest - end function my_replacetime - ! - function my_timetostring(my_time, string) result(string_ptr) bind(c, name='timeToString') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: my_time - character(c_char), dimension(*) :: string - end function my_timetostring - ! - function my_timetoposixstring(my_time, string, fmtstr) result(string_ptr) bind(c, name='timeToPosixString') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: my_time - character(c_char), dimension(*) :: string - character(c_char), dimension(*) :: fmtstr - end function my_timetoposixstring - ! - end interface - !> @endcond DOXYGEN_IGNORE_THIS - ! contains ! !! @param[out] errno optional, error message @@ -782,6 +622,7 @@ module mtime_datetime ! use, intrinsic :: iso_c_binding, only: c_int, c_int64_t, c_char, c_null_char, c_ptr, & & c_loc, c_f_pointer, c_associated + use :: libmtime_c_bindings ! use mtime_julianday use mtime_date @@ -867,108 +708,6 @@ module mtime_datetime module procedure datetime_ne end interface operator (/=) ! - !> @cond DOXYGEN_IGNORE_THIS - interface - ! - function my_newdatetime(string) result(c_pointer) bind(c, name='newDateTime') - import :: c_ptr, c_char - type(c_ptr) :: c_pointer - character(c_char), dimension(*) :: string - end function my_newdatetime - ! - function my_newrawdatetime(year, month, day, hour, minute, second, ms) result(c_pointer) & - & bind(c, name='newRawDateTime') - import :: c_int64_t, c_int, c_ptr - type(c_ptr) :: c_pointer - integer(c_int64_t), value :: year - integer(c_int), value :: month, day, hour, minute, second, ms - end function my_newrawdatetime - ! - function my_constructandcopydatetime(dt) result(c_pointer) bind(c,name='constructAndCopyDateTime') - import :: c_ptr - type(c_ptr) :: c_pointer - type(c_ptr), value :: dt - end function my_constructandcopydatetime - ! - subroutine my_deallocatedatetime(dt) bind(c,name='deallocateDateTime') - import :: c_ptr - type(c_ptr), value :: dt - end subroutine my_deallocatedatetime - ! - function my_comparedatetime(op1, op2) result(ret) bind(c, name='compareDatetime') - import :: c_ptr, c_int - integer(c_int) :: ret - type(c_ptr), value :: op1 - type(c_ptr), value :: op2 - end function my_comparedatetime - - function my_replacedatetime(src, dest) result(ret_dest) bind(c, name='replaceDatetime') - import :: c_ptr - type(c_ptr) :: ret_dest - type(c_ptr), value :: src - type(c_ptr), value :: dest - end function my_replacedatetime - ! - function my_datetimetostring(my_time, string) result(string_ptr) bind(c, name='datetimeToString') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: my_time - character(c_char), dimension(*) :: string - end function my_datetimetostring - ! - function my_datetimetoposixstring(my_time, string, fmtstr) result(string_ptr) bind(c, name='datetimeToPosixString') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: my_time - character(c_char), dimension(*) :: string - character(c_char), dimension(*) :: fmtstr - end function my_datetimetoposixstring - ! - function my_getnoofdaysinmonthdatetime(dt) bind(c, name='getNoOfDaysInMonthDateTime') - import :: c_int, c_ptr - integer(c_int) :: my_getnoofdaysinmonthdatetime - type(c_ptr), value :: dt - end function my_getnoofdaysinmonthdatetime - ! - function my_getnoofdaysinyeardatetime(dt) bind(c, name='getNoOfDaysInYearDateTime') - import :: c_int, c_ptr - integer(c_int) :: my_getnoofdaysinyeardatetime - type(c_ptr), value :: dt - end function my_getnoofdaysinyeardatetime - ! - function my_getdayofyearfromdatetime(dt) bind(c, name='getDayOfYearFromDateTime') - import :: c_int, c_ptr - integer(c_int) :: my_getdayofyearfromdatetime - type(c_ptr), value :: dt - end function my_getdayofyearfromdatetime - ! - function my_getnoofsecondselapsedinmonthdatetime(dt) bind(c, name='getNoOfSecondsElapsedInMonthDateTime') - import :: c_int64_t, c_ptr - integer(c_int64_t) :: my_getnoofsecondselapsedinmonthdatetime - type(c_ptr), value :: dt - end function my_getnoofsecondselapsedinmonthdatetime - ! - function my_getnoofsecondselapsedindaydatetime(dt) bind(c, name='getNoOfSecondsElapsedInDayDateTime') - import :: c_int, c_ptr - integer(c_int) :: my_getnoofsecondselapsedindaydatetime - type(c_ptr), value :: dt - end function my_getnoofsecondselapsedindaydatetime - ! - function my_getjuliandayfromdatetime(dt, jd) bind(c, name='getJulianDayFromDateTime') - import :: c_ptr - type(c_ptr) :: my_getjuliandayfromdatetime - type(c_ptr), value :: dt, jd - end function my_getjuliandayfromdatetime - ! - function my_getdatetimefromjulianday(jd, dt) bind(c, name='getDateTimeFromJulianDay') - import :: c_ptr - type(c_ptr) :: my_getdatetimefromjulianday - type(c_ptr), value :: jd, dt - end function my_getdatetimefromjulianday - ! - end interface - !> @endcond DOXYGEN_IGNORE_THIS - ! contains ! !! @param[out] errno optional, error message @@ -1374,7 +1113,8 @@ end module mtime_datetime module mtime_timedelta ! use, intrinsic :: iso_c_binding, only: c_int, c_int32_t, c_int64_t, c_float, c_double, c_char, & - & c_ptr, c_null_char, c_loc, c_f_pointer, c_associated + & c_ptr, c_null_char, c_loc, c_f_pointer, c_associated + use :: libmtime_c_bindings ! use mtime_datetime use mtime_date @@ -1492,206 +1232,6 @@ module mtime_timedelta module procedure getPTStringFromSecondsDouble end interface getPTStringFromSeconds ! - !> @cond DOXYGEN_IGNORE_THIS - interface - ! - function my_newtimedeltafromstring(string) result(c_pointer) bind(c, name='newTimeDelta') - import :: c_char, c_ptr - type(c_ptr) :: c_pointer - character(c_char), dimension(*) :: string - end function my_newtimedeltafromstring - ! - function my_newrawtimedelta(sign, year, month, day, hour, minute, second, ms) result(c_pointer) & - & bind(c, name='newRawTimeDelta') - import :: c_int64_t, c_char, c_int, c_ptr - type(c_ptr) :: c_pointer - character(c_char), value :: sign - integer(c_int64_t), value :: year - integer(c_int), value :: month, day, hour, minute, second, ms - end function my_newrawtimedelta - ! - function my_constructandcopytimedelta(td) result(c_pointer) bind(c,name='constructAndCopyTimeDelta') - import :: c_ptr - type(c_ptr) :: c_pointer - type(c_ptr), value :: td - end function my_constructandcopytimedelta - ! - subroutine my_deallocatetimedelta(dt) bind(c, name='deallocateTimeDelta') - import :: c_ptr - type(c_ptr), value :: dt - end subroutine my_deallocatetimedelta - ! - function my_comparetimedelta(op1, op2) result(ret) bind(c, name='compareTimeDelta') - import :: c_ptr, c_int - integer(c_int) :: ret - type(c_ptr), value :: op1 - type(c_ptr), value :: op2 - end function my_comparetimedelta - ! - function my_gettimedeltafromdate(my_date1,my_date2,timedelta_return) result(timedelta_ptr) & - & bind(c,name='getTimeDeltaFromDate') - import :: c_ptr - type(c_ptr) :: timedelta_ptr - type(c_ptr), value :: my_date1, my_date2, timedelta_return - end function my_gettimedeltafromdate - ! - function my_gettimedeltafromdatetime(my_datetime1,my_datetime2,timedelta_return) result(timedelta_ptr) & - & bind(c,name='getTimeDeltaFromDateTime') - import :: c_ptr - type(c_ptr) :: timedelta_ptr - type(c_ptr), value :: my_datetime1, my_datetime2, timedelta_return - end function my_gettimedeltafromdatetime - ! - function my_gettotalmillisecondstimedelta(my_timedelta, my_datetime) & - & bind(c, name='getTotalMilliSecondsTimeDelta') - import :: c_ptr, c_int64_t - integer(c_int64_t) :: my_gettotalmillisecondstimedelta - type(c_ptr), value :: my_timedelta, my_datetime - end function my_gettotalmillisecondstimedelta - ! - function my_gettotalsecondstimedelta(my_timedelta, my_datetime) bind(c, name='getTotalSecondsTimeDelta') - import :: c_ptr, c_int64_t - integer(c_int64_t) :: my_gettotalsecondstimedelta - type(c_ptr), value :: my_timedelta, my_datetime - end function my_gettotalsecondstimedelta - ! - function my_timedeltatostring(td, tostring) result(string_ptr) bind(c, name='timedeltaToString') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: td - character(c_char), dimension(*) :: tostring - end function my_timedeltatostring - ! - function my_addtimedeltatodatetime(my_datetime, my_timedelta, ret_datetime) result(datetime_ptr) & - & bind(c, name='addTimeDeltaToDateTime') - import :: c_ptr - type(c_ptr) :: datetime_ptr - type(c_ptr), value :: my_datetime, my_timedelta, ret_datetime - end function my_addtimedeltatodatetime - ! - function my_addtimedeltatodate(my_date, my_timedelta, ret_date) result(date_ptr) & - & bind(c, name='addTimeDeltaToDate') - import :: c_ptr - type(c_ptr) :: date_ptr - type(c_ptr), value :: my_date, my_timedelta, ret_date - end function my_addtimedeltatodate - ! - function my_elementwisescalarmultiplytimedelta(my_timedelta, lambda, scaled_timedelta) result(timedelta_return) & - & bind(c, name='elementwiseScalarMultiplyTimeDelta') - import :: c_ptr, c_int64_t - type(c_ptr) ::timedelta_return - type(c_ptr), value :: my_timedelta, scaled_timedelta - integer(c_int64_t), value :: lambda - end function my_elementwisescalarmultiplytimedelta - ! - function my_elementwisescalarmultiplytimedeltadp(my_timedelta, lambda, scaled_timedelta) RESULT(timedelta_return) & - & bind(c, name='elementwiseScalarMultiplyTimeDeltaDP') - import :: c_ptr, c_double - type(c_ptr) ::timedelta_return - type(c_ptr), value :: my_timedelta, scaled_timedelta - real(c_double), value :: lambda - end function my_elementwisescalarmultiplytimedeltadp - ! - function my_elementwiseAddTimeDeltatoTimeDelta(my_timedelta1,my_timedelta2,added_timedelta) result(timedelta_return) & - & bind(c, name='elementwiseAddTimeDeltatoTimeDelta') - import :: c_ptr - type(c_ptr) :: timedelta_return - type(c_ptr), value :: my_timedelta1,my_timedelta2,added_timedelta - end function my_elementwiseAddTimeDeltatoTimeDelta - ! - function my_modulotimedelta(a, p, quot) result(rem) bind(c, name='moduloTimedelta') - import :: c_ptr, c_int64_t - integer(c_int64_t) :: rem - type(c_ptr), value :: a - type(c_ptr), value :: p - type(c_ptr), value :: quot - end function my_modulotimedelta - ! - function my_getptstringfromms(ms, tostring) result(string_ptr) bind(c, name='getPTStringFromMS') - import :: c_ptr, c_int64_t, c_char - type(c_ptr) :: string_ptr - integer(c_int64_t), value :: ms - character(c_char), dimension(*) :: tostring - end function my_getptstringfromms - ! - function my_getptstringfromsecondsint(s, tostring) result(string_ptr) bind(c, name='getPTStringFromSeconds') - import :: c_ptr, c_int64_t, c_char - type(c_ptr) :: string_ptr - integer(c_int64_t), value :: s - character(c_char), dimension(*) :: tostring - end function my_getptstringfromsecondsint - ! - function my_getptstringfromsecondsfloat(s, tostring) result(string_ptr) bind(c, name='getPTStringFromSecondsFloat') - import :: c_ptr, c_float, c_char - type(c_ptr) :: string_ptr - real(c_float), value :: s - character(c_char), dimension(*) :: tostring - end function my_getptstringfromsecondsfloat - ! - function my_getptstringfromsecondsdouble(s, tostring) result(string_ptr) bind(c, name='getPTStringFromSecondsDouble') - import :: c_ptr, c_double, c_char - type(c_ptr) :: string_ptr - real(c_double), value :: s - character(c_char), dimension(*) :: tostring - end function my_getptstringfromsecondsdouble - ! - function my_getptstringfromminutes(m, tostring) result(string_ptr) bind(c, name='getPTStringFromMinutes') - import :: c_ptr, c_int64_t, c_char - type(c_ptr) :: string_ptr - integer(c_int64_t),value :: m - character(c_char), dimension(*) :: tostring - end function my_getptstringfromminutes - ! - function my_getptstringfromhours(h, tostring) result(string_ptr) bind(c, name='getPTStringFromHours') - import :: c_ptr, c_int64_t, c_char - type(c_ptr) :: string_ptr - integer(c_int64_t),value :: h - character(c_char), dimension(*) :: tostring - end function my_getptstringfromhours - ! - FUNCTION my_timedeltatojuliandelta(td,dt,jd) RESULT(c_pointer) bind(c,name='timeDeltaToJulianDelta') - import :: c_int64_t, c_ptr - type(c_ptr) :: c_pointer - TYPE(c_ptr), value :: td - TYPE(c_ptr), value :: dt - type(c_ptr), value :: jd - END FUNCTION my_timedeltatojuliandelta - ! - function my_divideTimeDeltaInSeconds(dividend, divisor, quotient) result(ret_quotient) bind(c,name='divideTimeDeltaInSeconds') - import :: c_ptr - type(c_ptr) :: ret_quotient - type(c_ptr), value :: dividend - type(c_ptr), value :: divisor - type(c_ptr), value :: quotient - end function my_divideTimeDeltaInSeconds - ! - function my_divideDatetimeDifferenceInSeconds(dt1, dt2, divisor, quotient) result(ret_quotient) & - & bind(c,name='divideDatetimeDifferenceInSeconds') - import :: c_ptr - type(c_ptr) :: ret_quotient - type(c_ptr), value :: dt1 - type(c_ptr), value :: dt2 - type(c_ptr), value :: divisor - type(c_ptr), value :: quotient - end function my_divideDatetimeDifferenceInSeconds - ! - function my_divideTwoDatetimeDiffsInSeconds(dt1_dividend, dt2_dividend, & - & dt1_divisor, dt2_divisor, denominator, quotient) & - & result(ret_quotient) & - & bind(c,name='divideTwoDatetimeDiffsInSeconds') - import :: c_ptr - type(c_ptr) :: ret_quotient - type(c_ptr), value :: dt1_dividend - type(c_ptr), value :: dt2_dividend - type(c_ptr), value :: dt1_divisor - type(c_ptr), value :: dt2_divisor - type(c_ptr), value :: denominator - type(c_ptr), value :: quotient - end function my_divideTwoDatetimeDiffsInSeconds - ! - end interface - !> @endcond DOXYGEN_IGNORE_THIS - ! contains ! !! @param[out] errno optional, error message @@ -2345,7 +1885,8 @@ end module mtime_timedelta module mtime_events ! use, intrinsic :: iso_c_binding, only: c_int64_t, c_char, c_null_char, c_bool, c_ptr, & - & c_loc, c_f_pointer, c_associated, c_null_ptr + & c_loc, c_f_pointer, c_associated, c_null_ptr + use :: libmtime_c_bindings ! use mtime_datetime use mtime_timedelta @@ -2411,148 +1952,6 @@ module mtime_events module procedure constructAndCopyEvent end interface newEvent ! - !> @cond DOXYGEN_IGNORE_THIS - interface - ! - function my_newevent(name, referenceDate, firstdate, lastDate, interval, offset) result(c_pointer) & - & bind(c, name='newEvent') - import :: c_char, c_ptr - type(c_ptr) :: c_pointer - character(c_char), dimension(*) :: name - character(c_char), dimension(*) :: referenceDate - character(c_char), dimension(*) :: firstDate - character(c_char), dimension(*) :: lastDate - character(c_char), dimension(*) :: interval - character(c_char), dimension(*) :: offset - end function my_newevent - ! - function my_neweventwithdatatypes(name, referenceDate, firstdate, lastDate, interval, offset) & - & result(c_pointer) bind(c, name='newEventWithDataType') - import :: c_char, c_ptr - type(c_ptr) :: c_pointer - character(c_char), dimension(*) :: name - type(c_ptr), value :: referenceDate - type(c_ptr), value :: firstDate - type(c_ptr), value :: lastDate - type(c_ptr), value :: interval - type(c_ptr), value :: offset - end function my_neweventwithdatatypes - ! - subroutine my_deallocateevent(ev) bind(c,name='deallocateEvent') - import :: c_ptr - type(c_ptr), value :: ev - end subroutine my_deallocateevent - ! - function my_constructandcopyevent(my_event) result(event_copy) bind(c, name='constructAndCopyEvent') - import :: c_ptr - type(c_ptr) :: event_copy - type(c_ptr), value :: my_event - end function my_constructandcopyevent - ! - function my_eventtostring(my_event, string) result(string_ptr) bind(c, name='eventToString') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: my_event - character(c_char), dimension(*) :: string - end function my_eventtostring - ! - function my_isCurrentEventActive(my_event, my_datetime, plus_slack, minus_slack) & - & result(ret) bind(c, name='isCurrentEventActive') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - type(c_ptr), value :: my_datetime - type(c_ptr), value :: plus_slack - type(c_ptr), value :: minus_slack - logical(c_bool) :: ret - end function my_isCurrentEventActive - ! - function my_iseventnextinnextday(my_event) result(ret) bind(c, name='iseventNextInNextDay') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_iseventnextinnextday - ! - function my_iseventnextinnextmonth(my_event) result(ret) bind(c, name='iseventNextInNextMonth') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_iseventnextinnextmonth - ! - function my_iseventnextinnextyear(my_event) result(ret) bind(c, name='iseventNextInNextYear') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_iseventnextinnextyear - ! - function my_gettriggernexteventatdatetime(my_event,my_currentdatetime,my_datetime) result(c_pointer) & - & bind(c, name='getTriggerNextEventAtDateTime') - import :: c_ptr - type(c_ptr) :: c_pointer - type(c_ptr), value :: my_event - type(c_ptr), value :: my_currentdatetime - type(c_ptr), value :: my_datetime - end function my_gettriggernexteventatdatetime - ! - function my_gettriggeredpreviouseventatdatetime(my_event,my_datetime) result(c_pointer) & - & bind(c, name='getTriggeredPreviousEventAtDateTime') - import :: c_ptr - type(c_ptr) :: c_pointer - type(c_ptr), value :: my_event - type(c_ptr), value :: my_datetime - end function my_gettriggeredpreviouseventatdatetime - ! - function my_geteventname(my_event, string) result(c_pointer) bind(c, name='getEventName') - import :: c_ptr, c_char - type(c_ptr) :: c_pointer - type(c_ptr), value :: my_event - character(c_char), dimension(*) :: string - end function my_geteventname - ! - function my_getnexteventisfirst(my_event) result(ret) bind(c, name='getNextEventIsFirst') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_getnexteventisfirst - ! - function my_geteventisfirstinday(my_event) result(ret) bind(c, name='getEventisFirstInDay') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_geteventisfirstinday - ! - function my_geteventisfirstinmonth(my_event) result(ret) bind(c, name='getEventisFirstInMonth') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_geteventisfirstinmonth - ! - function my_geteventisfirstinyear(my_event) result(ret) bind(c, name='getEventisFirstInYear') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_geteventisfirstinyear - ! - function my_geteventislastinday(my_event) result(ret) bind(c, name='getEventisLastInDay') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_geteventislastinday - ! - function my_geteventislastinmonth(my_event) result(ret) bind(c, name='getEventisLastInMonth') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_geteventislastinmonth - ! - function my_geteventislastinyear(my_event) result(ret) bind(c, name='getEventisLastInYear') - import :: c_bool, c_ptr - type(c_ptr), value :: my_event - logical(c_bool) :: ret - end function my_geteventislastinyear - ! - end interface - !> @endcond DOXYGEN_IGNORE_THIS - ! contains ! !! @param[out] errno optional, error message @@ -3029,6 +2428,7 @@ module mtime_eventgroups ! use, intrinsic :: iso_c_binding, only: c_int64_t, c_ptr, c_char, c_null_char, c_bool, & & c_loc, c_f_pointer, c_associated + use :: libmtime_c_bindings ! use mtime_events ! @@ -3056,44 +2456,6 @@ module mtime_eventgroups type(c_ptr) :: firstEventInGroup end type eventgroup ! - !> @cond DOXYGEN_IGNORE_THIS - interface - ! - function my_neweventgroup(name) result(c_pointer) bind(c, name='newEventGroup') - import :: c_char, c_ptr - type(c_ptr) :: c_pointer - character(c_char), dimension(*) :: name - end function my_neweventgroup - ! - subroutine my_deallocateeventgroup(evgrp) bind(c,name='deallocateEventGroup') - import :: c_ptr - type(c_ptr), value :: evgrp - end subroutine my_deallocateeventgroup - ! - function my_addeventtoeventgroup(my_event, my_eventgroup) result(ret) bind(c, name='addNewEventToEventGroup') - import :: c_bool, c_ptr - logical(c_bool) :: ret - type(c_ptr), value :: my_event - type(c_ptr), value :: my_eventgroup - end function my_addeventtoeventgroup - ! - function my_removeeventfromeventgroup(evname, evgrp) result(ret) bind(c, name='removeEventFromEventGroup') - import :: c_bool, c_char, c_ptr - logical(c_bool) :: ret - character(c_char), dimension(*) :: evname - type(c_ptr), value :: evgrp - end function my_removeeventfromeventgroup - ! - function my_geteventgroupname(my_eventgroup, string) result(string_ptr) bind(c, name='getEventGroupName') - import :: c_ptr, c_char - type(c_ptr) :: string_ptr - type(c_ptr), value :: my_eventgroup - character(c_char), dimension(*) :: string - end function my_geteventgroupname - ! - end interface - !> @endcond DOXYGEN_IGNORE_THIS - ! contains !> !! @brief Construct new event-Group using a string. @@ -3249,6 +2611,7 @@ end module mtime_eventgroups module mtime_utilities ! use, intrinsic :: iso_c_binding, only: c_int, c_char, c_null_char + use :: libmtime_c_bindings ! implicit none ! @@ -3261,28 +2624,6 @@ module mtime_utilities !> provides a string length for the maximum handable repetition string length input integer, parameter :: max_repetition_str_len = 132 ! - !> @cond DOXYGEN_IGNORE_THIS - interface - ! - function my_getRepetitions(repetitionString) bind(c, name='getRepetitions') - import :: c_int, c_char - integer(c_int) :: my_getRepetitions - character(c_char), dimension(*) :: repetitionString - end function my_getRepetitions - ! - subroutine my_splitRepetitionString(recurringTimeInterval, repetitor, start, end, duration) & - bind(c, name='splitRepetitionString') - import :: c_char - character(c_char), dimension(*) :: recurringTimeInterval - character(c_char), dimension(*) :: repetitor - character(c_char), dimension(*) :: start - character(c_char), dimension(*) :: end - character(c_char), dimension(*) :: duration - end subroutine my_splitRepetitionString - ! - end interface - !> @endcond DOXYGEN_IGNORE_THIS - ! contains !> !! @brief Extract number of repetitions from repetition string part. diff --git a/src/libmtime_c_bindings.f90 b/src/libmtime_c_bindings.f90 new file mode 100644 index 0000000000000000000000000000000000000000..98e300eba8fa34c6a8aa5c348f53a0cc61d2364d --- /dev/null +++ b/src/libmtime_c_bindings.f90 @@ -0,0 +1,659 @@ +module libmtime_c_bindings + ! + use, intrinsic :: iso_c_binding, only: c_bool, c_int, c_char, c_null_char, c_ptr, c_int64_t, & + & c_float, c_double, c_associated + ! + implicit none + ! + interface + ! + subroutine setCalendar(ct) bind(c, name='initCalendar') !TESTED-OK + import :: c_int + integer(c_int), value :: ct + end subroutine setCalendar + ! + subroutine resetCalendar() bind(c, name='freeCalendar') !TESTED-OK + end subroutine resetCalendar + ! + function calendarType() bind(c, name='getCalendarType') !TESTED-OK + import :: c_int + integer(c_int) :: calendarType + end function calendarType + ! + function my_calendartostring(calendar) result(c_pointer) bind(c, name='calendarToString') !TESTED-OK + import :: c_char, c_ptr + type(c_ptr) :: c_pointer + character(c_char), dimension(*) :: calendar + end function my_calendartostring + ! + end interface + + interface + function my_newjuliandelta(sign, day, ms) result(c_pointer) bind(c, name='newJulianDelta') + import :: c_int64_t, c_char, c_ptr + type(c_ptr) :: c_pointer + character(c_char) :: sign + integer(c_int64_t), value :: day + integer(c_int64_t), value :: ms + end function my_newjuliandelta + ! + subroutine my_deallocatejuliandelta(jd) bind(c,name='deallocateJulianDelta') + import :: c_ptr + type(c_ptr), value :: jd + end subroutine my_deallocatejuliandelta + end interface + + interface + function my_newjulianday(day, ms) result(c_pointer) bind(c, name='newJulianDay') + import :: c_int64_t, c_ptr + type(c_ptr) :: c_pointer + integer(c_int64_t), value :: day + integer(c_int64_t), value :: ms + end function my_newjulianday + ! + subroutine my_deallocatejulianday(jd) bind(c,name='deallocateJulianDay') + import :: c_ptr + type(c_ptr), value :: jd + end subroutine my_deallocatejulianday + ! + function my_juliandaytostring(my_julianday, string) result(string_ptr) bind(c, name='juliandayToString') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: my_julianday + character(c_char), dimension(*) :: string + end function my_juliandaytostring + ! + end interface + ! + interface + ! + function my_newdatefromstring(string) result(c_pointer) bind(c, name='newDate') + import :: c_char, c_ptr + type(c_ptr) :: c_pointer + character(c_char), dimension(*) :: string + end function my_newdatefromstring + ! + function my_newrawdate(year, month, day) result(c_pointer) bind(c, name='newRawDate') + import :: c_int64_t, c_int, c_ptr + type(c_ptr) :: c_pointer + integer(c_int64_t), value :: year + integer(c_int), value :: month, day + end function my_newrawdate + ! + function my_constructandcopydate(d) result(c_pointer) bind(c,name='constructAndCopyDate') + import :: c_ptr + type(c_ptr) :: c_pointer + type(c_ptr), value :: d + end function my_constructandcopydate + ! + subroutine my_deallocatedate(d) bind(c, name='deallocateDate') + import :: c_ptr + type(c_ptr), value :: d + end subroutine my_deallocatedate + ! + function my_replacedate(src, dest) result(ret_dest) bind(c, name='replaceDate') + import :: c_ptr + type(c_ptr) :: ret_dest + type(c_ptr), value :: src , dest + end function my_replacedate + ! + function my_datetostring(my_date, string) result(string_ptr) bind(c, name='dateToString') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: my_date + character(c_char), dimension(*) :: string + end function my_datetostring + ! + function my_datetoposixstring(my_date, string, fmtstr) result(string_ptr) bind(c, name='dateToPosixString') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: my_date + character(c_char), dimension(*) :: string + character(c_char), dimension(*) :: fmtstr + end function my_datetoposixstring + ! + end interface + ! + interface + ! + function my_newtimefromstring(string) result(c_pointer) bind(c, name='newTime') + import :: c_char, c_ptr + type(c_ptr) :: c_pointer + character(c_char), dimension(*) :: string + end function my_newtimefromstring + ! + function my_newrawtime(hour, minute, second, ms) result(c_pointer) bind(c, name='newRawTime') + import :: c_int, c_ptr + type(c_ptr) :: c_pointer + integer(c_int), value :: hour, minute, second, ms + end function my_newrawtime + ! + function my_constructandcopytime(t) result(c_pointer) bind(c,name='constructAndCopyTime') + import :: c_ptr + type(c_ptr) :: c_pointer + type(c_ptr), value :: t + end function my_constructandcopytime + ! + subroutine my_deallocatetime(t) bind(c,name='deallocateTime') + import :: c_ptr + type(c_ptr), value :: t + end subroutine my_deallocatetime + ! + function my_replacetime(src, dest) result(ret_dest) bind(c, name='replaceTime') + import :: c_ptr + type(c_ptr) :: ret_dest + type(c_ptr), value :: src , dest + end function my_replacetime + ! + function my_timetostring(my_time, string) result(string_ptr) bind(c, name='timeToString') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: my_time + character(c_char), dimension(*) :: string + end function my_timetostring + ! + function my_timetoposixstring(my_time, string, fmtstr) result(string_ptr) bind(c, name='timeToPosixString') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: my_time + character(c_char), dimension(*) :: string + character(c_char), dimension(*) :: fmtstr + end function my_timetoposixstring + ! + end interface + ! + interface + ! + function my_newdatetime(string) result(c_pointer) bind(c, name='newDateTime') + import :: c_ptr, c_char + type(c_ptr) :: c_pointer + character(c_char), dimension(*) :: string + end function my_newdatetime + ! + function my_newrawdatetime(year, month, day, hour, minute, second, ms) result(c_pointer) & + & bind(c, name='newRawDateTime') + import :: c_int64_t, c_int, c_ptr + type(c_ptr) :: c_pointer + integer(c_int64_t), value :: year + integer(c_int), value :: month, day, hour, minute, second, ms + end function my_newrawdatetime + ! + function my_constructandcopydatetime(dt) result(c_pointer) bind(c,name='constructAndCopyDateTime') + import :: c_ptr + type(c_ptr) :: c_pointer + type(c_ptr), value :: dt + end function my_constructandcopydatetime + ! + subroutine my_deallocatedatetime(dt) bind(c,name='deallocateDateTime') + import :: c_ptr + type(c_ptr), value :: dt + end subroutine my_deallocatedatetime + ! + function my_comparedatetime(op1, op2) result(ret) bind(c, name='compareDatetime') + import :: c_ptr, c_int + integer(c_int) :: ret + type(c_ptr), value :: op1 + type(c_ptr), value :: op2 + end function my_comparedatetime + + function my_replacedatetime(src, dest) result(ret_dest) bind(c, name='replaceDatetime') + import :: c_ptr + type(c_ptr) :: ret_dest + type(c_ptr), value :: src + type(c_ptr), value :: dest + end function my_replacedatetime + ! + function my_datetimetostring(my_time, string) result(string_ptr) bind(c, name='datetimeToString') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: my_time + character(c_char), dimension(*) :: string + end function my_datetimetostring + ! + function my_datetimetoposixstring(my_time, string, fmtstr) result(string_ptr) bind(c, name='datetimeToPosixString') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: my_time + character(c_char), dimension(*) :: string + character(c_char), dimension(*) :: fmtstr + end function my_datetimetoposixstring + ! + function my_getnoofdaysinmonthdatetime(dt) bind(c, name='getNoOfDaysInMonthDateTime') + import :: c_int, c_ptr + integer(c_int) :: my_getnoofdaysinmonthdatetime + type(c_ptr), value :: dt + end function my_getnoofdaysinmonthdatetime + ! + function my_getnoofdaysinyeardatetime(dt) bind(c, name='getNoOfDaysInYearDateTime') + import :: c_int, c_ptr + integer(c_int) :: my_getnoofdaysinyeardatetime + type(c_ptr), value :: dt + end function my_getnoofdaysinyeardatetime + ! + function my_getdayofyearfromdatetime(dt) bind(c, name='getDayOfYearFromDateTime') + import :: c_int, c_ptr + integer(c_int) :: my_getdayofyearfromdatetime + type(c_ptr), value :: dt + end function my_getdayofyearfromdatetime + ! + function my_getnoofsecondselapsedinmonthdatetime(dt) bind(c, name='getNoOfSecondsElapsedInMonthDateTime') + import :: c_int64_t, c_ptr + integer(c_int64_t) :: my_getnoofsecondselapsedinmonthdatetime + type(c_ptr), value :: dt + end function my_getnoofsecondselapsedinmonthdatetime + ! + function my_getnoofsecondselapsedindaydatetime(dt) bind(c, name='getNoOfSecondsElapsedInDayDateTime') + import :: c_int, c_ptr + integer(c_int) :: my_getnoofsecondselapsedindaydatetime + type(c_ptr), value :: dt + end function my_getnoofsecondselapsedindaydatetime + ! + function my_getjuliandayfromdatetime(dt, jd) bind(c, name='getJulianDayFromDateTime') + import :: c_ptr + type(c_ptr) :: my_getjuliandayfromdatetime + type(c_ptr), value :: dt, jd + end function my_getjuliandayfromdatetime + ! + function my_getdatetimefromjulianday(jd, dt) bind(c, name='getDateTimeFromJulianDay') + import :: c_ptr + type(c_ptr) :: my_getdatetimefromjulianday + type(c_ptr), value :: jd, dt + end function my_getdatetimefromjulianday + ! + end interface + ! + interface + ! + function my_newtimedeltafromstring(string) result(c_pointer) bind(c, name='newTimeDelta') + import :: c_char, c_ptr + type(c_ptr) :: c_pointer + character(c_char), dimension(*) :: string + end function my_newtimedeltafromstring + ! + function my_newrawtimedelta(sign, year, month, day, hour, minute, second, ms) result(c_pointer) & + & bind(c, name='newRawTimeDelta') + import :: c_int64_t, c_char, c_int, c_ptr + type(c_ptr) :: c_pointer + character(c_char), value :: sign + integer(c_int64_t), value :: year + integer(c_int), value :: month, day, hour, minute, second, ms + end function my_newrawtimedelta + ! + function my_constructandcopytimedelta(td) result(c_pointer) bind(c,name='constructAndCopyTimeDelta') + import :: c_ptr + type(c_ptr) :: c_pointer + type(c_ptr), value :: td + end function my_constructandcopytimedelta + ! + subroutine my_deallocatetimedelta(dt) bind(c, name='deallocateTimeDelta') + import :: c_ptr + type(c_ptr), value :: dt + end subroutine my_deallocatetimedelta + ! + function my_comparetimedelta(op1, op2) result(ret) bind(c, name='compareTimeDelta') + import :: c_ptr, c_int + integer(c_int) :: ret + type(c_ptr), value :: op1 + type(c_ptr), value :: op2 + end function my_comparetimedelta + ! + function my_gettimedeltafromdate(my_date1,my_date2,timedelta_return) result(timedelta_ptr) & + & bind(c,name='getTimeDeltaFromDate') + import :: c_ptr + type(c_ptr) :: timedelta_ptr + type(c_ptr), value :: my_date1, my_date2, timedelta_return + end function my_gettimedeltafromdate + ! + function my_gettimedeltafromdatetime(my_datetime1,my_datetime2,timedelta_return) result(timedelta_ptr) & + & bind(c,name='getTimeDeltaFromDateTime') + import :: c_ptr + type(c_ptr) :: timedelta_ptr + type(c_ptr), value :: my_datetime1, my_datetime2, timedelta_return + end function my_gettimedeltafromdatetime + ! + function my_gettotalmillisecondstimedelta(my_timedelta, my_datetime) & + & bind(c, name='getTotalMilliSecondsTimeDelta') + import :: c_ptr, c_int64_t + integer(c_int64_t) :: my_gettotalmillisecondstimedelta + type(c_ptr), value :: my_timedelta, my_datetime + end function my_gettotalmillisecondstimedelta + ! + function my_gettotalsecondstimedelta(my_timedelta, my_datetime) bind(c, name='getTotalSecondsTimeDelta') + import :: c_ptr, c_int64_t + integer(c_int64_t) :: my_gettotalsecondstimedelta + type(c_ptr), value :: my_timedelta, my_datetime + end function my_gettotalsecondstimedelta + ! + function my_timedeltatostring(td, tostring) result(string_ptr) bind(c, name='timedeltaToString') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: td + character(c_char), dimension(*) :: tostring + end function my_timedeltatostring + ! + function my_addtimedeltatodatetime(my_datetime, my_timedelta, ret_datetime) result(datetime_ptr) & + & bind(c, name='addTimeDeltaToDateTime') + import :: c_ptr + type(c_ptr) :: datetime_ptr + type(c_ptr), value :: my_datetime, my_timedelta, ret_datetime + end function my_addtimedeltatodatetime + ! + function my_addtimedeltatodate(my_date, my_timedelta, ret_date) result(date_ptr) & + & bind(c, name='addTimeDeltaToDate') + import :: c_ptr + type(c_ptr) :: date_ptr + type(c_ptr), value :: my_date, my_timedelta, ret_date + end function my_addtimedeltatodate + ! + function my_elementwisescalarmultiplytimedelta(my_timedelta, lambda, scaled_timedelta) result(timedelta_return) & + & bind(c, name='elementwiseScalarMultiplyTimeDelta') + import :: c_ptr, c_int64_t + type(c_ptr) ::timedelta_return + type(c_ptr), value :: my_timedelta, scaled_timedelta + integer(c_int64_t), value :: lambda + end function my_elementwisescalarmultiplytimedelta + ! + function my_elementwisescalarmultiplytimedeltadp(my_timedelta, lambda, scaled_timedelta) result(timedelta_return) & + & bind(c, name='elementwiseScalarMultiplyTimeDeltaDP') + import :: c_ptr, c_double + type(c_ptr) ::timedelta_return + type(c_ptr), value :: my_timedelta, scaled_timedelta + real(c_double), value :: lambda + end function my_elementwisescalarmultiplytimedeltadp + ! + function my_elementwiseAddTimeDeltatoTimeDelta(my_timedelta1,my_timedelta2,added_timedelta) result(timedelta_return) & + & bind(c, name='elementwiseAddTimeDeltatoTimeDelta') + import :: c_ptr + type(c_ptr) :: timedelta_return + type(c_ptr), value :: my_timedelta1,my_timedelta2,added_timedelta + end function my_elementwiseAddTimeDeltatoTimeDelta + ! + function my_modulotimedelta(a, p, quot) result(rem) bind(c, name='moduloTimedelta') + import :: c_ptr, c_int64_t + integer(c_int64_t) :: rem + type(c_ptr), value :: a + type(c_ptr), value :: p + type(c_ptr), value :: quot + end function my_modulotimedelta + ! + function my_getptstringfromms(ms, tostring) result(string_ptr) bind(c, name='getPTStringFromMS') + import :: c_ptr, c_int64_t, c_char + type(c_ptr) :: string_ptr + integer(c_int64_t), value :: ms + character(c_char), dimension(*) :: tostring + end function my_getptstringfromms + ! + function my_getptstringfromsecondsint(s, tostring) result(string_ptr) bind(c, name='getPTStringFromSeconds') + import :: c_ptr, c_int64_t, c_char + type(c_ptr) :: string_ptr + integer(c_int64_t), value :: s + character(c_char), dimension(*) :: tostring + end function my_getptstringfromsecondsint + ! + function my_getptstringfromsecondsfloat(s, tostring) result(string_ptr) bind(c, name='getPTStringFromSecondsFloat') + import :: c_ptr, c_float, c_char + type(c_ptr) :: string_ptr + real(c_float), value :: s + character(c_char), dimension(*) :: tostring + end function my_getptstringfromsecondsfloat + ! + function my_getptstringfromsecondsdouble(s, tostring) result(string_ptr) bind(c, name='getPTStringFromSecondsDouble') + import :: c_ptr, c_double, c_char + type(c_ptr) :: string_ptr + real(c_double), value :: s + character(c_char), dimension(*) :: tostring + end function my_getptstringfromsecondsdouble + ! + function my_getptstringfromminutes(m, tostring) result(string_ptr) bind(c, name='getPTStringFromMinutes') + import :: c_ptr, c_int64_t, c_char + type(c_ptr) :: string_ptr + integer(c_int64_t),value :: m + character(c_char), dimension(*) :: tostring + end function my_getptstringfromminutes + ! + function my_getptstringfromhours(h, tostring) result(string_ptr) bind(c, name='getPTStringFromHours') + import :: c_ptr, c_int64_t, c_char + type(c_ptr) :: string_ptr + integer(c_int64_t),value :: h + character(c_char), dimension(*) :: tostring + end function my_getptstringfromhours + ! + function my_timedeltatojuliandelta(td,dt,jd) result(c_pointer) bind(c,name='timeDeltaToJulianDelta') + import :: c_int64_t, c_ptr + type(c_ptr) :: c_pointer + type(c_ptr), value :: td + type(c_ptr), value :: dt + type(c_ptr), value :: jd + end function my_timedeltatojuliandelta + ! + function my_divideTimeDeltaInSeconds(dividend, divisor, quotient) result(ret_quotient) bind(c,name='divideTimeDeltaInSeconds') + import :: c_ptr + type(c_ptr) :: ret_quotient + type(c_ptr), value :: dividend + type(c_ptr), value :: divisor + type(c_ptr), value :: quotient + end function my_divideTimeDeltaInSeconds + ! + function my_divideDatetimeDifferenceInSeconds(dt1, dt2, divisor, quotient) result(ret_quotient) & + & bind(c,name='divideDatetimeDifferenceInSeconds') + import :: c_ptr + type(c_ptr) :: ret_quotient + type(c_ptr), value :: dt1 + type(c_ptr), value :: dt2 + type(c_ptr), value :: divisor + type(c_ptr), value :: quotient + end function my_divideDatetimeDifferenceInSeconds + ! + function my_divideTwoDatetimeDiffsInSeconds(dt1_dividend, dt2_dividend, & + & dt1_divisor, dt2_divisor, denominator, quotient) & + & result(ret_quotient) & + & bind(c,name='divideTwoDatetimeDiffsInSeconds') + import :: c_ptr + type(c_ptr) :: ret_quotient + type(c_ptr), value :: dt1_dividend + type(c_ptr), value :: dt2_dividend + type(c_ptr), value :: dt1_divisor + type(c_ptr), value :: dt2_divisor + type(c_ptr), value :: denominator + type(c_ptr), value :: quotient + end function my_divideTwoDatetimeDiffsInSeconds + ! + end interface + ! + interface + ! + function my_newevent(name, referenceDate, firstdate, lastDate, interval, offset) result(c_pointer) & + & bind(c, name='newEvent') + import :: c_char, c_ptr + type(c_ptr) :: c_pointer + character(c_char), dimension(*) :: name + character(c_char), dimension(*) :: referenceDate + character(c_char), dimension(*) :: firstDate + character(c_char), dimension(*) :: lastDate + character(c_char), dimension(*) :: interval + character(c_char), dimension(*) :: offset + end function my_newevent + ! + function my_neweventwithdatatypes(name, referenceDate, firstdate, lastDate, interval, offset) & + & result(c_pointer) bind(c, name='newEventWithDataType') + import :: c_char, c_ptr + type(c_ptr) :: c_pointer + character(c_char), dimension(*) :: name + type(c_ptr), value :: referenceDate + type(c_ptr), value :: firstDate + type(c_ptr), value :: lastDate + type(c_ptr), value :: interval + type(c_ptr), value :: offset + end function my_neweventwithdatatypes + ! + subroutine my_deallocateevent(ev) bind(c,name='deallocateEvent') + import :: c_ptr + type(c_ptr), value :: ev + end subroutine my_deallocateevent + ! + function my_constructandcopyevent(my_event) result(event_copy) bind(c, name='constructAndCopyEvent') + import :: c_ptr + type(c_ptr) :: event_copy + type(c_ptr), value :: my_event + end function my_constructandcopyevent + ! + function my_eventtostring(my_event, string) result(string_ptr) bind(c, name='eventToString') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: my_event + character(c_char), dimension(*) :: string + end function my_eventtostring + ! + function my_isCurrentEventActive(my_event, my_datetime, plus_slack, minus_slack) & + & result(ret) bind(c, name='isCurrentEventActive') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + type(c_ptr), value :: my_datetime + type(c_ptr), value :: plus_slack + type(c_ptr), value :: minus_slack + logical(c_bool) :: ret + end function my_isCurrentEventActive + ! + function my_iseventnextinnextday(my_event) result(ret) bind(c, name='iseventNextInNextDay') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_iseventnextinnextday + ! + function my_iseventnextinnextmonth(my_event) result(ret) bind(c, name='iseventNextInNextMonth') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_iseventnextinnextmonth + ! + function my_iseventnextinnextyear(my_event) result(ret) bind(c, name='iseventNextInNextYear') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_iseventnextinnextyear + ! + function my_gettriggernexteventatdatetime(my_event,my_currentdatetime,my_datetime) result(c_pointer) & + & bind(c, name='getTriggerNextEventAtDateTime') + import :: c_ptr + type(c_ptr) :: c_pointer + type(c_ptr), value :: my_event + type(c_ptr), value :: my_currentdatetime + type(c_ptr), value :: my_datetime + end function my_gettriggernexteventatdatetime + ! + function my_gettriggeredpreviouseventatdatetime(my_event,my_datetime) result(c_pointer) & + & bind(c, name='getTriggeredPreviousEventAtDateTime') + import :: c_ptr + type(c_ptr) :: c_pointer + type(c_ptr), value :: my_event + type(c_ptr), value :: my_datetime + end function my_gettriggeredpreviouseventatdatetime + ! + function my_geteventname(my_event, string) result(c_pointer) bind(c, name='getEventName') + import :: c_ptr, c_char + type(c_ptr) :: c_pointer + type(c_ptr), value :: my_event + character(c_char), dimension(*) :: string + end function my_geteventname + ! + function my_getnexteventisfirst(my_event) result(ret) bind(c, name='getNextEventIsFirst') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_getnexteventisfirst + ! + function my_geteventisfirstinday(my_event) result(ret) bind(c, name='getEventisFirstInDay') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_geteventisfirstinday + ! + function my_geteventisfirstinmonth(my_event) result(ret) bind(c, name='getEventisFirstInMonth') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_geteventisfirstinmonth + ! + function my_geteventisfirstinyear(my_event) result(ret) bind(c, name='getEventisFirstInYear') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_geteventisfirstinyear + ! + function my_geteventislastinday(my_event) result(ret) bind(c, name='getEventisLastInDay') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_geteventislastinday + ! + function my_geteventislastinmonth(my_event) result(ret) bind(c, name='getEventisLastInMonth') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_geteventislastinmonth + ! + function my_geteventislastinyear(my_event) result(ret) bind(c, name='getEventisLastInYear') + import :: c_bool, c_ptr + type(c_ptr), value :: my_event + logical(c_bool) :: ret + end function my_geteventislastinyear + ! + end interface + ! + interface + ! + function my_neweventgroup(name) result(c_pointer) bind(c, name='newEventGroup') + import :: c_char, c_ptr + type(c_ptr) :: c_pointer + character(c_char), dimension(*) :: name + end function my_neweventgroup + ! + subroutine my_deallocateeventgroup(evgrp) bind(c,name='deallocateEventGroup') + import :: c_ptr + type(c_ptr), value :: evgrp + end subroutine my_deallocateeventgroup + ! + function my_addeventtoeventgroup(my_event, my_eventgroup) result(ret) bind(c, name='addNewEventToEventGroup') + import :: c_bool, c_ptr + logical(c_bool) :: ret + type(c_ptr), value :: my_event + type(c_ptr), value :: my_eventgroup + end function my_addeventtoeventgroup + ! + function my_removeeventfromeventgroup(evname, evgrp) result(ret) bind(c, name='removeEventFromEventGroup') + import :: c_bool, c_char, c_ptr + logical(c_bool) :: ret + character(c_char), dimension(*) :: evname + type(c_ptr), value :: evgrp + end function my_removeeventfromeventgroup + ! + function my_geteventgroupname(my_eventgroup, string) result(string_ptr) bind(c, name='getEventGroupName') + import :: c_ptr, c_char + type(c_ptr) :: string_ptr + type(c_ptr), value :: my_eventgroup + character(c_char), dimension(*) :: string + end function my_geteventgroupname + ! + end interface + ! + interface + ! + function my_getRepetitions(repetitionString) bind(c, name='getRepetitions') + import :: c_int, c_char + integer(c_int) :: my_getRepetitions + character(c_char), dimension(*) :: repetitionString + end function my_getRepetitions + ! + subroutine my_splitRepetitionString(recurringTimeInterval, repetitor, start, end, duration) & + bind(c, name='splitRepetitionString') + import :: c_char + character(c_char), dimension(*) :: recurringTimeInterval + character(c_char), dimension(*) :: repetitor + character(c_char), dimension(*) :: start + character(c_char), dimension(*) :: end + character(c_char), dimension(*) :: duration + end subroutine my_splitRepetitionString + ! + end interface + ! +end module libmtime_c_bindings diff --git a/src/libmtime_hl.f90 b/src/libmtime_hl.f90 index 11cf3f4c43093fe561fbae584448a14505fea512..76eb7f42dd5169ead12080d36175fbe7ec18e9ea 100644 --- a/src/libmtime_hl.f90 +++ b/src/libmtime_hl.f90 @@ -1,3 +1,6 @@ +!TODO: extract internal c binding routines (my_...) from libmtime.f90 into extra module +! and derive old and new interface out of this + !> @file libmtime_hl.f90 !! !! @brief Providing a high level interface for the Fortran language bindings of libmtime. @@ -91,7 +94,7 @@ MODULE mtime_hl !> wrapped datatype of the standard mtime interface TYPE(datetime) :: dt = datetime(date(year=0_c_int64_t, month=UNINITIALIZED, day=0_c_int),& - & time(hour=0_c_int, minute=0_c_int, second=0_c_int, ms=0_c_int)) + & time(hour=0_c_int, minute=0_c_int, second=0_c_int, ms=0_c_int)) CONTAINS @@ -128,6 +131,8 @@ MODULE mtime_hl PROCEDURE :: less_or_equal_datetime => t_datetime_less_or_equal PROCEDURE :: greater_or_equal_datetime => t_datetime_greater_or_equal + PROCEDURE :: get_c_pointer => t_datetime_get_c_pointer + GENERIC :: ASSIGNMENT(=) => assign_t_datetime GENERIC :: OPERATOR(+) => add_timedelta GENERIC :: OPERATOR(-) => sub_timedelta @@ -144,7 +149,7 @@ MODULE mtime_hl INTERFACE t_datetime MODULE PROCEDURE t_datetime_assign_string MODULE PROCEDURE t_datetime_assign_raw - END INTERFACE + END INTERFACE t_datetime !> Wrapper class for "mtime" data type "timedelta". @@ -155,8 +160,8 @@ MODULE mtime_hl !> wrapped datatype of the standard mtime interface TYPE(timedelta) :: td = timedelta( flag_std_form = 0_c_int, sign = '+', year = 0_c_int64_t, & - & month = UNINITIALIZED, day = 0_c_int, hour = 0_c_int, & - & minute = 0_c_int, second = 0_c_int, ms = 0_c_int ) + & month = UNINITIALIZED, day = 0_c_int, hour = 0_c_int, & + & minute = 0_c_int, second = 0_c_int, ms = 0_c_int ) CONTAINS @@ -200,6 +205,8 @@ MODULE mtime_hl PROCEDURE :: scalar_multiply_int => t_timedelta_scalar_multiply_int PROCEDURE :: scalar_multiply_real => t_timedelta_scalar_multiply_real + PROCEDURE :: get_c_pointer => t_timedelta_get_c_pointer + GENERIC :: ASSIGNMENT(=) => assign_t_timedelta GENERIC :: OPERATOR(==) => equal_datetime GENERIC :: OPERATOR(/=) => not_equal_datetime @@ -208,37 +215,37 @@ MODULE mtime_hl GENERIC :: OPERATOR(<=) => less_or_equal_datetime GENERIC :: OPERATOR(>=) => greater_or_equal_datetime GENERIC :: OPERATOR(*) => scalar_multiply_long, scalar_multiply_int, & - & scalar_multiply_real + & scalar_multiply_real END TYPE t_timedelta INTERFACE t_timedelta MODULE PROCEDURE t_timedelta_assign_string - END INTERFACE + END INTERFACE t_timedelta INTERFACE t_timedeltaFromMilliseconds MODULE PROCEDURE t_timedelta_assign_ms MODULE PROCEDURE t_timedelta_assign_ms_i8 - END INTERFACE + END INTERFACE t_timedeltaFromMilliseconds INTERFACE t_timedeltaFromSeconds MODULE PROCEDURE t_timedelta_assign_sec MODULE PROCEDURE t_timedelta_assign_sec_i8 - END INTERFACE + END INTERFACE t_timedeltaFromSeconds INTERFACE OPERATOR(*) MODULE PROCEDURE t_timedelta_scalar_multiply_inv_long MODULE PROCEDURE t_timedelta_scalar_multiply_inv_int MODULE PROCEDURE t_timedelta_scalar_multiply_inv_real - END INTERFACE + END INTERFACE OPERATOR(*) INTERFACE min MODULE PROCEDURE t_datetime_min - END INTERFACE + END INTERFACE min INTERFACE max MODULE PROCEDURE t_datetime_max - END INTERFACE + END INTERFACE max TYPE t_julianday @@ -275,7 +282,7 @@ MODULE mtime_hl INTERFACE t_juliandelta MODULE PROCEDURE t_juliandelta_assign_raw - END INTERFACE + END INTERFACE t_juliandelta TYPE t_event @@ -330,7 +337,7 @@ MODULE mtime_hl INTERFACE t_event MODULE PROCEDURE t_event_assign_raw MODULE PROCEDURE t_event_assign_types - END INTERFACE + END INTERFACE t_event TYPE t_eventGroup @@ -345,7 +352,7 @@ MODULE mtime_hl CONTAINS PROCEDURE :: append => t_eventGroup_addToGroup - + !> TODO: implement the removal of a event in a list !PROCEDURE :: remove => t_eventGroup_removeFromGroup @@ -362,11 +369,11 @@ MODULE mtime_hl INTERFACE t_eventGroup MODULE PROCEDURE t_eventGroup_constructor - END INTERFACE + END INTERFACE t_eventGroup INTEGER :: event_group_id = 0 INTEGER :: event_id = 0 - + CONTAINS !___________________________________________________________________________ @@ -863,6 +870,8 @@ CONTAINS CLASS (t_timedelta) :: this TYPE(timedelta), POINTER :: td_tmp INTEGER :: errno + !TODO: consistent use of get_c_ptr and my_... (internal c bindings instead of calling Fortran wrappers) + ! means replace timeseltatostring with my_timedeltatostring td_tmp => newtimedelta(this%td, errno) CALL handle_errno(errno, __FILE__, __LINE__) CALL timedeltatostring(td_tmp, t_timedelta_toString, errno) @@ -900,7 +909,7 @@ CONTAINS tmp_dt => newDateTime(dt_tmp%dt, errno) CALL handle_errno(errno, __FILE__, __LINE__) CALL divideDatetimeDifferenceInSeconds(tmp_dt, tmp_ref, & - & tmp_divisor, quotient, errno) + & tmp_divisor, quotient, errno) CALL handle_errno(errno, __FILE__, __LINE__) CALL deallocateDatetime(tmp_dt) @@ -1044,7 +1053,7 @@ CONTAINS CHARACTER(len=*), INTENT(in), OPTIONAL :: offset CHARACTER(len=4) :: zeroOffset = "PT0S" - + t_event_assign_raw%eventName = name t_event_assign_raw%eventReferenceDateTime = t_datetime(referenceDate) t_event_assign_raw%eventFirstDateTime = t_datetime(firstDate) @@ -1052,7 +1061,7 @@ CONTAINS t_event_assign_raw%eventInterval = t_timedelta(interval) IF (PRESENT(offset)) THEN t_event_assign_raw%eventOffset = t_timedelta(offset) - else + ELSE t_event_assign_raw%eventOffset = t_timedelta(zeroOffset) ENDIF @@ -1068,7 +1077,7 @@ CONTAINS TYPE(t_timedelta), INTENT(in), OPTIONAL :: offset CHARACTER(len=4) :: zeroOffset = "PT0S" - + t_event_assign_types%eventName = name t_event_assign_types%eventReferenceDateTime = referenceDate t_event_assign_types%eventFirstDateTime = firstDate @@ -1076,7 +1085,7 @@ CONTAINS t_event_assign_types%eventInterval = interval IF (PRESENT(offset)) THEN t_event_assign_types%eventOffset = offset - else + ELSE t_event_assign_types%eventOffset = t_timedelta(zeroOffset) ENDIF @@ -1088,10 +1097,10 @@ CONTAINS FUNCTION t_event_next_event(this) TYPE(t_event), POINTER :: t_event_next_event CLASS(t_event) :: this - t_event_next_event => null() - IF (associated(this%nextEventInGroup)) then + t_event_next_event => NULL() + IF (ASSOCIATED(this%nextEventInGroup)) THEN t_event_next_event => this%nextEventInGroup - endif + ENDIF END FUNCTION t_event_next_event FUNCTION t_event_getId(this) RESULT(res) @@ -1100,7 +1109,7 @@ CONTAINS res = this%eventId END FUNCTION t_event_getId - FUNCTION t_event_getName(this) RESULT(res) + FUNCTION t_event_getName(this) RESULT(res) CHARACTER(len=max_event_str_len) :: res CLASS (t_event) :: this res = this%eventName @@ -1182,6 +1191,30 @@ CONTAINS event_ptr => this%first_event_in_group END FUNCTION t_eventGroup_getFirstEvent + FUNCTION t_datetime_get_c_pointer(this) RESULT(c_pointer) + TYPE(c_ptr) :: c_pointer + CLASS(t_datetime) :: this + TYPE(datetime), POINTER :: datetime_pointer + + datetime_pointer => newDatetime("0001-01-01T00:00:00") + + datetime_pointer = this%dt + + c_pointer = C_LOC(datetime_pointer) + END FUNCTION t_datetime_get_c_pointer + + FUNCTION t_timedelta_get_c_pointer(this) RESULT(c_pointer) + TYPE(c_ptr) :: c_pointer + CLASS(t_timedelta) :: this + TYPE(timedelta), POINTER :: timedelta_pointer + + timedelta_pointer => newTimedelta("PT0S") + + timedelta_pointer = this%td + + c_pointer = C_LOC(timedelta_pointer) + END FUNCTION t_timedelta_get_c_pointer + END MODULE mtime_hl !> !! @} diff --git a/src/trigger.f90 b/src/trigger.f90 deleted file mode 100644 index 7a405b05f180b96da304c61077a53e981579ce07..0000000000000000000000000000000000000000 --- a/src/trigger.f90 +++ /dev/null @@ -1,443 +0,0 @@ -!> TODO: we need undefs for a lot of datatypes - -FUNCTION triggerEvent(this, current_dt, plus_slack, minus_slack) RESULT(res) - CLASS(t_event) :: this - TYPE(t_datetime), INTENT(in) :: current_dt - TYPE(t_timedelta), INTENT(in) :: plus_slack - TYPE(t_timedelta), INTENT(in) :: minus_slack - - TYPE(t_timedelta) :: modulo_td - LOGICAL :: cmp_val_flag - - IF (this%neverTriggerEvent) THEN - res = .FALSE. - ENDIF - - IF (ASSOCIATED(event%eventsLastEvaluationDateTime)) THEN - IF (this%eventsLastEvaluationDateTime == current_dt) - res = .TRUE. - RETURN - ENDIF - - this%triggerCurrentEvent = .FALSE. - - this%eventisFirstInDay = .FALSE. - this%eventisFirstInMonth = .FALSE. - this%eventisFirstInYear = .FALSE. - this%eventisLastInDay = .FALSE. - this%eventisLastInMonth = .FALSE. - this%eventisLastInYear = .FALSE. - - IF (this%eventFirstDateTime == current_dt) THEN - res = .FALSE. - RETURN - ENDIF - - - IF (this%eventLastDateTime .AND. (compareDatetime(current_dt,this%eventLastDateTime) == greater_than)) THEN - IF (.NOT. this%nextEventIsFirst) THEN - this%lastEventWasFinal = true - res = .FALSE. - RETURN - ENDIF - - IF (isTriggerTimeInRange(current_dt, this%triggerNextEventDateTime, plus_slack, NULL) == greater_than) THEN - - moduloTimeDeltaFromDateTime(this%triggerNextEventDateTime, this%eventInterval, current_dt, modulo_td) - addTimeDeltaToDateTime(current_dt,modulo_td,this%triggerNextEventDateTime) - ENDIF - - IF ( .NOT. this%lastEventWasFinal & - & .AND. & - & (isTriggerTimeInRange(current_dt, this%triggerNextEventDateTime, plus_slack, minus_slack) == equal_to) ) THEN - - IF (this%nextEventIsFirst .OR. iseventNextInNextDay(event)) this%eventisFirstInDay = .TRUE. - IF (this%nextEventIsFirst .OR. iseventNextInNextMonth(event)) this%eventisFirstInMonth = .TRUE. - IF (this%nextEventIsFirst .OR. iseventNextInNextYear(event)) this%eventisFirstInYear = .TRUE. - - this%triggeredPreviousEventDateTime = curent_dt - - cmp_val_flag = isTriggerTimeInRange(addTimeDeltaToDateTime(current_dt, this%eventInterval,tmp_dt), & - this%eventLastDateTime, NULL, minus_slack - IF (.NOT.(this%eventLastDateTime .AND. (cmp_val_flag == greater_than)) THEN - addTimeDeltaToDateTime(this%triggerNextEventDateTime,this%eventInterval,this%triggerNextEventDateTime) - ELSE - this%lastEventWasFinal = true - ENDIF - - this%triggerCurrentEvent = true - - IF ((this%eventLastDateTime .AND. (cmp_val_flag == greater_than)) .OR. iseventNextInNextDay(event)) this%eventisLastInDay = .TRUE. - IF ((this%eventLastDateTime .AND. (cmp_val_flag == greater_than)) .OR. iseventNextInNextMonth(event)) this%eventisLastInMonth = .TRUE. - IF ((this%eventLastDateTime .AND. (cmp_val_flag == greater_than)) .OR. iseventNextInNextYear(event)) this%eventisLastInYear = .TRUE. - - this%nextEventIsFirst = false - - this%eventsLastEvaluationDateTime = current_dt - - res = .TRUE. - RETURN - ENDIF - - res = .FALSE. - RETURN - ENDIF - ELSE - res = .FALSE. - RETURN - ENDIF - -END FUNCTION triggerEvent - -FUNCTION iseventNextInNextDay(this) RESULT(res) - LOGICAL :: res - CLASS(t_event) :: this - TYPE(t_date) :: d_next - TYPE(t_date) :: d_prev - d_next = t_date(this%triggerNextEventDateTime) - d_prev = t_date(this%triggeredPreviousEventDateTime) - res = .FALSE. - IF (d_next > d_prev) res = .TRUE. -END FUNCTION iseventNextInNextDay -FUNCTION iseventNextInNextMonth(this) RESULT(res) - LOGICAL :: res - CLASS(t_event) :: this - TYPE(t_date) :: d_next - TYPE(t_date) :: d_prev - d_next = t_date(this%triggerNextEventDateTime) - d_prev = t_date(this%triggeredPreviousEventDateTime) - d_next%day = 1 - d_prev%day = 1 - res = .FALSE. - IF (d_next > d_prev) res = .TRUE. -END FUNCTION iseventNextInNextMonth -FUNCTION iseventNextInNextYear(this) RESULT(res) - LOGICAL :: res - CLASS(t_event) :: this - TYPE(t_date) :: d_next - TYPE(t_date) :: d_prev - d_next = t_date(this%triggerNextEventDateTime) - d_prev = t_date(this%triggeredPreviousEventDateTime) - d_next%day = 1 - d_next%month = 1 - d_prev%day = 1 - d_prev%month = 1 - res = .FALSE. - IF (d_next > d_prev) res = .TRUE. -END FUNCTION iseventNextInNextYear - -FUNCTION getEventFirstTriggerDateTime(start_dt, timestep, offset, ref_dt) RESULT(first_trigger_dt) - TYPE(t_datetime) :: first_trigger_dt - TYPE(t_datetime), INTENT(in) :: start_dt - TYPE(t_timedelta), INTENT(in) :: timestep - TYPE(t_timedelta), INTENT(in) :: offset - TYPE(t_datetime), INTENT(in) :: ref_dt - - TYPE(t_datetime) :: anchor - TYPE(t_timedelta) :: timestep_bkw - TYPE(t_julianday) :: start_jd - TYPE(t_juliandelta) :: timestep_jd - TYPE(t_juliandelta) :: timestep_fastfwd_jd - TYPE(t_juliandelta) :: timestep_fastbkw_jd - - INTEGER(c_int64_t) :: differenceOfYears, yearToAdd - INTEGER :: differenceOfMonth, monthsToAdd - INTEGER(c_int64_t) :: areDatesToFar - INTEGER :: lambda - - IF ( & - & timestep%year /= 0 .AND. timestep%month == 0 .AND. timestep%day == 0 & - & .AND. timestep%hour == 0 .AND. timestep%minute == 0 .AND. timestep%second == 0 .AND. timestep%ms == 0) THEN - - anchor = ref_dt + offset - - IF (anchor > start_dt) THEN - - first_trigger_dt = anchor - - ELSE - - differenceOfYears = start_dt%date%year - anchor%date%year - yearsToAdd = MOD(differenceOfYears % timestep%year) - - - first_trigger_dt = anchor - first_trigger_dt%year = first_trigger_dt%year + yearsToAdd - - ENDIF - - RETURN - - ELSE IF ( & - & timestep%year == 0 .AND. timestep%month /= 0 .AND. timestep%day == 0 & - & .AND. timestep%hour == 0 .AND. timestep%minute == 0 .AND. timestep%second == 0 .AND. timestep%ms == 0) THEN - - anchor = ref_dt + offset - - IF (anchor > start_dt) THEN - - first_trigger_dt = anchor - - ELSE - - differenceOfMonths = 12*(start_dt%date%year - anchor%date%year) + start_dt%date%month - anchor%date%month - - yearsToAdd = differenceOfMonths / 12 - monthsToAdd = MOD(differenceOfMonths, timestep%month) - - first_trigger_dt = anchor - first_trigger_dt%date%year = first_trigger_dt%date%year + yearsToAdd - first_trigger_dt%date%month = first_trigger_dt%date%month + monthsToAdd - - ENDIF - - RETURN - - ELSE IF (timestep%year == 0 .AND. timestep%month == 0) - - start_jd = t_julianday(start_dt) - - timestep_jd = t_juliandelta(timestep, ref_dt) - - anchor = ref_dt + offset - anchor_jd = t_julianday(anchor) - - - IF (timestep_jd%day /= 0) THEN - are_dates_too_far = (start_jd%day - anchor_jd%day)/(timestep_jd%day) - ELSE IF (timestep_jd%ms /= 0) THEN - are_dates_too_far = (start_jd%day - anchor_jd%day)/((float)timestep_jd%ms/NO_OF_MS_IN_A_DAY) - ENDIF - - lambda = 1 - IF (are_dates_too_far > 10 .OR. are_dates_too_far < -10) THEN - lambda = 100000 - ENDIF - - timestep_fastfwd_jd%day = lambda*timestep_jd%day - timestep_fastfwd_jd%ms = lambda*timestep_jd%ms - - DO WHILE (timestep_fastfwd_jd%ms >= NO_OF_MS_IN_A_DAY) - timestep_fastfwd_jd%day++ - timestep_fastfwd_jd%ms = timestep_fastfwd_jd%ms - NO_OF_MS_IN_A_DAY - ENDDO - - timestep_bkw = timestep - timestep_bkw%sign = '-' - - timestep_bkw_jd = t_juliandelta(timestep_bkw, ref_dt) - - timestep_fastbkw_jd%day = lambda*timestep_bkw_jd%day - timestep_fastbkw_jd%ms = lambda*timestep_bkw_jd%ms - - DO WHILE (timestep_fastbkw_jd%ms <= (-1)*(NO_OF_MS_IN_A_DAY)) - timestep_fastbkw_jd%day-- - timestep_fastbkw_jd%ms = timestep_fastbkw_jd%ms + NO_OF_MS_IN_A_DAY - ENDDO - - IF (start_dt > ref_date) THEN - - DO - anchor_jd%day = anchor_jd%day + timestep_fastfwd_jd%day - anchor_jd%ms = anchor_jd%ms + timestep_fastfwd_jd%ms - - IF (anchor_jd%ms >= NO_OF_MS_IN_A_DAY) THEN - anchor_jd%day = anchor_jd%day + 1 - anchor_jd%ms = anchor_jd%ms - NO_OF_MS_IN_A_DAY - ENDIF - - IF ((anchor_jd%day > start_jd%day) .OR. (anchor_jd%day == start_jd%day .AND. anchor_jd%ms > start_jd%ms)) EXIT - ENDDO - - anchor_jd%day = anchor_jd%day - timestep_fastfwd_jd%day - anchor_jd%ms = anchor_jd%ms - timestep_fastfwd_jd%ms - - IF (anchor_jd%ms < 0) THEN - anchor_jd%day = anchor_jd%day - 1 - anchor_jd%ms = anchor_jd%ms + NO_OF_MS_IN_A_DAY - ENDIF - - DO - anchor_jd%day = anchor_jd%day + timestep_jd%day - anchor_jd%ms = anchor_jd%ms + timestep_jd%ms - - IF (anchor_jd%ms >= NO_OF_MS_IN_A_DAY) THEN - anchor_jd%day = anchor_jd%day + 1 - anchor_jd%ms = anchor_jd%ms - NO_OF_MS_IN_A_DAY - ENDIF - - IF ((anchor_jd%day > start_jd%day) .OR. (anchor_jd%day == start_jd%day .AND. anchor_jd%ms >= start_jd%ms)) EXIT - ENDDO - - anchor_jd = t_juliandelta(anchor) - - ELSE IF (start_dt == ref_dt) THEN - - ! nothing to do - - ELSE IF (start_dt < ref_dt) THEN - - DO - anchor_jd%day = anchor_jd%day + timestep_fastbkw_jd%day - anchor_jd%ms = anchor_jd%ms + timestep_fastbkw_jd%ms - - IF ( anchor_jd%ms < 0 ) THEN - anchor_jd%day = anchor_jd%day - 1 - anchor_jd%ms = anchor_jd%ms + NO_OF_MS_IN_A_DAY - ENDIF - - IF (anchor_jd%day < start_jd%day .OR. (anchor_jd%day == start_jd%day .AND. anchor_jd%ms < start_jd%ms)) EXIT - ENDDO - - anchor_jd%day = anchor_jd%day + timestep_fastfwd_jd%day - anchor_jd%ms = anchor_jd%ms + timestep_fastfwd_jd%ms - - IF (anchor_jd%ms >= NO_OF_MS_IN_A_DAY) THEN - anchor_jd%day = anchor_jd%day + 1 - anchor_jd%ms = anchor_jd%ms - NO_OF_MS_IN_A_DAY - ENDIF - - DO - anchor_jd%day = anchor_jd%day + timestep_bkw_jd%day - anchor_jd%ms = anchor_jd%ms + timestep_bkw_jd%ms - - IF ( anchor_jd%ms < 0 ) THEN - anchor_jd%day = anchor_jd%day - 1 - anchor_jd%ms = anchor_jd%ms + NO_OF_MS_IN_A_DAY - ENDIF - - IF (anchor_jd%day < start_jd%day .OR. (anchor_jd%day == start_jd%day .AND. anchor_jd%ms < start_jd%ms)) EXIT - ENDDO - - anchor_jd%day = anchor_jd%day + timestep_jd%day - anchor_jd%ms = anchor_jd%ms + timestep_jd%ms - - IF (anchor_jd%ms >= NO_OF_MS_IN_A_DAY) THEN - anchor_jd%day = anchor_jd%day + 1 - anchor_jd%ms = anchor_jd%ms - NO_OF_MS_IN_A_DAY - ENDIF - - anchor_jd = t_juliandelta(anchor) - - ELSE - - ! should never happen. - - ENDIF - - first_trigger_date = anchor - - RETURN - - ELSE - - anchor = ref_dt - anchor = anchor + offset - - DO WHILE (anchor < start_dt) - anchor = anchor + timestep - ENDDO - - first_trigger_date = anchor - - RETURN - - ENDIF - -END FUNCTION getEventFirstTriggerDateTime - -FUNCTION getTriggerNextEventAtDateTime(e, current_dt) RESULT(dt_return) - TYPE(t_datetime) :: dt_return - TYPE(t_event), INTENT(in) :: e - TYPE(t_datetime), INTENT(in) :: current_dt - - TYPE(t_timedelta) :: modulo_td - - IF (e%eventLastDateTime .and. (current_dt > e%eventLastDateTime)) then - RETURN - ENDIF - - IF (e%nextEventIsFirst .AND. (current_dt > e%triggerNextEventDateTime)) THEN - moduloTimeDeltaFromDateTime(e%triggerNextEventDateTime, e%eventInterval, current_dt, modulo_td) - dt_return = current_dt + modulo_td - ELSE - dt_return = e%triggerNextEventDateTime - ENDIF - -END FUNCTION getTriggerNextEventAtDateTime - -! /* No trigger ever happened? */ -! if (e%nextEventIsFirst) -! return NULL -FUNCTION getTriggeredPreviousEventAtDateTime(e) result(dt_return) - type(t_datetime) :: dt_return - type(t_event) :: e - - dt_return = e%triggeredPreviousEventDateTime -end FUNCTION getTriggeredPreviousEventAtDateTime - -function getEventReferenceDateTime(e) result(dt_return) - type(t_datetime) :: dt_return - type(t_event) :: e - dt_return ? e%eventReferenceDateTime -end function getEventReferenceDateTime - -function getEventFirstDateTime(e) result(dt_return) - type(t_datetime) :: dt_return - type(t_event) :: e - dt_return = e%eventFirstDateTime -end function getEventFirstDateTime - -function getEventLastDateTime(e) result(dt_return) - type(t_datetime) :: dt_return - type(t_event) :: e - dt_return = e%eventLastDateTime -end function getEventLastDateTime - -function getEventInterval(e) result(td_return) - type(t_timedelta) :: td_return - type(t_event) :: e - dt_return = e%eventInterval -end function getEventInterval - -function getNextEventIsFirst(e) result(is) - logical :: is - type(t_event) :: e - is = e%nextEventIsFirst -end function getNextEventIsFirst - -function getEventisFirstInDay(e) result(is) - logical :: is - type(t_event) :: e - is = e%eventisFirstInDay -end function getEventisFirstInDay - -function getEventisFirstInMonth(e) result(is) - logical :: is - type(t_event) :: e - is = e%eventisFirstInMonth -end function getEventisFirstInMonth - -function getEventisFirstInYear(e) result(is) - logical :: is - type(t_event) :: e - is = e%eventisFirstInYear -end function getEventisFirstInYear - -function getEventisLastInDay(e) result(is) - logical :: is - type(t_event) :: e - is = e%eventisLastInDay -end function getEventisLastInDay - -function getEventisLastInMonth(e) result(is) - logical :: is - type(t_event) :: e - is = e%eventisLastInMonth -end function getEventisLastInMonth - -function getEventisLastInYear(e) result(is) - logical :: is - type(t_event) :: e - is = e%eventisLastInYear -end function getEventisLastInYear diff --git a/test/Makefile.am b/test/Makefile.am index c1ea01cbf33c91f5fb3dfa72a27f1579d8bd8e5a..58056024920aa6f3cf4a66be3c3fefbfa6e1abd7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -17,14 +17,11 @@ libmtime_check_la_SOURCES = mtime_calendar_test.c \ mtime_time_test.c \ mtime_time_test.h -libmtime_check_la_CPPFLAGS = -I$(top_srcdir)/include - noinst_PROGRAMS += test_runner test_runner_SOURCES = test_runner.c -test_runner_CPPFLAGS = -I$(top_srcdir)/include $(CHECK_INCLUDE) -test_runner_LDADD = libmtime_check.la $(top_builddir)/src/libmtime.la $(CHECK_LIBS) +test_runner_LDADD = libmtime_check.la $(top_builddir)/src/libmtime.la CHECKS += test_runner endif diff --git a/test/Makefile.in b/test/Makefile.in index 99b24f1ae32af680cc659a6a801cb6933db79638..1c37245b1ea5d92703f5b2211ebce02f9040e44e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -118,12 +118,10 @@ am__libmtime_check_la_SOURCES_DIST = mtime_calendar_test.c \ mtime_timedelta_test.c mtime_timedelta_test.h \ mtime_time_test.c mtime_time_test.h @ENABLE_CHECK_TRUE@am_libmtime_check_la_OBJECTS = \ -@ENABLE_CHECK_TRUE@ libmtime_check_la-mtime_calendar_test.lo \ -@ENABLE_CHECK_TRUE@ libmtime_check_la-mtime_date_test.lo \ -@ENABLE_CHECK_TRUE@ libmtime_check_la-mtime_datetime_test.lo \ -@ENABLE_CHECK_TRUE@ libmtime_check_la-mtime_julianDay_test.lo \ -@ENABLE_CHECK_TRUE@ libmtime_check_la-mtime_timedelta_test.lo \ -@ENABLE_CHECK_TRUE@ libmtime_check_la-mtime_time_test.lo +@ENABLE_CHECK_TRUE@ mtime_calendar_test.lo mtime_date_test.lo \ +@ENABLE_CHECK_TRUE@ mtime_datetime_test.lo \ +@ENABLE_CHECK_TRUE@ mtime_julianDay_test.lo \ +@ENABLE_CHECK_TRUE@ mtime_timedelta_test.lo mtime_time_test.lo libmtime_check_la_OBJECTS = $(am_libmtime_check_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -131,13 +129,10 @@ am__v_lt_0 = --silent am__v_lt_1 = @ENABLE_CHECK_TRUE@am_libmtime_check_la_rpath = am__test_runner_SOURCES_DIST = test_runner.c -@ENABLE_CHECK_TRUE@am_test_runner_OBJECTS = \ -@ENABLE_CHECK_TRUE@ test_runner-test_runner.$(OBJEXT) +@ENABLE_CHECK_TRUE@am_test_runner_OBJECTS = test_runner.$(OBJEXT) test_runner_OBJECTS = $(am_test_runner_OBJECTS) -am__DEPENDENCIES_1 = @ENABLE_CHECK_TRUE@test_runner_DEPENDENCIES = libmtime_check.la \ -@ENABLE_CHECK_TRUE@ $(top_builddir)/src/libmtime.la \ -@ENABLE_CHECK_TRUE@ $(am__DEPENDENCIES_1) +@ENABLE_CHECK_TRUE@ $(top_builddir)/src/libmtime.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -153,14 +148,13 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__maybe_remake_depfiles = depfiles -am__depfiles_remade = \ - ./$(DEPDIR)/libmtime_check_la-mtime_calendar_test.Plo \ - ./$(DEPDIR)/libmtime_check_la-mtime_date_test.Plo \ - ./$(DEPDIR)/libmtime_check_la-mtime_datetime_test.Plo \ - ./$(DEPDIR)/libmtime_check_la-mtime_julianDay_test.Plo \ - ./$(DEPDIR)/libmtime_check_la-mtime_time_test.Plo \ - ./$(DEPDIR)/libmtime_check_la-mtime_timedelta_test.Plo \ - ./$(DEPDIR)/test_runner-test_runner.Po +am__depfiles_remade = ./$(DEPDIR)/mtime_calendar_test.Plo \ + ./$(DEPDIR)/mtime_date_test.Plo \ + ./$(DEPDIR)/mtime_datetime_test.Plo \ + ./$(DEPDIR)/mtime_julianDay_test.Plo \ + ./$(DEPDIR)/mtime_time_test.Plo \ + ./$(DEPDIR)/mtime_timedelta_test.Plo \ + ./$(DEPDIR)/test_runner.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -220,9 +214,6 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CHECK_INCLUDE = @CHECK_INCLUDE@ -CHECK_LIBS = @CHECK_LIBS@ -CHECK_ROOT = @CHECK_ROOT@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -378,10 +369,8 @@ CHECKS = $(am__append_3) @ENABLE_CHECK_TRUE@ mtime_time_test.c \ @ENABLE_CHECK_TRUE@ mtime_time_test.h -@ENABLE_CHECK_TRUE@libmtime_check_la_CPPFLAGS = -I$(top_srcdir)/include @ENABLE_CHECK_TRUE@test_runner_SOURCES = test_runner.c -@ENABLE_CHECK_TRUE@test_runner_CPPFLAGS = -I$(top_srcdir)/include $(CHECK_INCLUDE) -@ENABLE_CHECK_TRUE@test_runner_LDADD = libmtime_check.la $(top_builddir)/src/libmtime.la $(CHECK_LIBS) +@ENABLE_CHECK_TRUE@test_runner_LDADD = libmtime_check.la $(top_builddir)/src/libmtime.la all: all-am .SUFFIXES: @@ -449,13 +438,13 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtime_check_la-mtime_calendar_test.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtime_check_la-mtime_date_test.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtime_check_la-mtime_datetime_test.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtime_check_la-mtime_julianDay_test.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtime_check_la-mtime_time_test.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtime_check_la-mtime_timedelta_test.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_runner-test_runner.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_calendar_test.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_date_test.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_datetime_test.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_julianDay_test.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_time_test.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_timedelta_test.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_runner.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @@ -484,62 +473,6 @@ am--depfiles: $(am__depfiles_remade) @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -libmtime_check_la-mtime_calendar_test.lo: mtime_calendar_test.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmtime_check_la-mtime_calendar_test.lo -MD -MP -MF $(DEPDIR)/libmtime_check_la-mtime_calendar_test.Tpo -c -o libmtime_check_la-mtime_calendar_test.lo `test -f 'mtime_calendar_test.c' || echo '$(srcdir)/'`mtime_calendar_test.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtime_check_la-mtime_calendar_test.Tpo $(DEPDIR)/libmtime_check_la-mtime_calendar_test.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mtime_calendar_test.c' object='libmtime_check_la-mtime_calendar_test.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) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmtime_check_la-mtime_calendar_test.lo `test -f 'mtime_calendar_test.c' || echo '$(srcdir)/'`mtime_calendar_test.c - -libmtime_check_la-mtime_date_test.lo: mtime_date_test.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmtime_check_la-mtime_date_test.lo -MD -MP -MF $(DEPDIR)/libmtime_check_la-mtime_date_test.Tpo -c -o libmtime_check_la-mtime_date_test.lo `test -f 'mtime_date_test.c' || echo '$(srcdir)/'`mtime_date_test.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtime_check_la-mtime_date_test.Tpo $(DEPDIR)/libmtime_check_la-mtime_date_test.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mtime_date_test.c' object='libmtime_check_la-mtime_date_test.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) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmtime_check_la-mtime_date_test.lo `test -f 'mtime_date_test.c' || echo '$(srcdir)/'`mtime_date_test.c - -libmtime_check_la-mtime_datetime_test.lo: mtime_datetime_test.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmtime_check_la-mtime_datetime_test.lo -MD -MP -MF $(DEPDIR)/libmtime_check_la-mtime_datetime_test.Tpo -c -o libmtime_check_la-mtime_datetime_test.lo `test -f 'mtime_datetime_test.c' || echo '$(srcdir)/'`mtime_datetime_test.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtime_check_la-mtime_datetime_test.Tpo $(DEPDIR)/libmtime_check_la-mtime_datetime_test.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mtime_datetime_test.c' object='libmtime_check_la-mtime_datetime_test.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) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmtime_check_la-mtime_datetime_test.lo `test -f 'mtime_datetime_test.c' || echo '$(srcdir)/'`mtime_datetime_test.c - -libmtime_check_la-mtime_julianDay_test.lo: mtime_julianDay_test.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmtime_check_la-mtime_julianDay_test.lo -MD -MP -MF $(DEPDIR)/libmtime_check_la-mtime_julianDay_test.Tpo -c -o libmtime_check_la-mtime_julianDay_test.lo `test -f 'mtime_julianDay_test.c' || echo '$(srcdir)/'`mtime_julianDay_test.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtime_check_la-mtime_julianDay_test.Tpo $(DEPDIR)/libmtime_check_la-mtime_julianDay_test.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mtime_julianDay_test.c' object='libmtime_check_la-mtime_julianDay_test.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) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmtime_check_la-mtime_julianDay_test.lo `test -f 'mtime_julianDay_test.c' || echo '$(srcdir)/'`mtime_julianDay_test.c - -libmtime_check_la-mtime_timedelta_test.lo: mtime_timedelta_test.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmtime_check_la-mtime_timedelta_test.lo -MD -MP -MF $(DEPDIR)/libmtime_check_la-mtime_timedelta_test.Tpo -c -o libmtime_check_la-mtime_timedelta_test.lo `test -f 'mtime_timedelta_test.c' || echo '$(srcdir)/'`mtime_timedelta_test.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtime_check_la-mtime_timedelta_test.Tpo $(DEPDIR)/libmtime_check_la-mtime_timedelta_test.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mtime_timedelta_test.c' object='libmtime_check_la-mtime_timedelta_test.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) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmtime_check_la-mtime_timedelta_test.lo `test -f 'mtime_timedelta_test.c' || echo '$(srcdir)/'`mtime_timedelta_test.c - -libmtime_check_la-mtime_time_test.lo: mtime_time_test.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmtime_check_la-mtime_time_test.lo -MD -MP -MF $(DEPDIR)/libmtime_check_la-mtime_time_test.Tpo -c -o libmtime_check_la-mtime_time_test.lo `test -f 'mtime_time_test.c' || echo '$(srcdir)/'`mtime_time_test.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtime_check_la-mtime_time_test.Tpo $(DEPDIR)/libmtime_check_la-mtime_time_test.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mtime_time_test.c' object='libmtime_check_la-mtime_time_test.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) $(libmtime_check_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmtime_check_la-mtime_time_test.lo `test -f 'mtime_time_test.c' || echo '$(srcdir)/'`mtime_time_test.c - -test_runner-test_runner.o: test_runner.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_runner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_runner-test_runner.o -MD -MP -MF $(DEPDIR)/test_runner-test_runner.Tpo -c -o test_runner-test_runner.o `test -f 'test_runner.c' || echo '$(srcdir)/'`test_runner.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_runner-test_runner.Tpo $(DEPDIR)/test_runner-test_runner.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_runner.c' object='test_runner-test_runner.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_runner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_runner-test_runner.o `test -f 'test_runner.c' || echo '$(srcdir)/'`test_runner.c - -test_runner-test_runner.obj: test_runner.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_runner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_runner-test_runner.obj -MD -MP -MF $(DEPDIR)/test_runner-test_runner.Tpo -c -o test_runner-test_runner.obj `if test -f 'test_runner.c'; then $(CYGPATH_W) 'test_runner.c'; else $(CYGPATH_W) '$(srcdir)/test_runner.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_runner-test_runner.Tpo $(DEPDIR)/test_runner-test_runner.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_runner.c' object='test_runner-test_runner.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_runner_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_runner-test_runner.obj `if test -f 'test_runner.c'; then $(CYGPATH_W) 'test_runner.c'; else $(CYGPATH_W) '$(srcdir)/test_runner.c'; fi` - mostlyclean-libtool: -rm -f *.lo @@ -671,13 +604,13 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_calendar_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_date_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_datetime_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_julianDay_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_time_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_timedelta_test.Plo - -rm -f ./$(DEPDIR)/test_runner-test_runner.Po + -rm -f ./$(DEPDIR)/mtime_calendar_test.Plo + -rm -f ./$(DEPDIR)/mtime_date_test.Plo + -rm -f ./$(DEPDIR)/mtime_datetime_test.Plo + -rm -f ./$(DEPDIR)/mtime_julianDay_test.Plo + -rm -f ./$(DEPDIR)/mtime_time_test.Plo + -rm -f ./$(DEPDIR)/mtime_timedelta_test.Plo + -rm -f ./$(DEPDIR)/test_runner.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -723,13 +656,13 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_calendar_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_date_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_datetime_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_julianDay_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_time_test.Plo - -rm -f ./$(DEPDIR)/libmtime_check_la-mtime_timedelta_test.Plo - -rm -f ./$(DEPDIR)/test_runner-test_runner.Po + -rm -f ./$(DEPDIR)/mtime_calendar_test.Plo + -rm -f ./$(DEPDIR)/mtime_date_test.Plo + -rm -f ./$(DEPDIR)/mtime_datetime_test.Plo + -rm -f ./$(DEPDIR)/mtime_julianDay_test.Plo + -rm -f ./$(DEPDIR)/mtime_time_test.Plo + -rm -f ./$(DEPDIR)/mtime_timedelta_test.Plo + -rm -f ./$(DEPDIR)/test_runner.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic