New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
dependfile.c in trunk/AGRIF/LIB – NEMO

source: trunk/AGRIF/LIB/dependfile.c @ 396

Last change on this file since 396 was 396, checked in by opalod, 18 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 30.7 KB
Line 
1/******************************************************************************/
2/*                                                                            */
3/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
4/*                                                                            */
5/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
6/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
7/*                                                                            */
8/*     This program is free software; you can redistribute it and/or modify   */
9/*    it                                                                      */
10/*                                                                            */
11/*    This program is distributed in the hope that it will be useful,         */
12/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
13/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
14/*    GNU General Public License for more details.                            */
15/*                                                                            */
16/******************************************************************************/
17#include <stdio.h>
18#include <stdlib.h>
19#include <string.h>
20#include "decl.h"
21
22
23/******************************************************************************/
24/*            Creation and modification of .dependfile                        */
25/******************************************************************************/
26/*  .dependnbxnby            : this file contains tabvars indices of variables*/
27/*                                given in agrif.in as number of cells        */
28/*  .dependuse<module>       : this file contains all modules used in the     */
29/*                                current file                                */
30/*  .dependparameter<module> : this file contains all parmeters defined in    */
31/*                                the current file                            */
32/*  .depend<module name>     : this file contains all globals variables       */
33/*                                informations (name, dim, etc ...)           */
34/*  .dependavailable         : this file contains all tabvars indices which   */
35/*                                are not used.                               */
36/******************************************************************************/
37
38
39/******************************************************************************/
40/*                 Writethedependnbxnbyfile                                   */
41/******************************************************************************/
42/* This subroutine is used to create the .dependnbxnby                        */
43/******************************************************************************/
44/*                                                                            */
45/*                     .dependnbxnby                                          */
46/*                                                                            */
47/*                     nbmaillesX                                             */
48/*                     nbmaillesY                                             */
49/*                     nbmaillesZ                                             */
50/*                                                                            */
51/******************************************************************************/
52void Writethedependnbxnbyfile()
53{
54  FILE *dependfileoutput;
55  listvar *parcours;
56  int out;
57   
58  /* We are looking for all the variable of the current filetoparse file      */
59  /*    in the globliste                                                      */
60  parcours =globliste;
61  out = 0;
62  while (parcours && out == 0 )
63  {
64     if ( !strcasecmp(parcours->var->nomvar,nbmaillesX) ) out = 1;
65     else parcours = parcours->suiv;
66  }
67  if ( out == 1 ) 
68  {
69     dependfileoutput = fopen(".dependnbxnby","w");
70     fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars);
71     IndicenbmaillesX = parcours->var->indicetabvars;
72
73     if ( dimprob > 1 )
74     {
75        parcours =globliste;
76        out = 0;
77        while (parcours && out == 0 )
78        {
79           if ( !strcasecmp(parcours->var->nomvar,nbmaillesY) ) out = 1;
80           else parcours = parcours->suiv;
81        }
82        if ( out == 1 ) 
83        {
84           fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars);
85           IndicenbmaillesY = parcours->var->indicetabvars;
86        }
87     }
88
89     if ( dimprob > 2 )
90     {
91        parcours =globliste;
92        out = 0;
93        while (parcours && out == 0 )
94        {
95           if ( !strcasecmp(parcours->var->nomvar,nbmaillesZ) ) out = 1;
96           else parcours = parcours->suiv;
97        }
98        if ( out == 1 ) 
99        {
100           fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars);
101           IndicenbmaillesZ = parcours->var->indicetabvars;
102        }
103     }
104
105     if ( out == 1 ) fclose(dependfileoutput);
106   }
107}
108
109/******************************************************************************/
110/*                 Readthedependnbxnbyfile                                    */
111/******************************************************************************/
112/* This subroutine is used to create the .dependnbxnby                        */
113/******************************************************************************/
114/*                                                                            */
115/*                     .dependnbxnby                                          */
116/*                                                                            */
117/*                     nbmaillesX                                             */
118/*                     nbmaillesY                                             */
119/*                     nbmaillesZ                                             */
120/*                                                                            */
121/******************************************************************************/
122void Readthedependnbxnbyfile()
123{
124  FILE *dependfileoutput;
125   
126  if ((dependfileoutput = fopen(".dependnbxnby","r"))!=NULL) 
127  {
128     fscanf(dependfileoutput,"%d\n",&IndicenbmaillesX);
129     if ( dimprob > 1 ) fscanf(dependfileoutput,"%d\n",&IndicenbmaillesY);
130     if ( dimprob > 2 ) fscanf(dependfileoutput,"%d\n",&IndicenbmaillesZ);
131     fclose(dependfileoutput);
132  }
133}
134
135/******************************************************************************/
136/*                     Writethedependlistofmoduleused                         */
137/******************************************************************************/
138/* This subroutine is used to create the .dependuse<module>                   */
139/******************************************************************************/
140/*                                                                            */
141/*               .dependuse<name>                                             */
142/*                                                                            */
143/*               mod1                                                         */
144/*               mod2                                                         */
145/*                                                                            */
146/******************************************************************************/
147void Writethedependlistofmoduleused(char *NameTampon )
148{
149  FILE *dependfileoutput;
150  listusemodule *parcours;
151  char ligne[LONGNOM];
152   
153  if ( listofmodulebysubroutine )
154  {
155     sprintf(ligne,".dependuse%s",NameTampon);
156     dependfileoutput = fopen(ligne,"w");
157     /* We are looking for all the variable of the current filetoparse file   */
158     /*    in the globliste                                                   */
159     parcours = listofmodulebysubroutine;
160     while (parcours)
161     {
162        fprintf(dependfileoutput,"%s\n",parcours->usemodule);
163        parcours = parcours->suiv;
164     }
165     fclose(dependfileoutput);
166  }
167}
168
169/******************************************************************************/
170/*                    Readthedependlistofmoduleused                           */
171/******************************************************************************/
172/* This subroutine is used to create the .dependuse<module>                   */
173/******************************************************************************/
174/*                                                                            */
175/*               .dependuse<name>                                             */
176/*                                                                            */
177/*               mod1                                                         */
178/*               mod2                                                         */
179/*                                                                            */
180/******************************************************************************/
181void Readthedependlistofmoduleused(char *NameTampon)
182{
183  FILE *dependfileoutput;
184  listusemodule *parcours;
185  char ligne[LONGNOM];
186
187  sprintf(ligne,".dependuse%s",NameTampon);
188 
189  tmpuselocallist = (listusemodule *)NULL;
190  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
191  {
192  }
193  else
194  {
195    /* if the file exist we should verify that this file has changed          */
196      while (!feof(dependfileoutput))
197      {
198         parcours=(listusemodule *)malloc(sizeof(listusemodule));
199         fscanf(dependfileoutput,"%s\n",parcours->usemodule);
200
201         parcours->suiv = tmpuselocallist;
202         tmpuselocallist = parcours;
203
204         parcours = NULL;
205      }
206      fclose(dependfileoutput);
207  }
208}
209
210
211/******************************************************************************/
212/*                        WritedependParameterList                            */
213/******************************************************************************/
214/* This subroutine is used to create the .dependparameter<name>               */
215/******************************************************************************/
216/*                                                                            */
217/*               .dependparameter<name>                                       */
218/*                                                                            */
219/*               mod1                                                         */
220/*               mod2                                                         */
221/*                                                                            */
222/******************************************************************************/
223void WritedependParameterList(char *NameTampon )
224{
225  FILE *dependfileoutput;
226  listvar *parcours;
227  char ligne[LONGNOM];
228   
229  if ( globparam )
230  {
231  sprintf(ligne,".dependparameter%s",NameTampon);
232  dependfileoutput = fopen(ligne,"w");
233
234  parcours =globparam;
235  while (parcours)
236  {
237     fprintf(dependfileoutput,"%s\n",parcours->var->nomvar);
238     fprintf(dependfileoutput,"%s\n",parcours->var->modulename);
239     parcours = parcours->suiv;
240  }
241  fclose(dependfileoutput);
242  }
243}
244
245
246/******************************************************************************/
247/*                         ReaddependParameterList                            */
248/******************************************************************************/
249/* This subroutine is used to create the .dependparameter<name>               */
250/******************************************************************************/
251/*                                                                            */
252/*               .dependparameter<name>                                       */
253/*                                                                            */
254/*               mod1                                                         */
255/*               mod2                                                         */
256/*                                                                            */
257/******************************************************************************/
258listparameter *ReaddependParameterList(char *NameTampon,listparameter *listout)
259{
260  FILE *dependfileoutput;
261  listparameter *parcours;
262  char ligne[LONGNOM];
263
264  sprintf(ligne,".dependparameter%s",NameTampon);
265
266  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
267  {
268  }
269  else
270  {
271    /* if the file exist we should verify that this file has changed          */
272      while (!feof(dependfileoutput))
273      {
274         parcours=(listparameter *)malloc(sizeof(listparameter));
275         fscanf(dependfileoutput,"%s\n",parcours->name);
276         fscanf(dependfileoutput,"%s\n",parcours->modulename);
277
278         parcours->suiv = listout;
279         listout = parcours;
280
281         parcours = NULL;
282      }
283      fclose(dependfileoutput);
284  }
285  return listout;
286}
287
288/******************************************************************************/
289/*                   Writethedependfile                                       */
290/******************************************************************************/
291/* This subroutine is used to create the .depend<name>                        */
292/******************************************************************************/
293/*                                                                            */
294/*                     .depend<name>                                          */
295/*                                                                            */
296/*                      REAL                                                  */
297/*                      Variable                                              */
298/*                      char dimension or T                                   */
299/*                      table dimension                                       */
300/*                      is type given                                         */
301/*                      precision or T                                        */
302/*                      initial value or T                                    */
303/*                      indice in the tabvars                                 */
304/*                      listdimension or T                                    */
305/*                      -------------------------                             */
306/*                                                                            */
307/******************************************************************************/
308void Writethedependfile(char *NameTampon, listvar *input )
309{
310  FILE *dependfileoutput;
311  listvar *parcours;
312  listdim *dims;
313  char ligne[LONGNOM];
314  char listdimension[LONGNOM];
315  char curname[LONGNOM];
316  int out;
317   
318  if ( input )
319  {
320  sprintf(ligne,".depend%s",NameTampon);
321  dependfileoutput = fopen(ligne,"w");
322  /* We are looking for all the variable of the current filetoparse file      */
323  /*    in the input                                                          */
324  parcours =input;
325  out = 0;
326  strcpy(curname,"");
327  while (parcours && out == 0 )
328  {
329     if ( !strcasecmp(parcours->var->modulename,NameTampon) ||
330          !strcasecmp(parcours->var->commonname,NameTampon) )
331     {
332        /*                                                                    */
333        if ( strcmp(curname,"") && 
334             !strcmp(curname,parcours->var->nomvar) ) out = 1 ;
335        if ( !strcmp(curname,"") ) strcpy(curname,parcours->var->nomvar);
336        /*                                                                    */
337        if ( out == 0 )
338        {
339           fprintf(dependfileoutput,"%s\n",parcours->var->typevar);
340           fprintf(dependfileoutput,"%s\n",parcours->var->nomvar);
341           if ( strcasecmp(parcours->var->dimchar,"") )
342           {
343              fprintf(dependfileoutput,"%s\n",parcours->var->dimchar);
344           }
345           else
346           {
347              fprintf(dependfileoutput,"T\n");
348           }
349           if ( strcasecmp(parcours->var->commoninfile,"") )
350           {
351              fprintf(dependfileoutput,"%s\n",parcours->var->commoninfile);
352           }
353           else
354           {
355              fprintf(dependfileoutput,"T\n");
356           }
357           if ( strcasecmp(parcours->var->commonname,"") )
358           {
359              fprintf(dependfileoutput,"%s\n",parcours->var->commonname);
360           }
361           else
362           {
363              fprintf(dependfileoutput,"T\n");
364           }
365           fprintf(dependfileoutput,"%d\n",parcours->var->nbdim);
366           fprintf(dependfileoutput,"%d\n",parcours->var->dimensiongiven);
367           fprintf(dependfileoutput,"%d\n",parcours->var->typegiven);
368           fprintf(dependfileoutput,"%d\n",parcours->var->allocatable);
369           fprintf(dependfileoutput,"%d\n",parcours->var->pointerdeclare);
370           if ( strcasecmp(parcours->var->precision,"") )
371           {
372              fprintf(dependfileoutput,"%s\n",parcours->var->precision); 
373           }
374           else
375           {
376              fprintf(dependfileoutput,"T\n");
377           }
378           if ( strcasecmp(parcours->var->initialvalue,"") )
379           {
380              fprintf(dependfileoutput,"%s\n",parcours->var->initialvalue); 
381           }
382           else
383           {
384              fprintf(dependfileoutput,"T\n");
385           }
386           fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars);
387           if ( parcours->var->dimensiongiven == 1 )
388           {
389              dims = parcours->var->dimension;
390              strcpy(listdimension,"");
391              while (dims)
392              {
393                 sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);
394                 strcat(listdimension,ligne);
395                 if ( dims->suiv )
396                 {
397                    strcat(listdimension,",");     
398                 }
399                 dims = dims->suiv;
400              }
401              fprintf(dependfileoutput,"%s\n",listdimension);   
402           }
403           else
404           {
405              fprintf(dependfileoutput,"T\n");
406           }
407           fprintf(dependfileoutput,"------------------------\n");
408        }
409     }
410     parcours = parcours->suiv;
411  }
412  fclose(dependfileoutput);
413  }
414}
415
416/******************************************************************************/
417/*                        Recordtmplocallist                                  */
418/******************************************************************************/
419/* This subroutine is used to read the .depend<name> if the                   */
420/* filetoparse has been read before                                           */
421/* if it is the case we record the .depend<name> in the tmplocallist          */
422/******************************************************************************/
423/*                                                                            */
424/*           .depend<name> -------->  tmplocallist = list of var              */
425/*                                                                            */
426/*        not.depend<name> -------->  tmplocallist = NULL                     */
427/*                                                                            */
428/******************************************************************************/
429void Recordtmplocallist( char *NameTampon)
430{
431  FILE *dependfileoutput;
432  listvar *parcours;
433  listvar *parcoursprec;
434  char ligne[LONGNOM];
435  char nothing[LONGNOM];
436
437  parcoursprec = (listvar *)NULL;
438  sprintf(ligne,".depend%s",NameTampon);
439  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
440  {
441    /* if the file doesn't exist it means that it is the first time           */
442    /*    we tried to parse this file                                         */
443  }
444  else
445  {
446    /* if the file exist we should verify that this file has changed          */
447      while (!feof(dependfileoutput))
448      {
449         parcours=(listvar *)malloc(sizeof(listvar));
450         parcours->var=(variable *)malloc(sizeof(variable));
451         fscanf(dependfileoutput,"%s\n",parcours->var->typevar);
452         fscanf(dependfileoutput,"%s\n",parcours->var->nomvar);
453         fscanf(dependfileoutput,"%s\n",parcours->var->dimchar);
454         if ( !strcasecmp(parcours->var->dimchar,"T") )
455         { 
456            strcpy(parcours->var->dimchar,"");
457         }
458         fscanf(dependfileoutput,"%s\n",parcours->var->commoninfile);
459         if ( !strcasecmp(parcours->var->commoninfile,"T") )
460         { 
461            strcpy(parcours->var->commoninfile,"");
462         }
463         fscanf(dependfileoutput,"%s\n",parcours->var->commonname);
464         if ( !strcasecmp(parcours->var->commonname,"T") )
465         { 
466            strcpy(parcours->var->commonname,"");
467         }
468         fscanf(dependfileoutput,"%d\n",&parcours->var->nbdim);
469         fscanf(dependfileoutput,"%d\n",&parcours->var->dimensiongiven);
470         fscanf(dependfileoutput,"%d\n",&parcours->var->typegiven);
471         fscanf(dependfileoutput,"%d\n",&parcours->var->allocatable);
472         fscanf(dependfileoutput,"%d\n",&parcours->var->pointerdeclare);
473         fscanf(dependfileoutput,"%[^\n] \n",parcours->var->precision);
474         if ( !strcasecmp(parcours->var->precision,"T") )
475         {
476            strcpy(parcours->var->precision,"");
477         }
478         fscanf(dependfileoutput,"%[^\n] \n",parcours->var->initialvalue);
479         if ( !strcasecmp(parcours->var->initialvalue,"T") )
480         {
481            strcpy(parcours->var->initialvalue,"");
482         }
483         fscanf(dependfileoutput,"%d\n",&parcours->var->indicetabvars);
484         fscanf(dependfileoutput,"%s\n",parcours->var->readedlistdimension);
485         if ( !strcasecmp(parcours->var->readedlistdimension,"T") )
486         {
487            strcpy(parcours->var->readedlistdimension,"");
488         }
489         fscanf(dependfileoutput,"%s\n",nothing);
490         parcours->suiv = NULL; 
491         if ( !tmplocallist )
492         { 
493            tmplocallist = parcours;
494            parcoursprec = parcours;
495         }
496         else
497         {
498            parcoursprec->suiv = parcours;
499            parcoursprec = parcours;
500         }
501         parcours = NULL;
502      }
503      fclose(dependfileoutput);
504  }
505}
506
507
508/******************************************************************************/
509/*                     Recordglobalvarofusefile                              */
510/******************************************************************************/
511/* This subroutine is used to read the .dependfile<name> and to insert new    */
512/*    information in the listout list.                                        */
513/******************************************************************************/
514/*                                                                            */
515/*           .dependmodule -------->  globalvarofusefile = list of var        */
516/*                                                                            */
517/*        not.dependmodule -------->                                          */
518/*                                                                            */
519/******************************************************************************/
520listvar *Recordglobalvarofusefile( char *NameTampon , listvar *listout)
521{
522  char ligne[LONGNOM];
523  FILE *dependfileoutput;
524  listvar *parcours0;
525  listvar *parcours;
526  listvar *parcoursprec;
527  char nothing[LONGNOM];
528
529  parcoursprec = (listvar *)NULL;
530  /* we should free the listvar globalvarofusefile                            */
531  sprintf(ligne,".depend%s",NameTampon);
532  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
533  {
534    /* if the file doesn't exist it means that it is the first time           */
535    /*    we tried to parse this file                                         */
536  }
537  else
538  {
539    /* if the file exist we should verify that this file has changed          */
540      while (!feof(dependfileoutput))
541      {
542         parcours=(listvar *)malloc(sizeof(listvar));
543         parcours->var=(variable *)malloc(sizeof(variable));
544         fscanf(dependfileoutput,"%s\n",parcours->var->typevar);
545         fscanf(dependfileoutput,"%s\n",parcours->var->nomvar);
546         fscanf(dependfileoutput,"%s\n",parcours->var->dimchar);
547         if ( !strcasecmp(parcours->var->dimchar,"T") )
548         { 
549            strcpy(parcours->var->dimchar,"");
550         }
551         fscanf(dependfileoutput,"%s\n",parcours->var->commoninfile);
552         if ( !strcasecmp(parcours->var->commoninfile,"T") )
553         { 
554            strcpy(parcours->var->commoninfile,"");
555         }
556         fscanf(dependfileoutput,"%s\n",parcours->var->commonname);
557         if ( !strcasecmp(parcours->var->commonname,"T") )
558         { 
559            strcpy(parcours->var->commonname,"");
560         }
561         fscanf(dependfileoutput,"%d\n",&parcours->var->nbdim);
562         fscanf(dependfileoutput,"%d\n",&parcours->var->dimensiongiven);
563         fscanf(dependfileoutput,"%d\n",&parcours->var->typegiven);
564         fscanf(dependfileoutput,"%d\n",&parcours->var->allocatable);
565         fscanf(dependfileoutput,"%d\n",&parcours->var->pointerdeclare);
566         fscanf(dependfileoutput,"%[^\n] \n",parcours->var->precision);
567         if ( !strcasecmp(parcours->var->precision,"T") )
568         {
569            strcpy(parcours->var->precision,"");
570         }
571         fscanf(dependfileoutput,"%[^\n] \n",parcours->var->initialvalue);
572         if ( !strcasecmp(parcours->var->initialvalue,"T") )
573         {
574            strcpy(parcours->var->initialvalue,"");
575         }
576         fscanf(dependfileoutput,"%d\n",&parcours->var->indicetabvars);
577         fscanf(dependfileoutput,"%s\n",parcours->var->readedlistdimension);
578         if ( !strcasecmp(parcours->var->readedlistdimension,"T") )
579         {
580            strcpy(parcours->var->readedlistdimension,"");
581         }
582         fscanf(dependfileoutput,"%s\n",nothing);
583         parcours->suiv = NULL; 
584         if ( !listout )
585         { 
586            listout = parcours;
587            parcoursprec = parcours;
588         }
589         else
590         {
591            if ( parcoursprec )
592            {
593               parcoursprec->suiv = parcours;
594               parcoursprec = parcours;
595            }
596            else
597            {
598               parcours0 = listout;
599               while ( parcours0->suiv ) parcours0=parcours0->suiv;
600               parcours0->suiv = parcours;
601               parcoursprec = parcours0->suiv;
602            }
603         }
604         parcours = NULL;
605      }
606      fclose(dependfileoutput);
607  }
608  return listout;
609}
610
611/******************************************************************************/
612/*                        Writethedependavailablefile                         */
613/******************************************************************************/
614/* This subroutine is used to write the .dependfileavailable file             */
615/******************************************************************************/
616/*                                                                            */
617/*                                  .dependavailable                          */
618/*     tabvars(1) = var1                                                      */
619/*     tabvars(3) = var1                  2                                   */
620/*     tabvars(4) = var1         =====>   5                                   */
621/*     tabvars(6) = var1                                                      */
622/*     tabvars(7) = var1                                                      */
623/*                                                                            */
624/*                                                                            */
625/*                                                                            */
626/******************************************************************************/
627void Writethedependavailablefile()
628{
629  FILE *dependfileoutput;
630  listindice *parcours;
631
632  if ( Listofavailableindices )
633  {
634  if ((dependfileoutput=fopen(".dependavailable","w"))!=NULL) 
635  {
636     /* We are looking for all the indices of the Listofavailableindices      */
637     parcours = Listofavailableindices;
638     while (parcours)
639     {
640        if ( parcours->indice != 0 )
641        {
642           fprintf(dependfileoutput,"%d\n",parcours->indice);
643        }
644        parcours = parcours->suiv;
645     }
646     fclose(dependfileoutput);
647  }
648  }
649}
650
651/******************************************************************************/
652/*                        Readthedependavailablefile                          */
653/******************************************************************************/
654/* This subroutine is used to read the .dependfileavailable file              */
655/******************************************************************************/
656/*                                                                            */
657/*                                  .dependavailable                          */
658/*     tabvars(1) = var1                                                      */
659/*     tabvars(3) = var1                  2                                   */
660/*     tabvars(4) = var1         =====>   5  ==> Listofavailableindices       */
661/*     tabvars(6) = var1                                                      */
662/*     tabvars(7) = var1                                                      */
663/*                                                                            */
664/*                                                                            */
665/*                                                                            */
666/******************************************************************************/
667void Readthedependavailablefile()
668{
669  FILE *dependfileoutput;
670  listindice *parcours;
671
672  if ((dependfileoutput=fopen(".dependavailable","r"))!=NULL) 
673  {
674     /* We are looking for all the indices of the Listofavailableindices      */
675     Listofavailableindices = (listindice *)NULL;
676     while (!feof(dependfileoutput))
677     {
678        parcours=(listindice *)malloc(sizeof(listindice));
679        fscanf(dependfileoutput,"%d\n",&parcours->indice);
680        if ( parcours->indice != 0 && parcours->indice < 10000000 )
681        {
682           parcours -> suiv = Listofavailableindices;
683           Listofavailableindices = parcours;
684        }
685        else
686        {
687           free(parcours);
688        }
689     }
690     fclose(dependfileoutput);
691  }
692}
693
694
695/******************************************************************************/
696/*                      Did_filetoparse_readed                                */
697/******************************************************************************/
698/* This subroutine is used to know if the .depend<NameTampon> exist           */
699/*    it means if the file has been ever parsed                               */
700/******************************************************************************/
701/*                                                                            */
702/******************************************************************************/
703int Did_filetoparse_readed(char *NameTampon)
704{
705  FILE *dependfileoutput;
706  char ligne[LONGNOM];
707  int out;
708
709  sprintf(ligne,".depend%s",NameTampon);
710  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
711  {
712      out = 0;
713  }
714  else
715  {
716      out = 1;
717      fclose(dependfileoutput);
718  }
719  return out;
720}
Note: See TracBrowser for help on using the repository browser.