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/UtilCharacter.c – 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/UtilCharacter.c

    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#include <stdio.h> 
     
    5656   listvar *newvar; 
    5757   int out; 
    58     
     58 
    5959   if ( strcasecmp(name,"") ) 
    6060   { 
     
    6363      while( newvar && out == 0 ) 
    6464      { 
    65          if ( !strcasecmp(newvar->var->nomvar,name) ) 
     65         if ( !strcasecmp(newvar->var->v_nomvar,name) ) 
    6666         { 
    6767            out = 1; 
     
    8484/*                                                                            */ 
    8585/******************************************************************************/ 
    86 char *ChangeTheInitalvaluebyTabvarsName(char *nom,listvar *listtoread, int whichone) 
     86char *ChangeTheInitalvaluebyTabvarsName(char *nom,listvar *listtoread, 
     87                                                                   int whichone) 
    8788{ 
    8889   char toprinttmp[LONGNOM]; 
    8990   int i; 
    9091   char chartmp[2]; 
    91     
     92 
    9293   i=0; 
    9394   strcpy(toprintglob,""); 
     
    9697   while ( i < strlen(nom) ) 
    9798   { 
    98       if ( nom[i] == '+' )  
     99      if ( nom[i] == '+' ) 
    99100      { 
    100101         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 
     
    102103         strcat(toprintglob,"+"); 
    103104      } 
    104       else if ( nom[i] == '-' )  
     105      else if ( nom[i] == '-' ) 
    105106      { 
    106107         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 
     
    146147      else 
    147148      { 
    148          sprintf(chartmp,"%c",nom[i]);         
     149         sprintf(chartmp,"%c",nom[i]); 
    149150         strcat(toprinttmp,chartmp); 
    150151      } 
     
    154155   FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 
    155156   strcpy(toprinttmp,""); 
    156     
     157 
    157158   /*                                                                         */ 
    158159   return toprintglob; 
     
    171172{ 
    172173   int Real; 
    173     
     174 
    174175   Real = 0; 
    175176   if ( ( nom[0] >= 'a' && nom[0] <= 'h' ) || 
     
    201202   out = 0; 
    202203 
    203    parcours = globliste; 
     204   parcours = List_Global_Var; 
    204205   while( parcours && out == 0 ) 
    205206   { 
    206       if ( !strcasecmp(nom,parcours->var->nomvar) ) out =1 ; 
     207      if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =1 ; 
    207208     else parcours=parcours->suiv; 
    208209   } 
    209210   if ( out == 0 ) 
    210211   { 
    211       parcours = globparam; 
     212      parcours = List_Common_Var; 
    212213      while( parcours && out == 0 ) 
    213214      { 
    214          if ( !strcasecmp(nom,parcours->var->nomvar) ) out =1 ; 
     215         if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =1 ; 
    215216        else parcours=parcours->suiv; 
    216217      } 
     
    218219   if ( out == 0 ) 
    219220   { 
    220       parcours = parameterlist; 
     221      parcours = List_GlobalParameter_Var; 
    221222      while( parcours && out == 0 ) 
    222223      { 
    223          if ( !strcasecmp(nom,parcours->var->nomvar) ) out =1 ; 
     224         if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =1 ; 
    224225        else parcours=parcours->suiv; 
    225226      } 
     
    227228   if ( out == 0 ) 
    228229   { 
    229       parcoursparam = tmpparameterlocallist; 
     230      parcours = List_Parameter_Var; 
     231      while( parcours && out == 0 ) 
     232      { 
     233         if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =1 ; 
     234        else parcours=parcours->suiv; 
     235      } 
     236   } 
     237   if ( out == 0 ) 
     238   { 
     239      parcoursparam = List_GlobParamModuleUsed_Var; 
    230240      while( parcoursparam && out == 0 ) 
    231241      { 
    232          if ( !strcasecmp(nom,parcoursparam->name) ) out =2 ; 
     242         if ( !strcasecmp(nom,parcoursparam->p_name) ) out =2 ; 
    233243         else parcoursparam=parcoursparam->suiv; 
    234244      } 
     
    236246   if ( out == 0 ) 
    237247   { 
    238       parcours = globalvarofusefile; 
     248      parcours = List_ModuleUsed_Var; 
    239249      while( parcours && out == 0 ) 
    240250      { 
    241          if ( !strcasecmp(nom,parcours->var->nomvar) ) out =2 ; 
     251         if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =2 ; 
    242252        else parcours=parcours->suiv; 
    243253      } 
     
    245255   if ( out == 0 || out == 2 ) 
    246256   { 
    247       parcoursparam = tmpparameterlocallist2; 
     257      parcoursparam = List_GlobParamModuleUsedInModuleUsed_Var; 
    248258      while( parcoursparam && out != 1 ) 
    249259      { 
    250          if ( !strcasecmp(nom,parcoursparam->name) ) out =1 ; 
     260         if ( !strcasecmp(nom,parcoursparam->p_name) ) out =1 ; 
    251261         else parcoursparam=parcoursparam->suiv; 
    252262      } 
    253       if ( out == 1 )  
    254       { 
    255          strcpy(charusemodule,parcoursparam->modulename); 
    256          Addmoduletothelist(parcoursparam->modulename); 
    257       } 
    258    } 
    259    if ( out == 0 ) printf("--- in UtilCharacter we do not found the \n"); 
    260    if ( out == 0 ) printf("---  variable %s, the module where this \n",nom); 
    261    if ( out == 0 ) printf("---  variable has been defined has not been\n"); 
    262    if ( out == 0 ) printf("---  found.\n"); 
     263      if ( out == 1 ) 
     264      { 
     265         strcpy(charusemodule,parcoursparam->p_modulename); 
     266         Addmoduletothelist(parcoursparam->p_modulename); 
     267      } 
     268   } 
     269   if ( out == 0 && 
     270        strcasecmp(nom,"MAX")             && 
     271        strcasecmp(nom,"mpi_status_size") 
     272      ) 
     273   { 
     274      printf("--- in UtilCharacter we do not found the \n"); 
     275      printf("---  variable %s, the module where this \n",nom); 
     276      printf("---  variable has been defined has not been\n"); 
     277      printf("---  found.\n"); 
     278   } 
    263279} 
    264280 
     
    276292   int i; 
    277293   char chartmp[2]; 
    278     
     294 
    279295   i=0; 
    280296   strcpy(toprinttmp,""); 
     
    289305           nom[i] == '(' || 
    290306           nom[i] == ',' || 
    291            nom[i] == ':'  
    292          )  
     307           nom[i] == ':' 
     308         ) 
    293309      { 
    294310         if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 
    295          {  
    296              listout = Addtolistnom(toprinttmp,listout); 
    297               
     311         { 
     312             listout = Addtolistnom(toprinttmp,listout,0); 
    298313         } 
    299314         strcpy(toprinttmp,""); 
     
    301316      else 
    302317      { 
    303          sprintf(chartmp,"%c",nom[i]);         
     318         sprintf(chartmp,"%c",nom[i]); 
    304319         strcat(toprinttmp,chartmp); 
    305320      } 
     
    307322      i=i+1; 
    308323   } 
    309    if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) )  
    310    {  
    311       listout = Addtolistnom(toprinttmp,listout); 
    312    } 
    313    strcpy(toprinttmp,""); 
    314   
    315    return listout;    
     324   if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 
     325   { 
     326      listout = Addtolistnom(toprinttmp,listout,0); 
     327   } 
     328   strcpy(toprinttmp,""); 
     329 
     330   return listout; 
    316331} 
    317332 
     
    331346   int i; 
    332347   char chartmp[2]; 
    333     
     348 
    334349   i=0; 
    335350   strcpy(toprinttmp,""); 
     
    344359           nom[i] == '(' || 
    345360           nom[i] == ',' || 
    346            nom[i] == ':'  
    347          )  
     361           nom[i] == ':' 
     362         ) 
    348363      { 
    349364         if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 
    350          {  
     365         { 
    351366            ajoutevarindoloop_definedimension (toprinttmp); 
    352367            /* Is this variable present in globvarofusefile                   */ 
     
    357372      else 
    358373      { 
    359          sprintf(chartmp,"%c",nom[i]);         
     374         sprintf(chartmp,"%c",nom[i]); 
    360375         strcat(toprinttmp,chartmp); 
    361376      } 
     
    363378      i=i+1; 
    364379   } 
    365    if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) )  
    366    {  
     380   if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 
     381   { 
    367382      ajoutevarindoloop_definedimension (toprinttmp); 
    368383      /* Is this variable present in globvarofusefile                         */ 
     
    370385   } 
    371386   strcpy(toprinttmp,""); 
    372     
    373 } 
     387 
     388} 
     389 
     390void convert2lower(char *name) 
     391{ 
     392   int l; 
     393   int i; 
     394   int caractere; 
     395 
     396   l=strlen(name)-1; 
     397   for (i=0;i<=l;i++) 
     398   { 
     399      caractere=name[i]; 
     400      if ((caractere>=65 && caractere<=90)||(caractere>=192 && caractere<=221)) 
     401      { 
     402         name[i]+=32; 
     403      } 
     404   } 
     405} 
Note: See TracChangeset for help on using the changeset viewer.