Ignore:
Timestamp:
12/11/18 13:22:07 (5 years ago)
Author:
oabramkina
Message:

Exception handling on trunk.

To activate it, compilation flag -DXIOS_EXCEPTION should be added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/interface/c/icdate.cpp

    r1542 r1622  
    3535{ 
    3636  long long int cxios_date_convert_to_seconds(cxios_date date_c) 
     37  TRY 
    3738  { 
    3839    xios::CDate date = xios::CDate(getCalendar("long long int cxios_date_convert_to_seconds(cxios_date date_c)"), 
     
    4142    return date; 
    4243  } 
     44  CATCH_DUMP_STACK 
    4345 
    4446  void cxios_date_convert_to_string(cxios_date date_c, char* str, int str_size) 
     47  TRY 
    4548  { 
    4649    xios::CDate date = xios::CDate(getCalendar("void cxios_date_convert_to_string(cxios_date date_c, char* str, int str_size)"), 
     
    5154      ERROR("void cxios_date_convert_to_string(cxios_date date_c, char* str, int str_size)", << "Input string is too short"); 
    5255  } 
     56  CATCH_DUMP_STACK 
    5357 
    5458  cxios_date cxios_date_convert_from_string(const char* str, int str_size) 
     59  TRY 
    5560  { 
    5661    std::string date_str; 
     
    6368    return { date.getYear(), date.getMonth(), date.getDay(), date.getHour(), date.getMinute(), date.getSecond() }; 
    6469  } 
     70  CATCH_DUMP_STACK 
    6571 
    6672  cxios_date cxios_date_add_duration(cxios_date date_c, cxios_duration dur_c) 
     73  TRY 
    6774  { 
    6875    xios::CDate date = xios::CDate(getCalendar("cxios_date cxios_date_add_duration(cxios_date date_c, cxios_duration dur_c)"), 
     
    7380    return { res.getYear(), res.getMonth(), res.getDay(), res.getHour(), res.getMinute(), res.getSecond() }; 
    7481  } 
     82  CATCH_DUMP_STACK 
    7583 
    7684  cxios_date cxios_date_sub_duration(cxios_date date_c, cxios_duration dur_c) 
     85  TRY 
    7786  { 
    7887    xios::CDate date = xios::CDate(getCalendar("cxios_date cxios_date_sub_duration(cxios_date date_c, cxios_duration dur_c)"), 
     
    8493    return { res.getYear(), res.getMonth(), res.getDay(), res.getHour(), res.getMinute(), res.getSecond() }; 
    8594  } 
     95  CATCH_DUMP_STACK 
    8696 
    8797  cxios_duration cxios_date_sub(cxios_date date1_c, cxios_date date2_c) 
     98  TRY 
    8899  { 
    89100    xios::CDate date1 = xios::CDate(getCalendar("cxios_duration cxios_date_sub(cxios_date date1_c, cxios_date date2_c)"), 
     
    96107    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
    97108  } 
     109  CATCH_DUMP_STACK 
    98110 
    99111  bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c) 
     112  TRY 
    100113  { 
    101114    xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 
     
    107120    return (date1 == date2); 
    108121  } 
     122  CATCH_DUMP_STACK 
    109123 
    110124  bool cxios_date_neq(cxios_date date1_c, cxios_date date2_c) 
     125  TRY 
    111126  { 
    112127    xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 
     
    118133    return (date1 != date2); 
    119134  } 
     135  CATCH_DUMP_STACK 
    120136 
    121137  bool cxios_date_lt(cxios_date date1_c, cxios_date date2_c) 
     138  TRY 
    122139  { 
    123140    xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 
     
    129146    return (date1 < date2); 
    130147  } 
     148  CATCH_DUMP_STACK 
    131149 
    132150  bool cxios_date_le(cxios_date date1_c, cxios_date date2_c) 
     151  TRY 
    133152  { 
    134153    xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 
     
    140159    return (date1 <= date2); 
    141160  } 
     161  CATCH_DUMP_STACK 
    142162 
    143163  bool cxios_date_gt(cxios_date date1_c, cxios_date date2_c) 
     164  TRY 
    144165  { 
    145166    xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 
     
    151172    return (date1 > date2); 
    152173  } 
     174  CATCH_DUMP_STACK 
    153175 
    154176  bool cxios_date_ge(cxios_date date1_c, cxios_date date2_c) 
     177  TRY 
    155178  { 
    156179    xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 
     
    162185    return (date1 >= date2); 
    163186  } 
     187  CATCH_DUMP_STACK 
    164188 
    165189  int cxios_date_get_second_of_year(cxios_date date_c) 
     190  TRY 
    166191  { 
    167192    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_second_of_year(cxios_date date_c)"), 
     
    170195    return date.getSecondOfYear(); 
    171196  } 
     197  CATCH_DUMP_STACK 
    172198 
    173199  double cxios_date_get_day_of_year(cxios_date date_c) 
     200  TRY 
    174201  { 
    175202    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_day_of_year(cxios_date date_c)"), 
     
    178205    return date.getDayOfYear(); 
    179206  } 
     207  CATCH_DUMP_STACK 
    180208 
    181209  double cxios_date_get_fraction_of_year(cxios_date date_c) 
     210  TRY 
    182211  { 
    183212    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_fraction_of_year(cxios_date date_c)"), 
     
    186215    return date.getFractionOfYear(); 
    187216  } 
     217  CATCH_DUMP_STACK 
    188218 
    189219  int cxios_date_get_second_of_day(cxios_date date_c) 
     220  TRY 
    190221  { 
    191222    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_second_of_day(cxios_date date_c)"), 
     
    194225    return date.getSecondOfDay(); 
    195226  } 
     227  CATCH_DUMP_STACK 
    196228 
    197229  double cxios_date_get_fraction_of_day(cxios_date date_c) 
     230  TRY 
    198231  { 
    199232    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_fraction_of_day(cxios_date date_c)"), 
     
    202235    return date.getFractionOfDay(); 
    203236  } 
     237  CATCH_DUMP_STACK 
    204238} // extern "C" 
Note: See TracChangeset for help on using the changeset viewer.