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 2715 for trunk/NEMOGCM/EXTERNAL/AGRIF/LIB/UtilListe.c – NEMO

Ignore:
Timestamp:
2011-03-30T17:58:35+02:00 (13 years ago)
Author:
rblod
Message:

First attempt to put dynamic allocation on the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/EXTERNAL/AGRIF/LIB/UtilListe.c

    r2528 r2715  
    7272   var->v_optionaldeclare     = 0 ; 
    7373   var->v_allocatable         = 0 ; 
     74   var->v_target              = 0 ; 
    7475   var->v_dimsempty           = 0 ; 
    7576   var->v_dimension = (listdim *)NULL; 
     
    152153   } 
    153154   /* Si cette variable est declaree en save                                  */ 
    154    if (SaveDeclare == 1 ) curvar->v_save = 1; 
     155   if (SaveDeclare == 1 ) { 
     156   curvar->v_save = 1; 
     157   } 
     158 
    155159   /* Si cette variable est v_allocatable                                     */ 
    156160   if (Allocatabledeclare == 1 ) curvar->v_allocatable=1; 
     161    
     162   /* Si cette variable est v_targer                                     */ 
     163   if (Targetdeclare == 1 ) curvar->v_target=1; 
    157164   /* if INTENT spec has been given                                           */ 
    158165   if ( strcasecmp(IntentSpec,"") ) 
     
    202209      tmpvar->v_save=parcours->var->v_save; 
    203210      tmpvar->v_VariableIsParameter=parcours->var->v_VariableIsParameter; 
     211      printf("QLKDF\n"); 
    204212      tmpvar->v_indicetabvars=parcours->var->v_indicetabvars; 
    205213      strcpy(tmpvar->v_modulename,parcours->var->v_modulename); 
     
    220228      tmpvar->v_optionaldeclare=parcours->var->v_optionaldeclare; 
    221229      tmpvar->v_allocatable=parcours->var->v_allocatable; 
     230      tmpvar->v_target=parcours->var->v_target; 
    222231      strcpy(tmpvar->v_IntentSpec,parcours->var->v_IntentSpec); 
    223232      tmpvar->v_dimsempty=parcours->var->v_dimsempty; 
     
    511520} 
    512521 
    513 listname *Insertname(listname *lin,char *nom) 
     522listname *Insertname(listname *lin,char *nom, int sens) 
    514523{ 
    515524   listname *newvar ; 
     
    526535   else 
    527536   { 
     537      if (sens == 0) 
     538      { 
    528539      tmpvar = lin ; 
    529540      while (tmpvar->suiv) 
     
    533544      tmpvar -> suiv = newvar; 
    534545   } 
     546      else 
     547      { 
     548      newvar->suiv = lin; 
     549      lin = newvar; 
     550      } 
     551   } 
    535552   return lin; 
     553} 
     554 
     555listname *concat_listname(listname *l1, listname *l2) 
     556{ 
     557   listname *tmpvar; 
     558 
     559   tmpvar = l1; 
     560   while (tmpvar->suiv) 
     561   { 
     562    tmpvar = tmpvar->suiv; 
     563   } 
     564    
     565   tmpvar->suiv = l2; 
     566    
     567   return l1; 
     568} 
     569 
     570void *createstringfromlistname(char *ligne, listname *lin) 
     571{ 
     572listname *tmpvar; 
     573 
     574strcpy(ligne,""); 
     575tmpvar = lin; 
     576while(tmpvar) 
     577{ 
     578  strcat(ligne,tmpvar->n_name); 
     579  if (tmpvar->suiv) strcat(ligne,","); 
     580  tmpvar=tmpvar->suiv; 
     581} 
    536582} 
    537583 
     
    618664 
    619665} 
     666 
     667void Init_List_Data_Var() 
     668{ 
     669listvar *parcours; 
     670 
     671parcours = List_Data_Var_Cur; 
     672 
     673if (List_Data_Var_Cur) 
     674{ 
     675while (parcours) 
     676{ 
     677 List_Data_Var_Cur = List_Data_Var_Cur->suiv; 
     678 free(parcours); 
     679 parcours = List_Data_Var_Cur; 
     680} 
     681} 
     682 
     683List_Data_Var_Cur = NULL; 
     684 
     685} 
Note: See TracChangeset for help on using the changeset viewer.