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 774 for trunk/AGRIF/LIB/SubLoopCreation.c – NEMO

Ignore:
Timestamp:
2007-12-18T17:45:53+01:00 (17 years ago)
Author:
rblod
Message:

Update Agrif, see ticket:#39

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AGRIF/LIB/SubLoopCreation.c

    r663 r774  
    3131/* knowledge of the CeCILL-C license and that you accept its terms.           */ 
    3232/******************************************************************************/ 
    33 /* version 1.6                                                                */ 
     33/* version 1.7                                                                */ 
    3434/******************************************************************************/ 
    3535#include <stdio.h> 
     
    4949/* Firstpass 0                                                                */ 
    5050/* We should write the head of the subroutine sub_loop_<subroutinename>       */ 
    51 /* suborfunc = 1 from subroutine                                              */ 
    52 /* suborfunc = 2 from function                                                */ 
    53 /******************************************************************************/ 
    54 /*                                                                            */ 
    55 /******************************************************************************/ 
    56 void writeheadnewsub_0(int suborfunc) 
    57 { 
    58    int out; 
    59    char ligne[LONGNOM]; 
    60    listusemodule *newmodule; 
     51/******************************************************************************/ 
     52/*                                                                            */ 
     53/******************************************************************************/ 
     54void writeheadnewsub_0() 
     55{ 
     56   char ligne[LONG_C]; 
    6157 
    6258   if ( firstpass == 0 && IsTabvarsUseInArgument_0() == 1 ) 
     
    7975      tofich(fortranout,ligne,1); 
    8076 
    81    /*   writesub_loopdeclaration_scalar(List_SubroutineArgument_Var,paramout);*/ 
    8277      WriteArgumentDeclaration_Sort(); 
    83 /*      writesub_loopdeclaration_tab(List_SubroutineArgument_Var,fortranout);*/ 
    8478 
    8579      if ( mark == 1 ) fprintf(fortranout,"!!! 222222222222222 \n"); 
     
    134128{ 
    135129   listvar *parcours; 
    136    char ligne[LONGNOM]; 
     130   char ligne[LONG_C]; 
    137131   int compteur; 
    138132 
     
    230224{ 
    231225   listvar *parcours; 
    232    char ligne[LONGNOM*100]; 
     226   char ligne[LONG_40M]; 
    233227   char ligne2[10]; 
    234228   int i; 
     229   int compteur ; 
    235230 
    236231   if ( todebug == 1 ) printf("Enter in WriteVariablelist_subloop_Call\n"); 
    237232   parcours = List_UsedInSubroutine_Var; 
     233   compteur = 0 ; 
    238234   while ( parcours ) 
    239235   { 
     
    248244         if ( didvariableadded == 0 ) 
    249245         { 
    250             strcpy(ligne,""); 
     246            if ( retour77 == 1 ) strcpy(ligne,"\n     & "); 
     247            else strcpy(ligne,"\n      "); 
    251248         } 
    252249         else 
    253250         { 
    254             strcpy(ligne,""); 
    255             strcat(ligne,","); 
     251            if ( compteur == 0 ) 
     252            { 
     253               if ( retour77 == 1 ) strcpy(ligne,"\n     & "); 
     254               else strcpy(ligne,"\n      "); 
     255            } 
     256            strcat(ligne," , "); 
    256257         } 
    257258         strcat(ligne,vargridcurgridtabvars(parcours->var,0)); 
     
    288289         } 
    289290         didvariableadded = 1; 
    290          if ( retour77 == 0 ) 
     291         compteur = compteur +1 ; 
     292         /*if ( retour77 == 0 ) 
    291293         { 
    292294            strcat(ligne," &"); 
    293295            fprintf(outputfile,"\n"); 
    294296         } 
    295          else fprintf(outputfile,"\n     & "); 
    296          tofich(outputfile,ligne,0); 
     297         else fprintf(outputfile,"\n     & ");*/ 
     298         /*tofich(outputfile,ligne,0);*/ 
    297299      } 
    298300      parcours = parcours -> suiv; 
    299301   } 
     302   Save_Length(ligne,41); 
     303   tofich(outputfile,ligne,0); 
    300304   /* Now we should replace the last ", &" by " &"                            */ 
    301    if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR); 
    302    if ( didvariableadded == 0 ) fseek(outputfile,-2,SEEK_CUR); 
     305/*   if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR); 
     306   if ( didvariableadded == 0 ) fseek(outputfile,-1,SEEK_CUR);*/ 
    303307   if ( todebug == 1 ) printf("Out of WriteVariablelist_subloop_Call\n"); 
    304308} 
     
    323327{ 
    324328   listvar *parcours; 
    325    char ligne[LONGNOM]; 
     329   char ligne[LONG_40M]; 
    326330   int compteur; 
    327331 
     
    341345         if ( didvariableadded == 0 ) 
    342346         { 
    343             strcpy(ligne,""); 
     347            if ( retour77 == 1 ) strcpy(ligne,"\n     &"); 
     348            else strcpy(ligne,"\n      "); 
    344349         } 
    345350         else 
    346351         { 
    347             if ( compteur == 0 ) strcpy(ligne,""); 
     352            if ( compteur == 0 ) 
     353            { 
     354               if ( retour77 == 1 ) strcpy(ligne,"\n     & "); 
     355               else strcpy(ligne,"\n      "); 
     356            } 
    348357            strcat(ligne,","); 
    349358         } 
     
    351360         compteur = compteur + 1; 
    352361         didvariableadded = 1; 
    353          if ( compteur == 3 ) 
     362/*         if ( compteur == 3 ) 
    354363         { 
    355364            if ( retour77 == 0 ) 
     
    360369            else fprintf(outputfile,"\n     & %s",ligne); 
    361370            compteur = 0; 
    362          } 
     371         }*/ 
    363372      } 
    364373      parcours = parcours -> suiv; 
    365374   } 
    366    if ( compteur != 3 && compteur != 0 ) 
     375 /*  if ( compteur != 3 && compteur != 0 ) 
    367376   { 
    368377      if ( retour77 == 0 ) fprintf(outputfile,"\n      %s &",ligne); 
    369378      else fprintf(outputfile,"\n     & %s",ligne); 
    370    } 
     379   }*/ 
     380   Save_Length(ligne,41); 
     381   tofich(outputfile,ligne,0); 
    371382 
    372383   /* Now we should replace the last ", &" by " &"                            */ 
    373   if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR); 
    374    if ( didvariableadded == 0 ) fseek(outputfile,-1,SEEK_CUR); 
     384  /* if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR); 
     385   if ( didvariableadded == 0 ) fseek(outputfile,-1,SEEK_CUR);*/ 
    375386   if ( todebug == 1 ) printf("Out of WriteVariablelist_subloop_Def\n"); 
    376387} 
     
    394405void WriteHeadofSubroutineLoop() 
    395406{ 
    396    char ligne[LONGNOM]; 
     407   char ligne[LONG_C]; 
    397408   FILE * subloop; 
    398409 
     
    412423   /*                                                                         */ 
    413424   sprintf(ligne,")"); 
    414    tofich(subloop,ligne,1); 
     425   fprintf(subloop,ligne); 
    415426   /* if USE agrif_Uti l should be add                                        */ 
    416427   AddUseAgrifUtil_0(subloop); 
     
    434445/*                                                                            */ 
    435446/******************************************************************************/ 
    436 void closeandcallsubloopandincludeit_0(int suborfun, char endsub[LONGNOM]) 
    437 { 
    438    char ligne[LONGNOM]; 
     447void closeandcallsubloopandincludeit_0(int suborfun) 
     448{ 
     449   char ligne[LONG_C]; 
    439450 
    440451   if ( firstpass == 0 ) 
     
    468479      /* Close the parenthesis of the new subroutine called                   */ 
    469480      sprintf(ligne,")"); 
    470       tofich(fortranout,ligne,1); 
     481      fprintf(fortranout,ligne); 
    471482      /* We should close the original subroutine                              */ 
    472483      if ( suborfun == 3 ) sprintf(ligne,"\n      end program %s" 
     
    489500 
    490501 
    491 void closeandcallsubloop_contains_0(int suborfun, char endsub[LONGNOM]) 
    492 { 
    493    char ligne[LONGNOM]; 
     502void closeandcallsubloop_contains_0() 
     503{ 
     504   char ligne[LONG_C]; 
    494505 
    495506   if ( firstpass == 0 ) 
Note: See TracChangeset for help on using the changeset viewer.