1 | /******************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran) */ |
---|
4 | /* */ |
---|
5 | /* Copyright or © or Copr. Laurent Debreu (Laurent.Debreu@imag.fr) */ |
---|
6 | /* Cyril Mazauric (Cyril.Mazauric@imag.fr) */ |
---|
7 | /* This software is governed by the CeCILL-C license under French law and */ |
---|
8 | /* abiding by the rules of distribution of free software. You can use, */ |
---|
9 | /* modify and/ or redistribute the software under the terms of the CeCILL-C */ |
---|
10 | /* license as circulated by CEA, CNRS and INRIA at the following URL */ |
---|
11 | /* "http://www.cecill.info". */ |
---|
12 | /* */ |
---|
13 | /* As a counterpart to the access to the source code and rights to copy, */ |
---|
14 | /* modify and redistribute granted by the license, users are provided only */ |
---|
15 | /* with a limited warranty and the software's author, the holder of the */ |
---|
16 | /* economic rights, and the successive licensors have only limited */ |
---|
17 | /* liability. */ |
---|
18 | /* */ |
---|
19 | /* In this respect, the user's attention is drawn to the risks associated */ |
---|
20 | /* with loading, using, modifying and/or developing or reproducing the */ |
---|
21 | /* software by the user in light of its specific status of free software, */ |
---|
22 | /* that may mean that it is complicated to manipulate, and that also */ |
---|
23 | /* therefore means that it is reserved for developers and experienced */ |
---|
24 | /* professionals having in-depth computer knowledge. Users are therefore */ |
---|
25 | /* encouraged to load and test the software's suitability as regards their */ |
---|
26 | /* requirements in conditions enabling the security of their systems and/or */ |
---|
27 | /* data to be ensured and, more generally, to use and operate it in the */ |
---|
28 | /* same conditions as regards security. */ |
---|
29 | /* */ |
---|
30 | /* The fact that you are presently reading this means that you have had */ |
---|
31 | /* knowledge of the CeCILL-C license and that you accept its terms. */ |
---|
32 | /******************************************************************************/ |
---|
33 | /* version 1.0 */ |
---|
34 | /******************************************************************************/ |
---|
35 | #include <stdio.h> |
---|
36 | #include <stdlib.h> |
---|
37 | #include <string.h> |
---|
38 | #include "decl.h" |
---|
39 | |
---|
40 | |
---|
41 | /******************************************************************************/ |
---|
42 | /* Creation and modification of .dependfile */ |
---|
43 | /******************************************************************************/ |
---|
44 | /* .dependnbxnby : this file contains tabvars indices of variables*/ |
---|
45 | /* given in agrif.in as number of cells */ |
---|
46 | /* .dependuse<module> : this file contains all modules used in the */ |
---|
47 | /* current file */ |
---|
48 | /* .dependparameter<module> : this file contains all parmeters defined in */ |
---|
49 | /* the current file */ |
---|
50 | /* .depend<module name> : this file contains all globals variables */ |
---|
51 | /* informations (name, dim, etc ...) */ |
---|
52 | /* .dependavailable : this file contains all tabvars indices which */ |
---|
53 | /* are not used. */ |
---|
54 | /******************************************************************************/ |
---|
55 | |
---|
56 | |
---|
57 | /******************************************************************************/ |
---|
58 | /* Writethedependnbxnbyfile */ |
---|
59 | /******************************************************************************/ |
---|
60 | /* This subroutine is used to create the .dependnbxnby */ |
---|
61 | /******************************************************************************/ |
---|
62 | /* */ |
---|
63 | /* .dependnbxnby */ |
---|
64 | /* */ |
---|
65 | /* nbmaillesX */ |
---|
66 | /* nbmaillesY */ |
---|
67 | /* nbmaillesZ */ |
---|
68 | /* */ |
---|
69 | /******************************************************************************/ |
---|
70 | void Writethedependnbxnbyfile() |
---|
71 | { |
---|
72 | FILE *dependfileoutput; |
---|
73 | listvar *parcours; |
---|
74 | int out; |
---|
75 | |
---|
76 | /* We are looking for all the variable of the current filetoparse file */ |
---|
77 | /* in the globliste */ |
---|
78 | parcours =globliste; |
---|
79 | out = 0; |
---|
80 | while (parcours && out == 0 ) |
---|
81 | { |
---|
82 | if ( !strcasecmp(parcours->var->nomvar,nbmaillesX) ) out = 1; |
---|
83 | else parcours = parcours->suiv; |
---|
84 | } |
---|
85 | if ( out == 1 ) |
---|
86 | { |
---|
87 | dependfileoutput = fopen(".dependnbxnby","w"); |
---|
88 | fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars); |
---|
89 | IndicenbmaillesX = parcours->var->indicetabvars; |
---|
90 | |
---|
91 | if ( dimprob > 1 ) |
---|
92 | { |
---|
93 | parcours =globliste; |
---|
94 | out = 0; |
---|
95 | while (parcours && out == 0 ) |
---|
96 | { |
---|
97 | if ( !strcasecmp(parcours->var->nomvar,nbmaillesY) ) out = 1; |
---|
98 | else parcours = parcours->suiv; |
---|
99 | } |
---|
100 | if ( out == 1 ) |
---|
101 | { |
---|
102 | fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars); |
---|
103 | IndicenbmaillesY = parcours->var->indicetabvars; |
---|
104 | } |
---|
105 | } |
---|
106 | |
---|
107 | if ( dimprob > 2 ) |
---|
108 | { |
---|
109 | parcours =globliste; |
---|
110 | out = 0; |
---|
111 | while (parcours && out == 0 ) |
---|
112 | { |
---|
113 | if ( !strcasecmp(parcours->var->nomvar,nbmaillesZ) ) out = 1; |
---|
114 | else parcours = parcours->suiv; |
---|
115 | } |
---|
116 | if ( out == 1 ) |
---|
117 | { |
---|
118 | fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars); |
---|
119 | IndicenbmaillesZ = parcours->var->indicetabvars; |
---|
120 | } |
---|
121 | } |
---|
122 | |
---|
123 | if ( out == 1 ) fclose(dependfileoutput); |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | /******************************************************************************/ |
---|
128 | /* Readthedependnbxnbyfile */ |
---|
129 | /******************************************************************************/ |
---|
130 | /* This subroutine is used to create the .dependnbxnby */ |
---|
131 | /******************************************************************************/ |
---|
132 | /* */ |
---|
133 | /* .dependnbxnby */ |
---|
134 | /* */ |
---|
135 | /* nbmaillesX */ |
---|
136 | /* nbmaillesY */ |
---|
137 | /* nbmaillesZ */ |
---|
138 | /* */ |
---|
139 | /******************************************************************************/ |
---|
140 | void Readthedependnbxnbyfile() |
---|
141 | { |
---|
142 | FILE *dependfileoutput; |
---|
143 | |
---|
144 | if ((dependfileoutput = fopen(".dependnbxnby","r"))!=NULL) |
---|
145 | { |
---|
146 | fscanf(dependfileoutput,"%d\n",&IndicenbmaillesX); |
---|
147 | if ( dimprob > 1 ) fscanf(dependfileoutput,"%d\n",&IndicenbmaillesY); |
---|
148 | if ( dimprob > 2 ) fscanf(dependfileoutput,"%d\n",&IndicenbmaillesZ); |
---|
149 | fclose(dependfileoutput); |
---|
150 | } |
---|
151 | } |
---|
152 | |
---|
153 | /******************************************************************************/ |
---|
154 | /* Writethedependlistofmoduleused */ |
---|
155 | /******************************************************************************/ |
---|
156 | /* This subroutine is used to create the .dependuse<module> */ |
---|
157 | /******************************************************************************/ |
---|
158 | /* */ |
---|
159 | /* .dependuse<name> */ |
---|
160 | /* */ |
---|
161 | /* mod1 */ |
---|
162 | /* mod2 */ |
---|
163 | /* */ |
---|
164 | /******************************************************************************/ |
---|
165 | void Writethedependlistofmoduleused(char *NameTampon ) |
---|
166 | { |
---|
167 | FILE *dependfileoutput; |
---|
168 | listusemodule *parcours; |
---|
169 | char ligne[LONGNOM]; |
---|
170 | |
---|
171 | if ( listofmodulebysubroutine ) |
---|
172 | { |
---|
173 | sprintf(ligne,".dependuse%s",NameTampon); |
---|
174 | dependfileoutput = fopen(ligne,"w"); |
---|
175 | /* We are looking for all the variable of the current filetoparse file */ |
---|
176 | /* in the globliste */ |
---|
177 | parcours = listofmodulebysubroutine; |
---|
178 | while (parcours) |
---|
179 | { |
---|
180 | fprintf(dependfileoutput,"%s\n",parcours->usemodule); |
---|
181 | parcours = parcours->suiv; |
---|
182 | } |
---|
183 | fclose(dependfileoutput); |
---|
184 | } |
---|
185 | } |
---|
186 | |
---|
187 | /******************************************************************************/ |
---|
188 | /* Readthedependlistofmoduleused */ |
---|
189 | /******************************************************************************/ |
---|
190 | /* This subroutine is used to create the .dependuse<module> */ |
---|
191 | /******************************************************************************/ |
---|
192 | /* */ |
---|
193 | /* .dependuse<name> */ |
---|
194 | /* */ |
---|
195 | /* mod1 */ |
---|
196 | /* mod2 */ |
---|
197 | /* */ |
---|
198 | /******************************************************************************/ |
---|
199 | void Readthedependlistofmoduleused(char *NameTampon) |
---|
200 | { |
---|
201 | FILE *dependfileoutput; |
---|
202 | listusemodule *parcours; |
---|
203 | char ligne[LONGNOM]; |
---|
204 | |
---|
205 | sprintf(ligne,".dependuse%s",NameTampon); |
---|
206 | |
---|
207 | tmpuselocallist = (listusemodule *)NULL; |
---|
208 | if ((dependfileoutput = fopen(ligne,"r"))==NULL) |
---|
209 | { |
---|
210 | } |
---|
211 | else |
---|
212 | { |
---|
213 | /* if the file exist we should verify that this file has changed */ |
---|
214 | while (!feof(dependfileoutput)) |
---|
215 | { |
---|
216 | parcours=(listusemodule *)malloc(sizeof(listusemodule)); |
---|
217 | fscanf(dependfileoutput,"%s\n",parcours->usemodule); |
---|
218 | |
---|
219 | parcours->suiv = tmpuselocallist; |
---|
220 | tmpuselocallist = parcours; |
---|
221 | |
---|
222 | parcours = NULL; |
---|
223 | } |
---|
224 | fclose(dependfileoutput); |
---|
225 | } |
---|
226 | } |
---|
227 | |
---|
228 | |
---|
229 | /******************************************************************************/ |
---|
230 | /* WritedependParameterList */ |
---|
231 | /******************************************************************************/ |
---|
232 | /* This subroutine is used to create the .dependparameter<name> */ |
---|
233 | /******************************************************************************/ |
---|
234 | /* */ |
---|
235 | /* .dependparameter<name> */ |
---|
236 | /* */ |
---|
237 | /* mod1 */ |
---|
238 | /* mod2 */ |
---|
239 | /* */ |
---|
240 | /******************************************************************************/ |
---|
241 | void WritedependParameterList(char *NameTampon ) |
---|
242 | { |
---|
243 | FILE *dependfileoutput; |
---|
244 | listvar *parcours; |
---|
245 | char ligne[LONGNOM]; |
---|
246 | |
---|
247 | if ( globparam ) |
---|
248 | { |
---|
249 | sprintf(ligne,".dependparameter%s",NameTampon); |
---|
250 | dependfileoutput = fopen(ligne,"w"); |
---|
251 | |
---|
252 | parcours =globparam; |
---|
253 | while (parcours) |
---|
254 | { |
---|
255 | fprintf(dependfileoutput,"%s\n",parcours->var->nomvar); |
---|
256 | fprintf(dependfileoutput,"%s\n",parcours->var->modulename); |
---|
257 | parcours = parcours->suiv; |
---|
258 | } |
---|
259 | fclose(dependfileoutput); |
---|
260 | } |
---|
261 | } |
---|
262 | |
---|
263 | |
---|
264 | /******************************************************************************/ |
---|
265 | /* ReaddependParameterList */ |
---|
266 | /******************************************************************************/ |
---|
267 | /* This subroutine is used to create the .dependparameter<name> */ |
---|
268 | /******************************************************************************/ |
---|
269 | /* */ |
---|
270 | /* .dependparameter<name> */ |
---|
271 | /* */ |
---|
272 | /* mod1 */ |
---|
273 | /* mod2 */ |
---|
274 | /* */ |
---|
275 | /******************************************************************************/ |
---|
276 | listparameter *ReaddependParameterList(char *NameTampon,listparameter *listout) |
---|
277 | { |
---|
278 | FILE *dependfileoutput; |
---|
279 | listparameter *parcours; |
---|
280 | char ligne[LONGNOM]; |
---|
281 | |
---|
282 | sprintf(ligne,".dependparameter%s",NameTampon); |
---|
283 | |
---|
284 | if ((dependfileoutput = fopen(ligne,"r"))==NULL) |
---|
285 | { |
---|
286 | } |
---|
287 | else |
---|
288 | { |
---|
289 | /* if the file exist we should verify that this file has changed */ |
---|
290 | while (!feof(dependfileoutput)) |
---|
291 | { |
---|
292 | parcours=(listparameter *)malloc(sizeof(listparameter)); |
---|
293 | fscanf(dependfileoutput,"%s\n",parcours->name); |
---|
294 | fscanf(dependfileoutput,"%s\n",parcours->modulename); |
---|
295 | |
---|
296 | parcours->suiv = listout; |
---|
297 | listout = parcours; |
---|
298 | |
---|
299 | parcours = NULL; |
---|
300 | } |
---|
301 | fclose(dependfileoutput); |
---|
302 | } |
---|
303 | return listout; |
---|
304 | } |
---|
305 | |
---|
306 | /******************************************************************************/ |
---|
307 | /* Writethedependfile */ |
---|
308 | /******************************************************************************/ |
---|
309 | /* This subroutine is used to create the .depend<name> */ |
---|
310 | /******************************************************************************/ |
---|
311 | /* */ |
---|
312 | /* .depend<name> */ |
---|
313 | /* */ |
---|
314 | /* REAL */ |
---|
315 | /* Variable */ |
---|
316 | /* char dimension or T */ |
---|
317 | /* table dimension */ |
---|
318 | /* is type given */ |
---|
319 | /* precision or T */ |
---|
320 | /* initial value or T */ |
---|
321 | /* indice in the tabvars */ |
---|
322 | /* listdimension or T */ |
---|
323 | /* ------------------------- */ |
---|
324 | /* */ |
---|
325 | /******************************************************************************/ |
---|
326 | void Writethedependfile(char *NameTampon, listvar *input ) |
---|
327 | { |
---|
328 | FILE *dependfileoutput; |
---|
329 | listvar *parcours; |
---|
330 | listdim *dims; |
---|
331 | char ligne[LONGNOM]; |
---|
332 | char listdimension[LONGNOM]; |
---|
333 | char curname[LONGNOM]; |
---|
334 | int out; |
---|
335 | |
---|
336 | if ( input ) |
---|
337 | { |
---|
338 | sprintf(ligne,".depend%s",NameTampon); |
---|
339 | dependfileoutput = fopen(ligne,"w"); |
---|
340 | /* We are looking for all the variable of the current filetoparse file */ |
---|
341 | /* in the input */ |
---|
342 | parcours =input; |
---|
343 | out = 0; |
---|
344 | strcpy(curname,""); |
---|
345 | while (parcours && out == 0 ) |
---|
346 | { |
---|
347 | if ( !strcasecmp(parcours->var->modulename,NameTampon) || |
---|
348 | !strcasecmp(parcours->var->commonname,NameTampon) ) |
---|
349 | { |
---|
350 | /* */ |
---|
351 | if ( strcasecmp(curname,"") && |
---|
352 | !strcasecmp(curname,parcours->var->nomvar) ) out = 1 ; |
---|
353 | if ( !strcasecmp(curname,"") ) strcpy(curname,parcours->var->nomvar); |
---|
354 | /* */ |
---|
355 | if ( out == 0 ) |
---|
356 | { |
---|
357 | fprintf(dependfileoutput,"%s\n",parcours->var->typevar); |
---|
358 | fprintf(dependfileoutput,"%s\n",parcours->var->nomvar); |
---|
359 | if ( strcasecmp(parcours->var->dimchar,"") ) |
---|
360 | { |
---|
361 | fprintf(dependfileoutput,"%s\n",parcours->var->dimchar); |
---|
362 | } |
---|
363 | else |
---|
364 | { |
---|
365 | fprintf(dependfileoutput,"T\n"); |
---|
366 | } |
---|
367 | if ( strcasecmp(parcours->var->commoninfile,"") ) |
---|
368 | { |
---|
369 | fprintf(dependfileoutput,"%s\n",parcours->var->commoninfile); |
---|
370 | } |
---|
371 | else |
---|
372 | { |
---|
373 | fprintf(dependfileoutput,"T\n"); |
---|
374 | } |
---|
375 | if ( strcasecmp(parcours->var->commonname,"") ) |
---|
376 | { |
---|
377 | fprintf(dependfileoutput,"%s\n",parcours->var->commonname); |
---|
378 | } |
---|
379 | else |
---|
380 | { |
---|
381 | fprintf(dependfileoutput,"T\n"); |
---|
382 | } |
---|
383 | fprintf(dependfileoutput,"%d\n",parcours->var->nbdim); |
---|
384 | fprintf(dependfileoutput,"%d\n",parcours->var->dimensiongiven); |
---|
385 | fprintf(dependfileoutput,"%d\n",parcours->var->typegiven); |
---|
386 | fprintf(dependfileoutput,"%d\n",parcours->var->allocatable); |
---|
387 | fprintf(dependfileoutput,"%d\n",parcours->var->pointerdeclare); |
---|
388 | if ( strcasecmp(parcours->var->precision,"") ) |
---|
389 | { |
---|
390 | fprintf(dependfileoutput,"%s\n",parcours->var->precision); |
---|
391 | } |
---|
392 | else |
---|
393 | { |
---|
394 | fprintf(dependfileoutput,"T\n"); |
---|
395 | } |
---|
396 | if ( strcasecmp(parcours->var->initialvalue,"") ) |
---|
397 | { |
---|
398 | fprintf(dependfileoutput,"%s\n",parcours->var->initialvalue); |
---|
399 | } |
---|
400 | else |
---|
401 | { |
---|
402 | fprintf(dependfileoutput,"T\n"); |
---|
403 | } |
---|
404 | fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars); |
---|
405 | if ( parcours->var->dimensiongiven == 1 ) |
---|
406 | { |
---|
407 | dims = parcours->var->dimension; |
---|
408 | strcpy(listdimension,""); |
---|
409 | while (dims) |
---|
410 | { |
---|
411 | sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last); |
---|
412 | strcat(listdimension,ligne); |
---|
413 | if ( dims->suiv ) |
---|
414 | { |
---|
415 | strcat(listdimension,","); |
---|
416 | } |
---|
417 | dims = dims->suiv; |
---|
418 | } |
---|
419 | fprintf(dependfileoutput,"%s\n",listdimension); |
---|
420 | } |
---|
421 | else |
---|
422 | { |
---|
423 | fprintf(dependfileoutput,"T\n"); |
---|
424 | } |
---|
425 | fprintf(dependfileoutput,"------------------------\n"); |
---|
426 | } |
---|
427 | } |
---|
428 | parcours = parcours->suiv; |
---|
429 | } |
---|
430 | fclose(dependfileoutput); |
---|
431 | } |
---|
432 | } |
---|
433 | |
---|
434 | /******************************************************************************/ |
---|
435 | /* Readthedependfile */ |
---|
436 | /******************************************************************************/ |
---|
437 | /* This subroutine is used to read the .dependfile<name> and to insert new */ |
---|
438 | /* information in the listout list. */ |
---|
439 | /******************************************************************************/ |
---|
440 | /* */ |
---|
441 | /* .dependmodule --------> globalvarofusefile = list of var */ |
---|
442 | /* */ |
---|
443 | /* not.dependmodule --------> */ |
---|
444 | /* */ |
---|
445 | /******************************************************************************/ |
---|
446 | listvar *Readthedependfile( char *NameTampon , listvar *listout) |
---|
447 | { |
---|
448 | char ligne[LONGNOM]; |
---|
449 | FILE *dependfileoutput; |
---|
450 | listvar *parcours0; |
---|
451 | listvar *parcours; |
---|
452 | listvar *parcoursprec; |
---|
453 | char nothing[LONGNOM]; |
---|
454 | |
---|
455 | parcoursprec = (listvar *)NULL; |
---|
456 | /* we should free the listvar globalvarofusefile */ |
---|
457 | sprintf(ligne,".depend%s",NameTampon); |
---|
458 | if ((dependfileoutput = fopen(ligne,"r"))==NULL) |
---|
459 | { |
---|
460 | /* if the file doesn't exist it means that it is the first time */ |
---|
461 | /* we tried to parse this file */ |
---|
462 | } |
---|
463 | else |
---|
464 | { |
---|
465 | /* if the file exist we should verify that this file has changed */ |
---|
466 | while (!feof(dependfileoutput)) |
---|
467 | { |
---|
468 | parcours=(listvar *)malloc(sizeof(listvar)); |
---|
469 | parcours->var=(variable *)malloc(sizeof(variable)); |
---|
470 | fscanf(dependfileoutput,"%s\n",parcours->var->typevar); |
---|
471 | fscanf(dependfileoutput,"%s\n",parcours->var->nomvar); |
---|
472 | fscanf(dependfileoutput,"%s\n",parcours->var->dimchar); |
---|
473 | if ( !strcasecmp(parcours->var->dimchar,"T") ) |
---|
474 | { |
---|
475 | strcpy(parcours->var->dimchar,""); |
---|
476 | } |
---|
477 | fscanf(dependfileoutput,"%s\n",parcours->var->commoninfile); |
---|
478 | if ( !strcasecmp(parcours->var->commoninfile,"T") ) |
---|
479 | { |
---|
480 | strcpy(parcours->var->commoninfile,""); |
---|
481 | } |
---|
482 | fscanf(dependfileoutput,"%s\n",parcours->var->commonname); |
---|
483 | if ( !strcasecmp(parcours->var->commonname,"T") ) |
---|
484 | { |
---|
485 | strcpy(parcours->var->commonname,""); |
---|
486 | } |
---|
487 | fscanf(dependfileoutput,"%d\n",&parcours->var->nbdim); |
---|
488 | fscanf(dependfileoutput,"%d\n",&parcours->var->dimensiongiven); |
---|
489 | fscanf(dependfileoutput,"%d\n",&parcours->var->typegiven); |
---|
490 | fscanf(dependfileoutput,"%d\n",&parcours->var->allocatable); |
---|
491 | fscanf(dependfileoutput,"%d\n",&parcours->var->pointerdeclare); |
---|
492 | fscanf(dependfileoutput,"%[^\n] \n",parcours->var->precision); |
---|
493 | if ( !strcasecmp(parcours->var->precision,"T") ) |
---|
494 | { |
---|
495 | strcpy(parcours->var->precision,""); |
---|
496 | } |
---|
497 | fscanf(dependfileoutput,"%[^\n] \n",parcours->var->initialvalue); |
---|
498 | if ( !strcasecmp(parcours->var->initialvalue,"T") ) |
---|
499 | { |
---|
500 | strcpy(parcours->var->initialvalue,""); |
---|
501 | } |
---|
502 | fscanf(dependfileoutput,"%d\n",&parcours->var->indicetabvars); |
---|
503 | fscanf(dependfileoutput,"%s\n",parcours->var->readedlistdimension); |
---|
504 | if ( !strcasecmp(parcours->var->readedlistdimension,"T") ) |
---|
505 | { |
---|
506 | strcpy(parcours->var->readedlistdimension,""); |
---|
507 | } |
---|
508 | fscanf(dependfileoutput,"%s\n",nothing); |
---|
509 | parcours->suiv = NULL; |
---|
510 | if ( !listout ) |
---|
511 | { |
---|
512 | listout = parcours; |
---|
513 | parcoursprec = parcours; |
---|
514 | } |
---|
515 | else |
---|
516 | { |
---|
517 | if ( parcoursprec ) |
---|
518 | { |
---|
519 | parcoursprec->suiv = parcours; |
---|
520 | parcoursprec = parcours; |
---|
521 | } |
---|
522 | else |
---|
523 | { |
---|
524 | parcours0 = listout; |
---|
525 | while ( parcours0->suiv ) parcours0=parcours0->suiv; |
---|
526 | parcours0->suiv = parcours; |
---|
527 | parcoursprec = parcours0->suiv; |
---|
528 | } |
---|
529 | } |
---|
530 | parcours = NULL; |
---|
531 | } |
---|
532 | fclose(dependfileoutput); |
---|
533 | } |
---|
534 | return listout; |
---|
535 | } |
---|
536 | |
---|
537 | /******************************************************************************/ |
---|
538 | /* Writethedependavailablefile */ |
---|
539 | /******************************************************************************/ |
---|
540 | /* This subroutine is used to write the .dependfileavailable file */ |
---|
541 | /******************************************************************************/ |
---|
542 | /* */ |
---|
543 | /* .dependavailable */ |
---|
544 | /* tabvars(1) = var1 */ |
---|
545 | /* tabvars(3) = var1 2 */ |
---|
546 | /* tabvars(4) = var1 =====> 5 */ |
---|
547 | /* tabvars(6) = var1 */ |
---|
548 | /* tabvars(7) = var1 */ |
---|
549 | /* */ |
---|
550 | /* */ |
---|
551 | /* */ |
---|
552 | /******************************************************************************/ |
---|
553 | void Writethedependavailablefile() |
---|
554 | { |
---|
555 | FILE *dependfileoutput; |
---|
556 | listindice *parcours; |
---|
557 | |
---|
558 | if ( Listofavailableindices ) |
---|
559 | { |
---|
560 | if ((dependfileoutput=fopen(".dependavailable","w"))!=NULL) |
---|
561 | { |
---|
562 | /* We are looking for all the indices of the Listofavailableindices */ |
---|
563 | parcours = Listofavailableindices; |
---|
564 | while (parcours) |
---|
565 | { |
---|
566 | if ( parcours->indice != 0 ) |
---|
567 | { |
---|
568 | fprintf(dependfileoutput,"%d\n",parcours->indice); |
---|
569 | } |
---|
570 | parcours = parcours->suiv; |
---|
571 | } |
---|
572 | fclose(dependfileoutput); |
---|
573 | } |
---|
574 | } |
---|
575 | } |
---|
576 | |
---|
577 | /******************************************************************************/ |
---|
578 | /* Readthedependavailablefile */ |
---|
579 | /******************************************************************************/ |
---|
580 | /* This subroutine is used to read the .dependfileavailable file */ |
---|
581 | /******************************************************************************/ |
---|
582 | /* */ |
---|
583 | /* .dependavailable */ |
---|
584 | /* tabvars(1) = var1 */ |
---|
585 | /* tabvars(3) = var1 2 */ |
---|
586 | /* tabvars(4) = var1 =====> 5 ==> Listofavailableindices */ |
---|
587 | /* tabvars(6) = var1 */ |
---|
588 | /* tabvars(7) = var1 */ |
---|
589 | /* */ |
---|
590 | /* */ |
---|
591 | /* */ |
---|
592 | /******************************************************************************/ |
---|
593 | void Readthedependavailablefile() |
---|
594 | { |
---|
595 | FILE *dependfileoutput; |
---|
596 | listindice *parcours; |
---|
597 | |
---|
598 | if ((dependfileoutput=fopen(".dependavailable","r"))!=NULL) |
---|
599 | { |
---|
600 | /* We are looking for all the indices of the Listofavailableindices */ |
---|
601 | Listofavailableindices = (listindice *)NULL; |
---|
602 | while (!feof(dependfileoutput)) |
---|
603 | { |
---|
604 | parcours=(listindice *)malloc(sizeof(listindice)); |
---|
605 | fscanf(dependfileoutput,"%d\n",&parcours->indice); |
---|
606 | if ( parcours->indice != 0 && parcours->indice < 10000000 ) |
---|
607 | { |
---|
608 | parcours -> suiv = Listofavailableindices; |
---|
609 | Listofavailableindices = parcours; |
---|
610 | } |
---|
611 | else |
---|
612 | { |
---|
613 | free(parcours); |
---|
614 | } |
---|
615 | } |
---|
616 | fclose(dependfileoutput); |
---|
617 | } |
---|
618 | } |
---|
619 | |
---|
620 | |
---|
621 | /******************************************************************************/ |
---|
622 | /* Did_filetoparse_readed */ |
---|
623 | /******************************************************************************/ |
---|
624 | /* This subroutine is used to know if the .depend<NameTampon> exist */ |
---|
625 | /* it means if the file has been ever parsed */ |
---|
626 | /******************************************************************************/ |
---|
627 | /* */ |
---|
628 | /******************************************************************************/ |
---|
629 | int Did_filetoparse_readed(char *NameTampon) |
---|
630 | { |
---|
631 | FILE *dependfileoutput; |
---|
632 | char ligne[LONGNOM]; |
---|
633 | int out; |
---|
634 | |
---|
635 | sprintf(ligne,".depend%s",NameTampon); |
---|
636 | if ((dependfileoutput = fopen(ligne,"r"))==NULL) |
---|
637 | { |
---|
638 | out = 0; |
---|
639 | } |
---|
640 | else |
---|
641 | { |
---|
642 | out = 1; |
---|
643 | fclose(dependfileoutput); |
---|
644 | } |
---|
645 | return out; |
---|
646 | } |
---|