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

Ignore:
Timestamp:
2008-09-24T15:05:20+02:00 (16 years ago)
Author:
rblod
Message:

Adapt Agrif to the new SBC and correct several bugs for agrif (restart writing and reading), see ticket #133
Note : this fix does not work yet on NEC computerq (sxf90/360)

File:
1 edited

Legend:

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

    r774 r1200  
    9191{ 
    9292   listvar *newvar; 
    93  
    9493   if ( firstpass == ValueFirstpass ) 
    9594   { 
     
    207206      strcpy(tmpvar->v_commonname,parcours->var->v_commonname); 
    208207      strcpy(tmpvar->v_vallengspec,parcours->var->v_vallengspec); 
     208 
    209209      strcpy(tmpvar->v_nameinttypename,parcours->var->v_nameinttypename); 
     210             
    210211      tmpvar->v_pointedvar=parcours->var->v_pointedvar; 
    211212      strcpy(tmpvar->v_commoninfile,mainfile); 
     
    361362      Save_Length(nameinttypename,9); 
    362363   } 
     364          
    363365   if ( optionaldeclare     == 1 ) var->v_optionaldeclare = 1; 
    364366   if ( pointerdeclare      == 1 ) var->v_pointerdeclare = 1; 
     
    369371   /*                                                                         */ 
    370372   var->v_dimension=d; 
     373 
    371374   /* Creation of the string for the dimension of this variable               */ 
    372375   dimsempty = 1; 
     
    464467   return newvar ; 
    465468} 
     469 
     470/******************************************************************/ 
     471/* printliste  */ 
     472/* print the list given in argulent */ 
     473/******************************************************************/ 
     474 
     475void printliste(listvar * lin) 
     476{ 
     477   listvar *newvar; 
     478   variable *v; 
     479 
     480   newvar=lin; 
     481   while (newvar) 
     482   { 
     483      v=newvar->var; 
     484      printf("nom = %s, allocatable = %d dim = %s\n",v->v_nomvar,v->v_allocatable,(v->v_dimension)->dim.last); 
     485      newvar=newvar->suiv; 
     486   } 
     487} 
     488 
     489/******************************************************************************/ 
     490/*   IsinListe : return 1 if name nom is in list lin                          */ 
     491/*                                                                            */ 
     492/******************************************************************************/ 
     493 int IsinListe(listvar *lin,char *nom) 
     494{ 
     495   listvar *newvar; 
     496   variable *v; 
     497   int out ; 
     498    
     499   newvar=lin; 
     500   out = 0; 
     501   while (newvar && (out == 0)) 
     502   { 
     503      v=newvar->var; 
     504      if (!strcasecmp(v->v_nomvar,nom) && !strcasecmp(v->v_subroutinename,subroutinename)) { 
     505      out = 1; 
     506      } 
     507      newvar=newvar->suiv; 
     508   } 
     509 
     510   return out ; 
     511} 
     512 
     513listname *Insertname(listname *lin,char *nom) 
     514{ 
     515   listname *newvar ; 
     516   listname *tmpvar; 
     517 
     518   newvar=(listname *) malloc (sizeof (listname)); 
     519   strcpy(newvar->n_name,nom); 
     520   newvar->suiv = NULL; 
     521   if (!lin) 
     522   { 
     523      newvar->suiv=NULL; 
     524      lin = newvar; 
     525   } 
     526   else 
     527   { 
     528      tmpvar = lin ; 
     529      while (tmpvar->suiv) 
     530      { 
     531         tmpvar = tmpvar ->suiv ; 
     532      } 
     533      tmpvar -> suiv = newvar; 
     534   } 
     535   return lin; 
     536} 
     537 
     538/******************************************************************/ 
     539/* printname  */ 
     540/* print the list given in argulent */ 
     541/******************************************************************/ 
     542 
     543void printname(listname * lin) 
     544{ 
     545   listname *newvar; 
     546 
     547   newvar=lin; 
     548   while (newvar) 
     549   { 
     550      printf("nom = %s \n",newvar->n_name); 
     551      newvar=newvar->suiv; 
     552   } 
     553} 
     554 
     555void removeglobfromlist(listname **lin) 
     556{ 
     557  listname *listemp; 
     558  listname *parcours1; 
     559  listvar *parcours2; 
     560  listname * parcourspres; 
     561  int out; 
     562   
     563  parcours1 = *lin; 
     564  parcourspres = (listname *)NULL; 
     565   
     566  while (parcours1) 
     567  { 
     568  parcours2 = List_Global_Var; 
     569  out = 0; 
     570  while (parcours2 && out == 0) 
     571  { 
     572    if (!strcasecmp(parcours2->var->v_nomvar,parcours1->n_name)) 
     573    { 
     574    out = 1; 
     575    } 
     576    parcours2 = parcours2->suiv; 
     577  } 
     578  if (out == 1) 
     579  { 
     580  if (parcours1 == *lin) 
     581   { 
     582   *lin = (*lin)->suiv; 
     583   parcours1 = *lin; 
     584   } 
     585   else 
     586   { 
     587   parcourspres->suiv = parcours1->suiv; 
     588   parcours1 = parcourspres->suiv; 
     589   } 
     590   } 
     591   else 
     592   { 
     593   parcourspres = parcours1; 
     594    parcours1 = parcours1->suiv;   
     595    } 
     596  } 
     597} 
     598 
     599void writelistpublic(listname *lin) 
     600{ 
     601  listname *parcours1; 
     602  char ligne[LONG_40M]; 
     603  char tempname[LONG_4M]; 
     604   
     605  if (lin) 
     606  { 
     607  sprintf(ligne,"public :: "); 
     608  parcours1 = lin; 
     609   
     610  while (parcours1) 
     611  { 
     612    strcat(ligne,parcours1->n_name); 
     613    if (parcours1->suiv) strcat(ligne,", "); 
     614    parcours1 = parcours1->suiv;   
     615  } 
     616  tofich(fortranout,ligne,1); 
     617  } 
     618 
     619} 
Note: See TracChangeset for help on using the changeset viewer.