1 |
/* |
2 |
* BrowserQuery.h |
3 |
* by Kirk Abbott and Ben Allan |
4 |
* Created: 1/94 |
5 |
* Version: $Revision: 1.17 $ |
6 |
* Version control file: $RCSfile: BrowserQuery.h,v $ |
7 |
* Date last modified: $Date: 2003/08/23 18:43:04 $ |
8 |
* Last modified by: $Author: ballan $ |
9 |
* |
10 |
* This file is part of the ASCEND Tcl/Tk interface |
11 |
* |
12 |
* Copyright 1997, Carnegie Mellon University |
13 |
* |
14 |
* The ASCEND Tcl/Tk interface is free software; you can redistribute |
15 |
* it and/or modify it under the terms of the GNU General Public License as |
16 |
* published by the Free Software Foundation; either version 2 of the |
17 |
* License, or (at your option) any later version. |
18 |
* |
19 |
* The ASCEND Tcl/Tk interface is distributed in hope that it will be |
20 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 |
* General Public License for more details. |
23 |
* |
24 |
* You should have received a copy of the GNU General Public License |
25 |
* along with the program; if not, write to the Free Software Foundation, |
26 |
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
27 |
* COPYING. COPYING is found in ../compiler. |
28 |
*/ |
29 |
|
30 |
/** @file |
31 |
* Browser Query Routines |
32 |
* <pre> |
33 |
* To include this header, you must include the following: |
34 |
* #include "tcl.h" |
35 |
* #include "utilities/ascConfig.h" |
36 |
* #include "interface/BrowserQuery.h" |
37 |
* </pre> |
38 |
*/ |
39 |
|
40 |
#ifndef __BrowserInst_io_module__ |
41 |
#define __BrowserInst_io_module__ |
42 |
|
43 |
|
44 |
extern int Asc_BrowIsRelationCmd(ClientData cdata, Tcl_Interp *interp, |
45 |
int argc, CONST84 char *argv[]); |
46 |
/**< |
47 |
* <!-- Asc_BrowIsRelationCmd; --> |
48 |
* |
49 |
* Will return 1, if the the instance in question is of relation type |
50 |
* of is an array, of array ... of relation. The normal InstanceType |
51 |
* routines return the empty string for array of relations, and it is |
52 |
* sometimes handy to know apriori what the type of the array is.<br><br> |
53 |
* |
54 |
* Registered as: __brow_isrelation ?current?search?. |
55 |
*/ |
56 |
|
57 |
extern int Asc_BrowIsLogRelCmd(ClientData cdata, Tcl_Interp *interp, |
58 |
int argc, CONST84 char *argv[]); |
59 |
/**< |
60 |
* <!-- Asc_BrowIsLogRelCmd; --> |
61 |
* |
62 |
* Will return 1, if the the instance in question is of logical relation |
63 |
* type of is an array, of array ... of logical relation. The normal |
64 |
* InstanceType routines return the empty string for array of logical |
65 |
* relations, and it is sometimes handy to know apriori what the type of |
66 |
* the array is.<br><br> |
67 |
* |
68 |
* Registered as: __brow_islogrel ?current?search?. |
69 |
*/ |
70 |
|
71 |
extern int Asc_BrowIsWhenCmd(ClientData cdata, Tcl_Interp *interp, |
72 |
int argc, CONST84 char *argv[]); |
73 |
/**< |
74 |
* <!-- Asc_BrowIsWhenCmd; --> |
75 |
* |
76 |
* Will return 1, if the the instance in question is of when |
77 |
* type of is an array, of array ... of when. The normal |
78 |
* InstanceType routines return the empty string for array of whens, |
79 |
* and it is sometimes handy to know apriori what the type of |
80 |
* the array is.<br><br> |
81 |
* |
82 |
* Registered as: __brow_iswhen ?current?search?. |
83 |
*/ |
84 |
|
85 |
extern int Asc_BrowIsInstanceInWhenCmd(ClientData cdata, Tcl_Interp *interp, |
86 |
int argc, CONST84 char *argv[]); |
87 |
/**< |
88 |
* <!-- Asc_BrowIsInstanceInWhenCmd; --> |
89 |
* |
90 |
* Will return 1, if the the instance in question may be in the list |
91 |
* of variables or in some CASE of a WHEN Statement: boolean, integer, |
92 |
* symbol, relations.<br><br> |
93 |
* |
94 |
* Registered as: __brow_isinstanceinwhen ?current?search?. |
95 |
*/ |
96 |
|
97 |
extern int Asc_BrowIsModelCmd(ClientData cdata, Tcl_Interp *interp, |
98 |
int argc, CONST84 char *argv[]); |
99 |
/**< |
100 |
* <!-- Asc_BrowIsModelCmd; --> |
101 |
* |
102 |
* Will return 1, if the the instance in question is of model type |
103 |
* of is an array, of array ... of model. The normal InstanceType |
104 |
* routines return the empty string for array of models, and it is |
105 |
* sometimes handy to know apriori what the type of the array is.<br><br> |
106 |
* |
107 |
* Registered as: __brow_ismodel ?current?search?. |
108 |
*/ |
109 |
|
110 |
extern struct gl_list_t *Asc_BrowShortestPath(CONST struct Instance *i, |
111 |
CONST struct Instance *ref, |
112 |
unsigned int, unsigned int); |
113 |
/**< |
114 |
* Returns the shortest path (instance pointers) from i back to ref. |
115 |
* If ref NULL, goes to top of instance tree. |
116 |
* <!-- Usage: path = Asc_BrowShortestPath(i,ref,0,UINT_MAX); --> |
117 |
* The search is recursive on the unsigned arguments. |
118 |
*/ |
119 |
|
120 |
extern int Asc_BrowWriteNameRec(char *fname, CONST struct InstanceName *rec); |
121 |
/**< |
122 |
* Write the string in the given rec into the fname buffer in the |
123 |
* ascend interface format. fname is assumed big enough. |
124 |
* This call being exported as very handy elsewhere, e.g. solver. baa |
125 |
*/ |
126 |
|
127 |
extern int Asc_BrowWriteAtomValue(char *ftorv, CONST struct Instance *i); |
128 |
/**< |
129 |
* Assumes ftorv is big enough and writes some value appropriate for |
130 |
* the instance i into the string ftorv. |
131 |
* This should be done with a DString in the compiler. |
132 |
*/ |
133 |
|
134 |
extern int Asc_BrowWriteInstanceNameCmd(ClientData cdata, Tcl_Interp *interp, |
135 |
int argc, CONST84 char *argv[]); |
136 |
/**< |
137 |
* <!-- int Asc_BrowWriteInstanceName; --> |
138 |
* Print the instance's name to the specified file. The shortest path to |
139 |
* root is always printed. For the purposes of interface1, root is always |
140 |
* the 'first' instance of a simulation (aka as the simulation base ptr) |
141 |
* or NULL. Will accept the symbolic name of a pointer in the form of |
142 |
* current of search as the basis of its queries. |
143 |
* |
144 |
* Registered as \"iname inst\" - no args" |
145 |
*/ |
146 |
|
147 |
extern int Asc_BrowCountNamesCmd(ClientData cdata, Tcl_Interp *interp, |
148 |
int argc, CONST84 char *argv[]); |
149 |
/**< |
150 |
* <!-- int Asc_BrowCountNamesCmd; --> |
151 |
* Returns the counts of ALIASES for all instances in the entire subtree |
152 |
* given current or search. |
153 |
* returned is a list (with labels) of: |
154 |
* - total unique instances counted. |
155 |
* - total ATOM-like instances counted (ATOM, constant,set) |
156 |
* - total names of these atoms. |
157 |
* - total creating names of these atoms. |
158 |
* - total relation-like instances (relation, logical, when) |
159 |
* - total names of these relations. |
160 |
* - total creating names of these relations. |
161 |
* - total MODEL instances counted. |
162 |
* - total names of these models. |
163 |
* - total creating names of these models. |
164 |
* - total array instances counted. |
165 |
* - total names of these arrays. |
166 |
* - total creating names of these arrays. |
167 |
* |
168 |
* Registered as "count_names" |
169 |
*/ |
170 |
|
171 |
extern int Asc_BrowWriteAliasesCmd(ClientData cdata, Tcl_Interp *interp, |
172 |
int argc, CONST84 char *argv[]); |
173 |
/**< |
174 |
* <!-- int Asc_BrowWriteAliases; --> |
175 |
* Print the instance's names to the interpreter. |
176 |
* |
177 |
* Registered as "ALIASES" |
178 |
*/ |
179 |
|
180 |
extern int Asc_BrowWriteISAsCmd(ClientData cdata, Tcl_Interp *interp, |
181 |
int argc, CONST84 char *argv[]); |
182 |
/**< |
183 |
* <!-- int Asc_BrowWriteISAs; --> |
184 |
* Print the instance's construction names to the interpreter. |
185 |
* |
186 |
* Registered as \"isas\" |
187 |
*/ |
188 |
|
189 |
extern int Asc_BrowWriteCliqueCmd(ClientData cdata, Tcl_Interp *interp, |
190 |
int argc, CONST84 char *argv[]); |
191 |
/**< |
192 |
* <!-- int Asc_WriteClique(f,i) --> |
193 |
* Print all the instance's clique members. |
194 |
* |
195 |
* Registered as \"cliques\" |
196 |
*/ |
197 |
|
198 |
extern int Asc_BrowWriteInstanceCmd(ClientData cdata, Tcl_Interp *interp, |
199 |
int argc, CONST84 char *argv[]); |
200 |
/**< |
201 |
* <!-- Asc_BrowWriteInstanceCmd(cdata,interp,argc,argv) --> |
202 |
*/ |
203 |
|
204 |
/** Registered as. */ |
205 |
#define Asc_BrowWriteInstanceCmdHN "brow_child_list" |
206 |
/** Usage. |
207 |
* |
208 |
* Print i's children in a form that we can readily stuff into the |
209 |
* childBoxes in the Browser. Will take the symbolic name of a pointer |
210 |
* i.e. current or search, to use as the basis of its queries. Will |
211 |
* also accept attributes in the form of TYPE, VALUE, ATOMS |
212 |
* to determine what form the information is returned. |
213 |
*/ |
214 |
#define Asc_BrowWriteInstanceCmdHU \ |
215 |
"<current,search> <all,N> [\"TYPE\",\"VALUE\"] [\"ATOMS\"] [\"PASSED\"]" |
216 |
|
217 |
extern int Asc_BrowWriteAtomChildren(Tcl_Interp *interp, CONST struct Instance *i); |
218 |
/**< |
219 |
* <!-- Asc_BrowWriteAtomChildren --> |
220 |
* Append the children of an atom (with values in display units) to |
221 |
* the interp->result as list elements. |
222 |
*/ |
223 |
|
224 |
extern int Asc_BrowWriteDimensions(char *fdims, CONST dim_type *dimp); |
225 |
/**< |
226 |
* Nearly the string equivalent of PrintDimen in dimen.c, except: |
227 |
* -# this one writes in proper dimensions |
228 |
* -# fdims has the dimensionality of dimp _appended_ to it, except as d |
229 |
* -# fdims is assumed long enough. |
230 |
* -# if dimensionality is wild or none, a * overwrites the string. |
231 |
*/ |
232 |
|
233 |
extern int Asc_BrowIsPlotAllowedCmd(ClientData cdata, Tcl_Interp *interp, |
234 |
int argc, CONST84 char *argv[]); |
235 |
/**< |
236 |
* <!-- int Asc_BrowIsPlotAllowedCmd; --> |
237 |
* Will accept the current of search instance and determine if the type |
238 |
* of the instance is 'plottable'. The current implementation makes use |
239 |
* of the type `plt_plot' as the basis of this decision. Will return 1 |
240 |
* if TRUE, 0 otherwise. This function should not exist.<br><br> |
241 |
* |
242 |
* Registered as : \"b_isplottable ?cur?search?. |
243 |
*/ |
244 |
|
245 |
extern int Asc_BrowPreparePlotFileCmd(ClientData cdata, Tcl_Interp *interp, |
246 |
int argc, CONST84 char *argv[]); |
247 |
/**< |
248 |
* <!-- int Asc_BrowPreparePlotFileCmd; --> |
249 |
* Will operate on the current or the search instance to produce a file |
250 |
* that may be plotted by the existing plotting programs. Requires a |
251 |
* filename arguement and an optional plot_type specifier |
252 |
* PLAIN_PLOT, GNU_PLOT, XGRAPH_PLOT.<br><br> |
253 |
* |
254 |
* Registered as : \"b_prepplotfile\" inst filename type. |
255 |
*/ |
256 |
|
257 |
extern int Asc_BrowRefinesMeCmd(ClientData cdata, Tcl_Interp *interp, |
258 |
int argc, CONST84 char *argv[]); |
259 |
/**< |
260 |
* <!-- int Asc_BrowRefinesMeCmd; --> |
261 |
* Will return ALL the library types that refine the current instance. |
262 |
* If instance typedesc is out of sync with library, returns none. |
263 |
* Will return the empty string if not refined by any types.<br><br> |
264 |
* |
265 |
* Registered as : \"irefines_me\"; |
266 |
*/ |
267 |
|
268 |
extern int Asc_BrowWriteValues(ClientData cdata, Tcl_Interp *interp, |
269 |
int argc, CONST84 char *argv[]); |
270 |
/**< |
271 |
* <!-- bwritevalues [qlfdid] filename acmd <current,root,qlfdid> --> |
272 |
* Write out the real and boolean values of an instance tree starting |
273 |
* at the instance indicated to a file filname. current/root refer to |
274 |
* browser. qlfdid is a full id. Only the first letter of the last arg |
275 |
* is significant.<br><br> |
276 |
* acmd is the string that will be prefixed to the qlfdid value pair, |
277 |
* eg. bwritevalues /tmp/val.txt "ASSIGN {sim" current is one way to write |
278 |
* the values, using the script ASSIGN command. acmd could also be |
279 |
* qassign {sim. As neither of these is the obvious choice in all circum- |
280 |
* stances, the command allows choice. |
281 |
* note that the simulation name should be part of acmd and an open |
282 |
* brace should be provided because a close brace after the name will |
283 |
* be printed. |
284 |
*/ |
285 |
|
286 |
extern int Asc_BrowFindTypeCmd(ClientData cdata, Tcl_Interp *interp, |
287 |
int argc, CONST84 char *argv[]); |
288 |
/**< |
289 |
* Implementation of find by type. More will be said later. |
290 |
* <pre> |
291 |
* Old Usage : __brow_find_type type attribute ?value? |
292 |
* New usage: |
293 |
* __brow_find_type <current,search> <typename> [attr [loval [hival]]] |
294 |
* |
295 |
* The Tcl window corresponding to this function has 4 boxes to fill. |
296 |
* Type, Atributtes, Low Value and High Value. |
297 |
* |
298 |
* There is nothing about this function from Kirk. After looking trough |
299 |
* the code, I can make the following remarks. |
300 |
* |
301 |
* 1) The default context for finding by type is the instance currently |
302 |
* highlighted. |
303 |
* 2) Obviously, the type one wants to find has to be provided in the first |
304 |
* box of the Tcl window. |
305 |
* 3) For each type of instance, there exists a filtering function |
306 |
* which will perform according to the values given in the other |
307 |
* 3 boxes. When the type one provides is a Model or an |
308 |
* array, the filtering functions of these types do nothing. |
309 |
* 4) The box Attributes correponds to the children of the type |
310 |
* selected. So, for example, "included" is a valid attribute of |
311 |
* a relation. |
312 |
* 5) When the Attribute is provided, the value of the |
313 |
* attribute should also be provided in the box "Low Value", if |
314 |
* applicable. For example, for the attribute "included" a valid |
315 |
* value is TRUE (or FALSE). In this way, one can ask for |
316 |
* specific relations among the total list. |
317 |
* 6) There are two special attributes, which do not correpond to |
318 |
* children of an instance: "VALUE" and "UNDEFINED". |
319 |
* i)For example, if the type requested is a boolean, we can |
320 |
* use the attribute VALUE for finding booleans with a particular |
321 |
* value. The value selected should be provided in the box "Lower |
322 |
* Value". This capability can be used for boolean, integer, |
323 |
* symbol, relation, and logic_relation. |
324 |
* Similarly, "UNDEFINED" is used when the value of |
325 |
* a symbol, integer or real has not been defined. In that case |
326 |
* the last two boxes are left empty. |
327 |
* ii)Specifically for the type "relation", the Attribute "VALUE" is |
328 |
* associated with the residual of the relation. We can specify |
329 |
* the range of the residuals we are interesting in, by using the |
330 |
* last two boxes. |
331 |
* |
332 |
* My modification to this function is an extension to deal with |
333 |
* logical relations, and whens. For conditional relations I did |
334 |
* nothing. They will show up in the list of relations. For whens, |
335 |
* I do the same as the case of models and arrays. For Logrelations, |
336 |
* the filtering can be done in terms of the logical residual. |
337 |
* Note that for this case, Feasibles Lower Value for the attribute |
338 |
* "VALUE" are "TRUE" and "FALSE". |
339 |
* |
340 |
* VRR |
341 |
* </pre> |
342 |
*/ |
343 |
|
344 |
extern int Asc_BrowRelationRelopCmd(ClientData cdata, Tcl_Interp *interp, |
345 |
int argc, CONST84 char *argv[]); |
346 |
/**< |
347 |
* <!-- Usage : __brow_reln_relop ?cur?search?. --> |
348 |
* Returns the a string describing the type of the relation. Valid |
349 |
* results are: |
350 |
* equal, notequal, less, greater, maximize, minimize. |
351 |
*/ |
352 |
|
353 |
extern int Asc_BrowClearVarsCmd(ClientData cdata, Tcl_Interp *interp, |
354 |
int argc, CONST84 char *argv[]); |
355 |
/**< |
356 |
* <!-- Asc_BrowClearVarsCmd --> |
357 |
* <!-- usage: free_all_vars [qlfdid] --> |
358 |
* Sets fixed flag of all variables to FALSE in Browser current instance,or if |
359 |
* qlfdid given, in the qlfdid instance. |
360 |
*/ |
361 |
|
362 |
#endif /* __BrowserInst_io_module__ */ |
363 |
|