| 1 |
|
#include <stdlib.h> |
| 2 |
|
#include <stdio.h> |
| 3 |
|
|
| 4 |
< |
#include <parse_tree.h> |
| 5 |
< |
#include <simError.h> |
| 4 |
> |
#include "parse_tree.h" |
| 5 |
> |
#include "simError.h" |
| 6 |
|
|
| 7 |
|
#ifdef IS_MPI |
| 8 |
|
#define __is_lex__ |
| 9 |
< |
#include <mpiBASS.h> |
| 9 |
> |
#include "mpiBASS.h" |
| 10 |
|
#endif |
| 11 |
|
|
| 12 |
|
void walk_down( struct node_tag* the_node, struct namespc the_namespc ); |
| 98 |
|
break; |
| 99 |
|
|
| 100 |
|
case ATOM_HEAD: |
| 101 |
+ |
if( the_namespc.type != MOLECULE_HEAD && the_namespc.type != RIGIDBODY_HEAD ){ |
| 102 |
+ |
print_tree_error( the_node, |
| 103 |
+ |
"The atom block is not in a molecule or rigidBody namespace" ); |
| 104 |
+ |
} |
| 105 |
+ |
else{ |
| 106 |
+ |
init_atom( the_node->index ); |
| 107 |
+ |
current_namespc.index = the_node->index; |
| 108 |
+ |
current_namespc.type = the_node->type; |
| 109 |
+ |
walk_down( the_node->stmt_list, current_namespc ); |
| 110 |
+ |
} |
| 111 |
+ |
break; |
| 112 |
+ |
|
| 113 |
+ |
case RIGIDBODY_HEAD: |
| 114 |
|
if( the_namespc.type != MOLECULE_HEAD ){ |
| 115 |
|
print_tree_error( the_node, |
| 116 |
< |
"The atom block is not in a molecule namespace" ); |
| 116 |
> |
"The rigid body block is not in a molecule namespace" ); |
| 117 |
|
} |
| 118 |
|
else{ |
| 119 |
< |
init_atom( the_node->index ); |
| 119 |
> |
init_rigidbody( the_node->index ); |
| 120 |
|
current_namespc.index = the_node->index; |
| 121 |
|
current_namespc.type = the_node->type; |
| 122 |
|
walk_down( the_node->stmt_list, current_namespc ); |
| 162 |
|
walk_down( the_node->stmt_list, current_namespc ); |
| 163 |
|
} |
| 164 |
|
break; |
| 165 |
+ |
|
| 166 |
+ |
case MEMBER_HEAD: |
| 167 |
+ |
if( the_namespc.type != RIGIDBODY_HEAD ){ |
| 168 |
+ |
print_tree_error( the_node, |
| 169 |
+ |
"The Member block is not in " |
| 170 |
+ |
"a rigidBody namespace" ); |
| 171 |
+ |
} |
| 172 |
+ |
else{ |
| 173 |
+ |
init_member( the_node->index ); |
| 174 |
+ |
current_namespc.index = the_node->index; |
| 175 |
+ |
current_namespc.type = the_node->type; |
| 176 |
+ |
walk_down( the_node->stmt_list, current_namespc ); |
| 177 |
+ |
} |
| 178 |
+ |
break; |
| 179 |
+ |
|
| 180 |
+ |
case ZCONSTRAINT_HEAD: |
| 181 |
+ |
if( the_namespc.type != GLOBAL_HEAD ){ |
| 182 |
+ |
print_tree_error( the_node, |
| 183 |
+ |
"The Zconstraint block is not in " |
| 184 |
+ |
"the global namespace" ); |
| 185 |
+ |
} |
| 186 |
+ |
else{ |
| 187 |
+ |
init_zconstraint( the_node->index ); |
| 188 |
+ |
current_namespc.index = the_node->index; |
| 189 |
+ |
current_namespc.type = the_node->type; |
| 190 |
+ |
walk_down( the_node->stmt_list, current_namespc ); |
| 191 |
+ |
} |
| 192 |
+ |
break; |
| 193 |
|
|
| 194 |
|
default: |
| 195 |
|
print_tree_error( the_node, "Not a valid code block" ); |
| 202 |
|
|
| 203 |
|
switch( the_node->type ){ |
| 204 |
|
|
| 205 |
< |
case MEMBER_STMT: |
| 205 |
> |
case MEMBERS_STMT: |
| 206 |
|
switch( the_namespc.type ){ |
| 207 |
|
case BOND_HEAD: // fall through |
| 208 |
|
case BEND_HEAD: // fall through |
| 212 |
|
|
| 213 |
|
default: |
| 214 |
|
print_tree_error( the_node, |
| 215 |
< |
"Member statement not in a bond, bend, " |
| 215 |
> |
"Members statement not in a bond, bend, " |
| 216 |
|
"or torsion" ); |
| 217 |
|
break; |
| 218 |
|
} |
| 239 |
|
break; |
| 240 |
|
|
| 241 |
|
case POSITION_STMT: |
| 242 |
< |
if( the_namespc.type != ATOM_HEAD ){ |
| 242 |
> |
if( the_namespc.type != ATOM_HEAD && the_namespc.type != RIGIDBODY_HEAD){ |
| 243 |
|
print_tree_error( the_node, |
| 244 |
|
"position statement is not located in an " |
| 245 |
< |
"atom block" ); |
| 245 |
> |
"atom or rigidBody block" ); |
| 246 |
|
} |
| 247 |
|
|
| 248 |
|
init_position( the_node, the_namespc ); |
| 249 |
|
break; |
| 250 |
|
|
| 251 |
|
case ORIENTATION_STMT: |
| 252 |
< |
if( the_namespc.type != ATOM_HEAD ){ |
| 252 |
> |
if( the_namespc.type != ATOM_HEAD && the_namespc.type != RIGIDBODY_HEAD){ |
| 253 |
|
print_tree_error( the_node, |
| 254 |
|
"orientation statement is not located in an " |
| 255 |
< |
"atom block" ); |
| 255 |
> |
"atom or rigidBody block" ); |
| 256 |
|
} |
| 257 |
|
|
| 258 |
|
init_orientation( the_node, the_namespc ); |
| 259 |
|
break; |
| 260 |
|
|
| 220 |
– |
case START_INDEX_STMT: |
| 221 |
– |
if( the_namespc.type != COMPONENT_HEAD ){ |
| 222 |
– |
print_tree_error( the_node, |
| 223 |
– |
"start_index statement is not located in an " |
| 224 |
– |
"component block" ); |
| 225 |
– |
} |
| 226 |
– |
|
| 227 |
– |
//init_start_index( the_node, the_namespc ); |
| 228 |
– |
break; |
| 229 |
– |
|
| 261 |
|
default: |
| 262 |
|
print_tree_error( the_node, "unrecognized statement" ); |
| 263 |
|
break; |
| 304 |
|
err_msg ); |
| 305 |
|
break; |
| 306 |
|
|
| 307 |
+ |
case RIGIDBODY_HEAD: |
| 308 |
+ |
sprintf( painCave.errMsg, |
| 309 |
+ |
"Parse tree error: rigidBody head node error -> %s\n", |
| 310 |
+ |
err_msg ); |
| 311 |
+ |
break; |
| 312 |
+ |
|
| 313 |
|
case ATOM_HEAD: |
| 314 |
|
sprintf( painCave.errMsg, |
| 315 |
|
"Parse tree error: atom head node error [%d] -> %s\n", |
| 330 |
|
err_node->index, |
| 331 |
|
err_msg ); |
| 332 |
|
break; |
| 333 |
< |
|
| 334 |
< |
case TORSION_HEAD: |
| 333 |
> |
|
| 334 |
> |
case ZCONSTRAINT_HEAD: |
| 335 |
|
sprintf( painCave.errMsg, |
| 336 |
< |
"Parse tree error: torsion head node error [%d] -> %s\n", |
| 336 |
> |
"Parse tree error: Zconstraint head node error [%d] -> %s\n", |
| 337 |
|
err_node->index, |
| 338 |
|
err_msg ); |
| 339 |
|
break; |
| 340 |
< |
|
| 341 |
< |
case MEMBER_STMT: |
| 340 |
> |
|
| 341 |
> |
case MEMBER_HEAD: |
| 342 |
|
sprintf( painCave.errMsg, |
| 343 |
< |
"Parse tree error: member node error => ( %d, %d, %d, %d )\n" |
| 343 |
> |
"Parse tree error: member head node error [%d] -> %s\n", |
| 344 |
> |
err_node->index, |
| 345 |
> |
err_msg ); |
| 346 |
> |
break; |
| 347 |
> |
|
| 348 |
> |
case MEMBERS_STMT: |
| 349 |
> |
sprintf( painCave.errMsg, |
| 350 |
> |
"Parse tree error: members node error => ( %d, %d, %d, %d )\n" |
| 351 |
|
" -> %s\n", |
| 352 |
< |
err_node->the_data.mbr.a, |
| 353 |
< |
err_node->the_data.mbr.b, |
| 354 |
< |
err_node->the_data.mbr.c, |
| 355 |
< |
err_node->the_data.mbr.d, |
| 352 |
> |
err_node->the_data.mbrs.a, |
| 353 |
> |
err_node->the_data.mbrs.b, |
| 354 |
> |
err_node->the_data.mbrs.c, |
| 355 |
> |
err_node->the_data.mbrs.d, |
| 356 |
|
err_msg ); |
| 357 |
|
break; |
| 358 |
|
|
| 417 |
|
err_msg ); |
| 418 |
|
break; |
| 419 |
|
|
| 376 |
– |
case START_INDEX_STMT: |
| 377 |
– |
sprintf( painCave.errMsg, |
| 378 |
– |
"Parse tree error: start_index error -> %s\n", |
| 379 |
– |
err_msg ); |
| 380 |
– |
break; |
| 381 |
– |
|
| 382 |
– |
|
| 420 |
|
default: |
| 421 |
|
sprintf( painCave.errMsg, |
| 422 |
|
"Parse tree error: unknown node type -> %s\n", |
| 439 |
|
|
| 440 |
|
void kill_tree( struct node_tag* the_node ){ |
| 441 |
|
|
| 405 |
– |
// These two are needed to get rid of the integer list |
| 442 |
|
|
| 407 |
– |
struct integer_list_tag* current_il; |
| 408 |
– |
struct integer_list_tag* temp_il; |
| 409 |
– |
|
| 410 |
– |
|
| 443 |
|
if( the_node != NULL ){ |
| 444 |
|
|
| 445 |
|
if( the_node->stmt_list != NULL ){ |
| 463 |
|
free( the_node->the_data.asmt.identifier ); |
| 464 |
|
break; |
| 465 |
|
|
| 434 |
– |
case START_INDEX_STMT: |
| 435 |
– |
|
| 436 |
– |
current_il = the_node->the_data.il_head; |
| 437 |
– |
while( current_il != NULL ){ |
| 438 |
– |
temp_il = current_il->next; |
| 439 |
– |
free( current_il ); |
| 440 |
– |
current_il = temp_il; |
| 441 |
– |
} |
| 442 |
– |
the_node->the_data.il_head = NULL; |
| 443 |
– |
break; |
| 444 |
– |
|
| 466 |
|
default: |
| 467 |
|
// nothing to do here, everyone else can be freed normally. |
| 468 |
|
break; |