Changeset 2509 in Sophya


Ignore:
Timestamp:
Mar 15, 2004, 10:14:46 PM (22 years ago)
Author:
ansari
Message:

Correction bug introduit suite au remplacement THROW par throw ds dates.cc : mot cle throw oublie - Reza 15 Mars 2004

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/NTools/dates.cc

    r2506 r2509  
    428428    if (p[0] == '?' && (p[1] == '?' || p[1] == '/'))   JJ = -1;
    429429    else {
    430       if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
    431       if (!isdigit(p[1]) && p[1] != '/') ParmError(PExcLongMessage(""));
     430      if (!isdigit(p[0])) throw ParmError(PExcLongMessage(""));
     431      if (!isdigit(p[1]) && p[1] != '/') throw ParmError(PExcLongMessage(""));
    432432      JJ = atoi(p);
    433       if (JJ <= 0) ParmError(PExcLongMessage(""));
     433      if (JJ <= 0) throw ParmError(PExcLongMessage(""));
    434434    }
    435435   
    436436    if (p[1] == '/') p += 2;
    437437    else if (p[2] == '/') p+= 3;
    438     else ParmError(PExcLongMessage(""));
     438    else throw ParmError(PExcLongMessage(""));
    439439
    440440    if (p[0] == '?' && (p[1] == '?' || p[1] == '/'))   MM = -1;
    441441    else {
    442       if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
    443       if (!isdigit(p[1]) && p[1] != '/') ParmError(PExcLongMessage(""));
     442      if (!isdigit(p[0])) throw ParmError(PExcLongMessage(""));
     443      if (!isdigit(p[1]) && p[1] != '/') throw ParmError(PExcLongMessage(""));
    444444      MM = atoi(p);
    445       if (MM <= 0 || MM >12) ParmError(PExcLongMessage(""));
     445      if (MM <= 0 || MM >12) throw ParmError(PExcLongMessage(""));
    446446    }
    447447
    448448    if (p[1] == '/') p += 2;
    449449    else if (p[2] == '/') p+= 3;
    450     else ParmError(PExcLongMessage(""));
     450    else throw ParmError(PExcLongMessage(""));
    451451
    452452    if (p[0] == '?')  AA = -1;
    453453    else {
    454       if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
    455       if (!isdigit(p[1])) ParmError(PExcLongMessage(""));
     454      if (!isdigit(p[0])) throw ParmError(PExcLongMessage(""));
     455      if (!isdigit(p[1])) throw ParmError(PExcLongMessage(""));
    456456      AA = atoi(p);
    457457      if (AA < 100 && AA >= 0 && date[6] != '0') AA += 1900;
    458458    }
    459459   
    460     if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) ParmError(PExcLongMessage(""));
     460    if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA))
     461      throw ParmError(PExcLongMessage(""));
    461462   
    462463   } else if (strlen(date)==4) {      // Code EROS de date
    463464     if (date[0] == '?') AA = -1;
    464465     else {
    465        if (!isdigit(date[0])) ParmError(PExcLongMessage(""));
     466       if (!isdigit(date[0])) throw ParmError(PExcLongMessage(""));
    466467       AA = 1990 + date[0] - '0';
    467468     }
     
    469470     if (date[1] == '?') MM = -1;
    470471     else {
    471        if (!isalpha(date[1])) ParmError(PExcLongMessage(""));
     472       if (!isalpha(date[1])) throw ParmError(PExcLongMessage(""));
    472473       if (islower(date[1]))
    473474         MM = date[1] - 'a' + 1;
    474475       else
    475476         MM = date[1] - 'A' + 1;
    476        if (MM<1 || MM>12) ParmError(PExcLongMessage(""));
     477       if (MM<1 || MM>12) throw ParmError(PExcLongMessage(""));
    477478     }
    478479     
    479480     if (date[2] == '?' && date[3] == '?') JJ = -1;
    480481     else {
    481        if (!isdigit(date[2])) ParmError(PExcLongMessage(""));
    482        if (!isdigit(date[3])) ParmError(PExcLongMessage(""));
     482       if (!isdigit(date[2])) throw ParmError(PExcLongMessage(""));
     483       if (!isdigit(date[3])) throw ParmError(PExcLongMessage(""));
    483484       JJ = atoi(date+2);
    484485     }
    485486     
    486      if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) ParmError(PExcLongMessage(""));
     487     if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA))
     488       throw ParmError(PExcLongMessage(""));
    487489     nuit = 1;
    488    } else ParmError(PExcLongMessage(""));   // Mauvaise longueur
     490   } else throw ParmError(PExcLongMessage(""));   // Mauvaise longueur
    489491  } else {                          // Pas de date
    490492    JJ = MM = AA = -1;
     
    495497    if (p[0] == '?' && (p[1] == '?' || p[1] == ':'))   hh = -1;
    496498    else {
    497       if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
    498       if (!isdigit(p[1]) && p[1] != ':') ParmError(PExcLongMessage(""));
     499      if (!isdigit(p[0])) throw ParmError(PExcLongMessage(""));
     500      if (!isdigit(p[1]) && p[1] != ':') throw ParmError(PExcLongMessage(""));
    499501      hh = atoi(p);
    500502    }
     
    502504    if (p[1] == ':') p += 2;
    503505    else if (p[2] == ':') p+= 3;
    504     else ParmError(PExcLongMessage(""));
     506    else throw ParmError(PExcLongMessage(""));
    505507
    506508    if (p[0] == '?' && (p[1] == '?' || p[1] == ':'))   mm = -1;
    507509    else {
    508       if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
    509       if (!isdigit(p[1]) && p[1] != '/') ParmError(PExcLongMessage(""));
     510      if (!isdigit(p[0])) throw ParmError(PExcLongMessage(""));
     511      if (!isdigit(p[1]) && p[1] != '/') throw ParmError(PExcLongMessage(""));
    510512      mm = atoi(p);
    511513    }
     
    513515    if (p[1] == ':') p += 2;
    514516    else if (p[2] == ':') p+= 3;
    515     else ParmError(PExcLongMessage(""));
     517    else throw ParmError(PExcLongMessage(""));
    516518
    517519    if (p[0] == '?')   ss = -1;
    518520    else {
    519       if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
     521      if (!isdigit(p[0])) throw ParmError(PExcLongMessage(""));
    520522      ss = atoi(p);
    521523    }
     
    578580
    579581  if (dt.AA != -1) {
    580     if (dt.AA < 1990 || dt.AA > 2016) ParmError(PExcLongMessage(""));
     582    if (dt.AA < 1990 || dt.AA > 2016) throw ParmError(PExcLongMessage(""));
    581583    int i = dt.AA - 1990;
    582584    if (i<10)
     
    764766//--
    765767{
    766   if (a.UndetTime() != b.UndetTime()) ParmError(PExcLongMessage(""));
    767   if (a.UndetDate() != b.UndetDate()) ParmError(PExcLongMessage(""));
     768  if (a.UndetTime() != b.UndetTime()) throw ParmError(PExcLongMessage(""));
     769  if (a.UndetDate() != b.UndetDate()) throw ParmError(PExcLongMessage(""));
    768770  return a.GetDays() - b.GetDays();
    769771}
Note: See TracChangeset for help on using the changeset viewer.