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 | |
---|
39 | #include "decl.h" |
---|
40 | |
---|
41 | /******************************************************************************/ |
---|
42 | /* cleanlistvarfordoloop_1 */ |
---|
43 | /******************************************************************************/ |
---|
44 | /* Firstpass 1 */ |
---|
45 | /* We should clean all the list used for the do loop OPTImization */ |
---|
46 | /* if endsuborfunc = 1 we are at the end of the subroutine */ |
---|
47 | /* if endsuborfunc = 0 we are at the end of the function */ |
---|
48 | /******************************************************************************/ |
---|
49 | /* */ |
---|
50 | /******************************************************************************/ |
---|
51 | void cleanlistvarfordoloop_1(int endsuborfunc) |
---|
52 | { |
---|
53 | |
---|
54 | if ( firstpass == 1 ) |
---|
55 | { |
---|
56 | if ( fortran77 == 1 ) UpdatevarofsubroutinelisteWithcommonlist(); |
---|
57 | if ( fortran77 == 1 ) UpdateparameterlistWithlistvarindoloop_1(); |
---|
58 | if ( fortran77 == 1 ) UpdateGloblisteWithcommonlist_1(); |
---|
59 | if ( endsuborfunc == 1 ) CompleteThelistvarindoloop(); |
---|
60 | if ( fortran77 == 0 ) UpdateIndiceTabvarsofGlobliste(); |
---|
61 | else UpdateIndiceTabvarsofGloblisteFromCommon(); |
---|
62 | CleanThelistvarindoloop(); |
---|
63 | CleanFromThelistvarindoloopTheAgrifSubArguments(); |
---|
64 | if ( fortran77 == 1 ) |
---|
65 | { |
---|
66 | listduplicated = (listvar *)NULL; |
---|
67 | duplicatelistvar(varofsubroutineliste); |
---|
68 | varsubroutine = AddListvarToListvar |
---|
69 | (listduplicated,varsubroutine,1); |
---|
70 | } |
---|
71 | CleanThelistvarofsubroutineliste(); |
---|
72 | if ( fortran77 == 1 ) UpdatevarsubroutineWithvarofsubroutinelist_1(); |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | /******************************************************************************/ |
---|
77 | /* ajoutevarindoloop_1 */ |
---|
78 | /******************************************************************************/ |
---|
79 | /* Firstpass 1 */ |
---|
80 | /* We should complete the listvarindoloop */ |
---|
81 | /******************************************************************************/ |
---|
82 | /* */ |
---|
83 | /* */ |
---|
84 | /* */ |
---|
85 | /* */ |
---|
86 | /* */ |
---|
87 | /* */ |
---|
88 | /******************************************************************************/ |
---|
89 | void ajoutevarindoloop_1(char *ident) |
---|
90 | { |
---|
91 | listvar *newvar; |
---|
92 | listvar *tmpvar; |
---|
93 | int out; |
---|
94 | |
---|
95 | /* In the first pass we record all variables presents in the do loop */ |
---|
96 | if (firstpass == 1 && insubroutinedeclare == 1 ) |
---|
97 | { |
---|
98 | |
---|
99 | if ( !listvarindoloop ) |
---|
100 | { |
---|
101 | newvar=(listvar *)malloc(sizeof(listvar)); |
---|
102 | newvar->var=(variable *)malloc(sizeof(variable)); |
---|
103 | newvar->suiv = NULL; |
---|
104 | strcpy(newvar->var->oldname,""); |
---|
105 | strcpy(newvar->var->nomvar,ident); |
---|
106 | strcpy(newvar->var->modulename,subroutinename); |
---|
107 | newvar->var->pointedvar=pointedvar; |
---|
108 | newvar->var->indicetabvars=0; |
---|
109 | listvarindoloop = newvar ; |
---|
110 | } |
---|
111 | else |
---|
112 | { |
---|
113 | /* We should verify that this variable did not added */ |
---|
114 | tmpvar = listvarindoloop; |
---|
115 | out = 0 ; |
---|
116 | while (tmpvar && out == 0 ) |
---|
117 | { |
---|
118 | if ( !strcasecmp(tmpvar->var->nomvar,ident) && |
---|
119 | !strcasecmp(tmpvar->var->modulename,subroutinename)) out = 1 ; |
---|
120 | else tmpvar = tmpvar->suiv; |
---|
121 | } |
---|
122 | if ( out == 0 ) |
---|
123 | { |
---|
124 | newvar=(listvar *)malloc(sizeof(listvar)); |
---|
125 | newvar->var=(variable *)malloc(sizeof(variable)); |
---|
126 | strcpy(newvar->var->oldname,""); |
---|
127 | strcpy(newvar->var->nomvar,ident); |
---|
128 | strcpy(newvar->var->modulename,subroutinename); |
---|
129 | newvar->var->pointedvar=pointedvar; |
---|
130 | newvar->var->indicetabvars=0; |
---|
131 | newvar->suiv = listvarindoloop; |
---|
132 | listvarindoloop = newvar; |
---|
133 | } |
---|
134 | } |
---|
135 | |
---|
136 | } |
---|
137 | } |
---|
138 | |
---|
139 | /******************************************************************************/ |
---|
140 | /* AJOUTEVARINDOLOOP_DEFINEDIMENSION */ |
---|
141 | /******************************************************************************/ |
---|
142 | /* This subroutine is used to add a listvar to listvarindoloop */ |
---|
143 | /******************************************************************************/ |
---|
144 | void ajoutevarindoloop_definedimension (char *name) |
---|
145 | { |
---|
146 | listvar *newvar; |
---|
147 | listvar *tmpvar; |
---|
148 | listvar *tmpvarprec; |
---|
149 | int out; |
---|
150 | int tablemeet; |
---|
151 | |
---|
152 | if ( !listvarindoloop ) |
---|
153 | { |
---|
154 | newvar=(listvar *)malloc(sizeof(listvar)); |
---|
155 | newvar->var=(variable *)malloc(sizeof(variable)); |
---|
156 | newvar->suiv = NULL; |
---|
157 | strcpy(newvar->var->oldname,""); |
---|
158 | strcpy(newvar->var->nomvar,name); |
---|
159 | strcpy(newvar->var->modulename,subroutinename); |
---|
160 | newvar->var->indicetabvars=0; |
---|
161 | newvar->var->pointedvar=pointedvar; |
---|
162 | listvarindoloop = newvar ; |
---|
163 | } |
---|
164 | else |
---|
165 | { |
---|
166 | /* We should verify that this variable did not added */ |
---|
167 | tmpvarprec = (listvar *)NULL; |
---|
168 | tmpvar = listvarindoloop; |
---|
169 | out = 0 ; |
---|
170 | tablemeet = 0 ; |
---|
171 | while (tmpvar && out == 0 ) |
---|
172 | { |
---|
173 | if ( tablemeet == 0 && tmpvar->var->nbdim != 0 ) tablemeet = 1 ; |
---|
174 | /* */ |
---|
175 | if ( !strcasecmp(tmpvar->var->nomvar,name) && |
---|
176 | !strcasecmp(tmpvar->var->modulename,subroutinename)) |
---|
177 | { |
---|
178 | out = 1 ; |
---|
179 | /* if this variable has been define before a table we doi nothing */ |
---|
180 | /* else we should remove it */ |
---|
181 | if ( tablemeet == 1 ) |
---|
182 | { |
---|
183 | tmpvarprec->suiv = tmpvar -> suiv; |
---|
184 | out = 2; |
---|
185 | } |
---|
186 | } |
---|
187 | else |
---|
188 | { |
---|
189 | tmpvarprec = tmpvar; |
---|
190 | tmpvar = tmpvar->suiv; |
---|
191 | } |
---|
192 | } |
---|
193 | if ( out == 2 || out == 0 ) |
---|
194 | { |
---|
195 | newvar=(listvar *)malloc(sizeof(listvar)); |
---|
196 | newvar->var=(variable *)malloc(sizeof(variable)); |
---|
197 | strcpy(newvar->var->nomvar,name); |
---|
198 | strcpy(newvar->var->oldname,""); |
---|
199 | newvar->var->indicetabvars=0; |
---|
200 | strcpy(newvar->var->modulename,subroutinename); |
---|
201 | newvar->var->pointedvar=pointedvar; |
---|
202 | /* we should find this new variable to know the tabvars indice */ |
---|
203 | if ( variableisglobal(newvar, globliste) == 1 ) |
---|
204 | { |
---|
205 | newvar->suiv = listvarindoloop; |
---|
206 | listvarindoloop = newvar; |
---|
207 | } |
---|
208 | else if ( variableisglobal(newvar, globalvarofusefile) == 1 ) |
---|
209 | { |
---|
210 | newvar->suiv = listvarindoloop; |
---|
211 | listvarindoloop = newvar; |
---|
212 | } |
---|
213 | else |
---|
214 | { |
---|
215 | free(newvar); |
---|
216 | } |
---|
217 | } |
---|
218 | } |
---|
219 | } |
---|
220 | |
---|
221 | /******************************************************************************/ |
---|
222 | /* CleanFromThelistvarindoloopTheAgrifSubArguments */ |
---|
223 | /******************************************************************************/ |
---|
224 | /* This subroutine is to remove from the listvarindoloop all variables */ |
---|
225 | /* which has been used in Agrif argument in order to avoid the */ |
---|
226 | /* optimization code on Agrif function or subroutines */ |
---|
227 | /******************************************************************************/ |
---|
228 | void CleanFromThelistvarindoloopTheAgrifSubArguments() |
---|
229 | { |
---|
230 | listnom *parcours; |
---|
231 | listvar *parcoursvar; |
---|
232 | listvar *parcoursvarprec; |
---|
233 | |
---|
234 | parcoursvarprec = (listvar *)NULL; |
---|
235 | parcoursvar = listvarindoloop; |
---|
236 | while ( parcoursvar ) |
---|
237 | { |
---|
238 | if ( !strcasecmp(parcoursvar->var->modulename,subroutinename) ) |
---|
239 | { |
---|
240 | parcours = Listofvariableinagriffunction; |
---|
241 | while (parcours && strcasecmp(parcoursvar->var->nomvar,parcours->nom) ) |
---|
242 | { |
---|
243 | parcours = parcours->suiv; |
---|
244 | } |
---|
245 | if ( parcours ) |
---|
246 | { |
---|
247 | /* if we found the name in the listvarindoloop and */ |
---|
248 | /* Listofvariableinagriffunction we should remove it from */ |
---|
249 | /* listvarindoloop */ |
---|
250 | if ( parcoursvar == listvarindoloop ) |
---|
251 | { |
---|
252 | listvarindoloop = listvarindoloop -> suiv; |
---|
253 | parcoursvar = listvarindoloop; |
---|
254 | } |
---|
255 | else |
---|
256 | { |
---|
257 | parcoursvarprec->suiv = parcoursvar->suiv; |
---|
258 | parcoursvar = parcoursvar->suiv; |
---|
259 | } |
---|
260 | } |
---|
261 | else |
---|
262 | { |
---|
263 | parcoursvarprec = parcoursvar; |
---|
264 | parcoursvar = parcoursvar ->suiv; |
---|
265 | } |
---|
266 | } |
---|
267 | else |
---|
268 | { |
---|
269 | parcoursvarprec = parcoursvar; |
---|
270 | parcoursvar = parcoursvar ->suiv; |
---|
271 | } |
---|
272 | } |
---|
273 | |
---|
274 | } |
---|
275 | |
---|
276 | |
---|
277 | /******************************************************************************/ |
---|
278 | /* CleanThelistvarindoloop */ |
---|
279 | /******************************************************************************/ |
---|
280 | /* This subroutine is to remove from the listvarindoloop all variables */ |
---|
281 | /* which has not been declared as table in the globliste */ |
---|
282 | /******************************************************************************/ |
---|
283 | void CleanThelistvarindoloop () |
---|
284 | { |
---|
285 | listvar *newvar; |
---|
286 | listvar *newvarPrec; |
---|
287 | listvar *tmpglobvar; |
---|
288 | listallocate *parcoursallocate; |
---|
289 | listnamelist *newnamelist; |
---|
290 | int not_remove; |
---|
291 | |
---|
292 | RecordUseModulesVariables(); |
---|
293 | RecordUseModulesUseModulesVariables(); |
---|
294 | /* */ |
---|
295 | not_remove = 0 ; |
---|
296 | newvarPrec = (listvar *)NULL; |
---|
297 | newvar = listvarindoloop; |
---|
298 | while ( newvar ) |
---|
299 | { |
---|
300 | if ( !strcasecmp(newvar->var->modulename,subroutinename)) |
---|
301 | { |
---|
302 | not_remove = 0; |
---|
303 | if ( Variableshouldberemove(newvar->var->nomvar) == 0 ) |
---|
304 | { |
---|
305 | /******************************************************************************/ |
---|
306 | /* look in the globliste */ |
---|
307 | /******************************************************************************/ |
---|
308 | /******************************************************************************/ |
---|
309 | /* look in the varofsubroutineliste */ |
---|
310 | /******************************************************************************/ |
---|
311 | tmpglobvar = varofsubroutineliste; |
---|
312 | while ( tmpglobvar && not_remove == 0 ) |
---|
313 | { |
---|
314 | if ( !strcasecmp(tmpglobvar->var->nomvar,newvar->var->nomvar) && |
---|
315 | !strcasecmp |
---|
316 | (tmpglobvar->var->modulename,newvar->var->modulename) |
---|
317 | ) |
---|
318 | not_remove = 2; |
---|
319 | else tmpglobvar = tmpglobvar->suiv; |
---|
320 | } |
---|
321 | |
---|
322 | if (not_remove == 0 ) tmpglobvar = globliste; |
---|
323 | else tmpglobvar = (listvar *)NULL; |
---|
324 | |
---|
325 | while ( tmpglobvar && not_remove == 0 ) |
---|
326 | { |
---|
327 | if ( !strcasecmp(tmpglobvar->var->nomvar,newvar->var->nomvar) ) |
---|
328 | { |
---|
329 | not_remove = 1; |
---|
330 | /* Now we should give the definition of the variable in the */ |
---|
331 | /* table listvarindoloop */ |
---|
332 | strcpy(newvar->var->typevar,tmpglobvar->var->typevar); |
---|
333 | strcpy(newvar->var->dimchar,tmpglobvar->var->dimchar); |
---|
334 | newvar->var->nbdim = tmpglobvar->var->nbdim; |
---|
335 | newvar->var->dimensiongiven = tmpglobvar->var->dimensiongiven; |
---|
336 | newvar->var->allocatable = tmpglobvar->var->allocatable; |
---|
337 | newvar->var->pointerdeclare = tmpglobvar->var->pointerdeclare; |
---|
338 | newvar->var->indicetabvars = tmpglobvar->var->indicetabvars; |
---|
339 | strcpy(newvar->var->precision,tmpglobvar->var->precision); |
---|
340 | strcpy(newvar->var->readedlistdimension, |
---|
341 | tmpglobvar->var->readedlistdimension); |
---|
342 | DecomposeTheName(newvar->var->readedlistdimension); |
---|
343 | } |
---|
344 | else tmpglobvar = tmpglobvar->suiv; |
---|
345 | } |
---|
346 | |
---|
347 | /******************************************************************************/ |
---|
348 | /* look in the globparam */ |
---|
349 | /******************************************************************************/ |
---|
350 | if ( not_remove == 0 ) |
---|
351 | { |
---|
352 | tmpglobvar = globparam; |
---|
353 | while ( tmpglobvar && not_remove == 0 ) |
---|
354 | { |
---|
355 | if ( !strcasecmp(tmpglobvar->var->nomvar,newvar->var->nomvar) && |
---|
356 | !strcasecmp(tmpglobvar->var->subroutinename, |
---|
357 | newvar->var->modulename) |
---|
358 | ) not_remove = 2; |
---|
359 | else tmpglobvar = tmpglobvar->suiv; |
---|
360 | } |
---|
361 | } |
---|
362 | |
---|
363 | if ( not_remove == 0 ) |
---|
364 | { |
---|
365 | /******************************************************************************/ |
---|
366 | /* look in the listenamelist */ |
---|
367 | /******************************************************************************/ |
---|
368 | newnamelist = listenamelist; |
---|
369 | while ( newnamelist && not_remove == 0 ) |
---|
370 | { |
---|
371 | if ( !strcasecmp(newnamelist->name,newvar->var->nomvar)) not_remove = 2; |
---|
372 | else newnamelist = newnamelist->suiv; |
---|
373 | } |
---|
374 | } |
---|
375 | |
---|
376 | if ( not_remove == 0 ) |
---|
377 | { |
---|
378 | /******************************************************************************/ |
---|
379 | /* look in the varofsubroutineliste */ |
---|
380 | /******************************************************************************/ |
---|
381 | tmpglobvar = varofsubroutineliste; |
---|
382 | while ( tmpglobvar && not_remove == 0 ) |
---|
383 | { |
---|
384 | if ( !strcasecmp(tmpglobvar->var->nomvar,newvar->var->nomvar) && |
---|
385 | !strcasecmp(tmpglobvar->var->modulename, |
---|
386 | newvar->var->modulename) |
---|
387 | ) not_remove = 2; |
---|
388 | else tmpglobvar = tmpglobvar->suiv; |
---|
389 | } |
---|
390 | } |
---|
391 | /******************************************************************************/ |
---|
392 | /* look in the .dependfile and .dependparameterfile */ |
---|
393 | /******************************************************************************/ |
---|
394 | if ( not_remove == 0 && not_remove == 0 ) |
---|
395 | { |
---|
396 | /* la liste des use de cette subroutine */ |
---|
397 | not_remove = 0 ; |
---|
398 | |
---|
399 | if ( variableisparameterglobal(newvar,tmpparameterlocallist) == 1 ) |
---|
400 | { |
---|
401 | not_remove = 2 ; |
---|
402 | } |
---|
403 | else if ( variableisglobal(newvar,globalvarofusefile) == 1 ) |
---|
404 | { |
---|
405 | not_remove = 1 ; |
---|
406 | DecomposeTheName(newvar->var->readedlistdimension); |
---|
407 | } |
---|
408 | |
---|
409 | /******************************************************************************/ |
---|
410 | /* look in the .dependfile and .dependparameterfile of USE modules */ |
---|
411 | /******************************************************************************/ |
---|
412 | if ( not_remove == 0 ) |
---|
413 | { |
---|
414 | if ( variableisparameterglobal(newvar,tmpparameterlocallist2) == 1 ) |
---|
415 | { |
---|
416 | not_remove = 2 ; |
---|
417 | } |
---|
418 | else if ( variableisglobal(newvar, globalvarofusefile2) == 1 ) |
---|
419 | { |
---|
420 | not_remove = 1 ; |
---|
421 | DecomposeTheName(newvar->var->readedlistdimension); |
---|
422 | } |
---|
423 | } |
---|
424 | } |
---|
425 | /******************************************************************************/ |
---|
426 | /* look if pointer variable */ |
---|
427 | /******************************************************************************/ |
---|
428 | /* if this variable is a pointer we should remove it */ |
---|
429 | if ( not_remove == 1 && newvar->var->pointerdeclare == 1 ) |
---|
430 | { |
---|
431 | not_remove = 2; |
---|
432 | } |
---|
433 | /* if this variable is an allocatable var we should remove it */ |
---|
434 | if ( not_remove == 1 && newvar->var->allocatable == 1 ) |
---|
435 | { |
---|
436 | not_remove = 2; |
---|
437 | } |
---|
438 | /******************************************************************************/ |
---|
439 | /* look in the AllocateList */ |
---|
440 | /******************************************************************************/ |
---|
441 | /* if this variable has been used in a allocate we should remove it */ |
---|
442 | if ( not_remove == 1 && newvar->var->nbdim != 0 ) |
---|
443 | { |
---|
444 | parcoursallocate = AllocateList; |
---|
445 | while ( parcoursallocate && not_remove == 1 ) |
---|
446 | { |
---|
447 | if ( !strcasecmp(parcoursallocate->nomvar,newvar->var->nomvar) && |
---|
448 | !strcasecmp(parcoursallocate->subroutine,subroutinename) |
---|
449 | ) not_remove = 2; |
---|
450 | else parcoursallocate = parcoursallocate->suiv; |
---|
451 | } |
---|
452 | } |
---|
453 | /* */ |
---|
454 | } /* end of strcasecmp(newvar->var->nomvar,"") */ |
---|
455 | else |
---|
456 | { |
---|
457 | not_remove = 2; |
---|
458 | } |
---|
459 | /******************************************************************************/ |
---|
460 | /* REMOVE */ |
---|
461 | /******************************************************************************/ |
---|
462 | if ( ( not_remove == 0 || not_remove == 2 ) && |
---|
463 | newvar->var->pointedvar == 0 |
---|
464 | ) |
---|
465 | { |
---|
466 | if ( newvar == listvarindoloop ) |
---|
467 | { |
---|
468 | listvarindoloop = listvarindoloop->suiv; |
---|
469 | newvar = listvarindoloop; |
---|
470 | } |
---|
471 | else |
---|
472 | { |
---|
473 | newvarPrec->suiv = newvar->suiv; |
---|
474 | newvar = newvarPrec->suiv; |
---|
475 | } |
---|
476 | } |
---|
477 | else |
---|
478 | { |
---|
479 | /* */ |
---|
480 | newvarPrec = newvar; |
---|
481 | newvar = newvar->suiv ; |
---|
482 | } |
---|
483 | } |
---|
484 | else |
---|
485 | { |
---|
486 | newvarPrec = newvar; |
---|
487 | newvar = newvar->suiv; |
---|
488 | } |
---|
489 | } |
---|
490 | } |
---|
491 | |
---|
492 | |
---|
493 | /******************************************************************************/ |
---|
494 | /* ModifyThelistvarindoloop */ |
---|
495 | /******************************************************************************/ |
---|
496 | /* This subroutine is to give the old name to the which has been */ |
---|
497 | /* declared as USE MOD, U => V in this case we should replace in the */ |
---|
498 | /* name V by the old name U in the listvarindoloop */ |
---|
499 | /******************************************************************************/ |
---|
500 | void ModifyThelistvarindoloop() |
---|
501 | { |
---|
502 | listvar *newvar; |
---|
503 | |
---|
504 | newvar = listvarindoloop; |
---|
505 | while ( newvar ) |
---|
506 | { |
---|
507 | if ( strcasecmp(newvar->var->oldname,"") ) |
---|
508 | { |
---|
509 | strcpy(newvar->var->nomvar,newvar->var->oldname); |
---|
510 | } |
---|
511 | newvar = newvar->suiv; |
---|
512 | } |
---|
513 | } |
---|
514 | |
---|
515 | /******************************************************************************/ |
---|
516 | /* CompleteThelistvarindoloop */ |
---|
517 | /******************************************************************************/ |
---|
518 | /* This subroutine is to add to the listvarindoloop all variables which */ |
---|
519 | /* has been declared as USE MOD, U => V in this case we should replace */ |
---|
520 | /* in the listvarindoloop the word U by the word V */ |
---|
521 | /******************************************************************************/ |
---|
522 | void CompleteThelistvarindoloop() |
---|
523 | { |
---|
524 | listvar *newvar; |
---|
525 | listvarpointtovar *pointtmplist; |
---|
526 | listcouple *coupletmp; |
---|
527 | int outvar; |
---|
528 | |
---|
529 | pointtmplist = Listofvarpointtovar; |
---|
530 | |
---|
531 | while ( pointtmplist ) |
---|
532 | { |
---|
533 | coupletmp = pointtmplist->couple; |
---|
534 | while ( coupletmp ) |
---|
535 | { |
---|
536 | newvar = listvarindoloop; |
---|
537 | outvar = 0 ; |
---|
538 | while ( newvar && outvar == 0) |
---|
539 | { |
---|
540 | /* we should find the same variable name in the same subroutine */ |
---|
541 | if ( !strcasecmp(newvar->var->nomvar,coupletmp->namevar) && |
---|
542 | !strcasecmp(newvar->var->modulename, |
---|
543 | pointtmplist->cursubroutine) && |
---|
544 | strcasecmp(coupletmp->namepointedvar,"") |
---|
545 | ) |
---|
546 | { |
---|
547 | outvar = 1; |
---|
548 | strcpy(newvar->var->oldname,newvar->var->nomvar); |
---|
549 | strcpy(newvar->var->nomvar,coupletmp->namepointedvar); |
---|
550 | } |
---|
551 | else |
---|
552 | { |
---|
553 | newvar = newvar->suiv; |
---|
554 | } |
---|
555 | } |
---|
556 | coupletmp = coupletmp->suiv; |
---|
557 | } |
---|
558 | pointtmplist = pointtmplist->suiv; |
---|
559 | } |
---|
560 | } |
---|