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 | /* AddvartoParamlist_1 */ |
---|
42 | /******************************************************************************/ |
---|
43 | /* This subroutines is used to add the variable defined in common in the */ |
---|
44 | /******************************************************************************/ |
---|
45 | /* */ |
---|
46 | /******************************************************************************/ |
---|
47 | void AddvartoParamlist_1(listvar *listin) |
---|
48 | { |
---|
49 | listvar *parcours; |
---|
50 | |
---|
51 | if ( firstpass == 1 ) |
---|
52 | { |
---|
53 | if ( !parameterlist ) |
---|
54 | { |
---|
55 | parameterlist = listin; |
---|
56 | } |
---|
57 | else |
---|
58 | { |
---|
59 | parcours = parameterlist; |
---|
60 | while (parcours->suiv) parcours=parcours->suiv; |
---|
61 | |
---|
62 | parcours->suiv = listin; |
---|
63 | } |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|
67 | /******************************************************************************/ |
---|
68 | /* UpdateparameterlistWithlistvarindoloop_1 */ |
---|
69 | /******************************************************************************/ |
---|
70 | /* This subroutines is used to add the variable defined in common in the */ |
---|
71 | /******************************************************************************/ |
---|
72 | /* */ |
---|
73 | /******************************************************************************/ |
---|
74 | void UpdateparameterlistWithlistvarindoloop_1() |
---|
75 | { |
---|
76 | listvar *parcours; |
---|
77 | listvar *parcours2; |
---|
78 | listvar *parcours3; |
---|
79 | listvar *parcoursprec; |
---|
80 | int out; |
---|
81 | |
---|
82 | parcoursprec = (listvar * )NULL; |
---|
83 | parcours = parameterlist; |
---|
84 | while ( parcours ) |
---|
85 | { |
---|
86 | if ( !strcasecmp(parcours->var->subroutinename,subroutinename) ) |
---|
87 | { |
---|
88 | /* We should look in the listvarindoloop if this variable is present */ |
---|
89 | parcours2=listvarindoloop; |
---|
90 | out=0; |
---|
91 | while( parcours2 && out == 0 ) |
---|
92 | { |
---|
93 | if ( !strcasecmp(parcours->var->nomvar,parcours2->var->nomvar) && |
---|
94 | !strcasecmp(parcours->var->subroutinename, |
---|
95 | parcours2->var->modulename) |
---|
96 | ) |
---|
97 | { |
---|
98 | parcours->var->VariableIsParameter = 1; |
---|
99 | /* we should find in the globliste the type of this variable */ |
---|
100 | parcours3 = globliste; |
---|
101 | while ( parcours3 && out == 0 ) |
---|
102 | { |
---|
103 | if ( !strcasecmp(parcours3->var->nomvar,parcours->var->nomvar) ) |
---|
104 | { |
---|
105 | out = 1 ; |
---|
106 | strcpy(parcours->var->typevar,parcours3->var->typevar); |
---|
107 | } |
---|
108 | else |
---|
109 | { |
---|
110 | parcours3 = parcours3->suiv; |
---|
111 | } |
---|
112 | } |
---|
113 | out = 1 ; |
---|
114 | } |
---|
115 | else |
---|
116 | { |
---|
117 | parcours2 = parcours2->suiv; |
---|
118 | } |
---|
119 | } |
---|
120 | if ( out == 0 ) |
---|
121 | { |
---|
122 | /* we did not find it */ |
---|
123 | /* we should remove the variable from the parameterlist */ |
---|
124 | if ( parcours == parameterlist) |
---|
125 | { |
---|
126 | parameterlist = parameterlist->suiv; |
---|
127 | parcours = parameterlist; |
---|
128 | } |
---|
129 | else |
---|
130 | { |
---|
131 | parcoursprec->suiv = parcours->suiv; |
---|
132 | parcours = parcoursprec->suiv; |
---|
133 | } |
---|
134 | } |
---|
135 | else |
---|
136 | { |
---|
137 | parcoursprec = parcours; |
---|
138 | parcours = parcours->suiv; |
---|
139 | } |
---|
140 | } |
---|
141 | else |
---|
142 | { |
---|
143 | parcoursprec = parcours; |
---|
144 | parcours = parcours->suiv; |
---|
145 | } |
---|
146 | } |
---|
147 | } |
---|