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

Annotation of /trunk/base/generic/compiler/setinstval.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 480 - (hide annotations) (download) (as text)
Mon Apr 17 10:45:23 2006 UTC (18 years, 5 months ago) by johnpye
File MIME type: text/x-chdr
File size: 9650 byte(s)
Adding ASC_DLLSPEC to all functions that are being used by Python interface.
Also cleaned up some #ifdef header brackets and html-style comments inside doxygen comments.
Renamed pygtk/interface/config.in to pygtk/interface/config.h.in and made 
this active again (for ASC_BUILDING_INTERFACE) use.
Trying to catch error in ascpy.Library call with try/except, doesn't work though.
1 jds 54 /*
2 aw0a 1 * Routines to Process Set Instance Values
3     * by Tom Epperly
4     * 11/16/89
5     * Version: $Revision: 1.7 $
6     * Version control file: $RCSfile: setinstval.h,v $
7     * Date last modified: $Date: 1998/02/05 16:37:52 $
8     * Last modified by: $Author: ballan $
9     *
10     * This file is part of the Ascend Language Interpreter.
11     *
12     * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
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 jds 54 */
28    
29     /** @file
30     * Routines to Process Set Instance Values.
31 aw0a 1 *
32     * This group of routines is used to process the value fields of set
33     * instances.
34 jds 54 * <pre>
35 aw0a 1 * When #including setinstval.h, make sure these files are #included first:
36 jds 54 * #include <stdio.h>
37     * #include "utilities/ascConfig.h"
38 aw0a 1 * #include "compiler.h"
39 jds 54 * #include "list.h"
40     * </pre>
41 aw0a 1 */
42    
43     #ifndef __SETINSTVAL_H_SEEN__
44     #define __SETINSTVAL_H_SEEN__
45 jds 54
46 aw0a 1 enum set_kind {
47 jds 54 integer_set, /**< set of integer values */
48     string_set, /**< set of string values */
49     empty_set /**< set with nothing in it */
50 aw0a 1 };
51    
52 jds 54 /** Do not confuse this set with the struct Set in types.h */
53 aw0a 1 struct set_t {
54     enum set_kind kind;
55     struct gl_list_t *list;
56     };
57    
58     extern void InitSetManager(void);
59 johnpye 480 /**<
60 jds 54 * This function initializes the pool.
61 aw0a 1 * We pool the set stubs for reuse, since there are so many used in
62     * most ASCEND models of any complexity.
63     * The pool grows as needed. It does not shrink until destroyed.
64     * It is a fatal error to call this a second time unless
65     * DestroySetManager has been called first.
66     * In the pooling operation we only keep the set stubs, not the
67 jds 54 * gl_lists associated.<br><br>
68 aw0a 1 *
69     * This exits if it cannot init the pool because of insufficient
70     * memory.
71     */
72    
73     extern void DestroySetManager(void);
74 johnpye 480 /**<
75 aw0a 1 * Destroys the set pool. Bombs if no pool exists.
76     */
77    
78 jds 54 extern void ReportSetManager(FILE*f);
79 johnpye 480 /**<
80 jds 54 * <!-- ReportSetManager(f); -->
81     * <!-- FILE *f; -->
82 aw0a 1 * Reports on the set pool to f.
83     */
84    
85     extern struct set_t *CreateEmptySet(void);
86 johnpye 480 /**<
87 jds 54 * <!-- struct set_t *CreateEmptySet() -->
88 aw0a 1 * Creates an empty set.
89     */
90    
91 jds 54 extern void InsertInteger(struct set_t *set, long i);
92 johnpye 480 /**<
93 jds 54 * <!-- void InsertInteger(set,i) -->
94     * <!-- struct set_t *set; -->
95     * <!-- long i; -->
96 aw0a 1 * Insert i into set. You can insert i multiple times without causing
97     * problems. Set must be non-NULL. This will coerce an empty set type
98     * into an integer set type; after that no symbols can be inserted into
99     * the set.
100     */
101    
102 jds 54 extern void InsertIntegerRange(struct set_t *set, long lower, long upper);
103 johnpye 480 /**<
104 jds 54 * <!-- struct InsertIntegerRange(set,lower,upper) -->
105     * <!-- struct set_t *set; -->
106     * <!-- long lower, upper; -->
107     * Insert the elements i such that i >= lower and i <= upper. Note if
108 aw0a 1 * lower > upper, no elements are inserted. This will coerce an empty
109     * set type into an integer set type.
110     */
111    
112 jds 54 extern void InsertString(struct set_t *set, symchar *str);
113 johnpye 480 /**<
114 jds 54 * <!-- struct InsertString(set,str) -->
115     * <!-- struct set_t *set; -->
116     * <!-- symchar *str; -->
117 aw0a 1 * Insert str into set. This will coerce an empty set type into
118     * a string set type; after which no integers can be inserted.
119     */
120    
121 jds 54 extern struct set_t *SetUnion(CONST struct set_t *s1, CONST struct set_t *s2);
122 johnpye 480 /**<
123 jds 54 * <!-- struct set_t *SetUnion(s1,s2) -->
124     * <!-- const struct set_t *s1,*s2; -->
125 aw0a 1 * Create a set which is the union of s1 and s2. s1 and s2 are uneffected.
126     * Union with empty set is always okay.
127     */
128    
129 jds 54 extern struct set_t *SetIntersection(CONST struct set_t *s1,
130     CONST struct set_t *s2);
131     /**<
132     * <!-- struct set_t *SetIntersection(s1,s2); -->
133     * <!-- const struct set_t *s1,*s2; -->
134 aw0a 1 * Create a set which is the intersection of s1 and s2. s1 and s2 are
135     * uneffected. Intersection with empty set is okay.
136     */
137    
138 jds 54 extern struct set_t *SetDifference(CONST struct set_t *s1, CONST struct set_t *s2);
139     /**<
140     * <!-- struct set_t *SetDifference(s1,s2) -->
141     * <!-- const struct set_t *s1,*s2; -->
142 aw0a 1 * Create a set which is define as follows:
143     * return set := { i | (i IN s1) and (NOT (i IN s2))}
144     */
145    
146 jds 54 extern struct set_t *CopySet(CONST struct set_t *set);
147     /**<
148     * <!-- struct set_t *CopySet(set) -->
149     * <!-- const struct set_t *set; -->
150     * Copy a set.
151 aw0a 1 */
152    
153 jds 54 extern int IntMember(long i, CONST struct set_t *set);
154     /**<
155     * <!-- int IntMember(i,set) -->
156     * <!-- long i; -->
157     * <!-- const struct set_t *set; -->
158 aw0a 1 * Return a TRUE value if i is a member of set; otherwise, return a false
159     * value.
160     */
161    
162 jds 54 extern int StrMember(symchar *str, CONST struct set_t *set);
163     /**<
164     * <!-- int StrMember(str,set) -->
165     * <!-- symchar *str; -->
166     * <!-- const struct set_t *set; -->
167 aw0a 1 * Return a TRUE value if str is a member of set; otherwise, return a false
168     * value.
169     */
170    
171 jds 54 extern void DestroySet(struct set_t *set);
172     /**< "Free up" set pointer. Actually returns it to the pool of set stubs. */
173 aw0a 1
174 jds 54 extern int NullSet(CONST struct set_t *set);
175     /**< Testing if the set is empty. TRUE if set is empty. */
176 aw0a 1
177 johnpye 480 extern unsigned long ASC_DLLSPEC Cardinality(CONST struct set_t *set);
178 jds 54 /**< Return the number of members. */
179 aw0a 1
180 johnpye 480 extern symchar* ASC_DLLSPEC FetchStrMember(CONST struct set_t *set, unsigned long n);
181 jds 54 /**< Returns the nth (internal sort order ) member symbol. */
182 aw0a 1
183 johnpye 480 extern long ASC_DLLSPEC FetchIntMember(CONST struct set_t *set, unsigned long n);
184 jds 54 /**< Returns the nth (internal sort order ) member number. */
185 aw0a 1
186 jds 54 extern void SetIterate(struct set_t *set, void (*func)());
187     /**< Calls func for every element in set. */
188 aw0a 1
189 johnpye 480 extern enum set_kind ASC_DLLSPEC SetKind(CONST struct set_t *set);
190 jds 54 /**< Returns the type of the set. */
191 aw0a 1
192 jds 54 extern int SetsEqual(CONST struct set_t *s1, CONST struct set_t *s2);
193     /**<
194     * <!-- int SetsEqual(s1,s2) -->
195     * <!-- const struct set_t *s1,*s2; -->
196 aw0a 1 * Returns a true value if the two sets are equal. Set equality is
197     * defined as:
198     * (i IN s1) <==> (i IN s2)
199     * This always returns FALSE if the sets are of different type.
200     */
201    
202 jds 54 extern int Subset(CONST struct set_t *s1, CONST struct set_t *s2);
203     /**<
204     * <!-- int Subset(s1,s2); -->
205     * <!-- struct set_t *s1,*s2; -->
206 aw0a 1 * Returns a true value if s1 is contained in s2. It always returns FALSE
207     * if the sets are of different type(even if they are empty sets).
208     *
209 jds 54 * - TRUE if (i IN s1) ==> (i IN s2)
210     * - FALSE otherwise
211 aw0a 1 */
212    
213 jds 54 extern int CmpSetInstVal(CONST struct set_t *s1, CONST struct set_t *s2);
214 johnpye 480 /**<
215 jds 54 * <!-- int CmpSetInstVal(s1,s2) -->
216     * <!-- struct set_t *s1,*s2; -->
217 aw0a 1 * Returns -1, 0, 1 from comparing s1,s2.
218     */
219    
220 jds 54 /*
221 aw0a 1 * Some ordered set processing. The elements of the below sets are
222     * not necessarily unique and not necessarily ordered. In this way they
223     * behave more like lists. For TRUE sets use the InsertInteger and
224     * InsertString functions above.
225     */
226    
227 jds 54 extern void AppendIntegerElement(struct set_t *set, long int i );
228 johnpye 480 /**<
229 jds 54 * <!-- void AppendIntegerElement(set,i); -->
230     * <!-- struct set_t *set; -->
231     * <!-- long int i; -->
232 aw0a 1 * This function will append an integer to a set. In so doing it will NOT
233     * attempt to sort the elements of the set or to make the elements of the
234     * set unique. In this way the set is treated as a list.
235     */
236    
237 jds 54 extern void AppendStringElement(struct set_t *set, symchar *str);
238 johnpye 480 /**<
239 jds 54 * <!-- struct set_t *set; -->
240     * <!-- symchar *str; -->
241 aw0a 1 * This function will append an string to a set. In so doing it will NOT
242     * attempt to sort the elements of the set or to make the elements of the
243     * set unique. In this way the set is treated as a list.
244     */
245    
246 jds 54 #endif /* __SETINSTVAL_H_SEEN__ */
247    

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