1 |
/* ASCEND modelling environment |
2 |
Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly |
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 |
Initialization Routines. |
22 |
|
23 |
Requires: |
24 |
#include "utilities/ascConfig.h" |
25 |
#include "instance_enum.h" |
26 |
#include "fractions.h" |
27 |
#include "compiler.h" |
28 |
#include "dimen.h" |
29 |
#include "expr_types.h" |
30 |
*//* |
31 |
by Tom Epperly |
32 |
Created: 3/24/1990 |
33 |
Last in CVS: $Revision: 1.11 $ $Date: 1998/03/17 22:08:40 $ $Author: ballan $ |
34 |
*/ |
35 |
|
36 |
#ifndef ASC_INITIALIZE_H |
37 |
#define ASC_INITIALIZE_H |
38 |
|
39 |
/** addtogroup compiler Compiler |
40 |
@{ |
41 |
*/ |
42 |
|
43 |
#include <utilities/ascConfig.h> |
44 |
|
45 |
/** Set the procedure stack limit */ |
46 |
extern void SetProcStackLimit(unsigned long l); |
47 |
/**< |
48 |
@param l the stack limit value to be set. |
49 |
|
50 |
The stack limit starts out at INITSTACKLIMIT. The limit exists to prevent infinite loops from running the machine out of C automatic variable space. |
51 |
*/ |
52 |
|
53 |
/** Initial stack limit. */ |
54 |
#define INITSTACKLIMIT 20 |
55 |
|
56 |
/** Get the procedure stack limit currently set. */ |
57 |
extern unsigned long GetProcStackLimit(void); |
58 |
|
59 |
/** Run a METHOD on a model. */ |
60 |
ASC_DLLSPEC enum Proc_enum Initialize(struct Instance *context, |
61 |
struct Name *name, |
62 |
char *cname, |
63 |
FILE *err, |
64 |
wpflags options, |
65 |
struct gl_list_t *watchpoints, |
66 |
FILE *dplog); |
67 |
/**< |
68 |
@param context instance in which to run the METHOD. |
69 |
@param name initialisation METHOD being called |
70 |
@param cname string form of the METHOD name (used in error messages) |
71 |
@param err file to which error messages are issued |
72 |
@param dplog file to which debugging messages are issued. If NULL, no logging is done (faster). |
73 |
@param wpflags watchpoint settings |
74 |
@param watchpoints list of watchpoints |
75 |
|
76 |
@return Proc_all_ok is all went well, else an error code (@see enum Proc_enum) |
77 |
|
78 |
This procedure will execute the initialization code indicated by name with respect to the context instance. |
79 |
If watchlist is NULL or flog is NULL, the debug output options corresponding to watchlist and flog will be ignored. |
80 |
File pointers 'log' and 'err' should not be the same pointer in a good ui design. |
81 |
|
82 |
Maximum speed comes from @code Initialize(context,procname,cname,ferr,0,NULL,NULL); @endcode |
83 |
*/ |
84 |
|
85 |
/** Run a class-access METHOD, eg "RUN MyType::values" */ |
86 |
extern enum Proc_enum ClassAccessInitialize(struct Instance *context, |
87 |
struct Name *class_name, |
88 |
struct Name *name, |
89 |
char *cname, |
90 |
FILE *err, |
91 |
wpflags options, |
92 |
struct gl_list_t *watchpoints, |
93 |
FILE *dplog); |
94 |
/**< |
95 |
@param class_name the class being called (eg MyType) |
96 |
@param name the METHOD being called (eg values) |
97 |
@param cname string version of method name, for use in error messages |
98 |
@param err file to which error messages will be output |
99 |
@param dplog file to which debugging messages will be output. NULL if no debug output is deired. |
100 |
@param wpflags watchpoint flags |
101 |
@param watchpoints list of watchpoints. NULL if no watchpoints are required. |
102 |
|
103 |
@return Proc_all_ok if success, else an error code. |
104 |
|
105 |
Will attempt to run the initialization procedure given by using so-called class access, i.e., deals with syntax such as "RUN Mytype::values." |
106 |
|
107 |
If watchlist is NULL or flog is NULL, the debug output options corresponding to watchlist and flog will be ignored. error (and possibly debugging) messages are issued on the files given. Maximum speed comes from @code ClassAccessInitialize(context,class,procname,cname,ferr,0,NULL,NULL); @endcode |
108 |
*/ |
109 |
|
110 |
/** Search for a named procedure on an instance */ |
111 |
ASC_DLLSPEC struct InitProcedure *FindProcedure(CONST struct Instance *i, |
112 |
symchar *procname); |
113 |
/**< |
114 |
@param procname the name of the procedure searched for |
115 |
@return pointer to found procedure, or NULL if none found. |
116 |
*/ |
117 |
|
118 |
/** Search a list for a named procedure. */ |
119 |
ASC_DLLSPEC struct InitProcedure *SearchProcList(CONST struct gl_list_t *list, |
120 |
symchar *name); |
121 |
/**< |
122 |
@param list (generally you will use the output from @code GetInitializationList() @endcode) |
123 |
@return pointer to found procedure, or NULL if none found. |
124 |
*/ |
125 |
|
126 |
/* @} */ |
127 |
|
128 |
#endif /* ASC_INITIALIZE_H */ |