Changeset 663 for trunk/AGRIF/LIB/UtilCharacter.c
- Timestamp:
- 2007-05-25T18:00:33+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AGRIF/LIB/UtilCharacter.c
r530 r663 3 3 /* CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran) */ 4 4 /* */ 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) */ 7 7 /* This software is governed by the CeCILL-C license under French law and */ 8 8 /* abiding by the rules of distribution of free software. You can use, */ … … 31 31 /* knowledge of the CeCILL-C license and that you accept its terms. */ 32 32 /******************************************************************************/ 33 /* version 1. 0*/33 /* version 1.6 */ 34 34 /******************************************************************************/ 35 35 #include <stdio.h> … … 56 56 listvar *newvar; 57 57 int out; 58 58 59 59 if ( strcasecmp(name,"") ) 60 60 { … … 63 63 while( newvar && out == 0 ) 64 64 { 65 if ( !strcasecmp(newvar->var-> nomvar,name) )65 if ( !strcasecmp(newvar->var->v_nomvar,name) ) 66 66 { 67 67 out = 1; … … 84 84 /* */ 85 85 /******************************************************************************/ 86 char *ChangeTheInitalvaluebyTabvarsName(char *nom,listvar *listtoread, int whichone) 86 char *ChangeTheInitalvaluebyTabvarsName(char *nom,listvar *listtoread, 87 int whichone) 87 88 { 88 89 char toprinttmp[LONGNOM]; 89 90 int i; 90 91 char chartmp[2]; 91 92 92 93 i=0; 93 94 strcpy(toprintglob,""); … … 96 97 while ( i < strlen(nom) ) 97 98 { 98 if ( nom[i] == '+' ) 99 if ( nom[i] == '+' ) 99 100 { 100 101 FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); … … 102 103 strcat(toprintglob,"+"); 103 104 } 104 else if ( nom[i] == '-' ) 105 else if ( nom[i] == '-' ) 105 106 { 106 107 FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); … … 146 147 else 147 148 { 148 sprintf(chartmp,"%c",nom[i]); 149 sprintf(chartmp,"%c",nom[i]); 149 150 strcat(toprinttmp,chartmp); 150 151 } … … 154 155 FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 155 156 strcpy(toprinttmp,""); 156 157 157 158 /* */ 158 159 return toprintglob; … … 171 172 { 172 173 int Real; 173 174 174 175 Real = 0; 175 176 if ( ( nom[0] >= 'a' && nom[0] <= 'h' ) || … … 201 202 out = 0; 202 203 203 parcours = globliste;204 parcours = List_Global_Var; 204 205 while( parcours && out == 0 ) 205 206 { 206 if ( !strcasecmp(nom,parcours->var-> nomvar) ) out =1 ;207 if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =1 ; 207 208 else parcours=parcours->suiv; 208 209 } 209 210 if ( out == 0 ) 210 211 { 211 parcours = globparam;212 parcours = List_Common_Var; 212 213 while( parcours && out == 0 ) 213 214 { 214 if ( !strcasecmp(nom,parcours->var-> nomvar) ) out =1 ;215 if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =1 ; 215 216 else parcours=parcours->suiv; 216 217 } … … 218 219 if ( out == 0 ) 219 220 { 220 parcours = parameterlist;221 parcours = List_GlobalParameter_Var; 221 222 while( parcours && out == 0 ) 222 223 { 223 if ( !strcasecmp(nom,parcours->var-> nomvar) ) out =1 ;224 if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =1 ; 224 225 else parcours=parcours->suiv; 225 226 } … … 227 228 if ( out == 0 ) 228 229 { 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; 230 240 while( parcoursparam && out == 0 ) 231 241 { 232 if ( !strcasecmp(nom,parcoursparam-> name) ) out =2 ;242 if ( !strcasecmp(nom,parcoursparam->p_name) ) out =2 ; 233 243 else parcoursparam=parcoursparam->suiv; 234 244 } … … 236 246 if ( out == 0 ) 237 247 { 238 parcours = globalvarofusefile;248 parcours = List_ModuleUsed_Var; 239 249 while( parcours && out == 0 ) 240 250 { 241 if ( !strcasecmp(nom,parcours->var-> nomvar) ) out =2 ;251 if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =2 ; 242 252 else parcours=parcours->suiv; 243 253 } … … 245 255 if ( out == 0 || out == 2 ) 246 256 { 247 parcoursparam = tmpparameterlocallist2;257 parcoursparam = List_GlobParamModuleUsedInModuleUsed_Var; 248 258 while( parcoursparam && out != 1 ) 249 259 { 250 if ( !strcasecmp(nom,parcoursparam-> name) ) out =1 ;260 if ( !strcasecmp(nom,parcoursparam->p_name) ) out =1 ; 251 261 else parcoursparam=parcoursparam->suiv; 252 262 } 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 } 263 279 } 264 280 … … 276 292 int i; 277 293 char chartmp[2]; 278 294 279 295 i=0; 280 296 strcpy(toprinttmp,""); … … 289 305 nom[i] == '(' || 290 306 nom[i] == ',' || 291 nom[i] == ':' 292 ) 307 nom[i] == ':' 308 ) 293 309 { 294 310 if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 295 { 296 listout = Addtolistnom(toprinttmp,listout); 297 311 { 312 listout = Addtolistnom(toprinttmp,listout,0); 298 313 } 299 314 strcpy(toprinttmp,""); … … 301 316 else 302 317 { 303 sprintf(chartmp,"%c",nom[i]); 318 sprintf(chartmp,"%c",nom[i]); 304 319 strcat(toprinttmp,chartmp); 305 320 } … … 307 322 i=i+1; 308 323 } 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; 316 331 } 317 332 … … 331 346 int i; 332 347 char chartmp[2]; 333 348 334 349 i=0; 335 350 strcpy(toprinttmp,""); … … 344 359 nom[i] == '(' || 345 360 nom[i] == ',' || 346 nom[i] == ':' 347 ) 361 nom[i] == ':' 362 ) 348 363 { 349 364 if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 350 { 365 { 351 366 ajoutevarindoloop_definedimension (toprinttmp); 352 367 /* Is this variable present in globvarofusefile */ … … 357 372 else 358 373 { 359 sprintf(chartmp,"%c",nom[i]); 374 sprintf(chartmp,"%c",nom[i]); 360 375 strcat(toprinttmp,chartmp); 361 376 } … … 363 378 i=i+1; 364 379 } 365 if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 366 { 380 if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 381 { 367 382 ajoutevarindoloop_definedimension (toprinttmp); 368 383 /* Is this variable present in globvarofusefile */ … … 370 385 } 371 386 strcpy(toprinttmp,""); 372 373 } 387 388 } 389 390 void 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.