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 663 for trunk/AGRIF/LIB/fortran.y – NEMO

Ignore:
Timestamp:
2007-05-25T18:00:33+02:00 (17 years ago)
Author:
opalod
Message:

RB: update CONV

File:
1 edited

Legend:

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

    r530 r663  
    33/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */ 
    44/*                                                                            */ 
    5 /* Copyright or © or Copr. Laurent Debreu (Laurent.Debreu@imag.fr)            */ 
    6 /*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */ 
     5/* Copyright or   or Copr. Laurent Debreu (Laurent.Debreu@imag.fr)            */ 
     6/*                        Cyril Mazauric (Cyril_Mazauric@yahoo.fr)            */ 
    77/* This software is governed by the CeCILL-C license under French law and     */ 
    88/* abiding by the rules of distribution of free software.  You can  use,      */ 
     
    3131/* knowledge of the CeCILL-C license and that you accept its terms.           */ 
    3232/******************************************************************************/ 
    33 /* version 1.0                                                                */ 
     33/* version 1.6                                                                */ 
    3434/******************************************************************************/ 
    3535%{ 
     
    4949typedim c_selectordim; 
    5050listcouple *coupletmp; 
     51listdim *parcoursdim; 
    5152int removeline=0; 
     53listvar *test; 
    5254%} 
    5355 
     
    5658       listdim  *d; 
    5759       listvar  *l; 
    58        listvarcommon *lcom; 
    5960       listnom  *ln; 
    6061       listcouple  *lc; 
     
    8182%token TOK_NEXTLINE 
    8283%token TOK_PARAMETER 
    83 %token TOK_KIND 
    8484%token TOK_RESULT 
    8585%token TOK_ONLY 
     
    103103%token TOK_SELECTCASE 
    104104%token TOK_FILE 
     105%token TOK_END 
     106%token TOK_ERR 
    105107%token TOK_DONOTTREAT 
    106108%token TOK_ENDDONOTTREAT 
     
    123125%token TOK_TAN 
    124126%token TOK_ATAN 
     127%token TOK_RECURSIVE 
    125128%token TOK_ABS 
    126129%token TOK_MOD 
    127130%token TOK_SIGN 
    128131%token TOK_MINLOC 
    129 /*%token TOK_REC*/ 
    130132%token TOK_MAXLOC 
    131133%token TOK_EXIT 
     
    168170%token TOK_INTENT 
    169171%token TOK_INTRINSIC 
    170 %token TOK_NAMELIST  
    171 %token TOK_CASEDEFAULT  
     172%token TOK_NAMELIST 
     173%token TOK_CASEDEFAULT 
    172174%token TOK_OPTIONAL 
    173175%token TOK_POINTER 
     
    175177%token TOK_SAVE 
    176178%token TOK_TARGET 
    177 %token TOK_POINT 
    178 %token TOK_DATA  
    179179%token TOK_QUOTE 
    180180%token TOK_IMPLICIT 
     
    185185%token TOK_COMMON 
    186186%token TOK_GLOBAL 
    187 %token TOK_INTERFACE  
    188 %token TOK_ENDINTERFACE  
    189 %token TOK_LEFTAB  
    190 %token TOK_RIGHTAB  
     187%token TOK_INTERFACE 
     188%token TOK_ENDINTERFACE 
     189%token TOK_LEFTAB 
     190%token TOK_RIGHTAB 
    191191%token TOK_PAUSE 
    192192%token TOK_PROCEDURE 
     
    207207%token <na> TOK_NOT 
    208208%token <na> TOK_AND 
    209 %token <na> TOK_TRUE  
    210 %token <na> TOK_FALSE  
     209%token <na> TOK_TRUE 
     210%token <na> TOK_FALSE 
    211211%token <na> TOK_LABEL 
    212212%token <na> TOK_TYPE 
     213%token <na> TOK_TYPEPAR 
    213214%token <na> TOK_ENDTYPE 
    214215%token <na> TOK_REAL 
     
    224225%token <na> TOK_CHAR_CONSTANT 
    225226%token <na> TOK_CHAR_CUT 
     227%token <na> TOK_DATA 
    226228%token <na> TOK_CHAR_INT 
    227 %token <na> TOK_CHAR_MESSAGE  
     229%token <na> TOK_CHAR_MESSAGE 
    228230%token <na> TOK_CSTREAL 
    229231%token <na> TOK_CSTREALDP 
    230232%token <na> TOK_CSTREALQP 
    231 %token <na> TOK_SFREAL  
     233%token <na> TOK_SFREAL 
    232234%token <na> TOK_COMPLEX 
    233235%token <na> TOK_DOUBLECOMPLEX 
     
    242244%token <na> TOK_OP 
    243245%token <na> TOK_CSTINT 
    244 %token <na> TOK_COMMENT  
     246%token <na> TOK_COMMENT 
    245247%token <na> TOK_FILENAME 
    246248%token ',' 
     
    248250%token ':' 
    249251%token '(' 
    250 %token ')'    
     252%token ')' 
    251253%token '[' 
    252254%token ']' 
    253255%token '!' 
    254 %token '_'  
    255 %token '<'  
    256 %token '>'  
     256%token '_' 
     257%token '<' 
     258%token '>' 
    257259%type <l> dcl 
     260%type <l> after_type 
    258261%type <l> dimension 
    259262%type <l> paramlist 
    260 %type <l> args   
     263%type <l> args 
     264%type <l> arglist 
    261265%type <lc> only_list 
    262266%type <lc> only_name 
    263267%type <lc> rename_list 
    264268%type <lc> rename_name 
    265 %type <lcom> common 
    266 %type <lcom> var_common 
    267 %type <lcom> var_common_list 
    268269%type <d> dims 
    269270%type <d> dimlist 
     
    286287%type <na> simple_const 
    287288%type <na> vec 
    288 %type <na> outlist  
    289 %type <na> out2  
    290 %type <na> other  
    291 %type <na> dospec  
    292 %type <na> expr_data  
    293 %type <na> beforefunctionuse  
    294 %type <na> ident  
    295 %type <na> structure_component  
    296 %type <na> array_ele_substring_func_ref   
    297 %type <na> funarglist   
    298 %type <na> funarg   
    299 %type <na> funargs   
    300 %type <na> triplet   
    301 %type <na> substring   
    302 %type <na> string_constant   
    303 %type <na> opt_substring   
    304 %type <na> opt_expr   
    305 %type <na> optexpr   
    306 %type <na> datavallist   
    307 %type <na> after_slash   
     289%type <na> outlist 
     290%type <na> out2 
     291%type <na> other 
     292%type <na> dospec 
     293%type <na> expr_data 
     294%type <na> beforefunctionuse 
     295%type <na> ident 
     296%type <na> structure_component 
     297%type <na> array_ele_substring_func_ref 
     298%type <na> funarglist 
     299%type <na> funarg 
     300%type <na> funargs 
     301%type <na> triplet 
     302%type <na> substring 
     303%type <na> string_constant 
     304%type <na> opt_substring 
     305%type <na> opt_expr 
     306%type <na> optexpr 
     307%type <na> datavallist 
     308%type <na> after_slash 
    308309%type <na> after_equal 
    309310%type <na> predefinedfunction 
    310 %type <na> do_var   
     311%type <na> do_var 
    311312%type <na> expr 
     313%type <na> word_endsubroutine 
     314%type <na> word_endfunction 
     315%type <na> word_endprogram 
     316%type <na> word_endunit 
    312317%type <na> intent_spec 
    313318%type <na> ubound 
     
    328333      | keyword cmnt writedeclar 
    329334      | error writedeclar nulcurbuf 
    330                    {yyerrok;yyclearin;}     
     335                   {yyerrok;yyclearin;} 
    331336      ; 
    332337suite_line_list : suite_line 
     
    337342      | before_include filename fin_line 
    338343                  { 
    339                      if (inmoduledeclare == 0 &&  
    340                          couldaddvariable == 1 ) 
     344                     if (inmoduledeclare == 0 ) 
    341345                     { 
    342346                        pos_end = setposcur(); 
     
    346350                  } 
    347351      | exec cmnt writedeclar /* if, do etc ...                               */ 
    348       | instr fin_line    /* instruction ident : do i = 1 ...                 */ 
     352      | instr fin_line    /* instruction ident  : do i = 1 ...                */ 
    349353      ; 
    350354instr : ident ':' 
     
    352356fin_line : position cmnt 
    353357      ; 
    354 keyword : TOK_DONOTTREAT  
     358keyword : TOK_DONOTTREAT 
    355359         { 
    356             /* we should ignore the declaration until the keyword   */ 
    357             /*    TOK_ENDDONOTTREAT                                 */ 
     360            /* we should ignore the declaration until the keyword             */ 
     361            /*    TOK_ENDDONOTTREAT                                           */ 
    358362            couldaddvariable = 0 ; 
    359363            RemoveWordCUR_0(fortranout,-20,20); 
    360364         } 
    361       | TOK_ENDDONOTTREAT  
     365      | TOK_ENDDONOTTREAT 
    362366         { 
    363367             couldaddvariable = 1 ; 
     
    369373position: {pos_cur = setposcur();} 
    370374      ; 
    371 thislabel:  
     375thislabel: 
    372376      | TOK_LABEL nulcurbuf 
    373377      ; 
     
    381385                   {if (incom !=1) {strcpy(curbuf,"");incom=0;}} 
    382386      ; 
    383 entry:  
    384       | TOK_SUBROUTINE name_routine arglist 
    385                    { 
    386                       Listofvariableinagriffunction=(listnom *)NULL; 
    387                       strcpy(subroutinename,$2); 
     387opt_recursive : 
     388      | TOK_RECURSIVE 
     389      ; 
     390entry: 
     391      | opt_recursive TOK_SUBROUTINE name_routine arglist 
     392                   { 
     393                      if ( couldaddvariable == 1 ) 
     394                      { 
     395                      /* open param file                                      */ 
     396                      if ( firstpass == 0 ) 
     397                      { 
     398                         sprintf(ligne,"%s/ParamFile%s.h",nomdir,$3); 
     399                         paramout=fopen(ligne,"w"); 
     400                         if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     401                         else fprintf(paramout,"C\n"); 
     402 
     403                      } 
     404                      Add_SubroutineArgument_Var_1($4); 
    388405                      if ( inmodulemeet == 1 ) 
    389406                      { 
    390                          tmpdeclaration_everdone = 0; 
    391                          paramdeclaration_everdone = 0; 
    392407                         insubroutinedeclare = 1; 
    393                          AddUseAgrifUtil_0(); 
    394408                         /* in the second step we should write the head of    */ 
    395409                         /*    the subroutine sub_loop_<subroutinename>       */ 
    396410                         writeheadnewsub_0(1); 
    397                          adduseagrifutil = 0 ;  
    398411                      } 
    399412                      else 
    400413                      { 
    401                             tmpdeclaration_everdone = 0; 
    402                             paramdeclaration_everdone = 0; 
    403414                            insubroutinedeclare = 1; 
    404                             AddUseAgrifUtil_0(); 
    405415                            writeheadnewsub_0(1); 
    406                             adduseagrifutil = 0 ;  
     416                      } 
    407417                      } 
    408418                   } 
    409419      | TOK_PROGRAM name_routine 
    410420                   { 
    411                       Listofvariableinagriffunction=(listnom *)NULL; 
     421                      /* open param file                                      */ 
     422                      if ( firstpass == 0 ) 
     423                      { 
     424                         sprintf(ligne,"%s/ParamFile%s.h",nomdir,$2); 
     425                         paramout=fopen(ligne,"w"); 
     426                         if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     427                         else fprintf(paramout,"C\n"); 
     428 
     429                      } 
    412430                      strcpy(subroutinename,$2); 
    413431                      /* Common case                                          */ 
    414                          tmpdeclaration_everdone = 0; 
    415                          paramdeclaration_everdone = 0; 
    416                          insubroutinedeclare = 1; 
    417                          AddUseAgrifUtil_0(); 
    418                          /* in the second step we should write the head of    */ 
    419                          /*    the subroutine sub_loop_<subroutinename>       */ 
    420                          writeheadnewsub_0(1); 
    421                          adduseagrifutil = 0 ;                        
     432                      insubroutinedeclare = 1; 
     433                      /* in the second step we should write the head of       */ 
     434                      /*    the subroutine sub_loop_<subroutinename>          */ 
     435                      writeheadnewsub_0(1); 
    422436                   } 
    423437      | TOK_FUNCTION name_routine arglist TOK_RESULT arglist1 
    424438                   { 
    425                       Listofvariableinagriffunction=(listnom *)NULL; 
     439                      /* open param file                                      */ 
     440                      if ( firstpass == 0 ) 
     441                      { 
     442                         sprintf(ligne,"%s/ParamFile%s.h",nomdir,$2); 
     443                         paramout=fopen(ligne,"w"); 
     444                         if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     445                         else fprintf(paramout,"C\n"); 
     446                      } 
    426447                      strcpy(subroutinename,$2); 
    427448                      if ( inmodulemeet == 1 ) 
    428449                      { 
    429                          tmpdeclaration_everdone = 0; 
    430                          paramdeclaration_everdone = 0; 
    431450                         insubroutinedeclare = 1; 
    432                          AddUseAgrifUtil_0(); 
    433451                         /* we should to list of the subroutine argument the  */ 
    434452                         /*    name of the function which has to be defined   */ 
    435                          if ( firstpass == 1 )  
    436                          { 
    437                             curvar=createvar($2,NULL); 
    438                             curlistvar=insertvar(NULL,curvar); 
    439                             listargsubroutine = AddListvarToListvar(curlistvar,listargsubroutine,1); 
    440                          } 
     453                         Add_SubroutineArgument_Var_1($3); 
     454                         strcpy(DeclType,""); 
    441455                         /* in the second step we should write the head of    */ 
    442456                         /*    the subroutine sub_loop_<subroutinename>       */ 
    443457                         writeheadnewsub_0(2); 
    444                          adduseagrifutil = 0 ;  
    445458                      } 
    446459                      else 
    447460                      { 
    448                             tmpdeclaration_everdone = 0; 
    449                             paramdeclaration_everdone = 0; 
    450461                            insubroutinedeclare = 1; 
    451                             AddUseAgrifUtil_0(); 
    452462                            /* we should to list of the subroutine argument   */ 
    453463                            /* name of the function which has to be defined   */ 
    454                             if ( firstpass == 1 )  
    455                             { 
    456                                curvar=createvar($2,NULL); 
    457                                curlistvar=insertvar(NULL,curvar); 
    458                                listargsubroutine = AddListvarToListvar 
    459                                                (curlistvar,listargsubroutine,1); 
    460                             } 
     464                            Add_SubroutineArgument_Var_1($3); 
     465                            strcpy(DeclType,""); 
     466                            Add_FunctionType_Var_1($2); 
    461467                            writeheadnewsub_0(2); 
    462                             adduseagrifutil = 0 ;  
    463468                      } 
    464469                   } 
    465470      | TOK_FUNCTION name_routine arglist 
    466471                   { 
    467                       Listofvariableinagriffunction=(listnom *)NULL; 
     472                      /* open param file                                      */ 
     473                      if ( firstpass == 0 ) 
     474                      { 
     475                         sprintf(ligne,"%s/ParamFile%s.h",nomdir,$2); 
     476                         paramout=fopen(ligne,"w"); 
     477                         if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     478                         else fprintf(paramout,"C\n"); 
     479                      } 
    468480                      strcpy(subroutinename,$2); 
    469481                      if ( inmodulemeet == 1 ) 
    470482                      { 
    471                          tmpdeclaration_everdone = 0; 
    472                          paramdeclaration_everdone = 0; 
    473483                         insubroutinedeclare = 1; 
    474                          AddUseAgrifUtil_0(); 
    475484                         /* we should to list of the subroutine argument the  */ 
    476485                         /*    name of the function which has to be defined   */ 
    477                          if ( firstpass == 1 )  
    478                          { 
    479                             curvar=createvar($2,NULL); 
    480                             curlistvar=insertvar(NULL,curvar); 
    481                             listargsubroutine = AddListvarToListvar 
    482                                                (curlistvar,listargsubroutine,1); 
    483                          } 
     486                         Add_SubroutineArgument_Var_1($3); 
     487                         strcpy(DeclType,""); 
     488                         Add_FunctionType_Var_1($2); 
    484489                         /* in the second step we should write the head of    */ 
    485490                         /*    the subroutine sub_loop_<subroutinename>       */ 
    486491                         writeheadnewsub_0(2); 
    487                          adduseagrifutil = 0 ;  
    488492                      } 
    489493                      else 
    490494                      { 
    491                             tmpdeclaration_everdone = 0; 
    492                             paramdeclaration_everdone = 0; 
    493495                            insubroutinedeclare = 1; 
    494                             AddUseAgrifUtil_0(); 
    495496                            /* we should to list of the subroutine argument   */ 
    496497                            /* name of the function which has to be defined   */ 
    497                             if ( firstpass == 1 )  
    498                             { 
    499                                curvar=createvar($2,NULL); 
    500                                curlistvar=insertvar(NULL,curvar); 
    501                                listargsubroutine = AddListvarToListvar 
    502                                                (curlistvar,listargsubroutine,1); 
    503                             } 
     498                            Add_SubroutineArgument_Var_1($3); 
     499                            strcpy(DeclType,""); 
     500                            Add_FunctionType_Var_1($2); 
    504501                            writeheadnewsub_0(2); 
    505                             adduseagrifutil = 0 ;  
    506502                      } 
    507503                   } 
    508504      | TOK_MODULE TOK_NAME 
    509505                   { 
     506                      GlobalDeclaration = 0; 
    510507                      strcpy(curmodulename,$2); 
    511                       Add_ModuleTo_Modulelist_1($2); 
     508                      strcpy(subroutinename,""); 
     509                      Add_NameOfModule_1($2); 
    512510                      if ( inmoduledeclare == 0 ) 
    513                       {  
    514                          /* Alloc should be create ?                          */ 
    515                          FillInlistmodule_1();    
     511                      { 
    516512                         /* To know if there are in the module declaration    */ 
    517513                         inmoduledeclare = 1; 
     
    520516                         /* to know if we are after the keyword contains      */ 
    521517                         aftercontainsdeclare = 0 ; 
    522                       }       
    523                       /* WE should use Agrif_Util if it is necessary          */ 
    524                       AddUseAgrifInModuleDeclaration_0(); 
    525                    } 
    526       ; 
    527 name_routine : TOK_NAME {strcpy($$,$1);strcpy(subroutinename,$1);} 
     518                      } 
     519                   } 
     520      ; 
     521name_routine : TOK_NAME 
     522                   { 
     523                      if ( couldaddvariable == 1 ) 
     524                      { 
     525                         strcpy($$,$1);strcpy(subroutinename,$1); 
     526                      } 
     527                   } 
    528528writedeclar : 
    529529      ; 
     
    531531                   { 
    532532                      pos_curinclude = setposcur()-9; 
    533                    }       
     533                   } 
    534534filename: TOK_CHAR_CONSTANT 
    535535                   { 
    536                       if ( couldaddvariable == 1 ) 
    537                       { 
    538                          Addincludetothelist_1($1); 
    539                       }                    
    540                    } 
    541       ; 
    542 arglist:  
     536                      if ( couldaddvariable == 1 ) Add_Include_1($1); 
     537                   } 
     538      ; 
     539arglist:           { 
     540                      if ( firstpass == 1 && couldaddvariable == 1) $$=NULL; 
     541                   } 
    543542      | '(' ')'    { 
    544                       if ( firstpass == 1 ) listargsubroutine=NULL; 
     543                      if ( firstpass == 1 && couldaddvariable == 1 ) $$=NULL; 
    545544                   } 
    546545      | '(' args ')' 
    547546                   { 
    548                        if ( firstpass == 1 ) listargsubroutine=$2; 
    549                    } 
    550       ; 
    551 arglist1:  
     547                       if ( firstpass == 1 && couldaddvariable == 1 ) $$=$2; 
     548                   } 
     549      ; 
     550arglist1: 
    552551      | '(' ')' 
    553552      | '(' args ')' 
    554553                   { 
    555                        listargsubroutine = AddListvarToListvar 
    556                                                        ($2,listargsubroutine,1); 
     554                      if ( couldaddvariable == 1 ) 
     555                      { 
     556                         Add_SubroutineArgument_Var_1($2); 
     557                      } 
    557558                   } 
    558559      ; 
    559560args:arg           { 
    560                       if ( firstpass == 1 ) 
    561                       { 
    562                          curvar=createvar($1,curdim); 
     561                      if ( firstpass == 1  && couldaddvariable == 1) 
     562                      { 
     563                         curvar=createvar($1,NULL); 
    563564                         curlistvar=insertvar(NULL,curvar); 
    564                          $$=settype($1,curlistvar); 
    565                       } 
    566                    } 
    567       | args ',' arg  
    568                    { 
    569                       if ( firstpass == 1 ) 
    570                       { 
    571                          curvar=createvar($3,curdim); 
     565                         $$=settype("",curlistvar); 
     566                      } 
     567                   } 
     568      | args ',' arg 
     569                   { 
     570                      if ( firstpass == 1  && couldaddvariable == 1) 
     571                      { 
     572                         curvar=createvar($3,NULL); 
    572573                         $$=insertvar($1,curvar); 
    573574                      } 
    574575                   } 
    575576      ; 
    576 arg: TOK_NAME      {strcpy($$,$1);} 
    577       | '*'        {strcpy($$,"*");} 
    578       ;  
     577arg: TOK_NAME      {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     578      | '*'        {if ( couldaddvariable == 1 ) strcpy($$,"*");} 
     579      ; 
    579580spec: type after_type 
    580581                   { 
    581                       /* remove declaration                                   */ 
    582                       if ( fortran77 == 1                       &&  
    583                            infunctiondeclare == 0               &&  
    584                            commonlist                           &&  
    585                            IsTabvarsUseInArgument_0() == 1      && 
    586                            couldaddvariable == 1 )  
    587                       { 
     582                      if ( VarTypepar == 1 ) 
     583                      { 
     584                         couldaddvariable = 1 ; 
     585                         VarTypepar = 0; 
     586                      } 
     587                   } 
     588      | TOK_TYPE opt_spec opt_sep opt_name 
     589                   { 
     590                      if ( couldaddvariable == 1 ) 
     591                      { 
     592                         VarType = 1; 
     593                         couldaddvariable = 0 ; 
     594                      } 
     595                   } 
     596      | TOK_ENDTYPE opt_name 
     597                   { 
     598                      if ( VarType == 1 ) couldaddvariable = 1 ; 
     599                      VarType = 0; 
     600                      VarTypepar = 0; 
     601                   } 
     602      | TOK_POINTER list_couple 
     603      | before_parameter  '(' paramlist ')' 
     604                   { 
     605                      if ( couldaddvariable == 1 ) 
     606                      { 
     607                         if ( insubroutinedeclare == 0 ) 
     608                                                  Add_GlobalParameter_Var_1($3); 
     609                         else Add_Parameter_Var_1($3); 
    588610                         pos_end = setposcur(); 
    589611                         RemoveWordSET_0(fortranout,pos_cur_decl, 
    590                                                pos_end-pos_cur_decl); 
    591                       } 
    592                       infunctiondeclare = 0 ; 
    593                    } 
    594       | TOK_TYPE opt_name 
    595 /*      { 
    596          couldaddvariable = 0; 
    597       }*/ 
    598       | TOK_ENDTYPE opt_name 
    599 /*      { 
    600          couldaddvariable = 1; 
    601       }*/ 
    602       | TOK_POINTER list_couple 
    603       | before_parameter  '(' paramlist ')'  
    604                    { 
    605                       AddvartoParamlist_1($3); 
    606                       if ( fortran77 == 1  &&  
    607                            commonlist      &&  
    608                            listvarindoloop &&  
    609                            IsTabvarsUseInArgument_0() == 1 ) 
    610                       { 
     612                                                    pos_end-pos_cur_decl); 
     613                      } 
     614                      VariableIsParameter =  0 ; 
     615                   } 
     616      | before_parameter  paramlist 
     617                   { 
     618                     if ( couldaddvariable == 1 ) 
     619                     { 
     620                        if ( insubroutinedeclare == 0 ) 
     621                                                  Add_GlobalParameter_Var_1($2); 
     622                         else Add_Parameter_Var_1($2); 
    611623                         pos_end = setposcur(); 
    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, 
    626                                                pos_end-pos_curparameter); 
    627                       } 
     624                         RemoveWordSET_0(fortranout,pos_cur_decl, 
     625                                                    pos_end-pos_cur_decl); 
     626                      } 
     627                      VariableIsParameter =  0 ; 
    628628                   } 
    629629      | common 
    630630      | save 
     631                  { 
     632                     pos_end = setposcur(); 
     633                     RemoveWordSET_0(fortranout,pos_cursave, 
     634                                                pos_end-pos_cursave); 
     635                  } 
    631636      | implicit 
    632637      | dimension 
     
    637642                      if ( couldaddvariable == 1 ) 
    638643                      { 
    639                          ajoutevar_1($1); 
    640                          NonGridDepDeclaration_0($1); 
    641                          /* if variables has been declared in a subroutine    */ 
     644                         Add_Globliste_1($1); 
     645                         /* if variableparamlists has been declared in a      */ 
     646                         /*    subroutine                                     */ 
    642647                         if ( insubroutinedeclare == 1 ) 
    643648                         { 
    644                            ajoutvarofsubroutine_1($1); 
    645                            writesubroutinedeclaration_0($1); 
     649                            Add_Dimension_Var_1($1); 
    646650                         } 
    647                       } 
    648                       /* Case of common block                                 */ 
    649                       indeclarationvar=0; 
    650                       PublicDeclare = 0;   
    651                       PrivateDeclare = 0;  
    652                       ExternalDeclare = 0;  
    653                       strcpy(NamePrecision,"");   
     651                         pos_end = setposcur(); 
     652                         RemoveWordSET_0(fortranout,pos_curdimension, 
     653                                                pos_end-pos_curdimension); 
     654                      } 
     655                      /*                                                      */ 
     656                      PublicDeclare = 0; 
     657                      PrivateDeclare = 0; 
     658                      ExternalDeclare = 0; 
     659                      strcpy(NamePrecision,""); 
    654660                      c_star = 0; 
    655661                      InitialValueGiven = 0 ; 
    656662                      strcpy(IntentSpec,""); 
    657                       VariableIsParameter =  0 ;  
     663                      VariableIsParameter =  0 ; 
    658664                      Allocatabledeclare = 0 ; 
    659665                      SaveDeclare = 0; 
     
    662668                      dimsgiven=0; 
    663669                      c_selectorgiven=0; 
    664                       strcpy(nameinttypename,"");   
     670                      strcpy(nameinttypename,""); 
     671                      strcpy(c_selectorname,""); 
    665672                   } 
    666673      | public 
     
    668675      | use_stat 
    669676      | module_proc_stmt 
    670       | interface  
     677      | interface 
    671678      | namelist 
    672679      | TOK_BACKSPACE '(' expr ')' 
    673680      | TOK_EXTERNAL opt_sep use_name_list 
    674681      | TOK_INTRINSIC opt_sep use_intrinsic_list 
    675       | TOK_EQUIVALENCE '(' list_expr ')' 
     682      | TOK_EQUIVALENCE list_expr_equi 
    676683      | before_data data '\n' 
    677684                   { 
    678685                      /* we should remove the data declaration                */ 
    679                      if ( aftercontainsdeclare == 0 ) 
    680                      { 
     686                      if ( couldaddvariable == 1 && aftercontainsdeclare == 0 ) 
     687                      { 
    681688                        pos_end = setposcur(); 
    682689                        RemoveWordSET_0(fortranout,pos_curdata, 
    683690                                              pos_end-pos_curdata); 
    684                      } 
     691                      } 
    685692                  } 
     693      ; 
     694opt_spec : 
     695      | access_spec 
     696      { 
     697         PublicDeclare = 0 ; 
     698         PrivateDeclare = 0 ; 
     699      } 
    686700      ; 
    687701name_intrinsic : TOK_SUM 
     
    712726use_intrinsic_list : name_intrinsic 
    713727      | use_intrinsic_list ',' name_intrinsic 
    714 list_couple : '(' list_expr ')'  
    715       | list_couple ',' '(' list_expr ')'  
     728      ; 
     729list_couple : '(' list_expr ')' 
     730      | list_couple ',' '(' list_expr ')' 
     731      ; 
     732list_expr_equi : expr_equi 
     733      | list_expr_equi ',' expr_equi 
     734      ; 
     735expr_equi : '(' list_expr_equi1 ')' 
     736      ; 
     737list_expr_equi1 : ident dims 
     738      | list_expr_equi1 ',' ident dims 
     739      ; 
    716740list_expr : expr 
    717741      | list_expr ',' expr 
     742      ; 
    718743opt_sep : 
    719744      | ':' ':' 
    720745      ; 
    721 after_type : dcl nodimsgiven  
    722                    { 
    723                    /* if the variable is a parameter we can suppose that is   */ 
    724                    /*    value is the same on each grid. It is not useless to */ 
    725                    /*    create a copy of it on each grid                     */ 
     746after_type : dcl nodimsgiven 
     747                   { 
     748                      /* if the variable is a parameter we can suppose that is*/ 
     749                      /*    value is the same on each grid. It is not useless */ 
     750                      /*    to create a copy of it on each grid               */ 
    726751                      if ( couldaddvariable == 1 ) 
    727752                      { 
    728                          ajoutevar_1($1); 
    729                          if ( VariableIsParameter == 1 ) globparam = 
    730                                             AddListvarToListvar($1,globparam,1); 
    731                          NonGridDepDeclaration_0($1); 
     753                      pos_end = setposcur(); 
     754                      RemoveWordSET_0(fortranout,pos_cur_decl, 
     755                                                 pos_end-pos_cur_decl); 
     756                      if ( firstpass == 0 && 
     757                           GlobalDeclaration == 0 && 
     758                           insubroutinedeclare == 0 ) 
     759                      { 
     760                         sprintf(ligne,"\n#include \"Module_Declar_%s.h\"\n" 
     761                                                                ,curmodulename); 
     762                         tofich(fortranout,ligne,1); 
     763                         sprintf (ligne, "Module_Declar_%s.h",curmodulename); 
     764                         module_declar = associate(ligne); 
     765                         sprintf (ligne, " "); 
     766                         tofich (module_declar, ligne,1); 
     767                         GlobalDeclaration = 1 ; 
     768                      } 
     769                         $$ = $1; 
     770                         Add_Globliste_1($1); 
     771                         if ( insubroutinedeclare == 0 ) 
     772                                                  Add_GlobalParameter_Var_1($1); 
     773                         else 
     774                         { 
     775                            if ( pointerdeclare == 1 ) 
     776                                                Add_Pointer_Var_From_List_1($1); 
     777                            Add_Parameter_Var_1($1); 
     778                         } 
     779 
    732780                         /* if variables has been declared in a subroutine    */ 
    733781                         if ( insubroutinedeclare == 1 ) 
    734782                         { 
    735                            ajoutvarofsubroutine_1($1); 
    736                            writesubroutinedeclaration_0($1); 
     783                           Add_SubroutineDeclaration_Var_1($1); 
    737784                         } 
    738785                         /* If there are a SAVE declarations in module's      */ 
     
    740787                         /*    subroutines declaration and add it in the      */ 
    741788                         /*    global declarations                            */ 
    742                          if ( aftercontainsdeclare == 1 )  
     789                         if ( aftercontainsdeclare == 1 && 
     790                              SaveDeclare == 1 && firstpass == 1 ) 
    743791                         { 
    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                             } 
     792                              if ( inmodulemeet == 0 ) Add_Save_Var_dcl_1($1); 
     793                              else  Add_SubroutineDeclarationSave_Var_1($1); 
    751794                         } 
    752795                      } 
    753                       /* Case of common block                                 */ 
    754                       indeclarationvar=0; 
    755                       PublicDeclare = 0;   
    756                       PrivateDeclare = 0;  
    757                       ExternalDeclare = 0;  
    758                       strcpy(NamePrecision,"");   
     796                      /*                                                      */ 
     797                      PublicDeclare = 0; 
     798                      PrivateDeclare = 0; 
     799                      ExternalDeclare = 0; 
     800                      strcpy(NamePrecision,""); 
    759801                      c_star = 0; 
    760802                      InitialValueGiven = 0 ; 
    761803                      strcpy(IntentSpec,""); 
    762                       VariableIsParameter =  0 ;  
     804                      VariableIsParameter =  0 ; 
    763805                      Allocatabledeclare = 0 ; 
    764806                      SaveDeclare = 0; 
     
    767809                      dimsgiven=0; 
    768810                      c_selectorgiven=0; 
    769                       strcpy(nameinttypename,"");   
    770                    } 
    771       | TOK_FUNCTION TOK_NAME arglist 
    772                    { 
    773                       infunctiondeclare = 1 ; 
    774                       Listofvariableinagriffunction=(listnom *)NULL; 
     811                      strcpy(nameinttypename,""); 
     812                      strcpy(c_selectorname,""); 
     813                   } 
     814      | before_function name_routine arglist 
     815                   { 
     816                      /* open param file                                      */ 
     817                      if ( firstpass == 0 ) 
     818                      { 
     819                         sprintf(ligne,"%s/ParamFile%s.h",nomdir,$2); 
     820                         paramout=fopen(ligne,"w"); 
     821                         if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     822                         else fprintf(paramout,"C\n"); 
     823                      } 
    775824                      strcpy(subroutinename,$2); 
    776825                      if ( inmodulemeet == 1 ) 
    777826                      { 
    778                          tmpdeclaration_everdone = 0; 
    779                          paramdeclaration_everdone = 0; 
    780827                         insubroutinedeclare = 1; 
    781                          AddUseAgrifUtil_0(); 
    782828                         /* we should to list of the subroutine argument the  */ 
    783829                         /*    name of the function which has to be defined   */ 
    784                          if ( firstpass == 1 )  
    785                          { 
    786                             curvar=createvar($2,NULL); 
    787                             strcpy(curvar->typevar,DeclType); 
    788                             curlistvar=insertvar(NULL,curvar); 
    789                             listargsubroutine = AddListvarToListvar 
    790                                                (curlistvar,listargsubroutine,1); 
    791                             curvar=createvar($2,NULL); 
    792                             strcpy(curvar->typevar,DeclType); 
    793                             strcpy(curvar->modulename,subroutinename); 
    794                             curlistvar=insertvar(NULL,curvar);         
    795                             varofsubroutineliste = AddListvarToListvar 
    796                                             (curlistvar,varofsubroutineliste,1); 
    797                          } 
    798                          if ( firstpass == 0 ) 
    799                          { 
    800                             curvar=createvar($2,NULL); 
    801                             strcpy(curvar->typevar,DeclType); 
    802                             functionlistvar=insertvar(NULL,curvar); 
    803                          } 
     830                         Add_SubroutineArgument_Var_1($3); 
     831                         Add_FunctionType_Var_1($2); 
    804832                         /* in the second step we should write the head of    */ 
    805833                         /*    the subroutine sub_loop_<subroutinename>       */ 
    806834                         writeheadnewsub_0(2); 
    807                          adduseagrifutil = 0 ;  
    808835                      } 
    809836                      else 
    810837                      { 
    811                          tmpdeclaration_everdone = 0; 
    812                          paramdeclaration_everdone = 0; 
    813838                         insubroutinedeclare = 1; 
    814                          AddUseAgrifUtil_0(); 
    815839                         /* we should to list of the subroutine argument the  */ 
    816840                         /*    name of the function which has to be defined   */ 
    817                          if ( firstpass == 1 )  
    818                          { 
    819                             curvar=createvar($2,NULL); 
    820                             strcpy(curvar->typevar,DeclType); 
    821                             curlistvar=insertvar(NULL,curvar); 
    822                             listargsubroutine = AddListvarToListvar 
    823                                                (curlistvar,listargsubroutine,1); 
    824                             curvar=createvar($2,NULL); 
    825                             strcpy(curvar->typevar,DeclType); 
    826                             strcpy(curvar->modulename,subroutinename); 
    827                             curlistvar=insertvar(NULL,curvar);         
    828                             varofsubroutineliste = AddListvarToListvar 
    829                                             (curlistvar,varofsubroutineliste,1); 
    830                          } 
     841                         Add_SubroutineArgument_Var_1($3); 
     842                         Add_FunctionType_Var_1($2); 
    831843                         /* in the second step we should write the head of    */ 
    832844                         /*    the subroutine sub_loop_<subroutinename>       */ 
    833845                         writeheadnewsub_0(2); 
    834                          adduseagrifutil = 0 ;  
    835                       } 
    836                    } 
    837       ; 
     846                      } 
     847                   } 
     848      ; 
     849before_function : TOK_FUNCTION 
     850                   { 
     851                       functiondeclarationisdone = 1; 
     852                   } 
     853                   ; 
     854 
    838855before_parameter : TOK_PARAMETER 
    839856                   { 
     857                      VariableIsParameter = 1; 
    840858                      pos_curparameter = setposcur()-9; 
    841                    }       
     859                   } 
    842860before_data : TOK_DATA 
    843861                   { 
    844                       pos_curdata = setposcur()-4; 
     862                      pos_curdata = setposcur()-strlen($1); 
    845863                   } 
    846864data: TOK_NAME TOK_SLASH datavallist TOK_SLASH 
    847865                   { 
    848                       sprintf(ligne,"(/ %s /)",$3); 
    849                       CompleteDataList($1,ligne); 
     866                      if ( couldaddvariable == 1 ) 
     867                      { 
     868                      if ( aftercontainsdeclare == 1 ) strcpy(ligne,""); 
     869                      else sprintf(ligne,"(/ %s /)",$3); 
     870                      Add_Data_Var_1($1,ligne); 
     871                      } 
    850872                   } 
    851873      | data opt_comma TOK_NAME TOK_SLASH datavallist TOK_SLASH 
    852874                   { 
    853                       sprintf(ligne,"(/ %s /)",$5); 
    854                       CompleteDataList($3,ligne); 
     875                      if ( couldaddvariable == 1 ) 
     876                      { 
     877                      if ( aftercontainsdeclare == 1 ) strcpy(ligne,""); 
     878                      else sprintf(ligne,"(/ %s /)",$5); 
     879                      Add_Data_Var_1($3,ligne); 
     880                      } 
    855881                   } 
    856882      | datanamelist TOK_SLASH datavallist TOK_SLASH 
     
    865891                   } 
    866892      ; 
     893datavallist : expr_data 
     894                   { 
     895                      if ( couldaddvariable == 1 ) 
     896                      { 
     897                         strcpy($$,$1); 
     898                      } 
     899                   } 
     900      | expr_data ',' datavallist 
     901                   { 
     902                      if ( couldaddvariable == 1 ) 
     903                      { 
     904                         sprintf($$,"%s,%s",$1,$3); 
     905                      } 
     906                   } 
     907      ; 
     908 
     909save:  before_save varsave 
     910      | before_save  comblock varsave 
     911      | save opt_comma comblock opt_comma varsave 
     912      | save ',' varsave 
     913      ; 
     914before_save : TOK_SAVE 
     915                  { 
     916                     pos_cursave = setposcur()-4; 
     917                  } 
     918      ; 
     919varsave: 
     920      | TOK_NAME dims 
     921                  { 
     922                     if ( couldaddvariable == 1 ) Add_Save_Var_1($1,$2); 
     923                  } 
     924      ; 
    867925datanamelist : TOK_NAME 
    868       | datanamelist ',' TOK_NAME 
    869       ; 
    870 datavallist : expr_data 
    871                    { 
    872                       strcpy($$,$1); 
    873                    } 
    874       | expr_data ',' datavallist  
    875                    { 
    876                       sprintf($$,"%s,%s",$1,$3); 
    877                    } 
     926      | TOK_NAME '(' expr ')' 
     927      | datanamelist ',' datanamelist 
    878928      ; 
    879929expr_data : opt_signe simple_const 
    880                    {sprintf($$,"%s%s",$1,$2);} 
     930                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
    881931      | expr_data '+' expr_data 
    882                    {sprintf($$,"%s+%s",$1,$3);} 
     932                   {if ( couldaddvariable == 1 ) sprintf($$,"%s+%s",$1,$3);} 
    883933      | expr_data '-' expr_data 
    884                    {sprintf($$,"%s-%s",$1,$3);} 
     934                   {if ( couldaddvariable == 1 ) sprintf($$,"%s-%s",$1,$3);} 
    885935      | expr_data '*' expr_data 
    886                    {sprintf($$,"%s*%s",$1,$3);} 
     936                   {if ( couldaddvariable == 1 ) sprintf($$,"%s*%s",$1,$3);} 
    887937      | expr_data '/' expr_data 
    888                    {sprintf($$,"%s/%s",$1,$3);} 
    889       ; 
    890 opt_signe :  
    891                    {strcpy($$,"");} 
     938                   {if ( couldaddvariable == 1 ) sprintf($$,"%s/%s",$1,$3);} 
     939      ; 
     940opt_signe : 
     941                   {if ( couldaddvariable == 1 ) strcpy($$,"");} 
    892942      | signe 
    893                    {strcpy($$,$1);} 
     943                   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
    894944      ; 
    895945namelist:  namelist_action after_namelist 
    896946      ; 
    897 namelist_action : TOK_NAMELIST  ident  
     947namelist_action : TOK_NAMELIST  ident 
    898948      | TOK_NAMELIST  comblock ident 
    899       { 
    900          AddNameToListNamelist_1($2); 
    901       } 
    902949      | namelist_action opt_comma comblock opt_comma ident 
    903       { 
    904          AddNameToListNamelist_1($3); 
    905       } 
    906950      | namelist_action ',' ident 
    907951      ; 
     
    911955      | TOK_ENDINTERFACE opt_name 
    912956      ; 
    913 dimension: TOK_DIMENSION  opt_comma TOK_NAME dims lengspec 
     957before_dimension : TOK_DIMENSION 
     958                   { 
     959                      positioninblock=0; 
     960                      pos_curdimension = setposcur()-9; 
     961                   } 
     962 
     963dimension:  before_dimension opt_comma TOK_NAME dims lengspec 
    914964      { 
    915965         if ( couldaddvariable == 1 ) 
    916966         { 
    917             if ( inmoduledeclare == 1 || SaveDeclare == 1 ) 
    918             { 
    919                if ( AllocShouldMadeInModule() == 1 )  
    920                { 
    921                  AllocTo1InModule_1(); 
    922                } 
    923             }       
    924967            /*                                                                */ 
    925968            curvar=createvar($3,$4); 
    926969            /*                                                                */ 
    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             } 
     970            CreateAndFillin_Curvar("",curvar); 
     971            /*                                                                */ 
     972            curlistvar=insertvar(NULL,curvar); 
     973            /*                                                                */ 
     974            $$=settype("",curlistvar); 
     975            /*                                                                */ 
    945976            strcpy(vallengspec,""); 
    946          } 
    947          else 
    948          { 
    949             /* mazauric*/ 
    950977         } 
    951978      } 
     
    957984            curvar=createvar($3,$4); 
    958985            /*                                                                */ 
    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             } 
     986            CreateAndFillin_Curvar("",curvar); 
     987            /*                                                                */ 
     988            curlistvar=insertvar($1,curvar); 
     989            /*                                                                */ 
     990            $$=curlistvar; 
     991            /*                                                                */ 
    977992            strcpy(vallengspec,""); 
    978          }          
    979          else 
    980          { 
    981             /* mazauric*/ 
    982993         } 
    983994      } 
     
    987998      ; 
    988999public: TOK_PUBLIC '\n' 
    989       | TOK_PUBLIC opt_sep use_name_list  
    990       ; 
    991 use_name_list: TOK_NAME  
     1000      | TOK_PUBLIC opt_sep use_name_list 
     1001      ; 
     1002use_name_list: TOK_NAME 
    9921003      | use_name_list ',' TOK_NAME 
    9931004      ; 
    9941005common: before_common var_common_list 
    9951006                   { 
    996                          if (fortran77 == 1 && 
    997                              couldaddvariable == 1 ) 
    998                          { 
    999                             pos_end = setposcur(); 
    1000                             RemoveWordSET_0(fortranout,pos_curcommon, 
     1007                         pos_end = setposcur(); 
     1008                         RemoveWordSET_0(fortranout,pos_curcommon, 
    10011009                                                  pos_end-pos_curcommon); 
    1002                          } 
    10031010                   } 
    10041011      | before_common comblock var_common_list 
     
    10071014                         { 
    10081015                            sprintf(charusemodule,"%s",$2); 
    1009                             Add_ModuleTo_Modulelist_1($2); 
    1010                             if ( fortran77 == 1 ) 
    1011                             { 
    1012                                pos_end = setposcur(); 
    1013                                RemoveWordSET_0(fortranout,pos_curcommon, 
    1014                                                      pos_end-pos_curcommon); 
    1015                             } 
     1016                            Add_NameOfCommon_1($2); 
     1017                            pos_end = setposcur(); 
     1018                            RemoveWordSET_0(fortranout,pos_curcommon, 
     1019                                                       pos_end-pos_curcommon); 
    10161020                         } 
    10171021                   } 
     
    10211025                         { 
    10221026                            sprintf(charusemodule,"%s",$3); 
    1023                             Add_ModuleTo_Modulelist_1($3); 
    1024                             if ( fortran77 == 1 ) 
    1025                             { 
    1026                                pos_end = setposcur(); 
    1027                                RemoveWordSET_0(fortranout,pos_curcommon, 
    1028                                                      pos_end-pos_curcommon); 
    1029                             } 
     1027                            Add_NameOfCommon_1($3); 
     1028                            pos_end = setposcur(); 
     1029                            RemoveWordSET_0(fortranout,pos_curcommon, 
     1030                                                       pos_end-pos_curcommon); 
    10301031                         } 
    10311032                   } 
     
    10441045var_common_list : var_common 
    10451046                   { 
    1046                       if ( couldaddvariable == 1 ) Addtolistvarcommon(); 
     1047                      if ( couldaddvariable == 1 ) Add_Common_var_1(); 
    10471048                   } 
    10481049 
    10491050     | var_common_list ',' var_common 
    10501051                   { 
    1051                       if ( couldaddvariable == 1 ) Addtolistvarcommon(); 
    1052                    } 
    1053 var_common: TOK_NAME dims   
    1054                    { 
    1055                       if ( couldaddvariable == 1 )  
     1052                      if ( couldaddvariable == 1 ) Add_Common_var_1(); 
     1053                   } 
     1054var_common: TOK_NAME dims 
     1055                   { 
     1056                      if ( couldaddvariable == 1 ) 
    10561057                      { 
    10571058                         positioninblock = positioninblock + 1 ; 
     
    10611062                   } 
    10621063      ; 
    1063 comblock: TOK_DSLASH  
    1064                    { 
    1065                       if ( couldaddvariable == 1 )  
     1064comblock: TOK_DSLASH 
     1065                   { 
     1066                      if ( couldaddvariable == 1 ) 
    10661067                      { 
    10671068                         strcpy($$,""); 
     
    10701071                      } 
    10711072                   } 
    1072       | TOK_SLASH TOK_NAME TOK_SLASH  
    1073                    { 
    1074                       if ( couldaddvariable == 1 )  
     1073      | TOK_SLASH TOK_NAME TOK_SLASH 
     1074                   { 
     1075                      if ( couldaddvariable == 1 ) 
    10751076                      { 
    10761077                         strcpy($$,$2); 
     
    10801081                   } 
    10811082      ; 
    1082 save: TOK_SAVE varsave 
    1083       | TOK_SAVE  comblock varsave 
    1084       | save opt_comma comblock opt_comma varsave 
    1085       | save ',' varsave 
    1086       ; 
    1087 varsave:  
    1088       | TOK_NAME before_dims dims  
    1089       {created_dimensionlist = 1;} 
    1090       ; 
    1091        
    10921083opt_comma: 
    10931084      | ',' 
     
    10951086paramlist: paramitem 
    10961087                   { 
    1097                       if ( firstpass == 1 ) $$=insertvar(NULL,$1); 
     1088                      if ( couldaddvariable == 1 ) $$=insertvar(NULL,$1); 
    10981089                   } 
    10991090      | paramlist ',' paramitem 
    11001091                   { 
    1101                       if ( firstpass == 1 ) $$=insertvar($1,$3); 
     1092                      if ( couldaddvariable == 1 ) $$=insertvar($1,$3); 
    11021093                   } 
    11031094      ; 
    11041095paramitem : TOK_NAME '=' expr 
    11051096                   { 
    1106                       if ( firstpass == 1 ) 
    1107                       { 
     1097                     if ( couldaddvariable == 1 ) 
     1098                     { 
    11081099                         curvar=(variable *) malloc(sizeof(variable)); 
    1109                          strcpy(curvar->nomvar,$1); 
    1110                          strcpy(curvar->subroutinename,subroutinename); 
    1111                          strcpy(curvar->modulename,subroutinename); 
    1112                          strcpy(curvar->initialvalue,$3); 
     1100                         /*                                                   */ 
     1101                         Init_Variable(curvar); 
     1102                         /*                                                   */ 
     1103                         curvar->v_VariableIsParameter=1; 
     1104                         strcpy(curvar->v_nomvar,$1); 
     1105                         strcpy(curvar->v_subroutinename,subroutinename); 
     1106                         strcpy(curvar->v_modulename,curmodulename); 
     1107                         strcpy(curvar->v_initialvalue,$3); 
     1108                         strcpy(curvar->v_commoninfile,mainfile); 
    11131109                         $$=curvar; 
    11141110                      } 
     
    11221118implicit: TOK_IMPLICIT TOK_NONE 
    11231119                    { 
    1124                        if ( firstpass == 1 && insubroutinedeclare == 1 ) 
    1125                        { 
    1126                            listimplicitnone = Addtolistname 
    1127                                               (subroutinename,listimplicitnone); 
    1128                        } 
    1129                        if ( tmpdeclaration_everdone == 1 &&  
    1130                             inmoduledeclare == 0 ) 
    1131                        { 
    1132                          pos_end = setposcur(); 
    1133                          RemoveWordSET_0(fortranout,pos_end-13, 
    1134                                                13); 
     1120                       if ( insubroutinedeclare == 1 ) 
     1121                       { 
     1122                          Add_ImplicitNoneSubroutine_1(); 
     1123                          pos_end = setposcur(); 
     1124                          RemoveWordSET_0(fortranout,pos_end-13, 
     1125                                                             13); 
    11351126                       } 
    11361127                    } 
     
    11431134                      if ( couldaddvariable == 1 ) 
    11441135                      { 
    1145                          if ( inmoduledeclare == 1 || SaveDeclare == 1 ) 
    1146                          { 
    1147                             if ( AllocShouldMadeInModule() == 1 )  
    1148                             { 
    1149                                AllocTo1InModule_1(); 
    1150                             } 
    1151                          }       
    11521136                         /*                                                   */ 
    1153                          if (dimsgiven == 1)  
     1137                         if (dimsgiven == 1) 
    11541138                         { 
    11551139                            curvar=createvar($3,curdim); 
     
    11601144                         } 
    11611145                         /*                                                   */ 
    1162                          CreateAndFillin_Curvar(DeclType,$3,$4,curvar); 
     1146                         CreateAndFillin_Curvar(DeclType,curvar); 
    11631147                         /*                                                   */ 
    11641148                         curlistvar=insertvar(NULL,curvar); 
    1165                          if (!strcasecmp(DeclType,"character"))  
     1149                         if (!strcasecmp(DeclType,"character")) 
    11661150                         { 
    1167                             if (c_selectorgiven == 1)  
     1151                            if (c_selectorgiven == 1) 
    11681152                            { 
    11691153                               strcpy(c_selectordim.first,"1"); 
     
    11751159                         $$=settype(DeclType,curlistvar); 
    11761160                      } 
    1177                       else 
    1178                       { 
    1179                          /* mazauric*/ 
    1180                       } 
    11811161                      strcpy(vallengspec,""); 
    11821162                   } 
     
    11851165                      if ( couldaddvariable == 1 ) 
    11861166                      { 
    1187                          if (dimsgiven == 1)  
     1167                         if (dimsgiven == 1) 
    11881168                         { 
    11891169                            curvar=createvar($4,curdim); 
     
    11931173                            curvar=createvar($4,$5); 
    11941174                         } 
    1195                          /*                                                   */  
    1196                          CreateAndFillin_Curvar($1->var->typevar,$4,$5,curvar); 
    11971175                         /*                                                   */ 
    1198                          strcpy(curvar->typevar,($1->var->typevar)); 
     1176                         CreateAndFillin_Curvar($1->var->v_typevar,curvar); 
     1177                         /*                                                   */ 
     1178                         strcpy(curvar->v_typevar,($1->var->v_typevar)); 
    11991179                         /*                                                   */ 
    12001180                         curlistvar=insertvar($1,curvar); 
    1201                          if (!strcasecmp(DeclType,"character"))  
     1181                         if (!strcasecmp(DeclType,"character")) 
    12021182                         { 
    1203                             if (c_selectorgiven == 1)  
     1183                            if (c_selectorgiven == 1) 
    12041184                            { 
    12051185                               strcpy(c_selectordim.first,"1"); 
     
    12111191                         $$=curlistvar; 
    12121192                      } 
    1213                       else 
    1214                       { 
    1215                          /* mazauric*/ 
    1216                       } 
    12171193                      strcpy(vallengspec,""); 
    12181194                   } 
    1219       ;       
     1195      ; 
    12201196nodimsgiven:       {dimsgiven=0;} 
    12211197      ; 
    1222 type:typespec selector  
    1223                    {strcpy(DeclType,$1);indeclarationvar=1;} 
    1224       | before_character c_selector  
    1225                    { 
    1226                       indeclarationvar=1; 
     1198type:typespec selector 
     1199                   {strcpy(DeclType,$1);} 
     1200      | before_character c_selector 
     1201                   { 
    12271202                      strcpy(DeclType,"CHARACTER"); 
    1228                       if (inmoduledeclare == 1 )  
    1229                       { 
    1230                          AllocShouldMadeTo1InModule_1(); 
    1231                       } 
    12321203                   } 
    12331204      | typename '*' TOK_CSTINT 
    12341205                   { 
    1235                       indeclarationvar=1; 
    12361206                      strcpy(DeclType,$1); 
    12371207                      strcpy(nameinttypename,$3); 
    12381208                   } 
     1209      | before_typepar attribute ')' 
     1210                   { 
     1211                      strcpy(DeclType,"TYPE"); 
     1212                   } 
     1213      ; 
     1214before_typepar : TOK_TYPEPAR 
     1215                   { 
     1216                      if ( couldaddvariable == 1 ) VarTypepar = 1 ; 
     1217                      couldaddvariable = 0 ; 
     1218                      pos_cur_decl = setposcur()-5; 
     1219                   } 
    12391220      ; 
    12401221c_selector: 
    1241       | '*' TOK_CSTINT  
     1222      | '*' TOK_CSTINT 
    12421223                   {c_selectorgiven=1;strcpy(c_selectorname,$2);} 
    12431224      | '*' '(' c_attribute ')' {c_star = 1;} 
    1244       | '(' c_attribute ')'  
    1245       ; 
    1246 c_attribute: TOK_NAME clause opt_clause  
    1247       | TOK_NAME '=' clause opt_clause  
    1248       | clause opt_clause  
     1225      | '(' c_attribute ')' 
     1226      ; 
     1227c_attribute: TOK_NAME clause opt_clause 
     1228      | TOK_NAME '=' clause opt_clause 
     1229      | clause opt_clause 
    12491230      ; 
    12501231before_character : TOK_CHARACTER 
     
    12551236typespec: typename {strcpy($$,$1);} 
    12561237      ; 
    1257 typename: TOK_INTEGER  
     1238typename: TOK_INTEGER 
    12581239                   { 
    12591240                      strcpy($$,"INTEGER"); 
    12601241                      pos_cur_decl = setposcur()-7; 
    1261                       if (inmoduledeclare == 1 )  
    1262                       { 
    1263                          AllocShouldMadeTo1InModule_1(); 
    1264                        } 
    12651242                   } 
    12661243      | TOK_REAL   { 
    1267                       strcpy($$,"REAL");  
     1244                      strcpy($$,"REAL"); 
    12681245                      pos_cur_decl = setposcur()-4; 
    1269                       if (inmoduledeclare == 1 )  
    1270                       { 
    1271                          AllocShouldMadeTo1InModule_1(); 
    1272                       } 
    1273                    } 
    1274       | TOK_COMPLEX       
     1246                   } 
     1247      | TOK_COMPLEX 
    12751248                   {strcpy($$,"COMPLEX");} 
    1276       | TOK_DOUBLEPRECISION  
    1277                    {strcpy($$,"DOUBLE PRECISION");} 
    1278       | TOK_DOUBLECOMPLEX  
     1249      | TOK_DOUBLEPRECISION 
     1250                   { 
     1251                      pos_cur_decl = setposcur()-16; 
     1252                      strcpy($$,"REAL"); 
     1253                      strcpy(nameinttypename,"8"); 
     1254                   } 
     1255      | TOK_DOUBLECOMPLEX 
    12791256                   {strcpy($$,"DOUBLE COMPLEX");} 
    1280       | TOK_LOGICAL       
     1257      | TOK_LOGICAL 
    12811258                   { 
    12821259                      strcpy($$,"LOGICAL"); 
    12831260                      pos_cur_decl = setposcur()-7; 
    1284                       if (inmoduledeclare == 1 )  
    1285                       { 
    1286                          AllocShouldMadeTo1InModule_1(); 
    1287                       } 
    1288                    } 
    1289       | TOK_TYPE       
    1290                    { 
    1291                       pos_cur_decl = setposcur()-5; 
    1292                       strcpy($$,"TYPE"); 
    12931261                   } 
    12941262      ; 
     
    13011269selector: 
    13021270      | '*' proper_selector 
    1303       | '(' attribute ')'  
     1271      | '(' attribute ')' 
    13041272      ; 
    13051273proper_selector: expr 
    13061274      | '(' '*' ')' 
    13071275      ; 
    1308 attribute: TOK_NAME clause  
    1309       | TOK_NAME '=' clause   
    1310                    { 
    1311                       sprintf(NamePrecision,"%s = %s",$1,$3);   
     1276attribute: TOK_NAME clause 
     1277      | TOK_NAME '=' clause 
     1278                   { 
     1279                      if ( strstr($3,"0.d0") ) 
     1280                      { 
     1281                         strcpy(nameinttypename,"8"); 
     1282                         sprintf(NamePrecision,""); 
     1283                      } 
     1284                      else sprintf(NamePrecision,"%s = %s",$1,$3); 
    13121285                   } 
    13131286      | TOK_NAME 
    13141287                   { 
    1315                       strcpy(NamePrecision,$1);   
     1288                      strcpy(NamePrecision,$1); 
    13161289                   } 
    13171290      | TOK_CSTINT 
    13181291                   { 
    1319                       strcpy(NamePrecision,$1);   
     1292                      strcpy(NamePrecision,$1); 
    13201293                   } 
    13211294      ; 
     
    13231296                    strcpy($$,$1);} 
    13241297      | '*'        {strcpy(CharacterSize,"*"); 
    1325                     strcpy($$,"*");}  
    1326       ; 
    1327 opt_clause:  
     1298                    strcpy($$,"*");} 
     1299      ; 
     1300opt_clause: 
    13281301      | ',' TOK_NAME clause 
    13291302      ; 
     
    13351308      | attr_spec_list ',' attr_spec 
    13361309      ; 
    1337 attr_spec: TOK_PARAMETER  
     1310attr_spec: TOK_PARAMETER 
    13381311                   { 
    13391312                      VariableIsParameter = 1; 
    1340                       if (inmoduledeclare == 1 )  
    1341                       { 
    1342                          AllocShouldMadeTo0InModule_1(); 
    1343                       } 
    13441313                   } 
    13451314      | access_spec 
    1346       | TOK_ALLOCATABLE  
     1315      | TOK_ALLOCATABLE 
    13471316                   {Allocatabledeclare = 1;} 
    1348       | TOK_DIMENSION dims  
    1349                    { 
    1350                       dimsgiven=1;  
     1317      | TOK_DIMENSION dims 
     1318                   { 
     1319                      dimsgiven=1; 
    13511320                      curdim=$2; 
    13521321                   } 
    1353       | TOK_EXTERNAL   
    1354                    {ExternalDeclare = 1;}  
     1322      | TOK_EXTERNAL 
     1323                   {ExternalDeclare = 1;} 
    13551324      | TOK_INTENT intent_spec 
    13561325                   {strcpy(IntentSpec,$2);} 
     
    13591328      | TOK_POINTER {pointerdeclare = 1 ;} 
    13601329      | TOK_SAVE    { 
    1361                        if ( inmodulemeet == 1 ) 
    1362                        { 
     1330/*                       if ( inmodulemeet == 1 ) 
     1331                       {*/ 
    13631332                          SaveDeclare = 1 ; 
    1364                           Savemeet = 1; 
    1365                           AllocShouldMadeTo1InModule_1(); 
    1366                        } 
     1333                     /*  }*/ 
    13671334                    } 
    13681335      | TOK_TARGET 
     
    13711338      | TOK_OUT     {sprintf($$,"out");} 
    13721339      | TOK_INOUT   {sprintf($$,"inout");} 
    1373       ;  
    1374 access_spec: TOK_PUBLIC  
    1375                    {PublicDeclare = 1;}  
    1376       | TOK_PRIVATE  
    1377                    {PrivateDeclare = 1;}  
    1378       ; 
    1379 dims:              {if ( created_dimensionlist == 1 ) $$=(listdim *)NULL;} 
    1380       | '(' dimlist ')'   
    1381                    {if ( created_dimensionlist == 1 ) $$=$2;} 
    1382       ; 
    1383 dimlist:   dim     {if ( created_dimensionlist == 1 ) $$=insertdim(NULL,$1);} 
    1384       | dimlist ',' dim  
    1385                    {if ( created_dimensionlist == 1 ) $$=insertdim($1,$3);} 
     1340      ; 
     1341access_spec: TOK_PUBLIC 
     1342                   {PublicDeclare = 1;} 
     1343      | TOK_PRIVATE 
     1344                   {PrivateDeclare = 1;} 
     1345      ; 
     1346dims:              {if ( created_dimensionlist == 1 ) 
     1347                       { 
     1348                           $$=(listdim *)NULL; 
     1349                       } 
     1350                   } 
     1351      | '(' dimlist ')' 
     1352                   {if ( created_dimensionlist == 1 || 
     1353                         agrif_parentcall      == 1 ) $$=$2;} 
     1354      ; 
     1355dimlist:   dim     {if ( created_dimensionlist == 1 || 
     1356                         agrif_parentcall      == 1 ) $$=insertdim(NULL,$1);} 
     1357      | dimlist ',' dim 
     1358                   {if ( couldaddvariable == 1 ) 
     1359                         if ( created_dimensionlist == 1 ) $$=insertdim($1,$3);} 
    13861360      ; 
    13871361dim:ubound         {strcpy($$.first,"1");strcpy($$.last,$1);} 
     
    13951369      | expr       {strcpy($$,$1);} 
    13961370      ; 
    1397 expr:  uexpr       {strcpy($$,$1);} 
    1398       | '(' expr ')'  
    1399                    {sprintf($$,"(%s)",$2);} 
    1400       | complex_const  
    1401                    {strcpy($$,$1);} 
     1371expr:  uexpr       {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1372      | '(' expr ')' 
     1373                   {if ( couldaddvariable == 1 ) sprintf($$,"(%s)",$2);} 
     1374      | complex_const 
     1375                   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
    14021376      | predefinedfunction 
    1403       ; 
    1404        
    1405 predefinedfunction : TOK_SUM minmaxlist ')'  
     1377                   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1378      ; 
     1379 
     1380predefinedfunction : TOK_SUM minmaxlist ')' 
    14061381                   {sprintf($$,"SUM(%s)",$2);} 
    14071382      | TOK_MAX minmaxlist ')' 
     
    14221397                   {sprintf($$,"REAL(%s)",$3);} 
    14231398      | TOK_INT '(' expr ')' 
    1424                    {sprintf($$,"INT(%s)",$3);}                    
     1399                   {sprintf($$,"INT(%s)",$3);} 
    14251400      | TOK_NINT '(' expr ')' 
    1426                    {sprintf($$,"NINT(%s)",$3);}                    
     1401                   {sprintf($$,"NINT(%s)",$3);} 
    14271402      | TOK_FLOAT '(' expr ')' 
    14281403                   {sprintf($$,"FLOAT(%s)",$3);} 
     
    14591434      ; 
    14601435minmaxlist : expr {strcpy($$,$1);} 
    1461       | minmaxlist ',' expr  
    1462                    {strcpy($$,$1);strcat($$,",");strcat($$,$3);} 
    1463       ; 
    1464 uexpr:  lhs        {strcpy($$,$1);}  
    1465       | simple_const  
    1466                    {strcpy($$,$1);}  
    1467       | vec  
    1468                    {strcpy($$,$1);}  
     1436      | minmaxlist ',' expr 
     1437                   {if ( couldaddvariable == 1 ) 
     1438                   { strcpy($$,$1);strcat($$,",");strcat($$,$3);}} 
     1439      ; 
     1440uexpr:  lhs        {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1441      | simple_const 
     1442                   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1443      | vec 
     1444                   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
    14691445      | expr operation 
    1470                    {sprintf($$,"%s%s",$1,$2);} 
     1446                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
    14711447      | signe expr %prec '* '  
    1472                    {sprintf($$,"%s%s",$1,$2);} 
    1473       | TOK_NOT expr  
    1474                    {sprintf($$,"%s%s",$1,$2);} 
    1475       ; 
    1476 signe : '+'        {strcpy($$,"+");} 
    1477       | '-'        {strcpy($$,"-");} 
    1478       ; 
    1479 operation : '+' expr %prec '+'  
    1480                    {sprintf($$,"+%s",$2);} 
    1481       |  '-' expr %prec '+'  
    1482                    {sprintf($$,"-%s",$2);} 
    1483       |  '*' expr  
    1484                    {sprintf($$,"*%s",$2);} 
    1485       |  TOK_DASTER expr  
    1486                    {sprintf($$,"%s%s",$1,$2);} 
    1487       |  TOK_EQ expr %prec TOK_EQ  
    1488                    {sprintf($$,"%s%s",$1,$2);} 
    1489       |  TOK_GT expr %prec TOK_EQ  
    1490                    {sprintf($$,"%s%s",$1,$2);} 
    1491       |  '>' expr %prec TOK_EQ  
    1492                    {sprintf($$," > %s",$2);} 
    1493       |  TOK_LT expr %prec TOK_EQ  
    1494                    {sprintf($$,"%s%s",$1,$2);} 
    1495       |  '<' expr %prec TOK_EQ  
    1496                    {sprintf($$," < %s",$2);} 
    1497       |  TOK_GE expr %prec TOK_EQ  
    1498                    {sprintf($$,"%s%s",$1,$2);} 
    1499       |  '>''=' expr %prec TOK_EQ  
    1500                    {sprintf($$," >= %s",$3);} 
     1448                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1449      | TOK_NOT expr 
     1450                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1451      ; 
     1452signe : '+'        {if ( couldaddvariable == 1 ) strcpy($$,"+");} 
     1453      | '-'        {if ( couldaddvariable == 1 ) strcpy($$,"-");} 
     1454      ; 
     1455operation : '+' expr %prec '+' 
     1456                   {if ( couldaddvariable == 1 ) sprintf($$,"+%s",$2);} 
     1457      |  '-' expr %prec '+' 
     1458                   {if ( couldaddvariable == 1 ) sprintf($$,"-%s",$2);} 
     1459      |  '*' expr 
     1460                   {if ( couldaddvariable == 1 ) sprintf($$,"*%s",$2);} 
     1461      |  TOK_DASTER expr 
     1462                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1463      |  TOK_EQ expr %prec TOK_EQ 
     1464                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1465      |  TOK_GT expr %prec TOK_EQ 
     1466                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1467      |  '>' expr %prec TOK_EQ 
     1468                   {if ( couldaddvariable == 1 ) sprintf($$," > %s",$2);} 
     1469      |  TOK_LT expr %prec TOK_EQ 
     1470                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1471      |  '<' expr %prec TOK_EQ 
     1472                   {if ( couldaddvariable == 1 ) sprintf($$," < %s",$2);} 
     1473      |  TOK_GE expr %prec TOK_EQ 
     1474                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1475      |  '>''=' expr %prec TOK_EQ 
     1476                   {if ( couldaddvariable == 1 ) sprintf($$," >= %s",$3);} 
    15011477      |  TOK_LE expr %prec TOK_EQ 
    1502                    {sprintf($$,"%s%s",$1,$2);} 
    1503       |  '<''=' expr %prec TOK_EQ  
    1504                    {sprintf($$," <= %s",$3);} 
    1505       |  TOK_NE expr %prec TOK_EQ  
    1506                    {sprintf($$,"%s%s",$1,$2);} 
    1507       |  TOK_XOR expr  
    1508                    {sprintf($$,"%s%s",$1,$2);} 
    1509       |  TOK_OR expr  
    1510                    {sprintf($$,"%s%s",$1,$2);} 
    1511       |  TOK_AND expr  
    1512                    {sprintf($$,"%s%s",$1,$2);} 
     1478                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1479      |  '<''=' expr %prec TOK_EQ 
     1480                   {if ( couldaddvariable == 1 ) sprintf($$," <= %s",$3);} 
     1481      |  TOK_NE expr %prec TOK_EQ 
     1482                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1483      |  TOK_XOR expr 
     1484                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1485      |  TOK_OR expr 
     1486                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
     1487      |  TOK_AND expr 
     1488                   {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
    15131489      |  TOK_SLASH after_slash 
    1514                    {sprintf($$,"%s",$2);} 
     1490                   {if ( couldaddvariable == 1 ) sprintf($$,"%s",$2);} 
    15151491      |  '=' after_equal 
    1516                    {sprintf($$,"%s",$2);} 
     1492                   {if ( couldaddvariable == 1 ) sprintf($$,"%s",$2);} 
    15171493 
    15181494after_slash : {strcpy($$,"");} 
    1519       | expr  
     1495      | expr 
    15201496                   {sprintf($$,"/%s",$1);} 
    1521       | '=' expr %prec TOK_EQ  
     1497      | '=' expr %prec TOK_EQ 
    15221498                   {sprintf($$,"/= %s",$2);} 
    15231499      | TOK_SLASH expr 
    15241500                   {sprintf($$,"//%s",$2);} 
    15251501      ; 
    1526 after_equal : '=' expr %prec TOK_EQ  
    1527                    {sprintf($$,"==%s",$2);} 
     1502after_equal : '=' expr %prec TOK_EQ 
     1503                   {if ( couldaddvariable == 1 ) sprintf($$,"==%s",$2);} 
    15281504      | expr 
    1529                    {sprintf($$,"= %s",$1);} 
    1530       ; 
    1531        
    1532 lhs: ident         {strcpy($$,$1);}  
    1533       | structure_component  
    1534                    {strcpy($$,$1);}  
    1535       | array_ele_substring_func_ref  
    1536                    {strcpy($$,$1);}  
     1505                   {if ( couldaddvariable == 1 ) sprintf($$,"= %s",$1);} 
     1506      ; 
     1507 
     1508lhs: ident         {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1509      | structure_component 
     1510                   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1511      | array_ele_substring_func_ref 
     1512                   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
    15371513      ; 
    15381514beforefunctionuse : { 
     
    15411517                                                            agrif_parentcall =1; 
    15421518                      if ( Agrif_in_Tok_NAME(identcopy) == 1 ) 
    1543                       {  
     1519                      { 
    15441520                         inagrifcallargument = 1; 
    1545                          AddsubroutineTolistsubwhereagrifused(); 
     1521                         Add_SubroutineWhereAgrifUsed_1(subroutinename, 
     1522                                                        curmodulename); 
    15461523                      } 
    15471524                   } 
     
    15521529                     if ( incalldeclare == 0 ) inagrifcallargument = 0; 
    15531530                   } 
    1554       | begin_array substring  
    1555                    {sprintf($$," %s %s ",$1,$2);} 
    1556       | structure_component '(' funarglist ')'  
    1557                    {sprintf($$," %s ( %s )",$1,$3);} 
    1558       | structure_component '(' funarglist ')' substring  
    1559                    {sprintf($$," %s ( %s ) %s ",$1,$3,$5);} 
     1531      | begin_array substring 
     1532                   {if ( couldaddvariable == 1 ) sprintf($$," %s %s ",$1,$2);} 
     1533      | structure_component '(' funarglist ')' 
     1534                   {if ( couldaddvariable == 1 ) 
     1535                                                sprintf($$," %s ( %s )",$1,$3);} 
     1536      | structure_component '(' funarglist ')' substring 
     1537                   {if ( couldaddvariable == 1 ) 
     1538                                         sprintf($$," %s ( %s ) %s ",$1,$3,$5);} 
    15601539      ; 
    15611540begin_array : ident '(' funarglist ')' 
    15621541                   { 
    1563                       sprintf($$," %s ( %s )",$1,$3); 
    1564                       ModifyTheAgrifFunction_0($3); 
    1565                      agrif_parentcall =0;  
    1566                    } 
    1567       ; 
    1568 structure_component: lhs '%' lhs  
     1542                      if ( couldaddvariable == 1 ) 
     1543                      { 
     1544                         sprintf($$," %s ( %s )",$1,$3); 
     1545                         ModifyTheAgrifFunction_0($3); 
     1546                         agrif_parentcall =0; 
     1547                      } 
     1548                   } 
     1549      ; 
     1550structure_component: lhs '%' lhs 
    15691551                   { 
    15701552                      sprintf($$," %s %% %s ",$1,$3); 
    1571                      if ( incalldeclare == 0 ) inagrifcallargument = 0; 
    1572                    } 
    1573       ; 
    1574 vec:  TOK_LEFTAB outlist TOK_RIGHTAB  
    1575                    {sprintf($$,"(/%s/)",$2);}  
     1553                      if ( incalldeclare == 0 ) inagrifcallargument = 0; 
     1554                   } 
     1555      ; 
     1556vec:  TOK_LEFTAB outlist TOK_RIGHTAB 
     1557                   {sprintf($$,"(/%s/)",$2);} 
    15761558      ; 
    15771559funarglist: beforefunctionuse    {strcpy($$," ");} 
    1578       | beforefunctionuse funargs   
     1560      | beforefunctionuse funargs 
    15791561                   {strcpy($$,$2);} 
    15801562      ; 
    1581 funargs: funarg     {strcpy($$,$1);} 
    1582       | funargs ',' funarg  
    1583                     {sprintf($$,"%s,%s",$1,$3);}  
     1563funargs: funarg     {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1564      | funargs ',' funarg 
     1565                    {if ( couldaddvariable == 1 ) sprintf($$,"%s,%s",$1,$3);} 
    15841566      ; 
    15851567funarg: expr       {strcpy($$,$1);} 
    15861568      | triplet    {strcpy($$,$1);} 
    15871569      ; 
    1588 triplet: expr ':' expr  
    1589                     {sprintf($$,"%s:%s",$1,$3);}  
    1590       | expr ':' expr ':' expr  
    1591                     {sprintf($$,"%s:%s:%s",$1,$3,$5);}  
    1592       | ':' expr ':' expr  
    1593                     {sprintf($$,":%s:%s",$2,$4);}  
    1594       | ':' ':' expr{sprintf($$,": : %s",$3);}  
    1595       | ':' expr    {sprintf($$,":%s",$2);}  
    1596       | expr ':'     {sprintf($$,"%s:",$1);}  
    1597       | ':'         {sprintf($$,":");}  
    1598       ; 
    1599 ident : TOK_NAME    {   
     1570triplet: expr ':' expr 
     1571                    {if ( couldaddvariable == 1 ) sprintf($$,"%s:%s",$1,$3);} 
     1572      | expr ':' expr ':' expr 
     1573                    {if ( couldaddvariable == 1 ) 
     1574                                               sprintf($$,"%s:%s:%s",$1,$3,$5);} 
     1575      | ':' expr ':' expr 
     1576                    {if ( couldaddvariable == 1 ) sprintf($$,":%s:%s",$2,$4);} 
     1577      | ':' ':' expr{if ( couldaddvariable == 1 ) sprintf($$,": : %s",$3);} 
     1578      | ':' expr    {if ( couldaddvariable == 1 ) sprintf($$,":%s",$2);} 
     1579      | expr ':'    {if ( couldaddvariable == 1 ) sprintf($$,"%s:",$1);} 
     1580      | ':'         {if ( couldaddvariable == 1 ) sprintf($$,":");} 
     1581      ; 
     1582ident : TOK_NAME    { 
     1583                       if ( couldaddvariable == 1 ) 
     1584                       { 
     1585                       if ( Vartonumber($1) == 1 ) 
     1586                       { 
     1587                          Add_SubroutineWhereAgrifUsed_1(subroutinename, 
     1588                                                        curmodulename); 
     1589                       } 
     1590                       if (!strcasecmp($1,"Agrif_Parent") ) 
     1591                                                            agrif_parentcall =1; 
    16001592                       if ( VariableIsNotFunction($1) == 0 ) 
    16011593                       { 
     
    16111603                          pointedvar=0; 
    16121604                          if ( VarIsNonGridDepend($1) == 0 && 
    1613                                formatdeclare == 0  
    1614                              ) 
     1605                               Variableshouldberemove($1) == 0 ) 
    16151606                          { 
    16161607                             if ( inagrifcallargument == 1 || 
     
    16201611                                ModifyTheVariableName_0($1); 
    16211612                             } 
    1622                              if ( inagrifcallargument != 1 || sameagrifargument ==1 ) 
    1623                                   ajoutevarindoloop_1($1); 
     1613                             if ( inagrifcallargument != 1 || 
     1614                                  sameagrifargument ==1 ) 
     1615                                  Add_UsedInSubroutine_Var_1($1); 
    16241616                          } 
    16251617                          NotifyAgrifFunction_0($1); 
    16261618                       } 
    1627           } 
    1628       ; 
    1629 simple_const: TOK_TRUE  
    1630                      {strcpy($$,".TRUE.");} 
    1631       | TOK_FALSE    {strcpy($$,".FALSE.");} 
    1632       | TOK_CSTINT   {strcpy($$,$1);} 
    1633       | TOK_CSTREAL  {strcpy($$,$1);} 
    1634       | TOK_CSTREALDP{strcpy($$,$1);} 
    1635       | TOK_CSTREALQP{strcpy($$,$1);} 
    1636       | simple_const TOK_NAME  
    1637                      {sprintf($$,"%s%s",$1,$2);} 
     1619                       } 
     1620                    } 
     1621      ; 
     1622simple_const: TOK_TRUE 
     1623                     {if ( couldaddvariable == 1 ) strcpy($$,".TRUE.");} 
     1624      | TOK_FALSE    {if ( couldaddvariable == 1 ) strcpy($$,".FALSE.");} 
     1625      | TOK_CSTINT   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1626      | TOK_CSTREAL  {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1627      | TOK_CSTREALDP{if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1628      | TOK_CSTREALQP{if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1629      | simple_const TOK_NAME 
     1630                     {if ( couldaddvariable == 1 ) sprintf($$,"%s%s",$1,$2);} 
    16381631      | string_constant opt_substring 
    16391632      ; 
    1640 string_constant: TOK_CHAR_CONSTANT  
    1641                      {strcpy($$,$1);} 
    1642       | string_constant TOK_CHAR_CONSTANT  
    1643       | TOK_CHAR_MESSAGE  
    1644                      {strcpy($$,$1);} 
     1633string_constant: TOK_CHAR_CONSTANT 
     1634                     {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1635      | string_constant TOK_CHAR_CONSTANT 
     1636      | TOK_CHAR_MESSAGE 
     1637                     {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
    16451638      | TOK_CHAR_CUT 
    1646                      {strcpy($$,$1);} 
    1647       ; 
    1648 opt_substring:      {strcpy($$," ");} 
    1649       | substring   {strcpy($$,$1);} 
    1650       ; 
    1651 substring: '(' optexpr ':' optexpr ')'  
    1652                     {sprintf($$,"(%s:%s)",$2,$4);}  
    1653       ; 
    1654 optexpr:           {strcpy($$," ");} 
    1655       | expr        {strcpy($$,$1);} 
    1656       ; 
    1657 opt_expr: '\n'          {strcpy($$," ");} 
    1658       | expr        {strcpy($$,$1);} 
     1639                     {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1640      ; 
     1641opt_substring:      {if ( couldaddvariable == 1 ) strcpy($$," ");} 
     1642      | substring   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1643      ; 
     1644substring: '(' optexpr ':' optexpr ')' 
     1645                    {if ( couldaddvariable == 1 ) sprintf($$,"(%s:%s)",$2,$4);} 
     1646      ; 
     1647optexpr:           {if ( couldaddvariable == 1 ) strcpy($$," ");} 
     1648      | expr        {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     1649      ; 
     1650opt_expr: '\n'          {if ( couldaddvariable == 1 ) strcpy($$," ");} 
     1651      | expr        {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
    16591652      ; 
    16601653initial_value:      {InitialValueGiven = 0;} 
    1661       | before_initial '=' expr     
     1654      | before_initial '=' expr 
    16621655                    { 
    1663                        strcpy(InitValue,$3); 
    1664                        InitialValueGiven = 1; 
    1665                     }  
     1656                       if ( couldaddvariable == 1 ) 
     1657                       { 
     1658                          strcpy(InitValue,$3); 
     1659                          InitialValueGiven = 1; 
     1660                       } 
     1661                    } 
    16661662      ; 
    16671663before_initial : {pos_curinit = setposcur();} 
    16681664      ; 
    1669 complex_const: '(' uexpr ',' uexpr ')'  
    1670                     {sprintf($$,"(%s,%s)",$2,$4);}  
     1665complex_const: '(' uexpr ',' uexpr ')' 
     1666                    {sprintf($$,"(%s,%s)",$2,$4);} 
    16711667      ; 
    16721668use_stat: word_use  module_name 
    16731669                    { 
     1670                      if ( couldaddvariable == 1 ) 
     1671                      { 
    16741672                      /* if variables has been declared in a subroutine       */ 
    16751673                      if (insubroutinedeclare == 1) 
     
    16781676                      } 
    16791677                      sprintf(charusemodule,"%s",$2); 
    1680                       Addmoduletothelist_1($2); 
     1678                      Add_NameOfModuleUsed_1($2); 
    16811679 
    16821680                      if ( inmoduledeclare == 0 ) 
     
    16861684                                               pos_end-pos_curuse); 
    16871685                      } 
    1688                     }     
     1686                      } 
     1687                    } 
    16891688      | word_use  module_name ',' rename_list 
    16901689                    { 
     1690                       if ( couldaddvariable == 1 ) 
     1691                       { 
    16911692                      if (insubroutinedeclare == 1) 
    16921693                      { 
    1693                          completelistvarpointtovar_1($2,$4); 
    1694                       } 
    1695                       if ( firstpass == 1 )  
     1694                         Add_CouplePointed_Var_1($2,$4); 
     1695                      } 
     1696                      if ( firstpass == 1 ) 
    16961697                      { 
    16971698                         if ( insubroutinedeclare == 1 ) 
     
    17011702                            while ( coupletmp ) 
    17021703                            { 
    1703                                strcat(ligne,coupletmp->namevar); 
     1704                               strcat(ligne,coupletmp->c_namevar); 
    17041705                               strcat(ligne," => "); 
    1705                                strcat(ligne,coupletmp->namepointedvar); 
     1706                               strcat(ligne,coupletmp->c_namepointedvar); 
    17061707                               coupletmp = coupletmp->suiv; 
    17071708                               if ( coupletmp ) strcat(ligne,","); 
     
    17091710                            sprintf(charusemodule,"%s",$2); 
    17101711                         } 
    1711                          Addmoduletothelist_1($2); 
     1712                         Add_NameOfModuleUsed_1($2); 
    17121713                      } 
    17131714                      if ( inmoduledeclare == 0 ) 
     
    17171718                                               pos_end-pos_curuse); 
    17181719                      } 
    1719                     }     
     1720                      } 
     1721                    } 
    17201722      | word_use  module_name ',' TOK_ONLY ':' '\n' 
    17211723                    { 
     1724                       if ( couldaddvariable == 1 ) 
     1725                       { 
    17221726                      /* if variables has been declared in a subroutine       */ 
    17231727                      if (insubroutinedeclare == 1) 
     
    17261730                      } 
    17271731                      sprintf(charusemodule,"%s",$2); 
    1728                       Addmoduletothelist_1($2); 
     1732                      Add_NameOfModuleUsed_1($2); 
    17291733 
    17301734                       if ( inmoduledeclare == 0 ) 
     
    17341738                                                pos_end-pos_curuse); 
    17351739                       } 
    1736                     }     
     1740                       } 
     1741                    } 
    17371742      | word_use  module_name ',' TOK_ONLY ':' only_list 
    17381743                    { 
     1744                       if ( couldaddvariable == 1 ) 
     1745                       { 
    17391746                       /* if variables has been declared in a subroutine      */ 
    17401747                       if (insubroutinedeclare == 1) 
    17411748                       { 
    1742                           completelistvarpointtovar_1($2,$6); 
     1749                          Add_CouplePointed_Var_1($2,$6); 
    17431750                       } 
    1744                        if ( firstpass == 1 )  
     1751                       if ( firstpass == 1 ) 
    17451752                       { 
    17461753                         if ( insubroutinedeclare == 1 ) 
     
    17501757                             while ( coupletmp ) 
    17511758                             { 
    1752                                 strcat(ligne,coupletmp->namevar); 
    1753                                 if ( strcasecmp(coupletmp->namepointedvar,"") ) 
     1759                                strcat(ligne,coupletmp->c_namevar); 
     1760                               if ( strcasecmp(coupletmp->c_namepointedvar,"") ) 
    17541761                                                           strcat(ligne," => "); 
    1755                                 strcat(ligne,coupletmp->namepointedvar); 
     1762                                strcat(ligne,coupletmp->c_namepointedvar); 
    17561763                                coupletmp = coupletmp->suiv; 
    17571764                                if ( coupletmp ) strcat(ligne,","); 
     
    17591766                             sprintf(charusemodule,"%s",$2); 
    17601767                          } 
    1761                           Addmoduletothelist_1($2); 
     1768                          Add_NameOfModuleUsed_1($2); 
    17621769                       } 
    17631770                       if ( firstpass == 0 ) 
    1764              { 
     1771                       { 
    17651772                          if ( inmoduledeclare == 0 ) 
    17661773                          { 
     
    17691776                                                   pos_end-pos_curuse); 
    17701777                          } 
    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                 } 
     1778                          else 
     1779                          { 
     1780                             /* if we are in the module declare and if the    */ 
     1781                             /* onlylist is a list of global variable         */ 
     1782                             variableisglobalinmodule($6, $2, fortranout); 
     1783                          } 
    17771784                       } 
    1778                     }     
     1785                       } 
     1786                    } 
    17791787      ; 
    17801788word_use : TOK_USE 
     
    17831791                   } 
    17841792      ; 
    1785 module_name: TOK_NAME  
     1793module_name: TOK_NAME 
    17861794                    {strcpy($$,$1);} 
    17871795      ; 
    17881796rename_list: rename_name 
    17891797                    { 
    1790                        $$ = $1; 
    1791                     }                     
     1798                       if ( couldaddvariable == 1 ) $$ = $1; 
     1799                    } 
    17921800      | rename_list ',' rename_name 
    17931801                    { 
     1802                        if ( couldaddvariable == 1 ) 
     1803                        { 
    17941804                        /* insert the variable in the list $1                 */ 
    17951805                        $3->suiv = $1; 
    17961806                        $$ = $3; 
     1807                        } 
    17971808                    } 
    17981809      ; 
     
    18001811                    { 
    18011812                       coupletmp =(listcouple *)malloc(sizeof(listcouple)); 
    1802                        strcpy(coupletmp->namevar,$1); 
    1803                        strcpy(coupletmp->namepointedvar,$3); 
     1813                       strcpy(coupletmp->c_namevar,$1); 
     1814                       strcpy(coupletmp->c_namepointedvar,$3); 
    18041815                       coupletmp->suiv = NULL; 
    18051816                       $$ = coupletmp; 
    18061817                     } 
    18071818      ; 
    1808 only_list: only_name  
     1819only_list: only_name 
    18091820                    { 
    1810                        $$ = $1; 
    1811                     }                     
     1821                       if ( couldaddvariable == 1 ) $$ = $1; 
     1822                    } 
    18121823      | only_list ',' only_name 
    18131824                    { 
     1825                        if ( couldaddvariable == 1 ) 
     1826                        { 
    18141827                        /* insert the variable in the list $1                 */ 
    18151828                        $3->suiv = $1; 
    18161829                        $$ = $3; 
     1830                        } 
    18171831                    } 
    18181832      ; 
    1819 only_name: TOK_NAME TOK_POINT_TO TOK_NAME  
     1833only_name: TOK_NAME TOK_POINT_TO TOK_NAME 
    18201834                    { 
    18211835                       coupletmp =(listcouple *)malloc(sizeof(listcouple)); 
    1822                        strcpy(coupletmp->namevar,$1); 
    1823                        strcpy(coupletmp->namepointedvar,$3); 
     1836                       strcpy(coupletmp->c_namevar,$1); 
     1837                       strcpy(coupletmp->c_namepointedvar,$3); 
    18241838                       coupletmp->suiv = NULL; 
    18251839                       $$ = coupletmp; 
    18261840                       pointedvar=1; 
    1827                        ajoutevarindoloop_1($1); 
     1841                       Add_UsedInSubroutine_Var_1($1); 
    18281842                    } 
    18291843      | TOK_NAME    { 
    18301844                       coupletmp =(listcouple *)malloc(sizeof(listcouple)); 
    1831                        strcpy(coupletmp->namevar,$1); 
    1832                        strcpy(coupletmp->namepointedvar,""); 
     1845                       strcpy(coupletmp->c_namevar,$1); 
     1846                       strcpy(coupletmp->c_namepointedvar,""); 
    18331847                       coupletmp->suiv = NULL; 
    18341848                       $$ = coupletmp; 
     
    18371851exec: iffable 
    18381852      | TOK_ALLOCATE '(' allocation_list opt_stat_spec ')' 
     1853                     { 
     1854                         Add_SubroutineWhereAgrifUsed_1(subroutinename, 
     1855                                                        curmodulename); 
     1856                     } 
    18391857      | TOK_DEALLOCATE '(' allocate_object_list opt_stat_spec ')' 
     1858                     { 
     1859                          Add_SubroutineWhereAgrifUsed_1(subroutinename, 
     1860                                                         curmodulename); 
     1861                     } 
    18401862      | TOK_NULLIFY '(' pointer_name_list ')' 
    1841       | TOK_ENDUNIT /* end                                                    */ 
     1863      | word_endunit /* end                                                   */ 
    18421864                    { 
     1865                       GlobalDeclaration = 0 ; 
     1866                       if ( firstpass == 0 && 
     1867                            strcasecmp(subroutinename,"") ) 
     1868                       { 
     1869                          if ( module_declar && insubroutinedeclare == 0 ) 
     1870                          { 
     1871                              fclose(module_declar); 
     1872                          } 
     1873                       } 
     1874                       if ( couldaddvariable == 1 && 
     1875                            strcasecmp(subroutinename,"") ) 
     1876                       { 
    18431877                       if ( inmodulemeet == 1 ) 
    18441878                       { 
     
    18481882                            /* it is like an end subroutine <name>            */ 
    18491883                            insubroutinedeclare = 0 ; 
    1850                             paramdeclaration_everdone = 0; 
    1851                             tmpdeclaration_everdone = 0; 
    18521884                            /*                                                */ 
    1853                             closeandcallsubloopandincludeit_0(1,$1,""); 
    1854                             /* at the end of the firstpas  we should remove   */ 
    1855                             /*    from the listvarindoloop all variables      */ 
    1856                             /*    which has not been declared as table in the */ 
    1857                             /*    globliste                                   */ 
    1858                             cleanlistvarfordoloop_1(1); 
     1885                            pos_cur = setposcur(); 
     1886                            closeandcallsubloopandincludeit_0(1,$1); 
     1887                            functiondeclarationisdone = 0; 
    18591888                         } 
    18601889                         else 
    18611890                         { 
    1862                             /* if we never meet the contains keyword          */ 
    1863                             if ( inmoduledeclare == 1 ) 
    1864                             { 
    1865                                if ( aftercontainsdeclare == 0 ) 
    1866                                { 
    1867                                  CompleteGlobListeWithDatalist_1(); 
    1868                                  addsubroutine_alloc_0(1); 
    1869                                } 
    1870                             } 
    18711891                            /* it is like an end module <name>                */ 
    1872                             inmoduledeclare = 0 ;  
    1873                             inmodulemeet = 0 ;  
     1892                            inmoduledeclare = 0 ; 
     1893                            inmodulemeet = 0 ; 
    18741894                         } 
    18751895                       } 
    18761896                       else 
    18771897                       { 
    1878                           paramdeclaration_everdone = 0; 
    1879                           tmpdeclaration_everdone = 0; 
    18801898                          insubroutinedeclare = 0; 
    18811899                          /*                                                  */ 
    1882                           closeandcallsubloopandincludeit_0(2,$1,""); 
    1883                           /* it is like end subroutine or end program         */ 
    1884                           /*  Common case                                     */ 
    1885                           /* at the end of the firstpas  we should remove     */ 
    1886                           /*    from the listvarindoloop all variables which  */ 
    1887                           /*    has not been declared as table in the         */ 
    1888                           /*    globliste                                     */ 
    1889                           cleanlistvarfordoloop_1(1); 
    1890                        } 
     1900                          pos_cur = setposcur(); 
     1901                          closeandcallsubloopandincludeit_0(2,$1); 
     1902                            functiondeclarationisdone = 0; 
     1903                          if ( firstpass == 0 ) 
     1904                          { 
     1905                             if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     1906                             else fprintf(paramout,"C\n"); 
     1907                             fclose(paramout); 
     1908                           } 
     1909                        } 
     1910                      } 
     1911                      strcpy(subroutinename,""); 
    18911912                    } 
    1892       | TOK_ENDPROGRAM opt_name 
     1913      | word_endprogram opt_name 
    18931914                    { 
    1894                        tmpdeclaration_everdone = 0; 
    1895                          paramdeclaration_everdone = 0; 
     1915                       if ( couldaddvariable == 1 ) 
     1916                       { 
    18961917                       insubroutinedeclare = 0; 
    18971918                       /*                                                     */ 
    1898                        closeandcallsubloopandincludeit_0(3,$1,$2); 
    1899                        /*  Common case                                        */ 
    1900                        /* at the end of the firstpas  we should remove from   */ 
    1901                        /*    the listvarindoloop all variables which has not  */ 
    1902                        /*    been declared as table in the globliste          */ 
    1903                        cleanlistvarfordoloop_1(3); 
     1919                       pos_cur = setposcur(); 
     1920                       closeandcallsubloopandincludeit_0(3,$1); 
     1921                            functiondeclarationisdone = 0; 
     1922                      if ( firstpass == 0 ) 
     1923                      { 
     1924                         if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     1925                         else fprintf(paramout,"C\n"); 
     1926                         fclose(paramout); 
     1927                      } 
     1928                      strcpy(subroutinename,""); 
     1929                      } 
    19041930                    } 
    1905       | TOK_ENDSUBROUTINE opt_name 
     1931      | word_endsubroutine opt_name 
    19061932                    { 
    1907                        tmpdeclaration_everdone = 0; 
    1908                        paramdeclaration_everdone = 0; 
     1933                       if ( couldaddvariable == 1 && 
     1934                            strcasecmp(subroutinename,"") ) 
     1935                       { 
    19091936                       insubroutinedeclare = 0; 
    19101937                       /*                                                     */ 
    1911                        closeandcallsubloopandincludeit_0(1,$1,$2); 
    1912                        /*  Common case                                        */ 
    1913                        /* at the end of the firstpas  we should remove from   */ 
    1914                        /*    the listvarindoloop all variables which has not  */ 
    1915                        /*    been declared as table in the globliste          */ 
    1916                        cleanlistvarfordoloop_1(1); 
     1938                       pos_cur = setposcur(); 
     1939                       closeandcallsubloopandincludeit_0(1,$1); 
     1940                            functiondeclarationisdone = 0; 
     1941                      if ( firstpass == 0 ) 
     1942                      { 
     1943                         if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     1944                         else fprintf(paramout,"C\n"); 
     1945                         fclose(paramout); 
     1946                      } 
     1947                      strcpy(subroutinename,""); 
     1948                      } 
    19171949                    } 
    1918       | TOK_ENDFUNCTION opt_name 
     1950      | word_endfunction opt_name 
    19191951                    { 
    1920                        tmpdeclaration_everdone = 0; 
    1921                        paramdeclaration_everdone = 0; 
     1952                       if ( couldaddvariable == 1 ) 
     1953                       { 
    19221954                       insubroutinedeclare = 0; 
    19231955                       /*                                                     */ 
    1924                        closeandcallsubloopandincludeit_0(0,$1,$2); 
    1925                        /*  Common case                                        */ 
    1926                        /* at the end of the firstpas  we should remove from   */ 
    1927                        /*    the listvarindoloop all variables which has not  */ 
    1928                        /*    been declared as table in the globliste          */ 
    1929                        cleanlistvarfordoloop_1(0); 
     1956                       pos_cur = setposcur(); 
     1957                       closeandcallsubloopandincludeit_0(0,$1); 
     1958                            functiondeclarationisdone = 0; 
     1959                      if ( firstpass == 0 ) 
     1960                      { 
     1961                         if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     1962                         else fprintf(paramout,"C\n"); 
     1963                         fclose(paramout); 
     1964                      } 
     1965                      strcpy(subroutinename,""); 
     1966                      } 
    19301967                    } 
    19311968      | TOK_ENDMODULE opt_name 
    19321969                    { 
     1970                       if ( couldaddvariable == 1 ) 
     1971                       { 
    19331972                       /* if we never meet the contains keyword               */ 
     1973                      Remove_Word_end_module_0(); 
    19341974                       if ( inmoduledeclare == 1 ) 
    19351975                       { 
    19361976                          if ( aftercontainsdeclare == 0 ) 
    19371977                          { 
    1938                              CompleteGlobListeWithDatalist_1(); 
    1939                              addsubroutine_alloc_0(1); 
     1978                             Write_GlobalParameter_Declaration_0(); 
     1979                             Write_NotGridDepend_Declaration_0(); 
     1980                             Write_Alloc_Subroutine_For_End_0(); 
    19401981                          } 
    19411982                       } 
    1942                        inmoduledeclare = 0 ;  
    1943                        inmodulemeet = 0 ;  
     1983                       inmoduledeclare = 0 ; 
     1984                       inmodulemeet = 0 ; 
     1985 
     1986                      Write_Word_end_module_0(); 
     1987                      strcpy(curmodulename,""); 
     1988                      aftercontainsdeclare = 1; 
     1989                      if ( firstpass == 0 ) 
     1990                      { 
     1991                         if ( module_declar && insubroutinedeclare == 0) 
     1992                         { 
     1993                           fclose(module_declar); 
     1994                         } 
     1995                      } 
     1996                      GlobalDeclaration = 0 ; 
     1997                      } 
    19441998                  } 
    19451999      | boucledo 
     
    19502004      | logif TOK_THEN 
    19512005      | TOK_ELSEIF  '(' expr ')' TOK_THEN 
    1952       | TOK_ELSE  
    1953       | TOK_ENDIF 
    1954       | TOK_CASE '(' caselist ')' 
     2006      | TOK_ELSE 
     2007      | TOK_ENDIF opt_name 
     2008      | TOK_CASE caselist ')' 
    19552009      | TOK_SELECTCASE '(' expr ')' 
    19562010      | TOK_CASEDEFAULT 
     
    19602014                      if (inmoduledeclare == 1 ) 
    19612015                      { 
    1962                          CompleteGlobListeWithDatalist_1(); 
    1963                          addsubroutine_alloc_0(0); 
    1964                       } 
    1965                       inmoduledeclare = 0 ;  
    1966                       aftercontainsdeclare = 1; 
    1967                    } 
    1968       ; 
    1969  
     2016                         Remove_Word_Contains_0(); 
     2017                         Write_GlobalParameter_Declaration_0(); 
     2018                         Write_NotGridDepend_Declaration_0(); 
     2019                         Write_Alloc_Subroutine_0(); 
     2020                         inmoduledeclare = 0 ; 
     2021                         aftercontainsdeclare = 1; 
     2022                      } 
     2023                      else 
     2024                      { 
     2025                       if ( couldaddvariable == 1 ) 
     2026                       { 
     2027                          if ( firstpass == 1 ) List_ContainsSubroutine = 
     2028                                                Addtolistnom(subroutinename, 
     2029                                                     List_ContainsSubroutine,0); 
     2030                          insubroutinedeclare = 0; 
     2031                          /*                                                  */ 
     2032                          closeandcallsubloop_contains_0(); 
     2033                            functiondeclarationisdone = 0; 
     2034                         if ( firstpass == 0 ) 
     2035                         { 
     2036                            if ( retour77 == 0 ) fprintf(paramout,"!\n"); 
     2037                            else fprintf(paramout,"C\n"); 
     2038                            fclose(paramout); 
     2039                         } 
     2040                         } 
     2041                         strcpy(subroutinename,""); 
     2042                      } 
     2043                   } 
     2044      ; 
     2045word_endsubroutine: TOK_ENDSUBROUTINE 
     2046                    { 
     2047                      if ( couldaddvariable == 1 ) 
     2048                      { 
     2049                       strcpy($$,$1); 
     2050                       pos_endsubroutine = setposcur()-strlen($1); 
     2051                       functiondeclarationisdone = 0; 
     2052                       } 
     2053                    } 
     2054      ; 
     2055word_endunit: TOK_ENDUNIT 
     2056                    { 
     2057                      if ( couldaddvariable == 1 ) 
     2058                      { 
     2059                       strcpy($$,$1); 
     2060                       pos_endsubroutine = setposcur()-strlen($1); 
     2061                       } 
     2062                    } 
     2063      ; 
     2064word_endprogram:  TOK_ENDPROGRAM 
     2065                    { 
     2066                      if ( couldaddvariable == 1 ) 
     2067                      { 
     2068                       strcpy($$,$1); 
     2069                       pos_endsubroutine = setposcur()-strlen($1); 
     2070                       } 
     2071                    } 
     2072      ; 
     2073word_endfunction: TOK_ENDFUNCTION 
     2074                    { 
     2075                      if ( couldaddvariable == 1 ) 
     2076                      { 
     2077                       strcpy($$,$1); 
     2078                       pos_endsubroutine = setposcur()-strlen($1); 
     2079                       } 
     2080                    } 
     2081      ; 
    19702082caselist: expr 
    19712083      | caselist ',' expr 
    19722084      | caselist ':' expr 
    19732085      ; 
    1974 boucledo : worddo opt_int do_var '=' expr ',' expr 
    1975       | worddo opt_int do_var '=' expr ',' expr ',' expr 
     2086boucledo : worddo opt_int do_arg 
    19762087      | wordwhile expr 
    19772088      | TOK_ENDDO optname 
    19782089      ; 
    1979 opt_int :  
    1980       | TOK_CSTINT 
     2090do_arg : 
     2091      | do_var '=' expr ',' expr 
     2092      | do_var '=' expr ',' expr ',' expr 
     2093opt_int : 
     2094      | TOK_CSTINT opt_comma 
    19812095      ; 
    19822096opt_name : '\n'  {strcpy($$,"");} 
     
    19892103      ; 
    19902104wordwhile :TOK_DOWHILE 
    1991       ;      
     2105      ; 
    19922106 
    19932107dotarget: 
     
    19992113      | goto 
    20002114      | io 
    2001       | call  
     2115      | call 
    20022116      | TOK_ALLOCATE '(' allocation_list opt_stat_spec ')' 
     2117                     { 
     2118                          Add_SubroutineWhereAgrifUsed_1(subroutinename, 
     2119                                                        curmodulename); 
     2120                     } 
    20032121      | TOK_DEALLOCATE '(' allocate_object_list opt_stat_spec ')' 
     2122                     { 
     2123                          Add_SubroutineWhereAgrifUsed_1(subroutinename, 
     2124                                                        curmodulename); 
     2125                     } 
    20042126      | TOK_EXIT optexpr 
    20052127      | TOK_RETURN opt_expr 
     
    20102132before_dims : {if ( couldaddvariable == 1 ) created_dimensionlist = 0;} 
    20112133ident_dims : ident before_dims dims dims 
    2012       {created_dimensionlist = 1;} 
     2134              { 
     2135                  created_dimensionlist = 1; 
     2136                  if  ( agrif_parentcall == 1 ) 
     2137                  { 
     2138                      ModifyTheAgrifFunction_0($3->dim.last); 
     2139                      agrif_parentcall =0; 
     2140                      fprintf(fortranout," = "); 
     2141                  } 
     2142              } 
    20132143      | ident_dims '%' ident before_dims dims dims 
    20142144      {created_dimensionlist = 1;} 
     
    20162146      | int_list ',' TOK_CSTINT 
    20172147      ; 
    2018 after_ident_dims : '=' expr  
    2019       | TOK_POINT_TO expr  
    2020       ; 
    2021 call: keywordcall opt_call  
     2148after_ident_dims : '=' expr 
     2149      | TOK_POINT_TO expr 
     2150      ; 
     2151call: keywordcall opt_call 
    20222152                   { 
    20232153                      inagrifcallargument = 0 ; 
    20242154                      incalldeclare=0; 
    2025                       if ( oldfortranout &&  
    2026                            !strcasecmp(meetagrifinitgrids,subroutinename) &&  
     2155                      if ( oldfortranout && 
     2156                           !strcasecmp(meetagrifinitgrids,subroutinename) && 
    20272157                           firstpass == 0 && 
    20282158                           callmpiinit == 1) 
     
    20342164                                                                   ,mpiinitvar); 
    20352165                      } 
    2036                       if ( oldfortranout           &&  
    2037                            callagrifinitgrids == 1 &&  
     2166                      if ( oldfortranout           && 
     2167                           callagrifinitgrids == 1 && 
    20382168                           firstpass == 0 ) 
    20392169                      { 
     
    20412171                         RemoveWordSET_0(fortranout,pos_curcall, 
    20422172                                               pos_end-pos_curcall); 
    2043                          fprintf(oldfortranout, 
    2044                                            "      Call Agrif_Init_Grids () \n"); 
     2173 
    20452174                         strcpy(subofagrifinitgrids,subroutinename); 
    20462175                      } 
     
    20482177                   } 
    20492178      ; 
    2050 opt_call :  
     2179opt_call : 
    20512180      | '(' opt_callarglist  ')' 
    20522181      ; 
     
    20542183      | callarglist 
    20552184      ; 
    2056 keywordcall : before_call TOK_NAME  
     2185keywordcall : before_call TOK_NAME 
    20572186                    { 
    2058                        if (!strcasecmp($2,"MPI_Init") )  
     2187                       if (!strcasecmp($2,"MPI_Init") ) 
    20592188                       { 
    20602189                          callmpiinit = 1; 
    2061                           strcpy(meetmpiinit,subroutinename); 
    20622190                       } 
    20632191                       else 
     
    20652193                          callmpiinit = 0; 
    20662194                       } 
    2067                        if (!strcasecmp($2,"Agrif_Init_Grids") )  
     2195                       if (!strcasecmp($2,"Agrif_Init_Grids") ) 
    20682196                       { 
    20692197                          callagrifinitgrids = 1; 
     
    20712199                       } 
    20722200                       else callagrifinitgrids = 0; 
    2073                        if ( Vartonumber($2) == 1 )  
     2201                       if ( !strcasecmp($2,"Agrif_Open_File") ) 
     2202                       { 
     2203                          Add_SubroutineWhereAgrifUsed_1(subroutinename, 
     2204                                                        curmodulename); 
     2205                       } 
     2206                       if ( Vartonumber($2) == 1 ) 
    20742207                       { 
    20752208                          incalldeclare=1; 
    20762209                          inagrifcallargument = 1 ; 
    2077                           AddsubroutineTolistsubwhereagrifused(); 
     2210                          Add_SubroutineWhereAgrifUsed_1(subroutinename, 
     2211                                                        curmodulename); 
    20782212                       } 
    20792213                    } 
     
    20862220 
    20872221callarg:  expr { 
    2088                   if ( callmpiinit == 1 )  
     2222                  if ( callmpiinit == 1 ) 
    20892223                  { 
    20902224                     strcpy(mpiinitvar,$1); 
    2091                      if ( firstpass == 1 )  
     2225                     if ( firstpass == 1 ) 
    20922226                     { 
    2093                         curvar=createvar($1,NULL); 
     2227                        Add_UsedInSubroutine_Var_1 (mpiinitvar); 
     2228/*                        curvar=createvar($1,NULL); 
    20942229                        curlistvar=insertvar(NULL,curvar); 
    2095                         listargsubroutine = AddListvarToListvar 
    2096                                                (curlistvar,listargsubroutine,1); 
     2230                        List_Subr outineArgument_Var = AddListvarToListvar 
     2231                         (curlistvar,List_SubroutineAr gument_Var,1);*/ 
    20972232                     } 
    20982233                  } 
     
    21082243      | read option_read 
    21092244      | TOK_REWIND after_rewind 
    2110       | print option_print 
    2111       | wordformat debut_format ioctl_format fin_format 
    2112                     {formatdeclare = 0;} 
    2113       ; 
    2114 wordformat : TOK_FORMAT 
    2115                     {formatdeclare = 1;} 
    2116 opt_ioctlformat :  
    2117       | ioctl_format 
    2118       ; 
    2119 opt_ioctl_format :  
    2120       | ',' ioctl_format 
    2121       | ',' '*' 
    2122       ; 
    2123 debut_format : TOK_LEFTAB opt_comma 
    2124       | '(' 
    2125       ; 
    2126 ioctl_format : format_expr 
    2127       |   ioctl_format ',' format_expr 
    2128       ; 
    2129 format_expr :  
    2130       | uexpr 
    2131       | TOK_CSTINT TOK_CHAR_INT 
    2132       | TOK_CSTINT debut_format ioctl_format fin_format 
    2133       | TOK_SLASH opt_CHAR_INT 
    2134       | TOK_CHAR_INT TOK_SLASH format_expr 
    2135       | TOK_SLASH TOK_SLASH 
    2136       | TOK_CHAR_INT 
    2137       | '(' format_expr ')' 
    2138       | '(' uexpr ')' 
    2139       ; 
    2140 opt_CHAR_INT :  
     2245      | TOK_FORMAT 
     2246      ; 
     2247opt_CHAR_INT : 
    21412248      | TOK_CSTINT TOK_NAME 
    2142       ; 
    2143 fin_format : opt_comma TOK_RIGHTAB opt_comma 
    2144       | ')' 
    21452249      ; 
    21462250idfile : '*' 
     
    21642268      ; 
    21652269ioctl:  '(' ctllist ')' 
    2166       | '(' fexpr ')'  
     2270      | '(' fexpr ')' 
    21672271      ; 
    21682272after_rewind:  '(' ident ')' 
     2273      | '(' TOK_CSTINT ')' 
     2274      | TOK_CSTINT 
     2275      | '(' uexpr ')' 
    21692276      | TOK_NAME 
    21702277      ; 
     
    21722279      | ctllist ',' ioclause 
    21732280      ; 
    2174 ioclause: fexpr  
     2281ioclause: fexpr 
    21752282      | '*' 
    21762283      | TOK_DASTER 
    2177       | TOK_NAME expr  
     2284      | TOK_NAME expr 
    21782285      | TOK_NAME expr '%' ident_dims 
    21792286      | TOK_NAME '(' triplet ')' 
    2180       | TOK_NAME '*'  
    2181       | TOK_NAME TOK_DASTER  
     2287      | TOK_NAME '*' 
     2288      | TOK_NAME TOK_DASTER 
    21822289      ; 
    21832290iofctl: TOK_OPEN 
     
    21912298      | TOK_INQUIRE 
    21922299      | TOK_WRITE 
    2193       ; 
    2194 print: TOK_PRINT fexpr 
    2195       | TOK_PRINT '*' 
     2300      | TOK_PRINT 
    21962301      ; 
    21972302fexpr: unpar_fexpr 
     
    22082313      | TOK_FILE expr 
    22092314      | TOK_EXIST expr 
     2315      | TOK_ERR expr 
     2316      | TOK_END expr 
    22102317      | TOK_NAME '=' expr 
    22112318      ; 
     
    22162323      | inlist ',' inelt 
    22172324      ; 
    2218 opt_lhs :  
     2325opt_lhs : 
    22192326      | lhs 
    22202327      ; 
     
    22222329      | '(' inlist ')' opt_operation 
    22232330      | predefinedfunction opt_operation 
    2224       | simple_const opt_operation  
     2331      | simple_const opt_operation 
    22252332      | '(' inlist ',' dospec ')' 
    22262333      ; 
     
    22282335      | operation 
    22292336      | opt_operation operation 
    2230       ;       
    2231 outlist: other      {strcpy($$,$1);}  
    2232       | out2       {strcpy($$,$1);}  
     2337      ; 
     2338outlist: other      {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     2339      | out2       {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
    22332340      ; 
    22342341out2: uexpr ',' expr 
    2235                    {sprintf($$,"%s,%s",$1,$3);}  
    2236       | uexpr ',' other  
    2237                    {sprintf($$,"%s,%s",$1,$3);}  
    2238       | other ',' expr  
    2239                    {sprintf($$,"%s,%s",$1,$3);}  
    2240       | other ',' other  
    2241                    {sprintf($$,"%s,%s",$1,$3);}  
    2242       | out2 ',' expr  
    2243                    {sprintf($$,"%s,%s",$1,$3);}  
    2244       | out2 ',' other  
    2245                    {sprintf($$,"%s,%s",$1,$3);}  
    2246       | uexpr     {strcpy($$,$1);}  
    2247       | predefinedfunction {strcpy($$,$1);}  
    2248       ; 
    2249 other:  complex_const  
    2250                    {strcpy($$,$1);}  
    2251       | '(' expr ')'  
    2252                    {sprintf($$," (%s)",$2);}  
     2342                   {if ( couldaddvariable == 1 ) sprintf($$,"%s,%s",$1,$3);} 
     2343      | uexpr ',' other 
     2344                   {if ( couldaddvariable == 1 ) sprintf($$,"%s,%s",$1,$3);} 
     2345      | other ',' expr 
     2346                   {if ( couldaddvariable == 1 ) sprintf($$,"%s,%s",$1,$3);} 
     2347      | other ',' other 
     2348                   {if ( couldaddvariable == 1 ) sprintf($$,"%s,%s",$1,$3);} 
     2349      | out2 ',' expr 
     2350                   {if ( couldaddvariable == 1 ) sprintf($$,"%s,%s",$1,$3);} 
     2351      | out2 ',' other 
     2352                   {if ( couldaddvariable == 1 ) sprintf($$,"%s,%s",$1,$3);} 
     2353      | uexpr     {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     2354      | predefinedfunction {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     2355      ; 
     2356other:  complex_const 
     2357                   {if ( couldaddvariable == 1 ) strcpy($$,$1);} 
     2358      | '(' expr ')' 
     2359                   {if ( couldaddvariable == 1 ) sprintf($$," (%s)",$2);} 
    22532360      | '(' uexpr ',' dospec ')' 
    2254                    {sprintf($$,"(%s,%s)",$2,$4);}  
     2361                   {if ( couldaddvariable == 1 ) sprintf($$,"(%s,%s)",$2,$4);} 
    22552362      | '(' other ',' dospec ')' 
    2256                    {sprintf($$,"(%s,%s)",$2,$4);}  
     2363                   {if ( couldaddvariable == 1 ) sprintf($$,"(%s,%s)",$2,$4);} 
    22572364      | '(' out2 ',' dospec ')' 
    2258                    {sprintf($$,"(%s,%s)",$2,$4);}  
    2259       ; 
    2260  
    2261 dospec: TOK_NAME '=' expr ',' expr  
    2262                    {sprintf($$,"%s=%s,%s)",$1,$3,$5);}  
    2263       | TOK_NAME '=' expr ',' expr ',' expr  
    2264                    {sprintf($$,"%s=%s,%s,%s)",$1,$3,$5,$7);}  
     2365                   {if ( couldaddvariable == 1 ) sprintf($$,"(%s,%s)",$2,$4);} 
     2366      ; 
     2367 
     2368dospec: TOK_NAME '=' expr ',' expr 
     2369                   {if ( couldaddvariable == 1 ) 
     2370                                              sprintf($$,"%s=%s,%s)",$1,$3,$5);} 
     2371      | TOK_NAME '=' expr ',' expr ',' expr 
     2372                   {if ( couldaddvariable == 1 ) 
     2373                                        sprintf($$,"%s=%s,%s,%s)",$1,$3,$5,$7);} 
    22652374      ; 
    22662375labellist: label 
     
    22692378label: TOK_CSTINT 
    22702379      ; 
    2271 goto: TOK_PLAINGOTO label 
     2380goto: TOK_PLAINGOTO '(' expr ',' expr ')' ',' expr 
     2381      | TOK_PLAINGOTO label 
    22722382      ; 
    22732383allocation_list: allocate_object 
     
    22762386      ; 
    22772387allocate_object: ident 
    2278                    {AddIdentToTheAllocateList_1($1);} 
     2388                   {Add_Allocate_Var_1($1,curmodulename);} 
    22792389      | structure_component 
    22802390      | array_element 
    22812391      ; 
    2282 array_element: ident '(' funargs ')'  
    2283                    {AddIdentToTheAllocateList_1($1);} 
    2284       ; 
    2285 subscript_list: expr  
    2286       | subscript_list ',' expr  
     2392array_element: ident '(' funargs ')' 
     2393                   {Add_Allocate_Var_1($1,curmodulename);} 
     2394      ; 
     2395subscript_list: expr 
     2396      | subscript_list ',' expr 
    22872397      ; 
    22882398 
     
    23172427 
    23182428   /*fortrandebug = 1;*/ 
     2429   if ( mark == 1 ) printf("Firstpass == %d \n",firstpass); 
    23192430/******************************************************************************/ 
    23202431/*  1-  Open input and output files                                           */ 
    23212432/******************************************************************************/ 
    2322    strcpy(OriginalFileName,fichier_entree);  
    23232433   strcpy(nomfile,commondirin); 
    23242434   strcat(nomfile,"/"); 
    23252435   strcat(nomfile,fichier_entree); 
    23262436   fortranin=fopen( nomfile,"r"); 
    2327    if (! fortranin)  
     2437   if (! fortranin) 
    23282438   { 
    23292439      printf("Error : File %s does not exist\n",nomfile); 
    23302440      exit(1); 
    23312441   } 
    2332     
     2442 
    23332443   strcpy(curfile,nomfile); 
    23342444   strcpy(nomfile,commondirout); 
    2335    strcat(nomfile,"/");   
     2445   strcat(nomfile,"/"); 
    23362446   strcat(nomfile,fichier_entree); 
    23372447   strcpy(nomfileoutput,nomfile); 
    2338    if (firstpass == 1)  
     2448   if (firstpass == 1) 
    23392449   { 
    2340       if (checkexistcommon == 1)  
     2450      if (checkexistcommon == 1) 
    23412451      { 
    2342          if (fopen(nomfile,"r"))  
     2452         if (fopen(nomfile,"r")) 
    23432453         { 
    23442454            printf("Warning : file %s already exist\n",nomfile); 
    23452455            confirmyes = 0; 
    2346             while (confirmyes==0)  
     2456            while (confirmyes==0) 
    23472457            { 
    23482458               printf("Override file %s ? [Y/N]\n",nomfile); 
    23492459               c=getchar(); 
    2350                getchar();     
    2351                if (c==79 || c==110)  
     2460               getchar(); 
     2461               if (c==79 || c==110) 
    23522462               { 
    23532463                  printf("We stop\n"); 
    23542464                  exit(1); 
    23552465               } 
    2356                if (c==89 || c==121)  
     2466               if (c==89 || c==121) 
    23572467               { 
    23582468                  confirmyes=1; 
     
    23612471         } 
    23622472      } 
    2363    }   
     2473   } 
    23642474 
    23652475/******************************************************************************/ 
     
    23672477/******************************************************************************/ 
    23682478 
    2369    line_num_fortran_common=1;  
     2479   line_num_fortran_common=1; 
    23702480   line_num_fortran=1; 
    2371    PublicDeclare = 0;   
    2372    PrivateDeclare = 0;  
    2373    formatdeclare = 0; 
    2374    ExternalDeclare = 0;  
     2481   PublicDeclare = 0; 
     2482   PrivateDeclare = 0; 
     2483   ExternalDeclare = 0; 
    23752484   SaveDeclare = 0; 
    2376    indeclarationvar=0; 
    23772485   pointerdeclare = 0; 
    23782486   optionaldeclare = 0; 
    23792487   incalldeclare = 0; 
    2380    infunctiondeclare = 0 ; 
     2488   VarType = 0; 
     2489   VarTypepar = 0; 
    23812490   Allocatabledeclare = 0 ; 
    2382    strcpy(NamePrecision," ");  
    2383    VariableIsParameter =  0 ;  
    2384    strcpy(NamePrecision,"");   
    2385    c_star = 0 ;  
     2491   strcpy(NamePrecision," "); 
     2492   VariableIsParameter =  0 ; 
     2493   strcpy(NamePrecision,""); 
     2494   c_star = 0 ; 
     2495   functiondeclarationisdone = 0; 
    23862496   insubroutinedeclare = 0 ; 
    2387    strcpy(subroutinename," ");  
    2388    InitialValueGiven = 0 ;  
    2389    strcpy(EmptyChar," ");  
     2497   strcpy(subroutinename," "); 
     2498   InitialValueGiven = 0 ; 
     2499   strcpy(EmptyChar," "); 
    23902500   inmoduledeclare = 0; 
    23912501   colnum=0; 
     
    23952505   /* Name of the file without format                                         */ 
    23962506   tmp = strchr(fichier_entree, '.'); 
    2397    strncpy(curfilename,fichier_entree,strlen(fichier_entree)-strlen(tmp));  
     2507   strncpy(curfilename,fichier_entree,strlen(fichier_entree)-strlen(tmp)); 
    23982508/******************************************************************************/ 
    2399 /*  2-  Parsing of the input file (1 time)                                    */ 
     2509/*  3-  Parsing of the input file (1 time)                                    */ 
    24002510/******************************************************************************/ 
    2401    if (firstpass == 0 )  
     2511   if (firstpass == 0 ) 
    24022512   { 
    24032513      fortranout=fopen(nomfileoutput,"w"); 
    2404       /* we should add the new module comes from common block                 */ 
    2405       if (fortran77 == 1 ) fprintf 
    2406                       (fortranout,"#include \"NewModule_%s.h\" \n",curfilename); 
     2514 
     2515      NewModule_Creation_0(); 
    24072516   } 
    24082517 
Note: See TracChangeset for help on using the changeset viewer.