ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libBASS/make_nodes.c
(Generate patch)

Comparing trunk/OOPSE/libBASS/make_nodes.c (file contents):
Revision 378 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
Revision 988 by gezelter, Tue Jan 27 19:37:48 2004 UTC

# Line 2 | Line 2
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
# Line 20 | Line 20 | struct node_tag* walk_to_top( struct node_tag* walk_me
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  
# Line 88 | Line 88 | struct node_tag* members_2( int a, int b ){
88    struct node_tag* the_node;
89    the_node = ( struct node_tag* )malloc( sizeof( node ) );
90    
91 <  the_node->type = MEMBER_STMT;
91 >  the_node->type = MEMBERS_STMT;
92    the_node->index = 0;
93    the_node->next_stmt = NULL;
94    the_node->prev_stmt = NULL;
95    the_node->stmt_list = NULL;
96    
97 <  the_node->the_data.mbr.a = a;
98 <  the_node->the_data.mbr.b = b;
99 <  the_node->the_data.mbr.c = 0;
100 <  the_node->the_data.mbr.d = 0;
97 >  the_node->the_data.mbrs.a = a;
98 >  the_node->the_data.mbrs.b = b;
99 >  the_node->the_data.mbrs.c = 0;
100 >  the_node->the_data.mbrs.d = 0;
101  
102    return the_node;
103   }
# Line 107 | Line 107 | struct node_tag* members_3( int a, int b, int c ){
107    struct node_tag* the_node;
108    the_node = ( struct node_tag* )malloc( sizeof( node ) );
109    
110 <  the_node->type = MEMBER_STMT;
110 >  the_node->type = MEMBERS_STMT;
111    the_node->index = 0;
112    the_node->next_stmt = NULL;
113    the_node->prev_stmt = NULL;
114    the_node->stmt_list = NULL;
115    
116 <  the_node->the_data.mbr.a = a;
117 <  the_node->the_data.mbr.b = b;
118 <  the_node->the_data.mbr.c = c;
119 <  the_node->the_data.mbr.d = 0;
116 >  the_node->the_data.mbrs.a = a;
117 >  the_node->the_data.mbrs.b = b;
118 >  the_node->the_data.mbrs.c = c;
119 >  the_node->the_data.mbrs.d = 0;
120  
121    return the_node;
122   }
# Line 126 | Line 126 | struct node_tag* members_4( int a, int b, int c, int d
126    struct node_tag* the_node;
127    the_node = ( struct node_tag* )malloc( sizeof( node ) );
128    
129 <  the_node->type = MEMBER_STMT;
129 >  the_node->type = MEMBERS_STMT;
130    the_node->index = 0;
131    the_node->next_stmt = NULL;
132    the_node->prev_stmt = NULL;
133    the_node->stmt_list = NULL;
134    
135 <  the_node->the_data.mbr.a = a;
136 <  the_node->the_data.mbr.b = b;
137 <  the_node->the_data.mbr.c = c;
138 <  the_node->the_data.mbr.d = d;
135 >  the_node->the_data.mbrs.a = a;
136 >  the_node->the_data.mbrs.b = b;
137 >  the_node->the_data.mbrs.c = c;
138 >  the_node->the_data.mbrs.d = d;
139  
140    return the_node;
141   }
# Line 205 | Line 205 | struct node_tag* position( double x, double y, double
205   }
206  
207   /*
208 <   Does the C & I for the start_index statement
208 >  The following six functions initialize the statement nodes
209 >  coresponding to the different code block types.
210   */
211  
212 < struct node_tag* start_index( struct integer_list_tag* the_list ){
212 > struct node_tag* molecule_blk( struct node_tag* stmt_list ){
213    
214    struct node_tag* the_node;
215    the_node = ( struct node_tag* )malloc( sizeof( node ) );
216    
217 <  the_node->type = START_INDEX_STMT;
217 >  the_node->type = MOLECULE_HEAD;
218    the_node->index = 0;
219    the_node->next_stmt = NULL;
220    the_node->prev_stmt = NULL;
221 <  the_node->stmt_list = NULL;
222 <  
222 <  the_node->the_data.il_head = the_list;
223 <  
221 >  the_node->stmt_list = walk_to_top( stmt_list );
222 >    
223    return the_node;
224 < }  
224 > }
225  
226 < /*
228 <  The following six functions initialize the statement nodes
229 <  coresponding to the different code block types.
230 < */
231 <
232 < struct node_tag* molecule_blk( struct node_tag* stmt_list ){
226 > struct node_tag* rigidbody_blk( int index, struct node_tag* stmt_list ){
227    
228    struct node_tag* the_node;
229    the_node = ( struct node_tag* )malloc( sizeof( node ) );
230    
231 <  the_node->type = MOLECULE_HEAD;
231 >  the_node->type = RIGIDBODY_HEAD;
232    the_node->index = 0;
233    the_node->next_stmt = NULL;
234    the_node->prev_stmt = NULL;
# Line 298 | Line 292 | struct node_tag* torsion_blk( int index, struct node_t
292      
293    return the_node;
294   }
295 +
296 + struct node_tag* member_blk( int index, struct node_tag* stmt_list ){
297 +  
298 +  struct node_tag* the_node;
299 +  the_node = ( struct node_tag* )malloc( sizeof( node ) );
300 +  
301 +  the_node->type = MEMBER_HEAD;
302 +  the_node->index = index;
303 +  the_node->next_stmt = NULL;
304 +  the_node->prev_stmt = NULL;
305 +  the_node->stmt_list = walk_to_top( stmt_list );
306 +    
307 +  return the_node;
308 + }
309 +
310 + struct node_tag* zconstraint_blk( int index, struct node_tag* stmt_list ){
311 +  
312 +  struct node_tag* the_node;
313 +  the_node = ( struct node_tag* )malloc( sizeof( node ) );
314 +  
315 +  the_node->type = ZCONSTRAINT_HEAD;
316 +  the_node->index = index;
317 +  the_node->next_stmt = NULL;
318 +  the_node->prev_stmt = NULL;
319 +  the_node->stmt_list = walk_to_top( stmt_list );
320 +    
321 +  return the_node;
322 + }
323  
324   struct node_tag* component_blk( struct node_tag* stmt_list ){
325    
# Line 312 | Line 334 | struct node_tag* component_blk( struct node_tag* stmt_
334    
335    return the_node;
336   }
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 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines