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

Comparing:
branches/mmeineke/OOPSE/libBASS/parse_tree.c (file contents), Revision 377 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
trunk/OOPSE/libBASS/parse_tree.c (file contents), Revision 1153 by gezelter, Tue May 11 04:21:52 2004 UTC

# Line 1 | Line 1
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 );
# Line 99 | Line 99 | void walk_down( struct node_tag* the_node, struct name
99  
100        case ATOM_HEAD:
101          if( the_namespc.type != MOLECULE_HEAD ){
102 <          print_tree_error( the_node,
102 >             print_tree_error( the_node,
103                              "The atom block is not in a molecule namespace" );
104          }
105          else{
# Line 109 | Line 109 | void walk_down( struct node_tag* the_node, struct name
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 RigidBody block is not in a Molecule namespace" );
117 +        }
118 +        else{
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 );
123 +        }
124 +        break;
125 +
126 +      case CUTOFFGROUP_HEAD:
127 +        if( the_namespc.type != CUTOFFGROUP_HEAD ){
128 +          print_tree_error( the_node,
129 +                            "The CutoffGroup block is not in a Molecule namespace" );
130 +        }
131 +        else{
132 +          init_cutoffgroup( the_node->index );
133 +          current_namespc.index = the_node->index;
134 +          current_namespc.type = the_node->type;
135 +          walk_down( the_node->stmt_list, current_namespc );
136 +        }
137 +        break;
138          
139        case BOND_HEAD:
140          if( the_namespc.type != MOLECULE_HEAD ){
# Line 149 | Line 175 | void walk_down( struct node_tag* the_node, struct name
175            walk_down( the_node->stmt_list, current_namespc );
176          }
177          break;
178 +      
179 +      case ZCONSTRAINT_HEAD:
180 +        if( the_namespc.type != GLOBAL_HEAD ){
181 +          print_tree_error( the_node,
182 +                            "The Zconstraint block is not in "
183 +                            "the global namespace" );
184 +        }
185 +        else{
186 +          init_zconstraint( the_node->index );
187 +          current_namespc.index = the_node->index;
188 +          current_namespc.type = the_node->type;
189 +          walk_down( the_node->stmt_list, current_namespc );
190 +        }
191 +        break;
192          
193        default:
194          print_tree_error( the_node, "Not a valid code block" );
# Line 161 | Line 201 | void walk_down( struct node_tag* the_node, struct name
201  
202        switch( the_node->type ){
203  
204 <      case MEMBER_STMT:
204 >      case MEMBERS_STMT:
205          switch( the_namespc.type ){
206          case BOND_HEAD: // fall through
207          case BEND_HEAD: // fall through
208 <        case TORSION_HEAD: // same for the first three
208 >        case TORSION_HEAD:
209 >        case RIGIDBODY_HEAD:
210 >        case CUTOFFGROUP_HEAD: // same for the first four
211            init_members( the_node, the_namespc );
212            break;
213  
214          default:
215            print_tree_error( the_node,
216 <                            "Member statement not in a bond, bend, "
217 <                            "or torsion" );
216 >                            "Members statement not in a bond, bend, "
217 >                            "torsion, RigidBody, or CutoffGroup" );
218            break;
219          }
220          break;
# Line 215 | Line 257 | void walk_down( struct node_tag* the_node, struct name
257          }
258          
259          init_orientation( the_node, the_namespc );
218        break;
219
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 );
260          break;
261  
262        default:
# Line 273 | Line 305 | void print_tree_error( struct node_tag* err_node, char
305               err_msg );
306      break;
307  
308 +  case RIGIDBODY_HEAD:
309 +    sprintf( painCave.errMsg,
310 +             "Parse tree error: rigidBody head node error -> %s\n",
311 +             err_msg );
312 +    break;
313 +    
314 +  case CUTOFFGROUP_HEAD:
315 +    sprintf( painCave.errMsg,
316 +             "Parse tree error: CutoffGroup head node error -> %s\n",
317 +             err_msg );
318 +    break;
319 +
320    case ATOM_HEAD:
321      sprintf( painCave.errMsg,
322               "Parse tree error: atom head node error [%d] -> %s\n",
# Line 293 | Line 337 | void print_tree_error( struct node_tag* err_node, char
337               err_node->index,
338               err_msg );
339      break;
340 <    
341 <  case TORSION_HEAD:
340 >      
341 >  case ZCONSTRAINT_HEAD:
342      sprintf( painCave.errMsg,
343 <             "Parse tree error: torsion head node error [%d] -> %s\n",
343 >             "Parse tree error: Zconstraint head node error [%d] -> %s\n",
344               err_node->index,
345               err_msg );
346      break;
347 <    
348 <  case MEMBER_STMT:
347 >
348 >  case MEMBERS_STMT:
349      sprintf( painCave.errMsg,
350 <             "Parse tree error: member node error => ( %d, %d, %d, %d )\n"
350 >             "Parse tree error: members node error (nMembers = %d)\n"
351               "                  -> %s\n",
352 <             err_node->the_data.mbr.a,
309 <             err_node->the_data.mbr.b,
310 <             err_node->the_data.mbr.c,
311 <             err_node->the_data.mbr.d,
352 >             err_node->the_data.mbrs.nMembers,
353               err_msg );
354      break;
355  
# Line 367 | Line 408 | void print_tree_error( struct node_tag* err_node, char
408      sprintf( painCave.errMsg,
409               "Parse tree error: orientation node error => ( %lf, %lf, %lf )\n"
410               "                  -> %s\n",
411 <             err_node->the_data.ort.x,
412 <             err_node->the_data.ort.y,
413 <             err_node->the_data.ort.z,
411 >             err_node->the_data.ort.phi,
412 >             err_node->the_data.ort.theta,
413 >             err_node->the_data.ort.psi,
414               err_msg );
415      break;
416  
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
417    default:
418      sprintf( painCave.errMsg,
419               "Parse tree error: unknown node type -> %s\n",
# Line 402 | Line 436 | void kill_tree( struct node_tag* the_node ){
436    
437   void kill_tree( struct node_tag* the_node ){
438    
405  // These two are needed to get rid of the integer list
439  
407  struct integer_list_tag* current_il;
408  struct integer_list_tag* temp_il;
409
410
440    if( the_node != NULL ){
441      
442      if( the_node->stmt_list != NULL ){
# Line 431 | Line 460 | void kill_tree( struct node_tag* the_node ){
460          free( the_node->the_data.asmt.identifier );
461          break;
462  
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
463        default:
464          // nothing to do here, everyone else can be freed normally.
465          break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines