From c228e022ba2528a60e7415d5486652c720dec02f Mon Sep 17 00:00:00 2001
From: Rahul Sinha <rahul@rahulASUS.(none)>
Date: Mon, 29 Jul 2013 14:07:36 +0200
Subject: [PATCH] purge old files. Update Makefiles

---
 Makefile.am                      |   23 +-
 Makefile.in                      |  321 ++-
 aclocal.m4                       |  408 ++--
 configure                        |  185 +-
 configure.ac                     |    4 +-
 doc/Makefile.in                  |   76 +-
 include/OLD/calendar.h           |   80 +
 include/OLD/calendar_360day.h    |   33 +
 include/OLD/calendar_365day.h    |   35 +
 include/OLD/calendar_gregorian.h |   34 +
 include/OLD/date.h               |   71 +
 include/OLD/datetime.h           |   83 +
 include/OLD/event_handling.h     |  136 ++
 include/OLD/event_list.h         |   35 +
 include/OLD/iso8601.h            |   76 +
 include/OLD/julian_day.h         |   78 +
 include/OLD/time.h               |   62 +
 include/OLD/timedelta.h          |  107 +
 src/Makefile.am                  |   30 +-
 src/Makefile.in                  |  295 ++-
 src/OLD/calendar.c               |  150 ++
 src/OLD/calendar_360day.c        |  152 ++
 src/OLD/calendar_365day.c        |  183 ++
 src/OLD/calendar_gregorian.c     |  166 ++
 src/OLD/date.c                   |  349 ++++
 src/OLD/datetime.c               |  621 ++++++
 src/OLD/event_handling.c         |  608 ++++++
 src/OLD/event_list.c             |  128 ++
 src/OLD/iso8601.c                | 3139 ++++++++++++++++++++++++++++++
 src/OLD/iso8601.rl               |  710 +++++++
 src/OLD/julian_day.c             |  249 +++
 src/OLD/time.c                   |  219 +++
 src/OLD/timedelta.c              | 1310 +++++++++++++
 test/Makefile.in                 |  250 +--
 34 files changed, 9453 insertions(+), 953 deletions(-)
 create mode 100644 include/OLD/calendar.h
 create mode 100644 include/OLD/calendar_360day.h
 create mode 100644 include/OLD/calendar_365day.h
 create mode 100644 include/OLD/calendar_gregorian.h
 create mode 100644 include/OLD/date.h
 create mode 100644 include/OLD/datetime.h
 create mode 100644 include/OLD/event_handling.h
 create mode 100644 include/OLD/event_list.h
 create mode 100644 include/OLD/iso8601.h
 create mode 100644 include/OLD/julian_day.h
 create mode 100644 include/OLD/time.h
 create mode 100644 include/OLD/timedelta.h
 create mode 100644 src/OLD/calendar.c
 create mode 100644 src/OLD/calendar_360day.c
 create mode 100644 src/OLD/calendar_365day.c
 create mode 100644 src/OLD/calendar_gregorian.c
 create mode 100644 src/OLD/date.c
 create mode 100644 src/OLD/datetime.c
 create mode 100644 src/OLD/event_handling.c
 create mode 100644 src/OLD/event_list.c
 create mode 100644 src/OLD/iso8601.c
 create mode 100644 src/OLD/iso8601.rl
 create mode 100644 src/OLD/julian_day.c
 create mode 100644 src/OLD/time.c
 create mode 100644 src/OLD/timedelta.c

diff --git a/Makefile.am b/Makefile.am
index e286635d..cd27e57e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,17 +1,18 @@
 ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = src test doc
 
-EXTRA_DIST = include/calendar.h \
-             include/calendar_360day.h \
-             include/calendar_365day.h \
-             include/calendar_gregorian.h \
-             include/date.h include/datetime.h \
-             include/event_handling.h \
-             include/event_list.h \
-             include/iso8601.h \
-             include/julian_day.h \
-             include/time.h \
-             include/timedelta.h
+EXTRA_DIST = include/mtime_calendar.h \
+             include/mtime_calendar360day.h \
+             include/mtime_calendar365day.h \
+             include/mtime_calendarGregorian.h \
+             include/mtime_date.h \
+	     include/mtime_datetime.h \
+             include/mtime_eventHandling.h \
+             include/mtime_eventList.h \
+             include/mtime_iso8601.h \
+             include/mtime_julianDay.h \
+             include/mtime_time.h \
+             include/mtime_timedelta.h
 
 doc:
 	cd doc && $(MAKE) $(AM_MAKEFLAGS) doc
diff --git a/Makefile.in b/Makefile.in
index 69dd1565..1770a303 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.13.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
-
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,23 +15,6 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
-    esac; \
-    test $$am__dry = yes; \
-  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -50,16 +34,11 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = .
-DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
-	$(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/configure $(am__configure_deps) \
-	$(top_srcdir)/config/config.h.in COPYING config/config.guess \
-	config/config.sub config/depcomp config/install-sh \
-	config/missing config/ltmain.sh \
-	$(top_srcdir)/config/config.guess \
-	$(top_srcdir)/config/config.sub \
-	$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
-	$(top_srcdir)/config/missing
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/config/config.h.in \
+	$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
+	config/config.guess config/config.sub config/depcomp \
+	config/install-sh config/ltmain.sh config/missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prog_doxygen.m4 \
 	$(top_srcdir)/m4/ax_prog_ragel.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -74,61 +53,22 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
-	ctags-recursive dvi-recursive html-recursive info-recursive \
-	install-data-recursive install-dvi-recursive \
-	install-exec-recursive install-html-recursive \
-	install-info-recursive install-pdf-recursive \
-	install-ps-recursive install-recursive installcheck-recursive \
-	installdirs-recursive pdf-recursive ps-recursive \
-	tags-recursive uninstall-recursive
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
-am__recursive_targets = \
-  $(RECURSIVE_TARGETS) \
-  $(RECURSIVE_CLEAN_TARGETS) \
-  $(am__extra_recursive_targets)
-AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	cscope distdir dist dist-all distcheck
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir dist dist-all distcheck
 ETAGS = etags
 CTAGS = ctags
-CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
@@ -139,7 +79,6 @@ am__remove_distdir = \
       && rm -rf "$(distdir)" \
       || { sleep 5 && rm -rf "$(distdir)"; }; \
   else :; fi
-am__post_remove_distdir = $(am__remove_distdir)
 am__relativize = \
   dir0=`pwd`; \
   sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -167,14 +106,12 @@ am__relativize = \
   reldir="$$dir2"
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
-DIST_TARGETS = dist-gzip
 distuninstallcheck_listfiles = find . -type f -print
 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -322,17 +259,18 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = src test doc
-EXTRA_DIST = include/calendar.h \
-             include/calendar_360day.h \
-             include/calendar_365day.h \
-             include/calendar_gregorian.h \
-             include/date.h include/datetime.h \
-             include/event_handling.h \
-             include/event_list.h \
-             include/iso8601.h \
-             include/julian_day.h \
-             include/time.h \
-             include/timedelta.h
+EXTRA_DIST = include/mtime_calendar.h \
+             include/mtime_calendar360day.h \
+             include/mtime_calendar365day.h \
+             include/mtime_calendarGregorian.h \
+             include/mtime_date.h \
+	     include/mtime_datetime.h \
+             include/mtime_eventHandling.h \
+             include/mtime_eventList.h \
+             include/mtime_iso8601.h \
+             include/mtime_julianDay.h \
+             include/mtime_time.h \
+             include/mtime_timedelta.h
 
 all: all-recursive
 
@@ -397,12 +335,12 @@ distclean-libtool:
 	-rm -f libtool config.lt
 
 # This directory's subdirectories are mostly independent; you can cd
-# into them and run 'make' without going through this Makefile.
-# To change the values of 'make' variables: instead of editing Makefiles,
-# (1) if the variable is set in 'config.status', edit 'config.status'
-#     (which will cause the Makefiles to be regenerated when you run 'make');
-# (2) otherwise, pass the desired values on the 'make' command line.
-$(am__recursive_targets):
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
 	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
@@ -412,11 +350,7 @@ $(am__recursive_targets):
 	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	for subdir in $$list; do \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  echo "Making $$target in $$subdir"; \
 	  if test "$$subdir" = "."; then \
 	    dot_seen=yes; \
@@ -431,12 +365,57 @@ $(am__recursive_targets):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-recursive
-TAGS: tags
+$(RECURSIVE_CLEAN_TARGETS):
+	@fail= failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
 
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
 	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -452,7 +431,12 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
-	$(am__define_uniq_tagged_files); \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -464,11 +448,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	      $$unique; \
 	  fi; \
 	fi
-ctags: ctags-recursive
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -477,31 +465,9 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscope: cscope.files
-	test ! -s cscope.files \
-	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
-clean-cscope:
-	-rm -f cscope.files
-cscope.files: clean-cscope cscopelist
-cscopelist: cscopelist-recursive
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 
 distdir: $(DISTFILES)
 	$(am__remove_distdir)
@@ -537,10 +503,13 @@ distdir: $(DISTFILES)
 	done
 	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    $(am__make_dryrun) \
-	      || test -d "$(distdir)/$$subdir" \
-	      || $(MKDIR_P) "$(distdir)/$$subdir" \
-	      || exit 1; \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
 	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
 	    $(am__relativize); \
 	    new_distdir=$$reldir; \
@@ -569,36 +538,40 @@ distdir: $(DISTFILES)
 	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__post_remove_distdir)
+	$(am__remove_distdir)
 
 dist-bzip2: distdir
 	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
-	$(am__post_remove_distdir)
+	$(am__remove_distdir)
 
 dist-lzip: distdir
 	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
-	$(am__post_remove_distdir)
+	$(am__remove_distdir)
+
+dist-lzma: distdir
+	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+	$(am__remove_distdir)
 
 dist-xz: distdir
 	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
-	$(am__post_remove_distdir)
+	$(am__remove_distdir)
 
 dist-tarZ: distdir
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
-	$(am__post_remove_distdir)
+	$(am__remove_distdir)
 
 dist-shar: distdir
 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-	$(am__post_remove_distdir)
+	$(am__remove_distdir)
 
 dist-zip: distdir
 	-rm -f $(distdir).zip
 	zip -rq $(distdir).zip $(distdir)
-	$(am__post_remove_distdir)
+	$(am__remove_distdir)
 
-dist dist-all:
-	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
-	$(am__post_remove_distdir)
+dist dist-all: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
 # it guarantees that the distribution is self-contained by making another
@@ -609,6 +582,8 @@ distcheck: dist
 	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.lzma*) \
+	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
 	*.tar.lz*) \
 	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
 	*.tar.xz*) \
@@ -620,9 +595,9 @@ distcheck: dist
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
-	chmod -R a-w $(distdir)
-	chmod u+w $(distdir)
-	mkdir $(distdir)/_build $(distdir)/_inst
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/_build
+	mkdir $(distdir)/_inst
 	chmod a-w $(distdir)
 	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
@@ -654,7 +629,7 @@ distcheck: dist
 	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
 	  && cd "$$am__cwd" \
 	  || exit 1
-	$(am__post_remove_distdir)
+	$(am__remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
@@ -789,24 +764,24 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(am__recursive_targets) install-am install-strip
-
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
-	am--refresh check check-am clean clean-cscope clean-generic \
-	clean-libtool cscope cscopelist-am ctags ctags-am dist \
-	dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
-	dist-xz dist-zip distcheck distclean distclean-generic \
-	distclean-hdr distclean-libtool distclean-tags distcleancheck \
-	distdir distuninstallcheck dvi dvi-am html html-am info \
-	info-am install install-am install-data install-data-am \
-	install-dvi install-dvi-am install-exec install-exec-am \
-	install-html install-html-am install-info install-info-am \
-	install-man install-pdf install-pdf-am install-ps \
-	install-ps-am install-strip installcheck installcheck-am \
-	installdirs installdirs-am maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am am--refresh check check-am clean clean-generic \
+	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
+	dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \
+	dist-zip distcheck distclean distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags tags-recursive uninstall uninstall-am
 
 
 doc:
diff --git a/aclocal.m4 b/aclocal.m4
index 6c31b82b..809d67e9 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,8 @@
-# generated automatically by aclocal 1.13.1 -*- Autoconf -*-
-
-# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
 
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,31 +12,33 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
 [m4_warning([this file was generated for autoconf 2.69.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.13'
+[am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.13.1], [],
+m4_if([$1], [1.11.3], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -51,22 +54,24 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.13.1])dnl
+[AM_AUTOMAKE_VERSION([1.11.3])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
-# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
 #
 # Of course, Automake must honor this variable whenever it calls a
 # tool from the auxiliary directory.  The problem is that $srcdir (and
@@ -85,7 +90,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 #
 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
 # are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is '.', but things will broke when you
+# harmless because $srcdir is `.', but things will broke when you
 # start a VPATH build or use an absolute $srcdir.
 #
 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@@ -111,19 +116,22 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 9
+
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # Define a conditional.
 AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ([2.52])dnl
- m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
@@ -142,14 +150,16 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 12
 
-# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
 # will think it sees a *use*, and therefore will trigger all it's
 # C support machinery.  Also note that it means that autoscan, seeing
@@ -159,7 +169,7 @@ fi])])
 # _AM_DEPENDENCIES(NAME)
 # ----------------------
 # See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
 # We try a few techniques and use that to set a single cache variable.
 #
 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -172,13 +182,12 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
 AC_REQUIRE([AM_DEP_TRACK])dnl
 
-m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
-      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
-      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
-      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
-      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                    [depcc="$$1"   am_compiler_list=])
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
 
 AC_CACHE_CHECK([dependency style of $depcc],
                [am_cv_$1_dependencies_compiler_type],
@@ -186,8 +195,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named 'D' -- because '-MD' means "put the output
-  # in D".
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -227,16 +236,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
-      # Solaris 10 /bin/sh.
-      echo '/* dummy */' > sub/conftst$i.h
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle '-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs.
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -245,8 +254,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # After this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested.
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -254,7 +263,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok '-c -o', but also, the minuso test has
+      # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -302,7 +311,7 @@ AM_CONDITIONAL([am__fastdep$1], [
 # AM_SET_DEPDIR
 # -------------
 # Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
 AC_DEFUN([AM_SET_DEPDIR],
 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@@ -312,13 +321,9 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
 # AM_DEP_TRACK
 # ------------
 AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE([dependency-tracking], [dnl
-AS_HELP_STRING(
-  [--enable-dependency-tracking],
-  [do not reject slow dependency extractors])
-AS_HELP_STRING(
-  [--disable-dependency-tracking],
-  [speeds up one-time build])])
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
@@ -333,18 +338,20 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+#serial 5
 
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 [{
-  # Older Autoconf quotes --file arguments for eval, but not when files
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -357,7 +364,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named 'Makefile.in', but
+    # We used to match only the files named `Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -369,19 +376,21 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running 'make'.
+    # from the Makefile without running `make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
     test -z "am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`AS_DIRNAME(["$file"])`
@@ -399,7 +408,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
 # This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each '.P' file that we will
+# is enabled.  FIXME.  This creates each `.P' file that we will
 # need in order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
@@ -409,12 +418,15 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 16
+
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
 
@@ -430,7 +442,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.65])dnl
+[AC_PREREQ([2.62])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -459,40 +471,31 @@ AC_SUBST([CYGPATH_W])
 # Define the identity of the package.
 dnl Distinguish between old-style and new-style calls.
 m4_ifval([$2],
-[AC_DIAGNOSE([obsolete],
-             [$0: two- and three-arguments forms are deprecated.])
-m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(
-  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
-  [ok:ok],,
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
 _AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
- AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
 
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
-AM_MISSING_PROG([AUTOCONF], [autoconf])
-AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
-AM_MISSING_PROG([AUTOHEADER], [autoheader])
-AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-# For better backward compatibility.  To be removed once Automake 1.9.x
-# dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
-AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
@@ -503,32 +506,28 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
 			     [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
-		  [_AM_DEPENDENCIES([CC])],
-		  [m4_define([AC_PROG_CC],
-			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+		  [_AM_DEPENDENCIES(CC)],
+		  [define([AC_PROG_CC],
+			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
-		  [_AM_DEPENDENCIES([CXX])],
-		  [m4_define([AC_PROG_CXX],
-			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+		  [_AM_DEPENDENCIES(CXX)],
+		  [define([AC_PROG_CXX],
+			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-		  [_AM_DEPENDENCIES([OBJC])],
-		  [m4_define([AC_PROG_OBJC],
-			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
-		  [_AM_DEPENDENCIES([OBJCXX])],
-		  [m4_define([AC_PROG_OBJCXX],
-			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
+		  [_AM_DEPENDENCIES(OBJC)],
+		  [define([AC_PROG_OBJC],
+			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
 ])
-AC_REQUIRE([AM_SILENT_RULES])dnl
-dnl The testsuite driver may need to know about EXEEXT, so add the
-dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
-dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
 AC_CONFIG_COMMANDS_PRE(dnl
 [m4_provide_if([_AM_COMPILER_EXEEXT],
   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
 ])
 
-dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
 dnl mangled by Autoconf and run in a shell conditional statement.
 m4_define([_AC_COMPILER_EXEEXT],
@@ -556,12 +555,15 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
@@ -575,14 +577,16 @@ if test x"${install_sh}" != xset; then
     install_sh="\${SHELL} $am_aux_dir/install-sh"
   esac
 fi
-AC_SUBST([install_sh])])
+AC_SUBST(install_sh)])
 
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 2
+
 # Check whether the underlying file-system supports filenames
 # with a leading dot.  For instance MS-DOS doesn't.
 AC_DEFUN([AM_SET_LEADING_DOT],
@@ -598,12 +602,14 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 4
+
 # AM_MAKE_INCLUDE()
 # -----------------
 # Check to see how make treats includes.
@@ -621,7 +627,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
+# Ignore all kinds of additional output from `make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -648,12 +654,15 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 6
+
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
 AC_DEFUN([AM_MISSING_PROG],
@@ -661,10 +670,11 @@ AC_DEFUN([AM_MISSING_PROG],
 $1=${$1-"${am_missing_run}$2"}
 AC_SUBST($1)])
 
+
 # AM_MISSING_HAS_RUN
 # ------------------
-# Define MISSING if not defined so far and test if it is modern enough.
-# If it is, set am_missing_run to use it, otherwise, to nothing.
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 AC_REQUIRE_AUX_FILE([missing])dnl
@@ -677,22 +687,54 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --is-lightweight"; then
-  am_missing_run="$MISSING "
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
 else
   am_missing_run=
-  AC_MSG_WARN(['missing' script is too old or missing])
+  AC_MSG_WARN([`missing' script is too old or missing])
 fi
 ])
 
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 5
+
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
 AC_DEFUN([_AM_MANGLE_OPTION],
@@ -702,7 +744,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 # --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
 
 # _AM_SET_OPTIONS(OPTIONS)
 # ------------------------
@@ -718,16 +760,22 @@ AC_DEFUN([_AM_IF_OPTION],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 5
+
 # AM_SANITY_CHECK
 # ---------------
 AC_DEFUN([AM_SANITY_CHECK],
 [AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -738,40 +786,32 @@ case `pwd` in
 esac
 case $srcdir in
   *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
-    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
 esac
 
-# Do 'set' in a subshell so we don't clobber the current shell's
+# Do `set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   am_has_slept=no
-   for am_try in 1 2; do
-     echo "timestamp, slept: $am_has_slept" > conftest.file
-     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-     if test "$[*]" = "X"; then
-	# -L didn't work.
-	set X `ls -t "$srcdir/configure" conftest.file`
-     fi
-     if test "$[*]" != "X $srcdir/configure conftest.file" \
-	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-	# If neither matched, then we have a broken ls.  This can happen
-	# if, for instance, CONFIG_SHELL is bash and it inherits a
-	# broken ls alias from the environment.  This has actually
-	# happened.  Such a system could not be considered "sane".
-	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-  alias in your environment])
-     fi
-     if test "$[2]" = conftest.file || test $am_try -eq 2; then
-       break
-     fi
-     # Just in case.
-     sleep 1
-     am_has_slept=yes
-   done
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
    test "$[2]" = conftest.file
    )
 then
@@ -781,118 +821,46 @@ else
    AC_MSG_ERROR([newly created file is older than distributed files!
 Check your system clock])
 fi
-AC_MSG_RESULT([yes])
-# If we didn't sleep, we still need to ensure time stamps of config.status and
-# generated files are strictly newer.
-am_sleep_pid=
-if grep 'slept: no' conftest.file >/dev/null 2>&1; then
-  ( sleep 1 ) &
-  am_sleep_pid=$!
-fi
-AC_CONFIG_COMMANDS_PRE(
-  [AC_MSG_CHECKING([that generated files are newer than configure])
-   if test -n "$am_sleep_pid"; then
-     # Hide warnings about reused PIDs.
-     wait $am_sleep_pid 2>/dev/null
-   fi
-   AC_MSG_RESULT([done])])
-rm -f conftest.file
-])
+AC_MSG_RESULT(yes)])
 
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# AM_SILENT_RULES([DEFAULT])
-# --------------------------
-# Enable less verbose build rules; with the default set to DEFAULT
-# ("yes" being less verbose, "no" or empty being verbose).
-AC_DEFUN([AM_SILENT_RULES],
-[AC_ARG_ENABLE([silent-rules], [dnl
-AS_HELP_STRING(
-  [--enable-silent-rules],
-  [less verbose build output (undo: "make V=1")])
-AS_HELP_STRING(
-  [--disable-silent-rules],
-  [verbose build output (undo: "make V=0")])dnl
-])
-case $enable_silent_rules in @%:@ (((
-  yes) AM_DEFAULT_VERBOSITY=0;;
-   no) AM_DEFAULT_VERBOSITY=1;;
-    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
-esac
-dnl
-dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
-dnl do not support nested variable expansions.
-dnl See automake bug#9928 and bug#10237.
-am_make=${MAKE-make}
-AC_CACHE_CHECK([whether $am_make supports nested variables],
-   [am_cv_make_support_nested_variables],
-   [if AS_ECHO([['TRUE=$(BAR$(V))
-BAR0=false
-BAR1=true
-V=1
-am__doit:
-	@$(TRUE)
-.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
-  am_cv_make_support_nested_variables=yes
-else
-  am_cv_make_support_nested_variables=no
-fi])
-if test $am_cv_make_support_nested_variables = yes; then
-  dnl Using '$V' instead of '$(V)' breaks IRIX make.
-  AM_V='$(V)'
-  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
-else
-  AM_V=$AM_DEFAULT_VERBOSITY
-  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
-fi
-AC_SUBST([AM_V])dnl
-AM_SUBST_NOTMAKE([AM_V])dnl
-AC_SUBST([AM_DEFAULT_V])dnl
-AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
-AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
-AM_BACKSLASH='\'
-AC_SUBST([AM_BACKSLASH])dnl
-_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
-])
-
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# serial 1
 
 # AM_PROG_INSTALL_STRIP
 # ---------------------
-# One issue with vendor 'install' (even GNU) is that you can't
+# One issue with vendor `install' (even GNU) is that you can't
 # specify the program used to strip binaries.  This is especially
 # annoying in cross-compiling environments, where the build's strip
 # is unlikely to handle the host's binaries.
 # Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in "make install-strip", and initialize
+# always use install-sh in `make install-strip', and initialize
 # STRIPPROG with the value of the STRIP variable (set by the user).
 AC_DEFUN([AM_PROG_INSTALL_STRIP],
 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using 'strip' when the user
-# run "make install-strip".  However 'strip' might not be the right
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the 'STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
 if test "$cross_compiling" != no; then
   AC_CHECK_TOOL([STRIP], [strip], :)
 fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 3
+
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
@@ -906,16 +874,18 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 2
+
 # _AM_PROG_TAR(FORMAT)
 # --------------------
 # Check how to create a tarball in format FORMAT.
-# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+# FORMAT should be one of `v7', `ustar', or `pax'.
 #
 # Substitute a variable $(am__tar) that is a command
 # writing to stdout a FORMAT-tarball containing the directory
@@ -938,7 +908,7 @@ AC_MSG_CHECKING([how to create a $1 tar archive])
 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
 _am_tools=${am_cv_prog_tar_$1-$_am_tools}
 # Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of '-'.
+# Solaris sh will not grok spaces in the rhs of `-'.
 for _am_tool in $_am_tools
 do
   case $_am_tool in
diff --git a/configure b/configure
index 33f72510..31014d29 100755
--- a/configure
+++ b/configure
@@ -595,7 +595,7 @@ PACKAGE_STRING='libmtime 0.1.0'
 PACKAGE_BUGREPORT='luis.kornblueh@zmaw.de'
 PACKAGE_URL=''
 
-ac_unique_file="include/calendar.h"
+ac_unique_file="include/mtime_calendar.h"
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
@@ -694,10 +694,6 @@ FCFLAGS_f90
 ac_ct_FC
 FCFLAGS
 FC
-AM_BACKSLASH
-AM_DEFAULT_VERBOSITY
-AM_DEFAULT_V
-AM_V
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
 CCDEPMODE
@@ -817,7 +813,6 @@ with_gnu_ld
 with_sysroot
 enable_libtool_lock
 enable_dependency_tracking
-enable_silent_rules
 enable_doxygen_doc
 enable_doxygen_dot
 enable_doxygen_man
@@ -1466,12 +1461,8 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
-  --enable-dependency-tracking
-                          do not reject slow dependency extractors
-  --disable-dependency-tracking
-                          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")
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
   --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
@@ -10955,7 +10946,7 @@ CC="$lt_save_CC"
 
 
 
-am__api_version='1.13'
+am__api_version='1.11'
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -11052,6 +11043,9 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
 $as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -11062,40 +11056,32 @@ case `pwd` in
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
 esac
 
-# Do 'set' in a subshell so we don't clobber the current shell's
+# Do `set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   am_has_slept=no
-   for am_try in 1 2; do
-     echo "timestamp, slept: $am_has_slept" > conftest.file
-     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-     if test "$*" = "X"; then
-	# -L didn't work.
-	set X `ls -t "$srcdir/configure" conftest.file`
-     fi
-     if test "$*" != "X $srcdir/configure conftest.file" \
-	&& test "$*" != "X conftest.file $srcdir/configure"; then
-
-	# If neither matched, then we have a broken ls.  This can happen
-	# if, for instance, CONFIG_SHELL is bash and it inherits a
-	# broken ls alias from the environment.  This has actually
-	# happened.  Such a system could not be considered "sane".
-	as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-  alias in your environment" "$LINENO" 5
-     fi
-     if test "$2" = conftest.file || test $am_try -eq 2; then
-       break
-     fi
-     # Just in case.
-     sleep 1
-     am_has_slept=yes
-   done
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+   fi
+
    test "$2" = conftest.file
    )
 then
@@ -11107,16 +11093,6 @@ Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-# If we didn't sleep, we still need to ensure time stamps of config.status and
-# generated files are strictly newer.
-am_sleep_pid=
-if grep 'slept: no' conftest.file >/dev/null 2>&1; then
-  ( sleep 1 ) &
-  am_sleep_pid=$!
-fi
-
-rm -f conftest.file
-
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
@@ -11139,12 +11115,12 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --is-lightweight"; then
-  am_missing_run="$MISSING "
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
 else
   am_missing_run=
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
 fi
 
 if test x"${install_sh}" != xset; then
@@ -11156,10 +11132,10 @@ if test x"${install_sh}" != xset; then
   esac
 fi
 
-# Installed binaries are usually stripped using 'strip' when the user
-# run "make install-strip".  However 'strip' might not be the right
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the 'STRIP' environment variable to overrule this program.
+# will honor the `STRIP' environment variable to overrule this program.
 if test "$cross_compiling" != no; then
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
@@ -11298,6 +11274,12 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
 $as_echo "$MKDIR_P" >&6; }
 
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
@@ -11357,7 +11339,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
+# Ignore all kinds of additional output from `make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -11401,45 +11383,6 @@ else
 fi
 
 
-# Check whether --enable-silent-rules was given.
-if test "${enable_silent_rules+set}" = set; then :
-  enableval=$enable_silent_rules;
-fi
-
-case $enable_silent_rules in # (((
-  yes) AM_DEFAULT_VERBOSITY=0;;
-   no) AM_DEFAULT_VERBOSITY=1;;
-    *) AM_DEFAULT_VERBOSITY=1;;
-esac
-am_make=${MAKE-make}
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
-$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
-if ${am_cv_make_support_nested_variables+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if $as_echo 'TRUE=$(BAR$(V))
-BAR0=false
-BAR1=true
-V=1
-am__doit:
-	@$(TRUE)
-.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
-  am_cv_make_support_nested_variables=yes
-else
-  am_cv_make_support_nested_variables=no
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
-$as_echo "$am_cv_make_support_nested_variables" >&6; }
-if test $am_cv_make_support_nested_variables = yes; then
-    AM_V='$(V)'
-  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
-else
-  AM_V=$AM_DEFAULT_VERBOSITY
-  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
-fi
-AM_BACKSLASH='\'
-
 if test "`cd $srcdir && pwd`" != "`pwd`"; then
   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
   # is not polluted with repeated "-I."
@@ -11490,12 +11433,6 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
 
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
-# For better backward compatibility.  To be removed once Automake 1.9.x
-# dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
-mkdir_p='$(MKDIR_P)'
-
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 # Always define AMTAR for backward compatibility.  Yes, it's still used
@@ -11518,8 +11455,8 @@ else
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named 'D' -- because '-MD' means "put the output
-  # in D".
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -11554,16 +11491,16 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
-      # Solaris 10 /bin/sh.
-      echo '/* dummy */' > sub/conftst$i.h
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle '-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs.
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -11572,8 +11509,8 @@ else
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # After this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested.
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -11581,7 +11518,7 @@ else
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok '-c -o', but also, the minuso test has
+      # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -15211,7 +15148,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need ragel to regenerate sources" >&5
 $as_echo_n "checking whether we need ragel to regenerate sources... " >&6; }
-    if test src/iso8601.c -nt src/iso8601.rl; then :
+    if test src/mtime_iso8601.c -nt src/mtime_iso8601.rl; then :
   ragel_needed=no
 else
   ragel_needed=yes
@@ -17380,14 +17317,6 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
-$as_echo_n "checking that generated files are newer than configure... " >&6; }
-   if test -n "$am_sleep_pid"; then
-     # Hide warnings about reused PIDs.
-     wait $am_sleep_pid 2>/dev/null
-   fi
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
-$as_echo "done" >&6; }
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
   as_fn_error $? "conditional \"AMDEP\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -19823,7 +19752,7 @@ _LT_EOF
 
  ;;
     "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
-  # Older Autoconf quotes --file arguments for eval, but not when files
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -19836,7 +19765,7 @@ _LT_EOF
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named 'Makefile.in', but
+    # We used to match only the files named `Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -19870,19 +19799,21 @@ $as_echo X"$mf" |
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running 'make'.
+    # from the Makefile without running `make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
     test -z "am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`$as_dirname -- "$file" ||
diff --git a/configure.ac b/configure.ac
index 6eb933fa..4e53d00a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ AC_INIT([libmtime], [0.1.0], [luis.kornblueh@zmaw.de])
 AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config/config.h])
-AC_CONFIG_SRCDIR([include/calendar.h])
+AC_CONFIG_SRCDIR([include/mtime_calendar.h])
 
 LT_INIT
 
@@ -27,7 +27,7 @@ AS_IF([test "$TAR" = "no"],
 
 AC_SUBST([TAR])
 
-AX_PROG_RAGEL([src/iso8601.c], [src/iso8601.rl])
+AX_PROG_RAGEL([src/mtime_iso8601.c], [src/mtime_iso8601.rl])
 
 # Checks for libraries.
 
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 032bfbce..93cb3676 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.13.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
-
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,23 +15,6 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
-    esac; \
-    test $$am__dry = yes; \
-  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -50,8 +34,8 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = doc
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(srcdir)/Doxyfile.in
+DIST_COMMON = $(srcdir)/Doxyfile.in $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prog_doxygen.m4 \
 	$(top_srcdir)/m4/ax_prog_ragel.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -64,30 +48,11 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config/config.h
 CONFIG_CLEAN_FILES = Doxyfile
 CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -287,11 +252,11 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
-tags TAGS:
-
-ctags CTAGS:
+tags: TAGS
+TAGS:
 
-cscope cscopelist:
+ctags: CTAGS
+CTAGS:
 
 
 distdir: $(DISTFILES)
@@ -430,17 +395,16 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
-	cscopelist-am ctags-am distclean distclean-generic \
-	distclean-libtool distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am \
-	install-data-local install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am \
-	tags-am uninstall uninstall-am
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-data-local install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am uninstall uninstall-am
 
 
 @DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
diff --git a/include/OLD/calendar.h b/include/OLD/calendar.h
new file mode 100644
index 00000000..21667685
--- /dev/null
+++ b/include/OLD/calendar.h
@@ -0,0 +1,80 @@
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file calendar.h
+ * 
+ * @brief Singleton Calendar connecting all supported calendar types.
+ *
+ * @details
+ *
+ * Three calendar types are provided:
+ *
+ *   - a proleptic Gregorian calendar
+ *   - a calendar with 365 days per year without leap years
+ *   - a calendar with 360 days per year and each month having 30 days
+ *
+ * To use this library, a call to initCalendar() with the respective selector (enum calendarType) must be
+ * done first. The implementation is based on a singleton concept meaning that only one calendar
+ * can be active at a time. To release a calendar a call to freeCalendar() has to be done.
+ *
+ * 
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology
+ *
+ * @date March 2013
+ *
+ * @note Calendar type, once initialized, should not be changed.
+ */
+
+
+#ifndef CALENDAR_H
+#define CALENDAR_H
+
+///provides a string length for toString.
+#define MAX_CALENDAR_STR_LEN 32
+
+struct _datetime;
+struct _julianday;
+
+
+/**
+ * @enum calendarType
+ *
+ * @brief enum calendarType lists the calendarTypes supported. The values are used for selecting calendars.
+ *
+ */
+typedef enum
+  {
+    CALENDAR_NOT_SET = 0,  	///< calendar is not defined yet.
+    PROLEPTIC_GREGORIAN = 1,  	///< proleptic Gregorian calendar.
+    YEAR_OF_365_DAYS = 2,  	///< 365 day year without leap years.
+    YEAR_OF_360_DAYS = 3  	///< 360 day year with 30 day months.
+  }calendarType;
+
+
+///@brief Function pointer connecting the Calendar to Julian routine. The pointed to Function depends on the selected Calendar type.
+extern struct _julianday *
+(*date2julian)(struct _datetime *date, struct _julianday *julian);
+///@brief Function pointer connecting Julian to Calendar routine. The pointed to Function depends on the selected Calendar type.
+extern struct _datetime *
+(*julian2date)(struct _julianday *julian, struct _datetime *date);
+
+
+void
+initCalendar(calendarType ct);
+void
+freeCalendar(void);
+
+calendarType
+getCalendarType(void);
+
+void
+calendarToString(char *calendar);
+
+
+/**
+ * @}
+ */
+#endif
diff --git a/include/OLD/calendar_360day.h b/include/OLD/calendar_360day.h
new file mode 100644
index 00000000..589a7183
--- /dev/null
+++ b/include/OLD/calendar_360day.h
@@ -0,0 +1,33 @@
+/*! \cond PRIVATE */
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file calendar_360day.h
+ * 
+ * @brief Convert julian dates to Calendar-with-360-days dates and vice-versa.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology.
+ *
+ * @date March 2013
+ *
+ * @note Calendar-with-360-days has 30 days in 'every' month and hence 360 days in every calendar year. 
+ *       Also, Julian Day (0,0) corresponds to Calendar-with-360-day's day 0-01-01T12:00:00.000Z.
+ */
+
+#ifndef _CALENDAR_360DAY_H
+#define _CALENDAR_360DAY_H
+
+struct _datetime;
+struct _julianday;
+
+struct _datetime *
+getDate360FromJulian(struct _julianday *jd, struct _datetime* gd);
+struct _julianday *
+getJulianFromDate360(struct _datetime* gd, struct _julianday *jd);
+
+/**
+ * @}
+ */
+#endif
diff --git a/include/OLD/calendar_365day.h b/include/OLD/calendar_365day.h
new file mode 100644
index 00000000..5aae461d
--- /dev/null
+++ b/include/OLD/calendar_365day.h
@@ -0,0 +1,35 @@
+/*! \cond PRIVATE */
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file calendar_365day.h
+ * 
+ * @brief Convert julian dates to Calendar-with-365-days dates and vice-versa.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology.
+ *
+ * @date March 2013
+ *
+ * @note Calendar-with-365-days has a non-leap year characteristic and has 365 days in a calendar year. 
+ * Number of days in the 12 months is given by: {  31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }.
+ * Julian Day (0,0) corresponds to Calendar-with-365-day's day 0-01-01T12:00:00.000Z.
+ *
+ */
+
+#ifndef _CALENDAR_365DAY_H
+#define _CALENDAR_365DAY_H
+
+struct _datetime;
+struct _julianday;
+
+struct _datetime *
+getDate365FromJulian(struct _julianday *jd, struct _datetime* gd);
+struct _julianday *
+getJulianFromDate365(struct _datetime* gd, struct _julianday *jd);
+
+/**
+ * @}
+ */
+#endif
diff --git a/include/OLD/calendar_gregorian.h b/include/OLD/calendar_gregorian.h
new file mode 100644
index 00000000..faad9e14
--- /dev/null
+++ b/include/OLD/calendar_gregorian.h
@@ -0,0 +1,34 @@
+/*! \cond PRIVATE */
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file calendar_gregorian.h
+ * 
+ * @brief Convert julian dates to Gregorian-Calendar dates and vice-versa.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology.
+ *
+ * @date March 2013
+ *
+ * @note TODO-Ask LUIS
+ */
+
+
+#ifndef _CALENDAR_GREGORIAN_H
+#define _CALENDAR_GREGORIAN_H
+
+struct _datetime;
+struct _julianday;
+
+struct _datetime *
+getDateGregorianFromJulian(struct _julianday *jd, struct _datetime* gd);
+struct _julianday *
+getJulianFromDateGregorian(struct _datetime* gd, struct _julianday *jd);
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/include/OLD/date.h b/include/OLD/date.h
new file mode 100644
index 00000000..efa6a5ac
--- /dev/null
+++ b/include/OLD/date.h
@@ -0,0 +1,71 @@
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file date.h
+ * 
+ * @brief Date and some operations supported on Date.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology.
+ *
+ * @date March 2013
+ *
+ */
+
+
+#ifndef _DATE_H
+#define _DATE_H
+
+#include <stdbool.h>
+
+///provides a string length for toString.
+#define MAX_DATE_STR_LEN 32
+
+struct _timedelta;
+
+/**
+ * @struct _date
+ *
+ * @brief struct _date containing usual date parameters. 
+ */
+struct _date
+{
+  int64_t year; ///< Year of date. Can be both positive and negative.
+  int month;	///< Month of date.	
+  int day;	///< day of date.
+};
+
+struct _date*
+newDate(const char* ds);
+
+struct _date*
+newRawDate(int64_t _year, int _month, int _day);
+
+struct _date*
+constructAndCopyDate(struct _date* d);
+
+void
+deallocateDate(struct _date* d);
+
+/*! \cond PRIVATE */
+struct _datetime *
+convertDateToDateTime(struct _date* d, struct _datetime* dt_return);
+
+struct _date *
+convertDateTimeToDate(struct _datetime* dt, struct _date* d_return);
+
+char
+compareDate(struct _date*, struct _date*);
+
+struct _date*
+replaceDate(struct _date*, struct _date*);
+/*! \endcond  */
+
+char*
+dateToString(struct _date*, char*);
+
+/**
+ * @}
+ */ 
+#endif
diff --git a/include/OLD/datetime.h b/include/OLD/datetime.h
new file mode 100644
index 00000000..9f729a7a
--- /dev/null
+++ b/include/OLD/datetime.h
@@ -0,0 +1,83 @@
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file datetime.h
+ * 
+ * @brief DateTime and some operations supported on DateTime.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology.
+ * 
+ * @date March 2013
+ *
+ */
+
+
+#ifndef _DATETIME_H
+#define _DATETIME_H
+
+#include <stdint.h>
+
+#include "date.h"
+#include "time.h"
+
+///provides a string length for toString.
+#define MAX_DATETIME_STR_LEN 32
+
+
+/**
+ * @struct _datetime
+ *
+ * @brief struct _datetime contains a struct _date and a struct _time element. 
+ */
+struct _datetime
+{
+  struct _date date;	///< Date elements.
+  struct _time time;	///< Time elements.
+};
+
+struct _datetime*
+newDateTime(const char* datetime_string);
+
+struct _datetime*
+newRawDateTime(int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int _ms);
+
+struct _datetime*
+constructAndCopyDateTime(struct _datetime* dt);
+
+void
+deallocateDateTime(struct _datetime* dt);
+
+char
+compareDatetime(struct _datetime* dt1, struct _datetime* dt2);
+
+struct _datetime*
+replaceDatetime(struct _datetime* dtsrc, struct _datetime* dtdest);
+
+char*
+datetimeToString(struct _datetime* dt, char* toStr);
+
+int
+getNoOfDaysInMonthDateTime(struct _datetime* dt);
+
+int
+getNoOfDaysInYearDateTime(struct _datetime* dt);
+
+int64_t
+getNoOfSecondsElapsedInMonthDateTime(struct _datetime* dt);
+
+int64_t
+getNoOfSecondsElapsedInDayDateTime(struct _datetime* dt);
+
+int
+getDayOfYearFromDateTime(struct _datetime* currentdt);
+
+struct _julianday*
+getJulianDayFromDateTime(struct _datetime* dt, struct _julianday* jd);
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/include/OLD/event_handling.h b/include/OLD/event_handling.h
new file mode 100644
index 00000000..87833886
--- /dev/null
+++ b/include/OLD/event_handling.h
@@ -0,0 +1,136 @@
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file event_handling.h
+ *
+ * @brief  Definition of the basic event type and its methods. 
+ *	   Definition of Even-Groups which contains a list of events.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology.
+ * 
+ * @date March 2013
+ */
+
+
+#ifndef EVENT_HANDLING_H
+#define EVENT_HANDLING_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+///provides a Maximum string length for Group Names.
+#define MAX_GROUPNAME_STR_LEN 132
+///provides a Maximum string length for Event names.
+#define MAX_EVENTNAME_STR_LEN 132
+
+struct _datetime;
+struct _timedelta;
+struct _event;
+
+
+/**
+ * @struct _eventGroup
+ *
+ * @brief struct _eventGroup defines an Event-group. Each event group has an associated list of events.
+ * 	  Event group is a place holder to 'group' events based on some user defined charteristics.
+ * 	  	
+ */
+struct _eventGroup
+{
+  int64_t eventGroupId;		///< Event Group's ID.
+  char* eventGroupName;		///< Event Group's name.
+
+  struct _event* rootEvent;	///< Pointer to a List of events in this group.
+};
+
+struct _eventGroup*
+newEventGroup(char* _eventGroupName);
+
+void
+deallocateEventGroup(struct _eventGroup* eg);
+
+bool
+addNewEventToEventGroup(struct _event* e, struct _eventGroup* eg);
+
+bool
+removeEventFromEventGroup(char* eventName, struct _eventGroup* eg);
+
+
+/**
+ * @struct _event
+ *
+ * @brief struct _event defines events. Events are set to be triggered at pre-specified intervals. 
+ *              
+ */
+struct _event
+{
+  struct _event* nextEventInGroup;		///< Pointer to the next event in a given Event Group.
+
+  int64_t eventId;				///< Auto generated. (For future use. Not in use yet).
+  char* eventName;				///< Event's name.
+
+  struct _datetime* eventReferenceDateTime;	///< Anchor datetime.
+
+  struct _datetime* eventFirstDateTime;		///< Start datetime of the event. Can be empty string ? TODO: LUIS: we need to resolve this.
+  struct _datetime* eventLastDateTime;		///< Last datetime of the event. Can be empty string  ? TODO: LUIS: we need to resolve this.
+
+  struct _timedelta* eventInterval;		///< TimeDelta between succesive triggers.
+
+  bool triggerCurrentEvent;			///< is this event active?
+
+
+  //Properties of the event being triggered.
+
+  bool nextEventIsFirst;			///< Is the next scheduled event the first to be triggered?
+
+  bool eventisFirstInDay;	///< Is the event being triggered (i.e event when triggerCurrentEvent is true) First-In-Day?
+  bool eventisFirstInMonth; 	///< Is the event being triggered (i.e event when triggerCurrentEvent is true) First-In-Month?
+  bool eventisFirstInYear; 	///< Is the event being triggered (i.e event when triggerCurrentEvent is true) First-In-Year?
+  bool eventisLastInDay; 	///< Is the event being triggered (i.e event when triggerCurrentEvent is true) Last-In-Day?
+  bool eventisLastInMonth; 	///< Is the event being triggered (i.e event when triggerCurrentEvent is true) Last-In-Month?
+  bool eventisLastInYear;	///< Is the event being triggered (i.e event when triggerCurrentEvent is true) Last-In-Year?
+
+  struct _datetime* triggerNextEventDateTime;		///< Trigger the event next at this DT.
+  struct _datetime* triggeredPreviousEventDateTime;	///< Last Trigger event happened at this DT.
+
+};
+
+struct _event*
+newEvent(char* _eventName, char* _eventReferenceDate, char* _eventFirstDate, char* _eventLastDate, char* _eventInterval);
+
+void
+deallocateEvent(struct _event* e);
+
+/*
+void
+setEvent(struct _event* e);
+*/
+
+bool
+isCurrentEventActive(struct _event* e, struct _datetime* current_dt);
+
+static bool
+iseventNextInNextDays(struct _event* e);
+
+static bool
+iseventNextInNextMonths(struct _event* e);
+
+static bool
+iseventNextInNextYears(struct _event* e);
+
+char*
+eventToString(struct _event* e, char* string);
+
+struct _datetime*
+getTriggerNextEventAtDateTime(struct _event* e, struct _datetime* dt_return);
+
+struct _datetime*
+getTriggeredPreviousEventAtDateTime(struct _event* e, struct _datetime* dt_return);
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/include/OLD/event_list.h b/include/OLD/event_list.h
new file mode 100644
index 00000000..01fe41d6
--- /dev/null
+++ b/include/OLD/event_list.h
@@ -0,0 +1,35 @@
+/*! \cond PRIVATE */
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file event_list.h
+ *
+ * @brief _eventList data structure supports 'Event-groups'; Each group stores multiple events as a link list of nodes.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology.
+ *
+ * @date March 2013
+ *
+ * @note All functions in this file are internal.
+ */
+
+#ifndef EVENT_LIST_H
+#define EVENT_LIST_H
+
+#include "event_handling.h"
+
+void
+deallocateEventsInGroup(struct _eventGroup* eg);
+
+bool
+addNewEventToGroup(struct _event* ev, struct _eventGroup* eg);
+
+bool
+removeEventWithNameFromGroup(char* nodeName, struct _eventGroup* eg);
+
+/**
+ * @}
+ */
+#endif
diff --git a/include/OLD/iso8601.h b/include/OLD/iso8601.h
new file mode 100644
index 00000000..d32a7736
--- /dev/null
+++ b/include/OLD/iso8601.h
@@ -0,0 +1,76 @@
+/*! \cond PRIVATE */
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file iso8601.h
+ * 
+ * @brief Routines and Data-Structures for checking ISO860 compliannce.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology.
+ *
+ * @date March 2013
+ *
+ */
+
+
+#ifndef _ISO8601_H
+#define _ISO8601_H
+
+#include <stdint.h>
+
+typedef enum
+{
+  FAILURE = 0, DATETIME_MATCH = 1, DURATION_MATCH = 2
+} ISO8601_STATUS;
+
+struct iso8601_duration
+{
+  char sign;
+  int64_t year;
+  int month;
+  int day;
+  int hour;
+  int minute;
+  int second;
+  int64_t ms;
+};
+
+struct iso8601_datetime
+{
+  /* Year can be positive or negative. */
+  char sign_of_year;
+  int64_t year;
+  int month;
+  int day;
+  int hour;
+  int minute;
+  int second;
+  int64_t ms;
+  char timeZoneOffSet;
+};
+
+struct iso8601_datetime*
+new_iso8601_datetime(char _sign_of_year, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int64_t _ms,
+    char _timeZoneOffSet);
+
+void
+deallocate_iso8601_datetime(struct iso8601_datetime* iso8601_datetimeObj);
+
+struct iso8601_duration*
+new_iso8601_duration(char _sign, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int64_t _ms);
+
+void
+deallocate_iso8601_duration(struct iso8601_duration* iso8601_durationObj);
+
+ISO8601_STATUS
+verify_string_datetime(const char* test_string, struct iso8601_datetime* dummy_isoDtObj);
+
+ISO8601_STATUS
+verify_string_duration(const char* test_string, struct iso8601_duration* dummy_isoDObj);
+
+/**
+ * @}
+ */
+#endif
diff --git a/include/OLD/julian_day.h b/include/OLD/julian_day.h
new file mode 100644
index 00000000..0e626705
--- /dev/null
+++ b/include/OLD/julian_day.h
@@ -0,0 +1,78 @@
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file julian_day.h
+ *
+ * @brief Julian Day Calendar and some operations supported on julian dates.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology.
+ * 
+ * @date March 2013
+ */
+
+#ifndef JULIAN_DAY_H
+#define JULIAN_DAY_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/// provides a string length for toString.
+#define MAX_JULIANDAY_STR_LEN 32
+
+
+/**
+ * @struct _julianday
+ *
+ * @brief Struct _julianday containing julian day parameters.
+ */
+struct _julianday
+{
+  int64_t day; 	///< the actual Julian day.
+  int64_t ms;	///< the milisecond on that particular day.
+};
+
+/*! \cond PRIVATE */
+/* Notice that Julian delta, as such, is not defined by any standard. In this lib,
+ it serves as a proxy for equivalent deltas on julian time scale. For example, a 
+ TD of P02DT12H is equivalend to (2 days and 43200000 ms) Julian delta and -P02DT12H
+ is equivalent to (-2 days and -43200000 ms) */
+struct _juliandelta
+{
+  char sign;
+  int64_t day;
+  int64_t ms;
+};
+/*! \endcond */
+
+struct _julianday*
+newJulianDay(int64_t _day, int64_t _ms);
+
+void
+deallocateJulianDay(struct _julianday* jd);
+
+/*! \cond PRIVATE */
+struct _juliandelta*
+newJulianDelta(char _sign, int64_t _day, int64_t _ms);
+
+void
+deallocateJulianDelta(struct _juliandelta* jd);
+
+struct _julianday*
+addJulianDelta(struct _julianday* jd1, struct _juliandelta* jd2, struct _julianday* jd);
+struct _julianday*
+substractJulianDelta(struct _julianday* jd1, struct _juliandelta* jd2, struct _julianday* jd);
+
+struct _juliandelta*
+substractJulianDay(struct _julianday* jd1, struct _julianday* jd2, struct _juliandelta* jd);
+/*! \endcond */
+
+char*
+juliandayToString(struct _julianday* jd, char* toStr);
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/include/OLD/time.h b/include/OLD/time.h
new file mode 100644
index 00000000..025881e4
--- /dev/null
+++ b/include/OLD/time.h
@@ -0,0 +1,62 @@
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file time.h
+ * 
+ * @brief Time and some operations supported on Time.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology 
+ *
+ * @date March 2013
+ *
+ */
+
+#ifndef _TIME_H
+#define _TIME_H
+
+#include <stdint.h>
+
+///provides a string length for toString
+#define MAX_TIME_STR_LEN 32
+
+
+/**
+ * @struct _time
+ *
+ * @brief struct _time containing usual time parameters. 
+ */
+struct _time
+{
+  int hour;	///< hour part of time.
+  int minute;	///< minute part of time.
+  int second;	///< second part of time.
+  int ms;	///< milli-second part of time. 0<=ms<=999.
+};
+
+struct _time*
+newTime(const char* time_string);
+
+struct _time*
+newRawTime(int _hour, int _minute, int _second, int _ms);
+
+struct _time*
+constructAndCopyTime(struct _time* t);
+
+void
+deallocateTime(struct _time* t);
+
+/*! \cond PRIVATE */
+struct _time*
+replaceTime(struct _time*, struct _time*);
+/*! \endcond */
+
+char*
+timeToString(struct _time*, char*);
+
+/**
+ * @}
+ */
+#endif
+
diff --git a/include/OLD/timedelta.h b/include/OLD/timedelta.h
new file mode 100644
index 00000000..7ccd129a
--- /dev/null
+++ b/include/OLD/timedelta.h
@@ -0,0 +1,107 @@
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ * @{
+ *
+ * @file timedelta.h
+ * 
+ * @brief TimeDelta and some operations supported on TimeDelta.
+ *
+ * @author  Luis Kornblueh, Max Planck Institute for Meteorology.
+ * @author  Rahul Sinha, Max Planck Institute for Meteorology. 
+ * 
+ * @date March 2013
+ * 
+ */
+
+#ifndef _TIMEDELTA_H
+#define _TIMEDELTA_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+///provides a string length for toString
+#define MAX_TIMEDELTA_STR_LEN 32
+
+struct _timedelta;
+struct _datetime;
+struct _date;
+struct _julianday;
+struct _juliandelta;
+
+/**
+ * @struct _timedelta
+ *
+ * @brief Struct _timedelta containing timedelta and sign of year parameter. 
+ */
+struct _timedelta
+{
+  char sign;	///< sign of time delta. Sign can be '+' or '-'.
+
+  int64_t year;	///< Year part of timedelta.
+  int month;	///< Month part of timedelta.
+  int day;	///< Day part of timedelta.
+  int hour;	///< Hour part of timedelta.
+  int minute;	///< Minute part of timedelta.
+  int second;	///< Second part of timedelta.
+  int ms;	///< Milli-Second part of timedelta.
+};
+
+struct _timedelta*
+newTimeDelta(const char* timedelta_string);
+
+struct _timedelta*
+newRawTimeDelta(char _sign, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int _ms);
+
+struct _timedelta*
+constructAndCopyTimeDelta(struct _timedelta* td);
+
+void
+deallocateTimeDelta(struct _timedelta* td);
+
+/*! \cond PRIVATE */
+struct _juliandelta*
+timeDeltaToJulianDelta(struct _timedelta *td, struct _datetime *dt, struct _juliandelta *jd);
+
+struct _timedelta*
+julianDeltaToTimeDelta(struct _juliandelta* jd, struct _datetime *dt, struct _timedelta* td_return);
+/*! \endcond */
+
+struct _timedelta*
+getTimeDeltaFromDate(struct _date*, struct _date*, struct _timedelta*);
+
+struct _timedelta*
+getTimeDeltaFromDateTime(struct _datetime* dt1, struct _datetime* dt2, struct _timedelta* td_return);
+
+int64_t
+getTotalMilliSecondsTimeDelta(struct _timedelta *td, struct _datetime* dt);
+
+int64_t
+getTotalSecondsTimeDelta(struct _timedelta *td, struct _datetime* dt);
+
+char*
+timedeltaToString(struct _timedelta * td, char *toString);
+
+struct _date*
+addTimeDeltaToDate(struct _date* dt, struct _timedelta* td, struct _date* dt_return);
+
+struct _datetime*
+addTimeDeltaToDateTime(struct _datetime* dt, struct _timedelta* td, struct _datetime* dt_return);
+
+struct _timedelta*
+moduloTimeDeltaFromDateTime(struct _datetime* start_dt, struct _timedelta* timestep, struct _datetime* current_dt, struct _timedelta* modulo_td);
+
+struct _timedelta*
+elementwiseScalarMultiplyTimeDelta(struct _timedelta* base_td, int64_t lambda, struct _timedelta* scaled_td);
+
+struct _timedelta*
+elementwiseAddTimeDeltatoTimeDelta(struct _timedelta* td1, struct _timedelta* td2,  struct _timedelta* td_return);
+
+/*! \cond PRIVATE */
+bool
+testYearIsLeapYear(int64_t year);
+/*! \endcond */
+
+/**
+ * @}
+ */
+#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index d5da4529..1db4c81b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,18 +3,18 @@ AM_FCFLAGS = $(FCFLAGS_f90)
 
 lib_LTLIBRARIES     = libmtime.la
 
-libmtime_la_SOURCES = calendar.c \
-		      calendar_360day.c \
-		      calendar_365day.c \
-		      calendar_gregorian.c \
-		      iso8601.c \
-		      date.c \
-		      datetime.c \
-		      julian_day.c \
-		      time.c \
-		      timedelta.c \
-		      event_list.c \
-		      event_handling.c \
+libmtime_la_SOURCES = mtime_calendar.c \
+		      mtime_calendar360day.c \
+		      mtime_calendar365day.c \
+		      mtime_calendarGregorian.c \
+		      mtime_iso8601.c \
+		      mtime_date.c \
+		      mtime_datetime.c \
+		      mtime_julianDay.c \
+		      mtime_time.c \
+		      mtime_timedelta.c \
+		      mtime_eventList.c \
+		      mtime_eventHandling.c \
 		      vsop87.c \
 		      kepler.c \
 		      orbit.c \
@@ -22,8 +22,8 @@ libmtime_la_SOURCES = calendar.c \
 
 if HAVE_RAGEL
 
-iso8601.c: iso8601.rl
-	$(RAGEL) -o iso8601.c iso8601.rl
+mtime_iso8601.c: mtime_iso8601.rl
+	$(RAGEL) -o mtime_iso8601.c mtime_iso8601.rl
 
 endif HAVE_RAGEL
 
@@ -37,4 +37,4 @@ DISTCLEANFILES = libmtime.$(FC_MODEXT) \
                  mtime_time.$(FC_MODEXT) \
                  mtime_timedelta.$(FC_MODEXT)
 
-EXTRA_DIST = $(srcdir)/iso8601.rl
+EXTRA_DIST = $(srcdir)/mtime_iso8601.rl
diff --git a/src/Makefile.in b/src/Makefile.in
index 41926e6d..51eb162b 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.13.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
-
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,23 +16,6 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
-    esac; \
-    test $$am__dry = yes; \
-  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -51,8 +35,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = src
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/config/depcomp
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prog_doxygen.m4 \
 	$(top_srcdir)/m4/ax_prog_ragel.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -95,94 +78,40 @@ am__uninstall_files_from_dir = { \
 am__installdirs = "$(DESTDIR)$(libdir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
 libmtime_la_LIBADD =
-am_libmtime_la_OBJECTS = calendar.lo calendar_360day.lo \
-	calendar_365day.lo calendar_gregorian.lo iso8601.lo date.lo \
-	datetime.lo julian_day.lo time.lo timedelta.lo event_list.lo \
-	event_handling.lo vsop87.lo kepler.lo orbit.lo libmtime.lo
+am_libmtime_la_OBJECTS = mtime_calendar.lo mtime_calendar360day.lo \
+	mtime_calendar365day.lo mtime_calendarGregorian.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 vsop87.lo kepler.lo \
+	orbit.lo libmtime.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@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-	$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
 FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-LTFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-AM_V_FC = $(am__v_FC_@AM_V@)
-am__v_FC_ = $(am__v_FC_@AM_DEFAULT_V@)
-am__v_FC_0 = @echo "  FC      " $@;
-am__v_FC_1 = 
+LTFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
 FCLD = $(FC)
-FCLINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_FCLD = $(am__v_FCLD_@AM_V@)
-am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@)
-am__v_FCLD_0 = @echo "  FCLD    " $@;
-am__v_FCLD_1 = 
+FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
 SOURCES = $(libmtime_la_SOURCES)
 DIST_SOURCES = $(libmtime_la_SOURCES)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -331,18 +260,18 @@ top_srcdir = @top_srcdir@
 AM_CPPFLAGS = -I$(top_srcdir)/include
 AM_FCFLAGS = $(FCFLAGS_f90)
 lib_LTLIBRARIES = libmtime.la
-libmtime_la_SOURCES = calendar.c \
-		      calendar_360day.c \
-		      calendar_365day.c \
-		      calendar_gregorian.c \
-		      iso8601.c \
-		      date.c \
-		      datetime.c \
-		      julian_day.c \
-		      time.c \
-		      timedelta.c \
-		      event_list.c \
-		      event_handling.c \
+libmtime_la_SOURCES = mtime_calendar.c \
+		      mtime_calendar360day.c \
+		      mtime_calendar365day.c \
+		      mtime_calendarGregorian.c \
+		      mtime_iso8601.c \
+		      mtime_date.c \
+		      mtime_datetime.c \
+		      mtime_julianDay.c \
+		      mtime_time.c \
+		      mtime_timedelta.c \
+		      mtime_eventList.c \
+		      mtime_eventHandling.c \
 		      vsop87.c \
 		      kepler.c \
 		      orbit.c \
@@ -358,7 +287,7 @@ DISTCLEANFILES = libmtime.$(FC_MODEXT) \
                  mtime_time.$(FC_MODEXT) \
                  mtime_timedelta.$(FC_MODEXT)
 
-EXTRA_DIST = $(srcdir)/iso8601.rl
+EXTRA_DIST = $(srcdir)/mtime_iso8601.rl
 all: all-am
 
 .SUFFIXES:
@@ -393,9 +322,9 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
 	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
@@ -403,8 +332,6 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
 	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
 	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
 	}
@@ -420,16 +347,14 @@ uninstall-libLTLIBRARIES:
 
 clean-libLTLIBRARIES:
 	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-	@list='$(lib_LTLIBRARIES)'; \
-	locs=`for p in $$list; do echo $$p; done | \
-	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-	      sort -u`; \
-	test -z "$$locs" || { \
-	  echo rm -f $${locs}; \
-	  rm -f $${locs}; \
-	}
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
 libmtime.la: $(libmtime_la_OBJECTS) $(libmtime_la_DEPENDENCIES) $(EXTRA_libmtime_la_DEPENDENCIES) 
-	$(AM_V_FCLD)$(FCLINK) -rpath $(libdir) $(libmtime_la_OBJECTS) $(libmtime_la_LIBADD) $(LIBS)
+	$(FCLINK) -rpath $(libdir) $(libmtime_la_OBJECTS) $(libmtime_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -437,51 +362,51 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_360day.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_365day.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_gregorian.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/date.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datetime.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event_handling.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event_list.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8601.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/julian_day.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kepler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_calendar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_calendar360day.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_calendar365day.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_calendarGregorian.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_date.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_datetime.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_eventHandling.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_eventList.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_iso8601.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_julianDay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_time.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime_timedelta.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orbit.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timedelta.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsop87.Plo@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 .f90.o:
-	$(AM_V_FC)$(FCCOMPILE) -c -o $@ $<
+	$(FCCOMPILE) -c -o $@ $<
 
 .f90.obj:
-	$(AM_V_FC)$(FCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+	$(FCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .f90.lo:
-	$(AM_V_FC)$(LTFCCOMPILE) -c -o $@ $<
+	$(LTFCCOMPILE) -c -o $@ $<
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -489,15 +414,26 @@ mostlyclean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
 	set x; \
 	here=`pwd`; \
-	$(am__define_uniq_tagged_files); \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -509,11 +445,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	      $$unique; \
 	  fi; \
 	fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -522,21 +462,6 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -682,23 +607,23 @@ uninstall-am: uninstall-libLTLIBRARIES
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-libLTLIBRARIES install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
+	tags uninstall uninstall-am uninstall-libLTLIBRARIES
 
 
-@HAVE_RAGEL_TRUE@iso8601.c: iso8601.rl
-@HAVE_RAGEL_TRUE@	$(RAGEL) -o iso8601.c iso8601.rl
+@HAVE_RAGEL_TRUE@mtime_iso8601.c: mtime_iso8601.rl
+@HAVE_RAGEL_TRUE@	$(RAGEL) -o mtime_iso8601.c mtime_iso8601.rl
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/OLD/calendar.c b/src/OLD/calendar.c
new file mode 100644
index 00000000..313765ab
--- /dev/null
+++ b/src/OLD/calendar.c
@@ -0,0 +1,150 @@
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ *
+ * @file calendar.c
+ * 
+ * @brief Singleton Calendar connecting all supported calendar types.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ * @note Calendar type, once initialized, should not be changed.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include "calendar.h"
+
+#include "calendar_gregorian.h"
+#include "calendar_365day.h"
+#include "calendar_360day.h"
+
+struct _datetime;
+struct _julianday;
+
+struct _julianday *
+(*date2julian)(struct _datetime *date, struct _julianday *julian);
+struct _datetime *
+(*julian2date)(struct _julianday *julian, struct _datetime *date);
+
+static calendarType _calendar_type = CALENDAR_NOT_SET;
+
+static bool calendar_initialized = false;
+
+/**
+ * @brief To initialize a new calendar
+ *
+ * Calendar init is done at the very begining to use this calendar lib. Init intializes the 
+ * calendar to:
+ * - PROLEPTIC_GREGORIAN
+ * - YEAR_OF_365_DAYS
+ * - OR YEAR_OF_360_DAYS Calendar.
+ * 
+ * The calendar type and hence it's behaviour (Calendar to Julian conversion and vice versa) is fixed for the lifetime of the calendar object.
+ * Attempts to change the calendar type on the fly is discouraged. The lib has built-in checks to reject change attempts at run time. 
+ * However, calendar can be "re-initialized" after calling freeCalendar() but is not advised. MANTRA: Know what you are doing before you do it 
+ * and do it right the first time.
+ *
+ * @param  ct
+ *         An object of struct calendarType. 
+ *	   ct 'fixes' the calendar type by setting function pointers to point to functions designed
+ *	   to work with that calendarType.
+ */
+void
+initCalendar(calendarType ct)
+{
+  //DO not allow calendar type to be modified.
+  if (calendar_initialized) 
+    {
+      ct = _calendar_type;
+    }
+
+  switch (ct)
+    {
+  case PROLEPTIC_GREGORIAN:
+    date2julian = getJulianFromDateGregorian;
+    julian2date = getDateGregorianFromJulian;
+    _calendar_type = PROLEPTIC_GREGORIAN;
+    calendar_initialized = true;
+    break;
+  case YEAR_OF_365_DAYS:
+    date2julian = getJulianFromDate365;
+    julian2date = getDate365FromJulian;
+    _calendar_type = YEAR_OF_365_DAYS;
+    calendar_initialized = true;
+    break;
+  case YEAR_OF_360_DAYS:
+    date2julian = getJulianFromDate360;
+    julian2date = getDate360FromJulian;
+    _calendar_type = YEAR_OF_360_DAYS;
+    calendar_initialized = true;
+    break;
+  case CALENDAR_NOT_SET:
+  default:
+    break;
+    }
+
+  return;
+}
+
+
+/** 
+ * @brief called to discard the selected calendar type.
+ *
+ * RESETs the calendar. Ideally, should be performed at exit only.
+ */
+void
+freeCalendar(void)
+{
+  _calendar_type = CALENDAR_NOT_SET;
+  calendar_initialized = false;
+  return;
+}
+
+
+/**
+ * @brief to get an idea, which calendar type is selected.
+ * 
+ * Gets the calendarType. 
+ * @return ct
+ *         A member of enum calendarType. Denotes the currently set calendar type.
+ */
+calendarType
+getCalendarType(void)
+{
+  return _calendar_type;
+}
+
+
+/** 
+ * @brief convert the calendar identifier into a human readable string. 
+ *
+ * Gets a string describing the calendar in use. 
+ *
+ * @param  calendar
+ *         A pointer to char. A string where the currently set calendar type will be written.
+ */
+void
+calendarToString(char *calendar)
+{
+  switch (_calendar_type)
+    {
+  case PROLEPTIC_GREGORIAN:
+    strcpy(calendar, "Proleptic Gregorian");
+    break;
+  case YEAR_OF_365_DAYS:
+    strcpy(calendar, "Year of 365 days");
+    break;
+  case YEAR_OF_360_DAYS:
+    strcpy(calendar, "Year of 360 days");
+    break;
+  case CALENDAR_NOT_SET:
+  default:
+    strcpy(calendar, "Not defined");
+    break;
+    }
+  return;
+}
diff --git a/src/OLD/calendar_360day.c b/src/OLD/calendar_360day.c
new file mode 100644
index 00000000..0cbf08bd
--- /dev/null
+++ b/src/OLD/calendar_360day.c
@@ -0,0 +1,152 @@
+/**
+ * @file calendar_360day.c
+ * 
+ * @brief Convert julian dates to Calendar-with-360-days dates and vice-versa.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ * @note Calendar-with-360-days has 30 days in 'every' month and hence 360 days in every calendar year. 
+ *       Also, Julian Day (0,0) corresponds to Calendar-with-360-day's day 0-01-01T12:00:00.000Z.
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+#include "calendar_360day.h"
+#include "julian_day.h"
+#include "datetime.h"
+#include "date.h"
+#include "time.h"
+
+/**
+ * @brief Convert Julian Date to Calendar-with-360-days date.
+ *
+ * The getDate360FromJulian routine accepts a date on Julian axis and translates it to a date
+ * on Calendar-of-360-days. For eg. If Julian Day values are day = 1 and ms = 0, the corresponding 
+ * Calendar-of-360-days values will be Year = 0, Month = 1, Day = 2, Hour = 12, Minute = 0, 
+ * Second = 0 and MS = 0.
+ *
+ * The routine expects non NULL parameters. In case Julian-Day or DateTime
+ * is NULL, the routine returns with a NULL indicating failure.
+ *
+ * @param  jd 
+ *         A pointer to struct _julianday. JD contains the date to be 'translated' to type d360.
+ * @param  d360
+ *	  A pointer to struct _datetime. The translated date is copied into d360.
+ * @return d360
+ * 	  A pointer to the filled d360.
+ */
+
+struct _datetime*
+getDate360FromJulian(struct _julianday *jd, struct _datetime* d360)
+{
+  /* Check for malformed parameters */
+  if ((jd != NULL) && (d360 != NULL)){
+  int days;
+  int64_t jday, jms;
+
+  jday = jd->day;
+  jms = jd->ms;
+
+  /* Handle the 12 hour skew between two time axis. */
+  jms = jms + 43200000;
+  if (jms >= 86400000)
+    {
+      jday = jday + 1;
+      jms = jms - 86400000;
+    }
+
+  /* Handle skew due to the fact that Julian is symmetric about 0.0 JD while d360 is not. */
+  if (jday >= 0)
+    {
+      d360->date.year = (jday) / 360;
+
+      days = jday % 360;
+      d360->date.month = days / 30 + 1;
+      d360->date.day = days % 30 + 1;
+    }
+  else
+    {
+      d360->date.year = (jday) / 360 - 1;
+      days = -jday % 360;
+      d360->date.month = 12 - days / 30;
+      d360->date.day = 30 - (days % 30 - 1);
+
+      if (d360->date.day == 31)
+        {
+          d360->date.month = d360->date.month + 1;
+          if (d360->date.month == 13)
+            {
+              d360->date.year = d360->date.year + 1;
+              d360->date.month = 1;
+            }
+
+          d360->date.day = 1;
+        }
+    }
+
+  d360->time.hour = jms / 3600000;
+  d360->time.minute = (jms - d360->time.hour * 3600000) / 60000;
+  d360->time.second = (jms - d360->time.hour * 3600000 - d360->time.minute * 60000) / 1000;
+  d360->time.ms = jms - d360->time.hour * 3600000 - d360->time.minute * 60000 - d360->time.second * 1000;
+
+  return d360;
+}
+else
+return NULL;
+}
+
+  /**
+   * @brief Convert Calendar-with-360-days date to Julian Date.
+   *
+   * The getJulianFromDate360 routine accepts a date on Calendar-of-360-days axis and translates it to a date
+   * on Julian axis. For eg. If Calendar-of-360-days values are Year = 0, Month = 1, Day = 2, Hour = 12, Minute = 0, 
+   * Second = 0 and MS = 0 , corresponding Julian Day values will be day = 1 and ms = 0.
+   *
+   * The routine expects non NULL parameters. In case Julian-Day or DateTime
+   * is NULL, the routine returns with a NULL indicating failure.
+   *
+   * @param  d360
+   *         A pointer to struct _datetime. d360 contains the date to be translated.
+   * @param  jd 
+   *         A pointer to struct _julianday. The translated date is copied to JD.
+   * @return jd
+   *         A pointer to the filled jd. 
+   */
+
+struct _julianday*
+getJulianFromDate360(struct _datetime *d360, struct _julianday *jd)
+{
+  /* Check for malformed parameters */
+  if ((d360 != NULL) && (jd != NULL)){
+  /* Handle skew due to the fact that Julian is symmetric about 0.0 JD while d360 is not. */
+  if (d360->date.year < 0)
+    {
+      jd->day = d360->date.year * 360 + (d360->date.month) * 30 + (d360->date.day - 30) - 1;
+    }
+  else
+    {
+      jd->day = d360->date.year * 360 + (d360->date.month - 1) * 30 + d360->date.day - 1;
+    }
+
+  /* Handle the 12 hour skew between two time axis. */
+  if (d360->time.hour < 12)
+    {
+      jd->ms = 43200000;
+      jd->ms = jd->ms + 3600000 * (d360->time.hour);
+      jd->day = jd->day - 1;
+    }
+  else
+    {
+      jd->ms = 3600000 * (d360->time.hour - 12);
+    }
+
+  jd->ms = jd->ms + 60000 * d360->time.minute;
+  jd->ms = jd->ms + 1000 * d360->time.second;
+  jd->ms = jd->ms + d360->time.ms;
+
+  return jd;
+}
+else
+return NULL;
+}
diff --git a/src/OLD/calendar_365day.c b/src/OLD/calendar_365day.c
new file mode 100644
index 00000000..d543d0b7
--- /dev/null
+++ b/src/OLD/calendar_365day.c
@@ -0,0 +1,183 @@
+/**
+ * @file calendar_365day.c
+ * 
+ * @brief Convert julian dates to Calendar-with-365-days dates and vice-versa.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ * @note Calendar-with-365-days has a non-leap year characteristic and has 365 days in a calendar year. 
+ * Number of days in the 12 months is given by: {  31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }.
+ * Julian Day (0,0) corresponds to Calendar-with-365-day's day 0-01-01T12:00:00.000Z.
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+#include "calendar_365day.h"
+#include "julian_day.h"
+#include "datetime.h"
+#include "date.h"
+#include "time.h"
+
+/* Number of days after 0,1,2...12 months in a non-Leap year. */
+static const int msn[] =
+  { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
+
+/**
+ * @brief Convert Julian Date to Calendar-with-365-days date.
+ *
+ * The getDate365FromJulian routine accepts a date on Julian axis and translates it to a date
+ * on Calendar-of-365-days. For eg. If Julian Day values are day = 1 and ms = 0, the corresponding 
+ * Calendar-of-365-days values will be Year = 0, Month = 1, Day = 2, Hour = 12, Minute = 0, 
+ * Second = 0 and MS = 0.
+ *
+ * The routine expects non NULL parameters. In case Julian-Day or DateTime
+ * is NULL, the routine returns with a NULL indicating failure.
+ *
+ * @param  jd 
+ *         A pointer to struct _julianday. JD contains the date to be 'translated' to type d365.
+ * @param  d365
+ *         A pointer to struct _datetime. The translated date is copied into d365.
+ * @return d365
+ *         A pointer to the filled d365. 
+ */
+
+struct _datetime*
+getDate365FromJulian(struct _julianday *jd, struct _datetime* d365)
+{
+  /* Check for malformed parameters */
+  if ((jd != NULL) && (d365 != NULL)){
+  int i;
+  int64_t days;
+
+  /* No of days in January, February, March .. December. */
+  static const int mon[] =
+    { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+  int64_t jday, jms;
+
+  jday = jd->day;
+  jms = jd->ms;
+
+  /* Handle the 12 hour skew between two time axis. */
+  jms = jms + 43200000;
+  if (jms >= 86400000)
+    {
+      jday = jday + 1;
+      jms = jms - 86400000;
+    }
+
+  /* Handle skew due to the fact that Julian is symmetric about 0.0 JD while d360 is not. */
+  if (jday >= 0)
+    {
+      d365->date.year = (jday) / 365;
+
+      days = jday % 365;
+      for (i = 11; i >= 0; i--)
+        {
+          if (days >= msn[i])
+            {
+              d365->date.month = i + 1;
+              d365->date.day = days - msn[i] + 1;
+
+              break;
+            }
+        }
+    }
+  else
+    {
+      d365->date.year = (jday) / 365 - 1;
+      days = -jday % 365;
+      for (i = 11; i >= 0; i--)
+        {
+          if (365 - days + 1 > msn[i])
+            {
+              d365->date.month = i + 1;
+              // Avoid divide by zero.
+              if (msn[i] == 0)
+              d365->date.day = (365 - days + 1);
+              else
+              d365->date.day = (365 - days + 1) % msn[i];
+
+              break;
+            }
+        }
+
+      if (d365->date.day == (mon[i] + 1))
+        {
+          d365->date.month = d365->date.month + 1;
+          if (d365->date.month == 13)
+            {
+              d365->date.year = d365->date.year + 1;
+              d365->date.month = 1;
+            }
+          d365->date.day = 1;
+        }
+    }
+
+  d365->time.hour = jms / 3600000;
+  d365->time.minute = (jms - d365->time.hour * 3600000) / 60000;
+  d365->time.second = (jms - d365->time.hour * 3600000 - d365->time.minute * 60000) / 1000;
+  d365->time.ms = jms - d365->time.hour * 3600000 - d365->time.minute * 60000 - d365->time.second * 1000;
+
+  return d365;
+}
+else
+return NULL;
+}
+
+  /**
+   * @brief Convert Calendar-with-365-days date to Julian Date.
+   *
+   * The getJulianFromDate365 routine accepts a date on Calendar-of-365-days axis and translates it to a date
+   * on Julian axis. For eg. If Calendar-of-365-days values are Year = 0, Month = 1, Day = 2, Hour = 12, Minute = 0, 
+   * Second = 0 and MS = 0 , corresponding Julian Day values will be day = 1 and ms = 0.
+   *
+   * The routine expects non NULL parameters. In case Julian-Day or DateTime
+   * is NULL, the routine returns with a NULL indicating failure.
+   *
+   * @param  d365
+   *         A pointer to struct _datetime. d365 contains the date to be translated.
+   * @param  jd 
+   *         A pointer to struct _julianday. The translated date is copied to JD.
+   * @return jd
+   *         A pointer to the filled jd. 
+   */
+
+struct _julianday*
+getJulianFromDate365(struct _datetime *d365, struct _julianday* jd)
+{
+  /* Check for malformed parameters */
+  if ((d365 != NULL) && (jd != NULL)){
+  /* Handle skew due to the fact that Julian is symmetric about 0.0 JD while d365 is not. 
+   The code looks exactly the same but it can be instructive to see how the two execution
+   paths calculate the respective values. */
+  if (d365->date.year < 0)
+    {
+      jd->day = d365->date.year * 365 + msn[d365->date.month - 1] + d365->date.day - 1;
+    }
+  else
+    {
+      jd->day = d365->date.year * 365 + msn[d365->date.month - 1] + d365->date.day - 1;
+    }
+
+  /* Handle the 12 hour skew between two time axis. */
+  if (d365->time.hour < 12)
+    {
+      jd->ms = 43200000;
+      jd->ms = jd->ms + 3600000 * (d365->time.hour);
+      jd->day = jd->day - 1;
+    }
+  else
+    {
+      jd->ms = 3600000 * (d365->time.hour - 12);
+    }
+
+  jd->ms = jd->ms + 60000 * d365->time.minute;
+  jd->ms = jd->ms + 1000 * d365->time.second;
+  jd->ms = jd->ms + d365->time.ms;
+
+  return jd;
+}
+else
+return NULL;
+}
diff --git a/src/OLD/calendar_gregorian.c b/src/OLD/calendar_gregorian.c
new file mode 100644
index 00000000..a4a57993
--- /dev/null
+++ b/src/OLD/calendar_gregorian.c
@@ -0,0 +1,166 @@
+/**
+ * @file calendar_gregorian.c
+ * 
+ * @brief Convert julian dates to Gregorian-Calendar dates and vice-versa.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ * @note TODO-Ask LUIS
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+#include "calendar_gregorian.h"
+#include "julian_day.h"
+#include "datetime.h"
+#include "date.h"
+#include "time.h"
+
+/* Number of days after 0,1,2...12 months. */
+static const int msn[12] =
+  { 0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 337 };
+
+/* Internal function. */
+static
+int
+ifloor(int ir1, int ir2)
+{
+  int r;
+  int ifl;
+
+  r = (ir1 % ir2);
+  ifl = ir1 / ir2;
+
+  if (r < 0)
+    {
+      ifl = ifl - 1;
+    }
+  return ifl;
+}
+
+/**
+ * @brief Convert Julian Date to Gregorian date.
+ *
+ * The getDateGregorianFromJulian routine accepts a date on Julian axis and translates it to a date
+ * on Gregorian. For eg. If Julian Day values are day = 1721060 and ms = 0, the corresponding 
+ * Gregorian values will be Year = 0, Month = 1, Day = 1, Hour = 12, Minute = 0, 
+ * Second = 0 and MS = 0.
+ *
+ * The routine expects non NULL parameters. In case Julian-Day or DateTime
+ * is NULL, the routine returns with a NULL indicating failure.
+ *
+ * @param  jd 
+ *         A pointer to struct _julianday. JD contains the date to be 'translated' to type gregorian.
+ * @param  gd
+ *         A pointer to struct _datetime. The translated date is copied into gd.
+ * @return gd
+ *         A pointer to the filled gd. 
+ */
+
+struct _datetime*
+getDateGregorianFromJulian(struct _julianday *jd, struct _datetime* gd)
+{
+  if ((jd != NULL) && (gd != NULL)){
+  int tmp2, tmp3;
+
+  int64_t tjd, tms;
+  int a, b, c, d, j, m, y;
+
+  tjd = jd->day;
+  tms = jd->ms;
+  if (tms >= 43200000)
+    {
+      tjd = tjd + 1;
+      tms = tms - 86400000;
+    }
+  j = tjd - 1721119;
+  d = 100 * j - 25;
+  tmp2 = 3652425;
+  a = ifloor(d, tmp2);
+  tmp2 = 4;
+  b = a - ifloor(a, tmp2);
+  tmp2 = 100 * b + d;
+  tmp3 = 36525;
+  y = ifloor(tmp2, tmp3);
+  tmp2 = 4;
+  c = b + j - 365 * y - ifloor(y, tmp2);
+  m = (5 * c + 456) / 153;
+  d = c - msn[m - 3];
+  if (m > 12)
+    {
+      y = y + 1;
+      m = m - 12;
+    }
+
+  gd->date.year = y;
+  gd->date.month = m;
+  gd->date.day = d;
+  gd->time.hour = ifloor(tms, 3600000);
+  gd->time.minute = (tms - gd->time.hour * 3600000) / 60000;
+  gd->time.second = (tms - gd->time.hour * 3600000 - gd->time.minute * 60000) / 1000;
+  gd->time.ms = tms - gd->time.hour * 3600000 - gd->time.minute * 60000 - gd->time.second * 1000;
+  gd->time.hour = gd->time.hour + 12;
+
+  return gd;
+}
+else
+return NULL;
+}
+
+  /**
+   * @brief Convert Gregorian date to Julian Date.
+   *
+   * The getJulianFromDateGregorian routine accepts a date on Gregorian axis and translates it to a date
+   * on Julian axis. For eg. If Gregorian values are Year = -4713, Month = 11, Day = 24, Hour = 12, Minute = 0, 
+   * Second = 0 and MS = 0 , corresponding Julian Day values will be day = 0 and ms = 0.
+   *
+   * The routine expects non NULL parameters. In case Julian-Day or DateTime
+   * is NULL, the routine returns with a NULL indicating failure.
+   *
+   * @param  gd
+   *         A pointer to struct _datetime. gd contains the date to be translated.
+   * @param  jd 
+   *         A pointer to struct _julianday. The translated date is copied to JD.
+   * @return jd
+   *         A pointer to the filled jd. 
+   */
+
+struct _julianday*
+getJulianFromDateGregorian(struct _datetime* gd, struct _julianday *jd)
+{
+  if ((gd != NULL) && (jd != NULL)){
+  int tmp2, tmp3, tmp4;
+
+  int d, m, y;
+
+  y = gd->date.year;
+  m = gd->date.month;
+  d = gd->date.day;
+
+  if (m < 3)
+    {
+      m = m + 12;
+      y = y - 1;
+    }
+  tmp2 = 4;
+  tmp3 = 100;
+  tmp4 = 400;
+  jd->day = d + msn[m - 3] + 365 * y + ifloor(y, tmp2) - ifloor(y, tmp3) + ifloor(y, tmp4) + 1721119;
+  jd->ms = 0;
+  jd->ms = jd->ms + 3600000 * (gd->time.hour - 12);
+  jd->ms = jd->ms + 60000 * gd->time.minute;
+  jd->ms = jd->ms + 1000 * gd->time.second;
+  jd->ms = jd->ms + gd->time.ms;
+  if (jd->ms < 0)
+    {
+      jd->ms = 86400000 + jd->ms;
+      jd->day = jd->day - 1;
+    }
+
+  return jd;
+}
+else
+return NULL;
+}
+
diff --git a/src/OLD/date.c b/src/OLD/date.c
new file mode 100644
index 00000000..66baabe5
--- /dev/null
+++ b/src/OLD/date.c
@@ -0,0 +1,349 @@
+/**
+ * \addtogroup CBindings libmtime C language bindings
+ * 
+ * @file date.c
+ * 
+ * @brief Date and some operations supported on Date.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "julian_day.h"
+#include "date.h"
+#include "time.h"
+#include "calendar.h"
+#include "timedelta.h"
+#include "datetime.h"
+#include "iso8601.h"
+
+static const int64_t _min = -2147483648;        // as Julian day, might be to high
+static const int64_t _max = 2147483647;        // as Julian day, might be to low
+static const int64_t _resolution = 1000;        // ticks per second 
+
+/**
+ * @brief Construct new Date using an ISO 8601 conforming string.
+ *
+ * @param  ds
+ *         A pointer to char. The string should contain parameters with which Date object is to be created.
+ * @return d
+ *         A pointer to an initialized date object. 
+ */
+
+struct _date *
+newDate(const char* ds)
+{
+  if (ds != NULL )
+    {
+      /* Intialize a dummy ISO8601 object. */
+      struct iso8601_datetime* isoDt = new_iso8601_datetime('+', 0, 0, 0, 0, 0, 0, 0, 'Z');
+      if (isoDt == NULL )
+        return NULL ;
+
+      /* Check ISO8601 compliance. */
+      if (verify_string_datetime(ds, isoDt) != DATETIME_MATCH)
+        {
+          deallocate_iso8601_datetime(isoDt);
+          return NULL ;
+        }
+
+      struct _date *d = (struct _date*) malloc(sizeof(struct _date));
+      if (d == NULL )
+        {
+          deallocate_iso8601_datetime(isoDt);
+          return NULL ;
+        }
+
+      d->year = isoDt->year;
+      if (isoDt->sign_of_year == '-')
+        d->year = (-1) * d->year;
+      d->month = isoDt->month;
+      d->day = isoDt->day;
+
+      /* Cleanup. */
+      deallocate_iso8601_datetime(isoDt);
+
+      return d;
+    }
+  else
+    return NULL ;
+}
+
+/**
+ * @brief Construct new Date using 'raw' numerical values.
+ *
+ * @param  _year
+ *         An "int64_t" value denoting the year part of Date. 
+ * @param  _month
+ *         An "int" value denoting the month part of Date.
+ * @param  _day
+ *         An "int" value denoting the day part of Date.
+ *
+ * @return d
+ *         A pointer to an initialized Date object. 
+ */
+
+struct _date*
+newRawDate(int64_t _year, int _month, int _day)
+{
+  char* ds = (char*) malloc(sizeof(char) * MAX_DATE_STR_LEN);
+  if (ds == NULL )
+    {
+      return NULL ;
+    }
+
+  snprintf(ds, MAX_DATE_STR_LEN, "%" PRIi64 "-%02d-%02d", _year, _month, _day);
+
+  /* Resuse string interface and create object. */
+  struct _date* d = newDate(ds);
+
+  /* Cleanup. */
+  free(ds);
+  ds = NULL;
+
+  return d;
+}
+
+
+
+/**
+ * @brief Copy the values and construct a new date.
+ *
+ * @param  d
+ *         A pointer to struct _date. Values of d are used to initialize the new date object being created. 
+ *
+ * @return _d
+ *         A pointer to an initialized Date object. 
+ */
+
+struct _date*
+constructAndCopyDate(struct _date* d)
+{
+  if( d != NULL )
+    return newRawDate(d->year, d->month, d->day);
+  else
+    return NULL;
+}
+
+
+
+/**
+ * @brief Destructor of Date. Free the Date object.
+ *
+ * @param  d
+ *         A pointer to struct _date. d is deallocated.
+ */
+
+void
+deallocateDate(struct _date* d)
+{
+  if (d != NULL )
+    {
+      free(d);
+      d = NULL;
+    }
+}
+
+/*
+ * Internal and not doxyfied.
+ *
+ * @brief Copy the contents of Date into a DateTime object.
+ * 
+ * Routine convertDateToDateTime copies the contents of date object into a datetime object 
+ * and sets the time parameters to 0. For e.g A date 1999-12-01 can be copied into a DateTime
+ * object resulting in 1999-12-01T00:00:00.000. This function can be used by Date objects
+ * to get an equivalent DateTime object and then call routines supporting DateTime.
+ *
+ * @param  d
+ *         A pointer to struct _date. Copy "FROM" date object.
+ *
+ * @param  dt_return
+ *         A pointer to struct _datetime. Copy "TO" datetime object.
+ *
+ * @return dt_return
+ *         A pointer to the copied datetime object.
+ */
+
+struct _datetime *
+convertDateToDateTime(struct _date* d, struct _datetime* dt_return)
+{
+  if ((d != NULL) && (dt_return != NULL)){
+  dt_return->date.year = d->year;
+  dt_return->date.month = d->month;
+  dt_return->date.day = d->day;
+
+  dt_return->time.hour = 0;
+  dt_return->time.minute = 0;
+  dt_return->time.second = 0;
+  dt_return->time.ms = 0;
+
+  return dt_return;
+}
+else
+return NULL;
+}
+
+/*
+ * Internal and not doxyfied. 
+ *
+ * @brief Copy the contents of DateTime into a Date object.
+ *
+ * Routine convertDateTimeToDate copies the date elements of DateTime object(Year,Month,Day)
+ * into a Date object and discards the time elements (Hour, minute, second, ms). For e.g 
+ * A DateTime 1999-12-01T00:00:00.000 can be converted into a Date Object resulting in 
+ * 1999-12-01. (This function is used to 'go-back-to' Date format! Date objects, which convert
+ * to DateTime using the routine convertDateToDateTime can return to the original Date
+ * format after relevant processing on the meta-DateTime object.)
+ *
+ * @param  dt
+ *         A pointer to struct _datetime. Copy "FROM" datetime object.
+ *
+ * @param  d_return
+ *         A pointer to struct _date. Copy "TO" date object.
+ *
+ * @return d_return
+ *         A pointer to the copied date object.
+ */
+
+struct _date *
+convertDateTimeToDate(struct _datetime* dt, struct _date* d_return)
+{
+  if ((dt != NULL) && (d_return != NULL)){
+  /* Copy Date elements. Discard Time elements. */
+  d_return->year = dt->date.year;
+  d_return->month = dt->date.month;
+  d_return->day = dt->date.day;
+
+  return d_return;
+}
+else
+return NULL;
+}
+
+/*
+ * Internal and not doxyfied.
+ *
+ * @brief Compare two dates and return (d1 > d2) OR (d1 = d2) OR (d1 < d2).
+ *
+ * @param  d1
+ *         A pointer to struct _date.
+ *
+ * @param  d2
+ *         A pointer to struct _date.
+ *
+ * @return boolean
+ *         if (d1 > d2), return 1. If (d1 = d2), return 0. If (d1 < d2), return -1. Return 100 to indicate error.
+ */
+//TODO on RAHUL:Change error code to ENUM.
+char
+compareDate(struct _date* d1, struct _date* d2)
+{
+  if ((d1 != NULL )&& (d2 != NULL) ){
+  char boolean = 0;
+
+  if (d1->year == d2->year)
+    {
+      if (d1->month == d2->month)
+        {
+          if (d1->day == d2->day)
+            {
+              boolean = 0;
+            }
+          else if (d1->day > d2->day)
+            {
+              boolean = 1;
+            }
+          else
+            {
+              boolean = -1;
+            }
+        }
+      else if (d1->month > d2->month)
+        {
+          boolean = 1;
+        }
+      else
+        {
+          boolean = -1;
+        }
+
+    }
+  else if (d1->year > d2->year)
+    {
+      boolean = 1;
+    }
+  else
+    {
+      boolean = -1;
+    }
+
+  return boolean;
+}
+else
+return 100;
+}
+
+/*
+ * Internal and not doxyfied.
+ *
+ * @brief COPY a Date object.
+ *
+ * Routine replaceDate copies the contents of source Date into a Destination Date object.
+ *
+ * @param  dsrc
+ *         A pointer to struct _date. Copy "FROM" Date object.
+ *
+ * @param  ddest
+ *         A pointer to struct _date. Copy "TO" Date object.
+ *
+ * @return ddest
+ *         A pointer to 'copied' Date Object.
+ */
+
+struct _date*
+replaceDate(struct _date* dsrc, struct _date* ddest)
+{
+  if ((ddest != NULL )&& ( dsrc!=NULL ) ){
+  ddest->year = dsrc->year;
+  ddest->month = dsrc->month;
+  ddest->day = dsrc->day;
+
+  return ddest;
+}
+else
+return NULL;
+}
+
+/**
+ * @brief Get Date as a string.
+ *
+ * DateToString returns a string in IS08601 compliant (and extended) format.
+ *
+ * @param  d
+ *         A pointer to struct _date. The date to be converted to string.
+ *
+ * @param  toStr
+ *         A pointer to char. String where date is to be written.
+ *
+ * @return toStr
+ *         A pointer to the string containing date.
+ */
+char*
+dateToString(struct _date* d, char* toStr)
+{
+  if ((d != NULL )&& ( toStr!=NULL ) ){
+  snprintf(toStr,MAX_DATE_STR_LEN,"%" PRIi64 "-%02d-%02d", d->year, d->month, d->day);
+
+  return toStr;
+}
+else
+return NULL;
+}
+
diff --git a/src/OLD/datetime.c b/src/OLD/datetime.c
new file mode 100644
index 00000000..def4602c
--- /dev/null
+++ b/src/OLD/datetime.c
@@ -0,0 +1,621 @@
+/**
+ * @file datetime.c
+ * 
+ * @brief DateTime and some operations supported on DateTime.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "calendar.h"
+#include "julian_day.h"
+#include "datetime.h"
+#include "timedelta.h"
+#include "date.h"
+#include "time.h"
+#include "iso8601.h"
+
+/* Number of days after 0,1,2...12 months in a non-Leap year*/
+static const int nDaysNonLeap[13] =
+  { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
+
+/* Number of days after 0,1,2...12 months in a Leap year.*/
+static const int nDaysLeap[13] =
+  { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 };
+
+static const int64_t _min = -2147483648;        // as Julian day, might be to high
+static const int64_t _max = 2147483647;        // as Julian day, might be to low
+static const int64_t _resolution = 1000;        // ticks per second 
+
+
+/**
+ * @brief Construct new DateTime using a string.
+ *
+ * @param  dts
+ *         A pointer to char. The string should contain parameters with which DateTime is created.
+ *
+ * @return dt
+ *         A pointer to a filled datetime. 
+ */
+struct _datetime*
+newDateTime(const char* dts)
+{
+  if (dts != NULL )
+    {
+      /* Intialize a dummy ISO8601 object. */
+      struct iso8601_datetime* isoDt = new_iso8601_datetime('+', 0, 0, 0, 0, 0, 0, 0, 'Z');
+      if (isoDt == NULL )
+        return NULL ;
+
+      /* Check ISO8601 compliance. */
+      if (verify_string_datetime(dts, isoDt) != DATETIME_MATCH)
+        {
+          deallocate_iso8601_datetime(isoDt);
+          return NULL ;
+        }
+
+      struct _datetime *dt = (struct _datetime*) malloc(sizeof(struct _datetime));
+      if (dt == NULL )
+        {
+          deallocate_iso8601_datetime(isoDt);
+          return NULL ;
+        }
+
+      dt->date.year 	= isoDt->year;
+      if (isoDt->sign_of_year == '-')
+        dt->date.year 	= (-1) * dt->date.year;
+      dt->date.month 	= isoDt->month;
+      dt->date.day 	= isoDt->day;
+      dt->time.hour 	= isoDt->hour;
+      dt->time.minute	= isoDt->minute;
+      dt->time.second	= isoDt->second;
+      dt->time.ms	= isoDt->ms;
+
+      //Cleanup.	
+      deallocate_iso8601_datetime(isoDt);
+    
+      return dt;
+    }
+  else
+    return NULL ;
+}
+
+
+/**
+ * @brief Construct new DateTime using 'raw' numerical values.
+ *
+ * @param  _year
+ *         An "int64_t" value denoting the year part of DateTime. 
+ * @param  _month
+ *         An "int" value denoting the month part of DateTime.
+ * @param  _day
+ *         An "int" value denoting the day part of DateTime.
+ * @param  _hour
+ *         An "int" value denoting the hour part of DateTime.
+ * @param  _minute
+ *         An "int" value denoting the minute part of DateTime.
+ * @param  _second
+ *         An "int" value denoting the second part of DateTime.
+ * @param  _ms
+ *         An "int" value denoting the milli-second part of DateTime.
+ *
+ * @return dt
+ *         A pointer to a filled DateTime. 
+ */
+struct _datetime*
+newRawDateTime(int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int _ms)
+{
+  char* dts = (char*) malloc(sizeof(char) * MAX_DATETIME_STR_LEN);
+  if (dts == NULL )
+    {
+      return NULL ;
+    }
+
+  snprintf(dts, MAX_DATETIME_STR_LEN, "%" PRIi64 "-%02d-%02dT%02d:%02d:%02d.%03d", _year, _month, _day, _hour, _minute, _second,
+      _ms);
+
+  struct _datetime* dt = newDateTime(dts);
+
+  free(dts);
+  dts = NULL;
+  return dt;
+}
+
+
+/**
+ * @brief Copy the values and construct a new datetime.
+ *
+ * @param  dt
+ *         A pointer to struct _datetime. Values of dt are used to initialize the new datetime being created. 
+ *
+ * @return _dt
+ *         A pointer to an initialized DateTime. 
+ */
+struct _datetime*
+constructAndCopyDateTime(struct _datetime* dt)
+{
+  if ( dt != NULL )
+    return newRawDateTime(dt->date.year, dt->date.month, dt->date.day, dt->time.hour, dt->time.minute, dt->time.second, dt->time.ms);
+  else
+    return NULL;
+}
+
+
+
+/**
+ * @brief Destructor of DateTime.
+ *
+ * @param  dt
+ *         A pointer to struct _datetime. dt is deallocated.
+ */
+
+void
+deallocateDateTime(struct _datetime* dt)
+{
+  if (dt != NULL )
+    {
+      free(dt);
+      dt = NULL;
+    }
+}
+
+/**
+ * @brief Get the TimeDelta between two DateTimes dt1 and dt2 as (dt1-dt2).
+ *
+ * Routine getTimeDeltaFromDateTime 'substracts' two DateTime's and returns the TimeDelta between
+ * them. Each datetime is converted to an equivalent Julian Date. Substraction is then performed
+ * on Julian axis. The "Julian delta" is finally converted back to normal calendar delta. 
+ * 
+ * This routine  handles all supported Calendar types; i.e. the translation from Calendar date 
+ * to Julian date and conversion from Julian Delta to normal TimeDetla is Calendar-type dependent. 
+ * For eg. for Calendar type Gregorian, the TimeDelta between 2001-02-01T00:00:00.000 and 
+ * 2001-01-01T00:00:00.000 will be 1 month. Similarly, for Calendar of type 360-Day-Calendar, 
+ * the TimeDelta will be 1 month. It must be noted however, that the two dates differ by 31 and 
+ * 30 days respectively. 
+ *
+ * @param  dt1
+ *         A pointer to struct _datetime. 
+ *
+ * @param  dt2
+ *         A pointer to struct _datetime.
+ *
+ * @param  td_return
+ *         A pointer to struct _timedelta. Copy the result of (dt1 - dt2) in td_return.
+ *
+ * @return td_return
+ *	  A pointer to TimeDelta containing the result of substraction.
+ */
+
+struct _timedelta*
+getTimeDeltaFromDateTime(struct _datetime* dt1, struct _datetime* dt2, struct _timedelta* td_return)
+{
+  if ((dt1 != NULL )&& (dt2 != NULL) && (td_return != NULL) ){
+  /* Convert dt1 to Julian. */
+  struct _julianday* jd1 = newJulianDay(0, 0);
+  if (jd1 == NULL)
+  return NULL;
+  jd1 = date2julian(dt1, jd1);
+
+  /* Convert dt2 to Julian. */
+  struct _julianday* jd2 = newJulianDay(0, 0);
+  if (jd2 == NULL)
+    {
+      deallocateJulianDay(jd1);
+      return NULL;
+    }
+  jd2 = date2julian(dt2, jd2);
+
+  /* Calculat Delta on Julian axis. "RULE: A - B = Delta". If A > B, Delta is positive. */
+  struct _juliandelta* jd = newJulianDelta('+', 0, 0);
+  if (jd == NULL)
+    {
+      deallocateJulianDay(jd1);
+      deallocateJulianDay(jd2);
+      return NULL;
+    }
+
+  /* Substract the 2 dates on julian axis. */
+  jd = substractJulianDay(jd1, jd2, jd);
+
+  /* Convert Julian-delta to TimeDelta. */
+  td_return = julianDeltaToTimeDelta(jd, dt1, td_return);
+
+  deallocateJulianDay(jd1);
+  deallocateJulianDay(jd2);
+  deallocateJulianDelta(jd);
+
+  return td_return;
+}
+else
+return NULL;
+}
+
+/**
+ * @brief Compare two datetimes and return (dt1 > dt2) OR (dt1 = dt2) OR (dt1 < dt2).
+ *
+ * @param  dt1
+ *         A pointer to struct _datetime.
+ *
+ * @param  dt2
+ *         A pointer to struct _datetime.
+ *
+ * @return boolean
+ *         if (dt1 > dt2), return 1. If (dt1 = dt2), return 0. If (dt1 < dt2), return -1. Return 100 to indicate error.
+ */
+//TODO on RAHUL: Use enum for ERROR code.
+char
+compareDatetime(struct _datetime* dt1, struct _datetime* dt2)
+{
+  if ((dt1 != NULL) && (dt2 != NULL)){
+  int boolean = 0;
+
+  if (dt1->date.year == dt2->date.year)
+    {
+      if (dt1->date.month == dt2->date.month)
+        {
+          if (dt1->date.day == dt2->date.day)
+            {
+              if (dt1->time.hour == dt2->time.hour)
+                {
+                  if (dt1->time.minute == dt2->time.minute)
+                    {
+                      if (dt1->time.second == dt2->time.second)
+                        {
+                          if (dt1->time.ms == dt2->time.ms)
+                            {
+                              boolean = 0;
+                            }
+                          else if (dt1->time.ms > dt2->time.ms)
+                            {
+                              boolean = 1;
+                            }
+                          else
+                            {
+                              boolean = -1;
+                            }
+
+                        }
+                      else if (dt1->time.second > dt2->time.second)
+                        {
+                          boolean = 1;
+                        }
+                      else
+                        {
+                          boolean = -1;
+                        }
+                    }
+                  else if (dt1->time.minute > dt2->time.minute)
+                    {
+                      boolean = 1;
+                    }
+                  else
+                    {
+                      boolean = -1;
+                    }
+                }
+              else if (dt1->time.hour > dt2->time.hour)
+                {
+                  boolean = 1;
+                }
+              else
+                {
+                  boolean = -1;
+                }
+
+            }
+          else if (dt1->date.day > dt2->date.day)
+            {
+              boolean = 1;
+            }
+          else
+            {
+              boolean = -1;
+            }
+        }
+      else if (dt1->date.month > dt2->date.month)
+        {
+          boolean = 1;
+        }
+      else
+        {
+          boolean = -1;
+        }
+
+    }
+  else if (dt1->date.year > dt2->date.year)
+    {
+      boolean = 1;
+    }
+  else
+    {
+      boolean = -1;
+    }
+
+  return boolean;
+}
+else
+return 100;
+}
+
+  /**
+   * @brief COPY a DateTime object.
+   *
+   * Routine replaceDateTime copies the contents of source DateTime into a Destination DateTime object.
+   *
+   * @param  dtsrc         
+   *         A pointer to struct _datetime. Copy "FROM" DateTime object.
+   *
+   * @param  dtdest
+   *         A pointer to struct _datetime. Copy "TO" DateTime object.
+   *
+   * @return dtdest
+   *         A pointer to 'copied' DateTime Object.
+   */
+
+struct _datetime*
+replaceDatetime(struct _datetime* dtsrc, struct _datetime* dtdest)
+{
+  if ((dtdest != NULL) && (dtsrc != NULL)){
+  dtdest->date.year = dtsrc->date.year;
+  dtdest->date.month = dtsrc->date.month;
+  dtdest->date.day = dtsrc->date.day;
+  dtdest->time.hour = dtsrc->time.hour;
+  dtdest->time.minute = dtsrc->time.minute;
+  dtdest->time.second = dtsrc->time.second;
+  dtdest->time.ms = dtsrc->time.ms;
+
+  return dtdest;
+}
+else
+return NULL;
+}
+
+  /**
+   * @brief Get the 'day-of-year' value of a DateTime.
+   *
+   * Routine getDayOfYearFromDateTime returns Day of Year for the DateTime. This routine supports
+   * all Calendar types.
+   *
+   * For eg. the day of year value for 2001-10-15T00:00:00.000 will be 288 for Gregorian Calendar. 
+   * Similarly, this value will be 285 for Calendar of type 360 day-Calendar.
+   *
+   * @param  dt
+   *         A pointer to struct _datetime. Retrieve the 'day-of-year' from this DT object.
+   *
+   * @return doy
+   *         Integer value of doy. The value depends on the calendar type. Zero indicates error.
+   */
+
+int
+getDayOfYearFromDateTime(struct _datetime* dt)
+{
+  if (dt != NULL )
+    {
+      int doy = 0;
+      calendarType ct;
+
+      if ((ct = getCalendarType()) == PROLEPTIC_GREGORIAN)
+        {
+          if (testYearIsLeapYear(dt->date.year))
+            {
+              doy = nDaysLeap[dt->date.month - 1] + dt->date.day;
+            }
+          else
+            {
+              doy = nDaysNonLeap[dt->date.month - 1] + dt->date.day;
+            }
+
+        }
+      else if (ct == YEAR_OF_365_DAYS)
+        {
+          doy = nDaysNonLeap[dt->date.month - 1] + dt->date.day;
+        }
+      else if (ct == YEAR_OF_360_DAYS)
+        {
+          doy = (dt->date.month - 1) * 30 + dt->date.day;
+        }
+
+      return doy;
+    }
+  else
+    return 0;
+}
+
+/**
+ * @brief Get nod (number of Days) in the month of DateTime.
+ *
+ * Routine getNoOfDaysInMonthDateTime returns number of days in the month of DateTime. This routine  
+ * supports all calendar types.
+ *
+ * For eg. the number of days for 2001-10-15T00:00:00.000 will be 31 for Gregorian Calendar. 
+ * Similarly, this value will be 30 for Calendar of type 360 day-Calendar.
+ *
+ * @param  dt
+ *         A pointer to struct _datetime.
+ *
+ * @return nod
+ *         Integer value of nod. The value depends on the month and the calendar type. Zero indicates error.
+ */
+
+int
+getNoOfDaysInMonthDateTime(struct _datetime* dt)
+{
+  if (dt != NULL )
+    {
+      int nod = 0;
+      calendarType ct;
+
+      if ((ct = getCalendarType()) == PROLEPTIC_GREGORIAN)
+        {
+          if (testYearIsLeapYear(dt->date.year))
+            {
+              nod = nDaysLeap[dt->date.month] - nDaysLeap[dt->date.month - 1];
+            }
+          else
+            {
+              nod = nDaysNonLeap[dt->date.month] - nDaysNonLeap[dt->date.month - 1];
+            }
+
+        }
+      else if (ct == YEAR_OF_365_DAYS)
+        {
+          nod = nDaysNonLeap[dt->date.month] - nDaysNonLeap[dt->date.month - 1];
+        }
+      else if (ct == YEAR_OF_360_DAYS)
+        {
+          nod = 30;
+        }
+
+      return nod;
+    }
+  else
+    return 0;
+}
+
+/**
+ * @brief Get number of days in the Year of DateTime.
+ *
+ * Routine getNoOfDaysInYearDateTime returns number of days in the Year of DateTime. This routine  
+ * supports all calendar types.
+ *
+ * Number of days returned will depend on the calendar type and if applicable, leap v/s non leap year.
+ *
+ * @param  dt
+ *         A pointer to struct _datetime.
+ *
+ * @return nod
+ *         Integer value of nod. The value depends on the year and the calendar type. Zero indicates error.
+ */
+
+int
+getNoOfDaysInYearDateTime(struct _datetime* dt)
+{
+  if (dt != NULL )
+    {
+      int nod = 0;
+      calendarType ct;
+
+      if ((ct = getCalendarType()) == PROLEPTIC_GREGORIAN)
+        {
+          if (testYearIsLeapYear(dt->date.year))
+            {
+              nod = 366;
+            }
+          else
+            {
+              nod = 365;
+            }
+
+        }
+      else if (ct == YEAR_OF_365_DAYS)
+        {
+          nod = 365;
+        }
+      else if (ct == YEAR_OF_360_DAYS)
+        {
+          nod = 360;
+        }
+
+      return nod;
+    }
+  else
+    return 0;
+}
+
+/**
+ * @brief Get number of seconds elapsed in the month of DateTime.
+ *
+ * @param  dt
+ *         A pointer to struct _datetime.
+ *
+ * @return no_of_seconds
+ *         int64_t value of no_of_seconds. -1 indicates error.
+ */
+
+int64_t
+getNoOfSecondsElapsedInMonthDateTime(struct _datetime* dt)
+{
+  if ( dt != NULL )
+    return ((dt->date.day-1) * 86400 + dt->time.hour * 3600 + dt->time.minute * 60 + dt->time.second);
+  else
+    return -1;
+}
+
+
+/**
+ * @brief Get number of seconds elapsed in the day of DateTime.
+ *
+ * @param  dt
+ *         A pointer to struct _datetime.
+ *
+ * @return no_of_seconds
+ *         int64_t value of no_of_seconds. -1 indicates error.
+ */
+
+int64_t
+getNoOfSecondsElapsedInDayDateTime(struct _datetime* dt)
+{
+  if ( dt != NULL )
+    return  (dt->time.hour * 3600 + dt->time.minute * 60 + dt->time.second);
+  else
+    return -1;
+}
+
+
+/**
+ * @brief Get the Julian Day from DateTime.
+ *
+ * The routine getJulianDayFromDateTime returns the equivalent Julian date to DateTime. Internally
+ * it calls translation routines based on Calndar type.
+ *
+ * @param  dt
+ *         A pointer to struct _datetime. The DT's value is converted to julian day value.
+ *
+ ** @param  jd
+ *         A pointer to struct _julianday. JD where the converted value is stored.
+ *
+ * @return jd
+ *         A pointer to struct _julianday containing a copy of the JD value corresponding to the DT.
+ */
+
+struct _julianday*
+getJulianDayFromDateTime(struct _datetime* dt, struct _julianday* jd)
+{
+  return date2julian(dt, jd);
+}
+
+
+/**
+ * @brief Get DateTime as a string.
+ *
+ * datetimeToString returns a string in IS08601 compliant (and extended) format.
+ *
+ * @param  dt
+ *         A pointer to struct _datetime. The datetime to be converted to string.
+ *
+ * @param  toStr
+ *         A pointer to char. String where datetime is to be written.
+ *
+ * @return toStr
+ *         A pointer to the string containing datetime.
+ */
+
+char*
+datetimeToString(struct _datetime* dt, char* toStr)
+{
+  if ((dt != NULL )&& (toStr != NULL)){
+  snprintf(toStr,MAX_DATETIME_STR_LEN,"%" PRIi64 "-%02d-%02dT%02d:%02d:%02d.%03dZ",
+      dt->date.year, dt->date.month, dt->date.day,
+      dt->time.hour, dt->time.minute, dt->time.second, dt->time.ms);
+
+  return toStr;
+}
+else
+return NULL;
+}
diff --git a/src/OLD/event_handling.c b/src/OLD/event_handling.c
new file mode 100644
index 00000000..755acaa4
--- /dev/null
+++ b/src/OLD/event_handling.c
@@ -0,0 +1,608 @@
+/**
+ * @file event_handling.c
+ *
+ * @brief Event-groups which contains a list of events.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ * @note
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "event_handling.h"
+#include "date.h"
+#include "time.h"
+#include "datetime.h"
+#include "timedelta.h"
+#include "event_list.h"
+#include "iso8601.h"
+
+//TODO: Need to handle cases where some parameters are left out in the init. Discuss each value independently.
+
+//The IDs are unique only when they are live. Once a group/event has been deleted, the IDs will be reused.
+static int64_t EVENTGROUPID = 0;
+static int64_t EVENTID = 0;
+
+
+/**
+ * @brief Construct new event-Group using a string.
+ *
+ * @param  egn
+ *         A pointer to char. This string contains the name of event group.
+ *
+ * @return eg
+ *         A pointer to a initialized event-Group. 
+ *
+ */
+
+struct _eventGroup*
+newEventGroup(char* egn)
+{
+if ( egn != NULL )
+{
+  struct _eventGroup* eg = (struct _eventGroup*) malloc(sizeof(struct _eventGroup));
+  if (eg == NULL )
+    return NULL ;
+
+  /* Copy Group name. */
+  eg->eventGroupName = (char*) malloc(sizeof(char) * MAX_GROUPNAME_STR_LEN);
+  if (eg->eventGroupName == NULL )
+    {
+      free(eg);
+      eg = NULL;
+      return NULL ;
+    }
+  strncpy(eg->eventGroupName, egn, MAX_GROUPNAME_STR_LEN-1);
+  eg->eventGroupName[MAX_GROUPNAME_STR_LEN - 1] = '\0';
+
+  /* Generate eventGroupId. */
+  EVENTGROUPID = EVENTGROUPID + 1;
+  eg->eventGroupId = EVENTGROUPID;
+
+  /* Initialize a NULL pointer. Stores a List of events associated with 'this' Event Group. */
+  eg->rootEvent = NULL;
+
+  return eg;
+}
+else
+  return NULL;
+}
+
+
+/**
+ * @brief Destructor of EventGroup.
+ *
+ * @param  eg
+ *         A pointer to struct _eventGroup. eg is deallocated.
+ */
+
+void
+deallocateEventGroup(struct _eventGroup* eg)
+{
+  if (eg != NULL )
+    {
+      EVENTGROUPID = EVENTGROUPID - 1;
+
+      free(eg->eventGroupName);
+      eg->eventGroupName = NULL;
+
+      /* Deallocate all events in the list. */
+      deallocateEventsInGroup(eg);
+
+      free(eg);
+      eg = NULL;
+    }
+}
+
+
+/**
+ * @brief Add new event to an eventgroup.
+ *
+ * @param  e
+ *         A pointer to struct _event. The event to be added.
+ *
+ * @param  eg
+ *         A pointer to struct _eventGroup. The eventGroup where the event is added.
+ *
+ * @return bool
+ *         true/false indicating success or failure of addition.
+ */
+
+bool
+addNewEventToEventGroup(struct _event* e, struct _eventGroup* eg)
+{
+  if ((e != NULL )&& (eg != NULL) )
+    {
+      if ( addNewEventToGroup(e,eg) == true )
+        return true;
+      else
+        return false;
+    }
+  else
+    return false;
+}
+
+
+/**
+ * @brief Remove event from eventgroup.
+ *
+ * @param  en
+ *         A pointer to char. The name of event to be removed.
+ *
+ * @param  eg
+ *         A pointer to struct _eventGroup. The eventGroup to which this event belongs.
+ *
+ * @return bool
+ *         true/false indicating success or failure of removal.
+ */
+
+bool
+removeEventFromEventGroup(char* en, struct _eventGroup* eg)
+{
+  if ((en != NULL )&& (eg != NULL) )
+    return removeEventWithNameFromGroup(en,eg);
+  else
+    return false;
+}
+
+  /**
+   * @brief Construct new event using strings.
+   *
+   * @param  _en
+   *         A pointer to char. This string contains the name of event.
+   * @param  _eventReferenceDT
+   *         A pointer to char. This string contains the First Reference date.
+   * @param  _eventFirstDT
+   *         A pointer to char. This string contains the Starting time.
+   * @param  _eventLastDT
+   *         A pointer to char. This string contains the Ending time.
+   * @param  _eventInterval
+   *         A pointer to char. This string contains the timestep.
+   * @return e
+   *         A pointer to an initialized event. 
+   *
+   */
+
+struct _event*
+newEvent(char* _en, char* _eventReferenceDT, char* _eventFirstDT, char* _eventLastDT, char* _eventInterval)
+{
+  struct _event* e = (struct _event*) malloc(sizeof(struct _event));
+  if (e == NULL )
+    return NULL ;
+
+  /* Initialize a null pointer. Connectes to the 'next' event in the list of Events in an Event Group.  */
+  e->nextEventInGroup = NULL;
+
+  /* Copy event name. */
+  e->eventName = (char*) malloc(sizeof(char) * MAX_EVENTNAME_STR_LEN);
+  if (e->eventName == NULL )
+    {
+      free(e);
+      e = NULL;
+      return NULL ;
+    }
+  strncpy(e->eventName, _en, MAX_EVENTNAME_STR_LEN-1);
+  e->eventName[MAX_EVENTNAME_STR_LEN - 1] = '\0';
+
+  //Generate eventId.
+  EVENTID = EVENTID + 1;
+  e->eventId = EVENTID;
+
+  if (_eventReferenceDT)
+    {
+      e->eventReferenceDateTime = newDateTime(_eventReferenceDT);
+      if (e->eventReferenceDateTime == NULL )
+        {
+          free(e->eventName);
+          e->eventName = NULL;
+          free(e);
+          e = NULL;
+          return NULL ;
+        }
+    }
+  else
+    {
+      //TODO:
+    }
+
+  if (_eventFirstDT)
+    {
+      e->eventFirstDateTime = newDateTime(_eventFirstDT);
+      if (e->eventFirstDateTime == NULL )
+        {
+          free(e->eventName);
+          e->eventName = NULL;
+          deallocateDateTime(e->eventReferenceDateTime);
+          free(e);
+          e = NULL;
+          return NULL ;
+        }
+    }
+  else
+    {
+      //TODO:
+    }
+
+  if (_eventLastDT)
+    {
+      e->eventLastDateTime = newDateTime(_eventLastDT);
+      if (e->eventLastDateTime == NULL )
+        {
+          free(e->eventName);
+          e->eventName = NULL;
+          deallocateDateTime(e->eventReferenceDateTime);
+          deallocateDateTime(e->eventFirstDateTime);
+          free(e);
+          e = NULL;
+          return NULL ;
+        }
+    }
+  else
+    {
+      //TODO:
+    }
+
+  if (_eventInterval)
+    {
+      e->eventInterval = newTimeDelta(_eventInterval);
+      if (e->eventInterval == NULL )
+        {
+          free(e->eventName);
+          e->eventName = NULL;
+          deallocateDateTime(e->eventReferenceDateTime);
+          deallocateDateTime(e->eventFirstDateTime);
+          deallocateDateTime(e->eventLastDateTime);
+          free(e);
+          e = NULL;
+          return NULL ;
+        }
+    }
+  else
+    {
+      //TODO:
+    }
+
+  /* Initialize with 'some' value. */
+  e->triggerNextEventDateTime = newDateTime("0-01-01T00:00:00.000");
+  e->triggeredPreviousEventDateTime = newDateTime("0-01-01T00:00:00.000");
+
+  /* Intialize the next trigger to be the first trigger. */
+  e->triggerNextEventDateTime = replaceDatetime(e->eventFirstDateTime, e->triggerNextEventDateTime);
+
+  e->nextEventIsFirst = true;
+
+  e->eventisFirstInDay = false;
+  e->eventisFirstInMonth = false;
+  e->eventisFirstInYear = false;
+  e->eventisLastInDay = false;
+  e->eventisLastInMonth  = false;
+  e->eventisLastInYear = false;
+
+  return e;
+}
+
+
+/**
+ * @brief Destructor of Event.
+ *
+ * @param  e
+ *         A pointer to struct _event. e is deallocated.
+ */
+
+void
+deallocateEvent(struct _event* e)
+{
+  if (e != NULL )
+    {
+      EVENTID = EVENTID - 1;
+
+      free(e->eventName);
+      e->eventName = NULL;
+
+      deallocateDateTime(e->eventReferenceDateTime);
+      deallocateDateTime(e->eventFirstDateTime);
+      deallocateDateTime(e->eventLastDateTime);
+      deallocateDateTime(e->triggerNextEventDateTime);
+      deallocateDateTime(e->triggeredPreviousEventDateTime);
+
+      deallocateTimeDelta(e->eventInterval);
+
+      e->nextEventInGroup = NULL;
+
+      free(e);
+      e = NULL;
+    }
+}
+
+
+/*! \cond PRIVATE */
+/*  Internal event. Should not be exposed to the user.*/
+static
+void
+setEvent(struct _event* e)
+{
+  if (e != NULL )
+    e->triggerCurrentEvent = true;
+}
+/*! \endcond */
+
+/**
+ * @brief Check if this event is active by comparing event's trigger time with current_dt.
+ *
+ * @param  event
+ *         A pointer to struct _event. This is the event being tested.
+ *
+ * @param  current_dt
+ *         A pointer to struct _datetime. This is the 'current' datetime of the system.
+ *
+ * @return bool
+ *         true/false indicating if the event is active.
+ */
+
+bool
+isCurrentEventActive(struct _event* event, struct _datetime* current_dt)
+{
+  if ((event != NULL )&& (current_dt != NULL) ){
+  if(compareDatetime(current_dt,event->triggerNextEventDateTime) >= 0)
+    {
+      /* If current Datetime is ahead of next trigger datetime, Event is active. */
+
+
+      /* If the event being triggred is the first event to be triggered, it is all of FirstIn*  */
+      /* If previous triggered event had a different day/month/year, this event must be FirstIn* */
+      if( (event->nextEventIsFirst == true) || (iseventNextInNextDays(event) == true))
+	{
+	  event->eventisFirstInDay = true;
+	}
+      if( (event->nextEventIsFirst == true)  || (iseventNextInNextMonths(event) == true))
+	{
+	  event->eventisFirstInMonth = true;
+	}
+      if( (event->nextEventIsFirst == true)  || (iseventNextInNextYears(event) == true))
+	{
+	  event->eventisFirstInYear = true;
+	}
+
+
+
+      /* Set the new next-trigger datetime and the new previous-triggered-datetime. */
+      replaceDatetime(event->triggerNextEventDateTime, event->triggeredPreviousEventDateTime);
+      event->triggerNextEventDateTime = addTimeDeltaToDateTime(event->triggerNextEventDateTime,event->eventInterval,event->triggerNextEventDateTime);
+
+      /* Set event. */
+      setEvent(event);
+
+
+
+      /* If the future event (not the current event being triggered) has a different day/month/year, current event must be LastIn* */
+      if(iseventNextInNextDays(event) == true)
+	{
+	  event->eventisLastInDay = true;
+	}
+      
+      if(iseventNextInNextMonths(event) == true)
+	{
+	  event->eventisLastInMonth = true;
+	}
+      if(iseventNextInNextYears(event) == true)
+	{
+	  event->eventisLastInYear = true;
+	}
+
+      return true;
+    }
+  else if ((event->triggerCurrentEvent == true) && (compareDatetime(current_dt,event->triggerNextEventDateTime) < 0))
+    {
+      /* This is the next iteration after event was set in last call. Reset event. Return false. */
+      event->triggerCurrentEvent = false;
+
+      event->eventisFirstInDay = false;
+      event->eventisFirstInMonth = false;
+      event->eventisFirstInYear = false;
+      event->eventisLastInDay = false;
+      event->eventisLastInMonth	 = false;
+      event->eventisLastInYear = false;
+      
+      event->nextEventIsFirst = false;
+    }
+
+  return false;
+}
+else
+return false;
+}
+
+
+/* Is next event in next day(s) of previous event. */
+static bool
+iseventNextInNextDays(struct _event* e)
+{
+  if( e != NULL )
+    {
+      bool ret = false;
+
+      struct _date* d_next = newRawDate(0,1,1);
+      struct _date* d_prev = newRawDate(0,1,1);
+      d_next = convertDateTimeToDate(e->triggerNextEventDateTime,d_next);
+      d_prev = convertDateTimeToDate(e->triggeredPreviousEventDateTime,d_prev);
+
+      if(compareDate(d_next,d_prev) == 1)
+	{
+	  ret = true;
+	}
+      else
+	{
+	  ret = false;
+	}
+
+      deallocateDate(d_next);
+      deallocateDate(d_prev);
+
+      return ret;
+    }
+  else
+    return false;
+}
+
+
+/* Is next event in next month(s) of previous event. */
+static bool
+iseventNextInNextMonths(struct _event* e)
+{
+  if( e != NULL )
+    {
+      bool ret = false;
+
+      struct _date* d_next = newRawDate(0,1,1);
+      struct _date* d_prev = newRawDate(0,1,1);
+      d_next = convertDateTimeToDate(e->triggerNextEventDateTime,d_next);
+      d_prev = convertDateTimeToDate(e->triggeredPreviousEventDateTime,d_prev);
+
+      d_next->day = 1;
+      d_prev->day = 1;
+
+      if(compareDate(d_next,d_prev) == 1)
+	{
+	  ret = true;
+	}
+      else
+	{
+	  ret = false;
+	}
+
+      deallocateDate(d_next);
+      deallocateDate(d_prev);
+
+      return ret;
+    }
+  else
+    return false;
+}
+
+/* Is next event in next year(s) of previous event. */
+static bool
+iseventNextInNextYears(struct _event* e)
+{
+  if( e != NULL )
+    {
+      bool ret = false;
+
+      struct _date* d_next = newRawDate(0,1,1);
+      struct _date* d_prev = newRawDate(0,1,1);
+      d_next = convertDateTimeToDate(e->triggerNextEventDateTime,d_next);
+      d_prev = convertDateTimeToDate(e->triggeredPreviousEventDateTime,d_prev);
+
+      d_next->day = 1;
+      d_next->month = 1;
+      
+      d_prev->day = 1;
+      d_prev->month = 1;
+
+
+      if(compareDate(d_next,d_prev) == 1)
+	{
+	  ret = true;
+	}
+      else
+      {
+	ret = false;
+      }
+
+      deallocateDate(d_next);
+      deallocateDate(d_prev);
+
+      return ret;
+    }
+  else
+    return false;
+}
+
+
+  /**
+   * @brief Get Event as a string.
+   *
+   * @param  e
+   *         A pointer to struct _event. The event to be converted to string.
+   *
+   * @param  string
+   *         A pointer to char. String where event is to be written.
+   *
+   * @return string
+   *         A pointer to the string containing event description.
+   */
+//TODO: Get exact format from LUIS.
+char*
+eventToString(struct _event* e, char* string)
+{
+  if ((e != NULL )&& (string != NULL) )
+    {
+      if (e->eventName != NULL)
+	{
+      	  sprintf(string, "%s", e->eventName);
+          return string;
+	}
+      else
+	{  
+	   //TODO: Need to work on this!
+	   return NULL;
+	}
+    }
+  else
+    return NULL;
+}
+
+  /**
+   * @brief Get the Datetime when 'this' event will be triggered next.
+   *
+   * @param  e
+   *         A pointer to struct _event. This is the event being queried.
+   *
+   * @param  dt_return
+   *         A pointer to struct _datetime. The next trigger datetime is copied here.
+   *
+   * @return dt_return
+   *         A pointer to DateTime with next-trigger datetime.
+   */
+
+struct _datetime*
+getTriggerNextEventAtDateTime(struct _event* e, struct _datetime* dt_return)
+{
+  if ((e != NULL )&& (dt_return != NULL) ){
+  replaceDatetime(e->triggerNextEventDateTime, dt_return);
+  return dt_return;
+}
+else
+return NULL;
+}
+
+  /**
+   * @brief Get the Datetime when 'this' event was triggered last.
+   *
+   * @param  e
+   *         A pointer to struct _event. This is the event being queried.
+   *
+   * @param  dt_return
+   *         A pointer to struct _datetime. The last trigger datetime is copied here.
+   *
+   * @return dt_return
+   *         A pointer to DT with previous-trigger datetime.
+   */
+  /* If the event was never tiggered, 0-01-01T00:00:00.000 is returned. */
+struct _datetime*
+getTriggeredPreviousEventAtDateTime(struct _event* e, struct _datetime* dt_return)
+{
+  if ((e != NULL )&& (dt_return != NULL) ){
+  replaceDatetime(e->triggeredPreviousEventDateTime, dt_return);
+  return dt_return;
+}
+else
+return NULL;
+}
+
diff --git a/src/OLD/event_list.c b/src/OLD/event_list.c
new file mode 100644
index 00000000..76bfca96
--- /dev/null
+++ b/src/OLD/event_list.c
@@ -0,0 +1,128 @@
+/*! \cond PRIVATE */
+/**
+ * @file event_list.c
+ *
+ * @brief _eventList data structure supports 'Event-groups'; Each group stores multiple events as a link list of nodes.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ * @note All functions in this file are internal.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "event_list.h"
+#include "event_handling.h"
+
+
+/* Deallocate all Event's in Group. */
+void
+deallocateEventsInGroup(struct _eventGroup* eg)
+{
+  if (eg != NULL )
+    { 
+      struct _event* conductor = eg->rootEvent;
+      /* Loop over and deallocate all non NULL events in the list. */
+      while ((eg->rootEvent != NULL ))
+        {
+          eg->rootEvent = eg->rootEvent->nextEventInGroup;
+	  deallocateEvent(conductor);
+          conductor = eg->rootEvent;
+        }
+    }
+}
+
+
+/* Add new Event to Group. Attach event at the end of the list. */
+bool
+addNewEventToGroup(struct _event* ev, struct _eventGroup* eg)
+{
+  if ( (ev != NULL ) && (eg != NULL) ){
+  if(eg->rootEvent != NULL)
+    {
+      /* Non empty Group. */
+
+      struct _event* conductor = eg->rootEvent;
+      /* Loop over and get to the end of lisr. */
+      while(conductor->nextEventInGroup != NULL)
+        {
+          conductor = conductor->nextEventInGroup;
+        }
+
+      /* Add new node. */
+      conductor->nextEventInGroup = ev;
+    }
+  else
+    {
+      /* This is an empty Group.*/
+      eg->rootEvent = ev;
+    }
+
+  return true;
+}
+return false;
+}
+
+
+/* Remove node with a given name */
+bool
+removeEventWithNameFromGroup(char* nodeName, struct _eventGroup* eg)
+{
+  if ( (nodeName != NULL ) && (eg != NULL) ){
+  struct _event* conductor_fwd = eg->rootEvent;
+  struct _event* conductor_bkd = eg->rootEvent;
+
+  if(conductor_fwd == NULL)
+    {
+      /*Empty group. Can't delete a ghost!*/
+      return false;
+    }
+
+  /* Delete root. */
+  if(!strcmp(conductor_fwd->eventName,nodeName))
+    {
+      /* Set root to root->next. */
+      eg->rootEvent = eg->rootEvent->nextEventInGroup;
+      /* Deallocate root. */
+      deallocateEvent(conductor_bkd);
+      return true;
+    }
+
+  if(eg->rootEvent->nextEventInGroup != NULL)
+    {
+      /* There are atleast 2 objects in the Group. Restart from root->next. */
+      conductor_fwd = conductor_fwd->nextEventInGroup;
+
+      /* Loop over and find a name match. */
+      while(strcmp(conductor_fwd->eventName,nodeName))
+        {
+          conductor_fwd = conductor_fwd->nextEventInGroup;
+          conductor_bkd = conductor_bkd->nextEventInGroup;
+
+	  /* No name match. Can't delete. */
+          if(conductor_fwd == NULL)
+            {
+              return false;
+            }
+        }
+    }
+  else
+    {
+      /* Root node, the only node, was not a match */
+      return false;
+    }
+
+  /* The while exited with a match. Delete conductor_fwd. */
+  conductor_bkd->nextEventInGroup = conductor_fwd->nextEventInGroup;
+  deallocateEvent(conductor_fwd);
+
+  return true;
+}
+else
+return false;
+}
+
+/*! \endcond */
diff --git a/src/OLD/iso8601.c b/src/OLD/iso8601.c
new file mode 100644
index 00000000..941f2ba5
--- /dev/null
+++ b/src/OLD/iso8601.c
@@ -0,0 +1,3139 @@
+
+#line 1 "iso8601.rl"
+/*! \cond PRIVATE */
+/**
+  * @brief ISO 8601_2004 complaint Time.
+  *
+  * @author Luis Kornblueh, Rahul Sinha. MPIM.
+  * @date March 2013
+  *
+  * @note USAGE: Compile this rl file and generate iso8601.c file. Compile the iso8601.c file using gcc. iso8601.h file needs to be edited seperately. match_found = 1 => DATE/DATETIME. match_found = 2 => Duration. Else malformed string and hence REJECT.
+  */
+
+//file iso8601.rl
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#include "iso8601.h"
+
+#define MAX_BUFFER_LENGTH 32
+
+
+#line 26 "iso8601.c"
+static const char _date_machine_actions[] = {
+	0, 1, 0, 1, 1, 1, 2, 1, 
+	5, 1, 6, 1, 7, 1, 8, 1, 
+	9, 1, 10, 1, 11, 1, 12, 1, 
+	13, 1, 14, 1, 15, 1, 16, 1, 
+	17, 1, 18, 1, 19, 2, 0, 5, 
+	2, 0, 8, 2, 0, 9, 2, 0, 
+	10, 2, 0, 11, 2, 0, 12, 2, 
+	6, 9, 2, 7, 10, 2, 8, 0, 
+	2, 9, 0, 2, 9, 11, 2, 10, 
+	0, 2, 10, 11, 2, 11, 0, 2, 
+	11, 9, 2, 11, 10, 3, 0, 9, 
+	10, 3, 0, 10, 11, 3, 0, 11, 
+	9, 3, 0, 11, 10, 3, 3, 0, 
+	4, 3, 7, 0, 10, 3, 7, 9, 
+	10, 3, 7, 10, 9, 3, 9, 0, 
+	11, 3, 9, 10, 11, 3, 9, 11, 
+	10, 3, 10, 0, 11, 3, 10, 11, 
+	0, 3, 10, 11, 9, 4, 0, 10, 
+	11, 9, 4, 7, 0, 9, 10, 4, 
+	9, 0, 10, 11
+};
+
+static const int date_machine_start = 1;
+static const int date_machine_first_final = 240;
+static const int date_machine_error = 0;
+
+static const int date_machine_en_main = 1;
+
+
+#line 25 "iso8601.rl"
+
+
+struct internal_datetime
+  {
+    char            sign_of_year;
+    int64_t         year;
+    int             month;
+    int             day;
+    char            flag_365type_day;
+    int             hour;
+    int             minute;
+    int             second;
+    int64_t         ms;
+    char	    timeZoneOffSet;
+  };
+
+static 
+void 
+date_machine( char *str, ISO8601_STATUS* stat, struct internal_datetime* dtObj, struct iso8601_duration* duObj)
+  {
+    char *p = str, *pe = str + strlen( str );
+    char *ts, *te = 0;
+    int cs;
+
+    
+#line 83 "iso8601.c"
+	{
+	cs = date_machine_start;
+	}
+
+#line 88 "iso8601.c"
+	{
+	const char *_acts;
+	unsigned int _nacts;
+
+	if ( p == pe )
+		goto _test_eof;
+	if ( cs == 0 )
+		goto _out;
+_resume:
+	switch ( cs ) {
+case 1:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 36: goto tr2;
+		case 43: goto tr2;
+		case 45: goto tr3;
+		case 80: goto tr5;
+		case 84: goto tr6;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr4;
+	goto tr1;
+case 0:
+	goto _out;
+case 240:
+	goto tr1;
+case 2:
+	switch( (*p) ) {
+		case 45: goto tr7;
+		case 80: goto tr8;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr4;
+	goto tr1;
+case 3:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 48: goto tr11;
+		case 49: goto tr12;
+		case 50: goto tr13;
+		case 51: goto tr14;
+		case 84: goto tr9;
+	}
+	if ( 9 <= (*p) && (*p) <= 13 )
+		goto tr9;
+	goto tr1;
+case 4:
+	if ( (*p) == 50 )
+		goto tr16;
+	if ( 48 <= (*p) && (*p) <= 49 )
+		goto tr15;
+	goto tr1;
+case 5:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr17;
+	goto tr1;
+case 6:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr19;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 7:
+	if ( 48 <= (*p) && (*p) <= 53 )
+		goto tr21;
+	goto tr1;
+case 8:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr22;
+	goto tr1;
+case 9:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr23;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 10:
+	if ( 48 <= (*p) && (*p) <= 53 )
+		goto tr24;
+	goto tr1;
+case 11:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr25;
+	goto tr1;
+case 12:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 44: goto tr26;
+		case 46: goto tr26;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 13:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr27;
+	goto tr1;
+case 14:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr28;
+	goto tr1;
+case 15:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr29;
+	goto tr1;
+case 16:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 17:
+	if ( (*p) == 10 )
+		goto tr18;
+	goto tr1;
+case 18:
+	if ( (*p) == 52 )
+		goto tr30;
+	if ( 48 <= (*p) && (*p) <= 51 )
+		goto tr17;
+	goto tr1;
+case 19:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr31;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 20:
+	if ( (*p) == 48 )
+		goto tr32;
+	goto tr1;
+case 21:
+	if ( (*p) == 48 )
+		goto tr33;
+	goto tr1;
+case 22:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr34;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 23:
+	if ( (*p) == 48 )
+		goto tr35;
+	goto tr1;
+case 24:
+	if ( (*p) == 48 )
+		goto tr36;
+	goto tr1;
+case 25:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 44: goto tr37;
+		case 46: goto tr37;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 26:
+	if ( (*p) == 48 )
+		goto tr38;
+	goto tr1;
+case 27:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 48: goto tr39;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 28:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 48: goto tr29;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 241:
+	if ( (*p) == 50 )
+		goto tr16;
+	if ( 48 <= (*p) && (*p) <= 49 )
+		goto tr15;
+	goto tr1;
+case 29:
+	if ( (*p) == 48 )
+		goto tr40;
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr41;
+	goto tr1;
+case 30:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr19;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr42;
+	goto tr1;
+case 31:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 50: goto tr16;
+		case 84: goto tr9;
+	}
+	if ( (*p) > 13 ) {
+		if ( 48 <= (*p) && (*p) <= 49 )
+			goto tr15;
+	} else if ( (*p) >= 9 )
+		goto tr9;
+	goto tr1;
+case 32:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 45: goto tr43;
+		case 50: goto tr45;
+		case 58: goto tr19;
+		case 84: goto tr9;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr9;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr42;
+	} else
+		goto tr44;
+	goto tr1;
+case 33:
+	switch( (*p) ) {
+		case 48: goto tr46;
+		case 51: goto tr48;
+	}
+	if ( 49 <= (*p) && (*p) <= 50 )
+		goto tr47;
+	goto tr1;
+case 34:
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr49;
+	goto tr1;
+case 35:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr49;
+	goto tr1;
+case 36:
+	if ( 48 <= (*p) && (*p) <= 49 )
+		goto tr49;
+	goto tr1;
+case 37:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 50: goto tr51;
+		case 84: goto tr9;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr9;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr17;
+	} else
+		goto tr50;
+	goto tr1;
+case 38:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr19;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr17;
+	goto tr1;
+case 39:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 52: goto tr30;
+		case 58: goto tr19;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 51 )
+		goto tr17;
+	goto tr1;
+case 40:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 50: goto tr51;
+		case 51: goto tr17;
+		case 52: goto tr30;
+		case 84: goto tr9;
+	}
+	if ( (*p) > 13 ) {
+		if ( 48 <= (*p) && (*p) <= 49 )
+			goto tr50;
+	} else if ( (*p) >= 9 )
+		goto tr9;
+	goto tr1;
+case 41:
+	if ( (*p) > 50 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr52;
+	} else if ( (*p) >= 48 )
+		goto tr41;
+	goto tr1;
+case 42:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr19;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr42;
+	goto tr1;
+case 43:
+	if ( (*p) == 52 )
+		goto tr53;
+	if ( (*p) > 51 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr54;
+	} else if ( (*p) >= 48 )
+		goto tr52;
+	goto tr1;
+case 44:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr31;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr42;
+	goto tr1;
+case 45:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr42;
+	goto tr1;
+case 46:
+	if ( (*p) == 54 )
+		goto tr55;
+	if ( 48 <= (*p) && (*p) <= 53 )
+		goto tr54;
+	goto tr1;
+case 47:
+	if ( 48 <= (*p) && (*p) <= 54 )
+		goto tr42;
+	goto tr1;
+case 48:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr57;
+	goto tr1;
+case 49:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr58;
+	goto tr1;
+case 50:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr59;
+	goto tr1;
+case 51:
+	switch( (*p) ) {
+		case 45: goto tr60;
+		case 48: goto tr61;
+		case 49: goto tr62;
+		case 50: goto tr63;
+		case 51: goto tr64;
+	}
+	if ( 52 <= (*p) && (*p) <= 57 )
+		goto tr65;
+	goto tr1;
+case 52:
+	switch( (*p) ) {
+		case 48: goto tr66;
+		case 49: goto tr67;
+		case 50: goto tr68;
+		case 51: goto tr14;
+	}
+	goto tr1;
+case 53:
+	if ( (*p) == 48 )
+		goto tr69;
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr70;
+	goto tr1;
+case 54:
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr42;
+	goto tr1;
+case 55:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr43;
+		case 50: goto tr45;
+	}
+	if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr42;
+	} else if ( (*p) >= 48 )
+		goto tr44;
+	goto tr1;
+case 56:
+	if ( (*p) > 50 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr54;
+	} else if ( (*p) >= 48 )
+		goto tr70;
+	goto tr1;
+case 57:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr54;
+	goto tr1;
+case 58:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 48: goto tr71;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr72;
+	goto tr1;
+case 59:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr73;
+		case 58: goto tr19;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr75;
+	} else if ( (*p) >= 49 )
+		goto tr74;
+	goto tr1;
+case 60:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr76;
+	goto tr1;
+case 61:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 48 )
+		goto tr77;
+	goto tr1;
+case 62:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr78;
+	goto tr1;
+case 63:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 44 )
+		goto tr26;
+	goto tr1;
+case 64:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr65;
+	goto tr1;
+case 65:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr82;
+		case 84: goto tr79;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else
+		goto tr81;
+	goto tr1;
+case 66:
+	if ( (*p) == 50 )
+		goto tr84;
+	if ( 48 <= (*p) && (*p) <= 49 )
+		goto tr83;
+	goto tr1;
+case 67:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr85;
+	goto tr1;
+case 68:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 53 )
+		goto tr86;
+	goto tr1;
+case 69:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr87;
+	goto tr1;
+case 70:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 53 )
+		goto tr24;
+	goto tr1;
+case 71:
+	if ( (*p) == 52 )
+		goto tr88;
+	if ( 48 <= (*p) && (*p) <= 51 )
+		goto tr85;
+	goto tr1;
+case 72:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 48: goto tr89;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 73:
+	if ( (*p) == 48 )
+		goto tr90;
+	goto tr1;
+case 74:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 48: goto tr35;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	goto tr1;
+case 242:
+	if ( (*p) == 50 )
+		goto tr84;
+	if ( 48 <= (*p) && (*p) <= 49 )
+		goto tr83;
+	goto tr1;
+case 75:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr92;
+	} else if ( (*p) >= 48 )
+		goto tr91;
+	goto tr1;
+case 76:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr78;
+	} else if ( (*p) >= 48 )
+		goto tr93;
+	goto tr1;
+case 77:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else if ( (*p) >= 44 )
+		goto tr26;
+	goto tr1;
+case 78:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 48 )
+		goto tr73;
+	goto tr1;
+case 79:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 52: goto tr94;
+		case 53: goto tr77;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 51 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 48 )
+		goto tr91;
+	goto tr1;
+case 80:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr95;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr78;
+	goto tr1;
+case 81:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr96;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 49 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 44 )
+		goto tr26;
+	goto tr1;
+case 82:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr97;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr65;
+	goto tr1;
+case 83:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 48: goto tr98;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr65;
+	goto tr1;
+case 84:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 44 )
+		goto tr37;
+	goto tr1;
+case 85:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr100;
+		case 84: goto tr79;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr99;
+	goto tr1;
+case 86:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr92;
+	goto tr1;
+case 87:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 52: goto tr101;
+	}
+	if ( (*p) > 51 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 48 )
+		goto tr92;
+	goto tr1;
+case 88:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr102;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr65;
+	goto tr1;
+case 89:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 48: goto tr96;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr65;
+	goto tr1;
+case 90:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 48: goto tr103;
+		case 49: goto tr104;
+		case 50: goto tr105;
+		case 51: goto tr106;
+		case 58: goto tr19;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr75;
+	} else if ( (*p) >= 52 )
+		goto tr74;
+	goto tr1;
+case 91:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 48: goto tr107;
+		case 49: goto tr108;
+		case 50: goto tr109;
+		case 84: goto tr79;
+	}
+	if ( (*p) > 13 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr110;
+	} else if ( (*p) >= 9 )
+		goto tr79;
+	goto tr1;
+case 92:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr92;
+	} else if ( (*p) >= 48 )
+		goto tr111;
+	goto tr1;
+case 93:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr113;
+	} else if ( (*p) >= 48 )
+		goto tr112;
+	goto tr1;
+case 94:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else
+		goto tr114;
+	goto tr1;
+case 95:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr78;
+	} else if ( (*p) >= 48 )
+		goto tr115;
+	goto tr1;
+case 96:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto tr78;
+	} else if ( (*p) >= 44 )
+		goto tr26;
+	goto tr1;
+case 97:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr77;
+	goto tr1;
+case 98:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr117;
+		case 84: goto tr79;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( (*p) > 53 ) {
+			if ( 54 <= (*p) && (*p) <= 57 )
+				goto tr92;
+		} else if ( (*p) >= 51 )
+			goto tr111;
+	} else
+		goto tr116;
+	goto tr1;
+case 99:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr119;
+	} else if ( (*p) >= 48 )
+		goto tr118;
+	goto tr1;
+case 100:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else
+		goto tr120;
+	goto tr1;
+case 101:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr113;
+	} else if ( (*p) >= 48 )
+		goto tr121;
+	goto tr1;
+case 102:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr78;
+	} else
+		goto tr115;
+	goto tr1;
+case 103:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr122;
+	goto tr1;
+case 104:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr113;
+	goto tr1;
+case 105:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 52: goto tr123;
+		case 53: goto tr112;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 51 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr113;
+	} else if ( (*p) >= 48 )
+		goto tr118;
+	goto tr1;
+case 106:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr124;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 49 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else
+		goto tr114;
+	goto tr1;
+case 107:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr125;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr78;
+	} else if ( (*p) >= 49 )
+		goto tr115;
+	goto tr1;
+case 108:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr126;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 49 <= (*p) && (*p) <= 57 )
+			goto tr78;
+	} else if ( (*p) >= 44 )
+		goto tr26;
+	goto tr1;
+case 109:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr98;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 49 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 44 )
+		goto tr26;
+	goto tr1;
+case 110:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr117;
+		case 51: goto tr111;
+		case 52: goto tr127;
+		case 53: goto tr122;
+		case 84: goto tr79;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr116;
+	goto tr1;
+case 111:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr128;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr113;
+	goto tr1;
+case 112:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr129;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 49 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr77;
+	goto tr1;
+case 113:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr126;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr78;
+	goto tr1;
+case 114:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr131;
+		case 84: goto tr79;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( (*p) > 53 ) {
+			if ( 54 <= (*p) && (*p) <= 57 )
+				goto tr65;
+		} else if ( (*p) >= 51 )
+			goto tr122;
+	} else
+		goto tr130;
+	goto tr1;
+case 115:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr119;
+	goto tr1;
+case 116:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 52: goto tr132;
+	}
+	if ( (*p) > 51 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr113;
+	} else if ( (*p) >= 48 )
+		goto tr119;
+	goto tr1;
+case 117:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr133;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 49 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr77;
+	goto tr1;
+case 118:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 48: goto tr134;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr78;
+	goto tr1;
+case 119:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr97;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 49 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 44 )
+		goto tr26;
+	goto tr1;
+case 120:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr109;
+		case 84: goto tr79;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr110;
+	} else
+		goto tr108;
+	goto tr1;
+case 121:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr109;
+		case 51: goto tr110;
+		case 52: goto tr135;
+		case 84: goto tr79;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr136;
+	} else
+		goto tr108;
+	goto tr1;
+case 122:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 48: goto tr137;
+		case 49: goto tr138;
+		case 50: goto tr139;
+		case 84: goto tr79;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 51 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr77;
+	goto tr1;
+case 123:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 48: goto tr140;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr141;
+	goto tr1;
+case 124:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr142;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 49 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr73;
+	goto tr1;
+case 125:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 48: goto tr143;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr76;
+	goto tr1;
+case 126:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr37;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr77;
+	goto tr1;
+case 127:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else
+		goto tr73;
+	goto tr1;
+case 128:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr141;
+	goto tr1;
+case 129:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 52: goto tr144;
+	}
+	if ( (*p) > 51 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr78;
+	} else if ( (*p) >= 48 )
+		goto tr141;
+	goto tr1;
+case 130:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr102;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 49 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 44 )
+		goto tr26;
+	goto tr1;
+case 131:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr139;
+		case 84: goto tr79;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( (*p) > 53 ) {
+			if ( 54 <= (*p) && (*p) <= 57 )
+				goto tr65;
+		} else if ( (*p) >= 51 )
+			goto tr77;
+	} else
+		goto tr138;
+	goto tr1;
+case 132:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr82;
+		case 84: goto tr79;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else
+		goto tr145;
+	goto tr1;
+case 133:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 50: goto tr147;
+		case 84: goto tr79;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr79;
+	} else if ( (*p) > 49 ) {
+		if ( (*p) > 53 ) {
+			if ( 54 <= (*p) && (*p) <= 57 )
+				goto tr92;
+		} else if ( (*p) >= 51 )
+			goto tr91;
+	} else
+		goto tr146;
+	goto tr1;
+case 134:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr141;
+	} else if ( (*p) >= 48 )
+		goto tr148;
+	goto tr1;
+case 135:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 44 <= (*p) && (*p) <= 46 )
+			goto tr26;
+	} else if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else
+		goto tr149;
+	goto tr1;
+case 136:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else if ( (*p) >= 48 )
+		goto tr114;
+	goto tr1;
+case 137:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 52: goto tr150;
+		case 53: goto tr93;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 51 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr78;
+	} else if ( (*p) >= 48 )
+		goto tr148;
+	goto tr1;
+case 138:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr151;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 49 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else if ( (*p) >= 44 )
+		goto tr26;
+	goto tr1;
+case 139:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr129;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 49 )
+		goto tr77;
+	goto tr1;
+case 140:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( (*p) > 50 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr152;
+	} else if ( (*p) >= 48 )
+		goto tr72;
+	goto tr1;
+case 141:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 58: goto tr19;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr75;
+	} else if ( (*p) >= 48 )
+		goto tr74;
+	goto tr1;
+case 142:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 52: goto tr153;
+	}
+	if ( (*p) > 51 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr154;
+	} else if ( (*p) >= 48 )
+		goto tr152;
+	goto tr1;
+case 143:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr155;
+		case 58: goto tr31;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr75;
+	goto tr1;
+case 144:
+	switch( (*p) ) {
+		case 10: goto tr80;
+		case 32: goto tr79;
+		case 45: goto tr56;
+		case 48: goto tr156;
+		case 49: goto tr99;
+		case 50: goto tr100;
+		case 84: goto tr79;
+	}
+	if ( (*p) > 13 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 9 )
+		goto tr79;
+	goto tr1;
+case 145:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr157;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr92;
+	goto tr1;
+case 146:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 48: goto tr158;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 53 ) {
+		if ( 54 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 49 )
+		goto tr73;
+	goto tr1;
+case 147:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 45: goto tr56;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 46 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto tr76;
+	} else if ( (*p) >= 44 )
+		goto tr37;
+	goto tr1;
+case 148:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr75;
+	goto tr1;
+case 149:
+	switch( (*p) ) {
+		case 45: goto tr56;
+		case 54: goto tr159;
+	}
+	if ( (*p) > 53 ) {
+		if ( 55 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 48 )
+		goto tr154;
+	goto tr1;
+case 150:
+	if ( (*p) == 45 )
+		goto tr56;
+	if ( (*p) > 54 ) {
+		if ( 55 <= (*p) && (*p) <= 57 )
+			goto tr65;
+	} else if ( (*p) >= 48 )
+		goto tr75;
+	goto tr1;
+case 151:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 48: goto tr160;
+		case 49: goto tr161;
+		case 50: goto tr162;
+		case 51: goto tr163;
+		case 84: goto tr165;
+	}
+	if ( 52 <= (*p) && (*p) <= 57 )
+		goto tr164;
+	goto tr1;
+case 152:
+	if ( (*p) == 89 )
+		goto tr167;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr166;
+	goto tr1;
+case 153:
+	switch( (*p) ) {
+		case 68: goto tr169;
+		case 77: goto tr170;
+		case 89: goto tr167;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr168;
+	goto tr1;
+case 154:
+	if ( (*p) == 89 )
+		goto tr167;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr168;
+	goto tr1;
+case 155:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 48: goto tr171;
+		case 49: goto tr172;
+		case 50: goto tr173;
+		case 51: goto tr174;
+		case 84: goto tr165;
+	}
+	goto tr1;
+case 156:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr175;
+	goto tr1;
+case 157:
+	switch( (*p) ) {
+		case 68: goto tr169;
+		case 77: goto tr170;
+	}
+	goto tr1;
+case 158:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 84: goto tr165;
+	}
+	goto tr1;
+case 159:
+	if ( (*p) == 50 )
+		goto tr177;
+	if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 53 )
+			goto tr178;
+	} else if ( (*p) >= 48 )
+		goto tr176;
+	goto tr1;
+case 160:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr179;
+	goto tr1;
+case 161:
+	switch( (*p) ) {
+		case 46: goto tr180;
+		case 72: goto tr181;
+		case 77: goto tr182;
+		case 83: goto tr183;
+	}
+	goto tr1;
+case 162:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr184;
+	goto tr1;
+case 163:
+	if ( (*p) == 83 )
+		goto tr183;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr185;
+	goto tr1;
+case 164:
+	if ( (*p) == 83 )
+		goto tr183;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr186;
+	goto tr1;
+case 165:
+	if ( (*p) == 83 )
+		goto tr183;
+	goto tr1;
+case 166:
+	if ( (*p) == 10 )
+		goto tr0;
+	goto tr1;
+case 167:
+	if ( (*p) == 10 )
+		goto tr0;
+	if ( 48 <= (*p) && (*p) <= 53 )
+		goto tr178;
+	goto tr1;
+case 168:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr187;
+	goto tr1;
+case 169:
+	switch( (*p) ) {
+		case 46: goto tr180;
+		case 77: goto tr182;
+		case 83: goto tr183;
+	}
+	goto tr1;
+case 170:
+	if ( (*p) == 10 )
+		goto tr0;
+	if ( 48 <= (*p) && (*p) <= 53 )
+		goto tr188;
+	goto tr1;
+case 171:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr189;
+	goto tr1;
+case 172:
+	switch( (*p) ) {
+		case 46: goto tr180;
+		case 83: goto tr183;
+	}
+	goto tr1;
+case 173:
+	if ( (*p) > 51 ) {
+		if ( 52 <= (*p) && (*p) <= 57 )
+			goto tr187;
+	} else if ( (*p) >= 48 )
+		goto tr179;
+	goto tr1;
+case 174:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 51: goto tr174;
+		case 84: goto tr165;
+	}
+	if ( 48 <= (*p) && (*p) <= 50 )
+		goto tr173;
+	goto tr1;
+case 175:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr190;
+	goto tr1;
+case 176:
+	if ( (*p) == 68 )
+		goto tr169;
+	goto tr1;
+case 177:
+	if ( (*p) == 48 )
+		goto tr190;
+	goto tr1;
+case 178:
+	if ( (*p) > 49 ) {
+		if ( 50 <= (*p) && (*p) <= 57 )
+			goto tr190;
+	} else if ( (*p) >= 48 )
+		goto tr175;
+	goto tr1;
+case 179:
+	if ( (*p) == 89 )
+		goto tr167;
+	if ( (*p) > 49 ) {
+		if ( 50 <= (*p) && (*p) <= 57 )
+			goto tr191;
+	} else if ( (*p) >= 48 )
+		goto tr166;
+	goto tr1;
+case 180:
+	switch( (*p) ) {
+		case 68: goto tr169;
+		case 89: goto tr167;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr168;
+	goto tr1;
+case 181:
+	if ( (*p) == 89 )
+		goto tr167;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr191;
+	goto tr1;
+case 182:
+	switch( (*p) ) {
+		case 48: goto tr191;
+		case 89: goto tr167;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr168;
+	goto tr1;
+case 183:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 48: goto tr192;
+		case 49: goto tr193;
+		case 50: goto tr194;
+		case 51: goto tr195;
+		case 84: goto tr9;
+	}
+	if ( (*p) > 13 ) {
+		if ( 52 <= (*p) && (*p) <= 57 )
+			goto tr196;
+	} else if ( (*p) >= 9 )
+		goto tr9;
+	goto tr1;
+case 184:
+	switch( (*p) ) {
+		case 48: goto tr197;
+		case 89: goto tr199;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr198;
+	goto tr1;
+case 185:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 48: goto tr200;
+		case 58: goto tr19;
+		case 68: goto tr202;
+		case 77: goto tr203;
+		case 89: goto tr199;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr201;
+	goto tr1;
+case 186:
+	if ( (*p) == 89 )
+		goto tr199;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr200;
+	goto tr1;
+case 187:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 45: goto tr204;
+		case 84: goto tr6;
+	}
+	goto tr1;
+case 188:
+	switch( (*p) ) {
+		case 48: goto tr205;
+		case 49: goto tr206;
+		case 50: goto tr207;
+		case 51: goto tr208;
+	}
+	goto tr1;
+case 189:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr209;
+	goto tr1;
+case 190:
+	switch( (*p) ) {
+		case 68: goto tr202;
+		case 77: goto tr203;
+	}
+	goto tr1;
+case 191:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 84: goto tr6;
+	}
+	goto tr1;
+case 192:
+	if ( (*p) == 45 )
+		goto tr210;
+	goto tr1;
+case 193:
+	if ( (*p) == 50 )
+		goto tr212;
+	if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 53 )
+			goto tr213;
+	} else if ( (*p) >= 48 )
+		goto tr211;
+	goto tr1;
+case 194:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr214;
+	goto tr1;
+case 195:
+	switch( (*p) ) {
+		case 46: goto tr215;
+		case 72: goto tr216;
+		case 77: goto tr217;
+		case 83: goto tr183;
+	}
+	goto tr1;
+case 196:
+	if ( (*p) == 45 )
+		goto tr180;
+	goto tr1;
+case 197:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 45: goto tr218;
+	}
+	goto tr1;
+case 198:
+	if ( 48 <= (*p) && (*p) <= 53 )
+		goto tr213;
+	goto tr1;
+case 199:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr219;
+	goto tr1;
+case 200:
+	switch( (*p) ) {
+		case 46: goto tr215;
+		case 77: goto tr217;
+		case 83: goto tr183;
+	}
+	goto tr1;
+case 201:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 45: goto tr220;
+	}
+	goto tr1;
+case 202:
+	if ( 48 <= (*p) && (*p) <= 53 )
+		goto tr221;
+	goto tr1;
+case 203:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr222;
+	goto tr1;
+case 204:
+	switch( (*p) ) {
+		case 46: goto tr215;
+		case 83: goto tr183;
+	}
+	goto tr1;
+case 205:
+	if ( (*p) > 51 ) {
+		if ( 52 <= (*p) && (*p) <= 57 )
+			goto tr219;
+	} else if ( (*p) >= 48 )
+		goto tr214;
+	goto tr1;
+case 206:
+	switch( (*p) ) {
+		case 10: goto tr0;
+		case 45: goto tr223;
+		case 84: goto tr6;
+	}
+	goto tr1;
+case 207:
+	if ( (*p) == 51 )
+		goto tr208;
+	if ( 48 <= (*p) && (*p) <= 50 )
+		goto tr207;
+	goto tr1;
+case 208:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr224;
+	goto tr1;
+case 209:
+	if ( (*p) == 68 )
+		goto tr202;
+	goto tr1;
+case 210:
+	if ( (*p) == 48 )
+		goto tr224;
+	goto tr1;
+case 211:
+	if ( (*p) > 49 ) {
+		if ( 50 <= (*p) && (*p) <= 57 )
+			goto tr224;
+	} else if ( (*p) >= 48 )
+		goto tr209;
+	goto tr1;
+case 212:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 50: goto tr226;
+		case 84: goto tr9;
+		case 89: goto tr199;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr9;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr200;
+	} else
+		goto tr225;
+	goto tr1;
+case 213:
+	if ( (*p) == 89 )
+		goto tr199;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr227;
+	goto tr1;
+case 214:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr19;
+		case 89: goto tr199;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr200;
+	goto tr1;
+case 215:
+	switch( (*p) ) {
+		case 52: goto tr228;
+		case 89: goto tr199;
+	}
+	if ( (*p) > 51 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr200;
+	} else if ( (*p) >= 48 )
+		goto tr227;
+	goto tr1;
+case 216:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr31;
+		case 89: goto tr199;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr200;
+	goto tr1;
+case 217:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 45: goto tr43;
+		case 50: goto tr230;
+		case 58: goto tr19;
+		case 68: goto tr202;
+		case 77: goto tr203;
+		case 84: goto tr9;
+		case 89: goto tr199;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr9;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr201;
+	} else
+		goto tr229;
+	goto tr1;
+case 218:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 50: goto tr232;
+		case 84: goto tr9;
+		case 89: goto tr199;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr9;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr227;
+	} else
+		goto tr231;
+	goto tr1;
+case 219:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr19;
+		case 89: goto tr199;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr227;
+	goto tr1;
+case 220:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 52: goto tr228;
+		case 58: goto tr19;
+		case 89: goto tr199;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) > 51 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr200;
+	} else if ( (*p) >= 48 )
+		goto tr227;
+	goto tr1;
+case 221:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 50: goto tr232;
+		case 51: goto tr227;
+		case 52: goto tr228;
+		case 84: goto tr9;
+		case 89: goto tr199;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr9;
+	} else if ( (*p) > 49 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr200;
+	} else
+		goto tr231;
+	goto tr1;
+case 222:
+	switch( (*p) ) {
+		case 50: goto tr233;
+		case 89: goto tr199;
+	}
+	if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr234;
+	} else if ( (*p) >= 48 )
+		goto tr198;
+	goto tr1;
+case 223:
+	switch( (*p) ) {
+		case 10: goto tr10;
+		case 32: goto tr9;
+		case 45: goto tr43;
+		case 50: goto tr230;
+		case 58: goto tr19;
+		case 68: goto tr202;
+		case 84: goto tr9;
+		case 89: goto tr199;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( (*p) < 48 ) {
+		if ( 9 <= (*p) && (*p) <= 13 )
+			goto tr9;
+	} else if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 57 )
+			goto tr201;
+	} else
+		goto tr229;
+	goto tr1;
+case 224:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr19;
+		case 68: goto tr202;
+		case 89: goto tr199;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr201;
+	goto tr1;
+case 225:
+	switch( (*p) ) {
+		case 52: goto tr235;
+		case 89: goto tr199;
+	}
+	if ( (*p) > 51 ) {
+		if ( 53 <= (*p) && (*p) <= 57 )
+			goto tr236;
+	} else if ( (*p) >= 48 )
+		goto tr234;
+	goto tr1;
+case 226:
+	switch( (*p) ) {
+		case 10: goto tr18;
+		case 58: goto tr31;
+		case 68: goto tr202;
+		case 89: goto tr199;
+		case 90: goto tr20;
+		case 122: goto tr20;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr201;
+	goto tr1;
+case 227:
+	switch( (*p) ) {
+		case 68: goto tr202;
+		case 89: goto tr199;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr201;
+	goto tr1;
+case 228:
+	switch( (*p) ) {
+		case 48: goto tr236;
+		case 54: goto tr238;
+		case 89: goto tr199;
+	}
+	if ( (*p) > 53 ) {
+		if ( 55 <= (*p) && (*p) <= 57 )
+			goto tr200;
+	} else if ( (*p) >= 49 )
+		goto tr237;
+	goto tr1;
+case 229:
+	if ( (*p) == 89 )
+		goto tr199;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr201;
+	goto tr1;
+case 230:
+	if ( (*p) == 89 )
+		goto tr199;
+	if ( (*p) > 54 ) {
+		if ( 55 <= (*p) && (*p) <= 57 )
+			goto tr200;
+	} else if ( (*p) >= 48 )
+		goto tr201;
+	goto tr1;
+case 231:
+	switch( (*p) ) {
+		case 45: goto tr239;
+		case 48: goto tr160;
+		case 49: goto tr161;
+		case 50: goto tr162;
+		case 51: goto tr163;
+		case 84: goto tr240;
+	}
+	if ( 52 <= (*p) && (*p) <= 57 )
+		goto tr164;
+	goto tr1;
+case 232:
+	switch( (*p) ) {
+		case 48: goto tr241;
+		case 49: goto tr242;
+		case 50: goto tr243;
+		case 51: goto tr244;
+	}
+	if ( 52 <= (*p) && (*p) <= 57 )
+		goto tr196;
+	goto tr1;
+case 233:
+	if ( (*p) == 89 )
+		goto tr199;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr245;
+	goto tr1;
+case 234:
+	switch( (*p) ) {
+		case 68: goto tr202;
+		case 77: goto tr203;
+		case 89: goto tr199;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr200;
+	goto tr1;
+case 235:
+	if ( (*p) == 89 )
+		goto tr199;
+	if ( (*p) > 49 ) {
+		if ( 50 <= (*p) && (*p) <= 57 )
+			goto tr246;
+	} else if ( (*p) >= 48 )
+		goto tr245;
+	goto tr1;
+case 236:
+	switch( (*p) ) {
+		case 68: goto tr202;
+		case 89: goto tr199;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr200;
+	goto tr1;
+case 237:
+	if ( (*p) == 89 )
+		goto tr199;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto tr246;
+	goto tr1;
+case 238:
+	switch( (*p) ) {
+		case 48: goto tr246;
+		case 89: goto tr199;
+	}
+	if ( 49 <= (*p) && (*p) <= 57 )
+		goto tr200;
+	goto tr1;
+case 239:
+	switch( (*p) ) {
+		case 45: goto tr210;
+		case 50: goto tr177;
+	}
+	if ( (*p) > 49 ) {
+		if ( 51 <= (*p) && (*p) <= 53 )
+			goto tr178;
+	} else if ( (*p) >= 48 )
+		goto tr176;
+	goto tr1;
+	}
+
+	tr1: cs = 0; goto _again;
+	tr2: cs = 2; goto f1;
+	tr7: cs = 3; goto f2;
+	tr56: cs = 3; goto f16;
+	tr9: cs = 4; goto _again;
+	tr15: cs = 5; goto f3;
+	tr17: cs = 6; goto f5;
+	tr19: cs = 7; goto _again;
+	tr21: cs = 8; goto f3;
+	tr22: cs = 9; goto f7;
+	tr23: cs = 10; goto _again;
+	tr24: cs = 11; goto f3;
+	tr25: cs = 12; goto f8;
+	tr26: cs = 13; goto _again;
+	tr27: cs = 14; goto f9;
+	tr28: cs = 15; goto f10;
+	tr29: cs = 16; goto f10;
+	tr20: cs = 17; goto f6;
+	tr16: cs = 18; goto f3;
+	tr30: cs = 19; goto f5;
+	tr31: cs = 20; goto _again;
+	tr32: cs = 21; goto f3;
+	tr33: cs = 22; goto f7;
+	tr34: cs = 23; goto _again;
+	tr35: cs = 24; goto f3;
+	tr36: cs = 25; goto f8;
+	tr37: cs = 26; goto _again;
+	tr38: cs = 27; goto f9;
+	tr39: cs = 28; goto f10;
+	tr11: cs = 29; goto f3;
+	tr40: cs = 30; goto f5;
+	tr42: cs = 31; goto f12;
+	tr49: cs = 31; goto f14;
+	tr41: cs = 32; goto f11;
+	tr43: cs = 33; goto _again;
+	tr46: cs = 34; goto f3;
+	tr47: cs = 35; goto f3;
+	tr48: cs = 36; goto f3;
+	tr44: cs = 37; goto f13;
+	tr50: cs = 38; goto f15;
+	tr51: cs = 39; goto f15;
+	tr45: cs = 40; goto f13;
+	tr12: cs = 41; goto f3;
+	tr52: cs = 42; goto f5;
+	tr13: cs = 43; goto f3;
+	tr53: cs = 44; goto f5;
+	tr54: cs = 45; goto _again;
+	tr14: cs = 46; goto f3;
+	tr55: cs = 47; goto _again;
+	tr4: cs = 48; goto f3;
+	tr57: cs = 49; goto _again;
+	tr58: cs = 50; goto _again;
+	tr59: cs = 51; goto f16;
+	tr60: cs = 52; goto _again;
+	tr66: cs = 53; goto f3;
+	tr69: cs = 54; goto _again;
+	tr70: cs = 55; goto f17;
+	tr67: cs = 56; goto f3;
+	tr68: cs = 57; goto f3;
+	tr61: cs = 58; goto f3;
+	tr71: cs = 59; goto f5;
+	tr73: cs = 60; goto f3;
+	tr76: cs = 61; goto f7;
+	tr77: cs = 62; goto f3;
+	tr78: cs = 63; goto f8;
+	tr65: cs = 64; goto _again;
+	tr74: cs = 65; goto f13;
+	tr79: cs = 66; goto _again;
+	tr83: cs = 67; goto f3;
+	tr85: cs = 68; goto f5;
+	tr86: cs = 69; goto f3;
+	tr87: cs = 70; goto f7;
+	tr84: cs = 71; goto f3;
+	tr88: cs = 72; goto f5;
+	tr89: cs = 73; goto f3;
+	tr90: cs = 74; goto f7;
+	tr81: cs = 75; goto f18;
+	tr91: cs = 76; goto f19;
+	tr93: cs = 77; goto f20;
+	tr92: cs = 78; goto f5;
+	tr82: cs = 79; goto f18;
+	tr94: cs = 80; goto f15;
+	tr95: cs = 81; goto f21;
+	tr96: cs = 82; goto f7;
+	tr97: cs = 83; goto f3;
+	tr98: cs = 84; goto f8;
+	tr75: cs = 85; goto f12;
+	tr99: cs = 86; goto f3;
+	tr100: cs = 87; goto f3;
+	tr101: cs = 88; goto f5;
+	tr102: cs = 89; goto f3;
+	tr72: cs = 90; goto f11;
+	tr103: cs = 91; goto f22;
+	tr107: cs = 92; goto f23;
+	tr111: cs = 93; goto f19;
+	tr112: cs = 94; goto f26;
+	tr114: cs = 95; goto f28;
+	tr115: cs = 96; goto f20;
+	tr113: cs = 97; goto f27;
+	tr108: cs = 98; goto f24;
+	tr116: cs = 99; goto f15;
+	tr118: cs = 100; goto f29;
+	tr120: cs = 101; goto f18;
+	tr121: cs = 102; goto f31;
+	tr119: cs = 103; goto f30;
+	tr122: cs = 104; goto f3;
+	tr117: cs = 105; goto f15;
+	tr123: cs = 106; goto f32;
+	tr124: cs = 107; goto f28;
+	tr125: cs = 108; goto f33;
+	tr126: cs = 109; goto f21;
+	tr109: cs = 110; goto f24;
+	tr127: cs = 111; goto f15;
+	tr128: cs = 112; goto f34;
+	tr129: cs = 113; goto f18;
+	tr110: cs = 114; goto f25;
+	tr130: cs = 115; goto f3;
+	tr131: cs = 116; goto f3;
+	tr132: cs = 117; goto f35;
+	tr133: cs = 118; goto f3;
+	tr134: cs = 119; goto f36;
+	tr104: cs = 120; goto f22;
+	tr105: cs = 121; goto f22;
+	tr135: cs = 122; goto f37;
+	tr137: cs = 123; goto f3;
+	tr140: cs = 124; goto f39;
+	tr142: cs = 125; goto f3;
+	tr143: cs = 126; goto f27;
+	tr141: cs = 127; goto f40;
+	tr138: cs = 128; goto f3;
+	tr139: cs = 129; goto f3;
+	tr144: cs = 130; goto f41;
+	tr136: cs = 131; goto f38;
+	tr106: cs = 132; goto f22;
+	tr145: cs = 133; goto f42;
+	tr146: cs = 134; goto f15;
+	tr148: cs = 135; goto f43;
+	tr149: cs = 136; goto f18;
+	tr147: cs = 137; goto f15;
+	tr150: cs = 138; goto f44;
+	tr151: cs = 139; goto f28;
+	tr62: cs = 140; goto f3;
+	tr152: cs = 141; goto f5;
+	tr63: cs = 142; goto f3;
+	tr153: cs = 143; goto f5;
+	tr155: cs = 144; goto f13;
+	tr156: cs = 145; goto f18;
+	tr157: cs = 146; goto f19;
+	tr158: cs = 147; goto f20;
+	tr154: cs = 148; goto _again;
+	tr64: cs = 149; goto f3;
+	tr159: cs = 150; goto _again;
+	tr8: cs = 151; goto _again;
+	tr160: cs = 152; goto f3;
+	tr166: cs = 153; goto _again;
+	tr168: cs = 154; goto _again;
+	tr164: cs = 154; goto f3;
+	tr167: cs = 155; goto f45;
+	tr171: cs = 156; goto f3;
+	tr175: cs = 157; goto _again;
+	tr169: cs = 158; goto f46;
+	tr165: cs = 159; goto _again;
+	tr176: cs = 160; goto f3;
+	tr179: cs = 161; goto _again;
+	tr180: cs = 162; goto _again;
+	tr184: cs = 163; goto _again;
+	tr185: cs = 164; goto _again;
+	tr186: cs = 165; goto _again;
+	tr183: cs = 166; goto f50;
+	tr181: cs = 167; goto f48;
+	tr178: cs = 168; goto f3;
+	tr187: cs = 169; goto _again;
+	tr182: cs = 170; goto f49;
+	tr188: cs = 171; goto f3;
+	tr189: cs = 172; goto _again;
+	tr177: cs = 173; goto f3;
+	tr170: cs = 174; goto f47;
+	tr173: cs = 175; goto f3;
+	tr190: cs = 176; goto _again;
+	tr174: cs = 177; goto f3;
+	tr172: cs = 178; goto f3;
+	tr161: cs = 179; goto f3;
+	tr191: cs = 180; goto _again;
+	tr162: cs = 181; goto f3;
+	tr163: cs = 182; goto f3;
+	tr3: cs = 183; goto f2;
+	tr192: cs = 184; goto f3;
+	tr197: cs = 185; goto f5;
+	tr200: cs = 186; goto _again;
+	tr196: cs = 186; goto f3;
+	tr199: cs = 187; goto f45;
+	tr204: cs = 188; goto _again;
+	tr205: cs = 189; goto f3;
+	tr209: cs = 190; goto _again;
+	tr202: cs = 191; goto f46;
+	tr6: cs = 192; goto _again;
+	tr210: cs = 193; goto _again;
+	tr211: cs = 194; goto f3;
+	tr214: cs = 195; goto _again;
+	tr215: cs = 196; goto _again;
+	tr216: cs = 197; goto f48;
+	tr218: cs = 198; goto _again;
+	tr213: cs = 199; goto f3;
+	tr219: cs = 200; goto _again;
+	tr217: cs = 201; goto f49;
+	tr220: cs = 202; goto _again;
+	tr221: cs = 203; goto f3;
+	tr222: cs = 204; goto _again;
+	tr212: cs = 205; goto f3;
+	tr203: cs = 206; goto f47;
+	tr223: cs = 207; goto _again;
+	tr207: cs = 208; goto f3;
+	tr224: cs = 209; goto _again;
+	tr208: cs = 210; goto f3;
+	tr206: cs = 211; goto f3;
+	tr201: cs = 212; goto f12;
+	tr225: cs = 213; goto f3;
+	tr227: cs = 214; goto f5;
+	tr226: cs = 215; goto f3;
+	tr228: cs = 216; goto f5;
+	tr198: cs = 217; goto f11;
+	tr229: cs = 218; goto f13;
+	tr231: cs = 219; goto f15;
+	tr232: cs = 220; goto f15;
+	tr230: cs = 221; goto f13;
+	tr193: cs = 222; goto f3;
+	tr233: cs = 223; goto f11;
+	tr234: cs = 224; goto f5;
+	tr194: cs = 225; goto f3;
+	tr235: cs = 226; goto f5;
+	tr236: cs = 227; goto _again;
+	tr195: cs = 228; goto f3;
+	tr237: cs = 229; goto _again;
+	tr238: cs = 230; goto _again;
+	tr5: cs = 231; goto _again;
+	tr239: cs = 232; goto _again;
+	tr241: cs = 233; goto f3;
+	tr245: cs = 234; goto _again;
+	tr242: cs = 235; goto f3;
+	tr246: cs = 236; goto _again;
+	tr243: cs = 237; goto f3;
+	tr244: cs = 238; goto f3;
+	tr240: cs = 239; goto _again;
+	tr0: cs = 240; goto f0;
+	tr18: cs = 240; goto f4;
+	tr10: cs = 241; goto f4;
+	tr80: cs = 242; goto f4;
+
+	f3: _acts = _date_machine_actions + 1; goto execFuncs;
+	f4: _acts = _date_machine_actions + 3; goto execFuncs;
+	f0: _acts = _date_machine_actions + 5; goto execFuncs;
+	f16: _acts = _date_machine_actions + 7; goto execFuncs;
+	f17: _acts = _date_machine_actions + 9; goto execFuncs;
+	f14: _acts = _date_machine_actions + 11; goto execFuncs;
+	f12: _acts = _date_machine_actions + 13; goto execFuncs;
+	f5: _acts = _date_machine_actions + 15; goto execFuncs;
+	f7: _acts = _date_machine_actions + 17; goto execFuncs;
+	f8: _acts = _date_machine_actions + 19; goto execFuncs;
+	f10: _acts = _date_machine_actions + 21; goto execFuncs;
+	f6: _acts = _date_machine_actions + 23; goto execFuncs;
+	f45: _acts = _date_machine_actions + 25; goto execFuncs;
+	f47: _acts = _date_machine_actions + 27; goto execFuncs;
+	f46: _acts = _date_machine_actions + 29; goto execFuncs;
+	f48: _acts = _date_machine_actions + 31; goto execFuncs;
+	f49: _acts = _date_machine_actions + 33; goto execFuncs;
+	f50: _acts = _date_machine_actions + 35; goto execFuncs;
+	f2: _acts = _date_machine_actions + 37; goto execFuncs;
+	f22: _acts = _date_machine_actions + 40; goto execFuncs;
+	f15: _acts = _date_machine_actions + 43; goto execFuncs;
+	f18: _acts = _date_machine_actions + 46; goto execFuncs;
+	f20: _acts = _date_machine_actions + 49; goto execFuncs;
+	f9: _acts = _date_machine_actions + 52; goto execFuncs;
+	f11: _acts = _date_machine_actions + 55; goto execFuncs;
+	f38: _acts = _date_machine_actions + 58; goto execFuncs;
+	f13: _acts = _date_machine_actions + 61; goto execFuncs;
+	f19: _acts = _date_machine_actions + 64; goto execFuncs;
+	f40: _acts = _date_machine_actions + 67; goto execFuncs;
+	f28: _acts = _date_machine_actions + 70; goto execFuncs;
+	f27: _acts = _date_machine_actions + 73; goto execFuncs;
+	f21: _acts = _date_machine_actions + 76; goto execFuncs;
+	f41: _acts = _date_machine_actions + 79; goto execFuncs;
+	f36: _acts = _date_machine_actions + 82; goto execFuncs;
+	f23: _acts = _date_machine_actions + 85; goto execFuncs;
+	f26: _acts = _date_machine_actions + 89; goto execFuncs;
+	f44: _acts = _date_machine_actions + 93; goto execFuncs;
+	f33: _acts = _date_machine_actions + 97; goto execFuncs;
+	f1: _acts = _date_machine_actions + 101; goto execFuncs;
+	f42: _acts = _date_machine_actions + 105; goto execFuncs;
+	f25: _acts = _date_machine_actions + 109; goto execFuncs;
+	f37: _acts = _date_machine_actions + 113; goto execFuncs;
+	f43: _acts = _date_machine_actions + 117; goto execFuncs;
+	f30: _acts = _date_machine_actions + 121; goto execFuncs;
+	f39: _acts = _date_machine_actions + 125; goto execFuncs;
+	f31: _acts = _date_machine_actions + 129; goto execFuncs;
+	f34: _acts = _date_machine_actions + 133; goto execFuncs;
+	f35: _acts = _date_machine_actions + 137; goto execFuncs;
+	f32: _acts = _date_machine_actions + 141; goto execFuncs;
+	f24: _acts = _date_machine_actions + 146; goto execFuncs;
+	f29: _acts = _date_machine_actions + 151; goto execFuncs;
+
+execFuncs:
+	_nacts = *_acts++;
+	while ( _nacts-- > 0 ) {
+		switch ( *_acts++ ) {
+	case 0:
+#line 51 "iso8601.rl"
+	{
+	    ts = p;
+	  }
+	break;
+	case 1:
+#line 56 "iso8601.rl"
+	{
+	    *stat = DATETIME_MATCH;
+	  }
+	break;
+	case 2:
+#line 61 "iso8601.rl"
+	{
+	    *stat = DURATION_MATCH;
+	  }
+	break;
+	case 3:
+#line 66 "iso8601.rl"
+	{
+	    dtObj->sign_of_year = (*p);
+	  }
+	break;
+	case 4:
+#line 71 "iso8601.rl"
+	{
+	    duObj->sign = (*p);
+	  }
+	break;
+	case 5:
+#line 76 "iso8601.rl"
+	{
+	    te = p+1;                       
+	    char _year[MAX_BUFFER_LENGTH] = {0};
+	    strncpy( _year, ts, te-ts);
+	    _year[MAX_BUFFER_LENGTH-1] = '\0';
+	    dtObj->year = atoi(_year);
+	  }
+	break;
+	case 6:
+#line 85 "iso8601.rl"
+	{
+	    te = p+1;
+	    char _month[3] = {0};
+	    strncpy( _month, ts, te-ts);
+	    _month[2] = '\0';
+	    dtObj->month = atoi(_month);
+	  }
+	break;
+	case 7:
+#line 94 "iso8601.rl"
+	{
+	    te = p+1;
+	    char _day[3] = {0};
+	    strncpy( _day, ts, te-ts);
+	    _day[2] = '\0';
+	    dtObj->day = atoi(_day);
+	    dtObj->flag_365type_day = 0;
+	  }
+	break;
+	case 8:
+#line 104 "iso8601.rl"
+	{
+	    te = p+1;
+	    char _day[4] = {0};
+	    strncpy( _day, ts, te-ts);
+	    _day[3] = '\0';
+	    dtObj->day = atoi(_day);
+	    dtObj->flag_365type_day = 1;
+	  }
+	break;
+	case 9:
+#line 114 "iso8601.rl"
+	{
+	    te = p+1;
+	    char _hour[3] = {0};
+	    strncpy( _hour, ts, te-ts);
+	    _hour[2] = '\0';
+	    dtObj->hour = atoi(_hour);
+	  }
+	break;
+	case 10:
+#line 123 "iso8601.rl"
+	{
+	    te = p+1;
+	    char _minute[3] = {0};
+	    strncpy( _minute, ts, te-ts);
+	    _minute[2] = '\0';
+	    dtObj->minute = atoi(_minute);
+	  }
+	break;
+	case 11:
+#line 132 "iso8601.rl"
+	{
+	    te = p+1;
+	    char _second[3] = {0};
+	    strncpy( _second, ts, te-ts);
+	    _second[2] = '\0';
+	    dtObj->second = atoi(_second);                
+	  }
+	break;
+	case 12:
+#line 141 "iso8601.rl"
+	{
+	    te = p+1;
+	    char _ms[4] = {0};
+	    strncpy( _ms, ts, te-ts);
+	    _ms[3] = '\0';
+	    dtObj->ms = atoi(_ms);
+	  }
+	break;
+	case 13:
+#line 150 "iso8601.rl"
+	{
+	    dtObj->timeZoneOffSet = (*p);
+	  }
+	break;
+	case 14:
+#line 155 "iso8601.rl"
+	{
+	    te = p;                 
+	    char _du_year[1000] = {0};
+	    strncpy( _du_year, ts, te-ts);
+	    _du_year[999] = '\0';
+	    duObj->year = atoi(_du_year);
+	  }
+	break;
+	case 15:
+#line 164 "iso8601.rl"
+	{
+	    te = p;
+	    char _du_month[3] = {0};
+	    strncpy( _du_month, ts, te-ts);
+	    _du_month[2] = '\0';
+	    duObj->month = atoi(_du_month);
+	  }
+	break;
+	case 16:
+#line 173 "iso8601.rl"
+	{
+	    te = p;
+	    char _du_day[3] = {0};
+	    strncpy( _du_day, ts, te-ts);
+	    _du_day[2] = '\0';
+	    duObj->day = atoi(_du_day);     
+	  }
+	break;
+	case 17:
+#line 182 "iso8601.rl"
+	{
+	    te = p;
+	    char _du_hour[3] = {0};
+	    strncpy( _du_hour, ts, te-ts);
+	    _du_hour[2] = '\0';
+	    duObj->hour = atoi(_du_hour);
+	  }
+	break;
+	case 18:
+#line 191 "iso8601.rl"
+	{
+	    te = p;
+	    char _du_minute[3] = {0};
+	    strncpy( _du_minute, ts, te-ts);
+	    _du_minute[2] = '\0';
+	    duObj->minute = atoi(_du_minute);
+	  }
+	break;
+	case 19:
+#line 200 "iso8601.rl"
+	{
+	    te = p;
+	    char _du_second[13] = {0};
+	    char* _du_ms;
+	    int _ms;
+	    
+	    strncpy( _du_second, ts, te-ts);
+	    _du_second[12] = '\0';
+	    duObj->second = atoi(_du_second);
+	    
+	    if(strstr(_du_second,"."))
+	      {
+		_du_ms = (strstr(_du_second,".")+1);
+		if(_du_ms[0] == '-')
+		  _du_ms = _du_ms + 1;
+
+		_ms = atoi(_du_ms);
+
+		if(strlen(_du_ms) == 1)
+		  duObj->ms = _ms*100;
+		else if(strlen(_du_ms) == 2)
+		  duObj->ms = _ms*10;
+		else
+		  duObj->ms = _ms;        
+	      }               
+	  }
+	break;
+#line 2929 "iso8601.c"
+		}
+	}
+	goto _again;
+
+_again:
+	if ( cs == 0 )
+		goto _out;
+	if ( ++p != pe )
+		goto _resume;
+	_test_eof: {}
+	_out: {}
+	}
+
+#line 514 "iso8601.rl"
+
+    
+};
+
+/* Internal Function. */
+static 
+ISO8601_STATUS 
+get_date_time(const char* buffer, struct iso8601_datetime* datetimeObj, struct iso8601_duration* durationObj)
+  {
+    /* Create a local buffer. */
+    char buf[MAX_BUFFER_LENGTH];
+    strncpy(buf,buffer,MAX_BUFFER_LENGTH);
+    buf[MAX_BUFFER_LENGTH-1] = '\0';
+
+    /* Success or Failure flag. */
+    ISO8601_STATUS stat = FAILURE;
+
+    /* Placeholder for values of DateTime and Duration. */
+    struct internal_datetime dtObj = {0};
+    struct iso8601_duration duObj = {0};
+
+    /* Initialize month and day to 1. In case these values are not specified in the buffer
+       the default value should be 1. For eg. Date 1999-12 should return Year 1999, Month
+       12 and DATE as "1".
+    */
+    dtObj.month = 1;
+    dtObj.day = 1;
+
+    /*Ragel expects \n at the end of the string.*/
+    char* replace = strchr(buf, '\0');
+    *replace = '\n';
+
+    /*The fact that '-' sign is used to denote negative years as well as a seperator in datetime 
+      causes the regex to fail in certain scenarios. The fix ( hack? ) is to replace the - sign 
+      with a '$' sign and copy back the value after processing. 
+    */
+    if(buf[0] == '-')
+      buf[0] = '$';
+
+
+    /* Execute Ragel Machine. */
+    date_machine(buf,&stat,&dtObj,&duObj);
+
+   
+    /* stat contains the type of match. */
+    if(stat == DATETIME_MATCH)
+      {       
+	/* Set sign of year. */
+	if(dtObj.sign_of_year == '$')
+	  datetimeObj->sign_of_year = '-';
+	else
+	  datetimeObj->sign_of_year = '+';
+
+	/* Year. */
+	datetimeObj->year = dtObj.year;
+
+	/* If this is a 365 type day, set month to 0. */
+	if(dtObj.flag_365type_day == 1)
+	  {
+	    datetimeObj->month  = 0;
+	  }
+	else
+	  {
+	    datetimeObj->month  = dtObj.month;
+	  }
+
+	/* Set rest. */
+	datetimeObj->day = dtObj.day;               
+	datetimeObj->hour = dtObj.hour;
+	datetimeObj->minute = dtObj.minute;
+	datetimeObj->second = dtObj.second;
+	datetimeObj->ms = dtObj.ms;
+	datetimeObj->timeZoneOffSet = dtObj.timeZoneOffSet;
+      }               
+    else if (stat == DURATION_MATCH)
+      {
+	/* Set sign of duration. */
+	if (duObj.sign == '$')
+	  durationObj->sign = '-';
+	else
+	  durationObj->sign = '+';
+
+	/* Set rest. */
+	durationObj->year   = duObj.year;
+	durationObj->month  = duObj.month;
+	durationObj->day    = duObj.day;
+	durationObj->hour   = duObj.hour;
+	durationObj->minute = duObj.minute;
+	durationObj->second = duObj.second;
+	durationObj->ms     = duObj.ms;
+      }
+    else
+      {
+        /* stat = FAILURE  */
+      }
+
+    return stat;
+  }
+
+
+/*Check DateTime string compliance and get DateTime values. */
+ISO8601_STATUS 
+verify_string_datetime(const char* test_string,struct iso8601_datetime* dummy_isoDtObj)
+  {
+    ISO8601_STATUS stat = FAILURE;
+    struct iso8601_duration* dummy_isoDObj = new_iso8601_duration('+',0,0,0,0,0,0,0);
+    if (dummy_isoDObj == NULL)
+      return FAILURE;
+
+    stat = get_date_time(test_string, dummy_isoDtObj, dummy_isoDObj);
+
+    deallocate_iso8601_duration(dummy_isoDObj);
+
+    return stat;
+  }
+
+/*Check TimeDelta string compliance and get duration values.*/
+ISO8601_STATUS
+verify_string_duration(const char* test_string, struct iso8601_duration* dummy_isoDObj)
+  {
+    ISO8601_STATUS stat = FAILURE;
+    struct iso8601_datetime* dummy_isoDtObj = new_iso8601_datetime('+',0,0,0,0,0,0,0,'Z');
+    if ( dummy_isoDtObj == NULL)
+      return FAILURE;
+
+    stat = get_date_time(test_string, dummy_isoDtObj, dummy_isoDObj);
+
+    deallocate_iso8601_datetime(dummy_isoDtObj);
+
+    return stat;
+  }
+
+
+struct iso8601_datetime* 
+new_iso8601_datetime( char _sign_of_year, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int64_t _ms, char _timeZoneOffSet )
+  {
+    struct iso8601_datetime* isoDtObj = NULL;
+    isoDtObj = (struct iso8601_datetime*)malloc(sizeof(struct iso8601_datetime));
+    if (isoDtObj == NULL)
+	    return NULL;
+
+
+    isoDtObj->sign_of_year = _sign_of_year;
+    isoDtObj->year = _year;
+    isoDtObj->month = _month;
+    isoDtObj->day = _day;
+    isoDtObj->hour = _hour;
+    isoDtObj->minute = _minute;
+    isoDtObj->second = _second;
+    isoDtObj->ms = _ms;
+    isoDtObj->timeZoneOffSet = _timeZoneOffSet;
+
+    return isoDtObj;
+  }
+
+
+void 
+deallocate_iso8601_datetime(struct iso8601_datetime* iso8601_datetimeObj)
+  {
+    if ( iso8601_datetimeObj != NULL)
+      {
+	free(iso8601_datetimeObj);
+	iso8601_datetimeObj = NULL;
+      }
+  }
+
+struct iso8601_duration* 
+new_iso8601_duration( char _sign, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int64_t _ms )
+  {
+    struct iso8601_duration* isoDObj = NULL;
+    isoDObj = (struct iso8601_duration*)malloc(sizeof(struct iso8601_duration));
+    if (isoDObj == NULL)
+	    return NULL;
+
+    isoDObj->sign = _sign;
+    isoDObj->year = _year;
+    isoDObj->month = _month;
+    isoDObj->day = _day;
+    isoDObj->hour = _hour;
+    isoDObj->minute = _minute;
+    isoDObj->second = _second;
+    isoDObj->ms = _ms;
+
+    return isoDObj;
+  }
+
+void 
+deallocate_iso8601_duration(struct iso8601_duration* iso8601_durationObj)
+  {
+    if ( iso8601_durationObj != NULL )
+      {
+	free(iso8601_durationObj);
+	iso8601_durationObj = NULL;
+      }
+  }
+
+/*! \endcond */
diff --git a/src/OLD/iso8601.rl b/src/OLD/iso8601.rl
new file mode 100644
index 00000000..ab989dd5
--- /dev/null
+++ b/src/OLD/iso8601.rl
@@ -0,0 +1,710 @@
+/*! \cond PRIVATE */
+/**
+  * @brief ISO 8601_2004 complaint Time.
+  *
+  * @author Luis Kornblueh, Rahul Sinha. MPIM.
+  * @date March 2013
+  *
+  * @note USAGE: Compile this rl file and generate iso8601.c file. Compile the iso8601.c file using gcc. iso8601.h file needs to be edited seperately. match_found = 1 => DATE/DATETIME. match_found = 2 => Duration. Else malformed string and hence REJECT.
+  */
+
+//file iso8601.rl
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#include "iso8601.h"
+
+#define MAX_BUFFER_LENGTH 32
+
+%%{
+    machine date_machine;
+    write data;
+}%%
+
+struct internal_datetime
+  {
+    char            sign_of_year;
+    int64_t         year;
+    int             month;
+    int             day;
+    char            flag_365type_day;
+    int             hour;
+    int             minute;
+    int             second;
+    int64_t         ms;
+    char	    timeZoneOffSet;
+  };
+
+static 
+void 
+date_machine( char *str, ISO8601_STATUS* stat, struct internal_datetime* dtObj, struct iso8601_duration* duObj)
+  {
+    char *p = str, *pe = str + strlen( str );
+    char *ts, *te = 0;
+    int cs;
+
+    %%{
+	action _start 
+	  {
+	    ts = p;
+	  }                
+	
+	action date_match
+	  {
+	    *stat = DATETIME_MATCH;
+	  }
+
+	action duration_match
+	  {
+	    *stat = DURATION_MATCH;
+	  }
+
+	action year_sign_match
+	  {
+	    dtObj->sign_of_year = fc;
+	  }
+			
+	action duration_sign_match
+	  {
+	    duObj->sign = fc;
+	  }
+
+	action year_year_copy
+	  {
+	    te = p+1;                       
+	    char _year[MAX_BUFFER_LENGTH] = {0};
+	    strncpy( _year, ts, te-ts);
+	    _year[MAX_BUFFER_LENGTH-1] = '\0';
+	    dtObj->year = atoi(_year);
+	  }
+	
+	action year_month_copy               
+	  {
+	    te = p+1;
+	    char _month[3] = {0};
+	    strncpy( _month, ts, te-ts);
+	    _month[2] = '\0';
+	    dtObj->month = atoi(_month);
+	  }
+
+	action year_day_copy                 
+	  {
+	    te = p+1;
+	    char _day[3] = {0};
+	    strncpy( _day, ts, te-ts);
+	    _day[2] = '\0';
+	    dtObj->day = atoi(_day);
+	    dtObj->flag_365type_day = 0;
+	  }
+
+	action  year_365_day_copy            
+	  {
+	    te = p+1;
+	    char _day[4] = {0};
+	    strncpy( _day, ts, te-ts);
+	    _day[3] = '\0';
+	    dtObj->day = atoi(_day);
+	    dtObj->flag_365type_day = 1;
+	  }
+
+	action year_hour_copy                
+	  {
+	    te = p+1;
+	    char _hour[3] = {0};
+	    strncpy( _hour, ts, te-ts);
+	    _hour[2] = '\0';
+	    dtObj->hour = atoi(_hour);
+	  }
+
+	action year_minute_copy              
+	  {
+	    te = p+1;
+	    char _minute[3] = {0};
+	    strncpy( _minute, ts, te-ts);
+	    _minute[2] = '\0';
+	    dtObj->minute = atoi(_minute);
+	  }
+
+	action year_second_copy              
+	  {
+	    te = p+1;
+	    char _second[3] = {0};
+	    strncpy( _second, ts, te-ts);
+	    _second[2] = '\0';
+	    dtObj->second = atoi(_second);                
+	  }
+
+	action year_ms_copy          
+	  {
+	    te = p+1;
+	    char _ms[4] = {0};
+	    strncpy( _ms, ts, te-ts);
+	    _ms[3] = '\0';
+	    dtObj->ms = atoi(_ms);
+	  }
+
+	action year_timeZoneOffSet_copy        
+	  {
+	    dtObj->timeZoneOffSet = fc;
+	  }
+
+	action duration_year_copy            
+	  {
+	    te = p;                 
+	    char _du_year[1000] = {0};
+	    strncpy( _du_year, ts, te-ts);
+	    _du_year[999] = '\0';
+	    duObj->year = atoi(_du_year);
+	  }
+
+	action duration_month_copy           
+	  {
+	    te = p;
+	    char _du_month[3] = {0};
+	    strncpy( _du_month, ts, te-ts);
+	    _du_month[2] = '\0';
+	    duObj->month = atoi(_du_month);
+	  }
+
+	action duration_day_copy             
+	  {
+	    te = p;
+	    char _du_day[3] = {0};
+	    strncpy( _du_day, ts, te-ts);
+	    _du_day[2] = '\0';
+	    duObj->day = atoi(_du_day);     
+	  }
+
+	action duration_hour_copy            
+	  {
+	    te = p;
+	    char _du_hour[3] = {0};
+	    strncpy( _du_hour, ts, te-ts);
+	    _du_hour[2] = '\0';
+	    duObj->hour = atoi(_du_hour);
+	  }
+
+	action duration_minute_copy          
+	  {
+	    te = p;
+	    char _du_minute[3] = {0};
+	    strncpy( _du_minute, ts, te-ts);
+	    _du_minute[2] = '\0';
+	    duObj->minute = atoi(_du_minute);
+	  }
+
+	action duration_second_copy          
+	  {
+	    te = p;
+	    char _du_second[13] = {0};
+	    char* _du_ms;
+	    int _ms;
+	    
+	    strncpy( _du_second, ts, te-ts);
+	    _du_second[12] = '\0';
+	    duObj->second = atoi(_du_second);
+	    
+	    if(strstr(_du_second,"."))
+	      {
+		_du_ms = (strstr(_du_second,".")+1);
+		if(_du_ms[0] == '-')
+		  _du_ms = _du_ms + 1;
+
+		_ms = atoi(_du_ms);
+
+		if(strlen(_du_ms) == 1)
+		  duObj->ms = _ms*100;
+		else if(strlen(_du_ms) == 2)
+		  duObj->ms = _ms*10;
+		else
+		  duObj->ms = _ms;        
+	      }               
+	  }
+
+
+	#BIG: Year can be of any length but not of size 4 (which case is handeled later). String MUST be in extended format.
+
+	Big_Year = 	
+			(   
+				( ('+'|'$') @year_sign_match)?   
+				(([0-9]*'-') >_start @year_year_copy)
+			) 
+			- 
+			(('+'|'$')?[0-9]{4}'-');
+
+
+	Big_rest_year =
+			(	
+				(( [0][1-9] | [1][0-2] ) >_start @year_month_copy)
+				( '-' (	( [0][1-9] | [12][0-9] | [3][01] ) ) >_start @year_day_copy )?
+			  |
+				(
+					( [0]{2}[1-9] | [0][1-9][0-9] | [12][0-9]{2} | [3]([0-5][0-9]|[6][0-6]) )  
+					>_start  @year_365_day_copy
+				)
+			);
+	
+	Big_Time = ('T'|space)?
+
+		(   
+			(  
+				( ([01][0-9] | [2][0-3])  >_start @year_hour_copy )  
+				(   
+					 (	(':') ([0-5][0-9]) >_start @year_minute_copy  )
+					 (  	
+						( (':') ([0-5][0-9])  >_start @year_second_copy) 
+						( ('.'|',')([0-9]{1,3}) >_start @year_ms_copy)? 
+					 )? 
+				)? 
+			) 
+				
+			|
+			
+			(        
+				( ([2][4])  >_start @year_hour_copy ) 
+				(    
+					 (      (':') ([0][0]) >_start @year_minute_copy  )
+					 (      
+						( (':') ([0][0])  >_start @year_second_copy)
+						( ('.'|',')([0]{1,3}) >_start @year_ms_copy)? 
+					 )?     
+				)?
+			)
+
+				
+		)
+
+		(               
+			('z'|'Z') @year_timeZoneOffSet_copy 
+		)? ;
+
+
+
+	
+	#Year which is exactly 4 charachters long. Non-extended format.
+
+	Year = 	
+		(    
+			(('+'|'$') @year_sign_match)?     
+			( ([0-9]{4}) >_start @year_year_copy)    
+		) ;
+
+	rest_year = 
+			(    
+				( 
+					(([0][1-9]|[1][0-2]) >_start @year_month_copy) 
+					(([12][0-9]|[0][1-9]|[3][01]) >_start @year_day_copy)?  
+				)
+				|
+				(    
+					([0]{2}[1-9] | [0][1-9][0-9] | [12][0-9]{2} | [3]([0-5][0-9]|[6][0-6])) 
+						>_start @year_365_day_copy  
+				)
+			);
+
+	Time = ('T'|space)?
+
+		(   
+				(  	
+					(( [01][0-9] | [2][0-3] ) >_start @year_hour_copy )  
+					( 
+						( ([0-5][0-9]) >_start @year_minute_copy)  
+						( 
+							(([0-5][0-9]) >_start @year_second_copy)
+							(('.'|',')([0-9]{1,3})> _start @year_ms_copy)?
+						)? 
+					)? 
+				) 
+				|
+				(       
+					(( [2][4] ) >_start @year_hour_copy )
+					( 
+						( ([0][0]) >_start @year_minute_copy) 
+						( 
+							(([0][0]) >_start @year_second_copy)
+							(('.'|',')([0]{1,3})> _start @year_ms_copy)?
+						)?
+					)?
+				)
+		)
+
+		(               
+				('z'|'Z') @year_timeZoneOffSet_copy 
+		)? ;
+		 
+
+
+	#Year which is exactly 4 charachters long. Extended format. 
+	
+	rest_year_extended = ( '-'
+				(       
+					(
+						(([0][1-9]|[1][0-2]) >_start @year_month_copy)
+						( '-'(([0][1-9] |[12][0-9]|[3][01]))>_start @year_day_copy)?
+					)
+					|
+					(	([0]{2}[1-9]|[0][1-9][0-9]|[12][0-9]{2}|[3]([0-5][0-9]|[6][0-6])) 
+							>_start @year_365_day_copy
+					)
+				)
+			     );
+
+	Time_extended = 
+			('T'|space)?
+			(   
+				(  	
+					(([01][0-9] | [2][0-3]) >_start @year_hour_copy)  
+					( 	
+						((':') (([0-5][0-9])>_start @year_minute_copy)) 
+						(	
+							((':')([0-5][0-9])>_start @year_second_copy)
+							( ('.'|',')([0-9]{1,3}) >_start @year_ms_copy)?
+						)?
+					)? 
+				) 
+				|
+				(       
+					(([2][4]) >_start @year_hour_copy)  
+					(       
+						((':') (([0][0])>_start @year_minute_copy))
+						(       
+							((':')([0][0])>_start @year_second_copy)
+							( ('.'|',')([0]{1,3}) >_start @year_ms_copy)?
+						)?
+					)?
+				)
+			)
+			(               
+				('z'|'Z') @year_timeZoneOffSet_copy 
+			)? ;
+	
+	
+
+	#Date can not be: 1. Just Year and Month OR 2. Just Year in non-extended format.
+	Date_can_not_be_YearMonth_exception = 
+	  (
+	    	('+'|'$')?
+		( [0-9]{4} ) ( [0][1-9] | [1][0-2] )
+	  ) ;
+	Date_can_not_be_Year_exception = 
+	  (
+	   	('+'|'$')?
+		( [0-9]{4} )
+	  ) ;
+	
+
+	#If string contains T or ' ', only extended format is permitted.
+	If_T_or_space_then_full_date_only_exception = 
+	  (
+		('+'|'$')?  
+		(
+			 ( [0-9]{4} ('T'|space) any* ) 
+			|
+			 ( [0-9]{4}'-'?[0-9]{2}('T'|space) any* )
+		)			  
+	  ) ;
+
+
+	#Negative duration is represented as -P01D instead of P-01D. Negative represented as '$'
+	duration_positive_negative  =	
+			(     
+				(('$'|'+') >_start @duration_sign_match)?
+				('P')
+				( 
+					(	
+						([0-9]+ 'Y') >_start @duration_year_copy 	
+					)? 
+					(
+						(([0][0-9]|[1][0-1]) 'M') >_start @duration_month_copy
+					)? 
+					(	
+						(([0][0-9]|[12][0-9]|[3][0]) 'D') >_start @duration_day_copy
+					)?
+				) 
+				(
+					('T') 
+					( 
+							(	
+								(([01][0-9] | [2][0-3]) 'H')>_start @duration_hour_copy
+							)? 
+							(
+								(([0-5][0-9]) 'M')>_start @duration_minute_copy
+							)? 
+							( 
+								(([0-5][0-9])('.'[0-9]{1,3})?'S') >_start @duration_second_copy
+							)? 
+					) - ('T')	
+				)? 
+			) - ('P');
+
+
+
+
+	 #Negative duration which has the form P-01M-14D.
+	 duration_negative_inside  =
+			(
+				('P')?
+				(
+					(
+					      ('-')(([0-9]+ 'Y') >_start @duration_year_copy)
+					)?
+					(
+					      ('-')((([0][0-9]|[1][0-1]) 'M') >_start @duration_month_copy)
+					)?
+					(
+					      ('-')((([12][0-9]|[0][0-9]|[3][0]) 'D') >_start @duration_day_copy)
+					)?
+				)
+				(       
+					('T')
+					( 
+							(
+							       ('-')((([01][0-9] | [2][0-3]) 'H')>_start @duration_hour_copy)
+							)?       
+							(       
+							       ('-')((([0-5][0-9]) 'M')>_start @duration_minute_copy)
+							)?      
+							(       
+							       ('-')((([0-5][0-9])('.-'[0-9]{1,3})?'S') >_start @duration_second_copy)
+							)?      
+					) - ('T')       
+				)?
+			) - ('P');
+
+
+
+
+	
+	main := 
+		(
+			(
+		
+				(       
+					(Year (rest_year)? (Time)? '\n') 
+					| 
+					(Year (rest_year_extended)? (Time_extended)? '\n')
+					|
+					(Big_Year (Big_rest_year)? (Big_Time)? '\n') 
+				) 
+				- 
+				(If_T_or_space_then_full_date_only_exception '\n')
+				-
+				(Date_can_not_be_YearMonth_exception '\n')  
+				-
+				(Date_can_not_be_Year_exception '\n')
+		
+			) @date_match
+		)
+		|
+		(
+			(
+				(duration_positive_negative '\n')
+				|
+				(duration_negative_inside '\n')
+			)@duration_match
+		);              
+
+
+	# Initialize and execute.
+	write init;
+	write exec;
+    }%%
+    
+};
+
+/* Internal Function. */
+static 
+ISO8601_STATUS 
+get_date_time(const char* buffer, struct iso8601_datetime* datetimeObj, struct iso8601_duration* durationObj)
+  {
+    /* Create a local buffer. */
+    char buf[MAX_BUFFER_LENGTH];
+    strncpy(buf,buffer,MAX_BUFFER_LENGTH);
+    buf[MAX_BUFFER_LENGTH-1] = '\0';
+
+    /* Success or Failure flag. */
+    ISO8601_STATUS stat = FAILURE;
+
+    /* Placeholder for values of DateTime and Duration. */
+    struct internal_datetime dtObj = {0};
+    struct iso8601_duration duObj = {0};
+
+    /* Initialize month and day to 1. In case these values are not specified in the buffer
+       the default value should be 1. For eg. Date 1999-12 should return Year 1999, Month
+       12 and DATE as "1".
+    */
+    dtObj.month = 1;
+    dtObj.day = 1;
+
+    /*Ragel expects \n at the end of the string.*/
+    char* replace = strchr(buf, '\0');
+    *replace = '\n';
+
+    /*The fact that '-' sign is used to denote negative years as well as a seperator in datetime 
+      causes the regex to fail in certain scenarios. The fix ( hack? ) is to replace the - sign 
+      with a '$' sign and copy back the value after processing. 
+    */
+    if(buf[0] == '-')
+      buf[0] = '$';
+
+
+    /* Execute Ragel Machine. */
+    date_machine(buf,&stat,&dtObj,&duObj);
+
+   
+    /* stat contains the type of match. */
+    if(stat == DATETIME_MATCH)
+      {       
+	/* Set sign of year. */
+	if(dtObj.sign_of_year == '$')
+	  datetimeObj->sign_of_year = '-';
+	else
+	  datetimeObj->sign_of_year = '+';
+
+	/* Year. */
+	datetimeObj->year = dtObj.year;
+
+	/* If this is a 365 type day, set month to 0. */
+	if(dtObj.flag_365type_day == 1)
+	  {
+	    datetimeObj->month  = 0;
+	  }
+	else
+	  {
+	    datetimeObj->month  = dtObj.month;
+	  }
+
+	/* Set rest. */
+	datetimeObj->day = dtObj.day;               
+	datetimeObj->hour = dtObj.hour;
+	datetimeObj->minute = dtObj.minute;
+	datetimeObj->second = dtObj.second;
+	datetimeObj->ms = dtObj.ms;
+	datetimeObj->timeZoneOffSet = dtObj.timeZoneOffSet;
+      }               
+    else if (stat == DURATION_MATCH)
+      {
+	/* Set sign of duration. */
+	if (duObj.sign == '$')
+	  durationObj->sign = '-';
+	else
+	  durationObj->sign = '+';
+
+	/* Set rest. */
+	durationObj->year   = duObj.year;
+	durationObj->month  = duObj.month;
+	durationObj->day    = duObj.day;
+	durationObj->hour   = duObj.hour;
+	durationObj->minute = duObj.minute;
+	durationObj->second = duObj.second;
+	durationObj->ms     = duObj.ms;
+      }
+    else
+      {
+        /* stat = FAILURE  */
+      }
+
+    return stat;
+  }
+
+
+/*Check DateTime string compliance and get DateTime values. */
+ISO8601_STATUS 
+verify_string_datetime(const char* test_string,struct iso8601_datetime* dummy_isoDtObj)
+  {
+    ISO8601_STATUS stat = FAILURE;
+    struct iso8601_duration* dummy_isoDObj = new_iso8601_duration('+',0,0,0,0,0,0,0);
+    if (dummy_isoDObj == NULL)
+      return FAILURE;
+
+    stat = get_date_time(test_string, dummy_isoDtObj, dummy_isoDObj);
+
+    deallocate_iso8601_duration(dummy_isoDObj);
+
+    return stat;
+  }
+
+/*Check TimeDelta string compliance and get duration values.*/
+ISO8601_STATUS
+verify_string_duration(const char* test_string, struct iso8601_duration* dummy_isoDObj)
+  {
+    ISO8601_STATUS stat = FAILURE;
+    struct iso8601_datetime* dummy_isoDtObj = new_iso8601_datetime('+',0,0,0,0,0,0,0,'Z');
+    if ( dummy_isoDtObj == NULL)
+      return FAILURE;
+
+    stat = get_date_time(test_string, dummy_isoDtObj, dummy_isoDObj);
+
+    deallocate_iso8601_datetime(dummy_isoDtObj);
+
+    return stat;
+  }
+
+
+struct iso8601_datetime* 
+new_iso8601_datetime( char _sign_of_year, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int64_t _ms, char _timeZoneOffSet )
+  {
+    struct iso8601_datetime* isoDtObj = NULL;
+    isoDtObj = (struct iso8601_datetime*)malloc(sizeof(struct iso8601_datetime));
+    if (isoDtObj == NULL)
+	    return NULL;
+
+
+    isoDtObj->sign_of_year = _sign_of_year;
+    isoDtObj->year = _year;
+    isoDtObj->month = _month;
+    isoDtObj->day = _day;
+    isoDtObj->hour = _hour;
+    isoDtObj->minute = _minute;
+    isoDtObj->second = _second;
+    isoDtObj->ms = _ms;
+    isoDtObj->timeZoneOffSet = _timeZoneOffSet;
+
+    return isoDtObj;
+  }
+
+
+void 
+deallocate_iso8601_datetime(struct iso8601_datetime* iso8601_datetimeObj)
+  {
+    if ( iso8601_datetimeObj != NULL)
+      {
+	free(iso8601_datetimeObj);
+	iso8601_datetimeObj = NULL;
+      }
+  }
+
+struct iso8601_duration* 
+new_iso8601_duration( char _sign, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int64_t _ms )
+  {
+    struct iso8601_duration* isoDObj = NULL;
+    isoDObj = (struct iso8601_duration*)malloc(sizeof(struct iso8601_duration));
+    if (isoDObj == NULL)
+	    return NULL;
+
+    isoDObj->sign = _sign;
+    isoDObj->year = _year;
+    isoDObj->month = _month;
+    isoDObj->day = _day;
+    isoDObj->hour = _hour;
+    isoDObj->minute = _minute;
+    isoDObj->second = _second;
+    isoDObj->ms = _ms;
+
+    return isoDObj;
+  }
+
+void 
+deallocate_iso8601_duration(struct iso8601_duration* iso8601_durationObj)
+  {
+    if ( iso8601_durationObj != NULL )
+      {
+	free(iso8601_durationObj);
+	iso8601_durationObj = NULL;
+      }
+  }
+
+/*! \endcond */
diff --git a/src/OLD/julian_day.c b/src/OLD/julian_day.c
new file mode 100644
index 00000000..b34db3a1
--- /dev/null
+++ b/src/OLD/julian_day.c
@@ -0,0 +1,249 @@
+/**
+ * @file julian_day.c
+ *
+ * @brief Julian Day Calendar and some operations supported on julian dates.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ * @note
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <inttypes.h>
+
+
+
+#include"julian_day.h"
+
+/**
+ * @brief Construct new Julian-Date object.
+ *
+ * @param  _day
+ *         An "int64_t" value denoting the Day part of JD.
+ * @param  _ms
+ *         An "int64_t" value denoting the milli-second part of Date.
+ * @return jd
+ *         A pointer to a initialized Julian-Date object. 
+ */
+
+struct _julianday*
+newJulianDay(int64_t _day, int64_t _ms)
+{
+  struct _julianday* jd = (struct _julianday *) malloc(sizeof(struct _julianday));
+  if (jd == NULL )
+    return NULL ;
+
+  jd->day = _day;
+  jd->ms = _ms;
+
+  return jd;
+}
+
+/*! \cond PRIVATE */
+/* Internal data structure. */
+/* Create a new Julian Delta. */
+struct _juliandelta*
+newJulianDelta(char _sign, int64_t _day, int64_t _ms)
+{
+  struct _juliandelta* jd = (struct _juliandelta *) malloc(sizeof(struct _juliandelta));
+  if (jd == NULL )
+    return NULL ;
+
+  jd->sign = _sign;
+  jd->day = _day;
+  jd->ms = _ms;
+
+  return jd;
+}
+/*! \endcond */
+
+/**
+ * @brief Destructor of Julian-Date.
+ *
+ * @param  jd
+ *         A pointer to struct _julianday. jd is deallocated.
+ */
+
+void
+deallocateJulianDay(struct _julianday* jd)
+{
+  if (jd != NULL )
+    {
+      free(jd);
+      jd = NULL;
+
+      return;
+    }
+}
+
+
+/*! \cond PRIVATE */
+/*Internal function.*/
+/* Destructor of JulianDelta.*/
+void
+deallocateJulianDelta(struct _juliandelta* jd)
+{
+  if (jd != NULL )
+    {
+      free(jd);
+      jd = NULL;
+
+      return;
+    }
+}
+
+/* Internal Function. */
+/* Add a lib defined julian delta to a Julian Day. */
+struct _julianday*
+addJulianDelta(struct _julianday* jd1, struct _juliandelta* jd2, struct _julianday* jd)
+{
+  if ((jd1 != NULL )&& (jd2 != NULL) && (jd != NULL) ){
+  jd->day = jd1->day + jd2->day;
+  jd->ms = jd1->ms + jd2->ms;
+
+  if (jd->ms >= 86400000)
+    {
+      jd->day = jd->day + 1;
+      jd->ms = jd->ms - 86400000;
+    }
+  return jd;
+}
+else
+return NULL;
+}
+
+  /* Internal Function. */
+  /* Substract a lib defined julian delta from a Julian Day. */
+
+struct _julianday*
+substractJulianDelta(struct _julianday* jd1, struct _juliandelta* jd2, struct _julianday* jd)
+{
+  if ((jd1 != NULL )&& (jd2 != NULL) && (jd != NULL) ){
+  jd->day = jd1->day + jd2->day;
+  jd->ms = jd1->ms + jd2->ms;
+
+  if ( jd->ms < 0 )
+    {
+      jd->ms = 86400000 + jd->ms;
+      jd->day = jd->day - 1;
+    }
+
+  return jd;
+}
+else
+return NULL;
+}
+
+  /* Internal function. */
+  /* Return jd1 >= jd2 */
+bool
+compareJulianDay(struct _julianday* jd1, struct _julianday* jd2)
+{
+  if (jd1->day > jd2->day)
+    {
+      return true;
+    }
+  else if (jd2->day > jd1->day)
+    {
+      return false;
+    }
+  else if (jd1->ms > jd2->ms)
+    {
+      return true;
+    }
+  else if (jd2->ms > jd1->ms)
+    {
+      return false;
+    }
+  else
+    {
+      return true;
+    }
+}
+/*! \endcond */
+
+
+/**
+ * @brief Get the JulianDelta between two JulianDays as (jd1-jd2).
+ *
+ * @param  jd1
+ *         A pointer to struct _julianday. 
+ *
+ * @param  jd2
+ *         A pointer to struct _julianday.
+ *
+ * @param  jd
+ *         A pointer to struct _juliandelta. Copy the result of (jd1 - jd2) in jd.
+ *
+ * @return jd
+ *         A pointer to Juliandelta containing the result of substraction.
+ */
+
+struct _juliandelta*
+substractJulianDay(struct _julianday* jd1, struct _julianday* jd2, struct _juliandelta* jd)
+{
+  if ((jd1 != NULL )&& (jd2 != NULL) && (jd != NULL) ){
+  if ( compareJulianDay(jd1,jd2) == true )
+    {
+      /*JD1 >= JD2*/
+
+      jd->sign = '+';
+      jd->day = jd1->day - jd2->day;
+      jd->ms = jd1->ms - jd2->ms;
+
+      if(jd->ms < 0)
+        {
+          jd->ms = 86400000 + jd->ms;
+          jd->day = jd->day - 1;
+        }
+    }
+  else
+    {
+      /*  JD2 > JD1 */
+
+      /*Recursive call with jd1 and jd2 switched and then negate the values.*/
+      jd = substractJulianDay(jd2,jd1,jd);
+
+      jd->sign = '-';
+      jd->day = (-1)*jd->day;
+      jd->ms = (-1)*jd->ms;
+    }
+
+  return jd;
+}
+else
+return NULL;
+}
+
+
+/**
+ * @brief Get Julian as a string.
+ *
+ * juliandayToString returns a string in Day.MS format.
+ *
+ * @param  jd
+ *         A pointer to struct _julianday. The julian value to be converted to string.
+ *
+ * @param  toStr
+ *         A pointer to char. String where julian value is to be written.
+ *
+ * @return toStr
+ *         A pointer to the string containing julian value.
+ */
+
+char*
+juliandayToString(struct _julianday* jd, char* toStr)
+{
+    if ((jd != NULL )&& ( toStr != NULL ) ){
+        snprintf(toStr,MAX_JULIANDAY_STR_LEN,"%" PRIi64 ".%" PRIi64, jd->day, jd->ms );
+
+	  return toStr;
+    }
+    else
+      return NULL;
+}
+
diff --git a/src/OLD/time.c b/src/OLD/time.c
new file mode 100644
index 00000000..fe5421c4
--- /dev/null
+++ b/src/OLD/time.c
@@ -0,0 +1,219 @@
+/**
+ * @addtogroup CBindings libmtime C language bindings
+ *
+ * @file time.c
+ * 
+ * @brief Time and some operations supported on Time.
+ *
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ *
+ */
+
+#include<stdio.h>
+#include<stdlib.h>
+#include<string.h>
+
+#include"time.h"
+#include"iso8601.h"
+#include"datetime.h"
+
+//TODO: Later on.
+static const int64_t _min = 0;
+static const int64_t _max = 24;
+static const int64_t _resolution = 1000;
+
+/**
+ * @brief Construct new Time using an ISO 8601 conforming string.
+ *
+ * @param  ts
+ *         A pointer to char. The string contains parameters with which Time is created.
+ *
+ * @return t
+ *         A pointer to a filled Time. 
+ */
+struct _time*
+newTime(const char* ts)
+{
+  if (ts != NULL )
+    {
+      /* Convert ts to dts by appending dummy Date 0-01-01 for testing with verify_string_datetime(). */
+      char* dts = (char*) malloc(sizeof(char) * MAX_DATETIME_STR_LEN);
+      if (dts == NULL )
+        return NULL ;
+
+      strcpy(dts, "0-01-01");
+      strncat(dts, ts, MAX_DATETIME_STR_LEN - 8);
+
+      struct iso8601_datetime* isoDt = new_iso8601_datetime('+', 0, 0, 0, 0, 0, 0, 0, 'Z');
+      if (isoDt == NULL )
+        {
+          free(dts);
+          dts = NULL;
+          return NULL ;
+        }
+
+      /* Verify ISO 8601 compliance. */
+      if (verify_string_datetime(dts, isoDt) != DATETIME_MATCH)
+        {
+          free(dts);
+          dts = NULL;
+          deallocate_iso8601_datetime(isoDt);
+          return NULL ;
+        }
+
+      struct _time* t = (struct _time*) malloc(sizeof(struct _time));
+      if (t == NULL )
+        {
+          free(dts);
+          dts = NULL;
+          deallocate_iso8601_datetime(isoDt);
+          return NULL ;
+        }
+
+      t->hour = isoDt->hour;
+      t->minute = isoDt->minute;
+      t->second = isoDt->second;
+      t->ms = isoDt->ms;
+
+      //Cleanup.
+      free(dts);
+      dts = NULL;
+      deallocate_iso8601_datetime(isoDt);
+
+      return t;
+    }
+  else
+    return NULL ;
+}
+
+/**
+ * @brief Construct new Time using 'raw' numerical values.
+ *
+ * @param  _hour
+ *	  An "int" value denoting the hour part of time. 
+ * @param  _minute
+ *	  An "int" value denoting the minute part of time.
+ * @param  _second
+ *	  An "int" value denoting the second part of time.
+ * @param  _ms
+ *	  An "int" value denoting the milli-second part of time.
+ *
+ * @return t
+ *         A pointer to a filled Time. 
+ */
+
+struct _time*
+newRawTime(int _hour, int _minute, int _second, int _ms)
+{
+  char* ts = (char*) malloc(sizeof(char) * MAX_TIME_STR_LEN);
+  if (ts == NULL )
+    {
+      return NULL ;
+    }
+
+  snprintf(ts, MAX_TIME_STR_LEN, "%02d:%02d:%02d.%03d", _hour, _minute, _second, _ms);
+
+  struct _time* t = newTime(ts);
+
+  free(ts);
+  ts = NULL;
+  return t;
+}
+
+
+/**
+ * @brief Copy the values and construct a new Time.
+ *
+ * @param  t
+ *         A pointer to struct _time. Values of t are used to initialize the new time being created. 
+ *
+ * @return _t
+ *         A pointer to an initialized Time object. 
+ */
+struct _time*
+constructAndCopyTime(struct _time* t)
+{
+  if ( t != NULL )
+    return newRawTime( t->hour, t->minute, t->second, t->ms );
+  else
+    return NULL;
+}
+
+
+/**
+ * @brief Destructor of Time.
+ *
+ * @param  t
+ *         A pointer to struct _time. t is deallocated.
+ */
+void
+deallocateTime(struct _time* t)
+{
+  if (t != NULL )
+    {
+      free(t);
+      t = NULL;
+    }
+}
+
+
+/*
+ * Internal and not doxyfied.
+ *
+ * @brief COPY a time object.
+ *
+ * Routine replaceTime copies the contents of source Time into a Destination Time object.
+ *
+ * @param  tsrc
+ *         A pointer to struct _time. Copy "FROM" time object.
+ *
+ * @param  tdest
+ *	  A pointer to struct _time. Copy "TO" time object.
+ *
+ * @return tdest
+ *         A pointer to 'copied' time Object.
+ */
+struct _time*
+replaceTime(struct _time* tsrc, struct _time* tdest)
+{
+  if ((tdest != NULL )&& (tsrc != NULL) ){
+  tdest->hour = tsrc->hour;
+  tdest->minute = tsrc->minute;
+  tdest->second = tsrc->second;
+  tdest->ms = tsrc->ms;
+
+  return tdest;
+}
+else
+{
+  return NULL;
+}
+}
+
+
+/**
+ * @brief Get time as a string.
+ *
+ * timetoString returns a string in IS08601 compliant (and extended) format.
+ *
+ * @param  t
+ *         A pointer to struct _time. The time to be converted to string.
+ *
+ * @param  toStr
+ *         A pointer to char. String where time is to be written.
+ *
+ * @return toStr
+ *         A pointer to the string containing time.
+ */
+char*
+timeToString(struct _time* t, char* toStr)
+{
+  if ((t != NULL )&& ( toStr != NULL ) ){
+  snprintf(toStr,MAX_TIME_STR_LEN,"%02d:%02d:%02d.%03dZ", t->hour, t->minute, t->second, t->ms);
+
+  return toStr;
+}
+else
+return NULL;
+}
diff --git a/src/OLD/timedelta.c b/src/OLD/timedelta.c
new file mode 100644
index 00000000..5e5ede05
--- /dev/null
+++ b/src/OLD/timedelta.c
@@ -0,0 +1,1310 @@
+/**
+ * @file timedelta.c
+ * 
+ * @brief TimeDelta and some operations supported on TimeDelta.
+ * 
+ * @author Luis Kornblueh, Rahul Sinha. MPIM.
+ * @date March 2013
+ * 
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "timedelta.h"
+#include "calendar.h"
+#include "julian_day.h"
+#include "datetime.h"
+#include "date.h"
+#include "time.h"
+#include "iso8601.h"
+
+/* #days in each month: Jan = 31, Feb = 28 ... */
+static const int month_days_leapyear[] =
+  { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+static const int month_days_365[] =
+  { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+static const int month_days_360[] =
+  { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 };
+
+/* Each row represents months 1,2,3..12; Each column entry is the number
+ of days after 0,1,2,3...12 months from the corresponding month. */
+static const int month_specific_delta_in_months_leapyear[12][13] =
+  {
+    { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 },
+    { 0, 29, 60, 90, 121, 151, 182, 213, 243, 274, 304, 335, 366 },
+    { 0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 337, 366 },
+    { 0, 30, 61, 91, 122, 153, 183, 214, 244, 275, 306, 335, 366 },
+    { 0, 31, 61, 92, 123, 153, 184, 214, 245, 276, 305, 336, 366 },
+    { 0, 30, 61, 92, 122, 153, 183, 214, 245, 274, 305, 335, 366 },
+    { 0, 31, 62, 92, 123, 153, 184, 215, 244, 275, 305, 336, 366 },
+    { 0, 31, 61, 92, 122, 153, 184, 213, 244, 274, 305, 335, 366 },
+    { 0, 30, 61, 91, 122, 153, 182, 213, 243, 274, 304, 335, 366 },
+    { 0, 31, 61, 92, 123, 152, 183, 213, 244, 274, 305, 336, 366 },
+    { 0, 30, 61, 92, 121, 152, 183, 213, 243, 274, 305, 335, 366 },
+    { 0, 31, 62, 91, 122, 152, 183, 213, 244, 275, 305, 336, 366 } };
+
+static const int month_specific_delta_in_months_365[12][13] =
+  {
+    { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+    { 0, 28, 59, 89, 120, 150, 181, 212, 242, 273, 303, 334, 365 },
+    { 0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 337, 365 },
+    { 0, 30, 61, 91, 122, 153, 183, 214, 244, 275, 306, 334, 365 },
+    { 0, 31, 61, 92, 123, 153, 184, 214, 245, 276, 304, 335, 365 },
+    { 0, 30, 61, 92, 122, 153, 183, 214, 245, 273, 304, 334, 365 },
+    { 0, 31, 62, 92, 123, 153, 184, 215, 243, 274, 304, 335, 365 },
+    { 0, 31, 61, 92, 122, 153, 184, 212, 243, 273, 304, 334, 365 },
+    { 0, 30, 61, 91, 122, 153, 181, 212, 242, 273, 303, 334, 365 },
+    { 0, 31, 61, 92, 123, 151, 182, 212, 243, 273, 304, 335, 365 },
+    { 0, 30, 61, 92, 120, 151, 182, 212, 242, 273, 304, 334, 365 },
+    { 0, 31, 62, 90, 121, 151, 182, 212, 243, 274, 304, 335, 365 } };
+
+static const int month_specific_delta_in_months_360[12][13] =
+  {
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 },
+    { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360 } };
+
+
+/**
+ * @brief Construct new TimeDelta using an ISO 8601 conforming string.
+ *
+ * @param  tds
+ *         A pointer to char. The string should contain parameters with which TimeDelta is to be created.
+ *
+ * @return td
+ *         A pointer to a filled TimeDelta. 
+ */
+struct _timedelta*
+newTimeDelta(const char* tds)
+{
+  if (tds != NULL )
+    {
+      /* Verify string is ISO8601 compliant. */
+      struct iso8601_duration* isoDuration = new_iso8601_duration('+', 0, 0, 0, 0, 0, 0, 0);
+      if (isoDuration == NULL )
+        return NULL ;
+
+      if (verify_string_duration(tds, isoDuration) != DURATION_MATCH)
+        {
+          deallocate_iso8601_duration(isoDuration);
+          return NULL ;
+        }
+
+      /* Create TimeDelta object. */
+      struct _timedelta* td = (struct _timedelta *) malloc(sizeof(struct _timedelta));
+      if (td == NULL )
+        {
+          deallocate_iso8601_duration(isoDuration);
+          return NULL ;
+        }
+
+      td->sign = isoDuration->sign;
+      td->year = isoDuration->year;
+      td->month = isoDuration->month;
+      td->day = isoDuration->day;
+      td->hour = isoDuration->hour;
+      td->minute = isoDuration->minute;
+      td->second = isoDuration->second;
+      td->ms = isoDuration->ms;
+
+      //Cleanup.
+      deallocate_iso8601_duration(isoDuration);
+
+      return td;
+    }
+  else
+    return NULL ;
+}
+
+/**
+ * @brief Construct new TimeDelta using 'raw' numerical values.
+ *
+ * @param  _sign
+ *         An char value denoting positive('+') or negative('-') TimeDelta. 
+ * @param  _year
+ *         An "int64_t" value denoting the year part of TimeDelta.
+ * @param  _month
+ *         An "int" value denoting the month part of TimeDelta.
+ * @param  _day
+ *         An "int" value denoting the day part of TimeDelta.
+ * @param  _hour
+ *         An "int" value denoting the hour part of TimeDelta.
+ * @param  _minute
+ *         An "int" value denoting the minute part of TimeDelta.
+ * @param  _second
+ *         An "int" value denoting the second part of TimeDelta.
+ * @param  _ms
+ *         An "int" value denoting the milli-second part of TimeDelta.
+ *
+ * @return td
+ *         A pointer to a filled TimeDelta. 
+ */
+
+struct _timedelta*
+newRawTimeDelta(char _sign, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int _ms)
+{
+  char* tds = (char*) malloc(sizeof(char) * MAX_TIMEDELTA_STR_LEN);
+  if (tds == NULL )
+    {
+      return NULL ;
+    }
+
+  snprintf(tds, MAX_TIMEDELTA_STR_LEN, "%cP%" PRIi64 "Y%02dM%02dDT%02dH%02dM%02d.%03dS", _sign, _year, _month, _day, _hour, _minute,
+      _second, _ms);
+
+  struct _timedelta* td = newTimeDelta(tds);
+
+  free(tds);
+  tds = NULL;
+
+  return td;
+}
+
+
+
+/**
+ * @brief Copy the values and construct a new TimeDelta.
+ *
+ * @param  td
+ *         A pointer to struct _timedelta. Values of td are used to initialize the new timedelta being created. 
+ *
+ * @return _td
+ *         A pointer to an initialized TimeDelta object. 
+ */
+
+
+struct _timedelta*
+constructAndCopyTimeDelta(struct _timedelta* td)
+{
+  if ( td != NULL )
+    return newRawTimeDelta(td->sign, td->year, td->month, td->day, td->hour, td->minute, td->second, td->ms);
+  else
+    return NULL;
+}
+
+
+/**
+ * @brief Destructor of TimeDelta.
+ *
+ * @param  td
+ *         A pointer to struct _timedelta. td is deallocated.
+ */
+
+void
+deallocateTimeDelta(struct _timedelta* td)
+{
+  if (td != NULL )
+    {
+      free(td);
+      td = NULL;
+    }
+}
+
+
+/*! \cond PRIVATE */
+/* Internal function. Test is year is a leap year. */bool
+testYearIsLeapYear(int64_t year)
+{
+  bool flag = false;
+
+  if (!(year % 400))
+    {
+      flag = true;
+    }
+  else if (!(year % 100))
+    {
+      flag = false;
+    }
+  else if (!(year % 4))
+    {
+      flag = true;
+    }
+  else
+    {
+      flag = false;
+    }
+
+  return flag;
+}
+
+
+/* Internal function. */
+/* Converts TimeDelta value to a lib defined juliandelta value. Juliadelta depends on the calendar type. 
+ Notice that TimeDelta is not uniquely defined but depends on the definition of corresponding DateTime.
+
+ The library assumes the following definition: Let A denote an anchor date and P a timedelta. For a 
+ positive P, A + P = B where date B > A. Consequently, for a negative P, A + P = B where A > B. 
+ Also, when P is positive, a delta of 1 month has as many days as in the month of anchor DateTime;
+ a delta of 2 months corresponds to the number of days in the anchor date month and the next month and 
+ so on. When P is negative, a delta of 1 month corresponds to as many days as in the month before the
+ anchor date month; a delta of 2 month corresponds to as many days as in the month before the
+ anchor date month and the month before that and so on. 
+ 
+ For eg, TimeDelta of P01M, when the 'Anchor' DateTime is 2001-02-01T00:00:00.000 is equivalent to a
+ Julian Delta of positive 28 days ( #days in February ) and 0 ms. Also, TimeDelta of P02M, when the 
+ 'Anchor' DateTime is 2001-02-01T00:00:00.000 is equivalent to a Julian Delta of positive 28+31 days
+ ( #days in February PLUS #days in March) and 0 ms. Similarly, a TimeDelta of -P01M with 'Anchor' 
+ DateTime of 2001-02-01T00:00:00.000 is equivalent to a Julian Delta of negative 31 days 
+ ( #days in January ) and 0 ms. Likewise, TimeDelta of -P02M with 'Anchor' DateTime of 
+ 2001-02-01T00:00:00.000 is equivalent to a Julian Delta of negative 31+31 days ( #days in January
+ PLUS #days in December) and 0 ms.
+ */
+
+struct _juliandelta*
+timeDeltaToJulianDelta(struct _timedelta* td, struct _datetime* base_dt, struct _juliandelta* jd_return)
+{
+  if ((td != NULL) && (base_dt != NULL) && (jd_return != NULL)){
+
+  /* Reset initial delta to 0.*/
+  jd_return->day = 0;
+  jd_return->ms = 0;
+  /* No of days in a year. */
+  int ndiny;
+  /* Pointer to an array of month_specific_delta_in_months. */
+  const int (*msdinm)[13];
+
+  /* Set parameters according to calendar type. */
+  switch (getCalendarType())
+    {
+      case YEAR_OF_365_DAYS:
+
+      msdinm = month_specific_delta_in_months_365;
+      ndiny = 365;
+      break;
+
+      case YEAR_OF_360_DAYS:
+
+      msdinm = month_specific_delta_in_months_360;
+      ndiny = 360;
+      break;
+
+      case PROLEPTIC_GREGORIAN:
+      /* Gregorian will have 366 days and 365 days depending on Leap year. */
+
+      if ( td->sign == '+' )
+        {
+          jd_return->sign = '+';
+
+          /* In final year. The crucial point is the month of february. */
+          if (
+              ( (testYearIsLeapYear(base_dt->date.year + td->year + 1) ) && (base_dt->date.month >= 3) )
+              ||
+              ( (testYearIsLeapYear(base_dt->date.year + td->year) ) && (base_dt->date.month < 3) )
+          )
+            {
+              /* If the base year + delta year is a year before a leap year and base month is >= 3 
+               OR 
+               base year + delta year is a leap year and month is < 3
+               => An addition of leap-year specific delta for each month.
+               */
+              msdinm = month_specific_delta_in_months_leapyear;
+              ndiny = 366;
+            }
+          else
+            {
+              /*Otherwise addition of non-leap year specific month.*/
+              msdinm = month_specific_delta_in_months_365;
+              ndiny = 365;
+            }
+
+          int i = 0;
+          /* The year from base date to base_date + delta years -1 */
+          for (i = base_dt->date.year; i < base_dt->date.year + td->year; i++)
+            {
+              if (
+                  ((testYearIsLeapYear(i + 1)) && (base_dt->date.month >= 3))
+                  ||
+                  ((testYearIsLeapYear(i)) && (base_dt->date.month < 3))
+              )
+                {
+                  /* If the next year is a leap year and month is >= 3 OR 
+                   this year is a leap year and month is less than 3 
+                   => delta of 1 year corresponds to 366 day julian delta. 
+                   */
+                  jd_return->day = jd_return->day + 366;
+                }
+              else
+                {
+                  /* Otherwise. */
+                  jd_return->day = jd_return->day + 365;
+                }
+            }
+
+          jd_return->day = jd_return->day + (msdinm[base_dt->date.month - 1][td->month]);
+          jd_return->day = jd_return->day + td->day;
+          jd_return->ms = td->hour * 3600000 + td->minute * 60000 + td->second * 1000 + td->ms;
+        }
+      else if ( td->sign == '-' )
+        {
+          jd_return->sign = '-';
+
+          /* In final year. The crucial point is the month of february. */
+          if (
+              ((testYearIsLeapYear(base_dt->date.year - td->year - 1)) && (base_dt->date.month < 3))
+              ||
+              ((testYearIsLeapYear(base_dt->date.year - td->year)) && (base_dt->date.month >= 3)))
+            {
+              /* If the base year - delta year is a year after leap year and base month is < 3 
+               OR 
+               base year - delta year is a leap year and month is >= 3
+               => A substraction of leap-year specific delta for each month.
+               */
+              msdinm = month_specific_delta_in_months_leapyear;
+              ndiny = 366;
+            }
+          else
+            {
+              /* Otherwise. */
+              msdinm = month_specific_delta_in_months_365;
+              ndiny = 365;
+            }
+
+          int i = 0;
+          /* The year from base date to base_date - delta years + 1 */
+          for (i = base_dt->date.year; i > base_dt->date.year - td->year; i--)
+            {
+              if (
+                  ( (testYearIsLeapYear(i - 1)) && (base_dt->date.month < 3) )
+                  ||
+                  ( (testYearIsLeapYear(i)) && (base_dt->date.month >= 3) )
+              )
+                {
+                  /* If the previous year is a leap year and month is < 3 OR 
+                   this year is a leap year and month is >= 3 
+                   => delta of 1 year corresponds to 366 day julian delta. 
+                   */
+                  jd_return->day = jd_return->day - 366;
+                }
+              else
+                {
+                  /* Otherwise. */
+                  jd_return->day = jd_return->day - 365;
+                }
+            }
+          jd_return->day = jd_return->day - (ndiny - msdinm[base_dt->date.month - 1][12 - td->month]);
+          jd_return->day = jd_return->day - td->day;
+          jd_return->ms = (-1)*td->hour * 3600000 - td->minute * 60000 - td->second * 1000 - td->ms;
+
+        }
+      else
+      return NULL; /* ERROR: Sign not set. */
+
+      return jd_return;
+
+      default:
+      return NULL /* Calendar type not set. */;
+    }
+
+  /* Calender type is 360 or 365.*/
+  if ( td->sign == '-' )
+    {
+      /* Negative TimeDelta. */
+
+      jd_return->sign = '-';
+      /* Year. */
+      jd_return->day = (-1) * td->year * ndiny;
+      /* Month. */
+      jd_return->day = jd_return->day - (ndiny - msdinm[base_dt->date.month - 1][12 - td->month]);
+      /* Day. */
+      jd_return->day = jd_return->day + (-1) * td->day;
+      /* Rest. */
+      jd_return->ms = (-1) * td->hour * 3600000 + (-1) * td->minute * 60000 + (-1) * td->second * 1000 + (-1) * td->ms;
+    }
+  else if ( td->sign == '+' )
+    {
+      /* Positive TimeDelta. */
+
+      jd_return->sign = '+';
+      /* Year.  */
+      jd_return->day = td->year * ndiny;
+      /* Month. No of days in a TimeDelta depends on Base date.*/
+      jd_return->day = jd_return->day + (msdinm[base_dt->date.month - 1][ td->month ]);
+      /* Day. */
+      jd_return->day = jd_return->day + td->day;
+      /* Rest. */
+      jd_return->ms = td->hour * 3600000 + td->minute * 60000 + td->second * 1000 + td->ms;
+    }
+  else
+  return NULL; /* ERROR: TD sign not defined. */
+
+  return jd_return;
+}
+else
+return NULL;
+}
+
+  /* Internal function. */
+  /* Converts a lib defined Julian delta value to a TimeDelta value. TimeDelta depends on the calendar type. 
+   Notice that TimeDelta is not uniquely defined but depends on the definition of corresponding DateTime.
+
+   The library assumes the following definition: Let A denote an anchor date and P a timedelta. For a 
+   positive P, A + P = B where date B > A. Consequently, for a negative P, A + P = B where A > B. 
+   Also, when P is positive, a delta of 1 month has as many days as in the month of anchor DateTime;
+   a delta of 2 months corresponds to the number of days in the anchor date month and the next month and 
+   so on. When P is negative, a delta of 1 month corresponds to as many days as in the month before the
+   anchor date month; a delta of 2 month corresponds to as many days as in the month before the
+   anchor date month and the month before that and so on. 
+   
+   For eg, TimeDelta of P01M, when the 'Anchor' DateTime is 2001-02-01T00:00:00.000 is equivalent to a
+   Julian Delta of positive 28 days ( #days in February ) and 0 ms. Also, TimeDelta of P02M, when the 
+   'Anchor' DateTime is 2001-02-01T00:00:00.000 is equivalent to a Julian Delta of positive 28+31 days
+   ( #days in February PLUS #days in March) and 0 ms. Similarly, a TimeDelta of -P01M with 'Anchor' 
+   DateTime of 2001-02-01T00:00:00.000 is equivalent to a Julian Delta of negative 31 days 
+   ( #days in January ) and 0 ms. Likewise, TimeDelta of -P02M with 'Anchor' DateTime of 
+   2001-02-01T00:00:00.000 is equivalent to a Julian Delta of negative 31+31 days ( #days in January
+   PLUS #days in December) and 0 ms.
+   */
+
+struct _timedelta*
+julianDeltaToTimeDelta(struct _juliandelta* jd, struct _datetime* base_dt, struct _timedelta* td_return)
+{
+  if ((jd != NULL) && (base_dt != NULL) && (td_return != NULL)){
+  int i = 0;
+  /* No of days in a year. */
+  int ndiny;
+
+  /* Pointer to an array of no of days in month. */
+  const int* month_days;
+  /* Pointer to an array of month_specific_delta_in_months. */
+  const int (*msdinm)[13];
+
+  /* Set parameter according to calender. */
+  switch (getCalendarType())
+    {
+      case YEAR_OF_365_DAYS:
+
+      month_days = month_days_365;
+      msdinm = month_specific_delta_in_months_365;
+      ndiny = 365;
+      break;
+
+      case YEAR_OF_360_DAYS:
+
+      month_days = month_days_360;
+      msdinm = month_specific_delta_in_months_360;
+      ndiny = 360;
+      break;
+
+      case PROLEPTIC_GREGORIAN:
+
+      /* Gregorian will have 366 days and 365 days depending on Leap year. */
+
+      if ( jd->sign == '-' )
+        {
+          td_return->sign = '-';
+
+          /* No of days in the final year */
+          int delta_final_year;
+          int64_t days = (-1)*jd->day;
+          /* Set counter to base year and then jump forward to get to the final year.
+           For each loop forward, increment year by 1.
+           */
+          int j = base_dt->date.year;
+          /* Reset. */
+          td_return->year = 0;
+          while (days >= 0)
+            {
+
+              /* Loop over and get to the final year by substracting 366/365 days depending
+               on leap/non-leap year. For each substraction, increment year by 1.  
+               */
+
+              /* The crucial point is month of february. */
+              delta_final_year = days;
+              if (
+                  ( (testYearIsLeapYear(j + 1)) && (base_dt->date.month >= 3) )
+                  ||
+                  ( (testYearIsLeapYear(j)) && (base_dt->date.month < 3) )
+              )
+                {
+                  /* If next year is leap year and base month is >= 3 
+                   OR 
+                   this year is a leap year and month is < 3
+                   => delta of 1 year corresponds to 366 day julian delta.  
+                   */
+                  days = days - 366;
+                }
+              else
+                {
+                  /* Otherwise. */
+                  days = days - 365;
+                }
+              td_return->year++;
+              j++;
+            }
+          /* The loop ran one time too much. */
+          if (days < 0)
+            {
+              td_return->year--;
+              j--;
+            }
+
+          /* In final year. The crucial point is the month of february. */
+          if (
+              ( (testYearIsLeapYear(j + 1)) && (base_dt->date.month >= 3) )
+              ||
+              ( (testYearIsLeapYear(j)) && (base_dt->date.month < 3) )
+          )
+            {
+              /* If final year's next year is a leap year and base month is >= 3 
+               OR 
+               final year is a leap year and month is < 3
+               => An addition of leap-year specific delta for each month.
+               */
+              month_days = month_days_leapyear;
+              msdinm = month_specific_delta_in_months_leapyear;
+              ndiny = 366;
+            }
+          else
+            {
+              /* Otherwise. */
+              month_days = month_days_365;
+              msdinm = month_specific_delta_in_months_365;
+              ndiny = 365;
+            }
+
+          for (i = 1; i <= 12; i++)
+            {
+              if (delta_final_year < msdinm[base_dt->date.month - 1][i])
+                {
+                  /* Month  */
+                  td_return->month = i - 1;
+                  /* Day. */
+                  td_return->day = delta_final_year - msdinm[base_dt->date.month - 1][i - 1];
+                  break;
+                }
+            }
+
+          /* Time. */
+          td_return->hour = ( (-1)* jd->ms ) / 3600000;
+          td_return->minute = ( (-1)*jd->ms - td_return->hour * 3600000) / 60000;
+          td_return->second = ( (-1)*jd->ms - td_return->hour * 3600000 - td_return->minute * 60000) / 1000;
+          td_return->ms = (-1)*jd->ms - td_return->hour * 3600000 - td_return->minute * 60000 - td_return->second * 1000;
+        }
+      else if (jd->sign == '+')
+        {
+          td_return->sign = '+';
+
+          /* No days in the final year. */
+          int delta_final_year;
+          int64_t days = jd->day;
+          /* Set counter to base year and then loop back to get to the final year.
+           For each loop back, increment year by 1.
+           */
+          int j = base_dt->date.year;
+          /* Reset */
+          td_return->year = 0;
+          while (days >= 0)
+            {
+              /* Loop over and get the year by substracting 366/365 days depending
+               on leap/non-leap year. For each substraction, increment year by 1.  
+               */
+
+              /* The crucial point is month of february. */
+              delta_final_year = days;
+              if (
+                  ( (testYearIsLeapYear(j - 1)) && (base_dt->date.month < 3) )
+                  ||
+                  ( (testYearIsLeapYear(j)) && (base_dt->date.month >= 3) )
+              )
+                {
+                  /* If previous year is leap year and base month is < 3 
+                   OR 
+                   this year is a leap year and month is >= 3
+                   => delta of 1 year corresponds to 366 day julian delta.  
+                   */
+                  days = days - 366;
+                }
+              else
+                {
+                  /* Otherwise. */
+                  days = days - 365;
+                }
+
+              td_return->year++;
+              j--;
+            }
+          /* The loop ran one time too much. */
+          if (days < 0)
+            {
+              td_return->year--;
+              j++;
+            }
+
+          /* In final year. The crucial point is the month of february. */
+          if (
+              ( (testYearIsLeapYear(j - 1)) && (base_dt->date.month < 3) )
+              ||
+              ( (testYearIsLeapYear(j)) && (base_dt->date.month >= 3) )
+          )
+            {
+              /* If final year is a leap year and base month is >= 3 
+               OR 
+               final year's previous year is a leap year and month is < 3
+               => An addition of leap-year specific delta for each month.
+               */
+              month_days = month_days_leapyear;
+              msdinm = month_specific_delta_in_months_leapyear;
+              ndiny = 366;
+            }
+          else
+            {
+              /* Otherwise. */
+              month_days = month_days_365;
+              msdinm = month_specific_delta_in_months_365;
+              ndiny = 365;
+            }
+
+          for (i = 12; i > 0; i--)
+            {
+              if (delta_final_year < (ndiny - msdinm[base_dt->date.month - 1][i - 1]))
+                {
+                  /* Month */
+                  td_return->month = 12 - i;
+                  /* Day.  */
+                  td_return->day = delta_final_year - (ndiny - msdinm[base_dt->date.month - 1][i]);
+                  break;
+                }
+            }
+
+          /* Time */
+          td_return->hour = jd->ms / 3600000;
+          td_return->minute = (jd->ms - td_return->hour * 3600000) / 60000;
+          td_return->second = (jd->ms - td_return->hour * 3600000 - td_return->minute * 60000) / 1000;
+          td_return->ms = jd->ms - td_return->hour * 3600000 - td_return->minute * 60000 - td_return->second * 1000;
+        }
+
+      return td_return;
+
+      default:
+      return NULL; /* Calender type not defined. */
+    }
+
+  /* 360 and 365 day calendars */
+  if (jd->sign == '+')
+    {
+      /* Positive delta.*/
+      td_return->sign = '+';
+
+      /* Year. */
+      td_return->year = jd->day / ndiny;
+
+      int delta_final_year = jd->day % ndiny;
+
+      for (i = 12; i > 0; i--)
+        {
+          if (delta_final_year < (ndiny - msdinm[base_dt->date.month - 1][i - 1]))
+            {
+              /* Month. */
+              td_return->month = 12 - i;
+              /* Day. */
+              td_return->day = delta_final_year - (ndiny - msdinm[base_dt->date.month - 1][i]);
+              break;
+            }
+        }
+
+      /* Time. */
+      td_return->hour = jd->ms / 3600000;
+      td_return->minute = (jd->ms - td_return->hour * 3600000) / 60000;
+      td_return->second = (jd->ms - td_return->hour * 3600000 - td_return->minute * 60000) / 1000;
+      td_return->ms = jd->ms - td_return->hour * 3600000 - td_return->minute * 60000 - td_return->second * 1000;
+    }
+  else if (jd->sign == '-')
+    {
+      /* Negative delta. */
+      td_return->sign = '-';
+
+      /* Year. */
+      td_return->year = ((-1)*jd->day) / ndiny;
+
+      int delta_final_year = ((-1)*jd->day) % ndiny;
+
+      for (i = 1; i <= 12; i++)
+        {
+          if (delta_final_year < msdinm[base_dt->date.month - 1][i])
+            {
+              /* Month. */
+              td_return->month = i - 1;
+              /* Day.  */
+              td_return->day = delta_final_year - msdinm[base_dt->date.month - 1][i - 1];
+              break;
+            }
+        }
+
+      /* Time. */
+      td_return->hour = (-1)*jd->ms / 3600000;
+      td_return->minute = ((-1)*jd->ms - td_return->hour * 3600000) / 60000;
+      td_return->second = ((-1)*jd->ms - td_return->hour * 3600000 - td_return->minute * 60000) / 1000;
+      td_return->ms = (-1)*jd->ms - td_return->hour * 3600000 - td_return->minute * 60000 - td_return->second * 1000;
+    }
+  else
+  return NULL; /* ERROR: Sign of julian delta not defined. */
+
+  return td_return;
+}
+else
+return NULL;
+}
+/*! \endcond */
+
+/**
+ * @brief Get the TimeDelta between two Dates d1 and d2 as (d1-d2).
+ *
+ * Routine getTimeDeltaFromDate 'substracts' two Dates and returns the TimeDelta between
+ * them. Internally, Dates are converted to DateTimes and then delta is calculated using 
+ * getTimeDeltaFromDateTime().
+ * 
+ * This routine  handles all supported Calendar types; i.e. the translation from Calendar date 
+ * to Julian date and conversion from Julian Delta to normal TimeDetla is Calendar-type dependent. 
+ * For eg. for Calendar type Gregorian, the TimeDelta between 2001-02-01 and 2001-01-01 will be 1 month. 
+ * Similarly, for Calendar of type 360-Day-Calendar, the TimeDelta will be 1 month. It must be noted 
+ * however, that the two dates differ by 31 and 30 days respectively.
+ *
+ * @param  d1
+ *         A pointer to struct _date. 
+ *
+ * @param  d2
+ *         A pointer to struct _date.
+ *
+ * @param  td_return
+ *         A pointer to struct _timedelta. Copy the result of (d1 - d2) in td_return.
+ *
+ * @return td_return
+ *         A pointer to TimeDelta containing the result of substraction.
+ */
+
+struct _timedelta*
+getTimeDeltaFromDate(struct _date* d1, struct _date* d2, struct _timedelta* td_return)
+{
+  if ((d1 != NULL )&& (d2 != NULL) && (td_return != NULL) ){
+  /* Convert Date to datetime and resuse the DateTime interface to calculate time delta. */
+  struct _datetime *dt1 = newDateTime("0-01-01T00:00:00.000");
+  if (dt1 == NULL)
+  return NULL;
+  dt1 = convertDateToDateTime(d1, dt1);
+
+  struct _datetime *dt2 = newDateTime("0-01-01T00:00:00.000");
+  if ( dt2 == NULL )
+    {
+      deallocateDateTime(dt1);
+      return NULL;
+    }
+  dt2 = convertDateToDateTime(d2, dt2);
+
+  /* Call the Datetime function to get TD. */
+  td_return = getTimeDeltaFromDateTime(dt1,dt2,td_return);
+
+  /* Cleanup. */
+  deallocateDateTime(dt1);
+  deallocateDateTime(dt2);
+
+  return td_return;
+}
+else
+return NULL;
+}
+
+/**
+ * @brief Get total number of milliseconds in timedelta (Absolute value).
+ *
+ * Routine getTotalMilliSecondsTimeDelta returns the total number of milliseconds in TimeDelta. 
+ * Notice that TimeDelta is not uniquely defined but depends on the definition of corresponding 
+ * DateTime. TimeDelta is first converted to corresponding delta on the Julian axis. Julian delta 
+ * is finally converted to the correct millisecond value. Notice that the routine returns absolute
+ * value of timedelta in milliseconds.
+ *
+ * @param  td
+ *         A pointer to struct _timedelta. Retrieve the number of milliseconds in this TD object.
+ *
+ * @param  base_dt
+ *         A pointer to struct _datetime. Reference Datetime for the TD.
+ *
+ * @return totalmilliSeconds
+ *         Integer (absolute) value of totalmilliSeconds. -1 indicates error.
+ */
+int64_t
+getTotalMilliSecondsTimeDelta(struct _timedelta* td, struct _datetime* base_dt)
+{
+  if ((td != NULL )&& (base_dt != NULL) ){
+  //TODO CRITICAL: Range Check.
+  int64_t totalmilliSeconds = 0;
+
+  struct _juliandelta* jd = newJulianDelta('+', 0, 0);
+  if ( jd == NULL )
+    return -1;
+  jd = timeDeltaToJulianDelta(td, base_dt, jd);
+  if ( jd == NULL )
+    {
+      deallocateJulianDelta(jd);
+      return -1;
+    }
+  totalmilliSeconds = jd->day * 86400000 + jd->ms;
+
+  /* Return absolute value.*/
+  if (totalmilliSeconds < 0) 
+    {
+      totalmilliSeconds =  -totalmilliSeconds;
+    }
+
+  deallocateJulianDelta(jd);
+
+  return totalmilliSeconds;
+}
+else
+return -1;
+}
+
+  /**
+   * @brief Get total number of seconds in timedelta (Absolute value).
+   *
+   * Routine getTotalSecondsTimeDelta returns the total number of seconds in TimeDelta. Notice that TimeDelta 
+   * is not uniquely defined but depends on the definition of corresponding DateTime. Internally, number of seconds
+   * is calculated by calling the routine function_totalmilliSeconds and then converting the millisecond value 
+   * to seconds by dividing it by 1000. Notice that the routine returns Absolute value of timedelta in seconds.
+   *
+   * @param  td
+   *         A pointer to struct _timedelta. Retrieve the number of seconds in this TD object.
+   *
+   * @param  base_dt
+   *         A pointer to struct _datetime. Reference Datetime for the TD.
+   *
+   * @return totalSeconds
+   *         Integer (absolute) value of totalSeconds. -1 indicates error.
+   */
+
+//TODO: Range check. Also notice that the range check here will depend on getTotalMilliSecondsTimeDelta!
+int64_t
+getTotalSecondsTimeDelta(struct _timedelta* td, struct _datetime* base_dt)
+{
+  if ((td != NULL )&& (base_dt != NULL) ){
+  return getTotalMilliSecondsTimeDelta(td, base_dt)/1000;
+}
+else
+return -1;
+}
+
+/**
+* @brief Get TimeDelta as a string.
+*
+* timedeltaToString returns a string in IS08601 compliant (and extended) format.
+*
+* @param  td
+*         A pointer to struct _timedelta. The timedelta to be converted to string.
+*
+* @param  toStr
+*         A pointer to char. String where timedelta is to be written.
+*
+* @return toStr
+*         A pointer to the string containing timedelta.
+*/
+char *
+timedeltaToString(struct _timedelta* td, char* toStr)
+{
+if ((td != NULL )&& (toStr != NULL) ){
+/* Return only non-negative values. */
+
+if (td->sign == '-')
+sprintf(toStr,"%cP",td->sign);
+else if (td->sign == '+')
+strcpy (toStr,"P");
+else
+return NULL; /*ERROR: TD sign not set. */
+
+if (td->year != 0)
+{
+sprintf(&(toStr[strlen(toStr)]),"%" PRIi64 "Y",td->year);
+}
+if (td->month != 0)
+{
+sprintf(&(toStr[strlen(toStr)]),"%02dM",td->month);
+}
+if (td->day != 0)
+{
+sprintf(&(toStr[strlen(toStr)]),"%02dD",td->day);
+}
+
+sprintf(&(toStr[strlen(toStr)]),"T");
+
+if (td->hour != 0)
+{
+sprintf(&(toStr[strlen(toStr)]),"%02dH",td->hour);
+}
+if (td->minute != 0)
+{
+sprintf(&(toStr[strlen(toStr)]),"%02dM",td->minute);
+}
+if ((td->second != 0) || (td->ms != 0))
+{
+sprintf(&(toStr[strlen(toStr)]),"%02d.%03dS",td->second,td->ms);
+}
+
+//Discard T if all time values are 0.
+if(toStr[strlen(toStr)-1] == 'T')
+{
+toStr[strlen(toStr)-1] = '\0';
+}
+//Return P00.000S if all delta values are 0.
+if(toStr[strlen(toStr)-1] == 'P')
+{
+strcat(toStr,"00.000S");
+}
+
+return toStr;
+}
+else
+return NULL;
+}
+
+/**
+* @brief Add timedelta to Date.
+*
+* Routine addTimeDeltaToDate adds a timedelta to a Date and returns the new Date. Both Date 
+* and TimeDetla are first converted to corresponding values on the Julian axis. Addition is performed on
+* the julian axis and the resulting Julian Date is converted back to the corrsponding Date. 
+*
+* The library assumes the following definition: Let A denote an anchor date and P a timedelta. For a 
+* positive P, A + P = B where date B > A. Consequently, for a negative P, A + P = B where A > B. 
+* Also, when P is positive, a delta of 1 month has as many days as in the month of anchor DateTime;
+* a delta of 2 months corresponds to the number of days in the anchor date month and the next month and 
+* so on. When P is negative, a delta of 1 month corresponds to as many days as in the month before the
+* anchor date month; a delta of 2 month corresponds to as many days as in the month before the
+* anchor date month and the month before that and so on.
+*
+* @param  d
+*         A pointer to struct _date. The base date.
+*
+* @param  td
+*         A pointer to struct _timedelta. The time delta to be added to d.
+*
+* @param  d_return
+*         A pointer to struct _date. The result of addition is copied here.
+*
+* @return d_return
+*         A pointer to the struct _date contianing the result of addition.
+*/
+
+struct _date *
+addTimeDeltaToDate(struct _date* d, struct _timedelta* td, struct _date* d_return)
+{
+if ((d != NULL )&& (td != NULL) && (d_return != NULL) ){
+/* Convert Date to Datetime and reuse the DateTime interface for Calculating the sum.*/
+struct _datetime *dt = newDateTime("0-01-01T00:00:00.000");
+if ( dt == NULL )
+return NULL;
+
+dt = convertDateToDateTime(d, dt);
+
+struct _datetime *dt_return = newDateTime("0-01-01T00:00:00.000");
+if ( dt_return == NULL )
+return NULL;
+
+/* Call the DateTime interface to calculate the new Datetime. */
+dt_return = addTimeDeltaToDateTime(dt,td, dt_return);
+
+/* Get Date from Datetime. */
+d_return = convertDateTimeToDate(dt_return, d_return);
+
+deallocateDateTime(dt);
+deallocateDateTime(dt_return);
+
+return d_return;
+}
+else
+return NULL;
+}
+
+/**
+* @brief Add timedelta to DateTime.
+*
+* Routine addTimeDeltaToDateTime adds a timedelta to a DateTime and returns the new DateTime. Both DateTime 
+* and TimeDetla are first converted to corresponding values on the Julian axis. Addition is performed on
+* the julian axis and the resulting Julian Date is converted back to the corrsponding DateTime.
+*
+* The library assumes the following definition: Let A denote an anchor date and P a timedelta. For a 
+* positive P, A + P = B where date B > A. Consequently, for a negative P, A + P = B where A > B. 
+* Also, when P is positive, a delta of 1 month has as many days as in the month of anchor DateTime;
+* a delta of 2 months corresponds to the number of days in the anchor date month and the next month and 
+* so on. When P is negative, a delta of 1 month corresponds to as many days as in the month before the
+* anchor date month; a delta of 2 month corresponds to as many days as in the month before the
+* anchor date month and the month before that and so on.
+*
+* @param  dt
+*         A pointer to struct _datetime. The base datetime.
+*
+* @param  td
+*         A pointer to struct _timedelta. The time delta to be added to dt.
+*
+* @param  dt_return
+*         A pointer to struct _datetime. The result of addition is copied here.
+*
+* @return dt_return
+*         A pointer to the struct _datetime contianing the result of addition.
+*/
+
+struct _datetime*
+addTimeDeltaToDateTime(struct _datetime* dt, struct _timedelta* td, struct _datetime* dt_return)
+{
+if ((dt != NULL )&& (td != NULL) && (dt_return != NULL) ){
+/* Convert base datetime to Julian. */
+struct _julianday* jd1 = newJulianDay(0, 0);
+if ( jd1 == NULL)
+return NULL;
+jd1 = date2julian(dt, jd1);
+
+/* Get julian delta. */
+struct _juliandelta* jd2 = newJulianDelta('+', 0, 0);
+if ( jd2 == NULL )
+{
+deallocateJulianDay(jd1);
+return NULL;
+}
+
+jd2 = timeDeltaToJulianDelta(td, dt, jd2);
+
+struct _julianday* jd = newJulianDay(0, 0);
+if ( jd == NULL )
+{
+deallocateJulianDay(jd1);
+deallocateJulianDelta(jd2);
+return NULL;
+}
+
+if ( td->sign == '+' )
+{
+jd = addJulianDelta(jd1, jd2, jd);
+}
+else if ( td->sign == '-' )
+{
+jd = substractJulianDelta(jd1, jd2, jd);
+}
+else
+return NULL; /* ERROR: Sign of timedelta is not defined. */
+
+/* Get the Datetime */
+dt_return = julian2date(jd, dt_return);
+
+deallocateJulianDay(jd1);
+deallocateJulianDelta(jd2);
+deallocateJulianDay(jd);
+
+return dt_return;
+}
+else
+return NULL;
+}
+
+/**
+* @brief Get the timedelta between current_dt and start_dt plus next integral-multiple-of-timestep (timedelta).
+*
+* Routine moduloTimeDeltaFromDateTime returns the timedelta between the current DateTime (current_dt) and the event's next-trigger time.
+* The next trigger time is defined as the the Anchor DateTime (start_dt) + N * TimeDelta(timestep) 
+* where N is the minimum positive integer for which this sum is >= Current DateTime. In case 
+* Anchor DateTime > Current DateTime, TimeDelta is calculated as start_dt - current_dt.
+* 
+* Notice that this TimeDelta will always be positive.
+*
+* @param  start_dt
+*         A pointer to struct _datetime. The base datetime.
+*
+* @param  timestep
+*         A pointer to struct _timedelta. delta between two consecutive triggers.
+*
+* @param  current_dt
+*         A pointer to struct _datetime. The Current Date time.
+*
+* @param  modulo_td
+*         A pointer to struct _timedelta. The timedelta between 'current datetime' and 'Start Datetime plus next integral-multiple-of-timestep' is copied here.
+*
+* @return modulo_td
+*         A pointer to the struct _timedelta contianing the modulo timedelta. If Start time is in the future, returns on start_time - current_time.
+*/
+
+struct _timedelta*
+moduloTimeDeltaFromDateTime(struct _datetime* start_dt, struct _timedelta* timestep, struct _datetime* current_dt, struct _timedelta* modulo_td)
+{
+  if ((start_dt != NULL )&& (timestep != NULL) && (current_dt != NULL) && (modulo_td != NULL) ){
+  struct _datetime* dt_tmp = newDateTime("0-01-01T00:00:00.000");
+  if ( dt_tmp == NULL )
+  return NULL;
+
+  if (compareDatetime(start_dt,current_dt)==(-1))
+    {
+      /* Loop over */
+      replaceDatetime(start_dt,dt_tmp);
+      while(compareDatetime((dt_tmp = addTimeDeltaToDateTime(dt_tmp,timestep,dt_tmp)),current_dt) < 0);
+
+      /* Return n*dt_tmp - current_dt */
+      modulo_td = getTimeDeltaFromDateTime(dt_tmp,current_dt,modulo_td);
+    }
+  else
+    {
+      /* Start time is in the future, return start_time - current_time. */
+      modulo_td = getTimeDeltaFromDateTime(start_dt,current_dt,modulo_td);
+    }
+
+  deallocateDateTime(dt_tmp);
+
+  return modulo_td;
+  }
+  else
+    return NULL;
+}
+
+
+
+struct _timedelta*
+elementwiseScalarMultiplyTimeDelta(struct _timedelta* base_td, int64_t lambda, struct _timedelta* scaled_td)
+{
+  if ((base_td != NULL) && (scaled_td != NULL) )
+    {
+      /*Reset scaled_td to 0.*/
+      memset(scaled_td,0,sizeof(struct _timedelta));
+
+      /* Scalar can be positive or negative. */
+      if ( (lambda < 0) && (base_td->sign == '+') || (lambda > 0) && (base_td->sign == '-'))
+        scaled_td->sign = '-';
+      else
+        scaled_td->sign = '+';
+
+      /* Sign already handled above. Make lambda positive.  */
+      if (lambda < 0)
+        lambda *= -1;
+
+
+      /* Multiply each element by scalar.*/
+
+      scaled_td->ms += lambda*base_td->ms;
+      while ( scaled_td->ms >= 1000 )
+        {
+	  scaled_td->ms -= 1000;
+	  scaled_td->second += 1;
+	}
+ 
+      scaled_td->second += lambda*base_td->second;
+      while ( scaled_td->second >= 60 )
+        {       
+          scaled_td->second -= 60;
+          scaled_td->minute += 1;
+        }
+   
+      scaled_td->minute += lambda*base_td->minute;
+      while ( scaled_td->minute >= 60 )
+        {
+          scaled_td->minute -= 60;
+          scaled_td->hour += 1;
+        }
+
+     scaled_td->hour += lambda*base_td->hour;
+     while ( scaled_td->hour >= 24 )
+       {
+         scaled_td->hour -= 24;
+         scaled_td->day += 1;
+       }
+
+     //TODO: day crossing the month is pathological. Discuss with LUIS.
+     /*TODO: WARNING: This part of code has to be fixed.*/
+     scaled_td->day += lambda*base_td->day;
+     while ( scaled_td->day >= 60 )
+       {
+         scaled_td->day -= 60;
+         scaled_td->month += 1;
+       }
+
+     scaled_td->month += lambda*base_td->month;
+     while ( scaled_td->month >= 12 )
+       {
+         scaled_td->month -= 12;
+         scaled_td->year += 1;
+       }
+    
+      scaled_td->year += lambda*base_td->year;
+
+      return scaled_td;
+    }
+  else
+    return NULL;
+}
+
+
+struct _timedelta*
+elementwiseAddTimeDeltatoTimeDelta(struct _timedelta* td1, struct _timedelta* td2,  struct _timedelta* td_return)
+{
+  if ( (td1 != NULL) && (td2 != NULL) && (td_return != NULL) )
+    {
+      /*Reset td_return to 0.*/
+      memset(td_return,0,sizeof(struct _timedelta));
+      
+      if(td1->sign == td2->sign)
+        {
+          /* If signs match, do add. */
+          td_return->sign = td1->sign;
+
+          td_return->ms += (td1->ms + td2->ms);  
+          if ( td_return->ms >= 1000 )
+            {
+              td_return->ms -= 1000;
+              td_return->second += 1;
+            }
+
+          td_return->second += (td1->second + td2->second);
+          if ( td_return->second >= 60 )
+            {
+              td_return->second -= 60;
+              td_return->minute += 1;
+            }
+
+          td_return->minute += (td1->minute + td2->minute);
+          if ( td_return->minute >= 60 )
+            {
+              td_return->minute -= 60;
+              td_return->hour += 1;
+            }
+
+          td_return->hour += (td1->hour + td2->hour);
+          if ( td_return->hour >= 24 )
+            {
+              td_return->hour -= 24;
+              td_return->day += 1;
+            }
+ 
+          //TODO: day crossing the month is pathological. Discuss with LUIS.
+          /*TODO: WARNING: This part of code has to be fixed.*/
+          td_return->day += (td1->day + td2->day);
+          if ( td_return->day >= 60 )
+            {
+              td_return->day -= 60;
+              td_return->month += 1;
+            }
+
+          td_return->month += (td1->month + td2->month);
+          if ( td_return->month >= 12 )
+            {
+              td_return->month -= 12;
+              td_return->year += 1;
+            }
+
+          td_return->year += (td1->year + td2->year);
+        } 
+      else
+        {
+          ; 
+        }
+
+      return td_return;
+    } 
+  else
+    return NULL;
+
+}
diff --git a/test/Makefile.in b/test/Makefile.in
index d280444e..b3c9ed4d 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.13.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
-
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,23 +16,6 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
-    esac; \
-    test $$am__dry = yes; \
-  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -53,8 +37,7 @@ host_triplet = @host@
 bin_PROGRAMS = time_calculus$(EXEEXT) model_integration$(EXEEXT) \
 	example$(EXEEXT)
 subdir = test
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/config/depcomp
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prog_doxygen.m4 \
 	$(top_srcdir)/m4/ax_prog_ragel.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -72,107 +55,50 @@ PROGRAMS = $(bin_PROGRAMS)
 am_example_OBJECTS = example.$(OBJEXT)
 example_OBJECTS = $(am_example_OBJECTS)
 example_DEPENDENCIES = ../src/libmtime.la
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-example_LINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \
+example_LINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \
 	$(example_LDFLAGS) $(LDFLAGS) -o $@
 am_model_integration_OBJECTS = model_integration.$(OBJEXT)
 model_integration_OBJECTS = $(am_model_integration_OBJECTS)
 model_integration_DEPENDENCIES = ../src/libmtime.la
-model_integration_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-	$(AM_CFLAGS) $(CFLAGS) $(model_integration_LDFLAGS) $(LDFLAGS) \
-	-o $@
+model_integration_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(model_integration_LDFLAGS) $(LDFLAGS) -o $@
 am_time_calculus_OBJECTS = time_calculus.$(OBJEXT)
 time_calculus_OBJECTS = $(am_time_calculus_OBJECTS)
 time_calculus_DEPENDENCIES = ../src/libmtime.la
-time_calculus_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+time_calculus_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(time_calculus_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-	$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
 FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-LTFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-AM_V_FC = $(am__v_FC_@AM_V@)
-am__v_FC_ = $(am__v_FC_@AM_DEFAULT_V@)
-am__v_FC_0 = @echo "  FC      " $@;
-am__v_FC_1 = 
+LTFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
 FCLD = $(FC)
-FCLINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_FCLD = $(am__v_FCLD_@AM_V@)
-am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@)
-am__v_FCLD_0 = @echo "  FCLD    " $@;
-am__v_FCLD_1 = 
+FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
 SOURCES = $(example_SOURCES) $(model_integration_SOURCES) \
 	$(time_calculus_SOURCES)
 DIST_SOURCES = $(example_SOURCES) $(model_integration_SOURCES) \
 	$(time_calculus_SOURCES)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -365,19 +291,14 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
 	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
-	fi; \
 	for p in $$list; do echo "$$p $$p"; done | \
 	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p \
-	 || test -f $$p1 \
-	  ; then echo "$$p"; echo "$$p"; else :; fi; \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
 	done | \
-	sed -e 'p;s,.*/,,;n;h' \
-	    -e 's|.*|.|' \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
 	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
 	sed 'N;N;N;s,\n, ,g' | \
 	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
@@ -398,8 +319,7 @@ uninstall-binPROGRAMS:
 	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
 	files=`for p in $$list; do echo "$$p"; done | \
 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' \
-	`; \
+	      -e 's/$$/$(EXEEXT)/' `; \
 	test -n "$$list" || exit 0; \
 	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
 	cd "$(DESTDIR)$(bindir)" && rm -f $$files
@@ -414,13 +334,13 @@ clean-binPROGRAMS:
 	rm -f $$list
 example$(EXEEXT): $(example_OBJECTS) $(example_DEPENDENCIES) $(EXTRA_example_DEPENDENCIES) 
 	@rm -f example$(EXEEXT)
-	$(AM_V_FCLD)$(example_LINK) $(example_OBJECTS) $(example_LDADD) $(LIBS)
+	$(example_LINK) $(example_OBJECTS) $(example_LDADD) $(LIBS)
 model_integration$(EXEEXT): $(model_integration_OBJECTS) $(model_integration_DEPENDENCIES) $(EXTRA_model_integration_DEPENDENCIES) 
 	@rm -f model_integration$(EXEEXT)
-	$(AM_V_CCLD)$(model_integration_LINK) $(model_integration_OBJECTS) $(model_integration_LDADD) $(LIBS)
+	$(model_integration_LINK) $(model_integration_OBJECTS) $(model_integration_LDADD) $(LIBS)
 time_calculus$(EXEEXT): $(time_calculus_OBJECTS) $(time_calculus_DEPENDENCIES) $(EXTRA_time_calculus_DEPENDENCIES) 
 	@rm -f time_calculus$(EXEEXT)
-	$(AM_V_CCLD)$(time_calculus_LINK) $(time_calculus_OBJECTS) $(time_calculus_LDADD) $(LIBS)
+	$(time_calculus_LINK) $(time_calculus_OBJECTS) $(time_calculus_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -432,34 +352,34 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_calculus.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 .f90.o:
-	$(AM_V_FC)$(FCCOMPILE) -c -o $@ $<
+	$(FCCOMPILE) -c -o $@ $<
 
 .f90.obj:
-	$(AM_V_FC)$(FCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+	$(FCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .f90.lo:
-	$(AM_V_FC)$(LTFCCOMPILE) -c -o $@ $<
+	$(LTFCCOMPILE) -c -o $@ $<
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -467,15 +387,26 @@ mostlyclean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
 	set x; \
 	here=`pwd`; \
-	$(am__define_uniq_tagged_files); \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -487,11 +418,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	      $$unique; \
 	  fi; \
 	fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -500,21 +435,6 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -658,19 +578,19 @@ uninstall-am: uninstall-binPROGRAMS
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
-	clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
-	ctags ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-binPROGRAMS \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libtool ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-binPROGRAMS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
-- 
GitLab