1 |
/* |
2 |
* SimsProc.h |
3 |
* by Kirk Abbott and Ben Allan |
4 |
* Created: 1/94 |
5 |
* Version: $Revision: 1.12 $ |
6 |
* Version control file: $RCSfile: SimsProc.h,v $ |
7 |
* Date last modified: $Date: 2003/08/23 18:43:08 $ |
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 |
* Simulation procedures. |
32 |
* <pre> |
33 |
* To include this header, you must include the following: |
34 |
* #include "tcl.h" |
35 |
* #include "utilities/ascConfig.h" |
36 |
* #include "compiler/compiler.h" |
37 |
* #include "compiler/instance_enum.h" |
38 |
* #include "interface/SimsProc.h" |
39 |
* </pre> |
40 |
*/ |
41 |
|
42 |
#ifndef ASCTK_SIMSPROC_H |
43 |
#define ASCTK_SIMSPROC_H |
44 |
|
45 |
extern int Asc_SimsQueryCmd(ClientData cdata, Tcl_Interp *interp, |
46 |
int argc, CONST84 char *argv[]); |
47 |
/**< |
48 |
* <!-- int Asc_SimsQueryCmd --> |
49 |
* Simulation name utility. |
50 |
* -# sims getcurrent -- |
51 |
* Returns the name of the current simualation. |
52 |
* If the simulation is not found then, returns "1" or ""; else it |
53 |
* returns the name of the simulation. |
54 |
* -# sims setcurrent simname -- |
55 |
* Searches for the simulation that matches the specified name. If found |
56 |
* sets the current simulation and returns "0". Otherwise it returns "1". |
57 |
* |
58 |
* Registered as : \"sims arg ?args?\"; |
59 |
*/ |
60 |
|
61 |
extern int Asc_SimsUniqueNameCmd(ClientData dummy, Tcl_Interp *interp, |
62 |
int argc, CONST84 char *argv[]); |
63 |
/**< |
64 |
* <!-- int Asc_SimsUniqueNameCmd --> |
65 |
* Returns 1 if name is not a simulation instance or if called with |
66 |
* wrong number of args. Returns 0 if simulation name exists.<br><br> |
67 |
* |
68 |
* Registered as : unique \"name\"; |
69 |
*/ |
70 |
|
71 |
extern int Asc_SimsCreateInstanceCmd(ClientData cdata, Tcl_Interp *interp, |
72 |
int argc, CONST84 char *argv[]); |
73 |
/**< |
74 |
* <!-- int CreateInstance_Callback; --> |
75 |
* A blatant ripofff of Tom Epperlys CreateInstance. |
76 |
* Creates a simulation instance and adds to the global simlist. |
77 |
* Returns 0 if failed, 1 if ok;<br><br> |
78 |
* |
79 |
* Registered as : screate \"simname\" \"type\". |
80 |
*/ |
81 |
|
82 |
extern int Asc_SimsResumeInstantiateCmd(ClientData cdata, Tcl_Interp *interp, |
83 |
int argc, CONST84 char *argv[]); |
84 |
/**< |
85 |
* <!-- int Asc_SimsResumeInstantiateCmd; --> |
86 |
* Returns "0" if sim not found, 1 if found. |
87 |
* |
88 |
* Registered as : sresume \"simname\"; |
89 |
*/ |
90 |
|
91 |
extern int Asc_BrowResumeInstantiateCmd(ClientData cdata, Tcl_Interp *interp, |
92 |
int argc, CONST84 char *argv[]); |
93 |
/**< |
94 |
* <!-- int Asc_BrowResumeInstantiateCmd; --> |
95 |
* Browser callback to resume compilation. |
96 |
* Assumes instance to be dealt with is in g_root. Returns "".<br><br> |
97 |
* |
98 |
* Registered as : bresume; |
99 |
*/ |
100 |
|
101 |
extern int Asc_SimsCopyInstanceCmd(ClientData cdata, Tcl_Interp *interp, |
102 |
int argc, CONST84 char *argv[]); |
103 |
/**< |
104 |
* <!-- int Asc_SimsCopyInstanceCmd; KAA_DEBUG --> |
105 |
* Will attempt to take the given qualified id id and 'copy' it. |
106 |
* It will destroy the information immediately after. This is some |
107 |
* experimental code.<br><br> |
108 |
* |
109 |
* Registered as : __sims_copy qlfdid; |
110 |
*/ |
111 |
|
112 |
extern int Asc_SimsProtoTypeInstanceCmd(ClientData cdata, Tcl_Interp *interp, |
113 |
int argc, CONST84 char *argv[]); |
114 |
/**< |
115 |
* <!-- int Asc_SimsProtoTypeInstanceCmd; KAA_DEBUG --> |
116 |
* Will attempt to take the given qualified id id and prototype it. |
117 |
* It will add the instance to the prototype library. It will copy<br><br> |
118 |
* |
119 |
* Registered as : __sims_proto qlfdid; |
120 |
*/ |
121 |
|
122 |
extern int Asc_SimsSaveInstanceCmd(ClientData cdata, Tcl_Interp *interp, |
123 |
int argc, CONST84 char *argv[]); |
124 |
/**< |
125 |
* <!-- inst Asc_SimsSaveInstanceCmd: KAA_DEBUG --> |
126 |
* Will attemptlt to take the given qualified id and 'save' it to |
127 |
* the specified file. This is still experimental code but hopefully |
128 |
* not for long. The details of the save format may be found in |
129 |
* instance_io.[ch]; If all goes well there will be a matching function |
130 |
* called SimsRestoreInstanceCmd();<br><br> |
131 |
* |
132 |
* Registered as : __sims_saveinst qlfdid file |
133 |
*/ |
134 |
|
135 |
extern int Asc_SimsUpdateInstanceCmd(ClientData cdata, Tcl_Interp *interp, |
136 |
int argc, CONST84 char *argv[]); |
137 |
/**< |
138 |
* <!-- int Asc_SimsUpdateInstanceCmd; KAA_DEBUG --> |
139 |
* Will attempt to take the given qualified id and 'update' it |
140 |
* using the information found in the file 'file', or using the given |
141 |
* type information. At the moment it reads the instructions from a |
142 |
* file. The primitives used may be found in compiler/instantiate.c<br><br> |
143 |
* |
144 |
* Registered as : __sims_update qlfdid <file,type>; |
145 |
*/ |
146 |
|
147 |
extern int Asc_SimsDestroySimulationCmd(ClientData cdata, Tcl_Interp *interp, |
148 |
int argc, CONST84 char *argv[]); |
149 |
/**< |
150 |
* <!-- int Asc_SimsDestroySimulationCmd; --> |
151 |
* Returns 1 if successful, returns 0 if not. |
152 |
* |
153 |
* Registered as : sdestroy \"simname\"; |
154 |
*/ |
155 |
|
156 |
extern int Asc_BrowShowPendings(ClientData cdata, Tcl_Interp *interp, |
157 |
int argc, CONST84 char *argv[]); |
158 |
/**< |
159 |
* <!-- int Asc_BrowShowPendings; --> |
160 |
* Returns the number of pending statements. |
161 |
* Call is: |
162 |
* - "bnumpendings simulation sim_name" -- checks given sim_name. |
163 |
* - "bnumpendings instance current" -- checks current instance. |
164 |
* - "bnumpendings instance search" -- checks search instance. |
165 |
* Will return > 1 if there are any pending statements. |
166 |
* Returns a BIG number if no instance. |
167 |
* For more details, use BrowWritePendings.<br><br> |
168 |
* |
169 |
* Registered as : \"bnumpendings\" ?simulation?instance? ?sim?search?current? |
170 |
*/ |
171 |
|
172 |
extern int Asc_BrowWritePendingsSTDOUT(ClientData cdata, Tcl_Interp *interp, |
173 |
int argc, CONST84 char *argv[]); |
174 |
/**< |
175 |
* <!-- int Asc_BrowWritePendingsSTDOUT; --> |
176 |
* Writes to stdout the list of pending statements for the given |
177 |
* simulation. Will return an error if the simulation does not exist or |
178 |
* the sim->root instance is NULL.<br><br> |
179 |
* |
180 |
* Registered as: \"bwritependings\" simname. |
181 |
*/ |
182 |
|
183 |
extern int Asc_SimListPending(ClientData cdata, Tcl_Interp *interp, |
184 |
int argc, CONST84 char *argv[]); |
185 |
/**< |
186 |
* <!-- int Asc_SimListPending ()a; --> |
187 |
* Will print all the unassigned constants and undefined structures and |
188 |
* unexecuted statements in a simulation. simname is the name of an |
189 |
* instance in the global simulation list. |
190 |
* Examples: |
191 |
* - simlistpendings tf |
192 |
* writes to stdout the pending messages of simulation tf |
193 |
* - simlistpendings tf /tmp/asctfpend1374.1 |
194 |
* writes to scratch file /tmp/asctfpend1374. the pending messages of |
195 |
* simulation tf. |
196 |
* |
197 |
* Registered as: simlistpending simname [optional filename]"; |
198 |
*/ |
199 |
|
200 |
STDHLF_H(Asc_SimBinTokenSetOptions); |
201 |
extern int Asc_SimBinTokenSetOptions(ClientData, Tcl_Interp*, int, CONST84 char**); |
202 |
/** Registered as */ |
203 |
#define Asc_SimBinTokenSetOptionsHN "sim_BinTokenSetOptions" |
204 |
/** Usage */ |
205 |
#define Asc_SimBinTokenSetOptionsHU \ |
206 |
Asc_SimBinTokenSetOptionsHN " <src obj lib build delete" \ |
207 |
" maxrels verbose housekeep>" |
208 |
/** Short help text */ |
209 |
#define Asc_SimBinTokenSetOptionsHS \ |
210 |
"Defines the next set of file names and other misc to build/load with" |
211 |
/** Long help text part 1 */ |
212 |
#define Asc_SimBinTokenSetOptionsHL "\ |
213 |
* Specifies full path names for source, object, and shared object files\n\ |
214 |
* to be used in the next compilation of binary token relations.\n\ |
215 |
* Names must be consistent and the name of the shared object must\n\ |
216 |
* be unique, e.g. where N is a number changing between instantiations:\n\ |
217 |
* /tmp/fooN.c /tmp/fooN.o /tmp/fooN.so <build command> /bin/rm 0 1 1000.\n\ |
218 |
* verbose is a code generation option 1 makes more readable code which\n\ |
219 |
* may be slower for cc to digest. housekeep if 1 causes intermediate\n\ |
220 |
* files to be aggressively deleted. maxrels is the most equations to\n\ |
221 |
* be allowed in one generated file. If more are needed, binary will not\n\ |
222 |
* be generated. If maxrels = 0, we ignore C generation completely.\n" |
223 |
/** Long help text part 2 */ |
224 |
#define Asc_SimBinTokenSetOptionsHL2 "\ |
225 |
* Bugs: needs to have additional arguments for coping with F77, Java, etc.\n\ |
226 |
* Note: This function is called indirectly from sim_create, because\n\ |
227 |
* we need consistently updated version values and don't trust the tcl\n\ |
228 |
* programmer to remember that. Tinkering, if needed, should be done via\n\ |
229 |
* Sim_SetupBinTokenCC in LibraryProc.tcl\n\ |
230 |
" |
231 |
|
232 |
#endif /* ASCTK_SIMSPROC_H */ |
233 |
|