Changeset 649


Ignore:
Timestamp:
07/24/15 16:40:05 (9 years ago)
Author:
rlacroix
Message:

Simplify a bit the generation of Fortran interfaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/attribute_map.cpp

    r623 r649  
    250250      { 
    251251         oss << "SUBROUTINE xios(set_" << className << "_attr_hdl_)   &" << iendl++; 
    252          ostringstream* oss2; 
    253          SuperClassMap::const_iterator it; 
    254          SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    255  
    256          oss2 = new ostringstream; 
    257  
    258          *oss2 << "( " << className << "_hdl" ; 
    259  
    260          for (it = begin; it != end; it++) 
    261          { 
    262            *oss2 << ", " << it->second->getName() << "_"; 
    263            if (oss2->str().size() > 90) 
    264            { 
    265              oss << oss2->str() << "  &" << iendl; 
    266              delete oss2; 
    267              oss2 = new ostringstream; 
    268            } 
    269          } 
    270          *oss2 << " )"; 
    271          oss << oss2->str() << std::endl; 
    272          oss << iendl; 
    273          delete oss2; 
     252         SuperClassMap::const_iterator it; 
     253         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     254 
     255         long startPos = oss.tellp(); 
     256 
     257         oss << "( " << className << "_hdl"; 
     258         for (it = begin; it != end; it++) 
     259         { 
     260           oss << ", " << it->second->getName() << "_"; 
     261           if (oss.tellp() - startPos > 90) 
     262           { 
     263             oss << "  &" << iendl; 
     264             startPos = oss.tellp(); 
     265           } 
     266         } 
     267         oss << " )"; 
     268         oss << std::endl; 
     269         oss << iendl; 
    274270 
    275271         oss << "IMPLICIT NONE" << iendl++; 
     
    295291      { 
    296292         oss << "SUBROUTINE xios(get_" << className << "_attr_hdl_)   &" << iendl++; 
    297          ostringstream* oss2; 
    298          SuperClassMap::const_iterator it; 
    299          SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    300  
    301          oss2 = new ostringstream; 
    302  
    303          *oss2 << "( " << className << "_hdl" ; 
    304  
    305          for (it = begin; it != end; it++) 
    306          { 
    307            *oss2 << ", " << it->second->getName() << "_"; 
    308            if (oss2->str().size() > 90) 
    309            { 
    310              oss << oss2->str() << "  &" << iendl; 
    311              delete oss2; 
    312              oss2 = new ostringstream; 
    313            } 
    314          } 
    315          *oss2 << " )"; 
    316          oss << oss2->str() << std::endl; 
    317          oss << iendl; 
    318          delete oss2; 
     293         SuperClassMap::const_iterator it; 
     294         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     295 
     296         long startPos = oss.tellp(); 
     297 
     298         oss << "( " << className << "_hdl"; 
     299         for (it = begin; it != end; it++) 
     300         { 
     301           oss << ", " << it->second->getName() << "_"; 
     302           if (oss.tellp() - startPos > 90) 
     303           { 
     304             oss << "  &" << iendl; 
     305             startPos = oss.tellp(); 
     306           } 
     307         } 
     308         oss << " )"; 
     309         oss << std::endl; 
     310         oss << iendl; 
    319311 
    320312         oss << "IMPLICIT NONE" << iendl++; 
     
    340332      { 
    341333         oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl_)   &" << iendl++; 
    342          ostringstream* oss2; 
    343          SuperClassMap::const_iterator it; 
    344          SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    345  
    346          oss2 = new ostringstream; 
    347  
    348          *oss2 << "( " << className << "_hdl" ; 
    349  
    350          for (it = begin; it != end; it++) 
    351          { 
    352            *oss2 << ", " << it->second->getName() << "_"; 
    353            if (oss2->str().size() > 90) 
    354            { 
    355              oss << oss2->str() << "  &" << iendl; 
    356              delete oss2; 
    357              oss2 = new ostringstream; 
    358            } 
    359          } 
    360          *oss2 << " )"; 
    361          oss << oss2->str() << std::endl; 
    362          oss << iendl; 
    363          delete oss2; 
     334         SuperClassMap::const_iterator it; 
     335         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     336 
     337         long startPos = oss.tellp(); 
     338 
     339         oss << "( " << className << "_hdl"; 
     340         for (it = begin; it != end; it++) 
     341         { 
     342           oss << ", " << it->second->getName() << "_"; 
     343           if (oss.tellp() - startPos > 90) 
     344           { 
     345             oss << "  &" << iendl; 
     346             startPos = oss.tellp(); 
     347           } 
     348         } 
     349         oss << " )"; 
     350         oss << std::endl; 
     351         oss << iendl; 
    364352 
    365353         oss << "IMPLICIT NONE" << iendl++; 
     
    385373      { 
    386374         oss << "SUBROUTINE xios(set_" << className << "_attr_hdl)  &" << iendl++; 
    387          ostringstream* oss2; 
    388          SuperClassMap::const_iterator it; 
    389          SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    390  
    391          oss2 = new ostringstream; 
    392          *oss2 << "( " << className << "_hdl" ; 
    393          for (it = begin; it != end; it++) 
    394          { 
    395            *oss2 << ", " << it->second->getName(); 
    396            if (oss2->str().size() > 90) 
    397            { 
    398              oss << oss2->str() << "  &" << iendl; 
    399              delete oss2; 
    400              oss2 = new ostringstream; 
    401            } 
    402          } 
    403          *oss2 << " )"; 
    404          oss << oss2->str() << std::endl; 
    405          oss << iendl; 
    406          delete oss2; 
    407          oss2 = new ostringstream; 
     375         SuperClassMap::const_iterator it; 
     376         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     377 
     378         long startPos = oss.tellp(); 
     379 
     380         oss << "( " << className << "_hdl"; 
     381         for (it = begin; it != end; it++) 
     382         { 
     383           oss << ", " << it->second->getName(); 
     384           if (oss.tellp() - startPos > 90) 
     385           { 
     386             oss << "  &" << iendl; 
     387             startPos = oss.tellp(); 
     388           } 
     389         } 
     390         oss << " )"; 
     391         oss << std::endl; 
     392         oss << iendl; 
    408393 
    409394         oss << "IMPLICIT NONE" << iendl++; 
     
    420405         oss << "CALL xios(set_" << className << "_attr_hdl_)  &" << iendl; 
    421406 
    422          *oss2 << "( " << className << "_hdl" ; 
    423          for (it = begin; it != end; it++) 
    424          { 
    425            *oss2 << ", " << it->second->getName(); 
    426            if (oss2->str().size() > 90) 
    427            { 
    428              oss << oss2->str() << "  &" << iendl; 
    429              delete oss2; 
    430              oss2 = new ostringstream; 
    431            } 
    432          } 
    433          *oss2 << " )"; 
    434          oss << oss2->str(); 
    435          delete oss2; 
     407         startPos = oss.tellp(); 
     408 
     409         oss << "( " << className << "_hdl"; 
     410         for (it = begin; it != end; it++) 
     411         { 
     412           oss << ", " << it->second->getName(); 
     413           if (oss.tellp() - startPos > 90) 
     414           { 
     415             oss << "  &" << iendl; 
     416             startPos = oss.tellp(); 
     417           } 
     418         } 
     419         oss << " )"; 
    436420 
    437421         oss << std::endl << (iendl -= 2); 
     
    442426      { 
    443427         oss << "SUBROUTINE xios(get_" << className << "_attr_hdl)  &" << iendl++; 
    444          ostringstream* oss2; 
    445          SuperClassMap::const_iterator it; 
    446          SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    447  
    448          oss2 = new ostringstream; 
    449          *oss2 << "( " << className << "_hdl" ; 
    450          for (it = begin; it != end; it++) 
    451          { 
    452            *oss2 << ", " << it->second->getName(); 
    453            if (oss2->str().size() > 90) 
    454            { 
    455              oss << oss2->str() << "  &" << iendl; 
    456              delete oss2; 
    457              oss2 = new ostringstream; 
    458            } 
    459          } 
    460          *oss2 << " )"; 
    461          oss << oss2->str() << std::endl; 
    462          oss << iendl; 
    463          delete oss2; 
    464          oss2 = new ostringstream; 
     428         SuperClassMap::const_iterator it; 
     429         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     430 
     431         long startPos = oss.tellp(); 
     432 
     433         oss << "( " << className << "_hdl"; 
     434         for (it = begin; it != end; it++) 
     435         { 
     436           oss << ", " << it->second->getName(); 
     437           if (oss.tellp() - startPos > 90) 
     438           { 
     439             oss << "  &" << iendl; 
     440             startPos = oss.tellp(); 
     441           } 
     442         } 
     443         oss << " )"; 
     444         oss << std::endl; 
     445         oss << iendl; 
    465446 
    466447         oss << "IMPLICIT NONE" << iendl++; 
     
    477458         oss << "CALL xios(get_" << className << "_attr_hdl_)  &" << iendl; 
    478459 
    479          *oss2 << "( " << className << "_hdl" ; 
    480          for (it = begin; it != end; it++) 
    481          { 
    482            *oss2 << ", " << it->second->getName(); 
    483            if (oss2->str().size() > 90) 
    484            { 
    485              oss << oss2->str() << "  &" << iendl; 
    486              delete oss2; 
    487              oss2 = new ostringstream; 
    488            } 
    489          } 
    490          *oss2 << " )"; 
    491          oss << oss2->str(); 
    492          delete oss2; 
     460         startPos = oss.tellp(); 
     461 
     462         oss << "( " << className << "_hdl"; 
     463         for (it = begin; it != end; it++) 
     464         { 
     465           oss << ", " << it->second->getName(); 
     466           if (oss.tellp() - startPos > 90) 
     467           { 
     468             oss << "  &" << iendl; 
     469             startPos = oss.tellp(); 
     470           } 
     471         } 
     472         oss << " )"; 
    493473 
    494474         oss << std::endl << (iendl -= 2); 
     
    499479      { 
    500480         oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl)  &" << iendl++; 
    501          ostringstream* oss2; 
    502          SuperClassMap::const_iterator it; 
    503          SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    504  
    505          oss2 = new ostringstream; 
    506          *oss2 << "( " << className << "_hdl" ; 
    507          for (it = begin; it != end; it++) 
    508          { 
    509            *oss2 << ", " << it->second->getName(); 
    510            if (oss2->str().size() > 90) 
    511            { 
    512              oss << oss2->str() << "  &" << iendl; 
    513              delete oss2; 
    514              oss2 = new ostringstream; 
    515            } 
    516          } 
    517          *oss2 << " )"; 
    518          oss << oss2->str() << std::endl; 
    519          oss << iendl; 
    520          delete oss2; 
    521          oss2 = new ostringstream; 
     481         SuperClassMap::const_iterator it; 
     482         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     483 
     484         long startPos = oss.tellp(); 
     485 
     486         oss << "( " << className << "_hdl"; 
     487         for (it = begin; it != end; it++) 
     488         { 
     489           oss << ", " << it->second->getName(); 
     490           if (oss.tellp() - startPos > 90) 
     491           { 
     492             oss << "  &" << iendl; 
     493             startPos = oss.tellp(); 
     494           } 
     495         } 
     496         oss << " )"; 
     497         oss << std::endl; 
     498         oss << iendl; 
    522499 
    523500         oss << "IMPLICIT NONE" << iendl++; 
     
    534511         oss << "CALL xios(is_defined_" << className << "_attr_hdl_)  &" << iendl; 
    535512 
    536          *oss2 << "( " << className << "_hdl" ; 
    537          for (it = begin; it != end; it++) 
    538          { 
    539            *oss2 << ", " << it->second->getName(); 
    540            if (oss2->str().size() > 90) 
    541            { 
    542              oss << oss2->str() << "  &" << iendl; 
    543              delete oss2; 
    544              oss2 = new ostringstream; 
    545            } 
    546          } 
    547          *oss2 << " )"; 
    548          oss << oss2->str(); 
    549          delete oss2; 
     513         startPos = oss.tellp(); 
     514 
     515         oss << "( " << className << "_hdl"; 
     516         for (it = begin; it != end; it++) 
     517         { 
     518           oss << ", " << it->second->getName(); 
     519           if (oss.tellp() - startPos > 90) 
     520           { 
     521             oss << "  &" << iendl; 
     522             startPos = oss.tellp(); 
     523           } 
     524         } 
     525         oss << " )"; 
    550526 
    551527         oss << std::endl << (iendl -= 2); 
     
    556532      { 
    557533         oss << "SUBROUTINE xios(set_" << className << "_attr)  &" << iendl++; 
    558          ostringstream* oss2; 
    559          SuperClassMap::const_iterator it; 
    560          SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    561  
    562          oss2 = new ostringstream; 
    563          *oss2 << "( " << className << "_id" ; 
    564          for (it = begin; it != end; it++) 
    565          { 
    566            *oss2 << ", " << it->second->getName(); 
    567            if (oss2->str().size() > 90) 
    568            { 
    569              oss << oss2->str() << "  &" << iendl; 
    570              delete oss2; 
    571              oss2 = new ostringstream; 
    572            } 
    573          } 
    574          *oss2 << " )"; 
    575          oss << oss2->str() << std::endl; 
    576          oss << iendl; 
    577          delete oss2; 
    578          oss2 = new ostringstream; 
     534         SuperClassMap::const_iterator it; 
     535         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     536 
     537         long startPos = oss.tellp(); 
     538 
     539         oss << "( " << className << "_id"; 
     540         for (it = begin; it != end; it++) 
     541         { 
     542           oss << ", " << it->second->getName(); 
     543           if (oss.tellp() - startPos > 90) 
     544           { 
     545             oss << "  &" << iendl; 
     546             startPos = oss.tellp(); 
     547           } 
     548         } 
     549         oss << " )"; 
     550         oss << std::endl; 
     551         oss << iendl; 
    579552 
    580553         oss << "IMPLICIT NONE" << iendl++; 
     
    592565         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl; 
    593566         oss << "CALL xios(set_" << className << "_attr_hdl_)   &" << iendl; 
    594          *oss2 << "( " << className << "_hdl" ; 
    595          for (it = begin; it != end; it++) 
    596          { 
    597            *oss2 << ", " << it->second->getName(); 
    598            if (oss2->str().size() > 90) 
    599            { 
    600              oss << oss2->str() << "  &" << iendl; 
    601              delete oss2; 
    602              oss2 = new ostringstream; 
    603            } 
    604          } 
    605          *oss2 << " )"; 
    606          oss << oss2->str(); 
    607          delete oss2; 
     567 
     568         startPos = oss.tellp(); 
     569 
     570         oss << "( " << className << "_hdl"; 
     571         for (it = begin; it != end; it++) 
     572         { 
     573           oss << ", " << it->second->getName(); 
     574           if (oss.tellp() - startPos > 90) 
     575           { 
     576             oss << "  &" << iendl; 
     577             startPos = oss.tellp(); 
     578           } 
     579         } 
     580         oss << " )"; 
    608581 
    609582         oss << std::endl << (iendl -= 2); 
     
    614587      { 
    615588         oss << "SUBROUTINE xios(get_" << className << "_attr)  &" << iendl++; 
    616          ostringstream* oss2; 
    617          SuperClassMap::const_iterator it; 
    618          SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    619  
    620          oss2 = new ostringstream; 
    621          *oss2 << "( " << className << "_id" ; 
    622          for (it = begin; it != end; it++) 
    623          { 
    624            *oss2 << ", " << it->second->getName(); 
    625            if (oss2->str().size() > 90) 
    626            { 
    627              oss << oss2->str() << "  &" << iendl; 
    628              delete oss2; 
    629              oss2 = new ostringstream; 
    630            } 
    631          } 
    632          *oss2 << " )"; 
    633          oss << oss2->str() << std::endl; 
    634          oss << iendl; 
    635          delete oss2; 
    636          oss2 = new ostringstream; 
     589         SuperClassMap::const_iterator it; 
     590         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     591 
     592         long startPos = oss.tellp(); 
     593 
     594         oss << "( " << className << "_id"; 
     595         for (it = begin; it != end; it++) 
     596         { 
     597           oss << ", " << it->second->getName(); 
     598           if (oss.tellp() - startPos > 90) 
     599           { 
     600             oss << "  &" << iendl; 
     601             startPos = oss.tellp(); 
     602           } 
     603         } 
     604         oss << " )"; 
     605         oss << std::endl; 
     606         oss << iendl; 
    637607 
    638608         oss << "IMPLICIT NONE" << iendl++; 
     
    650620         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl; 
    651621         oss << "CALL xios(get_" << className << "_attr_hdl_)   &" << iendl; 
    652          *oss2 << "( " << className << "_hdl" ; 
    653          for (it = begin; it != end; it++) 
    654          { 
    655            *oss2 << ", " << it->second->getName(); 
    656            if (oss2->str().size() > 90) 
    657            { 
    658              oss << oss2->str() << "  &" << iendl; 
    659              delete oss2; 
    660              oss2 = new ostringstream; 
    661            } 
    662          } 
    663          *oss2 << " )"; 
    664          oss << oss2->str(); 
    665          delete oss2; 
     622 
     623         startPos = oss.tellp(); 
     624 
     625         oss << "( " << className << "_hdl"; 
     626         for (it = begin; it != end; it++) 
     627         { 
     628           oss << ", " << it->second->getName(); 
     629           if (oss.tellp() - startPos > 90) 
     630           { 
     631             oss << "  &" << iendl; 
     632             startPos = oss.tellp(); 
     633           } 
     634         } 
     635         oss << " )"; 
    666636 
    667637         oss << std::endl << (iendl -= 2); 
     
    672642      { 
    673643         oss << "SUBROUTINE xios(is_defined_" << className << "_attr)  &" << iendl++; 
    674          ostringstream* oss2; 
    675          SuperClassMap::const_iterator it; 
    676          SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    677  
    678          oss2 = new ostringstream; 
    679          *oss2 << "( " << className << "_id" ; 
    680          for (it = begin; it != end; it++) 
    681          { 
    682            *oss2 << ", " << it->second->getName(); 
    683            if (oss2->str().size() > 90) 
    684            { 
    685              oss << oss2->str() << "  &" << iendl; 
    686              delete oss2; 
    687              oss2 = new ostringstream; 
    688            } 
    689          } 
    690          *oss2 << " )"; 
    691          oss << oss2->str() << std::endl; 
    692          oss << iendl; 
    693          delete oss2; 
    694          oss2 = new ostringstream; 
     644         SuperClassMap::const_iterator it; 
     645         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
     646 
     647         long startPos = oss.tellp(); 
     648 
     649         oss << "( " << className << "_id"; 
     650         for (it = begin; it != end; it++) 
     651         { 
     652           oss << ", " << it->second->getName(); 
     653           if (oss.tellp() - startPos > 90) 
     654           { 
     655             oss << "  &" << iendl; 
     656             startPos = oss.tellp(); 
     657           } 
     658         } 
     659         oss << " )"; 
     660         oss << std::endl; 
     661         oss << iendl; 
    695662 
    696663         oss << "IMPLICIT NONE" << iendl++; 
     
    708675         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl; 
    709676         oss << "CALL xios(is_defined_" << className << "_attr_hdl_)   &" << iendl; 
    710          *oss2 << "( " << className << "_hdl" ; 
    711          for (it = begin; it != end; it++) 
    712          { 
    713            *oss2 << ", " << it->second->getName(); 
    714            if (oss2->str().size() > 90) 
    715            { 
    716              oss << oss2->str() << "  &" << iendl; 
    717              delete oss2; 
    718              oss2 = new ostringstream; 
    719            } 
    720          } 
    721          *oss2 << " )"; 
    722          oss << oss2->str(); 
    723          delete oss2; 
     677 
     678         startPos = oss.tellp(); 
     679 
     680         oss << "( " << className << "_hdl"; 
     681         for (it = begin; it != end; it++) 
     682         { 
     683           oss << ", " << it->second->getName(); 
     684           if (oss.tellp() - startPos > 90) 
     685           { 
     686             oss << "  &" << iendl; 
     687             startPos = oss.tellp(); 
     688           } 
     689         } 
     690         oss << " )"; 
    724691 
    725692         oss << std::endl << (iendl -= 2); 
Note: See TracChangeset for help on using the changeset viewer.