New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 530 for trunk/AGRIF/LIB/fortran.y – NEMO

Ignore:
Timestamp:
2006-10-17T17:36:11+02:00 (18 years ago)
Author:
opalod
Message:

RB: update of the conv for IOM and NEC MPI library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AGRIF/LIB/fortran.y

    r396 r530  
    33/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */ 
    44/*                                                                            */ 
    5 /*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */ 
     5/* Copyright or © or Copr. Laurent Debreu (Laurent.Debreu@imag.fr)            */ 
    66/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */ 
     7/* This software is governed by the CeCILL-C license under French law and     */ 
     8/* abiding by the rules of distribution of free software.  You can  use,      */ 
     9/* modify and/ or redistribute the software under the terms of the CeCILL-C   */ 
     10/* license as circulated by CEA, CNRS and INRIA at the following URL          */ 
     11/* "http://www.cecill.info".                                                  */ 
    712/*                                                                            */ 
    8 /*     This program is free software; you can redistribute it and/or modify   */ 
    9 /*    it                                                                      */ 
     13/* As a counterpart to the access to the source code and  rights to copy,     */ 
     14/* modify and redistribute granted by the license, users are provided only    */ 
     15/* with a limited warranty  and the software's author,  the holder of the     */ 
     16/* economic rights,  and the successive licensors  have only  limited         */ 
     17/* liability.                                                                 */ 
    1018/*                                                                            */ 
    11 /*    This program is distributed in the hope that it will be useful,         */ 
    12 /*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */ 
    13 /*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */ 
    14 /*    GNU General Public License for more details.                            */ 
     19/* In this respect, the user's attention is drawn to the risks associated     */ 
     20/* with loading,  using,  modifying and/or developing or reproducing the      */ 
     21/* software by the user in light of its specific status of free software,     */ 
     22/* that may mean  that it is complicated to manipulate,  and  that  also      */ 
     23/* therefore means  that it is reserved for developers  and  experienced      */ 
     24/* professionals having in-depth computer knowledge. Users are therefore      */ 
     25/* encouraged to load and test the software's suitability as regards their    */ 
     26/* requirements in conditions enabling the security of their systems and/or   */ 
     27/* data to be ensured and,  more generally, to use and operate it in the      */ 
     28/* same conditions as regards security.                                       */ 
    1529/*                                                                            */ 
     30/* The fact that you are presently reading this means that you have had       */ 
     31/* knowledge of the CeCILL-C license and that you accept its terms.           */ 
     32/******************************************************************************/ 
     33/* version 1.0                                                                */ 
    1634/******************************************************************************/ 
    1735%{ 
     
    4058       listvarcommon *lcom; 
    4159       listnom  *ln; 
    42        listvarpointtovar  *lp; 
    4360       listcouple  *lc; 
    4461       typedim   dim1; 
     
    97114%token TOK_ACOS 
    98115%token TOK_NINT 
     116%token TOK_CYCLE 
    99117%token TOK_SIN 
    100118%token TOK_SINH 
    101119%token TOK_ASIN 
    102120%token TOK_EQUIVALENCE 
     121%token TOK_BACKSPACE 
    103122%token TOK_LOG 
    104123%token TOK_TAN 
     
    156175%token TOK_SAVE 
    157176%token TOK_TARGET 
    158 %token TOK_USE 
    159177%token TOK_POINT 
    160178%token TOK_DATA  
     
    166184%token TOK_POINT_TO 
    167185%token TOK_COMMON 
     186%token TOK_GLOBAL 
    168187%token TOK_INTERFACE  
    169188%token TOK_ENDINTERFACE  
     
    174193%token TOK_STOP 
    175194%token TOK_NAMEEQ 
     195%token TOK_REAL8 
     196%token <na> TOK_USE 
    176197%token <na> TOK_DSLASH 
    177198%token <na> TOK_DASTER 
     
    235256%token '>'  
    236257%type <l> dcl 
     258%type <l> dimension 
    237259%type <l> paramlist 
    238260%type <l> args   
     
    244266%type <lcom> var_common 
    245267%type <lcom> var_common_list 
     268%type <d> dims 
     269%type <d> dimlist 
     270%type <dim1> dim 
     271%type <v> paramitem 
    246272%type <na> comblock 
    247273%type <na> name_routine 
     
    286312%type <na> intent_spec 
    287313%type <na> ubound 
    288 %type <na> after_ident_dims 
    289314%type <na> signe 
    290315%type <na> opt_signe 
     
    292317%type <na> filename 
    293318%type <na> proper_lengspec 
    294 %type <d> dims 
    295 %type <d> dimlist 
    296 %type <dim1> dim 
    297 %type <v> paramitem 
    298319 
    299320%left TOK_OP 
     
    303324      ; 
    304325line :  '\n' position 
    305       | thislabel suite_line 
     326      | thislabel suite_line_list 
    306327      | TOK_COMMENT 
    307328      | keyword cmnt writedeclar 
     
    309330                   {yyerrok;yyclearin;}     
    310331      ; 
     332suite_line_list : suite_line 
     333      |   suite_line ';' suite_line_list 
     334      ; 
    311335suite_line : entry fin_line/* subroutine, function, module                    */ 
    312336      | spec fin_line      /* declaration                                     */ 
    313337      | before_include filename fin_line 
    314338                  { 
    315                      if (firstpass == 0 &&  
    316                          inmoduledeclare == 0 &&  
     339                     if (inmoduledeclare == 0 &&  
    317340                         couldaddvariable == 1 ) 
    318341                     { 
    319342                        pos_end = setposcur(); 
    320                         RemoveWordSET(fortranout,pos_curinclude, 
     343                        RemoveWordSET_0(fortranout,pos_curinclude, 
    321344                                              pos_end-pos_curinclude); 
    322345                     } 
     
    334357            /*    TOK_ENDDONOTTREAT                                 */ 
    335358            couldaddvariable = 0 ; 
    336             if ( firstpass == 0 )  
    337             { 
    338                RemoveWordCUR(fortranout,-20,20); 
    339             } 
     359            RemoveWordCUR_0(fortranout,-20,20); 
    340360         } 
    341361      | TOK_ENDDONOTTREAT  
    342362         { 
    343363             couldaddvariable = 1 ; 
    344              if ( firstpass == 0 )  
    345              { 
    346                  RemoveWordCUR(fortranout,-24,24); 
    347              } 
     364             RemoveWordCUR_0(fortranout,-24,24); 
    348365          } 
    349366      | TOK_OMP 
    350367      | TOK_DOLLAR 
    351368      ; 
    352 position: {if ( firstpass == 0 ) pos_cur = setposcur();} 
     369position: {pos_cur = setposcur();} 
    353370      ; 
    354371thislabel:  
     
    374391                         paramdeclaration_everdone = 0; 
    375392                         insubroutinedeclare = 1; 
    376                          if ( firstpass == 0 )  
    377                          { 
    378                             adduseagrifutil = 0 ; 
    379                             AGRIF_n_AddUseAgrifUtil(); 
    380                          } 
     393                         AddUseAgrifUtil_0(); 
    381394                         /* in the second step we should write the head of    */ 
    382395                         /*    the subroutine sub_loop_<subroutinename>       */ 
    383                          OPTI_0_writeheadnewsubforsub(); 
     396                         writeheadnewsub_0(1); 
    384397                         adduseagrifutil = 0 ;  
    385398                      } 
     
    389402                            paramdeclaration_everdone = 0; 
    390403                            insubroutinedeclare = 1; 
    391                             if ( firstpass == 0 )  
    392                             { 
    393                                adduseagrifutil = 0 ; 
    394                                AGRIF_n_AddUseAgrifUtil(); 
    395                             } 
    396                             OPTI_0_writeheadnewsubforsub(); 
     404                            AddUseAgrifUtil_0(); 
     405                            writeheadnewsub_0(1); 
    397406                            adduseagrifutil = 0 ;  
    398407                      } 
     
    406415                         paramdeclaration_everdone = 0; 
    407416                         insubroutinedeclare = 1; 
    408                          if ( firstpass == 0 )  
    409                          { 
    410                             adduseagrifutil = 0 ; 
    411                             AGRIF_n_AddUseAgrifUtil(); 
    412                          } 
     417                         AddUseAgrifUtil_0(); 
    413418                         /* in the second step we should write the head of    */ 
    414419                         /*    the subroutine sub_loop_<subroutinename>       */ 
    415                          OPTI_0_writeheadnewsubforsub(); 
     420                         writeheadnewsub_0(1); 
    416421                         adduseagrifutil = 0 ;                        
    417422                   } 
     
    425430                         paramdeclaration_everdone = 0; 
    426431                         insubroutinedeclare = 1; 
    427                          if ( firstpass == 0 )  
    428                          { 
    429                             adduseagrifutil = 0 ; 
    430                             AGRIF_n_AddUseAgrifUtil(); 
    431                          } 
     432                         AddUseAgrifUtil_0(); 
    432433                         /* we should to list of the subroutine argument the  */ 
    433434                         /*    name of the function which has to be defined   */ 
     
    440441                         /* in the second step we should write the head of    */ 
    441442                         /*    the subroutine sub_loop_<subroutinename>       */ 
    442                          OPTI_0_writeheadnewsubforfunc(); 
     443                         writeheadnewsub_0(2); 
    443444                         adduseagrifutil = 0 ;  
    444445                      } 
     
    446447                      { 
    447448                            tmpdeclaration_everdone = 0; 
    448                          paramdeclaration_everdone = 0; 
     449                            paramdeclaration_everdone = 0; 
    449450                            insubroutinedeclare = 1; 
    450                             if ( firstpass == 0 )  
    451                             { 
    452                                adduseagrifutil = 0 ; 
    453                                AGRIF_n_AddUseAgrifUtil(); 
    454                             } 
     451                            AddUseAgrifUtil_0(); 
    455452                            /* we should to list of the subroutine argument   */ 
    456453                            /* name of the function which has to be defined   */ 
     
    462459                                               (curlistvar,listargsubroutine,1); 
    463460                            } 
    464                             OPTI_0_writeheadnewsubforfunc(); 
     461                            writeheadnewsub_0(2); 
    465462                            adduseagrifutil = 0 ;  
    466463                      } 
     
    475472                         paramdeclaration_everdone = 0; 
    476473                         insubroutinedeclare = 1; 
    477                          if ( firstpass == 0 )  
    478                          { 
    479                             adduseagrifutil = 0 ; 
    480                             AGRIF_n_AddUseAgrifUtil(); 
    481                          } 
     474                         AddUseAgrifUtil_0(); 
    482475                         /* we should to list of the subroutine argument the  */ 
    483476                         /*    name of the function which has to be defined   */ 
     
    491484                         /* in the second step we should write the head of    */ 
    492485                         /*    the subroutine sub_loop_<subroutinename>       */ 
    493                          OPTI_0_writeheadnewsubforfunc(); 
     486                         writeheadnewsub_0(2); 
    494487                         adduseagrifutil = 0 ;  
    495488                      } 
     
    497490                      { 
    498491                            tmpdeclaration_everdone = 0; 
    499                          paramdeclaration_everdone = 0; 
     492                            paramdeclaration_everdone = 0; 
    500493                            insubroutinedeclare = 1; 
    501                             if ( firstpass == 0 )  
    502                             { 
    503                                adduseagrifutil = 0 ; 
    504                                AGRIF_n_AddUseAgrifUtil(); 
    505                             } 
     494                            AddUseAgrifUtil_0(); 
    506495                            /* we should to list of the subroutine argument   */ 
    507496                            /* name of the function which has to be defined   */ 
     
    513502                                               (curlistvar,listargsubroutine,1); 
    514503                            } 
    515                             OPTI_0_writeheadnewsubforfunc(); 
     504                            writeheadnewsub_0(2); 
    516505                            adduseagrifutil = 0 ;  
    517506                      } 
     
    520509                   { 
    521510                      strcpy(curmodulename,$2); 
    522                       if ( firstpass == 1 ) Add_ModuleTo_Modulelist($2); 
     511                      Add_ModuleTo_Modulelist_1($2); 
    523512                      if ( inmoduledeclare == 0 ) 
    524513                      {  
    525                          /* instance and back instance should be create ?     */ 
    526                          MOD_1_FillInlistmodule();    
     514                         /* Alloc should be create ?                          */ 
     515                         FillInlistmodule_1();    
    527516                         /* To know if there are in the module declaration    */ 
    528517                         inmoduledeclare = 1; 
     
    533522                      }       
    534523                      /* WE should use Agrif_Util if it is necessary          */ 
    535                       AGRIF_0_AddUseAgrifInModuleDeclaration(); 
     524                      AddUseAgrifInModuleDeclaration_0(); 
    536525                   } 
    537526      ; 
     
    541530before_include : TOK_INCLUDE 
    542531                   { 
    543                       if (firstpass == 0 ) 
    544                       { 
    545                          pos_curinclude = setposcur()-9; 
    546                       } 
     532                      pos_curinclude = setposcur()-9; 
    547533                   }       
    548534filename: TOK_CHAR_CONSTANT 
    549535                   { 
    550                       if ( firstpass == 1 && couldaddvariable == 1 ) 
    551                       { 
    552                          Addincludetothelist($1); 
     536                      if ( couldaddvariable == 1 ) 
     537                      { 
     538                         Addincludetothelist_1($1); 
    553539                      }                    
    554540                   } 
     
    595581                      /* remove declaration                                   */ 
    596582                      if ( fortran77 == 1                       &&  
    597                            firstpass == 0                       &&  
    598583                           infunctiondeclare == 0               &&  
    599584                           commonlist                           &&  
    600                            OPTI_0_IsTabvarsUseInArgument() == 1 && 
     585                           IsTabvarsUseInArgument_0() == 1      && 
    601586                           couldaddvariable == 1 )  
    602587                      { 
    603588                         pos_end = setposcur(); 
    604                          RemoveWordSET(fortranout,pos_cur_decl, 
     589                         RemoveWordSET_0(fortranout,pos_cur_decl, 
    605590                                               pos_end-pos_cur_decl); 
    606591                      } 
     
    608593                   } 
    609594      | TOK_TYPE opt_name 
     595/*      { 
     596         couldaddvariable = 0; 
     597      }*/ 
    610598      | TOK_ENDTYPE opt_name 
     599/*      { 
     600         couldaddvariable = 1; 
     601      }*/ 
    611602      | TOK_POINTER list_couple 
    612603      | before_parameter  '(' paramlist ')'  
    613604                   { 
    614                       COM_1_AddvartoParamlist($3); 
     605                      AddvartoParamlist_1($3); 
    615606                      if ( fortran77 == 1  &&  
    616                            firstpass == 0  &&  
    617607                           commonlist      &&  
    618608                           listvarindoloop &&  
    619                            OPTI_0_IsTabvarsUseInArgument() == 1 ) 
     609                           IsTabvarsUseInArgument_0() == 1 ) 
    620610                      { 
    621611                         pos_end = setposcur(); 
    622                          RemoveWordSET(fortranout,pos_curparameter, 
     612                         RemoveWordSET_0(fortranout,pos_curparameter, 
     613                                               pos_end-pos_curparameter); 
     614                      } 
     615                   } 
     616      | before_parameter  paramlist  
     617                   { 
     618                      AddvartoParamlist_1($2); 
     619                      if ( fortran77 == 1  &&  
     620                           commonlist      &&  
     621                           listvarindoloop &&  
     622                           IsTabvarsUseInArgument_0() == 1 ) 
     623                      { 
     624                         pos_end = setposcur(); 
     625                         RemoveWordSET_0(fortranout,pos_curparameter, 
    623626                                               pos_end-pos_curparameter); 
    624627                      } 
     
    628631      | implicit 
    629632      | dimension 
     633                  { 
     634                   /* if the variable is a parameter we can suppose that is   */ 
     635                   /*    value is the same on each grid. It is not useless to */ 
     636                   /*    create a copy of it on each grid                     */ 
     637                      if ( couldaddvariable == 1 ) 
     638                      { 
     639                         ajoutevar_1($1); 
     640                         NonGridDepDeclaration_0($1); 
     641                         /* if variables has been declared in a subroutine    */ 
     642                         if ( insubroutinedeclare == 1 ) 
     643                         { 
     644                           ajoutvarofsubroutine_1($1); 
     645                           writesubroutinedeclaration_0($1); 
     646                         } 
     647                      } 
     648                      /* Case of common block                                 */ 
     649                      indeclarationvar=0; 
     650                      PublicDeclare = 0;   
     651                      PrivateDeclare = 0;  
     652                      ExternalDeclare = 0;  
     653                      strcpy(NamePrecision,"");   
     654                      c_star = 0; 
     655                      InitialValueGiven = 0 ; 
     656                      strcpy(IntentSpec,""); 
     657                      VariableIsParameter =  0 ;  
     658                      Allocatabledeclare = 0 ; 
     659                      SaveDeclare = 0; 
     660                      pointerdeclare = 0; 
     661                      optionaldeclare = 0 ; 
     662                      dimsgiven=0; 
     663                      c_selectorgiven=0; 
     664                      strcpy(nameinttypename,"");   
     665                   } 
    630666      | public 
    631667      | private 
     
    634670      | interface  
    635671      | namelist 
     672      | TOK_BACKSPACE '(' expr ')' 
    636673      | TOK_EXTERNAL opt_sep use_name_list 
     674      | TOK_INTRINSIC opt_sep use_intrinsic_list 
    637675      | TOK_EQUIVALENCE '(' list_expr ')' 
    638676      | before_data data '\n' 
    639677                   { 
    640678                      /* we should remove the data declaration                */ 
    641                      if (firstpass == 0 && aftercontainsdeclare == 0 ) 
     679                     if ( aftercontainsdeclare == 0 ) 
    642680                     { 
    643681                        pos_end = setposcur(); 
    644                         RemoveWordSET(fortranout,pos_curdata, 
     682                        RemoveWordSET_0(fortranout,pos_curdata, 
    645683                                              pos_end-pos_curdata); 
    646684                     } 
    647685                  } 
    648686      ; 
     687name_intrinsic : TOK_SUM 
     688      | TOK_TANH 
     689      | TOK_MAXVAL 
     690      | TOK_MIN 
     691      | TOK_MINVAL 
     692      | TOK_TRIM 
     693      | TOK_SQRT 
     694      | TOK_NINT 
     695      | TOK_FLOAT 
     696      | TOK_EXP 
     697      | TOK_COS 
     698      | TOK_COSH 
     699      | TOK_ACOS 
     700      | TOK_SIN 
     701      | TOK_SINH 
     702      | TOK_ASIN 
     703      | TOK_LOG 
     704      | TOK_TAN 
     705      | TOK_ATAN 
     706      | TOK_MOD 
     707      | TOK_SIGN 
     708      | TOK_MINLOC 
     709      | TOK_MAXLOC 
     710      | TOK_NAME 
     711      ; 
     712use_intrinsic_list : name_intrinsic 
     713      | use_intrinsic_list ',' name_intrinsic 
    649714list_couple : '(' list_expr ')'  
    650715      | list_couple ',' '(' list_expr ')'  
     
    661726                      if ( couldaddvariable == 1 ) 
    662727                      { 
    663                          decl_1_ajoutevar($1); 
     728                         ajoutevar_1($1); 
    664729                         if ( VariableIsParameter == 1 ) globparam = 
    665730                                            AddListvarToListvar($1,globparam,1); 
    666                          DECL_0_NonGridDepDeclaration($1); 
     731                         NonGridDepDeclaration_0($1); 
    667732                         /* if variables has been declared in a subroutine    */ 
    668733                         if ( insubroutinedeclare == 1 ) 
    669734                         { 
    670                            OPTI_1_ajoutvarofsubroutine($1); 
    671                            OPTI_0_writesubroutinedeclaration($1); 
     735                           ajoutvarofsubroutine_1($1); 
     736                           writesubroutinedeclaration_0($1); 
    672737                         } 
    673738                         /* If there are a SAVE declarations in module's      */ 
     
    677742                         if ( aftercontainsdeclare == 1 )  
    678743                         { 
    679                             decl_1_ajoutevarsave($1); 
    680                             decl_0_modifdeclarationssave($1); 
     744                            ajoutevarsave_1($1); 
     745                            if ( VariableIsParameter == 0 && SaveDeclare == 1)  
     746                            { 
     747                               pos_end = setposcur(); 
     748                               RemoveWordSET_0(fortranout,pos_cur, 
     749                                               pos_end-pos_cur); 
     750                            } 
    681751                         } 
    682752                      } 
     
    686756                      PrivateDeclare = 0;  
    687757                      ExternalDeclare = 0;  
    688                       lengspecgiven=0; 
    689                       PrecisionGiven = 0;  
     758                      strcpy(NamePrecision,"");   
    690759                      c_star = 0; 
    691                       CharacterSizeGiven = 0 ;  
    692760                      InitialValueGiven = 0 ; 
    693                       IntentDeclare = 0;  
     761                      strcpy(IntentSpec,""); 
    694762                      VariableIsParameter =  0 ;  
    695763                      Allocatabledeclare = 0 ; 
     
    699767                      dimsgiven=0; 
    700768                      c_selectorgiven=0; 
    701                       inttypename=0; 
     769                      strcpy(nameinttypename,"");   
    702770                   } 
    703771      | TOK_FUNCTION TOK_NAME arglist 
     
    711779                         paramdeclaration_everdone = 0; 
    712780                         insubroutinedeclare = 1; 
    713                          if ( firstpass == 0 )  
    714                          { 
    715                             adduseagrifutil = 0 ; 
    716                             AGRIF_n_AddUseAgrifUtil(); 
    717                          } 
     781                         AddUseAgrifUtil_0(); 
    718782                         /* we should to list of the subroutine argument the  */ 
    719783                         /*    name of the function which has to be defined   */ 
     
    740804                         /* in the second step we should write the head of    */ 
    741805                         /*    the subroutine sub_loop_<subroutinename>       */ 
    742                          OPTI_0_writeheadnewsubforfunc(); 
     806                         writeheadnewsub_0(2); 
    743807                         adduseagrifutil = 0 ;  
    744808                      } 
     
    748812                         paramdeclaration_everdone = 0; 
    749813                         insubroutinedeclare = 1; 
    750                          if ( firstpass == 0 )  
    751                          { 
    752                             adduseagrifutil = 0 ; 
    753                             AGRIF_n_AddUseAgrifUtil(); 
    754                          } 
     814                         AddUseAgrifUtil_0(); 
    755815                         /* we should to list of the subroutine argument the  */ 
    756816                         /*    name of the function which has to be defined   */ 
     
    771831                         /* in the second step we should write the head of    */ 
    772832                         /*    the subroutine sub_loop_<subroutinename>       */ 
    773                          OPTI_0_writeheadnewsubforfunc(); 
     833                         writeheadnewsub_0(2); 
    774834                         adduseagrifutil = 0 ;  
    775835                      } 
     
    778838before_parameter : TOK_PARAMETER 
    779839                   { 
    780                       if (firstpass == 0 ) 
    781                       { 
    782                          pos_curparameter = setposcur()-9; 
    783                       } 
     840                      pos_curparameter = setposcur()-9; 
    784841                   }       
    785842before_data : TOK_DATA 
    786843                   { 
    787                       if (firstpass == 0 ) pos_curdata = setposcur()-4; 
     844                      pos_curdata = setposcur()-4; 
    788845                   } 
    789846data: TOK_NAME TOK_SLASH datavallist TOK_SLASH 
    790847                   { 
    791848                      sprintf(ligne,"(/ %s /)",$3); 
    792                       DATA_n_CompleteDataList($1,ligne); 
     849                      CompleteDataList($1,ligne); 
    793850                   } 
    794851      | data opt_comma TOK_NAME TOK_SLASH datavallist TOK_SLASH 
    795852                   { 
    796853                      sprintf(ligne,"(/ %s /)",$5); 
    797                       DATA_n_CompleteDataList($3,ligne); 
    798                    } 
     854                      CompleteDataList($3,ligne); 
     855                   } 
     856      | datanamelist TOK_SLASH datavallist TOK_SLASH 
     857                   { 
     858                       /*******************************************************/ 
     859                       /*******************************************************/ 
     860                       /*******************************************************/ 
     861                       /*******************************************************/ 
     862                       /*******************************************************/ 
     863                       /*******************************************************/ 
     864                       /*******************************************************/ 
     865                   } 
     866      ; 
     867datanamelist : TOK_NAME 
     868      | datanamelist ',' TOK_NAME 
    799869      ; 
    800870datavallist : expr_data 
     
    812882                   {sprintf($$,"%s+%s",$1,$3);} 
    813883      | expr_data '-' expr_data 
    814                    {sprintf($$,"%s+%s",$1,$3);} 
     884                   {sprintf($$,"%s-%s",$1,$3);} 
    815885      | expr_data '*' expr_data 
    816                    {sprintf($$,"%s+%s",$1,$3);} 
     886                   {sprintf($$,"%s*%s",$1,$3);} 
    817887      | expr_data '/' expr_data 
    818                    {sprintf($$,"%s+%s",$1,$3);} 
     888                   {sprintf($$,"%s/%s",$1,$3);} 
    819889      ; 
    820890opt_signe :  
     
    828898      | TOK_NAMELIST  comblock ident 
    829899      { 
    830          if ( firstpass == 1 ) AddNameToListNamelist($2); 
     900         AddNameToListNamelist_1($2); 
    831901      } 
    832902      | namelist_action opt_comma comblock opt_comma ident 
    833903      { 
    834          if ( firstpass == 1 ) AddNameToListNamelist($3); 
     904         AddNameToListNamelist_1($3); 
    835905      } 
    836906      | namelist_action ',' ident 
     
    842912      ; 
    843913dimension: TOK_DIMENSION  opt_comma TOK_NAME dims lengspec 
     914      { 
     915         if ( couldaddvariable == 1 ) 
     916         { 
     917            if ( inmoduledeclare == 1 || SaveDeclare == 1 ) 
     918            { 
     919               if ( AllocShouldMadeInModule() == 1 )  
     920               { 
     921                 AllocTo1InModule_1(); 
     922               } 
     923            }       
     924            /*                                                                */ 
     925            curvar=createvar($3,$4); 
     926            /*                                                                */ 
     927            if ( IsVariableReal($3) == 1 ) 
     928            { 
     929               /*                                                             */ 
     930               CreateAndFillin_Curvar("REAL",$3,$4,curvar); 
     931               /*                                                             */ 
     932               curlistvar=insertvar(NULL,curvar); 
     933               /*                                                             */ 
     934               $$=settype("REAL",curlistvar); 
     935            } 
     936            else 
     937            { 
     938               /*                                                             */ 
     939               CreateAndFillin_Curvar("INTEGER",$3,$4,curvar); 
     940               /*                                                             */ 
     941               curlistvar=insertvar(NULL,curvar); 
     942               /*                                                             */ 
     943               $$=settype("INTEGER",curlistvar); 
     944            } 
     945            strcpy(vallengspec,""); 
     946         } 
     947         else 
     948         { 
     949            /* mazauric*/ 
     950         } 
     951      } 
    844952      | dimension ',' TOK_NAME dims lengspec 
     953      { 
     954         if ( couldaddvariable == 1 ) 
     955         { 
     956            /*                                                                */ 
     957            curvar=createvar($3,$4); 
     958            /*                                                                */ 
     959            if ( IsVariableReal($3) == 1 ) 
     960            { 
     961               /*                                                             */ 
     962               CreateAndFillin_Curvar("REAL",$3,$4,curvar); 
     963               /*                                                             */ 
     964               curlistvar=insertvar($1,curvar); 
     965               /*                                                             */ 
     966               $$=curlistvar; 
     967            } 
     968            else 
     969            { 
     970               /*                                                             */ 
     971               CreateAndFillin_Curvar("INTEGER",$3,$4,curvar); 
     972               /*                                                             */ 
     973               curlistvar=insertvar($1,curvar); 
     974               /*                                                             */ 
     975               $$=curlistvar; 
     976            } 
     977            strcpy(vallengspec,""); 
     978         }          
     979         else 
     980         { 
     981            /* mazauric*/ 
     982         } 
     983      } 
    845984      ; 
    846985private: TOK_PRIVATE '\n' 
    847       | TOK_PRIVATE use_name_list 
     986      | TOK_PRIVATE opt_sep use_name_list 
    848987      ; 
    849988public: TOK_PUBLIC '\n' 
    850       | TOK_PUBLIC use_name_list  
     989      | TOK_PUBLIC opt_sep use_name_list  
    851990      ; 
    852991use_name_list: TOK_NAME  
     
    855994common: before_common var_common_list 
    856995                   { 
    857                          if (firstpass == 0 && fortran77 == 1 && 
     996                         if (fortran77 == 1 && 
    858997                             couldaddvariable == 1 ) 
    859998                         { 
    860999                            pos_end = setposcur(); 
    861                             RemoveWordSET(fortranout,pos_curcommon, 
     1000                            RemoveWordSET_0(fortranout,pos_curcommon, 
    8621001                                                  pos_end-pos_curcommon); 
    8631002                         } 
     
    8671006                         if ( couldaddvariable == 1 ) 
    8681007                         { 
    869                             if (firstpass == 1 )  
    870                             { 
    871                                sprintf(charusemodule,"%s",$2); 
    872                                Add_ModuleTo_Modulelist($2); 
    873                             } 
    874                             if (firstpass == 0 && fortran77 == 1 ) 
     1008                            sprintf(charusemodule,"%s",$2); 
     1009                            Add_ModuleTo_Modulelist_1($2); 
     1010                            if ( fortran77 == 1 ) 
    8751011                            { 
    8761012                               pos_end = setposcur(); 
    877                                RemoveWordSET(fortranout,pos_curcommon, 
     1013                               RemoveWordSET_0(fortranout,pos_curcommon, 
    8781014                                                     pos_end-pos_curcommon); 
    8791015                            } 
     
    8841020                         if ( couldaddvariable == 1 ) 
    8851021                         { 
    886                             if (firstpass == 1 )  
    887                             { 
    888                                sprintf(charusemodule,"%s",$3); 
    889                                Add_ModuleTo_Modulelist($3); 
    890                             } 
    891                             if (firstpass == 0 && fortran77 == 1 ) 
     1022                            sprintf(charusemodule,"%s",$3); 
     1023                            Add_ModuleTo_Modulelist_1($3); 
     1024                            if ( fortran77 == 1 ) 
    8921025                            { 
    8931026                               pos_end = setposcur(); 
    894                                RemoveWordSET(fortranout,pos_curcommon, 
     1027                               RemoveWordSET_0(fortranout,pos_curcommon, 
    8951028                                                     pos_end-pos_curcommon); 
    8961029                            } 
     
    9011034                   { 
    9021035                      positioninblock=0; 
    903                       if (firstpass == 0 ) pos_curcommon = setposcur()-6; 
    904                    } 
     1036                      pos_curcommon = setposcur()-6; 
     1037                   } 
     1038      | TOK_GLOBAL TOK_COMMON 
     1039                   { 
     1040                      positioninblock=0; 
     1041                      pos_curcommon = setposcur()-6-7; 
     1042                   } 
     1043      ; 
    9051044var_common_list : var_common 
    9061045                   { 
    907                       if ( couldaddvariable == 1 ) COM_1_AddCommonvartolist(); 
     1046                      if ( couldaddvariable == 1 ) Addtolistvarcommon(); 
    9081047                   } 
    9091048 
    9101049     | var_common_list ',' var_common 
    9111050                   { 
    912                       if ( couldaddvariable == 1 ) COM_1_AddCommonvartolist(); 
     1051                      if ( couldaddvariable == 1 ) Addtolistvarcommon(); 
    9131052                   } 
    9141053var_common: TOK_NAME dims   
     
    9471086      ; 
    9481087varsave:  
    949       | TOK_NAME dims  
     1088      | TOK_NAME before_dims dims  
     1089      {created_dimensionlist = 1;} 
    9501090      ; 
    9511091       
     
    9701110                         strcpy(curvar->subroutinename,subroutinename); 
    9711111                         strcpy(curvar->modulename,subroutinename); 
    972                          curvar->isparameter=1; 
    9731112                         strcpy(curvar->initialvalue,$3); 
    9741113                         $$=curvar; 
     
    9851124                       if ( firstpass == 1 && insubroutinedeclare == 1 ) 
    9861125                       { 
    987                            listimplicitnone = Add_listname 
     1126                           listimplicitnone = Addtolistname 
    9881127                                              (subroutinename,listimplicitnone); 
    9891128                       } 
    990                        if ( firstpass == 0               &&  
    991                             tmpdeclaration_everdone == 1 &&  
     1129                       if ( tmpdeclaration_everdone == 1 &&  
    9921130                            inmoduledeclare == 0 ) 
    9931131                       { 
    9941132                         pos_end = setposcur(); 
    995                          RemoveWordSET(fortranout,pos_end-13, 
     1133                         RemoveWordSET_0(fortranout,pos_end-13, 
    9961134                                               13); 
    9971135                       } 
    9981136                    } 
     1137      | TOK_IMPLICIT TOK_REAL8 
    9991138      ; 
    10001139opt_retour : 
     
    10061145                         if ( inmoduledeclare == 1 || SaveDeclare == 1 ) 
    10071146                         { 
    1008                             if ( MOD_n_InstanceShouldMadeInModule() == 1 )  
     1147                            if ( AllocShouldMadeInModule() == 1 )  
    10091148                            { 
    1010                                MOD_1_InstanceTo1InModule(); 
     1149                               AllocTo1InModule_1(); 
    10111150                            } 
    10121151                         }       
     
    10361175                         $$=settype(DeclType,curlistvar); 
    10371176                      } 
    1038                       lengspecgiven=0; 
     1177                      else 
     1178                      { 
     1179                         /* mazauric*/ 
     1180                      } 
    10391181                      strcpy(vallengspec,""); 
    10401182                   } 
     
    10541196                         CreateAndFillin_Curvar($1->var->typevar,$4,$5,curvar); 
    10551197                         /*                                                   */ 
    1056                          curvar->typegiven=1; 
    10571198                         strcpy(curvar->typevar,($1->var->typevar)); 
    10581199                         /*                                                   */ 
     
    10701211                         $$=curlistvar; 
    10711212                      } 
    1072                       lengspecgiven=0; 
     1213                      else 
     1214                      { 
     1215                         /* mazauric*/ 
     1216                      } 
    10731217                      strcpy(vallengspec,""); 
    10741218                   } 
     
    10841228                      if (inmoduledeclare == 1 )  
    10851229                      { 
    1086                          MOD_1_InstanceShouldMadeTo1InModule(); 
     1230                         AllocShouldMadeTo1InModule_1(); 
    10871231                      } 
    10881232                   } 
     
    10911235                      indeclarationvar=1; 
    10921236                      strcpy(DeclType,$1); 
    1093                       inttypename=1; 
    10941237                      strcpy(nameinttypename,$3); 
    10951238                   } 
     
    11071250before_character : TOK_CHARACTER 
    11081251                   { 
    1109                       if ( firstpass == 0 )  
    1110                       { 
    1111                          pos_cur_decl = setposcur(); 
    1112                          pos_cur_decl = pos_cur_decl-9; 
    1113                       } 
     1252                      pos_cur_decl = setposcur()-9; 
    11141253                   } 
    11151254      ; 
     
    11191258                   { 
    11201259                      strcpy($$,"INTEGER"); 
    1121                       if ( firstpass == 0 )  
    1122                       { 
    1123                          pos_cur_decl = setposcur(); 
    1124                          pos_cur_decl = pos_cur_decl-7; 
    1125                       } 
     1260                      pos_cur_decl = setposcur()-7; 
    11261261                      if (inmoduledeclare == 1 )  
    11271262                      { 
    1128                          MOD_1_InstanceShouldMadeTo1InModule(); 
     1263                         AllocShouldMadeTo1InModule_1(); 
    11291264                       } 
    11301265                   } 
    11311266      | TOK_REAL   { 
    11321267                      strcpy($$,"REAL");  
    1133                       if ( firstpass == 0 )  
    1134                       { 
    1135                          pos_cur_decl = setposcur(); 
    1136                          pos_cur_decl = pos_cur_decl-4; 
    1137                       } 
     1268                      pos_cur_decl = setposcur()-4; 
    11381269                      if (inmoduledeclare == 1 )  
    11391270                      { 
    1140                          MOD_1_InstanceShouldMadeTo1InModule(); 
     1271                         AllocShouldMadeTo1InModule_1(); 
    11411272                      } 
    11421273                   } 
     
    11501281                   { 
    11511282                      strcpy($$,"LOGICAL"); 
    1152                       if ( firstpass == 0 )  
    1153                       { 
    1154                          pos_cur_decl = setposcur(); 
    1155                          pos_cur_decl = pos_cur_decl-7; 
    1156                       } 
     1283                      pos_cur_decl = setposcur()-7; 
    11571284                      if (inmoduledeclare == 1 )  
    11581285                      { 
    1159                          MOD_1_InstanceShouldMadeTo1InModule(); 
     1286                         AllocShouldMadeTo1InModule_1(); 
    11601287                      } 
    11611288                   } 
    11621289      | TOK_TYPE       
    11631290                   { 
    1164                       if ( firstpass == 0 )  
    1165                       { 
    1166                          pos_cur_decl = setposcur(); 
    1167                          pos_cur_decl = pos_cur_decl-5; 
    1168                       } 
     1291                      pos_cur_decl = setposcur()-5; 
    11691292                      strcpy($$,"TYPE"); 
    11701293                   } 
    11711294      ; 
    11721295lengspec: 
    1173       | '*' proper_lengspec {lengspecgiven=1;strcpy(vallengspec,$2);} 
     1296      | '*' proper_lengspec {strcpy(vallengspec,$2);} 
    11741297      ; 
    11751298proper_lengspec: expr {sprintf($$,"*%s",$1);} 
     
    11861309      | TOK_NAME '=' clause   
    11871310                   { 
    1188                       PrecisionGiven = 1;  
    11891311                      sprintf(NamePrecision,"%s = %s",$1,$3);   
    11901312                   } 
    11911313      | TOK_NAME 
    11921314                   { 
    1193                       PrecisionGiven = 1;  
    11941315                      strcpy(NamePrecision,$1);   
    11951316                   } 
     1317      | TOK_CSTINT 
     1318                   { 
     1319                      strcpy(NamePrecision,$1);   
     1320                   } 
    11961321      ; 
    11971322clause: expr       {strcpy(CharacterSize,$1); 
    1198                     CharacterSizeGiven = 1;strcpy($$,$1);} 
     1323                    strcpy($$,$1);} 
    11991324      | '*'        {strcpy(CharacterSize,"*"); 
    1200                     CharacterSizeGiven = 1;strcpy($$,"*");}  
     1325                    strcpy($$,"*");}  
    12011326      ; 
    12021327opt_clause:  
     
    12151340                      if (inmoduledeclare == 1 )  
    12161341                      { 
    1217                          MOD_1_InstanceShouldMadeTo0InModule(); 
     1342                         AllocShouldMadeTo0InModule_1(); 
    12181343                      } 
    12191344                   } 
     
    12281353      | TOK_EXTERNAL   
    12291354                   {ExternalDeclare = 1;}  
    1230       | TOK_INTENT '(' intent_spec ')'  
    1231                    {IntentDeclare = 1; strcpy(IntentSpec,$3);} 
     1355      | TOK_INTENT intent_spec 
     1356                   {strcpy(IntentSpec,$2);} 
    12321357      | TOK_INTRINSIC 
    12331358      | TOK_OPTIONAL{optionaldeclare = 1 ;} 
     
    12381363                          SaveDeclare = 1 ; 
    12391364                          Savemeet = 1; 
    1240                           MOD_1_InstanceShouldMadeTo1InModule(); 
     1365                          AllocShouldMadeTo1InModule_1(); 
    12411366                       } 
    12421367                    } 
     
    12521377                   {PrivateDeclare = 1;}  
    12531378      ; 
    1254 dims:              {$$=(listdim *)NULL;} 
     1379dims:              {if ( created_dimensionlist == 1 ) $$=(listdim *)NULL;} 
    12551380      | '(' dimlist ')'   
    1256                    {$$=reverse($2);} 
    1257       ; 
    1258 dimlist:   dim     {$$=insertdim(NULL,$1);} 
     1381                   {if ( created_dimensionlist == 1 ) $$=$2;} 
     1382      ; 
     1383dimlist:   dim     {if ( created_dimensionlist == 1 ) $$=insertdim(NULL,$1);} 
    12591384      | dimlist ',' dim  
    1260                    {$$=insertdim($1,$3);} 
     1385                   {if ( created_dimensionlist == 1 ) $$=insertdim($1,$3);} 
    12611386      ; 
    12621387dim:ubound         {strcpy($$.first,"1");strcpy($$.last,$1);} 
     
    12801405predefinedfunction : TOK_SUM minmaxlist ')'  
    12811406                   {sprintf($$,"SUM(%s)",$2);} 
    1282       | TOK_MAX '(' minmaxlist ')' 
    1283                    {sprintf($$,"MAX(%s)",$3);} 
     1407      | TOK_MAX minmaxlist ')' 
     1408                   {sprintf($$,"MAX(%s)",$2);} 
    12841409      | TOK_TANH '(' minmaxlist ')' 
    12851410                   {sprintf($$,"TANH(%s)",$3);} 
     
    12921417      | TOK_TRIM '(' expr ')' 
    12931418                   {sprintf($$,"TRIM(%s)",$3);} 
    1294       | TOK_SQRT '(' expr ')' 
    1295                    {sprintf($$,"SQRT(%s)",$3);} 
    1296       | TOK_REAL '(' expr ')' 
     1419      | TOK_SQRT expr ')' 
     1420                   {sprintf($$,"SQRT(%s)",$2);} 
     1421      | TOK_REAL '(' minmaxlist ')' 
    12971422                   {sprintf($$,"REAL(%s)",$3);} 
    12981423      | TOK_INT '(' expr ')' 
     
    13221447      | TOK_ATAN '(' expr ')' 
    13231448                   {sprintf($$,"ATAN(%s)",$3);} 
    1324       | TOK_ABS '(' expr ')' 
    1325                    {sprintf($$,"ABS(%s)",$3);} 
     1449      | TOK_ABS expr ')' 
     1450                   {sprintf($$,"ABS(%s)",$2);} 
    13261451      | TOK_MOD '(' minmaxlist ')' 
    13271452                   {sprintf($$,"MOD(%s)",$3);} 
     
    13911516                   {sprintf($$,"%s",$2);} 
    13921517 
    1393 after_slash : expr  
     1518after_slash : {strcpy($$,"");} 
     1519      | expr  
    13941520                   {sprintf($$,"/%s",$1);} 
    13951521      | '=' expr %prec TOK_EQ  
    1396                    {sprintf($$,"== %s",$2);} 
     1522                   {sprintf($$,"/= %s",$2);} 
    13971523      | TOK_SLASH expr 
    13981524                   {sprintf($$,"//%s",$2);} 
     
    14141540                      if (!strcasecmp(identcopy,"Agrif_Parent") ) 
    14151541                                                            agrif_parentcall =1; 
    1416                       if ( AGRIF_n_Agrif_in_Tok_NAME(identcopy) == 1 ) 
     1542                      if ( Agrif_in_Tok_NAME(identcopy) == 1 ) 
    14171543                      {  
    14181544                         inagrifcallargument = 1; 
    1419                          AGRIF_n_AddsubroutineTolistsubwhereagrifused(); 
     1545                         AddsubroutineTolistsubwhereagrifused(); 
    14201546                      } 
    14211547                   } 
     
    14361562                   { 
    14371563                      sprintf($$," %s ( %s )",$1,$3); 
    1438                       AGRIF_0_ModifyTheAgrifFunction($3); 
     1564                      ModifyTheAgrifFunction_0($3); 
    14391565                     agrif_parentcall =0;  
    14401566                   } 
     
    14721598      ; 
    14731599ident : TOK_NAME    {   
    1474                        strcpy(identcopy,$1); 
    1475                        pointedvar=0; 
    1476                        if ( VarIsNonGridDepend($1) == 0 && 
    1477                             formatdeclare == 0  
    1478                           ) 
     1600                       if ( VariableIsNotFunction($1) == 0 ) 
    14791601                       { 
    1480                           if ( inagrifcallargument == 1 || 
    1481                                OPTI_0_varisallocatable($1) == 1 || 
    1482                 OPTI_0_varispointer($1) == 1 ) 
     1602                          if ( inagrifcallargument == 1 ) 
    14831603                          { 
    1484                              AGRIF_0_ModifyTheVariableName($1); 
     1604                             if ( !strcasecmp($1,identcopy) ) 
     1605                             { 
     1606                                strcpy(sameagrifname,identcopy); 
     1607                                sameagrifargument = 1; 
     1608                             } 
    14851609                          } 
    1486                           if ( inagrifcallargument != 1 ) 
    1487                                OPTI_1_ajoutevarindoloop($1); 
     1610                          strcpy(identcopy,$1); 
     1611                          pointedvar=0; 
     1612                          if ( VarIsNonGridDepend($1) == 0 && 
     1613                               formatdeclare == 0  
     1614                             ) 
     1615                          { 
     1616                             if ( inagrifcallargument == 1 || 
     1617                                  varisallocatable_0($1) == 1 || 
     1618                                  varispointer_0($1) == 1 ) 
     1619                             { 
     1620                                ModifyTheVariableName_0($1); 
     1621                             } 
     1622                             if ( inagrifcallargument != 1 || sameagrifargument ==1 ) 
     1623                                  ajoutevarindoloop_1($1); 
     1624                          } 
     1625                          NotifyAgrifFunction_0($1); 
    14881626                       } 
    1489                        AGRIF_0_NotifyAgrifFunction($1); 
    1490                     }        
     1627          } 
    14911628      ; 
    14921629simple_const: TOK_TRUE  
     
    15281665                    }  
    15291666      ; 
    1530 before_initial : {if ( firstpass == 0 ) pos_curinit = setposcur();} 
     1667before_initial : {pos_curinit = setposcur();} 
    15311668      ; 
    15321669complex_const: '(' uexpr ',' uexpr ')'  
     
    15381675                      if (insubroutinedeclare == 1) 
    15391676                      { 
    1540                          OPTI_0_copyuse($2); 
    1541                       } 
    1542                       if (firstpass == 1 )  
    1543                       { 
    1544                          sprintf(charusemodule,"%s",$2); 
    1545                          Addmoduletothelist($2); 
    1546                       } 
    1547                       if ( firstpass == 0 && inmoduledeclare == 0 ) 
     1677                         copyuse_0($2); 
     1678                      } 
     1679                      sprintf(charusemodule,"%s",$2); 
     1680                      Addmoduletothelist_1($2); 
     1681 
     1682                      if ( inmoduledeclare == 0 ) 
    15481683                      { 
    15491684                         pos_end = setposcur(); 
    1550                          RemoveWordSET(fortranout,pos_curuse, 
     1685                         RemoveWordSET_0(fortranout,pos_curuse, 
    15511686                                               pos_end-pos_curuse); 
    15521687                      } 
     
    15561691                      if (insubroutinedeclare == 1) 
    15571692                      { 
    1558                          OPTI_1_completelistvarpointtovar($2,$4); 
     1693                         completelistvarpointtovar_1($2,$4); 
    15591694                      } 
    15601695                      if ( firstpass == 1 )  
     
    15741709                            sprintf(charusemodule,"%s",$2); 
    15751710                         } 
    1576                          Addmoduletothelist($2); 
    1577                       } 
    1578                       if ( firstpass == 0  && inmoduledeclare == 0 ) 
     1711                         Addmoduletothelist_1($2); 
     1712                      } 
     1713                      if ( inmoduledeclare == 0 ) 
    15791714                      { 
    15801715                         pos_end = setposcur(); 
    1581                          RemoveWordSET(fortranout,pos_curuse, 
     1716                         RemoveWordSET_0(fortranout,pos_curuse, 
    15821717                                               pos_end-pos_curuse); 
    15831718                      } 
     
    15881723                      if (insubroutinedeclare == 1) 
    15891724                      { 
    1590                          OPTI_0_copyuseonly($2); 
    1591                       } 
    1592                       if (firstpass == 1 )  
    1593                       { 
    1594                          sprintf(charusemodule,"%s",$2); 
    1595                          Addmoduletothelist($2); 
    1596                       } 
    1597                        if ( firstpass == 0  && inmoduledeclare == 0 ) 
     1725                         copyuseonly_0($2); 
     1726                      } 
     1727                      sprintf(charusemodule,"%s",$2); 
     1728                      Addmoduletothelist_1($2); 
     1729 
     1730                       if ( inmoduledeclare == 0 ) 
    15981731                       { 
    15991732                          pos_end = setposcur(); 
    1600                           RemoveWordSET(fortranout,pos_curuse, 
     1733                          RemoveWordSET_0(fortranout,pos_curuse, 
    16011734                                                pos_end-pos_curuse); 
    16021735                       } 
     
    16071740                       if (insubroutinedeclare == 1) 
    16081741                       { 
    1609                           OPTI_1_completelistvarpointtovar($2,$6); 
     1742                          completelistvarpointtovar_1($2,$6); 
    16101743                       } 
    16111744                       if ( firstpass == 1 )  
     
    16261759                             sprintf(charusemodule,"%s",$2); 
    16271760                          } 
    1628                           Addmoduletothelist($2); 
     1761                          Addmoduletothelist_1($2); 
    16291762                       } 
    1630                        if ( firstpass == 0  && inmoduledeclare == 0 ) 
    1631                        { 
    1632                           pos_end = setposcur(); 
    1633                           RemoveWordSET(fortranout,pos_curuse, 
    1634                                                 pos_end-pos_curuse); 
     1763                       if ( firstpass == 0 ) 
     1764             { 
     1765                          if ( inmoduledeclare == 0 ) 
     1766                          { 
     1767                             pos_end = setposcur(); 
     1768                             RemoveWordSET_0(fortranout,pos_curuse, 
     1769                                                   pos_end-pos_curuse); 
     1770                          } 
     1771                else 
     1772                { 
     1773                      /* if we are in the module declare and if the    */ 
     1774                      /* onlylist is a list of global variable         */ 
     1775                   variableisglobalinmodule($6, $2, fortranout); 
     1776                } 
    16351777                       } 
    16361778                    }     
     
    16381780word_use : TOK_USE 
    16391781                   { 
    1640                       if ( firstpass == 0 ) pos_curuse = setposcur()-3; 
     1782                      pos_curuse = setposcur()-strlen($1); 
    16411783                   } 
    16421784      ; 
     
    16831825                       $$ = coupletmp; 
    16841826                       pointedvar=1; 
    1685                        OPTI_1_ajoutevarindoloop($1); 
     1827                       ajoutevarindoloop_1($1); 
    16861828                    } 
    16871829      | TOK_NAME    { 
     
    17091851                            tmpdeclaration_everdone = 0; 
    17101852                            /*                                                */ 
    1711                             OPTI_0_closeandcallsubloopandincludeit(1,$1,""); 
    1712                             /* at the end of the firstpass we should remove   */ 
     1853                            closeandcallsubloopandincludeit_0(1,$1,""); 
     1854                            /* at the end of the firstpas  we should remove   */ 
    17131855                            /*    from the listvarindoloop all variables      */ 
    17141856                            /*    which has not been declared as table in the */ 
    17151857                            /*    globliste                                   */ 
    1716                             OPTI_1_cleanlistvarfordoloop(1); 
     1858                            cleanlistvarfordoloop_1(1); 
    17171859                         } 
    17181860                         else 
     
    17231865                               if ( aftercontainsdeclare == 0 ) 
    17241866                               { 
    1725                                   if ( firstpass == 1)  
    1726                                          DATA_1_CompleteGlobListeWithDatalist(); 
    1727                                  addi_0_addsubroutine_inst_back_alloc(1); 
     1867                                 CompleteGlobListeWithDatalist_1(); 
     1868                                 addsubroutine_alloc_0(1); 
    17281869                               } 
    17291870                            } 
     
    17391880                          insubroutinedeclare = 0; 
    17401881                          /*                                                  */ 
    1741                           OPTI_0_closeandcallsubloopandincludeit(2,$1,""); 
     1882                          closeandcallsubloopandincludeit_0(2,$1,""); 
    17421883                          /* it is like end subroutine or end program         */ 
    17431884                          /*  Common case                                     */ 
    1744                           /* at the end of the firstpass we should remove     */ 
     1885                          /* at the end of the firstpas  we should remove     */ 
    17451886                          /*    from the listvarindoloop all variables which  */ 
    17461887                          /*    has not been declared as table in the         */ 
    17471888                          /*    globliste                                     */ 
    1748                           OPTI_1_cleanlistvarfordoloop(1); 
     1889                          cleanlistvarfordoloop_1(1); 
    17491890                       } 
    17501891                    } 
     
    17551896                       insubroutinedeclare = 0; 
    17561897                       /*                                                     */ 
    1757                        OPTI_0_closeandcallsubloopandincludeit(3,$1,$2); 
     1898                       closeandcallsubloopandincludeit_0(3,$1,$2); 
    17581899                       /*  Common case                                        */ 
    1759                        /* at the end of the firstpass we should remove from   */ 
     1900                       /* at the end of the firstpas  we should remove from   */ 
    17601901                       /*    the listvarindoloop all variables which has not  */ 
    17611902                       /*    been declared as table in the globliste          */ 
    1762                        OPTI_1_cleanlistvarfordoloop(3); 
     1903                       cleanlistvarfordoloop_1(3); 
    17631904                    } 
    17641905      | TOK_ENDSUBROUTINE opt_name 
     
    17681909                       insubroutinedeclare = 0; 
    17691910                       /*                                                     */ 
    1770                        OPTI_0_closeandcallsubloopandincludeit(1,$1,$2); 
     1911                       closeandcallsubloopandincludeit_0(1,$1,$2); 
    17711912                       /*  Common case                                        */ 
    1772                        /* at the end of the firstpass we should remove from   */ 
     1913                       /* at the end of the firstpas  we should remove from   */ 
    17731914                       /*    the listvarindoloop all variables which has not  */ 
    17741915                       /*    been declared as table in the globliste          */ 
    1775                        OPTI_1_cleanlistvarfordoloop(1); 
     1916                       cleanlistvarfordoloop_1(1); 
    17761917                    } 
    17771918      | TOK_ENDFUNCTION opt_name 
     
    17811922                       insubroutinedeclare = 0; 
    17821923                       /*                                                     */ 
    1783                        OPTI_0_closeandcallsubloopandincludeit(0,$1,$2); 
     1924                       closeandcallsubloopandincludeit_0(0,$1,$2); 
    17841925                       /*  Common case                                        */ 
    1785                        /* at the end of the firstpass we should remove from   */ 
     1926                       /* at the end of the firstpas  we should remove from   */ 
    17861927                       /*    the listvarindoloop all variables which has not  */ 
    17871928                       /*    been declared as table in the globliste          */ 
    1788                        OPTI_1_cleanlistvarfordoloop(0); 
     1929                       cleanlistvarfordoloop_1(0); 
    17891930                    } 
    17901931      | TOK_ENDMODULE opt_name 
     
    17951936                          if ( aftercontainsdeclare == 0 ) 
    17961937                          { 
    1797                              if ( firstpass == 1)  
    1798                                          DATA_1_CompleteGlobListeWithDatalist(); 
    1799                              addi_0_addsubroutine_inst_back_alloc(1); 
     1938                             CompleteGlobListeWithDatalist_1(); 
     1939                             addsubroutine_alloc_0(1); 
    18001940                          } 
    18011941                       } 
     
    18201960                      if (inmoduledeclare == 1 ) 
    18211961                      { 
    1822                          if ( firstpass == 1)  
    1823                                          DATA_1_CompleteGlobListeWithDatalist(); 
    1824                          addi_0_addsubroutine_inst_back_alloc(0); 
     1962                         CompleteGlobListeWithDatalist_1(); 
     1963                         addsubroutine_alloc_0(0); 
    18251964                      } 
    18261965                      inmoduledeclare = 0 ;  
     
    18331972      | caselist ':' expr 
    18341973      ; 
    1835 boucledo : worddo do_var '=' expr ',' expr 
    1836       | worddo do_var '=' expr ',' expr ',' expr 
     1974boucledo : worddo opt_int do_var '=' expr ',' expr 
     1975      | worddo opt_int do_var '=' expr ',' expr ',' expr 
    18371976      | wordwhile expr 
    18381977      | TOK_ENDDO optname 
     1978      ; 
     1979opt_int :  
     1980      | TOK_CSTINT 
    18391981      ; 
    18401982opt_name : '\n'  {strcpy($$,"");} 
     
    18541996 
    18551997iffable: TOK_CONTINUE 
    1856       | ident dims dims after_ident_dims 
    1857       | structure_component after_ident_dims 
     1998      | ident_dims after_ident_dims 
    18581999      | goto 
    18592000      | io 
    18602001      | call  
    1861       | TOK_EXIT opt_name 
    1862       | TOK_RETURN optexpr 
     2002      | TOK_ALLOCATE '(' allocation_list opt_stat_spec ')' 
     2003      | TOK_DEALLOCATE '(' allocate_object_list opt_stat_spec ')' 
     2004      | TOK_EXIT optexpr 
     2005      | TOK_RETURN opt_expr 
     2006      | TOK_CYCLE opt_expr 
    18632007      | stop opt_expr 
     2008      | int_list 
     2009      ; 
     2010before_dims : {if ( couldaddvariable == 1 ) created_dimensionlist = 0;} 
     2011ident_dims : ident before_dims dims dims 
     2012      {created_dimensionlist = 1;} 
     2013      | ident_dims '%' ident before_dims dims dims 
     2014      {created_dimensionlist = 1;} 
     2015int_list : TOK_CSTINT 
     2016      | int_list ',' TOK_CSTINT 
    18642017      ; 
    18652018after_ident_dims : '=' expr  
    1866                    {sprintf($$,"=%s",$2);} 
    18672019      | TOK_POINT_TO expr  
    1868                    {sprintf($$,"=>%s",$2);} 
    18692020      ; 
    18702021call: keywordcall opt_call  
     
    18732024                      incalldeclare=0; 
    18742025                      if ( oldfortranout &&  
    1875                            !strcmp(meetagrifinitgrids,subroutinename) &&  
     2026                           !strcasecmp(meetagrifinitgrids,subroutinename) &&  
    18762027                           firstpass == 0 && 
    18772028                           callmpiinit == 1) 
    18782029                      { 
    18792030                         pos_end = setposcur(); 
    1880                          RemoveWordSET(fortranout,pos_curcall, 
     2031                         RemoveWordSET_0(fortranout,pos_curcall, 
    18812032                                               pos_end-pos_curcall); 
    18822033                         fprintf(oldfortranout,"      Call MPI_Init (%s) \n" 
     
    18882039                      { 
    18892040                         pos_end = setposcur(); 
    1890                          RemoveWordSET(fortranout,pos_curcall, 
     2041                         RemoveWordSET_0(fortranout,pos_curcall, 
    18912042                                               pos_end-pos_curcall); 
    18922043                         fprintf(oldfortranout, 
     
    18942045                         strcpy(subofagrifinitgrids,subroutinename); 
    18952046                      } 
     2047                      Instanciation_0(sameagrifname); 
    18962048                   } 
    18972049      ; 
     
    19192071                       } 
    19202072                       else callagrifinitgrids = 0; 
    1921                        if ( AGRIF_n_Vartonumber($2) == 1 )  
     2073                       if ( Vartonumber($2) == 1 )  
    19222074                       { 
    19232075                          incalldeclare=1; 
    19242076                          inagrifcallargument = 1 ; 
    1925                           AGRIF_n_AddsubroutineTolistsubwhereagrifused(); 
     2077                          AddsubroutineTolistsubwhereagrifused(); 
    19262078                       } 
    19272079                    } 
    19282080      ; 
    19292081before_call : TOK_CALL 
    1930                     {if ( firstpass == 0 ) pos_curcall=setposcur()-4;} 
     2082                    {pos_curcall=setposcur()-4;} 
    19312083callarglist:  callarg 
    19322084      | callarglist ',' callarg 
     
    19552107io: iofctl ioctl 
    19562108      | read option_read 
    1957       | write '(' idfile  opt_ioctl_format ')' opt_outlist 
    1958                     {formatdeclare = 0;} 
    19592109      | TOK_REWIND after_rewind 
    19602110      | print option_print 
     
    19642114wordformat : TOK_FORMAT 
    19652115                    {formatdeclare = 1;} 
     2116opt_ioctlformat :  
     2117      | ioctl_format 
     2118      ; 
    19662119opt_ioctl_format :  
    19672120      | ',' ioctl_format 
     
    19742127      |   ioctl_format ',' format_expr 
    19752128      ; 
    1976 format_expr : uexpr 
     2129format_expr :  
     2130      | uexpr 
    19772131      | TOK_CSTINT TOK_CHAR_INT 
    19782132      | TOK_CSTINT debut_format ioctl_format fin_format 
    19792133      | TOK_SLASH opt_CHAR_INT 
     2134      | TOK_CHAR_INT TOK_SLASH format_expr 
     2135      | TOK_SLASH TOK_SLASH 
    19802136      | TOK_CHAR_INT 
     2137      | '(' format_expr ')' 
     2138      | '(' uexpr ')' 
    19812139      ; 
    19822140opt_CHAR_INT :  
     
    20182176      | TOK_DASTER 
    20192177      | TOK_NAME expr  
     2178      | TOK_NAME expr '%' ident_dims 
    20202179      | TOK_NAME '(' triplet ')' 
    20212180      | TOK_NAME '*'  
    20222181      | TOK_NAME TOK_DASTER  
    2023 /*      | TOK_REC '=' ident*/ 
    2024       ; 
    2025 iofctl:  ctlkwd 
    2026       ; 
    2027 ctlkwd: TOK_INQUIRE 
    2028       | TOK_OPEN 
     2182      ; 
     2183iofctl: TOK_OPEN 
    20292184      | TOK_CLOSE 
    20302185      ; 
     
    20342189 
    20352190read:TOK_READ 
    2036       ; 
    2037 write: TOK_WRITE 
    2038       ; 
    2039 print:TOK_PRINT fexpr 
     2191      | TOK_INQUIRE 
     2192      | TOK_WRITE 
     2193      ; 
     2194print: TOK_PRINT fexpr 
    20402195      | TOK_PRINT '*' 
    20412196      ; 
     
    20612216      | inlist ',' inelt 
    20622217      ; 
    2063 inelt: lhs 
     2218opt_lhs :  
     2219      | lhs 
     2220      ; 
     2221inelt: opt_lhs opt_operation 
     2222      | '(' inlist ')' opt_operation 
     2223      | predefinedfunction opt_operation 
     2224      | simple_const opt_operation  
    20642225      | '(' inlist ',' dospec ')' 
    20652226      ; 
     2227opt_operation : 
     2228      | operation 
     2229      | opt_operation operation 
     2230      ;       
    20662231outlist: other      {strcpy($$,$1);}  
    20672232      | out2       {strcpy($$,$1);}  
     
    21072272      ; 
    21082273allocation_list: allocate_object 
     2274      | ident_dims 
    21092275      | allocation_list ',' allocate_object 
    21102276      ; 
    21112277allocate_object: ident 
    2112                    {OPTI_1_AddIdentToTheAllocateList($1);} 
     2278                   {AddIdentToTheAllocateList_1($1);} 
    21132279      | structure_component 
    21142280      | array_element 
    21152281      ; 
    21162282array_element: ident '(' funargs ')'  
    2117                    {OPTI_1_AddIdentToTheAllocateList($1);} 
     2283                   {AddIdentToTheAllocateList_1($1);} 
    21182284      ; 
    21192285subscript_list: expr  
     
    21362302      | TOK_CONSTRUCTID ':' 
    21372303      ; 
    2138 logif: TOK_LOGICALIF '(' expr ')' 
     2304logif: TOK_LOGICALIF expr ')' 
    21392305      ; 
    21402306do_var: ident {strcpy($$,$1);} 
     
    21962362      } 
    21972363   }   
    2198    strcpy(commonfile,fichier_entree); 
    21992364 
    22002365/******************************************************************************/ 
     
    22172382   strcpy(NamePrecision," ");  
    22182383   VariableIsParameter =  0 ;  
    2219    PrecisionGiven = 0 ;  
    2220    lengspecgiven =0; 
     2384   strcpy(NamePrecision,"");   
    22212385   c_star = 0 ;  
    22222386   insubroutinedeclare = 0 ; 
    22232387   strcpy(subroutinename," ");  
    2224    CharacterSizeGiven = 0 ;  
    22252388   InitialValueGiven = 0 ;  
    22262389   strcpy(EmptyChar," ");  
     
    22362399/*  2-  Parsing of the input file (1 time)                                    */ 
    22372400/******************************************************************************/ 
    2238    if (firstpass == 0 ) fortranout=fopen(nomfileoutput,"w"); 
    2239    /* we should add the new module comes from common block                    */ 
    2240    if (firstpass == 0 && fortran77 == 1 ) fprintf 
     2401   if (firstpass == 0 )  
     2402   { 
     2403      fortranout=fopen(nomfileoutput,"w"); 
     2404      /* we should add the new module comes from common block                 */ 
     2405      if (fortran77 == 1 ) fprintf 
    22412406                      (fortranout,"#include \"NewModule_%s.h\" \n",curfilename); 
     2407   } 
    22422408 
    22432409   fortranparse(); 
     
    22452411   strcpy(curfile,mainfile); 
    22462412 
    2247    if (firstpass ==0) fclose(fortranout); 
     2413   if (firstpass == 0 ) fclose(fortranout); 
    22482414} 
Note: See TracChangeset for help on using the changeset viewer.