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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 33 - (hide annotations) (download) (as text)
Sun Dec 26 20:06:01 2004 UTC (19 years, 9 months ago) by ben.allan
File MIME type: text/x-chdr
File size: 6256 byte(s)
First pass at doxygenation -- mechanically putting in ** and where
most likely needed **< using sed. Lots of cleanup needed to
be really useful, including grouping data types and their
member methods into class-like documentation.
1 ben.allan 33 /**<
2 aw0a 1 * FOR Loop Index Variable Table
3     * by Tom Epperly
4     * Created: 1/14/89
5     * Version: $Revision: 1.8 $
6     * Version control file: $RCSfile: forvars.h,v $
7     * Date last modified: $Date: 1998/02/05 16:36:08 $
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
25     * along with the program; if not, write to the Free Software Foundation,
26     * Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named
27     * COPYING.
28     */
29    
30     #ifndef __FORVARS_H_SEEN__
31     #define __FORVARS_H_SEEN__
32 ben.allan 33 /**<
33 aw0a 1 * When #including forvars.h, make sure these files are #included first:
34     * #include "compiler.h"
35     */
36    
37    
38     enum for_kind {
39     f_untyped,
40     f_integer,
41     f_symbol,
42     f_set
43     };
44    
45     union for_union_t{
46     long ivalue;
47     symchar *sym_ptr;
48     struct set_t *sptr;
49     };
50    
51     struct for_var_t {
52 ben.allan 33 symchar *name; /**< internally used as a recycle ptr */
53     enum for_kind t; /**< what type of index variable it is */
54 aw0a 1 union for_union_t value;
55     };
56    
57     #define for_table_t gl_list_t
58    
59     extern struct for_table_t *CreateForTable(void);
60 ben.allan 33 /**<
61 aw0a 1 * struct for_table_t *CreateForTable()
62     * This function creates an empty FOR table which is then ready for use.
63     */
64    
65     extern void DestroyForTable(struct for_table_t *);
66 ben.allan 33 /**<
67 aw0a 1 * void DestroyForTable(ft)
68     * struct for_table_t *ft;
69     * This procedure deallocates the memory associated with the for table.
70     */
71    
72     extern void WriteForTable(FILE *,struct for_table_t *);
73 ben.allan 33 /**<
74 aw0a 1 * void WriteForTable(out,ft)
75     * FILE *out;
76     * struct for_table_t *ft;
77     * This procedure writes the contents of a for table.
78     */
79    
80     extern unsigned long ActiveForLoops(CONST struct for_table_t *);
81 ben.allan 33 /**<
82 aw0a 1 * unsigned long ActiveForLoops(ft)
83     * struct for_table_t *ft;
84     * Returns the number of active FOR loops.
85     */
86    
87     extern void AddLoopVariable(struct for_table_t *,struct for_var_t *);
88 ben.allan 33 /**<
89 aw0a 1 * void AddLoopVariable(ft,var)
90     * struct for_table_t *ft;
91     * struct for_var_t *var;
92     * Add another loop variable to the for table. Adding a loop variable to
93     * the for table is like activating the FOR loop variable
94     */
95    
96     extern struct for_var_t *LoopIndex(CONST struct for_table_t *,unsigned long);
97 ben.allan 33 /**<
98 aw0a 1 * struct for_var_t *LoopIndex(ft,num)
99     * const struct for_table_t *ft;
100     * unsigned long num;
101     * Returns the num'th loop index. Loop indices are numbered in the
102     * order they are added to the list. The first being one and the last
103     * being the number given by ActiveForLoops(ft).
104     */
105    
106     extern struct for_var_t *FindForVar(CONST struct for_table_t *, symchar *);
107 ben.allan 33 /**<
108 aw0a 1 * struct for_var_t *FindForVar(ft,name)
109     * CONST struct for_table_t *ft;
110     * symchar *name;
111     * Searches for a FOR index variable which matches name. If it finds a
112     * match it returns the for_var_t; otherwise, it returns NULL.
113     */
114    
115     extern void RemoveForVariable(struct for_table_t *);
116 ben.allan 33 /**<
117 aw0a 1 * void RemoveForVariable(ft)
118     * struct for_table_t *ft;
119     * This removes the most recently added FOR index variable. The
120     * for_var_t is automatically deallocated.
121     */
122    
123 ben.allan 33 /**<
124 aw0a 1 * Routines to create, query, modify and destroy for_var_t's.
125     */
126    
127     extern struct for_var_t *CreateForVar(symchar *);
128 ben.allan 33 /**<
129 aw0a 1 * struct for_var_t *CreateForVar(name)
130     * const char *name;
131     * Create a for_var_t with the name given. This for_var_t starts out being
132     * f_untyped. You can use the routines below to set type and values.
133     * Never free a for_var_t except by using DestroyForVar below.
134     */
135    
136     extern void SetForVarType(struct for_var_t *,enum for_kind);
137 ben.allan 33 /**<
138 aw0a 1 * void SetForVarType(fv,t)
139     * struct for_var_t *fv;
140     * enum for_kind t;
141     * Set the type to t. fv must be untyped.
142     */
143    
144     extern void SetForInteger(struct for_var_t *,long);
145 ben.allan 33 /**<
146 aw0a 1 * void SetForInteger(fv,ivalue)
147     * struct for_var_t *fv;
148     * long ivalue;
149     * Set an integer for variable's value to ivalue.
150     */
151    
152     extern void SetForSymbol(struct for_var_t *,symchar *);
153 ben.allan 33 /**<
154 aw0a 1 * void SetForSymbol(fv,sym_ptr)
155     * struct for_var_t *fv;
156     * const char *sym_ptr;
157     * Set a symbol for variable's value to sym_ptr.
158     */
159    
160     extern void SetForSet(struct for_var_t *,struct set_t *);
161 ben.allan 33 /**<
162 aw0a 1 * void SetForSet(fv,sptr)
163     * struct for_var_t *fv;
164     * struct set_t *sptr;
165     * Set a set for variable's value to sptr.
166     */
167    
168     extern enum for_kind GetForKind(CONST struct for_var_t *);
169 ben.allan 33 /**<
170 aw0a 1 * for_kind GetForKind(fv)
171     * const struct for_var_t *fv;
172     * Return the type of the for variable.
173     */
174    
175     extern symchar *GetForName(CONST struct for_var_t *);
176 ben.allan 33 /**<
177 aw0a 1 * symchar *GetForName(fv)
178     * const struct for_var_t *fv;
179     * Return the name of the for variable
180     */
181    
182     extern long GetForInteger(CONST struct for_var_t *);
183 ben.allan 33 /**<
184 aw0a 1 * long GetForInteger(fv)
185     * const struct for_var_t *fv;
186     * Return the value of an integer for variable.
187     */
188    
189     extern symchar *GetForSymbol(CONST struct for_var_t *);
190 ben.allan 33 /**<
191 aw0a 1 * symchar *GetForSymbol(fv)
192     * const struct for_var_t *fv;
193     * Return the value of a symbol for variable.
194     */
195    
196     extern CONST struct set_t *GetForSet(CONST struct for_var_t *);
197 ben.allan 33 /**<
198 aw0a 1 * const struct set_t *GetForSet(fv)
199     * const struct for_var_t *fv;
200     * Return the value of a set for variable.
201     */
202    
203     extern void DestroyForVar(struct for_var_t *);
204 ben.allan 33 /**<
205 aw0a 1 * void DestroyForVar(fv)
206     * struct for_var_t *fv;
207     * Deallocate the memory of this for variable. In the case of a set
208     * for variable, this will also deallocate the set.
209     */
210    
211     extern int ClearForVarRecycle(void);
212 ben.allan 33 /**<
213 aw0a 1 * int ClearForVarRecycle();
214     * Deallocates the recycle list of forvar_t. returns the list length,
215     * if anyone cares.
216     * This function may be safely called at any time.
217     * There is no recycle initialization function.
218     */
219 ben.allan 33 #endif /**< __FORVARS_H_SEEN__ */

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