- Timestamp:
- 2011-03-30T17:58:35+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMOGCM/EXTERNAL/AGRIF/LIB/WorkWithlistvarindoloop.c
r2528 r2715 66 66 newvar->suiv = NULL; 67 67 strcpy(newvar->var->v_nomvar,ident); 68 68 69 Save_Length(ident,4); 69 70 strcpy(newvar->var->v_modulename,curmodulename); 70 71 Save_Length(curmodulename,6); 72 printf("ICI %d\n",newvar->var->v_module); 73 71 74 strcpy(newvar->var->v_commoninfile,mainfile); 72 75 Save_Length(mainfile,10); … … 75 78 newvar->var->v_pointedvar=pointedvar; 76 79 List_UsedInSubroutine_Var = newvar ; 80 printf("jaoute %s\n",newvar->var->v_nomvar); 77 81 } 78 82 else … … 96 100 /* */ 97 101 strcpy(newvar->var->v_nomvar,ident); 102 98 103 Save_Length(ident,4); 99 104 strcpy(newvar->var->v_commoninfile,mainfile); … … 101 106 strcpy(newvar->var->v_modulename,curmodulename); 102 107 Save_Length(curmodulename,6); 108 printf("ICI %d\n",newvar->var->v_module); 103 109 strcpy(newvar->var->v_subroutinename,subroutinename); 104 110 Save_Length(subroutinename,11); 105 111 newvar->var->v_pointedvar=pointedvar; 106 112 newvar->suiv = List_UsedInSubroutine_Var; 107 List_UsedInSubroutine_Var = newvar; 113 printf("jaoute %s\n",newvar->var->v_nomvar); 114 List_UsedInSubroutine_Var = newvar; 108 115 } 109 116 } … … 134 141 newvar->suiv = NULL; 135 142 strcpy(newvar->var->v_nomvar,name); 143 136 144 Save_Length(name,4); 137 145 strcpy(newvar->var->v_modulename,curmodulename); … … 181 189 /* */ 182 190 strcpy(newvar->var->v_nomvar,name); 191 183 192 Save_Length(name,4); 184 193 strcpy(newvar->var->v_modulename,curmodulename); … … 189 198 Save_Length(subroutinename,11); 190 199 newvar->var->v_pointedvar=pointedvar; 200 191 201 /* we should find this new variable to know the tabvars indice */ 192 202 if ( variableisglobal(newvar, List_Global_Var) == 1 ) … … 303 313 strcpy(var1->v_commonname,var2->v_commonname); 304 314 else strcpy(var2->v_commonname,var1->v_commonname); 315 316 printf("modulenameII = %s %s %d %s\n",var1->v_modulename,var2->v_modulename,var1->v_module,var1->v_nomvar); 317 318 if ( !strcasecmp(var1->v_modulename,"") || (var1->v_module ==0)) 319 strcpy(var1->v_modulename,var2->v_modulename); 320 else strcpy(var2->v_modulename,var1->v_modulename); 305 321 306 322 if ( !strcasecmp(var1->v_vallengspec,"") ) … … 350 366 if ( var1->v_save == 0 ) var1->v_save = var2->v_save ; 351 367 else var2->v_save = var1->v_save ; 352 368 353 369 if ( var1->v_VariableIsParameter == 0 ) 354 370 var1->v_VariableIsParameter = var2->v_VariableIsParameter ; 371 355 372 else var2->v_VariableIsParameter = var1->v_VariableIsParameter ; 356 357 373 if ( var1->v_indicetabvars == 0 ) 374 { 375 358 376 var1->v_indicetabvars = var2->v_indicetabvars ; 377 printf("HERHEHR %s mm %s mm %d\n",var1->v_nomvar,var2->v_modulename,var2->v_indicetabvars); 378 } 359 379 else var2->v_indicetabvars = var1->v_indicetabvars ; 360 380 … … 387 407 if ( var1->v_allocatable == 0 ) var1->v_allocatable = var2->v_allocatable ; 388 408 else var2->v_allocatable = var1->v_allocatable ; 409 410 if ( var1->v_target == 0 ) var1->v_target = var2->v_target ; 411 else var2->v_target = var1->v_target ; 389 412 390 413 if ( var1->v_dimsempty == 0 ) var1->v_dimsempty = var2->v_dimsempty ; … … 424 447 } 425 448 /* if variable has been found */ 426 449 427 450 if ( out == 1 ) CopyRecord(parcours->var,parcours1->var); 428 451 … … 489 512 strcpy(newvar->var->v_subroutinename,parcours->var->v_subroutinename); 490 513 strcpy(newvar->var->v_nomvar,parcours->var->v_nomvar); 514 491 515 sprintf(ligne,"save_%s",parcours->var->v_subroutinename); 492 Add_NameOfCommon_1(ligne );516 Add_NameOfCommon_1(ligne,parcours->var->v_subroutinename); 493 517 strcpy(newvar->var->v_commonname,ligne); 494 518 Save_Length(ligne,7); … … 504 528 /* */ 505 529 newvar->suiv = NULL; 530 506 531 CopyRecord(parcours->var,newvar->var); 507 strcpy(newvar->var->v_subroutinename,""); 532 strcpy(newvar->var->v_subroutinename,parcours->var->v_subroutinename); 533 508 534 strcpy(newvar->var->v_nomvar,parcours->var->v_nomvar); 535 509 536 strcpy(newvar->var->v_modulename,parcours->var->v_modulename); 510 537 List_Global_Var = AddListvarToListvar(newvar,List_Global_Var,1); … … 532 559 while ( parcours1 && out == 0 ) 533 560 { 561 534 562 if ( !strcasecmp(parcours->var->v_nomvar, 535 563 parcours1->var->v_nomvar) && 536 564 !strcasecmp(parcours->var->v_subroutinename, 537 565 parcours1->var->v_subroutinename) 538 ) out = 1; 566 ) { 567 out = 1; 568 } 539 569 else parcours1 = parcours1->suiv; 540 570 } … … 543 573 { 544 574 strcpy(parcours->var->v_commoninfile,parcours1->var->v_commoninfile); 575 545 576 CopyRecord(parcours->var,parcours1->var); 546 577 } … … 559 590 listvar *parcours1; 560 591 int out; 592 int out2; 561 593 562 594 parcours = list_to_modify; 595 563 596 while( parcours ) 564 597 { 598 printf("LE NOM EST %s\n",parcours->var->v_nomvar); 565 599 /* looking in List_Global_Var */ 566 600 567 601 out = 0; 568 if (list_to_modify != List_SubroutineDeclaration_Var) { 602 603 // if (list_to_modify != List_SubroutineDeclaration_Var && list_to_modify != List_UsedInSubroutine_Var) { 604 // parcours1 = List_Global_Var; 605 // while ( parcours1 && out == 0 ) 606 // { 607 // if ( !strcasecmp(parcours->var->v_nomvar, 608 // parcours1->var->v_nomvar) && 609 // !strcasecmp(parcours->var->v_modulename, 610 // parcours1->var->v_modulename) 611 // ) out = 1; 612 // else parcours1 = parcours1->suiv; 613 // } 614 // } 615 616 // if (list_to_modify == List_UsedInSubroutine_Var) { 569 617 parcours1 = List_Global_Var; 570 618 while ( parcours1 && out == 0 ) 571 619 { 620 printf("lenombis est %s\n",parcours1->var->v_nomvar); 572 621 if ( !strcasecmp(parcours->var->v_nomvar, 573 622 parcours1->var->v_nomvar) && 623 !strcasecmp(parcours->var->v_subroutinename, 624 parcours1->var->v_subroutinename) && 574 625 !strcasecmp(parcours->var->v_modulename, 575 626 parcours1->var->v_modulename) 576 ) out = 1; 627 ) { 628 out = 1; 629 } 577 630 else parcours1 = parcours1->suiv; 578 631 } 579 } 580 632 // } 633 581 634 /* if variable has been found */ 582 635 if ( out == 1 ) { … … 588 641 parcours1 = List_SubroutineDeclaration_Var ; 589 642 out = 0; 590 while ( parcours1 && out == 0)643 while ( parcours1) 591 644 { 592 645 if ( !strcasecmp(parcours->var->v_nomvar, … … 596 649 !strcasecmp(parcours->var->v_modulename, 597 650 parcours1->var->v_modulename) 598 ) out = 1; 651 ) { 652 653 out = 1; 654 break; 655 } 599 656 else parcours1 = parcours1->suiv; 600 657 } … … 603 660 if ( out == 1 ) { 604 661 CopyRecord(parcours->var,parcours1->var); 662 605 663 } 606 664 else … … 620 678 } 621 679 /* if variable has been found */ 622 if ( out == 1 ) CopyRecord(parcours->var,parcours1->var); 623 } 680 if ( out == 1 ) { 681 CopyRecord(parcours->var,parcours1->var); 682 } 683 } 624 684 } 625 685 parcours = parcours->suiv; … … 636 696 int out; 637 697 698 638 699 parcours = List_UsedInSubroutine_Var; 639 700 while( parcours ) 640 701 { 641 702 out = 0 ; 703 printf("OIEROZEIR %s %s\n",parcours->var->v_nomvar,parcours->var->v_modulename); 642 704 if ( parcours->var->v_indicetabvars == 0 ) 643 705 { 706 printf("OIEROZEIR %s\n",parcours->var->v_nomvar); 644 707 parcours2 = List_NameOfModuleUsed; 645 708 while( parcours2 ) … … 864 927 remove = LookingForVariableInList(List_SubroutineDeclaration_Var, 865 928 parcours->var); 929 866 930 if ( remove == 0 ) 867 931 remove = LookingForVariableInList(List_Parameter_Var, … … 873 937 remove = LookingForVariableInListGlob(List_GlobalParameter_Var, 874 938 parcours->var); 939 875 940 if ( remove == 0 ) 876 941 remove = LookingForVariableInListParamGlob( 877 942 List_GlobParamModuleUsed_Var,parcours->var); 943 944 878 945 if ( remove == 0 ) 879 946 { … … 885 952 else remove = 1; 886 953 } 954 887 955 /************************************************************************/ 888 956 /* Remove */ 889 957 /************************************************************************/ 958 890 959 if ( remove == 1 ) 891 960 { … … 907 976 } 908 977 } 978 909 979 910 980 } … … 1136 1206 /* newvar = List_Common_Var;*/ 1137 1207 /* newvar = List_UsedInSubroutine_Var;*/ 1208 /* newvar = List_Data_Var;*/ 1138 1209 while ( newvar ) 1139 1210 { 1140 printf("++++ %s %d %s %s%s\n",1211 printf("++++ %s - %d - %s - %s - %s - %s\n", 1141 1212 newvar->var->v_nomvar, 1142 1213 newvar->var->v_VariableIsParameter, 1143 1214 newvar->var->v_subroutinename, 1144 1215 newvar->var->v_modulename, 1145 newvar->var->v_typevar 1216 newvar->var->v_typevar, 1217 newvar->var->v_initialvalue 1146 1218 ); 1147 1219 newvar = newvar->suiv; … … 1642 1714 listnom *parcours_nom; 1643 1715 char ligne[LONG_C]; 1644 1645 1716 if ( firstpass == 0 ) 1646 1717 { … … 1650 1721 if ( parcours_nom->o_val == 1 ) 1651 1722 { 1723 strcpy(ligne,""); 1724 tofich(fortranout,ligne,1); 1652 1725 sprintf (ligne, "module %s",parcours_nom->o_nom); 1653 1726 tofich(fortranout,ligne,1); 1727 WriteUsemoduleDeclaration(parcours_nom->o_subroutinename); 1654 1728 strcpy(ligne,"implicit none"); 1655 1729 tofich(fortranout,ligne,1); … … 1844 1918 } 1845 1919 if ( mark == 1 ) printf("Indicemaxtabvars = %d \n",indicemaxtabvars); 1920 1846 1921 } 1847 1922
Note: See TracChangeset
for help on using the changeset viewer.