Changeset 774 for trunk/AGRIF/LIB/SubLoopCreation.c
- Timestamp:
- 2007-12-18T17:45:53+01:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AGRIF/LIB/SubLoopCreation.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> … … 49 49 /* Firstpass 0 */ 50 50 /* We should write the head of the subroutine sub_loop_<subroutinename> */ 51 /* suborfunc = 1 from subroutine */ 52 /* suborfunc = 2 from function */ 53 /******************************************************************************/ 54 /* */ 55 /******************************************************************************/ 56 void writeheadnewsub_0(int suborfunc) 57 { 58 int out; 59 char ligne[LONGNOM]; 60 listusemodule *newmodule; 51 /******************************************************************************/ 52 /* */ 53 /******************************************************************************/ 54 void writeheadnewsub_0() 55 { 56 char ligne[LONG_C]; 61 57 62 58 if ( firstpass == 0 && IsTabvarsUseInArgument_0() == 1 ) … … 79 75 tofich(fortranout,ligne,1); 80 76 81 /* writesub_loopdeclaration_scalar(List_SubroutineArgument_Var,paramout);*/82 77 WriteArgumentDeclaration_Sort(); 83 /* writesub_loopdeclaration_tab(List_SubroutineArgument_Var,fortranout);*/84 78 85 79 if ( mark == 1 ) fprintf(fortranout,"!!! 222222222222222 \n"); … … 134 128 { 135 129 listvar *parcours; 136 char ligne[LONG NOM];130 char ligne[LONG_C]; 137 131 int compteur; 138 132 … … 230 224 { 231 225 listvar *parcours; 232 char ligne[LONG NOM*100];226 char ligne[LONG_40M]; 233 227 char ligne2[10]; 234 228 int i; 229 int compteur ; 235 230 236 231 if ( todebug == 1 ) printf("Enter in WriteVariablelist_subloop_Call\n"); 237 232 parcours = List_UsedInSubroutine_Var; 233 compteur = 0 ; 238 234 while ( parcours ) 239 235 { … … 248 244 if ( didvariableadded == 0 ) 249 245 { 250 strcpy(ligne,""); 246 if ( retour77 == 1 ) strcpy(ligne,"\n & "); 247 else strcpy(ligne,"\n "); 251 248 } 252 249 else 253 250 { 254 strcpy(ligne,""); 255 strcat(ligne,","); 251 if ( compteur == 0 ) 252 { 253 if ( retour77 == 1 ) strcpy(ligne,"\n & "); 254 else strcpy(ligne,"\n "); 255 } 256 strcat(ligne," , "); 256 257 } 257 258 strcat(ligne,vargridcurgridtabvars(parcours->var,0)); … … 288 289 } 289 290 didvariableadded = 1; 290 if ( retour77 == 0 ) 291 compteur = compteur +1 ; 292 /*if ( retour77 == 0 ) 291 293 { 292 294 strcat(ligne," &"); 293 295 fprintf(outputfile,"\n"); 294 296 } 295 else fprintf(outputfile,"\n & "); 296 tofich(outputfile,ligne,0);297 else fprintf(outputfile,"\n & ");*/ 298 /*tofich(outputfile,ligne,0);*/ 297 299 } 298 300 parcours = parcours -> suiv; 299 301 } 302 Save_Length(ligne,41); 303 tofich(outputfile,ligne,0); 300 304 /* Now we should replace the last ", &" by " &" */ 301 if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR);302 if ( didvariableadded == 0 ) fseek(outputfile,- 2,SEEK_CUR);305 /* if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR); 306 if ( didvariableadded == 0 ) fseek(outputfile,-1,SEEK_CUR);*/ 303 307 if ( todebug == 1 ) printf("Out of WriteVariablelist_subloop_Call\n"); 304 308 } … … 323 327 { 324 328 listvar *parcours; 325 char ligne[LONG NOM];329 char ligne[LONG_40M]; 326 330 int compteur; 327 331 … … 341 345 if ( didvariableadded == 0 ) 342 346 { 343 strcpy(ligne,""); 347 if ( retour77 == 1 ) strcpy(ligne,"\n &"); 348 else strcpy(ligne,"\n "); 344 349 } 345 350 else 346 351 { 347 if ( compteur == 0 ) strcpy(ligne,""); 352 if ( compteur == 0 ) 353 { 354 if ( retour77 == 1 ) strcpy(ligne,"\n & "); 355 else strcpy(ligne,"\n "); 356 } 348 357 strcat(ligne,","); 349 358 } … … 351 360 compteur = compteur + 1; 352 361 didvariableadded = 1; 353 if ( compteur == 3 )362 /* if ( compteur == 3 ) 354 363 { 355 364 if ( retour77 == 0 ) … … 360 369 else fprintf(outputfile,"\n & %s",ligne); 361 370 compteur = 0; 362 } 371 }*/ 363 372 } 364 373 parcours = parcours -> suiv; 365 374 } 366 if ( compteur != 3 && compteur != 0 )375 /* if ( compteur != 3 && compteur != 0 ) 367 376 { 368 377 if ( retour77 == 0 ) fprintf(outputfile,"\n %s &",ligne); 369 378 else fprintf(outputfile,"\n & %s",ligne); 370 } 379 }*/ 380 Save_Length(ligne,41); 381 tofich(outputfile,ligne,0); 371 382 372 383 /* Now we should replace the last ", &" by " &" */ 373 if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR);374 if ( didvariableadded == 0 ) fseek(outputfile,-1,SEEK_CUR); 384 /* if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR); 385 if ( didvariableadded == 0 ) fseek(outputfile,-1,SEEK_CUR);*/ 375 386 if ( todebug == 1 ) printf("Out of WriteVariablelist_subloop_Def\n"); 376 387 } … … 394 405 void WriteHeadofSubroutineLoop() 395 406 { 396 char ligne[LONG NOM];407 char ligne[LONG_C]; 397 408 FILE * subloop; 398 409 … … 412 423 /* */ 413 424 sprintf(ligne,")"); 414 tofich(subloop,ligne,1);425 fprintf(subloop,ligne); 415 426 /* if USE agrif_Uti l should be add */ 416 427 AddUseAgrifUtil_0(subloop); … … 434 445 /* */ 435 446 /******************************************************************************/ 436 void closeandcallsubloopandincludeit_0(int suborfun , char endsub[LONGNOM])437 { 438 char ligne[LONG NOM];447 void closeandcallsubloopandincludeit_0(int suborfun) 448 { 449 char ligne[LONG_C]; 439 450 440 451 if ( firstpass == 0 ) … … 468 479 /* Close the parenthesis of the new subroutine called */ 469 480 sprintf(ligne,")"); 470 tofich(fortranout,ligne,1);481 fprintf(fortranout,ligne); 471 482 /* We should close the original subroutine */ 472 483 if ( suborfun == 3 ) sprintf(ligne,"\n end program %s" … … 489 500 490 501 491 void closeandcallsubloop_contains_0( int suborfun, char endsub[LONGNOM])492 { 493 char ligne[LONG NOM];502 void closeandcallsubloop_contains_0() 503 { 504 char ligne[LONG_C]; 494 505 495 506 if ( firstpass == 0 )
Note: See TracChangeset
for help on using the changeset viewer.