2 |
|
#include <stdlib.h> |
3 |
|
#include <string.h> |
4 |
|
|
5 |
< |
#include <node_list.h> |
6 |
< |
#include <make_nodes.h> |
7 |
< |
#include <simError.h> |
5 |
> |
#include "node_list.h" |
6 |
> |
#include "make_nodes.h" |
7 |
> |
#include "simError.h" |
8 |
|
|
9 |
|
/* |
10 |
|
walks to to the top of a stmt_list. Needed when assigning the |
20 |
|
} |
21 |
|
|
22 |
|
/* |
23 |
< |
the next three functions are for creating and initialing the |
23 |
> |
the next three functions are for creating and initializing the |
24 |
|
assignment statements. |
25 |
|
*/ |
26 |
|
|
205 |
|
} |
206 |
|
|
207 |
|
/* |
208 |
– |
Does the C & I for the start_index statement |
209 |
– |
*/ |
210 |
– |
|
211 |
– |
struct node_tag* start_index( struct integer_list_tag* the_list ){ |
212 |
– |
|
213 |
– |
struct node_tag* the_node; |
214 |
– |
the_node = ( struct node_tag* )malloc( sizeof( node ) ); |
215 |
– |
|
216 |
– |
the_node->type = START_INDEX_STMT; |
217 |
– |
the_node->index = 0; |
218 |
– |
the_node->next_stmt = NULL; |
219 |
– |
the_node->prev_stmt = NULL; |
220 |
– |
the_node->stmt_list = NULL; |
221 |
– |
|
222 |
– |
the_node->the_data.il_head = the_list; |
223 |
– |
|
224 |
– |
return the_node; |
225 |
– |
} |
226 |
– |
|
227 |
– |
/* |
208 |
|
The following six functions initialize the statement nodes |
209 |
|
coresponding to the different code block types. |
210 |
|
*/ |
278 |
|
|
279 |
|
return the_node; |
280 |
|
} |
281 |
+ |
|
282 |
+ |
struct node_tag* zconstraint_blk( int index, struct node_tag* stmt_list ){ |
283 |
+ |
|
284 |
+ |
struct node_tag* the_node; |
285 |
+ |
the_node = ( struct node_tag* )malloc( sizeof( node ) ); |
286 |
+ |
|
287 |
+ |
the_node->type = ZCONSTRAINT_HEAD; |
288 |
+ |
the_node->index = index; |
289 |
+ |
the_node->next_stmt = NULL; |
290 |
+ |
the_node->prev_stmt = NULL; |
291 |
+ |
the_node->stmt_list = walk_to_top( stmt_list ); |
292 |
+ |
|
293 |
+ |
return the_node; |
294 |
+ |
} |
295 |
|
|
296 |
|
struct node_tag* component_blk( struct node_tag* stmt_list ){ |
297 |
|
|
306 |
|
|
307 |
|
return the_node; |
308 |
|
} |
315 |
– |
|
316 |
– |
/* |
317 |
– |
the next two functions handle the integer list nodes. |
318 |
– |
*/ |
319 |
– |
|
320 |
– |
struct integer_list_tag* il_node( int the_int ){ |
321 |
– |
|
322 |
– |
struct integer_list_tag* the_il_node; |
323 |
– |
the_il_node = ( struct integer_list_tag* )malloc( sizeof( integer_list ) ); |
324 |
– |
|
325 |
– |
the_il_node->prev = NULL; |
326 |
– |
the_il_node->next = NULL; |
327 |
– |
|
328 |
– |
the_il_node->the_int = the_int; |
329 |
– |
|
330 |
– |
return the_il_node; |
331 |
– |
} |
332 |
– |
|
333 |
– |
struct integer_list_tag* il_top( struct integer_list_tag* the_list ){ |
334 |
– |
|
335 |
– |
while( the_list->prev != NULL ){ |
336 |
– |
the_list = the_list->prev; |
337 |
– |
} |
338 |
– |
return the_list; |
339 |
– |
} |