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 | /* AddListvartolistvar */ |
---|
43 | /******************************************************************************/ |
---|
44 | /* This subroutine is used to add a listvar l at the end of a listvar */ |
---|
45 | /* glob. */ |
---|
46 | /* */ |
---|
47 | /******************************************************************************/ |
---|
48 | /* _______ _______ _______ _______ _______ */ |
---|
49 | /* + + + + + + + + + + */ |
---|
50 | /* + glob +--->+ glob +--->+ glob +--->+ glob +--->+ l + */ |
---|
51 | /* +______+ +______+ +______+ +______+ +______+ */ |
---|
52 | /* */ |
---|
53 | /******************************************************************************/ |
---|
54 | listvar * AddListvarToListvar(listvar *l,listvar *glob,int ValueFirstpass) |
---|
55 | { |
---|
56 | listvar *newvar; |
---|
57 | |
---|
58 | if ( firstpass == ValueFirstpass ) |
---|
59 | { |
---|
60 | if ( !glob) glob = l ; |
---|
61 | else |
---|
62 | { |
---|
63 | newvar=glob; |
---|
64 | while (newvar->suiv) newvar = newvar->suiv; |
---|
65 | newvar->suiv = l; |
---|
66 | } |
---|
67 | } |
---|
68 | return glob; |
---|
69 | } |
---|
70 | |
---|
71 | /******************************************************************************/ |
---|
72 | /* CreateAndFillin_Curvar */ |
---|
73 | /******************************************************************************/ |
---|
74 | /* This subroutine is used to create the record corresponding to the */ |
---|
75 | /* list of declaration */ |
---|
76 | /******************************************************************************/ |
---|
77 | /* */ |
---|
78 | /* */ |
---|
79 | /* */ |
---|
80 | /* */ |
---|
81 | /* */ |
---|
82 | /* */ |
---|
83 | /******************************************************************************/ |
---|
84 | void CreateAndFillin_Curvar(char *type,char *tokname, |
---|
85 | listdim *dims,variable *curvar) |
---|
86 | { |
---|
87 | if (!strcasecmp(type,"character") && strcasecmp(CharacterSize,"") ) |
---|
88 | strcpy(curvar->dimchar,CharacterSize); |
---|
89 | |
---|
90 | /* On donne la precision de la variable si elle a ete donnee */ |
---|
91 | curvar->c_star = 0; |
---|
92 | if ( c_star == 1 ) curvar->c_star = 1; |
---|
93 | /* */ |
---|
94 | if ( strcasecmp(vallengspec,"") ) strcpy(curvar->vallengspec,vallengspec); |
---|
95 | |
---|
96 | if ( strcasecmp(NamePrecision,"") ) strcpy(curvar->precision,NamePrecision); |
---|
97 | /* Si cette variable a ete declaree dans un module on met curvar->module=1 */ |
---|
98 | if ( inmoduledeclare == 1 || SaveDeclare == 1) |
---|
99 | { |
---|
100 | curvar->module = 1; |
---|
101 | /* Puis on donne le nom du module dans curvar->modulename */ |
---|
102 | strcpy(curvar->modulename,curmodulename); |
---|
103 | } |
---|
104 | else if (insubroutinedeclare == 1 ) |
---|
105 | /* we give the name of the subroutine to the modulename */ |
---|
106 | { |
---|
107 | strcpy(curvar->modulename,subroutinename); |
---|
108 | } |
---|
109 | /* Si cette variable a ete initialisee */ |
---|
110 | if (InitialValueGiven == 1 ) strcpy(curvar->initialvalue,InitValue); |
---|
111 | /* Si cette variable est declaree en save */ |
---|
112 | if (SaveDeclare == 1 ) curvar->save = 1; |
---|
113 | /* Si cette variable est allocatable */ |
---|
114 | if (Allocatabledeclare == 1 ) curvar->allocatable=1; |
---|
115 | /* if INTENT spec has been given */ |
---|
116 | if ( strcasecmp(IntentSpec,"") ) strcpy(curvar->IntentSpec,IntentSpec); |
---|
117 | } |
---|
118 | |
---|
119 | |
---|
120 | /******************************************************************************/ |
---|
121 | /* duplicatelistvar */ |
---|
122 | /******************************************************************************/ |
---|
123 | /* */ |
---|
124 | /******************************************************************************/ |
---|
125 | void duplicatelistvar(listvar * orig) |
---|
126 | { |
---|
127 | listvar *parcours; |
---|
128 | listvar *tmplistvar; |
---|
129 | listvar *tmplistvarprec; |
---|
130 | listdim *tmplistdim; |
---|
131 | variable *tmpvar; |
---|
132 | |
---|
133 | tmplistvarprec = (listvar *)NULL; |
---|
134 | parcours = orig; |
---|
135 | while ( parcours ) |
---|
136 | { |
---|
137 | tmplistvar = (listvar *)malloc(sizeof(listvar)); |
---|
138 | tmpvar = (variable *)malloc(sizeof(variable)); |
---|
139 | /* */ |
---|
140 | strcpy(tmpvar->typevar,parcours->var->typevar); |
---|
141 | strcpy(tmpvar->nomvar,parcours->var->nomvar); |
---|
142 | strcpy(tmpvar->oldname,parcours->var->oldname); |
---|
143 | strcpy(tmpvar->dimchar,parcours->var->dimchar); |
---|
144 | if ( parcours->var->dimension ) |
---|
145 | { |
---|
146 | tmplistdim = (listdim *)malloc(sizeof(listdim)); |
---|
147 | tmplistdim = parcours->var->dimension; |
---|
148 | tmpvar->dimension = tmplistdim; |
---|
149 | } |
---|
150 | tmpvar->nbdim=parcours->var->nbdim; |
---|
151 | tmpvar->common=parcours->var->common; |
---|
152 | tmpvar->positioninblock=parcours->var->positioninblock; |
---|
153 | tmpvar->module=parcours->var->module; |
---|
154 | tmpvar->save=parcours->var->save; |
---|
155 | tmpvar->VariableIsParameter=parcours->var->VariableIsParameter; |
---|
156 | strcpy(tmpvar->modulename,parcours->var->modulename); |
---|
157 | strcpy(tmpvar->commonname,parcours->var->commonname); |
---|
158 | strcpy(tmpvar->vallengspec,parcours->var->vallengspec); |
---|
159 | strcpy(tmpvar->nameinttypename,parcours->var->nameinttypename); |
---|
160 | tmpvar->pointedvar=parcours->var->pointedvar; |
---|
161 | strcpy(tmpvar->commoninfile,parcours->var->commoninfile); |
---|
162 | strcpy(tmpvar->subroutinename,parcours->var->subroutinename); |
---|
163 | tmpvar->dimensiongiven=parcours->var->dimensiongiven; |
---|
164 | tmpvar->c_star=parcours->var->c_star; |
---|
165 | strcpy(tmpvar->precision,parcours->var->precision); |
---|
166 | strcpy(tmpvar->initialvalue,parcours->var->initialvalue); |
---|
167 | tmpvar->pointerdeclare=parcours->var->pointerdeclare; |
---|
168 | tmpvar->optionaldeclare=parcours->var->optionaldeclare; |
---|
169 | tmpvar->allocatable=parcours->var->allocatable; |
---|
170 | strcpy(tmpvar->IntentSpec,parcours->var->IntentSpec); |
---|
171 | tmpvar->dimsempty=parcours->var->dimsempty; |
---|
172 | strcpy(tmpvar->readedlistdimension,parcours->var->readedlistdimension); |
---|
173 | /* */ |
---|
174 | tmplistvar->var = tmpvar; |
---|
175 | tmplistvar->suiv = NULL; |
---|
176 | /* */ |
---|
177 | if ( !listduplicated ) |
---|
178 | { |
---|
179 | listduplicated = tmplistvar; |
---|
180 | tmplistvarprec = listduplicated; |
---|
181 | } |
---|
182 | else |
---|
183 | { |
---|
184 | tmplistvarprec->suiv = tmplistvar; |
---|
185 | tmplistvarprec = tmplistvar; |
---|
186 | } |
---|
187 | /* */ |
---|
188 | parcours = parcours->suiv; |
---|
189 | } |
---|
190 | } |
---|
191 | |
---|
192 | /******************************************************************************/ |
---|
193 | /* insertdim */ |
---|
194 | /******************************************************************************/ |
---|
195 | /* This subroutine is used to insert a record in a list of */ |
---|
196 | /* struct : listdim */ |
---|
197 | /******************************************************************************/ |
---|
198 | /* _______ _______ _______ _______ _______ */ |
---|
199 | /* + + + + + + + + + + */ |
---|
200 | /* + NEW +--->+ lin +--->+ lin +--->+ lin +--->+ lin + */ |
---|
201 | /* +______+ +______+ +______+ +______+ +______+ */ |
---|
202 | /* */ |
---|
203 | /******************************************************************************/ |
---|
204 | listdim * insertdim(listdim *lin,typedim nom) |
---|
205 | { |
---|
206 | listdim *newdim ; |
---|
207 | listdim *parcours ; |
---|
208 | |
---|
209 | newdim=(listdim *) malloc (sizeof (listdim)); |
---|
210 | newdim->dim=nom; |
---|
211 | newdim->suiv=NULL; |
---|
212 | |
---|
213 | if ( ! lin ) |
---|
214 | { |
---|
215 | lin = newdim; |
---|
216 | } |
---|
217 | else |
---|
218 | { |
---|
219 | parcours = lin; |
---|
220 | while ( parcours->suiv ) parcours=parcours->suiv; |
---|
221 | parcours->suiv = newdim; |
---|
222 | } |
---|
223 | |
---|
224 | return lin; |
---|
225 | } |
---|
226 | |
---|
227 | /******************************************************************************/ |
---|
228 | /* change_dim_char */ |
---|
229 | /******************************************************************************/ |
---|
230 | /* This subroutine is used to change the dimension in the list lin */ |
---|
231 | /******************************************************************************/ |
---|
232 | /* _______ _______ _______ _______ */ |
---|
233 | /* + l + + l + + l + + l + */ |
---|
234 | /* + old +--->+ old +--------------->+ lin +--->+ lin + */ |
---|
235 | /* +______+ +______+ +______+ +______+ */ |
---|
236 | /* */ |
---|
237 | /******************************************************************************/ |
---|
238 | void change_dim_char(listdim *lin,listvar * l) |
---|
239 | { |
---|
240 | listvar *parcours_var; |
---|
241 | variable *v; |
---|
242 | |
---|
243 | |
---|
244 | parcours_var=l; |
---|
245 | while(parcours_var) |
---|
246 | { |
---|
247 | v=parcours_var->var; |
---|
248 | strcpy(v->dimchar,(lin->dim).last); |
---|
249 | parcours_var=parcours_var->suiv; |
---|
250 | } |
---|
251 | } |
---|
252 | |
---|
253 | |
---|
254 | /******************************************************************************/ |
---|
255 | /* num_dims */ |
---|
256 | /******************************************************************************/ |
---|
257 | /* This subroutine is used to know the dimension of a table */ |
---|
258 | /******************************************************************************/ |
---|
259 | /* */ |
---|
260 | /* Dimension(jpi,jpj,jpk) ----------> num_dims = 3 */ |
---|
261 | /* */ |
---|
262 | /******************************************************************************/ |
---|
263 | int num_dims(listdim *d) |
---|
264 | { |
---|
265 | listdim *parcours; |
---|
266 | int compteur = 0; |
---|
267 | |
---|
268 | parcours = d; |
---|
269 | while(parcours) |
---|
270 | { |
---|
271 | compteur++; |
---|
272 | parcours=parcours->suiv; |
---|
273 | } |
---|
274 | return compteur; |
---|
275 | } |
---|
276 | |
---|
277 | |
---|
278 | /******************************************************************************/ |
---|
279 | /* CREATEVAR */ |
---|
280 | /******************************************************************************/ |
---|
281 | /* This subroutine is used to create and initialized a record of the */ |
---|
282 | /* struct : variable */ |
---|
283 | /******************************************************************************/ |
---|
284 | variable * createvar(char *nom,listdim *d) |
---|
285 | { |
---|
286 | variable *var; |
---|
287 | listdim *dims; |
---|
288 | char ligne[LONGNOM]; |
---|
289 | char listdimension[LONGNOM]; |
---|
290 | |
---|
291 | var=(variable *) malloc(sizeof(variable)); |
---|
292 | strcpy(var->nomvar,nom); |
---|
293 | /* Definition of the number of this variable in the table tabvars */ |
---|
294 | var->indicetabvars = 0; |
---|
295 | if ( firstpass == 1 && ( aftercontainsdeclare == 0 || |
---|
296 | SaveDeclare == 1 || |
---|
297 | fortran77 == 1 ) |
---|
298 | ) |
---|
299 | { |
---|
300 | indicemaxtabvars = indicemaxtabvars + 1; |
---|
301 | var->indicetabvars = indicemaxtabvars; |
---|
302 | } |
---|
303 | /* */ |
---|
304 | var->pointerdeclare=0; |
---|
305 | var->dimsempty=0; |
---|
306 | var->optionaldeclare=0; |
---|
307 | var->dimensiongiven=0; |
---|
308 | var->positioninblock=0; |
---|
309 | var->VariableIsParameter = 0; |
---|
310 | var->PublicDeclare = 0; |
---|
311 | var->PrivateDeclare = 0; |
---|
312 | var->ExternalDeclare = 0; |
---|
313 | var->common=0; |
---|
314 | var->allocatable=0; |
---|
315 | var->module=0; |
---|
316 | var->save=0; |
---|
317 | /* */ |
---|
318 | strcpy(var->nameinttypename,""); |
---|
319 | strcpy(listdimension,""); |
---|
320 | strcpy(var->modulename,""); |
---|
321 | strcpy(var->commonname,""); |
---|
322 | strcpy(var->commoninfile,mainfile); |
---|
323 | strcpy(var->subroutinename,subroutinename); |
---|
324 | strcpy(var->dimchar,""); |
---|
325 | strcpy(var->oldname,""); |
---|
326 | strcpy(var->precision,""); |
---|
327 | strcpy(var->initialvalue,""); |
---|
328 | strcpy(var->IntentSpec,""); |
---|
329 | /* */ |
---|
330 | if ( strcasecmp(nameinttypename,"") ) |
---|
331 | strcpy(var->nameinttypename,nameinttypename); |
---|
332 | if ( optionaldeclare == 1 ) var->optionaldeclare = 1; |
---|
333 | if ( pointerdeclare == 1 ) var->pointerdeclare = 1; |
---|
334 | if ( VariableIsParameter == 1 ) var->VariableIsParameter = 1 ; |
---|
335 | if ( PublicDeclare == 1 ) var->PublicDeclare = 1 ; |
---|
336 | if ( PrivateDeclare == 1 ) var->PrivateDeclare = 1; |
---|
337 | if ( ExternalDeclare == 1 ) var->ExternalDeclare = 1; |
---|
338 | /* */ |
---|
339 | var->dimension=d; |
---|
340 | /* Creation of the string for the dimension of this variable */ |
---|
341 | dimsempty = 1; |
---|
342 | if ( d ) |
---|
343 | { |
---|
344 | var->dimensiongiven=1; |
---|
345 | dims = d; |
---|
346 | while (dims) |
---|
347 | { |
---|
348 | if ( strcasecmp(dims->dim.first,"") || strcasecmp(dims->dim.last,"")) |
---|
349 | dimsempty = 0; |
---|
350 | sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last); |
---|
351 | strcat(listdimension,ligne); |
---|
352 | if ( dims->suiv ) |
---|
353 | { |
---|
354 | strcat(listdimension,","); |
---|
355 | } |
---|
356 | dims = dims->suiv; |
---|
357 | } |
---|
358 | if ( dimsempty == 1 ) var->dimsempty=1; |
---|
359 | } |
---|
360 | strcpy(var->readedlistdimension,listdimension); |
---|
361 | /* */ |
---|
362 | var->nbdim=num_dims(d); |
---|
363 | /* */ |
---|
364 | return var; |
---|
365 | } |
---|
366 | |
---|
367 | /******************************************************************************/ |
---|
368 | /* INSERTVAR */ |
---|
369 | /******************************************************************************/ |
---|
370 | /* This subroutine is used to insert a record in a list of the */ |
---|
371 | /* struct : listvar */ |
---|
372 | /******************************************************************************/ |
---|
373 | /* _______ _______ _______ _______ _______ */ |
---|
374 | /* + + + + + + + + + + */ |
---|
375 | /* + lin +--->+ lin +--->+ lin +--->+ lin +--->+ NEW + */ |
---|
376 | /* +______+ +______+ +______+ +______+ +______+ */ |
---|
377 | /* */ |
---|
378 | /* */ |
---|
379 | /******************************************************************************/ |
---|
380 | listvar * insertvar(listvar *lin,variable *v) |
---|
381 | { |
---|
382 | listvar *newvar ; |
---|
383 | listvar *tmpvar ; |
---|
384 | |
---|
385 | newvar=(listvar *) malloc (sizeof (listvar)); |
---|
386 | newvar->var=v; |
---|
387 | newvar->suiv = NULL; |
---|
388 | if (!lin) |
---|
389 | { |
---|
390 | newvar->suiv=NULL; |
---|
391 | lin = newvar; |
---|
392 | } |
---|
393 | else |
---|
394 | { |
---|
395 | tmpvar = lin ; |
---|
396 | while (tmpvar->suiv) |
---|
397 | { |
---|
398 | tmpvar = tmpvar ->suiv ; |
---|
399 | } |
---|
400 | tmpvar -> suiv = newvar; |
---|
401 | } |
---|
402 | return lin; |
---|
403 | } |
---|
404 | |
---|
405 | /******************************************************************************/ |
---|
406 | /* SETTYPE */ |
---|
407 | /******************************************************************************/ |
---|
408 | /* This subroutine is used to give the same variable type at each */ |
---|
409 | /* record of the list of the struct : listvar */ |
---|
410 | /******************************************************************************/ |
---|
411 | /* _______ _______ _______ _______ _______ */ |
---|
412 | /* + REAL + + REAL + + REAL + + REAL + + REAL + */ |
---|
413 | /* + lin +--->+ lin +--->+ lin +--->+ lin +--->+ lin + */ |
---|
414 | /* +______+ +______+ +______+ +______+ +______+ */ |
---|
415 | /* */ |
---|
416 | /* */ |
---|
417 | /******************************************************************************/ |
---|
418 | listvar *settype(char *nom,listvar *lin) |
---|
419 | { |
---|
420 | listvar *newvar; |
---|
421 | variable *v; |
---|
422 | |
---|
423 | newvar=lin; |
---|
424 | while (newvar) |
---|
425 | { |
---|
426 | v=newvar->var; |
---|
427 | strcpy(v->typevar,nom); |
---|
428 | newvar=newvar->suiv; |
---|
429 | } |
---|
430 | newvar=lin; |
---|
431 | return newvar ; |
---|
432 | } |
---|
433 | |
---|
434 | /******************************************************************************/ |
---|
435 | /* deallocation_all */ |
---|
436 | /******************************************************************************/ |
---|
437 | /* This subroutine is used to deallocate every strucuture */ |
---|
438 | /******************************************************************************/ |
---|
439 | /* */ |
---|
440 | /* */ |
---|
441 | /* */ |
---|
442 | /* */ |
---|
443 | /* */ |
---|
444 | /* */ |
---|
445 | /******************************************************************************/ |
---|
446 | void deallocation_all() |
---|
447 | { |
---|
448 | int compt; |
---|
449 | listparameter *newparam; |
---|
450 | listvar *newlistvar; |
---|
451 | variable *newvar; |
---|
452 | listdim *newdim; |
---|
453 | listvarcommon *newvarcommon; |
---|
454 | listname *newname; |
---|
455 | listusemodule *newusemodule; |
---|
456 | listmodule *newmodule; |
---|
457 | listnamelist *newnamelist; |
---|
458 | listnom *newnom; |
---|
459 | listallocate *newallocate; |
---|
460 | listvarpointtovar *newvarpointtovar; |
---|
461 | listindice *newindice; |
---|
462 | |
---|
463 | /* deallocation globliste */ |
---|
464 | compt = 0; |
---|
465 | while ( globliste ) |
---|
466 | { |
---|
467 | if ( todebug == 1 && compt == 0 ) |
---|
468 | { |
---|
469 | printf("Deallocation globliste\n"); |
---|
470 | compt = 1; |
---|
471 | } |
---|
472 | newlistvar = globliste -> suiv; |
---|
473 | free(globliste->var->dimension); |
---|
474 | free(globliste->var); |
---|
475 | free(globliste); |
---|
476 | globliste = newlistvar; |
---|
477 | } |
---|
478 | /* deallocation globparam */ |
---|
479 | compt = 0; |
---|
480 | while ( globparam ) |
---|
481 | { |
---|
482 | if ( todebug == 1 && compt == 0 ) |
---|
483 | { |
---|
484 | printf("Deallocation globparam\n"); |
---|
485 | compt = 1; |
---|
486 | } |
---|
487 | newlistvar = globparam -> suiv; |
---|
488 | free(globparam->var->dimension); |
---|
489 | free(globparam->var); |
---|
490 | free(globparam); |
---|
491 | globparam = newlistvar; |
---|
492 | } |
---|
493 | /* deallocation listdatavariable */ |
---|
494 | compt = 0; |
---|
495 | while ( listdatavariable ) |
---|
496 | { |
---|
497 | if ( todebug == 1 && compt == 0 ) |
---|
498 | { |
---|
499 | printf("Deallocation listdatavariable\n"); |
---|
500 | compt = 1; |
---|
501 | } |
---|
502 | newlistvar = listdatavariable -> suiv; |
---|
503 | free(listdatavariable->var->dimension); |
---|
504 | free(listdatavariable->var); |
---|
505 | free(listdatavariable); |
---|
506 | listdatavariable = newlistvar; |
---|
507 | } |
---|
508 | /* deallocation listargsubroutine */ |
---|
509 | compt = 0; |
---|
510 | while ( listargsubroutine ) |
---|
511 | { |
---|
512 | if ( todebug == 1 && compt == 0 ) |
---|
513 | { |
---|
514 | printf("Deallocation listargsubroutine\n"); |
---|
515 | compt = 1; |
---|
516 | } |
---|
517 | newlistvar = listargsubroutine -> suiv; |
---|
518 | free(listargsubroutine->var->dimension); |
---|
519 | free(listargsubroutine->var); |
---|
520 | free(listargsubroutine); |
---|
521 | listargsubroutine = newlistvar; |
---|
522 | } |
---|
523 | /* deallocation varofsubroutineliste */ |
---|
524 | compt = 0; |
---|
525 | while ( varofsubroutineliste ) |
---|
526 | { |
---|
527 | if ( todebug == 1 && compt == 0 ) |
---|
528 | { |
---|
529 | printf("Deallocation varofsubroutineliste\n"); |
---|
530 | compt = 1; |
---|
531 | } |
---|
532 | newlistvar = varofsubroutineliste -> suiv; |
---|
533 | free(varofsubroutineliste->var->dimension); |
---|
534 | free(varofsubroutineliste->var); |
---|
535 | free(varofsubroutineliste); |
---|
536 | varofsubroutineliste = newlistvar; |
---|
537 | } |
---|
538 | /* deallocation varsubroutine */ |
---|
539 | compt = 0; |
---|
540 | while ( varsubroutine ) |
---|
541 | { |
---|
542 | if ( todebug == 1 && compt == 0 ) |
---|
543 | { |
---|
544 | printf("Deallocation varsubroutine\n"); |
---|
545 | compt = 1; |
---|
546 | } |
---|
547 | newlistvar = varsubroutine -> suiv; |
---|
548 | free(varsubroutine->var->dimension); |
---|
549 | free(varsubroutine->var); |
---|
550 | free(varsubroutine); |
---|
551 | varsubroutine = newlistvar; |
---|
552 | } |
---|
553 | /* deallocation listvarindoloop */ |
---|
554 | compt = 0; |
---|
555 | while ( listvarindoloop ) |
---|
556 | { |
---|
557 | if ( todebug == 1 && compt == 0 ) |
---|
558 | { |
---|
559 | printf("Deallocation listvarindoloop\n"); |
---|
560 | compt = 1; |
---|
561 | } |
---|
562 | newlistvar = listvarindoloop -> suiv; |
---|
563 | free(listvarindoloop->var->dimension); |
---|
564 | free(listvarindoloop->var); |
---|
565 | free(listvarindoloop); |
---|
566 | listvarindoloop = newlistvar; |
---|
567 | } |
---|
568 | /* deallocation finglobliste */ |
---|
569 | compt = 0; |
---|
570 | while ( finglobliste ) |
---|
571 | { |
---|
572 | if ( todebug == 1 && compt == 0 ) |
---|
573 | { |
---|
574 | printf("Deallocation finglobliste\n"); |
---|
575 | compt = 1; |
---|
576 | } |
---|
577 | newlistvar = finglobliste -> suiv; |
---|
578 | free(finglobliste->var->dimension); |
---|
579 | free(finglobliste->var); |
---|
580 | free(finglobliste); |
---|
581 | finglobliste = newlistvar; |
---|
582 | } |
---|
583 | /* deallocation tmplocallist */ |
---|
584 | compt = 0; |
---|
585 | while ( tmplocallist ) |
---|
586 | { |
---|
587 | if ( todebug == 1 && compt == 0 ) |
---|
588 | { |
---|
589 | printf("Deallocation tmplocallist\n"); |
---|
590 | compt = 1; |
---|
591 | } |
---|
592 | newlistvar = tmplocallist -> suiv; |
---|
593 | free(tmplocallist->var->dimension); |
---|
594 | free(tmplocallist->var); |
---|
595 | free(tmplocallist); |
---|
596 | tmplocallist = newlistvar; |
---|
597 | } |
---|
598 | /* deallocation parameterlist */ |
---|
599 | compt = 0; |
---|
600 | while ( parameterlist ) |
---|
601 | { |
---|
602 | if ( todebug == 1 && compt == 0 ) |
---|
603 | { |
---|
604 | printf("Deallocation parameterlist\n"); |
---|
605 | compt = 1; |
---|
606 | } |
---|
607 | newlistvar = parameterlist -> suiv; |
---|
608 | free(parameterlist->var->dimension); |
---|
609 | free(parameterlist->var); |
---|
610 | free(parameterlist); |
---|
611 | parameterlist = newlistvar; |
---|
612 | } |
---|
613 | /* deallocation globalvarofusefile2 */ |
---|
614 | compt = 0; |
---|
615 | while ( globalvarofusefile2 ) |
---|
616 | { |
---|
617 | if ( todebug == 1 && compt == 0 ) |
---|
618 | { |
---|
619 | printf("Deallocation globalvarofusefile2\n"); |
---|
620 | compt = 1; |
---|
621 | } |
---|
622 | newlistvar = globalvarofusefile2 -> suiv; |
---|
623 | /* free(globalvarofusefile2->var->dimension);*/ |
---|
624 | free(globalvarofusefile2->var); |
---|
625 | free(globalvarofusefile2); |
---|
626 | globalvarofusefile2 = newlistvar; |
---|
627 | } |
---|
628 | /* deallocation globalvarofusefile */ |
---|
629 | compt = 0; |
---|
630 | while ( globalvarofusefile ) |
---|
631 | { |
---|
632 | if ( todebug == 1 && compt == 0 ) |
---|
633 | { |
---|
634 | printf("Deallocation globalvarofusefile\n"); |
---|
635 | compt = 1; |
---|
636 | } |
---|
637 | newlistvar = globalvarofusefile -> suiv; |
---|
638 | free(globalvarofusefile->var->dimension); |
---|
639 | free(globalvarofusefile->var); |
---|
640 | free(globalvarofusefile); |
---|
641 | globalvarofusefile = newlistvar; |
---|
642 | } |
---|
643 | /* deallocation functionlistvar */ |
---|
644 | compt = 0; |
---|
645 | while ( functionlistvar ) |
---|
646 | { |
---|
647 | if ( todebug == 1 && compt == 0 ) |
---|
648 | { |
---|
649 | printf("Deallocation functionlistvar\n"); |
---|
650 | compt = 1; |
---|
651 | } |
---|
652 | newlistvar = functionlistvar -> suiv; |
---|
653 | free(functionlistvar->var->dimension); |
---|
654 | free(functionlistvar->var); |
---|
655 | free(functionlistvar); |
---|
656 | functionlistvar = newlistvar; |
---|
657 | } |
---|
658 | /* deallocation listenotgriddepend */ |
---|
659 | compt = 0; |
---|
660 | while ( listenotgriddepend ) |
---|
661 | { |
---|
662 | if ( todebug == 1 && compt == 0 ) |
---|
663 | { |
---|
664 | printf("Deallocation listenotgriddepend\n"); |
---|
665 | compt = 1; |
---|
666 | } |
---|
667 | newlistvar = listenotgriddepend -> suiv; |
---|
668 | free(listenotgriddepend->var->dimension); |
---|
669 | free(listenotgriddepend->var); |
---|
670 | free(listenotgriddepend); |
---|
671 | listenotgriddepend = newlistvar; |
---|
672 | } |
---|
673 | /* deallocation commonlist */ |
---|
674 | compt = 0; |
---|
675 | while ( commonlist ) |
---|
676 | { |
---|
677 | if ( todebug == 1 && compt == 0 ) |
---|
678 | { |
---|
679 | printf("Deallocation commonlist\n"); |
---|
680 | compt = 1; |
---|
681 | } |
---|
682 | newvarcommon = commonlist -> suiv; |
---|
683 | free(commonlist->dimension); |
---|
684 | free(commonlist); |
---|
685 | commonlist = newvarcommon; |
---|
686 | } |
---|
687 | /* deallocation listimplicitnone */ |
---|
688 | compt = 0; |
---|
689 | while ( listimplicitnone ) |
---|
690 | { |
---|
691 | if ( todebug == 1 && compt == 0 ) |
---|
692 | { |
---|
693 | printf("Deallocation listimplicitnone\n"); |
---|
694 | compt = 1; |
---|
695 | } |
---|
696 | newname = listimplicitnone -> suiv; |
---|
697 | free(listimplicitnone); |
---|
698 | listimplicitnone = newname; |
---|
699 | } |
---|
700 | /* deallocation listofmodulebysubroutine */ |
---|
701 | compt = 0; |
---|
702 | while ( listofmodulebysubroutine ) |
---|
703 | { |
---|
704 | if ( todebug == 1 && compt == 0 ) |
---|
705 | { |
---|
706 | printf("Deallocation listofmodulebysubroutine\n"); |
---|
707 | compt = 1; |
---|
708 | } |
---|
709 | newusemodule = listofmodulebysubroutine -> suiv; |
---|
710 | free(listofmodulebysubroutine); |
---|
711 | listofmodulebysubroutine = newusemodule; |
---|
712 | } |
---|
713 | /* deallocation listofincludebysubroutine */ |
---|
714 | compt = 0; |
---|
715 | while ( listofincludebysubroutine ) |
---|
716 | { |
---|
717 | if ( todebug == 1 && compt == 0 ) |
---|
718 | { |
---|
719 | printf("Deallocation listofincludebysubroutine\n"); |
---|
720 | compt = 1; |
---|
721 | } |
---|
722 | newusemodule = listofincludebysubroutine -> suiv; |
---|
723 | free(listofincludebysubroutine); |
---|
724 | listofincludebysubroutine = newusemodule; |
---|
725 | } |
---|
726 | /* deallocation listofmoduletmp */ |
---|
727 | compt = 0; |
---|
728 | while ( listofmoduletmp ) |
---|
729 | { |
---|
730 | if ( todebug == 1 && compt == 0 ) |
---|
731 | { |
---|
732 | printf("Deallocation listofmoduletmp\n"); |
---|
733 | compt = 1; |
---|
734 | } |
---|
735 | newusemodule = listofmoduletmp -> suiv; |
---|
736 | free(listofmoduletmp); |
---|
737 | listofmoduletmp = newusemodule; |
---|
738 | } |
---|
739 | /* deallocation tmpuselocallist */ |
---|
740 | compt = 0; |
---|
741 | while ( tmpuselocallist ) |
---|
742 | { |
---|
743 | if ( todebug == 1 && compt == 0 ) |
---|
744 | { |
---|
745 | printf("Deallocation tmpuselocallist\n"); |
---|
746 | compt = 1; |
---|
747 | } |
---|
748 | newusemodule = tmpuselocallist -> suiv; |
---|
749 | free(tmpuselocallist); |
---|
750 | tmpuselocallist = newusemodule; |
---|
751 | } |
---|
752 | /* deallocation tmpparameterlocallist2 */ |
---|
753 | compt = 0; |
---|
754 | while ( tmpparameterlocallist2 ) |
---|
755 | { |
---|
756 | if ( todebug == 1 && compt == 0 ) |
---|
757 | { |
---|
758 | printf("Deallocation tmpparameterlocallist2\n"); |
---|
759 | compt = 1; |
---|
760 | } |
---|
761 | newparam = tmpparameterlocallist2 -> suiv; |
---|
762 | free(tmpparameterlocallist2); |
---|
763 | tmpparameterlocallist2 = newparam; |
---|
764 | } |
---|
765 | /* deallocation tmpparameterlocallist */ |
---|
766 | compt = 0; |
---|
767 | while ( tmpparameterlocallist ) |
---|
768 | { |
---|
769 | if ( todebug == 1 && compt == 0 ) |
---|
770 | { |
---|
771 | printf("Deallocation tmpparameterlocallist\n"); |
---|
772 | compt = 1; |
---|
773 | } |
---|
774 | newparam = tmpparameterlocallist -> suiv; |
---|
775 | free(tmpparameterlocallist); |
---|
776 | tmpparameterlocallist = newparam; |
---|
777 | } |
---|
778 | /* deallocation listmoduleinfile */ |
---|
779 | compt = 0; |
---|
780 | while ( listmoduleinfile ) |
---|
781 | { |
---|
782 | if ( todebug == 1 && compt == 0 ) |
---|
783 | { |
---|
784 | printf("Deallocation listmoduleinfile\n"); |
---|
785 | compt = 1; |
---|
786 | } |
---|
787 | newmodule = listmoduleinfile -> suiv; |
---|
788 | free(listmoduleinfile); |
---|
789 | listmoduleinfile = newmodule; |
---|
790 | } |
---|
791 | /* deallocation listenamelist */ |
---|
792 | compt = 0; |
---|
793 | while ( listenamelist ) |
---|
794 | { |
---|
795 | if ( todebug == 1 && compt == 0 ) |
---|
796 | { |
---|
797 | printf("Deallocation listenamelist\n"); |
---|
798 | compt = 1; |
---|
799 | } |
---|
800 | newnamelist = listenamelist -> suiv; |
---|
801 | free(listenamelist); |
---|
802 | listenamelist = newnamelist; |
---|
803 | } |
---|
804 | /* deallocation NewModuleList */ |
---|
805 | compt = 0; |
---|
806 | while ( NewModuleList ) |
---|
807 | { |
---|
808 | if ( todebug == 1 && compt == 0 ) |
---|
809 | { |
---|
810 | printf("Deallocation NewModuleList\n"); |
---|
811 | compt = 1; |
---|
812 | } |
---|
813 | newnom = NewModuleList -> suiv; |
---|
814 | free(NewModuleList); |
---|
815 | NewModuleList = newnom; |
---|
816 | } |
---|
817 | /* deallocation listofmodules */ |
---|
818 | compt = 0; |
---|
819 | while ( listofmodules ) |
---|
820 | { |
---|
821 | if ( todebug == 1 && compt == 0 ) |
---|
822 | { |
---|
823 | printf("Deallocation listofmodules\n"); |
---|
824 | compt = 1; |
---|
825 | } |
---|
826 | newnom = listofmodules -> suiv; |
---|
827 | free(listofmodules); |
---|
828 | listofmodules = newnom; |
---|
829 | } |
---|
830 | /* deallocation modulelist */ |
---|
831 | compt = 0; |
---|
832 | while ( modulelist ) |
---|
833 | { |
---|
834 | if ( todebug == 1 && compt == 0 ) |
---|
835 | { |
---|
836 | printf("Deallocation modulelist\n"); |
---|
837 | compt = 1; |
---|
838 | } |
---|
839 | newnom = modulelist -> suiv; |
---|
840 | free(modulelist); |
---|
841 | modulelist = newnom; |
---|
842 | } |
---|
843 | /* deallocation Listofvariableinagriffunction */ |
---|
844 | compt = 0; |
---|
845 | while ( Listofvariableinagriffunction ) |
---|
846 | { |
---|
847 | if ( todebug == 1 && compt == 0 ) |
---|
848 | { |
---|
849 | printf("Deallocation Listofvariableinagriffunction\n"); |
---|
850 | compt = 1; |
---|
851 | } |
---|
852 | newnom = Listofvariableinagriffunction -> suiv; |
---|
853 | free(Listofvariableinagriffunction); |
---|
854 | Listofvariableinagriffunction = newnom; |
---|
855 | } |
---|
856 | /* deallocation listofsubroutinewhereagrifisused */ |
---|
857 | compt = 0; |
---|
858 | while ( listofsubroutinewhereagrifisused ) |
---|
859 | { |
---|
860 | if ( todebug == 1 && compt == 0 ) |
---|
861 | { |
---|
862 | printf("Deallocation listofsubroutinewhereagrifisused\n"); |
---|
863 | compt = 1; |
---|
864 | } |
---|
865 | newnom = listofsubroutinewhereagrifisused -> suiv; |
---|
866 | free(listofsubroutinewhereagrifisused); |
---|
867 | listofsubroutinewhereagrifisused = newnom; |
---|
868 | } |
---|
869 | /* deallocation AllocateList */ |
---|
870 | compt = 0; |
---|
871 | while ( AllocateList ) |
---|
872 | { |
---|
873 | if ( todebug == 1 && compt == 0 ) |
---|
874 | { |
---|
875 | printf("Deallocation AllocateList\n"); |
---|
876 | compt = 1; |
---|
877 | } |
---|
878 | newallocate = AllocateList -> suiv; |
---|
879 | free(AllocateList); |
---|
880 | AllocateList = newallocate; |
---|
881 | } |
---|
882 | /* deallocation Listofvarpointtovar */ |
---|
883 | compt = 0; |
---|
884 | while ( Listofvarpointtovar ) |
---|
885 | { |
---|
886 | if ( todebug == 1 && compt == 0 ) |
---|
887 | { |
---|
888 | printf("Deallocation Listofvarpointtovar\n"); |
---|
889 | compt = 1; |
---|
890 | } |
---|
891 | newvarpointtovar = Listofvarpointtovar -> suiv; |
---|
892 | free(Listofvarpointtovar); |
---|
893 | Listofvarpointtovar = newvarpointtovar; |
---|
894 | } |
---|
895 | /* deallocation Listofavailableindices */ |
---|
896 | compt = 0; |
---|
897 | while ( Listofavailableindices ) |
---|
898 | { |
---|
899 | if ( todebug == 1 && compt == 0 ) |
---|
900 | { |
---|
901 | printf("Deallocation Listofavailableindices\n"); |
---|
902 | compt = 1; |
---|
903 | } |
---|
904 | newindice = Listofavailableindices -> suiv; |
---|
905 | free(Listofavailableindices); |
---|
906 | Listofavailableindices = newindice; |
---|
907 | } |
---|
908 | |
---|
909 | |
---|
910 | } |
---|
911 | |
---|
912 | |
---|
913 | |
---|
914 | void deallocation_curdim() |
---|
915 | { |
---|
916 | int compt; |
---|
917 | listdim *newdim; |
---|
918 | |
---|
919 | /* deallocation listdim */ |
---|
920 | compt = 0; |
---|
921 | while ( curdim ) |
---|
922 | { |
---|
923 | if ( todebug == 1 && compt == 0 ) |
---|
924 | { |
---|
925 | printf("Deallocation curdim\n"); |
---|
926 | compt = 1; |
---|
927 | } |
---|
928 | newdim = curdim -> suiv; |
---|
929 | free(curdim); |
---|
930 | curdim = newdim; |
---|
931 | } |
---|
932 | |
---|
933 | } |
---|