1 |
/* ASCEND modelling environment |
2 |
Copyright (C) 1997 Benjamin Andrew Allan |
3 |
Copyright (C) 2006 Carnegie Mellon University |
4 |
|
5 |
This program is free software; you can redistribute it and/or modify |
6 |
it under the terms of the GNU General Public License as published by |
7 |
the Free Software Foundation; either version 2, or (at your option) |
8 |
any later version. |
9 |
|
10 |
This program is distributed in the hope that it will be useful, |
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
GNU General Public License for more details. |
14 |
|
15 |
You should have received a copy of the GNU General Public License |
16 |
along with this program; if not, write to the Free Software |
17 |
Foundation, Inc., 59 Temple Place - Suite 330, |
18 |
Boston, MA 02111-1307, USA. |
19 |
*//** |
20 |
@file |
21 |
Simulation Management for Ascend |
22 |
|
23 |
This module initializes and manages a global list of simulations. |
24 |
These may be interrelated in very twisty ways due to UNIVERSAL and |
25 |
parameter passing. |
26 |
|
27 |
@TODO Simulations need much better management than they currently get, |
28 |
once we start building simulations out of other simulations. |
29 |
For now this file is largely empty. |
30 |
|
31 |
Requires: |
32 |
#include "utilities/ascConfig.h" |
33 |
#include "instance_enum.h" |
34 |
#include "compiler/compiler.h" |
35 |
#include "general/list.h" |
36 |
*//* |
37 |
by Ben Allan |
38 |
Version: $Revision: 1.2 $ |
39 |
Version control file: $RCSfile: simlist.h,v $ |
40 |
Date last modified: $Date: 1997/07/18 12:34:54 $ |
41 |
Last modified by: $Author: mthomas $ |
42 |
*/ |
43 |
|
44 |
#ifndef ASC_SIMLIST_H |
45 |
#define ASC_SIMLIST_H |
46 |
|
47 |
#include <utilities/ascConfig.h> |
48 |
|
49 |
extern int g_compiler_timing; |
50 |
/**< Global flag for whether to perform timing of compiler operations. */ |
51 |
|
52 |
extern struct gl_list_t *g_simulation_list; |
53 |
/**< Global simulation list.*/ |
54 |
|
55 |
extern void Asc_DeAllocSim(struct Instance *inst); |
56 |
/**< |
57 |
* Destroys the instance given. |
58 |
* inst should be a simulation instance, and may be NULL. |
59 |
*/ |
60 |
|
61 |
/** Compilation types for SimsCreateInstance(). */ |
62 |
enum CreateInst_format { |
63 |
e_normal = 0, /**< Normal compilation (default). */ |
64 |
e_no_relations, /**< Compile with no relations. */ |
65 |
e_patch /**< Compile a patch. */ |
66 |
}; |
67 |
|
68 |
ASC_DLLSPEC(struct Instance *) SimsCreateInstance( |
69 |
symchar *type, |
70 |
symchar *name, |
71 |
enum CreateInst_format format, |
72 |
symchar *defmethod |
73 |
); |
74 |
/**< |
75 |
Creates a new simulation instance. |
76 |
This function sets up the call to instantiate with different |
77 |
compiler settings. In all cases Instantiate() will make a copy |
78 |
of the name that is given. format should perhaps be an array |
79 |
of enums or a bit structure to deal with multiple compilation |
80 |
flags. At the moment it is just a simple enum. NULL is |
81 |
returned if either type or name is NULL. |
82 |
|
83 |
The returned instance should be destroyed by the caller using |
84 |
Asc_DeAllocSim() or Asc_DestroySimulations(). |
85 |
|
86 |
@param type Name of the model type to create. |
87 |
@param name Name to give the new simulation. |
88 |
@param format Type of compilation to perform. |
89 |
@param defmethod The method to call after instantiation, if present. |
90 |
@return A pointer to the newly-created simulation instance. |
91 |
*/ |
92 |
|
93 |
ASC_DLLSPEC(void) Asc_DestroySimulations(void); |
94 |
/**< Destroys all known instances on the simulation list. */ |
95 |
|
96 |
|
97 |
/* |
98 |
* Stuff from SimsProc.h |
99 |
*/ |
100 |
|
101 |
extern struct Instance *Asc_FindSimulationTop(symchar *str); |
102 |
/**< Return the sim pointer if there is a sim named *str. */ |
103 |
|
104 |
extern struct Instance *Asc_FindSimulationRoot(symchar *str); |
105 |
/**< Return the top inst pointer if there is a sim named *str. */ |
106 |
|
107 |
extern symchar *Asc_SimsFindSimulationName(CONST struct Instance *sim); |
108 |
/**< |
109 |
* Return the name string of the instance given if it is in the |
110 |
* global sim list. Return null if not. |
111 |
*/ |
112 |
|
113 |
extern void Asc_SetCurrentSim(struct Instance *sim); |
114 |
/**< Sets the current working simulation to the specified simulation. */ |
115 |
|
116 |
ASC_DLLSPEC(struct Instance *) Asc_GetCurrentSim(void); |
117 |
/**< |
118 |
* Returns a pointer to the current working simulation. |
119 |
* Makes no checks on the state of the simulation. |
120 |
*/ |
121 |
|
122 |
extern int Asc_SimsUniqueName(symchar *str); |
123 |
/**< |
124 |
* Checks whether a simulation exists having specified name. |
125 |
* Returns 0 if the name was found, 1 otherwise. |
126 |
*/ |
127 |
|
128 |
extern int Asc_SimsCmpSim(struct Instance *sim1, struct Instance *sim2); |
129 |
/**< |
130 |
* Compares two simulations, based on their names. |
131 |
* Returns 0 if they are the same, non-zero if different. |
132 |
*/ |
133 |
|
134 |
extern void Asc_DeAllocSim(struct Instance *sim); |
135 |
/**< |
136 |
* Deallocates a simulation instance. |
137 |
* The instance and its associated root instance are destroyed using |
138 |
* DestroyInstance() (in instance.h). The name string i(which it owns) |
139 |
* is also destroyed, any external vars associated with the simulation |
140 |
* are cleaned up.<br><br> |
141 |
* |
142 |
* NOTE: |
143 |
* sim is the *Top* of the simulation and *not* the root. As such this |
144 |
* function works on instances of kind SIM_INST. |
145 |
*/ |
146 |
|
147 |
#endif /* ASC_SIMLIST_H */ |