/[ascend]/trunk/base/generic/compiler/case.h
ViewVC logotype

Contents of /trunk/base/generic/compiler/case.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 669 - (show annotations) (download) (as text)
Wed Jun 21 07:00:45 2006 UTC (13 years, 3 months ago) by johnpye
File MIME type: text/x-chdr
File size: 5707 byte(s)
Merged changes from DAE branch (revisions 702 to 819) back into trunk.
This adds the Integration API to the ASCEND solver (in base/generic).
Also provides pre-alpha support for 'IDA' from the SUNDIALS suite, a DAE solver.
Many other minor code clean-ups, including adoption of new 'ASC_NEW' and friends (to replace 'ascmalloc')
Added some very sketchy stuff providing 'DIFF(...)' syntax, although it is anticipated that this will be removed.
1 /*
2 * Case Processing functions
3 * Version: $Revision: 1.6 $
4 * Version control file: $RCSfile: case.h,v $
5 * Date last modified: $Date: 1997/07/18 12:28:12 $
6 * Last modified by: $Author: mthomas $
7 *
8 * This file is part of the Ascend Language Interpreter.
9 *
10 * Copyright (C) 1997 Carnegie Mellon University
11 *
12 * The Ascend Language Interpreter 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 Ascend Language Interpreter 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 along
23 * with the program; if not, write to the Free Software Foundation, Inc., 675
24 * Mass Ave, Cambridge, MA 02139 USA. Check the file named COPYING.
25 */
26
27 /** @file
28 * Case Processing functions.
29 * <pre>
30 * When #including case.h, make sure these files are #included first:
31 * #include "utilities/ascConfig.h"
32 * #include "compiler.h"
33 * #include "list.h"
34 * #include "expr_types.h"
35 * </pre>
36 */
37
38 #ifndef __CASE_H_SEEN__
39 #define __CASE_H_SEEN__
40
41 /** Case data structure. */
42 struct Case {
43 struct Set *ValueList; /**< List of Values for the Conditions
44 NULL if OTHERWISE */
45 struct gl_list_t *ref; /**< References to RelationInstance
46 ModelInstance or WhenInstance */
47 unsigned active; /**< 1:active 0:inactive */
48 };
49
50 extern struct Case *CreateCase(struct Set *v1, struct gl_list_t *refinst);
51 /**<
52 * <!-- struct Case *CreateCase(vl,refinst); -->
53 * <!-- struct Set *vl; -->
54 * <!-- struct gl_list_t *refinst; -->
55 * Create a Case from information provided for a When data structure.
56 */
57
58 #ifdef NDEBUG
59 #define GetCaseValues(c) ((c)->ValueList)
60 #else
61 #define GetCaseValues(c) GetCaseValuesF(c)
62 #endif
63 /**< Return the List of Values of a Case. */
64 extern struct Set *GetCaseValuesF(struct Case *cs);
65 /**<
66 * <!-- struct Set *GetCaseValuesF(cs); -->
67 * <!-- struct Case *cs; -->
68 * Return the List of Values of a Case. Implementation of GetCaseValues().
69 */
70
71 #ifdef NDEBUG
72 #define GetCaseReferences(c) ((c)->ref)
73 #else
74 #define GetCaseReferences(c) GetCaseReferencesF(c)
75 #endif
76 /**< Return the List of References of a Case. */
77 extern struct gl_list_t *GetCaseReferencesF(struct Case *cs);
78 /**<
79 * <!-- struct gl_list_t *GetCaseReferences(cs) -->
80 * <!-- struct Case *cs; -->
81 * Return the List of References of a Case. Implementation of GetCaseReferences().
82 */
83
84 #ifdef NDEBUG
85 #define GetCaseStatus(c) ((c)->active)
86 #else
87 #define GetCaseStatus(c) GetCaseStatusF(c)
88 #endif
89 /**< Return the Status of a Case. */
90 extern int GetCaseStatusF(struct Case *cs);
91 /**<
92 * <!-- int *GetCaseStatusF(cs); -->
93 * <!-- struct Case *cs; -->
94 * Return the Status of a Case. Implementation of GetCaseStatus().
95 */
96
97 extern struct Case *SetCaseValues(struct Case *cs, struct Set *set);
98 /**<
99 * <!-- struct Case *SetCaseValues(cs, set); -->
100 * <!-- struct Case *cs; -->
101 * <!-- struct Set *set; -->
102 * Set the List of Values of a Case.
103 */
104
105 extern struct Case *SetCaseReferences(struct Case *cs, struct gl_list_t *refinst);
106 /**<
107 * <!-- struct Case *SetCaseReferences(cs,refinst); -->
108 * <!-- struct Case *cs; -->
109 * <!-- struct gl_list_t *refinst; -->
110 * Set the List of References of a Case.
111 */
112
113 extern struct Case *SetCaseStatus(struct Case *cs, int status);
114 /**<
115 * <!-- struct Case *SetCaseStatus(cs,status); -->
116 * <!-- struct Case *cs; -->
117 * <!-- unsigned status; -->
118 * Return the Status of a Case.
119 */
120
121 extern unsigned long NumberCaseRefs(struct Case *cs);
122 /**<
123 * <!-- unsigned long NumberCaseRefs(cs) -->
124 * <!-- struct Case *cs; -->
125 * This will indicate the number of distinct instances to which the
126 * reflist of this case points.
127 */
128
129 extern struct Instance *CaseRef(struct Case *cs, unsigned long casenum);
130 /**<
131 * <!-- struct Instance *CaseRef(cs,casenum) -->
132 * <!-- struct Case *cs; -->
133 * <!-- unsigned long casenum; -->
134 * This will return the casenum'th instance of the case reflist.
135 */
136
137 extern void DestroyCase(struct Case *cs);
138 /**<
139 * <!-- void DestroyCase(cs) -->
140 * <!-- struct Case *cs; -->
141 * Destroy a Case.
142 */
143
144 extern struct Case *CopyCase(struct Case *cs);
145 /**<
146 * <!-- struct Case *CopyCase(cs) -->
147 * <!-- struct Case *cs; -->
148 * Copy a Case.
149 */
150
151 #endif /* __CASE_H_SEEN__ */
152

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22