Changeset 774 for trunk/AGRIF/LIB/WorkWithlistvarindoloop.c
- Timestamp:
- 2007-12-18T17:45:53+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AGRIF/LIB/WorkWithlistvarindoloop.c
r663 r774 31 31 /* knowledge of the CeCILL-C license and that you accept its terms. */ 32 32 /******************************************************************************/ 33 /* version 1. 6*/33 /* version 1.7 */ 34 34 /******************************************************************************/ 35 35 #include <stdio.h> … … 66 66 newvar->suiv = NULL; 67 67 strcpy(newvar->var->v_nomvar,ident); 68 Save_Length(ident,4); 68 69 strcpy(newvar->var->v_modulename,curmodulename); 70 Save_Length(curmodulename,6); 69 71 strcpy(newvar->var->v_commoninfile,mainfile); 72 Save_Length(mainfile,10); 70 73 strcpy(newvar->var->v_subroutinename,subroutinename); 74 Save_Length(subroutinename,11); 71 75 newvar->var->v_pointedvar=pointedvar; 72 76 List_UsedInSubroutine_Var = newvar ; … … 92 96 /* */ 93 97 strcpy(newvar->var->v_nomvar,ident); 98 Save_Length(ident,4); 94 99 strcpy(newvar->var->v_commoninfile,mainfile); 100 Save_Length(mainfile,10); 95 101 strcpy(newvar->var->v_modulename,curmodulename); 102 Save_Length(curmodulename,6); 96 103 strcpy(newvar->var->v_subroutinename,subroutinename); 104 Save_Length(subroutinename,11); 97 105 newvar->var->v_pointedvar=pointedvar; 98 106 newvar->suiv = List_UsedInSubroutine_Var; … … 126 134 newvar->suiv = NULL; 127 135 strcpy(newvar->var->v_nomvar,name); 136 Save_Length(name,4); 128 137 strcpy(newvar->var->v_modulename,curmodulename); 138 Save_Length(curmodulename,6); 129 139 strcpy(newvar->var->v_commoninfile,mainfile); 140 Save_Length(mainfile,10); 130 141 strcpy(newvar->var->v_subroutinename,subroutinename); 142 Save_Length(subroutinename,11); 131 143 newvar->var->v_pointedvar=pointedvar; 132 144 List_UsedInSubroutine_Var = newvar ; … … 169 181 /* */ 170 182 strcpy(newvar->var->v_nomvar,name); 183 Save_Length(name,4); 171 184 strcpy(newvar->var->v_modulename,curmodulename); 185 Save_Length(curmodulename,6); 172 186 strcpy(newvar->var->v_commoninfile,mainfile); 187 Save_Length(mainfile,10); 173 188 strcpy(newvar->var->v_subroutinename,subroutinename); 189 Save_Length(subroutinename,11); 174 190 newvar->var->v_pointedvar=pointedvar; 175 191 /* we should find this new variable to know the tabvars indice */ … … 390 406 int out; 391 407 408 parcoursprec = (listvar *)NULL; 392 409 parcours = list_to_modify; 393 410 while( parcours ) … … 453 470 listvar *parcours; 454 471 listvar *newvar; 455 listvar *parcours1; 456 char ligne[LONGNOM]; 457 int out; 472 char ligne[LONG_C]; 458 473 459 474 parcours = List_Save_Var; … … 475 490 Add_NameOfCommon_1(ligne); 476 491 strcpy(newvar->var->v_commonname,ligne); 492 Save_Length(ligne,7); 477 493 List_Common_Var = AddListvarToListvar(newvar,List_Common_Var,1); 478 494 } … … 751 767 } 752 768 769 int LookingForVariableInListName(listvar *listin,char *name) 770 { 771 listvar *parcours1; 772 int out; 773 774 parcours1 = listin; 775 out = 0 ; 776 while ( parcours1 && out == 0 ) 777 { 778 if ( !strcasecmp(name,parcours1->var->v_nomvar) && 779 ( !strcasecmp(subroutinename,parcours1->var->v_subroutinename) || 780 !strcasecmp(subroutinename,"") ) 781 ) out = 1 ; 782 else parcours1 = parcours1 -> suiv; 783 } 784 785 return out; 786 } 787 753 788 int LookingForVariableInListGlob(listvar *listin,variable *var) 754 789 { … … 809 844 int remove; 810 845 846 parcoursprec = (listvar *)NULL; 811 847 parcours = List_UsedInSubroutine_Var; 812 848 while ( parcours ) … … 865 901 866 902 903 void Clean_List_ModuleUsed_Var() 904 { 905 listvar *parcours; 906 listvar *parcours1; 907 listvar *parcoursprec; 908 int remove; 909 910 parcoursprec = (listvar *)NULL; 911 parcours = List_ModuleUsed_Var; 912 while ( parcours ) 913 { 914 /* */ 915 parcours1 = List_GlobalParameter_Var; 916 remove = 0 ; 917 while ( parcours1 && remove == 0 ) 918 { 919 if ( !strcasecmp(parcours->var->v_nomvar,parcours1->var->v_nomvar) 920 ) remove = 1 ; 921 else parcours1 = parcours1 -> suiv; 922 } 923 /************************************************************************/ 924 /* Remove */ 925 /************************************************************************/ 926 if ( remove == 1 ) 927 { 928 if ( parcours == List_ModuleUsed_Var ) 929 { 930 List_ModuleUsed_Var = List_ModuleUsed_Var -> suiv; 931 parcours = List_ModuleUsed_Var; 932 } 933 else 934 { 935 parcoursprec->suiv = parcours->suiv; 936 parcours = parcoursprec -> suiv ; 937 } 938 } 939 else 940 { 941 parcoursprec = parcours; 942 parcours = parcours -> suiv ; 943 } 944 } 945 946 } 947 867 948 void Clean_List_SubroutineDeclaration_Var() 868 949 { … … 872 953 int out ; 873 954 955 parcoursprec = (listvar *)NULL; 874 956 parcours = List_SubroutineDeclaration_Var; 875 957 while ( parcours ) … … 923 1005 } 924 1006 1007 void Clean_List_Global_Var() 1008 { 1009 listvar *parcours; 1010 listvar *parcours2; 1011 listvar *parcoursprec; 1012 listvar *parcours2prec; 1013 1014 parcoursprec = (listvar *)NULL; 1015 parcours2prec = (listvar *)NULL; 1016 parcours = List_Global_Var; 1017 while ( parcours ) 1018 { 1019 if ( parcours->var->v_VariableIsParameter == 1 ) 1020 { 1021 /* remove */ 1022 if ( parcours == List_Global_Var ) 1023 { 1024 List_Global_Var = List_Global_Var->suiv; 1025 free(parcours); 1026 parcours = List_Global_Var; 1027 } 1028 else 1029 { 1030 parcoursprec->suiv = parcours->suiv; 1031 free(parcours); 1032 parcours = parcoursprec->suiv; 1033 } 1034 } 1035 else 1036 { 1037 parcoursprec = parcours; 1038 parcours = parcours->suiv; 1039 } 1040 } 1041 /* looking for sevral declaration of the same variable */ 1042 parcours = List_Global_Var; 1043 while ( parcours ) 1044 { 1045 parcours2prec = parcours; 1046 parcours2 = parcours->suiv; 1047 while ( parcours2 ) 1048 { 1049 if ( !strcasecmp(parcours->var->v_nomvar, 1050 parcours2->var->v_nomvar) && 1051 !strcasecmp(parcours->var->v_modulename, 1052 parcours2->var->v_modulename) ) 1053 { 1054 CopyRecord(parcours->var,parcours2->var); 1055 /* remove var from the parcours2 */ 1056 parcours2prec ->suiv = parcours2->suiv; 1057 free(parcours2); 1058 parcours2 = parcours2prec ->suiv; 1059 } 1060 else 1061 { 1062 parcours2prec = parcours2; 1063 parcours2 = parcours2->suiv; 1064 } 1065 } 1066 parcours = parcours->suiv; 1067 } 1068 } 925 1069 /******************************************************************************/ 926 1070 /* ListClean */ … … 932 1076 listvar *newvar; 933 1077 934 1078 Clean_List_ModuleUsed_Var(); 935 1079 Clean_List_UsedInSubroutine_Var(); 936 1080 Clean_List_SubroutineDeclaration_Var(); 937 938 1081 939 1082 newvar = (listvar *)NULL; … … 978 1121 /* newvar = List_Common_Var;*/ 979 1122 /* newvar = List_UsedInSubroutine_Var;*/ 980 while(newvar) 981 { 982 printf("----- %s --- %s ---%s---\n",newvar->var->v_nomvar, 983 newvar->var->v_commonname,newvar->var->v_readedlistdimension 984 ); 985 newvar = newvar -> suiv; 1123 while ( newvar ) 1124 { 1125 printf("++++ %s %d %s %s %s\n", 1126 newvar->var->v_nomvar, 1127 newvar->var->v_VariableIsParameter, 1128 newvar->var->v_subroutinename, 1129 newvar->var->v_modulename, 1130 newvar->var->v_typevar 1131 ); 1132 newvar = newvar->suiv; 986 1133 } 987 1134 } … … 1049 1196 int position; 1050 1197 int out; 1051 char name_sub[LONG NOM];1198 char name_sub[LONG_C]; 1052 1199 1053 1200 parcours = List_SubroutineArgument_Var; … … 1125 1272 listindice *newindice; 1126 1273 int out; 1274 1275 parcoursprec = (listvar *)NULL; 1127 1276 1128 1277 if ( mark == 1 ) printf("MODULE Treated %s \n",nom); … … 1258 1407 int out; 1259 1408 1409 parcoursprec = (listvar *)NULL; 1410 1260 1411 if ( mark == 1 ) printf("COMMON Treated %s \n",nom); 1261 1412 … … 1373 1524 void IndiceTabvarsIdentification() 1374 1525 { 1375 listvar *parcours;1376 1526 listnom *parcours_nom; 1377 1527 … … 1473 1623 void NewModule_Creation_0() 1474 1624 { 1475 listvar *parcours;1476 1625 listnom *parcours_nom; 1477 char name_tmp[LONGNOM]; 1478 char ligne[LONGNOM]; 1626 char ligne[LONG_C]; 1479 1627 1480 1628 if ( firstpass == 0 ) … … 1529 1677 listvar *parcours4; 1530 1678 int out; 1531 char name_module[LONG NOM];1679 char name_module[LONG_C]; 1532 1680 1533 1681 /* We should integrate allocate and pointer variables */
Note: See TracChangeset
for help on using the changeset viewer.