Changeset 1200 for trunk/AGRIF/LIB/UtilFortran.c
- Timestamp:
- 2008-09-24T15:05:20+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AGRIF/LIB/UtilFortran.c
r774 r1200 167 167 /* This subroutine is to know if a variable is global */ 168 168 /******************************************************************************/ 169 void variableisglobalinmodule(listcouple *listin, char *module, FILE *fileout )169 void variableisglobalinmodule(listcouple *listin, char *module, FILE *fileout, long int oldposcuruse) 170 170 { 171 171 int Globalite; … … 175 175 listvar *newvar2; 176 176 int out; 177 char truename[LONG_C]; 177 178 178 179 Globalite = 1; … … 181 182 tempo = Readthedependfile(module,tempo); 182 183 newvar = listin; 184 183 185 while ( newvar ) 184 186 { 187 if (!strcmp(newvar->c_namepointedvar,"")) { 188 strcpy(truename,newvar->c_namevar); 189 } 190 else 191 { 192 strcpy(truename,newvar->c_namepointedvar); 193 } 194 185 195 out = 0; 186 196 newvar2 = tempo; 187 197 while ( newvar2 && out == 0 ) 188 198 { 189 if ( !strcasecmp(newvar2->var->v_nomvar, newvar->c_namevar) ) out = 1;199 if ( !strcasecmp(newvar2->var->v_nomvar,truename) ) out = 1; 190 200 else newvar2 = newvar2 ->suiv; 191 201 } … … 213 223 if ( Globalite == 0 || !newvar) 214 224 { 215 pos_end = setposcur(); 216 RemoveWordSET_0(fileout,pos_curuse, 217 pos_end-pos_curuse); 225 pos_end = setposcurname(fileout); 226 RemoveWordSET_0(fileout,oldposcuruse, 227 pos_end-oldposcuruse); 228 218 229 newvar = listin; 219 230 while ( newvar ) … … 234 245 } 235 246 236 void Remove_Word_end_module_0( )237 { 238 if ( firstpass == 0 ) 239 { 240 RemoveWordCUR_0(fortranout,(long)(- strlen(curmodulename)-12),241 strlen(curmodulename)+11);247 void Remove_Word_end_module_0(int modulenamelength) 248 { 249 if ( firstpass == 0 ) 250 { 251 RemoveWordCUR_0(fortranout,(long)(-modulenamelength-12), 252 modulenamelength+11); 242 253 } 243 254 } … … 470 481 if ( !strcasecmp(parcours->var->v_modulename,curmodulename) ) 471 482 { 472 writevardeclaration(parcours,module_declar,0 );483 writevardeclaration(parcours,module_declar,0,1); 473 484 } 474 485 parcours = parcours -> suiv; 475 486 } 487 } 488 } 489 490 void Write_GlobalType_Declaration_0() 491 { 492 listvar *parcours; 493 int out = 0; 494 int headtypewritten = 0; 495 char ligne[LONGNOM]; 496 int changeval; 497 498 if ( firstpass == 0 ) 499 { 500 parcours = List_Global_Var; 501 while( parcours ) 502 { 503 if ( !strcasecmp(parcours->var->v_modulename,curmodulename) ) 504 { 505 if (!strcasecmp(parcours->var->v_typevar,"type")) 506 { 507 out = 1; 508 if (headtypewritten == 0) 509 { 510 sprintf(ligne,"TYPE :: Agrif_%s",curmodulename); 511 tofich(module_declar,ligne,1); 512 headtypewritten = 1; 513 } 514 changeval = 0; 515 if (parcours->var->v_allocatable == 1) 516 { 517 changeval = 1; 518 parcours->var->v_allocatable = 0; 519 parcours->var->v_pointerdeclare = 1; 520 } 521 writevardeclaration(parcours,module_declar,0,0); 522 if (changeval == 1) 523 { 524 parcours->var->v_allocatable = 1; 525 parcours->var->v_pointerdeclare = 0; 526 } 527 } 528 } 529 parcours = parcours -> suiv; 530 } 531 if (out == 1) 532 { 533 sprintf(ligne,"END TYPE Agrif_%s",curmodulename); 534 tofich(module_declar,ligne,1); 535 sprintf(ligne,"TYPE(Agrif_%s), DIMENSION(:), ALLOCATABLE :: Agrif_%s_var",curmodulename,curmodulename); 536 tofich(module_declar,ligne,1); 537 } 476 538 } 477 539 } … … 488 550 if ( !strcasecmp(parcours->var->v_modulename,curmodulename) ) 489 551 { 490 writevardeclaration(parcours,fortranout,0 );552 writevardeclaration(parcours,fortranout,0,1); 491 553 } 492 554 parcours = parcours -> suiv; … … 648 710 } 649 711 712 /******************************************************************************/ 713 /* varistyped_0 */ 714 /******************************************************************************/ 715 /* Firstpass 0 */ 716 /******************************************************************************/ 717 /* */ 718 /******************************************************************************/ 719 int varistyped_0(char *ident) 720 { 721 listvar *parcours; 722 int out; 723 724 out =0; 725 if ( firstpass == 0 ) 726 { 727 parcours = List_Global_Var; 728 while( parcours && out == 0 ) 729 { 730 if ( !strcasecmp(ident,parcours->var->v_nomvar) ) 731 { 732 if (!strcasecmp(parcours->var->v_typevar,"type")) out = 1; 733 } 734 parcours = parcours->suiv; 735 } 736 } 737 return out; 738 } 739 650 740 651 741 /******************************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.