1 |
/* |
2 |
* SELECT List Routines |
3 |
* by Vicente Rico-Ramirez |
4 |
* 1/97 |
5 |
* Version: $Revision: 1.10 $ |
6 |
* Version control file: $RCSfile: select.h,v $ |
7 |
* Date last modified: $Date: 1997/07/29 15:52:55 $ |
8 |
* Last modified by: $Author: rv2a $ |
9 |
* |
10 |
* This file is part of the Ascend Language Interpreter. |
11 |
* |
12 |
* Copyright (C) 1997 Carnegie Mellon University |
13 |
* |
14 |
* The Ascend Language Interpreter 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 Language Interpreter 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 along |
25 |
* with the program; if not, write to the Free Software Foundation, Inc., 675 |
26 |
* Mass Ave, Cambridge, MA 02139 USA. Check the file named COPYING. |
27 |
*/ |
28 |
|
29 |
/** @file |
30 |
* SELECT List Routines. |
31 |
* <pre> |
32 |
* When #including select.h, make sure these files are #included first: |
33 |
* #include "utilities/ascConfig.h" |
34 |
* #include "compiler.h" |
35 |
* #include "sets.h" |
36 |
* #include "exprs.h" |
37 |
* #include "bit.h" |
38 |
* #include "stattypes.h" |
39 |
* </pre> |
40 |
*/ |
41 |
|
42 |
#ifndef ASC_SELECT_H |
43 |
#define ASC_SELECT_H |
44 |
|
45 |
/** addtogroup compiler Compiler |
46 |
@{ |
47 |
*/ |
48 |
|
49 |
extern struct SelectList *CreateSelect(struct Set *set, struct StatementList *sl); |
50 |
/**< |
51 |
* <!-- struct SelectList *CreateSelect(set,sl) --> |
52 |
* <!-- struct Set *set; --> |
53 |
* <!-- struct StatementList *sl; --> |
54 |
* Create a Select node. This will examine the set data structure which |
55 |
* must contain only constant expressions (TRUE or FALSE), symbol values or |
56 |
* integer values. |
57 |
* If set = NULL, this indicates an OTHERWISE case. |
58 |
*/ |
59 |
|
60 |
extern struct SelectList *ReverseSelectCases(struct SelectList *sel); |
61 |
/**< |
62 |
* <!-- struct SelectList *ReverseSelectCases(sel) --> |
63 |
* <!-- struct SelectList *sel; --> |
64 |
* Reverse this list. |
65 |
*/ |
66 |
|
67 |
extern struct SelectList |
68 |
*LinkSelectCases(struct SelectList *sel1, struct SelectList *sel2); |
69 |
/**< |
70 |
* <!-- struct SelectList *LinkSelectCases(sel1,sel2) --> |
71 |
* <!-- struct SelectList *sel1,*sel2; --> |
72 |
* Link two case lists and return the joined list. This works best when |
73 |
* sel1 is a one element list. |
74 |
*/ |
75 |
|
76 |
|
77 |
#ifdef NDEBUG |
78 |
#define NextSelectCase(sel) ((sel)->next) |
79 |
#else |
80 |
#define NextSelectCase(sel) NextSelectCaseF(sel) |
81 |
#endif |
82 |
/**< |
83 |
* Return the next case. |
84 |
* @param sel struct SelectList*, the SelectList to query. |
85 |
* @return Returns the next case as a struct SelectList*. |
86 |
* @see NextSelectCaseF() |
87 |
*/ |
88 |
extern struct SelectList *NextSelectCaseF(struct SelectList *cs); |
89 |
/**< |
90 |
* <!-- macro NextSelectCase(cs) --> |
91 |
* <!-- struct SelectList *NextSelectCaseF(cs) --> |
92 |
* <!-- struct SelectList *cs; --> |
93 |
* <!-- Return the next case. --> |
94 |
* Implementation function for NextSelectCase(). Do not call this |
95 |
* function directly - use NextSelectCase() instead. |
96 |
*/ |
97 |
|
98 |
#ifdef NDEBUG |
99 |
#define SelectSetList(sel) ((sel)->values) |
100 |
#else |
101 |
#define SelectSetList(sel) SelectSetListF(sel) |
102 |
#endif |
103 |
/**< |
104 |
* This will return the set list part of a SelectList structure. When |
105 |
* the set is NULL, this indicates an OTHERWISE case. |
106 |
* @param sel struct SelectList*, the SelectList to query.. |
107 |
* @return Returns the set list as a struct Set*. |
108 |
* @see SelectSetListF() |
109 |
*/ |
110 |
extern struct Set *SelectSetListF(struct SelectList *sel); |
111 |
/**< |
112 |
* <!-- macro SelectSetList(sel) --> |
113 |
* <!-- struct Set *SelectSetListF(sel) --> |
114 |
* <!-- const struct SelectList *sel; --> |
115 |
* <!-- This will return the set list part of a SelectList structure.--> |
116 |
* <!-- When the set is NULL, this indicates an OTHERWISE case. --> |
117 |
* Implementation function for SelectSetList(). Do not call this |
118 |
* function directly - use SelectSetList() instead. |
119 |
*/ |
120 |
|
121 |
#ifdef NDEBUG |
122 |
#define SelectStatementList(sel) ((sel)->slist) |
123 |
#else |
124 |
#define SelectStatementList(sel) SelectStatementListF(sel) |
125 |
#endif |
126 |
/**< |
127 |
* Return the statement list. |
128 |
* @param sel struct SelectList*, the SelectList to query.. |
129 |
* @return Returns the statement list as a struct StatementList*. |
130 |
* @see SelectStatementListF() |
131 |
*/ |
132 |
extern struct StatementList *SelectStatementListF(struct SelectList *sel); |
133 |
/**< |
134 |
* <!-- macro SelectStatementList(sel) --> |
135 |
* <!-- const struct StatementList *SelectStatementListF(sel) --> |
136 |
* <!-- const struct SelectList *sel; --> |
137 |
* <!-- Return the statement list. --> |
138 |
* Implementation function for SelectStatementList(). Do not call this |
139 |
* function directly - use SelectStatementList() instead. |
140 |
*/ |
141 |
|
142 |
extern void DestroySelectList(struct SelectList *sel); |
143 |
/**< |
144 |
* <!-- void DestroySelectList(sel) --> |
145 |
* <!-- struct SelectList *sel; --> |
146 |
* Destroy a whole list. |
147 |
*/ |
148 |
|
149 |
extern void DestroySelectNode(struct SelectList *sel); |
150 |
/**< |
151 |
* <!-- void DestroySelectNode(sel) --> |
152 |
* <!-- struct SelectList *sel; --> |
153 |
* Destroy just this node. |
154 |
*/ |
155 |
|
156 |
extern struct SelectList *CopySelectNode(struct SelectList *sel); |
157 |
/**< |
158 |
* <!-- struct SelectList *CopySelectNode(sel) --> |
159 |
* <!-- struct SelectList *sel; --> |
160 |
* Copy a case. The next attribute is initialized to NULL. |
161 |
*/ |
162 |
|
163 |
extern struct SelectList *CopySelectList(struct SelectList *sel); |
164 |
/**< |
165 |
* <!-- struct SelectList *CopySelectList(sel) --> |
166 |
* <!-- struct SelectList *sel; --> |
167 |
* Copy the whole list content. not a reference count change. |
168 |
*/ |
169 |
|
170 |
/* @} */ |
171 |
|
172 |
#endif /* ASC_SELECT_H */ |
173 |
|