Index: XIOS/trunk/src/interface/c/iccalendar.cpp
===================================================================
--- XIOS/trunk/src/interface/c/iccalendar.cpp	(revision 546)
+++ XIOS/trunk/src/interface/c/iccalendar.cpp	(revision 549)
@@ -1,4 +1,5 @@
 #include "xmlioserver.hpp"
 
+#include "icdate.hpp"
 #include "exception.hpp"
 #include "timer.hpp"
@@ -8,13 +9,4 @@
 extern "C"
 {
-  void cxios_create_calendar()
-  {
-    CTimer::get("XIOS").resume();
-    xios::CContext* context = CContext::getCurrent();
-    if (context->hasClient)
-      context->solveCalendar();
-    CTimer::get("XIOS").suspend();
-  }
-
   void cxios_update_calendar(int step)
   {
@@ -26,3 +18,47 @@
     CTimer::get("XIOS").suspend();
   }
+
+  void cxios_get_current_date(cxios_date* current_date_c)
+  {
+    CTimer::get("XIOS").resume();
+    const xios::CContext* context = CContext::getCurrent();
+    const boost::shared_ptr<xios::CCalendar> cal = context->getCalendar();
+    if (!cal)
+      ERROR("void cxios_get_current_date(cxios_date* current_date_c)",
+            << "Impossible to get the current date: no calendar was defined.");
+    const CDate& currentDate = cal->getCurrentDate();
+    current_date_c->year = currentDate.getYear();
+    current_date_c->month = currentDate.getMonth();
+    current_date_c->day = currentDate.getDay();
+    current_date_c->hour = currentDate.getHour();
+    current_date_c->minute = currentDate.getMinute();
+    current_date_c->second = currentDate.getSecond();
+    CTimer::get("XIOS").suspend();
+  }
+
+  int cxios_get_year_length_in_seconds(int year)
+  {
+    CTimer::get("XIOS").resume();
+    const boost::shared_ptr<xios::CCalendar> cal = CContext::getCurrent()->getCalendar();
+    if (!cal)
+      ERROR("int cxios_get_year_length_in_seconds(int year)",
+            << "Impossible to get the year length: no calendar was defined.");
+    int length = cal->getYearTotalLength(CDate(*cal, year, 01, 01));
+    CTimer::get("XIOS").suspend();
+
+    return length;
+  }
+
+  int cxios_get_day_length_in_seconds()
+  {
+    CTimer::get("XIOS").resume();
+    const boost::shared_ptr<xios::CCalendar> cal = CContext::getCurrent()->getCalendar();
+    if (!cal)
+      ERROR("int cxios_get_day_length_in_seconds()",
+            << "Impossible to get the day length: no calendar was defined.");
+    int length = cal->getDayLengthInSeconds();
+    CTimer::get("XIOS").suspend();
+
+    return length;
+  }
 }
Index: XIOS/trunk/src/interface/c/iccalendar_wrapper.cpp
===================================================================
--- XIOS/trunk/src/interface/c/iccalendar_wrapper.cpp	(revision 549)
+++ XIOS/trunk/src/interface/c/iccalendar_wrapper.cpp	(revision 549)
@@ -0,0 +1,127 @@
+/* ************************************************************************** *
+ *      Copyright Â© IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
+ * ************************************************************************** */
+
+#include <boost/multi_array.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include "xmlioserver.hpp"
+
+#include "attribute_template.hpp"
+#include "object_template.hpp"
+#include "group_template.hpp"
+
+#include "icutil.hpp"
+#include "icdate.hpp"
+#include "timer.hpp"
+#include "calendar_wrapper.hpp"
+
+extern "C"
+{
+// /////////////////////////////// DÃ©finitions ////////////////////////////// //
+
+  // ----------------------- RedÃ©finition de type ----------------------------
+
+  typedef xios::CCalendarWrapper *XCalendarWrapperPtr;
+
+  // ------------------------ CrÃ©ation des handle -----------------------------
+
+  void cxios_calendar_wrapper_handle_create(XCalendarWrapperPtr* _ret, const char* _id, int _id_len)
+  {
+    std::string id;
+    if (!cstr2string(_id, _id_len, id)) return;
+    CTimer::get("XIOS").resume();
+    *_ret = CCalendarWrapper::get(id);
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_get_current_calendar_wrapper(XCalendarWrapperPtr* _ret)
+  {
+    CTimer::get("XIOS").resume();
+    *_ret = CCalendarWrapper::get(CCalendarWrapper::GetDefName());
+    CTimer::get("XIOS").suspend();
+  }
+
+  // -------------------- VÃ©rification des identifiants -----------------------
+
+  void cxios_calendar_wrapper_valid_id(bool* _ret, const char* _id, int _id_len)
+  {
+    std::string id;
+    if (!cstr2string(_id, _id_len, id)) return;
+    CTimer::get("XIOS").resume();
+    *_ret = CCalendarWrapper::has(id);
+    CTimer::get("XIOS").suspend();
+  }
+
+  // ----------------------- Custom getters and setters -----------------------
+
+  void cxios_set_calendar_wrapper_date_start_date(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date start_date_c)
+  {
+    CTimer::get("XIOS").resume();
+    CDate start_date(*calendarWrapper_hdl->getCalendar(true),
+                     start_date_c.year,
+                     start_date_c.month,
+                     start_date_c.day,
+                     start_date_c.hour,
+                     start_date_c.minute,
+                     start_date_c.second);
+    calendarWrapper_hdl->setInitDate(start_date);
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_get_calendar_wrapper_date_start_date(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date* start_date_c)
+  {
+    CTimer::get("XIOS").resume();
+    const CDate& start_date = calendarWrapper_hdl->getInitDate();
+    start_date_c->year = start_date.getYear();
+    start_date_c->month = start_date.getMonth();
+    start_date_c->day = start_date.getDay();
+    start_date_c->hour = start_date.getHour();
+    start_date_c->minute = start_date.getMinute();
+    start_date_c->second = start_date.getSecond();
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_set_calendar_wrapper_date_time_origin(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date time_origin_c)
+  {
+    CTimer::get("XIOS").resume();
+    CDate time_origin(*calendarWrapper_hdl->getCalendar(true),
+                      time_origin_c.year,
+                      time_origin_c.month,
+                      time_origin_c.day,
+                      time_origin_c.hour,
+                      time_origin_c.minute,
+                      time_origin_c.second);
+    calendarWrapper_hdl->setTimeOrigin(time_origin);
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_get_calendar_wrapper_date_time_origin(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date* time_origin_c)
+  {
+    CTimer::get("XIOS").resume();
+    const CDate& time_origin = calendarWrapper_hdl->getTimeOrigin();
+    time_origin_c->year = time_origin.getYear();
+    time_origin_c->month = time_origin.getMonth();
+    time_origin_c->day = time_origin.getDay();
+    time_origin_c->hour = time_origin.getHour();
+    time_origin_c->minute = time_origin.getMinute();
+    time_origin_c->second = time_origin.getSecond();
+    CTimer::get("XIOS").suspend();
+  }
+
+  // ----------------------- Calendar creation and update ----------------------
+
+  void cxios_create_calendar(XCalendarWrapperPtr calendarWrapper_hdl)
+  {
+    CTimer::get("XIOS").resume();
+    calendarWrapper_hdl->createCalendar();
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_update_calendar_timestep(XCalendarWrapperPtr calendarWrapper_hdl)
+  {
+    CTimer::get("XIOS").resume();
+    calendarWrapper_hdl->updateTimestep();
+    CTimer::get("XIOS").suspend();
+  }
+} // extern "C"
Index: XIOS/trunk/src/interface/c/icdate.cpp
===================================================================
--- XIOS/trunk/src/interface/c/icdate.cpp	(revision 546)
+++ XIOS/trunk/src/interface/c/icdate.cpp	(revision 549)
@@ -144,3 +144,43 @@
     return (date1 >= date2);
   }
+
+  int cxios_date_get_second_of_year(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_second_of_year(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getSecondOfYear();
+  }
+
+  double cxios_date_get_day_of_year(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_day_of_year(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getDayOfYear();
+  }
+
+  double cxios_date_get_fraction_of_year(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_fraction_of_year(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getFractionOfYear();
+  }
+
+  int cxios_date_get_second_of_day(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_second_of_day(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getSecondOfDay();
+  }
+
+  double cxios_date_get_fraction_of_day(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_fraction_of_day(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getFractionOfDay();
+  }
 } // extern "C"
Index: XIOS/trunk/src/interface/c_attr/iccalendar_wrapper_attr.cpp
===================================================================
--- XIOS/trunk/src/interface/c_attr/iccalendar_wrapper_attr.cpp	(revision 549)
+++ XIOS/trunk/src/interface/c_attr/iccalendar_wrapper_attr.cpp	(revision 549)
@@ -0,0 +1,137 @@
+/* ************************************************************************** *
+ *               Interface auto generated - do not modify                   *
+ * ************************************************************************** */
+
+#include <boost/multi_array.hpp>
+#include <boost/shared_ptr.hpp>
+#include "xmlioserver.hpp"
+#include "attribute_template.hpp"
+#include "object_template.hpp"
+#include "group_template.hpp"
+#include "icutil.hpp"
+#include "icdate.hpp"
+#include "timer.hpp"
+#include "node_type.hpp"
+
+extern "C"
+{
+  typedef xios::CCalendarWrapper*  calendar_wrapper_Ptr;
+  
+  void cxios_set_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * start_date, int start_date_size)
+  {
+    std::string start_date_str;
+    if(!cstr2string(start_date, start_date_size, start_date_str)) return;
+     CTimer::get("XIOS").resume();
+    calendar_wrapper_hdl->start_date.setValue(start_date_str);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, char * start_date, int start_date_size)
+  {
+     CTimer::get("XIOS").resume();
+    if(!string_copy(calendar_wrapper_hdl->start_date.getInheritedValue(),start_date , start_date_size))
+      ERROR("void cxios_get_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, char * start_date, int start_date_size)", <<"Input string is to short");
+     CTimer::get("XIOS").suspend();
+  }
+  
+  bool cxios_is_defined_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return calendar_wrapper_hdl->start_date.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
+  void cxios_set_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * time_origin, int time_origin_size)
+  {
+    std::string time_origin_str;
+    if(!cstr2string(time_origin, time_origin_size, time_origin_str)) return;
+     CTimer::get("XIOS").resume();
+    calendar_wrapper_hdl->time_origin.setValue(time_origin_str);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl, char * time_origin, int time_origin_size)
+  {
+     CTimer::get("XIOS").resume();
+    if(!string_copy(calendar_wrapper_hdl->time_origin.getInheritedValue(),time_origin , time_origin_size))
+      ERROR("void cxios_get_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl, char * time_origin, int time_origin_size)", <<"Input string is to short");
+     CTimer::get("XIOS").suspend();
+  }
+  
+  bool cxios_is_defined_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return calendar_wrapper_hdl->time_origin.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
+  void cxios_set_calendar_wrapper_timestep(calendar_wrapper_Ptr calendar_wrapper_hdl, cxios_duration timestep_c)
+  {
+    CTimer::get("XIOS").resume();
+    calendar_wrapper_hdl->timestep.allocate();
+    CDuration& timestep = calendar_wrapper_hdl->timestep.get();
+    timestep.year = timestep_c.year;
+    timestep.month = timestep_c.month;
+    timestep.day = timestep_c.day;
+    timestep.hour = timestep_c.hour;
+    timestep.minute = timestep_c.minute;
+    timestep.second = timestep_c.second;
+    timestep.timestep = timestep_c.timestep;
+    CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_calendar_wrapper_timestep(calendar_wrapper_Ptr calendar_wrapper_hdl, cxios_duration* timestep_c)
+  {
+    CTimer::get("XIOS").resume();
+    CDuration timestep = calendar_wrapper_hdl->timestep.getInheritedValue();
+    timestep_c->year = timestep.year;
+    timestep_c->month = timestep.month;
+    timestep_c->day = timestep.day;
+    timestep_c->hour = timestep.hour;
+    timestep_c->minute = timestep.minute;
+    timestep_c->second = timestep.second;
+    timestep_c->timestep = timestep.timestep;
+    CTimer::get("XIOS").suspend();
+  }
+  
+  bool cxios_is_defined_calendar_wrapper_timestep(calendar_wrapper_Ptr calendar_wrapper_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return calendar_wrapper_hdl->timestep.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
+  void cxios_set_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * type, int type_size)
+  {
+    std::string type_str;
+    if(!cstr2string(type, type_size, type_str)) return;
+     CTimer::get("XIOS").resume();
+    calendar_wrapper_hdl->type.fromString(type_str);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl, char * type, int type_size)
+  {
+     CTimer::get("XIOS").resume();
+    if(!string_copy(calendar_wrapper_hdl->type.getInheritedStringValue(),type , type_size))
+      ERROR("void cxios_get_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl, char * type, int type_size)", <<"Input string is to short");
+     CTimer::get("XIOS").suspend();
+  }
+  
+  bool cxios_is_defined_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return calendar_wrapper_hdl->type.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
+  
+}
Index: XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp
===================================================================
--- XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp	(revision 546)
+++ XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp	(revision 549)
@@ -17,30 +17,4 @@
 {
   typedef xios::CContext*  context_Ptr;
-  
-  void cxios_set_context_calendar_type(context_Ptr context_hdl, const char * calendar_type, int calendar_type_size)
-  {
-    std::string calendar_type_str;
-    if(!cstr2string(calendar_type, calendar_type_size, calendar_type_str)) return;
-     CTimer::get("XIOS").resume();
-    context_hdl->calendar_type.fromString(calendar_type_str);
-     CTimer::get("XIOS").suspend();
-  }
-  
-  void cxios_get_context_calendar_type(context_Ptr context_hdl, char * calendar_type, int calendar_type_size)
-  {
-     CTimer::get("XIOS").resume();
-    if(!string_copy(context_hdl->calendar_type.getInheritedStringValue(),calendar_type , calendar_type_size))
-      ERROR("void cxios_get_context_calendar_type(context_Ptr context_hdl, char * calendar_type, int calendar_type_size)", <<"Input string is to short");
-     CTimer::get("XIOS").suspend();
-  }
-  
-  bool cxios_is_defined_context_calendar_type(context_Ptr context_hdl )
-  {
-     CTimer::get("XIOS").resume();
-    return context_hdl->calendar_type.hasInheritedValue();
-     CTimer::get("XIOS").suspend();
-  }
-  
-  
   
   void cxios_set_context_output_dir(context_Ptr context_hdl, const char * output_dir, int output_dir_size)
@@ -70,118 +44,4 @@
   
   
-  void cxios_set_context_start_date(context_Ptr context_hdl, cxios_date start_date_c)
-  {
-    CTimer::get("XIOS").resume();
-    context_hdl->start_date.allocate();
-    CDate& start_date = context_hdl->start_date.get();
-    start_date.setDate(start_date_c.year,
-                           start_date_c.month,
-                           start_date_c.day,
-                           start_date_c.hour,
-                           start_date_c.minute,
-                           start_date_c.second);
-    if (start_date.hasRelCalendar())
-      start_date.checkDate();
-    CTimer::get("XIOS").suspend();
-  }
-  
-  void cxios_get_context_start_date(context_Ptr context_hdl, cxios_date* start_date_c)
-  {
-    CTimer::get("XIOS").resume();
-    CDate start_date = context_hdl->start_date.getInheritedValue();
-    start_date_c->year = start_date.getYear();
-    start_date_c->month = start_date.getMonth();
-    start_date_c->day = start_date.getDay();
-    start_date_c->hour = start_date.getHour();
-    start_date_c->minute = start_date.getMinute();
-    start_date_c->second = start_date.getSecond();
-    CTimer::get("XIOS").suspend();
-  }
-  
-  bool cxios_is_defined_context_start_date(context_Ptr context_hdl )
-  {
-     CTimer::get("XIOS").resume();
-    return context_hdl->start_date.hasInheritedValue();
-     CTimer::get("XIOS").suspend();
-  }
-  
-  
-  
-  void cxios_set_context_time_origin(context_Ptr context_hdl, cxios_date time_origin_c)
-  {
-    CTimer::get("XIOS").resume();
-    context_hdl->time_origin.allocate();
-    CDate& time_origin = context_hdl->time_origin.get();
-    time_origin.setDate(time_origin_c.year,
-                           time_origin_c.month,
-                           time_origin_c.day,
-                           time_origin_c.hour,
-                           time_origin_c.minute,
-                           time_origin_c.second);
-    if (time_origin.hasRelCalendar())
-      time_origin.checkDate();
-    CTimer::get("XIOS").suspend();
-  }
-  
-  void cxios_get_context_time_origin(context_Ptr context_hdl, cxios_date* time_origin_c)
-  {
-    CTimer::get("XIOS").resume();
-    CDate time_origin = context_hdl->time_origin.getInheritedValue();
-    time_origin_c->year = time_origin.getYear();
-    time_origin_c->month = time_origin.getMonth();
-    time_origin_c->day = time_origin.getDay();
-    time_origin_c->hour = time_origin.getHour();
-    time_origin_c->minute = time_origin.getMinute();
-    time_origin_c->second = time_origin.getSecond();
-    CTimer::get("XIOS").suspend();
-  }
-  
-  bool cxios_is_defined_context_time_origin(context_Ptr context_hdl )
-  {
-     CTimer::get("XIOS").resume();
-    return context_hdl->time_origin.hasInheritedValue();
-     CTimer::get("XIOS").suspend();
-  }
-  
-  
-  
-  void cxios_set_context_timestep(context_Ptr context_hdl, cxios_duration timestep_c)
-  {
-    CTimer::get("XIOS").resume();
-    context_hdl->timestep.allocate();
-    CDuration& timestep = context_hdl->timestep.get();
-    timestep.year = timestep_c.year;
-    timestep.month = timestep_c.month;
-    timestep.day = timestep_c.day;
-    timestep.hour = timestep_c.hour;
-    timestep.minute = timestep_c.minute;
-    timestep.second = timestep_c.second;
-    timestep.timestep = timestep_c.timestep;
-    CTimer::get("XIOS").suspend();
-  }
-  
-  void cxios_get_context_timestep(context_Ptr context_hdl, cxios_duration* timestep_c)
-  {
-    CTimer::get("XIOS").resume();
-    CDuration timestep = context_hdl->timestep.getInheritedValue();
-    timestep_c->year = timestep.year;
-    timestep_c->month = timestep.month;
-    timestep_c->day = timestep.day;
-    timestep_c->hour = timestep.hour;
-    timestep_c->minute = timestep.minute;
-    timestep_c->second = timestep.second;
-    timestep_c->timestep = timestep.timestep;
-    CTimer::get("XIOS").suspend();
-  }
-  
-  bool cxios_is_defined_context_timestep(context_Ptr context_hdl )
-  {
-     CTimer::get("XIOS").resume();
-    return context_hdl->timestep.hasInheritedValue();
-     CTimer::get("XIOS").suspend();
-  }
-  
-  
-  
   
 }
Index: XIOS/trunk/src/interface/fortran/calendar_interface.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/calendar_interface.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran/calendar_interface.F90	(revision 549)
@@ -0,0 +1,29 @@
+#include "xios_fortran_prefix.hpp"
+
+MODULE CALENDAR_INTERFACE
+   USE, INTRINSIC :: ISO_C_BINDING
+
+   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
+
+      SUBROUTINE cxios_update_calendar(step) BIND(C)
+         IMPORT C_INT
+         INTEGER (kind = C_INT), VALUE :: step
+      END SUBROUTINE cxios_update_calendar
+
+      SUBROUTINE cxios_get_current_date(current_date) BIND(C)
+         USE IDATE
+         TYPE(txios(date))             :: current_date
+      END SUBROUTINE cxios_get_current_date
+
+      INTEGER(kind = C_INT) FUNCTION cxios_get_year_length_in_seconds(year) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER(kind = C_INT), VALUE :: year
+      END FUNCTION cxios_get_year_length_in_seconds
+
+      INTEGER(kind = C_INT) FUNCTION cxios_get_day_length_in_seconds() BIND(C)
+         USE ISO_C_BINDING
+      END FUNCTION cxios_get_day_length_in_seconds
+
+   END INTERFACE
+
+END MODULE CALENDAR_INTERFACE
Index: XIOS/trunk/src/interface/fortran/calendar_interface.f90
===================================================================
--- XIOS/trunk/src/interface/fortran/calendar_interface.f90	(revision 546)
+++ 	(revision )
@@ -1,16 +1,0 @@
-MODULE CALENDAR_INTERFACE
-   USE, INTRINSIC :: ISO_C_BINDING
-     
-   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
-
-      SUBROUTINE cxios_create_calendar() BIND(C)
-      END SUBROUTINE cxios_create_calendar
-
-      SUBROUTINE cxios_update_calendar(step) BIND(C)
-         IMPORT C_INT
-         INTEGER (kind = C_INT), VALUE :: step
-      END SUBROUTINE cxios_update_calendar
-
-   END INTERFACE
-     
-END MODULE CALENDAR_INTERFACE
Index: XIOS/trunk/src/interface/fortran/calendar_wrapper_interface.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/calendar_wrapper_interface.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran/calendar_wrapper_interface.F90	(revision 549)
@@ -0,0 +1,67 @@
+#include "../fortran/xios_fortran_prefix.hpp"
+
+MODULE CALENDAR_WRAPPER_INTERFACE
+   USE, INTRINSIC :: ISO_C_BINDING
+
+   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
+
+      SUBROUTINE cxios_calendar_wrapper_handle_create(ret, idt, idt_size) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T)               :: ret
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt
+         INTEGER  (kind = C_INT)     , VALUE        :: idt_size
+      END SUBROUTINE cxios_calendar_wrapper_handle_create
+
+      SUBROUTINE cxios_get_current_calendar_wrapper(ret) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T)               :: ret
+      END SUBROUTINE cxios_get_current_calendar_wrapper
+
+      SUBROUTINE cxios_calendar_wrapper_valid_id(ret, idt, idt_size) BIND(C)
+         USE ISO_C_BINDING
+         LOGICAL  (kind = C_BOOL)                   :: ret
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt
+         INTEGER  (kind = C_INT)     , VALUE        :: idt_size
+      END SUBROUTINE cxios_calendar_wrapper_valid_id
+
+      SUBROUTINE cxios_create_calendar(hdl) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T), VALUE        :: hdl
+      END SUBROUTINE cxios_create_calendar
+
+      SUBROUTINE cxios_update_calendar_timestep(hdl) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T), VALUE        :: hdl
+      END SUBROUTINE cxios_update_calendar_timestep
+
+      SUBROUTINE cxios_set_calendar_wrapper_date_start_date(hdl, start_date) BIND(C)
+         USE ISO_C_BINDING
+         USE IDATE
+         INTEGER (kind = C_INTPTR_T), VALUE :: hdl
+         TYPE(txios(date)), VALUE           :: start_date
+      END SUBROUTINE cxios_set_calendar_wrapper_date_start_date
+
+      SUBROUTINE cxios_get_calendar_wrapper_date_start_date(hdl, start_date) BIND(C)
+         USE ISO_C_BINDING
+         USE IDATE
+         INTEGER (kind = C_INTPTR_T), VALUE :: hdl
+         TYPE(txios(date))                  :: start_date
+      END SUBROUTINE cxios_get_calendar_wrapper_date_start_date
+
+      SUBROUTINE cxios_set_calendar_wrapper_date_time_origin(hdl, time_origin) BIND(C)
+         USE ISO_C_BINDING
+         USE IDATE
+         INTEGER (kind = C_INTPTR_T), VALUE :: hdl
+         TYPE(txios(date)), VALUE           :: time_origin
+      END SUBROUTINE cxios_set_calendar_wrapper_date_time_origin
+
+      SUBROUTINE cxios_get_calendar_wrapper_date_time_origin(hdl, time_origin) BIND(C)
+         USE ISO_C_BINDING
+         USE IDATE
+         INTEGER (kind = C_INTPTR_T), VALUE :: hdl
+         TYPE(txios(date))                  :: time_origin
+      END SUBROUTINE cxios_get_calendar_wrapper_date_time_origin
+
+   END INTERFACE
+
+END MODULE CALENDAR_WRAPPER_INTERFACE
Index: XIOS/trunk/src/interface/fortran/date_interface.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/date_interface.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran/date_interface.F90	(revision 549)
@@ -7,5 +7,5 @@
       INTEGER(kind = C_INT) :: year, month, day, hour, minute, second
    END TYPE txios(date)
-     
+
    INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
 
@@ -75,5 +75,35 @@
       END FUNCTION cxios_date_ge
 
+      INTEGER(kind = C_INT) FUNCTION cxios_date_get_second_of_year(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_second_of_year
+
+      REAL(kind = C_DOUBLE) FUNCTION cxios_date_get_day_of_year(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_day_of_year
+
+      REAL(kind = C_DOUBLE) FUNCTION cxios_date_get_fraction_of_year(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_fraction_of_year
+
+      INTEGER(kind = C_INT) FUNCTION cxios_date_get_second_of_day(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_second_of_day
+
+      REAL(kind = C_DOUBLE) FUNCTION cxios_date_get_fraction_of_day(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_fraction_of_day
+
    END INTERFACE
-     
+
 END MODULE DATE_INTERFACE
Index: XIOS/trunk/src/interface/fortran/icalendar.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/icalendar.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran/icalendar.F90	(revision 549)
@@ -3,4 +3,5 @@
    USE, INTRINSIC :: ISO_C_BINDING
    USE CALENDAR_INTERFACE
+   USE ICALENDAR_WRAPPER
    USE IDATE
    USE IDURATION
@@ -9,53 +10,165 @@
    INTEGER(kind = C_INT), PARAMETER :: D360 = 0 , ALLLEAP = 1 , NOLEAP = 2 , JULIAN = 3 , GREGORIAN = 4
 
+   INTERFACE xios(set_start_date)
+      MODULE PROCEDURE xios(set_start_date_date), xios(set_start_date_dur)
+   END INTERFACE xios(set_start_date)
+
+   INTERFACE xios(set_time_origin)
+      MODULE PROCEDURE xios(set_time_origin_date), xios(set_time_origin_dur)
+   END INTERFACE xios(set_time_origin)
+
    CONTAINS ! Fonctions disponibles pour les utilisateurs.
 
-   SUBROUTINE xios(set_calendar)(calendar_type, start_date, time_origin, timestep)
-      USE ICONTEXT, ONLY : txios(context), xios(get_current_context)
-      USE icontext_attr, ONLY : xios(set_context_attr_hdl)
-      USE IDATE, ONLY : txios(date)
-      USE IDURATION, ONLY : txios(duration)
-      IMPLICIT NONE
-      CHARACTER(len = *),    OPTIONAL, INTENT(IN) :: calendar_type
+   SUBROUTINE xios(define_calendar)(type, timestep, start_date, time_origin)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE icalendar_wrapper_attr, ONLY : xios(set_calendar_wrapper_attr_hdl)
+      USE IDURATION, ONLY : txios(duration)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      CHARACTER(len = *),              INTENT(IN) :: type
+      TYPE(txios(duration)), OPTIONAL, INTENT(IN) :: timestep
       TYPE(txios(date)),     OPTIONAL, INTENT(IN) :: start_date
       TYPE(txios(date)),     OPTIONAL, INTENT(IN) :: time_origin
-      TYPE(txios(duration)), OPTIONAL, INTENT(IN) :: timestep
-      TYPE(txios(context)) :: context
-
-      CALL xios(get_current_context)(context)
-
-      IF (PRESENT(calendar_type)) THEN
-         CALL xios(set_context_attr_hdl)(context, calendar_type=calendar_type)
-      END IF
+      TYPE(txios(calendar_wrapper)) :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, type=type)
+      IF (PRESENT(timestep)) THEN
+         CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep)
+      END IF
+
+      CALL xios(create_calendar)(calendar_wrapper)
+
       IF (PRESENT(start_date)) THEN
-         CALL xios(set_context_attr_hdl)(context, start_date=start_date)
+         CALL xios(set_start_date_hdl)(calendar_wrapper, start_date=start_date)
       END IF
       IF (PRESENT(time_origin)) THEN
-         CALL xios(set_context_attr_hdl)(context, time_origin=time_origin)
-      END IF
-      IF (PRESENT(time_origin)) THEN
-         CALL xios(set_context_attr_hdl)(context, timestep=timestep)
-      END IF
-
-      CALL cxios_create_calendar()
-   END SUBROUTINE xios(set_calendar)
+         CALL xios(set_time_origin_hdl)(calendar_wrapper, time_origin=time_origin)
+      END IF
+   END SUBROUTINE xios(define_calendar)
+
+   SUBROUTINE xios(get_calendar_type)(calendar_type)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE icalendar_wrapper_attr, ONLY : xios(get_calendar_wrapper_attr_hdl)
+      IMPLICIT NONE
+      CHARACTER(len = *), INTENT(OUT) :: calendar_type
+      TYPE(txios(calendar_wrapper))   :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(get_calendar_wrapper_attr_hdl)(calendar_wrapper, type=calendar_type)
+   END SUBROUTINE xios(get_calendar_type)
 
    SUBROUTINE xios(set_timestep)(timestep)
-      USE ICONTEXT, ONLY : txios(context), xios(get_current_context)
-      USE icontext_attr, ONLY : xios(set_context_attr_hdl)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE icalendar_wrapper_attr, ONLY : xios(set_calendar_wrapper_attr_hdl)
       USE IDURATION, ONLY : txios(duration)
       IMPLICIT NONE
       TYPE(txios(duration)), INTENT(IN) :: timestep
-      TYPE(txios(context)) :: context
-
-      CALL xios(get_current_context)(context)
-
-      CALL xios(set_context_attr_hdl)(context, timestep=timestep)
+      TYPE(txios(calendar_wrapper))     :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep)
+
+      CALL xios(update_calendar_timestep)(calendar_wrapper)
    END SUBROUTINE xios(set_timestep)
 
+   SUBROUTINE xios(get_timestep)(timestep)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE icalendar_wrapper_attr, ONLY : xios(get_calendar_wrapper_attr_hdl)
+      USE IDURATION, ONLY : txios(duration)
+      IMPLICIT NONE
+      TYPE(txios(duration)), INTENT(OUT) :: timestep
+      TYPE(txios(calendar_wrapper))      :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(get_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep)
+   END SUBROUTINE xios(get_timestep)
+
+   SUBROUTINE xios(set_start_date_date)(start_date)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(IN) :: start_date
+      TYPE(txios(calendar_wrapper)) :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(set_start_date_hdl)(calendar_wrapper, start_date)
+   END SUBROUTINE xios(set_start_date_date)
+
+   SUBROUTINE xios(set_start_date_dur)(start_date)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDURATION, ONLY : txios(duration)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(duration)), INTENT(IN) :: start_date
+      TYPE(txios(calendar_wrapper))     :: calendar_wrapper
+      TYPE(txios(date))                 :: start_date_date
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      start_date_date = start_date
+      CALL xios(set_start_date_hdl)(calendar_wrapper, start_date_date)
+   END SUBROUTINE xios(set_start_date_dur)
+
+   SUBROUTINE xios(get_start_date)(start_date)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: start_date
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(get_start_date_hdl)(calendar_wrapper, start_date)
+   END SUBROUTINE xios(get_start_date)
+
+   SUBROUTINE xios(set_time_origin_date)(time_origin)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(IN) :: time_origin
+      TYPE(txios(calendar_wrapper)) :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(set_time_origin_hdl)(calendar_wrapper, time_origin)
+   END SUBROUTINE xios(set_time_origin_date)
+
+   SUBROUTINE xios(set_time_origin_dur)(time_origin)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDURATION, ONLY : txios(duration)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(duration)), INTENT(IN) :: time_origin
+      TYPE(txios(calendar_wrapper))     :: calendar_wrapper
+      TYPE(txios(date))                 :: time_origin_date
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      time_origin_date = time_origin
+      CALL xios(set_time_origin_hdl)(calendar_wrapper, time_origin_date)
+   END SUBROUTINE xios(set_time_origin_dur)
+
+   SUBROUTINE xios(get_time_origin)(time_origin)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: time_origin
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(get_time_origin_hdl)(calendar_wrapper, time_origin)
+   END SUBROUTINE xios(get_time_origin)
+
    SUBROUTINE xios(update_calendar)(step)
       IMPLICIT NONE
       INTEGER, INTENT(IN) :: step
-      
+
       IF (step < 0) THEN
          PRINT *, "L'argument 'step' ne peut Ãªtre nÃ©gatif"
@@ -65,3 +178,26 @@
    END SUBROUTINE xios(update_calendar)
 
+   SUBROUTINE xios(get_current_date)(current_date)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: current_date
+
+      CALL cxios_get_current_date(current_date)
+   END SUBROUTINE xios(get_current_date)
+
+   FUNCTION xios(get_year_length_in_seconds)(year) RESULT(res)
+      IMPLICIT NONE
+      INTEGER(kind = C_INT), INTENT(IN) :: year
+      INTEGER(kind = C_INT) :: res
+
+      res = cxios_get_year_length_in_seconds(year)
+   END FUNCTION xios(get_year_length_in_seconds)
+
+   FUNCTION xios(get_day_length_in_seconds)() RESULT(res)
+      IMPLICIT NONE
+      INTEGER(kind = C_INT) :: res
+
+      res = cxios_get_day_length_in_seconds()
+   END FUNCTION xios(get_day_length_in_seconds)
+
 END MODULE ICALENDAR
Index: XIOS/trunk/src/interface/fortran/icalendar_wrapper.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/icalendar_wrapper.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran/icalendar_wrapper.F90	(revision 549)
@@ -0,0 +1,89 @@
+#include "xios_fortran_prefix.hpp"
+
+MODULE ICALENDAR_WRAPPER
+   USE, INTRINSIC :: ISO_C_BINDING
+   USE CALENDAR_WRAPPER_INTERFACE
+   USE IDATE
+   USE IDURATION
+
+   TYPE txios(calendar_wrapper)
+      INTEGER(kind = C_INTPTR_T) :: daddr
+   END TYPE txios(calendar_wrapper)
+
+   CONTAINS ! Fonctions disponibles pour les utilisateurs.
+
+   SUBROUTINE xios(get_calendar_wrapper_handle)(idt, ret)
+      IMPLICIT NONE
+      CHARACTER(len = *),            INTENT(IN)  :: idt
+      TYPE(txios(calendar_wrapper)), INTENT(OUT) :: ret
+
+      CALL cxios_calendar_wrapper_handle_create(ret%daddr, idt, len(idt))
+   END SUBROUTINE xios(get_calendar_wrapper_handle)
+
+   SUBROUTINE xios(get_default_calendar_wrapper_handle)(ret)
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(OUT) :: ret
+
+      CALL cxios_get_current_calendar_wrapper(ret%daddr)
+   END SUBROUTINE xios(get_default_calendar_wrapper_handle)
+
+   LOGICAL FUNCTION xios(is_valid_calendar_wrapper)(idt)
+      IMPLICIT NONE
+      CHARACTER(len  = *), INTENT(IN) :: idt
+      LOGICAL  (kind = 1)             :: val
+
+      CALL cxios_calendar_wrapper_valid_id(val, idt, len(idt));
+      xios(is_valid_calendar_wrapper) = val
+   END FUNCTION  xios(is_valid_calendar_wrapper)
+
+   SUBROUTINE xios(create_calendar)(hdl)
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl
+
+      CALL cxios_create_calendar(hdl%daddr)
+   END SUBROUTINE xios(create_calendar)
+
+   SUBROUTINE xios(update_calendar_timestep)(hdl)
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl
+
+      CALL cxios_update_calendar_timestep(hdl%daddr)
+   END SUBROUTINE xios(update_calendar_timestep)
+
+   SUBROUTINE xios(set_start_date_hdl)(hdl, start_date)
+      USE IDATE
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl
+      TYPE(txios(date)),             INTENT(IN) :: start_date
+
+      CALL cxios_set_calendar_wrapper_date_start_date(hdl%daddr, start_date)
+   END SUBROUTINE xios(set_start_date_hdl)
+
+   SUBROUTINE xios(get_start_date_hdl)(hdl, start_date)
+      USE IDATE
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN)  :: hdl
+      TYPE(txios(date)),             INTENT(OUT) :: start_date
+
+      CALL cxios_get_calendar_wrapper_date_start_date(hdl%daddr, start_date)
+   END SUBROUTINE xios(get_start_date_hdl)
+
+   SUBROUTINE xios(set_time_origin_hdl)(hdl, time_origin)
+      USE IDATE
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl
+      TYPE(txios(date)),             INTENT(IN) :: time_origin
+
+      CALL cxios_set_calendar_wrapper_date_time_origin(hdl%daddr, time_origin)
+   END SUBROUTINE xios(set_time_origin_hdl)
+
+   SUBROUTINE xios(get_time_origin_hdl)(hdl, time_origin)
+      USE IDATE
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN)  :: hdl
+      TYPE(txios(date)),             INTENT(OUT) :: time_origin
+
+      CALL cxios_get_calendar_wrapper_date_time_origin(hdl%daddr, time_origin)
+   END SUBROUTINE xios(get_time_origin_hdl)
+
+END MODULE ICALENDAR_WRAPPER
Index: XIOS/trunk/src/interface/fortran/idate.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/idate.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran/idate.F90	(revision 549)
@@ -37,4 +37,8 @@
    END INTERFACE
 
+   INTERFACE ASSIGNMENT(=)
+      MODULE PROCEDURE xios(date_assign_duration)
+   END INTERFACE
+
    CONTAINS ! Fonctions disponibles pour les utilisateurs.
 
@@ -140,3 +144,58 @@
    END FUNCTION xios(date_ge)
 
+   SUBROUTINE xios(date_assign_duration)(date, dur)
+      USE DATE_INTERFACE, only : txios(date)
+      USE IDURATION, only : txios(duration)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      TYPE(txios(duration)), INTENT(IN) :: dur
+
+      date = txios(date)(0, 1, 1, 0, 0, 0) + dur
+   END SUBROUTINE xios(date_assign_duration)
+
+   FUNCTION xios(date_get_second_of_year)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      INTEGER(kind = C_INT) :: res
+
+      res = cxios_date_get_second_of_year(date)
+   END FUNCTION xios(date_get_second_of_year)
+
+   FUNCTION xios(date_get_day_of_year)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      REAL(kind = C_DOUBLE) :: res
+
+      res = cxios_date_get_day_of_year(date)
+   END FUNCTION xios(date_get_day_of_year)
+
+   FUNCTION xios(date_get_fraction_of_year)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      REAL(kind = C_DOUBLE) :: res
+
+      res = cxios_date_get_fraction_of_year(date)
+   END FUNCTION xios(date_get_fraction_of_year)
+
+   FUNCTION xios(date_get_second_of_day)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      INTEGER(kind = C_INT) :: res
+
+      res = cxios_date_get_second_of_day(date)
+   END FUNCTION xios(date_get_second_of_day)
+
+   FUNCTION xios(date_get_fraction_of_day)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      REAL(kind = C_DOUBLE) :: res
+
+      res = cxios_date_get_fraction_of_day(date)
+   END FUNCTION xios(date_get_fraction_of_day)
+
 END MODULE IDATE
Index: XIOS/trunk/src/interface/fortran/ixios.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/ixios.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran/ixios.F90	(revision 549)
@@ -3,5 +3,8 @@
 MODULE XIOS
 
-USE icalendar, ONLY : xios(set_calendar), xios(set_timestep), xios(update_calendar)
+USE icalendar, ONLY : xios(define_calendar), xios(set_timestep), xios(set_start_date), xios(set_time_origin), &
+                      xios(get_calendar_type), xios(get_timestep), xios(get_start_date), xios(get_time_origin), &
+                      xios(update_calendar), xios(get_current_date), &
+                      xios(get_year_length_in_seconds), xios(get_day_length_in_seconds)
 
 USE icontext, ONLY : txios(context), xios(get_context_handle), xios(set_current_context),    &
@@ -24,6 +27,9 @@
                   xios(date_add_duration), xios(date_sub_duration), xios(date_sub), &
                   xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge), &
+                  xios(date_get_second_of_year), xios(date_get_day_of_year), xios(date_get_fraction_of_year), &
+                  xios(date_get_second_of_day), xios(date_get_fraction_of_day), &
                   OPERATOR(+), OPERATOR(-), &
-                  OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=)
+                  OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=), &
+                  ASSIGNMENT(=)
 
 USE idomain, ONLY : txios(domain), txios(domaingroup), xios(get_domain_handle),  &
@@ -200,5 +206,8 @@
            xios(field_is_active)
 
- PUBLIC :: xios(set_calendar), xios(set_timestep), xios(update_calendar)
+ PUBLIC :: xios(define_calendar), xios(set_timestep), xios(set_start_date), xios(set_time_origin), &
+           xios(get_calendar_type), xios(get_timestep), xios(get_start_date), xios(get_time_origin), &
+           xios(update_calendar), xios(get_current_date), &
+           xios(get_year_length_in_seconds), xios(get_day_length_in_seconds)
 
  PUBLIC :: xios(year), xios(month), xios(day), xios(hour), xios(minute), xios(second), xios(timestep), &
@@ -208,8 +217,11 @@
  PUBLIC :: xios(date_convert_to_seconds), &
            xios(date_add_duration), xios(date_sub_duration), xios(date_sub), &
-           xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge)
+           xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge), &
+           xios(date_get_second_of_year), xios(date_get_day_of_year), xios(date_get_fraction_of_year), &
+           xios(date_get_second_of_day), xios(date_get_fraction_of_day)
 
  PUBLIC :: OPERATOR(+), OPERATOR(-), OPERATOR(*), &
-           OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=)
+           OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=), &
+           ASSIGNMENT(=)
 
  PUBLIC :: xios(getVar)
Index: XIOS/trunk/src/interface/fortran_attr/calendar_wrapper_interface_attr.F90
===================================================================
--- XIOS/trunk/src/interface/fortran_attr/calendar_wrapper_interface_attr.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran_attr/calendar_wrapper_interface_attr.F90	(revision 549)
@@ -0,0 +1,98 @@
+! * ************************************************************************** *
+! *               Interface auto generated - do not modify                     *
+! * ************************************************************************** *
+#include "../fortran/xios_fortran_prefix.hpp"
+
+MODULE calendar_wrapper_interface_attr
+  USE, INTRINSIC :: ISO_C_BINDING
+  
+  INTERFACE ! Do not call directly / interface FORTRAN 2003 <-> C99
+    
+    
+    SUBROUTINE cxios_set_calendar_wrapper_start_date(calendar_wrapper_hdl, start_date, start_date_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: start_date
+      INTEGER  (kind = C_INT)     , VALUE        :: start_date_size
+    END SUBROUTINE cxios_set_calendar_wrapper_start_date
+    
+    SUBROUTINE cxios_get_calendar_wrapper_start_date(calendar_wrapper_hdl, start_date, start_date_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: start_date
+      INTEGER  (kind = C_INT)     , VALUE        :: start_date_size
+    END SUBROUTINE cxios_get_calendar_wrapper_start_date
+    
+    FUNCTION cxios_is_defined_calendar_wrapper_start_date(calendar_wrapper_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_start_date
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+    END FUNCTION cxios_is_defined_calendar_wrapper_start_date
+    
+    
+    SUBROUTINE cxios_set_calendar_wrapper_time_origin(calendar_wrapper_hdl, time_origin, time_origin_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: time_origin
+      INTEGER  (kind = C_INT)     , VALUE        :: time_origin_size
+    END SUBROUTINE cxios_set_calendar_wrapper_time_origin
+    
+    SUBROUTINE cxios_get_calendar_wrapper_time_origin(calendar_wrapper_hdl, time_origin, time_origin_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: time_origin
+      INTEGER  (kind = C_INT)     , VALUE        :: time_origin_size
+    END SUBROUTINE cxios_get_calendar_wrapper_time_origin
+    
+    FUNCTION cxios_is_defined_calendar_wrapper_time_origin(calendar_wrapper_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_time_origin
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+    END FUNCTION cxios_is_defined_calendar_wrapper_time_origin
+    
+    
+    SUBROUTINE cxios_set_calendar_wrapper_timestep(calendar_wrapper_hdl, timestep) BIND(C)
+      USE ISO_C_BINDING
+      USE IDURATION
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      TYPE(txios(duration)), VALUE :: timestep
+    END SUBROUTINE cxios_set_calendar_wrapper_timestep
+    
+    SUBROUTINE cxios_get_calendar_wrapper_timestep(calendar_wrapper_hdl, timestep) BIND(C)
+      USE ISO_C_BINDING
+      USE IDURATION
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      TYPE(txios(duration)) :: timestep
+    END SUBROUTINE cxios_get_calendar_wrapper_timestep
+    
+    FUNCTION cxios_is_defined_calendar_wrapper_timestep(calendar_wrapper_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_timestep
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+    END FUNCTION cxios_is_defined_calendar_wrapper_timestep
+    
+    
+    SUBROUTINE cxios_set_calendar_wrapper_type(calendar_wrapper_hdl, type, type_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: type
+      INTEGER  (kind = C_INT)     , VALUE        :: type_size
+    END SUBROUTINE cxios_set_calendar_wrapper_type
+    
+    SUBROUTINE cxios_get_calendar_wrapper_type(calendar_wrapper_hdl, type, type_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: type
+      INTEGER  (kind = C_INT)     , VALUE        :: type_size
+    END SUBROUTINE cxios_get_calendar_wrapper_type
+    
+    FUNCTION cxios_is_defined_calendar_wrapper_type(calendar_wrapper_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_type
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+    END FUNCTION cxios_is_defined_calendar_wrapper_type
+    
+    
+    END INTERFACE
+  
+END MODULE calendar_wrapper_interface_attr
Index: XIOS/trunk/src/interface/fortran_attr/context_interface_attr.F90
===================================================================
--- XIOS/trunk/src/interface/fortran_attr/context_interface_attr.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran_attr/context_interface_attr.F90	(revision 549)
@@ -8,25 +8,4 @@
   
   INTERFACE ! Do not call directly / interface FORTRAN 2003 <-> C99
-    
-    
-    SUBROUTINE cxios_set_context_calendar_type(context_hdl, calendar_type, calendar_type_size) BIND(C)
-      USE ISO_C_BINDING
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: calendar_type
-      INTEGER  (kind = C_INT)     , VALUE        :: calendar_type_size
-    END SUBROUTINE cxios_set_context_calendar_type
-    
-    SUBROUTINE cxios_get_context_calendar_type(context_hdl, calendar_type, calendar_type_size) BIND(C)
-      USE ISO_C_BINDING
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: calendar_type
-      INTEGER  (kind = C_INT)     , VALUE        :: calendar_type_size
-    END SUBROUTINE cxios_get_context_calendar_type
-    
-    FUNCTION cxios_is_defined_context_calendar_type(context_hdl ) BIND(C)
-      USE ISO_C_BINDING
-      LOGICAL(kind=C_BOOL) :: cxios_is_defined_context_calendar_type
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-    END FUNCTION cxios_is_defined_context_calendar_type
     
     
@@ -52,67 +31,4 @@
     
     
-    SUBROUTINE cxios_set_context_start_date(context_hdl, start_date) BIND(C)
-      USE ISO_C_BINDING
-      USE IDATE
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(date)), VALUE :: start_date
-    END SUBROUTINE cxios_set_context_start_date
-    
-    SUBROUTINE cxios_get_context_start_date(context_hdl, start_date) BIND(C)
-      USE ISO_C_BINDING
-      USE IDATE
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(date)) :: start_date
-    END SUBROUTINE cxios_get_context_start_date
-    
-    FUNCTION cxios_is_defined_context_start_date(context_hdl ) BIND(C)
-      USE ISO_C_BINDING
-      LOGICAL(kind=C_BOOL) :: cxios_is_defined_context_start_date
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-    END FUNCTION cxios_is_defined_context_start_date
-    
-    
-    SUBROUTINE cxios_set_context_time_origin(context_hdl, time_origin) BIND(C)
-      USE ISO_C_BINDING
-      USE IDATE
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(date)), VALUE :: time_origin
-    END SUBROUTINE cxios_set_context_time_origin
-    
-    SUBROUTINE cxios_get_context_time_origin(context_hdl, time_origin) BIND(C)
-      USE ISO_C_BINDING
-      USE IDATE
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(date)) :: time_origin
-    END SUBROUTINE cxios_get_context_time_origin
-    
-    FUNCTION cxios_is_defined_context_time_origin(context_hdl ) BIND(C)
-      USE ISO_C_BINDING
-      LOGICAL(kind=C_BOOL) :: cxios_is_defined_context_time_origin
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-    END FUNCTION cxios_is_defined_context_time_origin
-    
-    
-    SUBROUTINE cxios_set_context_timestep(context_hdl, timestep) BIND(C)
-      USE ISO_C_BINDING
-      USE IDURATION
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(duration)), VALUE :: timestep
-    END SUBROUTINE cxios_set_context_timestep
-    
-    SUBROUTINE cxios_get_context_timestep(context_hdl, timestep) BIND(C)
-      USE ISO_C_BINDING
-      USE IDURATION
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(duration)) :: timestep
-    END SUBROUTINE cxios_get_context_timestep
-    
-    FUNCTION cxios_is_defined_context_timestep(context_hdl ) BIND(C)
-      USE ISO_C_BINDING
-      LOGICAL(kind=C_BOOL) :: cxios_is_defined_context_timestep
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-    END FUNCTION cxios_is_defined_context_timestep
-    
-    
     END INTERFACE
   
Index: XIOS/trunk/src/interface/fortran_attr/icalendar_wrapper_attr.F90
===================================================================
--- XIOS/trunk/src/interface/fortran_attr/icalendar_wrapper_attr.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran_attr/icalendar_wrapper_attr.F90	(revision 549)
@@ -0,0 +1,215 @@
+! * ************************************************************************** *
+! *               Interface auto generated - do not modify                     *
+! * ************************************************************************** *
+#include "xios_fortran_prefix.hpp"
+
+MODULE icalendar_wrapper_attr
+  USE, INTRINSIC :: ISO_C_BINDING
+  USE icalendar_wrapper
+  USE calendar_wrapper_interface_attr
+  
+CONTAINS
+  
+  SUBROUTINE xios(set_calendar_wrapper_attr)  &
+    ( calendar_wrapper_id, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl
+      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin
+      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
+      
+      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl)
+      CALL xios(set_calendar_wrapper_attr_hdl_)   &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(set_calendar_wrapper_attr)
+  
+  SUBROUTINE xios(set_calendar_wrapper_attr_hdl)  &
+    ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin
+      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
+      
+      CALL xios(set_calendar_wrapper_attr_hdl_)  &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(set_calendar_wrapper_attr_hdl)
+  
+  SUBROUTINE xios(set_calendar_wrapper_attr_hdl_)   &
+    ( calendar_wrapper_hdl, start_date_, time_origin_, timestep_, type_ )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date_
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin_
+      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep_
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_
+      
+      IF (PRESENT(start_date_)) THEN
+        CALL cxios_set_calendar_wrapper_start_date(calendar_wrapper_hdl%daddr, start_date_, len(start_date_))
+      ENDIF
+      
+      IF (PRESENT(time_origin_)) THEN
+        CALL cxios_set_calendar_wrapper_time_origin(calendar_wrapper_hdl%daddr, time_origin_, len(time_origin_))
+      ENDIF
+      
+      IF (PRESENT(timestep_)) THEN
+        CALL cxios_set_calendar_wrapper_timestep(calendar_wrapper_hdl%daddr, timestep_)
+      ENDIF
+      
+      IF (PRESENT(type_)) THEN
+        CALL cxios_set_calendar_wrapper_type(calendar_wrapper_hdl%daddr, type_, len(type_))
+      ENDIF
+      
+      
+    
+  END SUBROUTINE xios(set_calendar_wrapper_attr_hdl_)
+  
+  SUBROUTINE xios(get_calendar_wrapper_attr)  &
+    ( calendar_wrapper_id, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl
+      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin
+      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
+      
+      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl)
+      CALL xios(get_calendar_wrapper_attr_hdl_)   &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(get_calendar_wrapper_attr)
+  
+  SUBROUTINE xios(get_calendar_wrapper_attr_hdl)  &
+    ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin
+      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
+      
+      CALL xios(get_calendar_wrapper_attr_hdl_)  &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(get_calendar_wrapper_attr_hdl)
+  
+  SUBROUTINE xios(get_calendar_wrapper_attr_hdl_)   &
+    ( calendar_wrapper_hdl, start_date_, time_origin_, timestep_, type_ )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date_
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin_
+      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep_
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_
+      
+      IF (PRESENT(start_date_)) THEN
+        CALL cxios_get_calendar_wrapper_start_date(calendar_wrapper_hdl%daddr, start_date_, len(start_date_))
+      ENDIF
+      
+      IF (PRESENT(time_origin_)) THEN
+        CALL cxios_get_calendar_wrapper_time_origin(calendar_wrapper_hdl%daddr, time_origin_, len(time_origin_))
+      ENDIF
+      
+      IF (PRESENT(timestep_)) THEN
+        CALL cxios_get_calendar_wrapper_timestep(calendar_wrapper_hdl%daddr, timestep_)
+      ENDIF
+      
+      IF (PRESENT(type_)) THEN
+        CALL cxios_get_calendar_wrapper_type(calendar_wrapper_hdl%daddr, type_, len(type_))
+      ENDIF
+      
+      
+    
+  END SUBROUTINE xios(get_calendar_wrapper_attr_hdl_)
+  
+  SUBROUTINE xios(is_defined_calendar_wrapper_attr)  &
+    ( calendar_wrapper_id, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl
+      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id
+      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
+      LOGICAL(KIND=C_BOOL) :: start_date_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
+      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
+      LOGICAL(KIND=C_BOOL) :: timestep_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: type
+      LOGICAL(KIND=C_BOOL) :: type_tmp
+      
+      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl)
+      CALL xios(is_defined_calendar_wrapper_attr_hdl_)   &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(is_defined_calendar_wrapper_attr)
+  
+  SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl)  &
+    ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
+      LOGICAL(KIND=C_BOOL) :: start_date_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
+      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
+      LOGICAL(KIND=C_BOOL) :: timestep_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: type
+      LOGICAL(KIND=C_BOOL) :: type_tmp
+      
+      CALL xios(is_defined_calendar_wrapper_attr_hdl_)  &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl)
+  
+  SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl_)   &
+    ( calendar_wrapper_hdl, start_date_, time_origin_, timestep_, type_ )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date_
+      LOGICAL(KIND=C_BOOL) :: start_date__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin_
+      LOGICAL(KIND=C_BOOL) :: time_origin__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep_
+      LOGICAL(KIND=C_BOOL) :: timestep__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: type_
+      LOGICAL(KIND=C_BOOL) :: type__tmp
+      
+      IF (PRESENT(start_date_)) THEN
+        start_date__tmp=cxios_is_defined_calendar_wrapper_start_date(calendar_wrapper_hdl%daddr)
+        start_date_=start_date__tmp
+      ENDIF
+      
+      IF (PRESENT(time_origin_)) THEN
+        time_origin__tmp=cxios_is_defined_calendar_wrapper_time_origin(calendar_wrapper_hdl%daddr)
+        time_origin_=time_origin__tmp
+      ENDIF
+      
+      IF (PRESENT(timestep_)) THEN
+        timestep__tmp=cxios_is_defined_calendar_wrapper_timestep(calendar_wrapper_hdl%daddr)
+        timestep_=timestep__tmp
+      ENDIF
+      
+      IF (PRESENT(type_)) THEN
+        type__tmp=cxios_is_defined_calendar_wrapper_type(calendar_wrapper_hdl%daddr)
+        type_=type__tmp
+      ENDIF
+      
+      
+    
+  END SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl_)
+  
+END MODULE icalendar_wrapper_attr
Index: XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90
===================================================================
--- XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90	(revision 549)
@@ -12,66 +12,38 @@
   
   SUBROUTINE xios(set_context_attr)  &
-    ( context_id, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_id, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context))  :: context_hdl
       CHARACTER(LEN=*), INTENT(IN) ::context_id
-      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: calendar_type
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: start_date
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: time_origin
-      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
       
       CALL xios(get_context_handle)(context_id,context_hdl)
       CALL xios(set_context_attr_hdl_)   &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(set_context_attr)
   
   SUBROUTINE xios(set_context_attr_hdl)  &
-    ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_hdl, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: calendar_type
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: start_date
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: time_origin
-      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
       
       CALL xios(set_context_attr_hdl_)  &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(set_context_attr_hdl)
   
   SUBROUTINE xios(set_context_attr_hdl_)   &
-    ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ )
+    ( context_hdl, output_dir_ )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: calendar_type_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir_
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: start_date_
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: time_origin_
-      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep_
-      
-      IF (PRESENT(calendar_type_)) THEN
-        CALL cxios_set_context_calendar_type(context_hdl%daddr, calendar_type_, len(calendar_type_))
-      ENDIF
       
       IF (PRESENT(output_dir_)) THEN
         CALL cxios_set_context_output_dir(context_hdl%daddr, output_dir_, len(output_dir_))
-      ENDIF
-      
-      IF (PRESENT(start_date_)) THEN
-        CALL cxios_set_context_start_date(context_hdl%daddr, start_date_)
-      ENDIF
-      
-      IF (PRESENT(time_origin_)) THEN
-        CALL cxios_set_context_time_origin(context_hdl%daddr, time_origin_)
-      ENDIF
-      
-      IF (PRESENT(timestep_)) THEN
-        CALL cxios_set_context_timestep(context_hdl%daddr, timestep_)
       ENDIF
       
@@ -81,66 +53,38 @@
   
   SUBROUTINE xios(get_context_attr)  &
-    ( context_id, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_id, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context))  :: context_hdl
       CHARACTER(LEN=*), INTENT(IN) ::context_id
-      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: calendar_type
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: start_date
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: time_origin
-      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
       
       CALL xios(get_context_handle)(context_id,context_hdl)
       CALL xios(get_context_attr_hdl_)   &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(get_context_attr)
   
   SUBROUTINE xios(get_context_attr_hdl)  &
-    ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_hdl, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: calendar_type
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: start_date
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: time_origin
-      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
       
       CALL xios(get_context_attr_hdl_)  &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(get_context_attr_hdl)
   
   SUBROUTINE xios(get_context_attr_hdl_)   &
-    ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ )
+    ( context_hdl, output_dir_ )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: calendar_type_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir_
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: start_date_
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: time_origin_
-      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep_
-      
-      IF (PRESENT(calendar_type_)) THEN
-        CALL cxios_get_context_calendar_type(context_hdl%daddr, calendar_type_, len(calendar_type_))
-      ENDIF
       
       IF (PRESENT(output_dir_)) THEN
         CALL cxios_get_context_output_dir(context_hdl%daddr, output_dir_, len(output_dir_))
-      ENDIF
-      
-      IF (PRESENT(start_date_)) THEN
-        CALL cxios_get_context_start_date(context_hdl%daddr, start_date_)
-      ENDIF
-      
-      IF (PRESENT(time_origin_)) THEN
-        CALL cxios_get_context_time_origin(context_hdl%daddr, time_origin_)
-      ENDIF
-      
-      IF (PRESENT(timestep_)) THEN
-        CALL cxios_get_context_timestep(context_hdl%daddr, timestep_)
       ENDIF
       
@@ -150,86 +94,42 @@
   
   SUBROUTINE xios(is_defined_context_attr)  &
-    ( context_id, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_id, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context))  :: context_hdl
       CHARACTER(LEN=*), INTENT(IN) ::context_id
-      LOGICAL, OPTIONAL, INTENT(OUT) :: calendar_type
-      LOGICAL(KIND=C_BOOL) :: calendar_type_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: output_dir
       LOGICAL(KIND=C_BOOL) :: output_dir_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
-      LOGICAL(KIND=C_BOOL) :: start_date_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
-      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
-      LOGICAL(KIND=C_BOOL) :: timestep_tmp
       
       CALL xios(get_context_handle)(context_id,context_hdl)
       CALL xios(is_defined_context_attr_hdl_)   &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(is_defined_context_attr)
   
   SUBROUTINE xios(is_defined_context_attr_hdl)  &
-    ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_hdl, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      LOGICAL, OPTIONAL, INTENT(OUT) :: calendar_type
-      LOGICAL(KIND=C_BOOL) :: calendar_type_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: output_dir
       LOGICAL(KIND=C_BOOL) :: output_dir_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
-      LOGICAL(KIND=C_BOOL) :: start_date_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
-      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
-      LOGICAL(KIND=C_BOOL) :: timestep_tmp
       
       CALL xios(is_defined_context_attr_hdl_)  &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(is_defined_context_attr_hdl)
   
   SUBROUTINE xios(is_defined_context_attr_hdl_)   &
-    ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ )
+    ( context_hdl, output_dir_ )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      LOGICAL, OPTIONAL, INTENT(OUT) :: calendar_type_
-      LOGICAL(KIND=C_BOOL) :: calendar_type__tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: output_dir_
       LOGICAL(KIND=C_BOOL) :: output_dir__tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date_
-      LOGICAL(KIND=C_BOOL) :: start_date__tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin_
-      LOGICAL(KIND=C_BOOL) :: time_origin__tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep_
-      LOGICAL(KIND=C_BOOL) :: timestep__tmp
-      
-      IF (PRESENT(calendar_type_)) THEN
-        calendar_type__tmp=cxios_is_defined_context_calendar_type(context_hdl%daddr)
-        calendar_type_=calendar_type__tmp
-      ENDIF
       
       IF (PRESENT(output_dir_)) THEN
         output_dir__tmp=cxios_is_defined_context_output_dir(context_hdl%daddr)
         output_dir_=output_dir__tmp
-      ENDIF
-      
-      IF (PRESENT(start_date_)) THEN
-        start_date__tmp=cxios_is_defined_context_start_date(context_hdl%daddr)
-        start_date_=start_date__tmp
-      ENDIF
-      
-      IF (PRESENT(time_origin_)) THEN
-        time_origin__tmp=cxios_is_defined_context_time_origin(context_hdl%daddr)
-        time_origin_=time_origin__tmp
-      ENDIF
-      
-      IF (PRESENT(timestep_)) THEN
-        timestep__tmp=cxios_is_defined_context_timestep(context_hdl%daddr)
-        timestep_=timestep__tmp
       ENDIF
       
