| 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 |
| 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; |
| 292 |
|
|
| 293 |
|
return the_node; |
| 294 |
|
} |
| 295 |
+ |
|
| 296 |
+ |
struct node_tag* zconstraint_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 = ZCONSTRAINT_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* component_blk( struct node_tag* stmt_list ){ |
| 311 |
|
|
| 320 |
|
|
| 321 |
|
return the_node; |
| 322 |
|
} |
| 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 |
– |
} |