| 1 | 
  | 
 | 
| 2 | 
< | 
#include <cstring> | 
| 3 | 
< | 
#include <cstdio> | 
| 4 | 
< | 
#include <cstdlib> | 
| 2 | 
> | 
#include <string.h> | 
| 3 | 
> | 
#include <stdio.h> | 
| 4 | 
> | 
#include <stdlib.h> | 
| 5 | 
  | 
 | 
| 6 | 
  | 
#include "Globals.hpp" | 
| 7 | 
  | 
#include "BASS_interface.h" | 
| 15 | 
  | 
// Globals ************************************************ | 
| 16 | 
  | 
 | 
| 17 | 
  | 
typedef enum { GLOBAL_BLK, MOLECULE_BLK, ATOM_BLK, BOND_BLK, BEND_BLK, | 
| 18 | 
< | 
               TORSION_BLK, COMPONENT_BLK } block_type; | 
| 18 | 
> | 
               TORSION_BLK, COMPONENT_BLK, ZCONSTRAINT_BLK,  | 
| 19 | 
> | 
               RIGIDBODY_BLK } block_type; | 
| 20 | 
  | 
 | 
| 21 | 
  | 
block_type current_block = GLOBAL_BLK; | 
| 22 | 
  | 
#define MAX_NEST 20 // the max number of nested blocks | 
| 51 | 
  | 
      incr_block( MOLECULE_BLK ); | 
| 52 | 
  | 
      handled = the_stamps->newMolecule( the_event ); | 
| 53 | 
  | 
      break; | 
| 54 | 
+ | 
 | 
| 55 | 
+ | 
    case ZCONSTRAINT: | 
| 56 | 
+ | 
      incr_block( ZCONSTRAINT_BLK ); | 
| 57 | 
+ | 
      handled = the_globals->newZconstraint( the_event ); | 
| 58 | 
+ | 
      break; | 
| 59 | 
+ | 
 | 
| 60 | 
+ | 
    case RIGIDBODY: | 
| 61 | 
+ | 
      incr_block( RIGIDBODY_BLK ); | 
| 62 | 
+ | 
      handled = the_stamps->newRigidBody( the_event ); | 
| 63 | 
+ | 
      break; | 
| 64 | 
  | 
       | 
| 65 | 
  | 
    case COMPONENT: | 
| 66 | 
  | 
      incr_block( COMPONENT_BLK ); | 
| 88 | 
  | 
       | 
| 89 | 
  | 
    case ATOM: | 
| 90 | 
  | 
      incr_block( ATOM_BLK ); | 
| 91 | 
< | 
      handled = the_stamps->newAtom( the_event ); | 
| 91 | 
> | 
      handled = the_stamps->newAtomInMolecule( the_event ); | 
| 92 | 
  | 
      break; | 
| 93 | 
  | 
       | 
| 94 | 
  | 
    case BOND: | 
| 106 | 
  | 
      handled = the_stamps->newTorsion( the_event ); | 
| 107 | 
  | 
      break; | 
| 108 | 
  | 
 | 
| 109 | 
+ | 
    case RIGIDBODY: | 
| 110 | 
+ | 
      incr_block( RIGIDBODY_BLK ); | 
| 111 | 
+ | 
      handled = the_stamps->newRigidBody( the_event ); | 
| 112 | 
+ | 
      break; | 
| 113 | 
+ | 
 | 
| 114 | 
  | 
    case ASSIGNMENT: | 
| 115 | 
  | 
      handled = the_stamps->moleculeAssign( the_event ); | 
| 116 | 
  | 
      break; | 
| 127 | 
  | 
    } | 
| 128 | 
  | 
    break; | 
| 129 | 
  | 
 | 
| 130 | 
+ | 
 | 
| 131 | 
+ | 
  case RIGIDBODY_BLK: | 
| 132 | 
+ | 
     | 
| 133 | 
+ | 
    switch( the_event->event_type ){ | 
| 134 | 
+ | 
       | 
| 135 | 
+ | 
    case ATOM: | 
| 136 | 
+ | 
      incr_block( ATOM_BLK ); | 
| 137 | 
+ | 
      handled = the_stamps->newAtomInRigidBody( the_event ); | 
| 138 | 
+ | 
      break; | 
| 139 | 
+ | 
       | 
| 140 | 
+ | 
    case POSITION: | 
| 141 | 
+ | 
      handled = the_stamps->rigidBodyPosition( the_event ); | 
| 142 | 
+ | 
      break; | 
| 143 | 
+ | 
       | 
| 144 | 
+ | 
    case ORIENTATION: | 
| 145 | 
+ | 
      handled = the_stamps->rigidBodyOrientation( the_event ); | 
| 146 | 
+ | 
      break; | 
| 147 | 
+ | 
 | 
| 148 | 
+ | 
    case ASSIGNMENT: | 
| 149 | 
+ | 
      handled = the_stamps->rigidBodyAssign( the_event ); | 
| 150 | 
+ | 
      break; | 
| 151 | 
+ | 
 | 
| 152 | 
+ | 
    case BLOCK_END: | 
| 153 | 
+ | 
      decr_block(); | 
| 154 | 
+ | 
      handled = the_stamps->rigidBodyEnd( the_event ); | 
| 155 | 
+ | 
      break; | 
| 156 | 
+ | 
 | 
| 157 | 
+ | 
    default: | 
| 158 | 
+ | 
      the_event->err_msg =  | 
| 159 | 
+ | 
        strdup( "Not a valid RigidBody event\n" ); | 
| 160 | 
+ | 
      return 0; | 
| 161 | 
+ | 
    } | 
| 162 | 
+ | 
    break; | 
| 163 | 
+ | 
 | 
| 164 | 
+ | 
 | 
| 165 | 
  | 
  case ATOM_BLK: | 
| 166 | 
  | 
     | 
| 167 | 
  | 
    switch( the_event->event_type ){ | 
| 273 | 
  | 
      return 0; | 
| 274 | 
  | 
    } | 
| 275 | 
  | 
    break; | 
| 276 | 
+ | 
 | 
| 277 | 
+ | 
  case ZCONSTRAINT_BLK: | 
| 278 | 
+ | 
  | 
| 279 | 
+ | 
    switch( the_event->event_type ){ | 
| 280 | 
+ | 
       | 
| 281 | 
+ | 
    case ASSIGNMENT: | 
| 282 | 
+ | 
      handled = the_globals->zConstraintAssign( the_event ); | 
| 283 | 
+ | 
      break; | 
| 284 | 
+ | 
       | 
| 285 | 
+ | 
    case BLOCK_END: | 
| 286 | 
+ | 
      decr_block(); | 
| 287 | 
+ | 
      handled = the_globals->zConstraintEnd( the_event ); | 
| 288 | 
+ | 
      break; | 
| 289 | 
+ | 
 | 
| 290 | 
+ | 
    default: | 
| 291 | 
+ | 
      the_event->err_msg =  | 
| 292 | 
+ | 
        strdup( "not a valid zConstraint event\n" ); | 
| 293 | 
+ | 
      return 0; | 
| 294 | 
+ | 
    } | 
| 295 | 
+ | 
    break; | 
| 296 | 
  | 
     | 
| 297 | 
  | 
  case COMPONENT_BLK: | 
| 298 | 
  | 
     | 
| 302 | 
  | 
      handled = the_globals->componentAssign( the_event ); | 
| 303 | 
  | 
      break; | 
| 304 | 
  | 
       | 
| 234 | 
– | 
    case START_INDEX: | 
| 235 | 
– | 
      handled = the_globals->componentStartIndex( the_event ); | 
| 236 | 
– | 
      break; | 
| 237 | 
– | 
       | 
| 305 | 
  | 
    case BLOCK_END: | 
| 306 | 
  | 
      decr_block(); | 
| 307 | 
  | 
      handled = the_globals->componentEnd(the_event ); |