1 |
/* |
2 |
* Conditional Modeling Configuration File |
3 |
* by Vicente Rico-Ramirez |
4 |
* Created: 04/97 |
5 |
* Version: $Revision: 1.6 $ |
6 |
* Version control file: $RCSfile: cond_config.h,v $ |
7 |
* Date last modified: $Date: 1998/03/30 22:06:51 $ |
8 |
* Last modified by: $Author: rv2a $ |
9 |
* |
10 |
* This file is part of the SLV solver. |
11 |
* |
12 |
* The SLV solver is free software; you can redistribute |
13 |
* it and/or modify it under the terms of the GNU General Public License as |
14 |
* published by the Free Software Foundation; either version 2 of the |
15 |
* License, or (at your option) any later version. |
16 |
* |
17 |
* The SLV solver is distributed in hope that it will be |
18 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
20 |
* General Public License for more details. |
21 |
* |
22 |
* You should have received a copy of the GNU General Public License |
23 |
* along with the program; if not, write to the Free Software Foundation, |
24 |
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
25 |
* COPYING. COPYING is found in ../compiler. |
26 |
* |
27 |
*/ |
28 |
|
29 |
#ifndef _cond_config_h_seen_ |
30 |
#define _cond_config_h_seen_ |
31 |
|
32 |
/* |
33 |
* requires #include "system.h" |
34 |
* requires #include "instance_enum.h" |
35 |
*/ |
36 |
|
37 |
extern void set_rels_status_in_when(struct w_when *, uint32); |
38 |
/* |
39 |
* Set the ACTIVE bit to FALSE/TRUE for all the relations and logrelations |
40 |
* included in the list of when |
41 |
*/ |
42 |
|
43 |
extern void analyze_when(struct w_when *); |
44 |
/* |
45 |
* Analyzes the when list to see which case is active in each of the |
46 |
* whens. For all the relations in the matched cases, set the ACTIVE |
47 |
* flag to TRUE |
48 |
*/ |
49 |
|
50 |
extern void set_active_rels_in_list(struct rel_relation **); |
51 |
/* |
52 |
* Set the ACTIVE bit to TRUE for all the rels included in the |
53 |
* rel list. |
54 |
*/ |
55 |
|
56 |
extern void set_active_rels_as_invariant(struct rel_relation **); |
57 |
/* |
58 |
* Sets the INVARIANT bit to TRUE for all the rels in the rel list which |
59 |
* are ACTIVE. Sets it to FALSE for all the INACTIVE rels. |
60 |
*/ |
61 |
|
62 |
extern void set_active_logrels_in_list(struct logrel_relation **); |
63 |
/* |
64 |
* Sets the ACTIVE bit to TRUE for all the logrels included in the |
65 |
* logrel list. |
66 |
*/ |
67 |
|
68 |
extern void set_inactive_vars_in_list(struct var_variable **); |
69 |
/* |
70 |
* Sets the ACTIVE bit to FALSE for all the vars included in the |
71 |
* var list |
72 |
*/ |
73 |
|
74 |
extern void set_invariant_in_rels_list(struct rel_relation **, uint32); |
75 |
/* |
76 |
* Set the INVARIAT bit to value for all the rels included in the |
77 |
* rel list. |
78 |
*/ |
79 |
|
80 |
void set_in_cur_subregion_in_rels_list(struct rel_relation **,uint32); |
81 |
/* |
82 |
* Set the IN_CUR_SUBREGION bit to value for all the rels included in the |
83 |
* rel list. |
84 |
*/ |
85 |
|
86 |
extern void set_inactive_disvars_in_list(struct dis_discrete **); |
87 |
/* |
88 |
* Set the ACTIVE bit to FALSE for all the discrete vars included in the |
89 |
* discrete var list |
90 |
*/ |
91 |
|
92 |
extern void set_active_vars_in_active_rels(struct rel_relation **); |
93 |
/* |
94 |
* Set the ACTIVE bit to TRUE for all the variables included in |
95 |
* ACTIVE relations. |
96 |
*/ |
97 |
|
98 |
extern void set_active_disvars_in_active_logrels(struct logrel_relation **); |
99 |
/* |
100 |
* Set the ACTIVE bit to TRUE for all the discrete variables included in |
101 |
* ACTIVE logrelations. |
102 |
*/ |
103 |
|
104 |
extern void set_active_vars_at_bnd(slv_system_t, struct gl_list_t *); |
105 |
/* |
106 |
* Set the ACTIVE bit to TRUE for all the variables incident in all |
107 |
* the relations of all the subregions neighboring a boundary(ies) |
108 |
*/ |
109 |
|
110 |
extern void identify_invariant_rels_at_bnd(slv_system_t, struct gl_list_t *); |
111 |
/* |
112 |
* Set the INVARIANT flag to TRUE for all the relations invariant with |
113 |
* respect to the current boundary(ies) |
114 |
*/ |
115 |
|
116 |
void set_active_rels_in_subregion(slv_system_t,int32 *,int32, |
117 |
struct gl_list_t *); |
118 |
/* |
119 |
* get the list of whens for each discrete variable in disvars, |
120 |
* set all the relation in those whens as inactive, and then |
121 |
* set as active the relations corresponding to the cases passed |
122 |
* as argument in cases. |
123 |
*/ |
124 |
|
125 |
void identify_variant_rels_in_subregion(slv_system_t); |
126 |
/* |
127 |
* For each relation active and not invariant, set the flag |
128 |
* in_cur_subregion as TRUE. First, the same flag is initialized |
129 |
* to FALSE for all of the relations |
130 |
*/ |
131 |
|
132 |
void set_active_vars_in_subregion(slv_system_t); |
133 |
/* |
134 |
* Set the ACTIVE bit flag as TRUE, for all of the variables |
135 |
* incident in the currently active relations. Used for analysis |
136 |
* at a boundary. |
137 |
*/ |
138 |
|
139 |
extern void enumerate_cases_in_when(struct w_when *); |
140 |
/* |
141 |
* Finds the number of cases in a when. This number will include nested |
142 |
* cases (in nested when statements). It also assigns a identifier number |
143 |
* to each case in the when statement. If this number is equal to -1 |
144 |
* for some case, it implies that the case contains nested whens and it |
145 |
* is necessary to perform a recursive analysis to find the number of the |
146 |
* cases embedded in the current case. |
147 |
* In general, the number assigned to each of the cases is only for |
148 |
* identification purposes, so, 1,2,3, whatever, does not matter, we only |
149 |
* want to distinguish among them. The identification number depends |
150 |
* on the order of the whens in the master when list, which is not |
151 |
* expected to change unless we destroy the system. |
152 |
* |
153 |
* This function uses the global variable g_case_number. Any caller |
154 |
* function has to reinitialize that global variable if it is required. |
155 |
*/ |
156 |
|
157 |
|
158 |
extern int *cases_matching(struct gl_list_t *, int *); |
159 |
/* |
160 |
* Given a list of discrete variables, it finds which cases apply |
161 |
* in the whens depending on those variables. |
162 |
* The caller funtion should modify the values of these discrete |
163 |
* variables so that we can make combinatorial search. Also, |
164 |
* the list should contain discrete variables INWHEN. |
165 |
* This functions assumes that the cases in the whens have been |
166 |
* previously enumerated. Need to check performance regarding the |
167 |
* visiting of cases when some of the whens are nested. |
168 |
* It returns an array containing the (ID number of) cases which |
169 |
* applies for the current values of the discrete varaibles. |
170 |
*/ |
171 |
|
172 |
|
173 |
extern void configure_conditional_problem(int,struct w_when **, |
174 |
struct rel_relation **, |
175 |
struct logrel_relation **, |
176 |
struct var_variable **); |
177 |
/* |
178 |
* configure_conditional_problem |
179 |
* analyze the when statements included in our problem so that, we |
180 |
* determine which rels, vars, disvars, and logrels are currently |
181 |
* active. It is called by analyze.c at the time of the system |
182 |
* building. For reconfiguration of the system call |
183 |
* reanalyze_solver_lists |
184 |
*/ |
185 |
|
186 |
extern void reanalyze_solver_lists(slv_system_t); |
187 |
/* |
188 |
* For conditional modeling. This functions analyzes the when's |
189 |
* of the solver when list and set the current value of the |
190 |
* flag ACTIVE for variables and relations in the solvers lists. |
191 |
*/ |
192 |
|
193 |
extern int system_reanalyze(slv_system_t, SlvBackendToken); |
194 |
/* |
195 |
* For conditional modeling. If a whenvarlist has been changed |
196 |
* or a method has been run, this function calls |
197 |
* reanlyze_solver_lists. |
198 |
*/ |
199 |
|
200 |
extern int build_rel_solver_from_master(struct rel_relation **, |
201 |
struct rel_relation **); |
202 |
/* |
203 |
* Build the rel solver list from the master list in the case of our |
204 |
* problem contains when's. This function is not currently in use. It |
205 |
* could be use to build a solver rel list of ACTIVE relations, by |
206 |
* using a master rel list with all of the relations in it. These |
207 |
* ACTIVE relations could be INCLUDED or UNINCLUDED. It returns the |
208 |
* number of relation in the list. |
209 |
*/ |
210 |
|
211 |
extern int build_logrel_solver_from_master(struct logrel_relation **, |
212 |
struct logrel_relation **); |
213 |
/* |
214 |
* Build the logrel solver list from the master list in the case of our |
215 |
* problem contains when's. This function is not currently in use. It |
216 |
* could be use to build a solver logrel list of ACTIVE logrelations, by |
217 |
* using a master logrel list with all of the logrelations in it. These |
218 |
* ACTIVE logrelations could be INCLUDED or UNINCLUDED. It returns the |
219 |
* number of logrelation in the list. |
220 |
*/ |
221 |
|
222 |
extern int build_var_solver_from_master(struct var_variable **, |
223 |
struct var_variable **); |
224 |
/* |
225 |
* Build the var solver list from the master list in the case of our |
226 |
* problem contains when's. This function is not currently in use. It |
227 |
* could be use to build a solver var list of ACTIVE variables (Vars |
228 |
* incident in ACTIVE relations). It returns the number of variables |
229 |
* in the list. |
230 |
*/ |
231 |
|
232 |
extern int build_disvar_solver_from_master(struct dis_discrete **, |
233 |
struct dis_discrete **); |
234 |
/* |
235 |
* Build the discrete var solver list from the master list in the case |
236 |
* of our problem contains when's. This function is not currently in use. |
237 |
* It could be use to build a solver discrete var list of ACTIVE discrete |
238 |
* variables (Discrete Vars incident in ACTIVE logrelations). It returns |
239 |
* the number of discrete variables in the list. |
240 |
*/ |
241 |
|
242 |
/* |
243 |
* extern void rebuild_solvers_from_masters(slv_system_t); |
244 |
* |
245 |
* For conditional modeling. This function rebuilds the solver |
246 |
* list using the master lists and the analysis of the when |
247 |
* structures present in the problem. It is not currently in |
248 |
* use. It would be used if I want only ACTIVE relations |
249 |
* (INCLUDED or NOT) and ACTIVE vars in the solver lists |
250 |
*/ |
251 |
|
252 |
#endif /* _cond_config_h_seen_ */ |