/[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 1066 - (show annotations) (download) (as text)
Sun Jan 7 10:02:41 2007 UTC (17 years, 8 months ago) by johnpye
File MIME type: text/x-chdr
File size: 5743 byte(s)
Adding doxygen 'addtogroup' for Solver, Compiler, Integrator.
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 ASC_CASE_H
39 #define ASC_CASE_H
40
41 /** addtogroup compiler Compiler
42 @{
43 */
44
45 /** Case data structure. */
46 struct Case {
47 struct Set *ValueList; /**< List of Values for the Conditions
48 NULL if OTHERWISE */
49 struct gl_list_t *ref; /**< References to RelationInstance
50 ModelInstance or WhenInstance */
51 unsigned active; /**< 1:active 0:inactive */
52 };
53
54 extern struct Case *CreateCase(struct Set *v1, struct gl_list_t *refinst);
55 /**<
56 * <!-- struct Case *CreateCase(vl,refinst); -->
57 * <!-- struct Set *vl; -->
58 * <!-- struct gl_list_t *refinst; -->
59 * Create a Case from information provided for a When data structure.
60 */
61
62 #ifdef NDEBUG
63 #define GetCaseValues(c) ((c)->ValueList)
64 #else
65 #define GetCaseValues(c) GetCaseValuesF(c)
66 #endif
67 /**< Return the List of Values of a Case. */
68 extern struct Set *GetCaseValuesF(struct Case *cs);
69 /**<
70 * <!-- struct Set *GetCaseValuesF(cs); -->
71 * <!-- struct Case *cs; -->
72 * Return the List of Values of a Case. Implementation of GetCaseValues().
73 */
74
75 #ifdef NDEBUG
76 #define GetCaseReferences(c) ((c)->ref)
77 #else
78 #define GetCaseReferences(c) GetCaseReferencesF(c)
79 #endif
80 /**< Return the List of References of a Case. */
81 extern struct gl_list_t *GetCaseReferencesF(struct Case *cs);
82 /**<
83 * <!-- struct gl_list_t *GetCaseReferences(cs) -->
84 * <!-- struct Case *cs; -->
85 * Return the List of References of a Case. Implementation of GetCaseReferences().
86 */
87
88 #ifdef NDEBUG
89 #define GetCaseStatus(c) ((c)->active)
90 #else
91 #define GetCaseStatus(c) GetCaseStatusF(c)
92 #endif
93 /**< Return the Status of a Case. */
94 extern int GetCaseStatusF(struct Case *cs);
95 /**<
96 * <!-- int *GetCaseStatusF(cs); -->
97 * <!-- struct Case *cs; -->
98 * Return the Status of a Case. Implementation of GetCaseStatus().
99 */
100
101 extern struct Case *SetCaseValues(struct Case *cs, struct Set *set);
102 /**<
103 * <!-- struct Case *SetCaseValues(cs, set); -->
104 * <!-- struct Case *cs; -->
105 * <!-- struct Set *set; -->
106 * Set the List of Values of a Case.
107 */
108
109 extern struct Case *SetCaseReferences(struct Case *cs, struct gl_list_t *refinst);
110 /**<
111 * <!-- struct Case *SetCaseReferences(cs,refinst); -->
112 * <!-- struct Case *cs; -->
113 * <!-- struct gl_list_t *refinst; -->
114 * Set the List of References of a Case.
115 */
116
117 extern struct Case *SetCaseStatus(struct Case *cs, int status);
118 /**<
119 * <!-- struct Case *SetCaseStatus(cs,status); -->
120 * <!-- struct Case *cs; -->
121 * <!-- unsigned status; -->
122 * Return the Status of a Case.
123 */
124
125 extern unsigned long NumberCaseRefs(struct Case *cs);
126 /**<
127 * <!-- unsigned long NumberCaseRefs(cs) -->
128 * <!-- struct Case *cs; -->
129 * This will indicate the number of distinct instances to which the
130 * reflist of this case points.
131 */
132
133 extern struct Instance *CaseRef(struct Case *cs, unsigned long casenum);
134 /**<
135 * <!-- struct Instance *CaseRef(cs,casenum) -->
136 * <!-- struct Case *cs; -->
137 * <!-- unsigned long casenum; -->
138 * This will return the casenum'th instance of the case reflist.
139 */
140
141 extern void DestroyCase(struct Case *cs);
142 /**<
143 * <!-- void DestroyCase(cs) -->
144 * <!-- struct Case *cs; -->
145 * Destroy a Case.
146 */
147
148 extern struct Case *CopyCase(struct Case *cs);
149 /**<
150 * <!-- struct Case *CopyCase(cs) -->
151 * <!-- struct Case *cs; -->
152 * Copy a Case.
153 */
154
155 /* @} */
156
157 #endif /* ASC_CASE_H */
158

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