      Structure /General_Param/                                                
        Union
          Map
            character*40 MtnFile
            character*40 AvgFile
            character*40 FrcFile
            character*9  last_updated
            character*40 name
            character*80 comment
            integer*4 age
            real*4    weight 
            real*4    height 
            integer*4 num_seg
            integer*4 seg_num(15)
            integer*4 num_jnt
            integer*4 jnt_num(15)
            logical*4 single_cycle
            logical*4 normalized		! not used
            logical*4 seg_unrotated		! not used
            logical*4 seg_smooth		! not used
            integer*4 int_poly_order
            integer*4 analysis_type		! 1- full body, 2-upper only, 3-timedist
            integer*4 ByteOrderCheck	! 4- force plate only
            character*1 Sex
            character*1 FileFormatVersion
            character*1      filler(83)		! fill out to 512 bytes   
          End Map
          Map
            character*1      array(512)
          End Map             
        End Union
      end Structure               
                              
      Structure /Motion_Param_VerB/
        Union
          Map                
            integer*4 array(128)
          End Map            
          Map
            integer*4 nfrm
            integer*4 frm_rate
            integer*4 num_cycle   
            integer*4 cycle_first_frm(5)
            integer*4 cycle_last_frm(5)
            integer*4 cycle_length(5)
            integer*4 num_rhs
            integer*4 num_lhs
            integer*4 num_rto
            integer*4 num_lto
            integer*4 rhs_frm(5)
            integer*4 lhs_frm(5)
            integer*4 rto_frm(5)
            integer*4 lto_frm(5)
            integer*4 first_ft
            integer*4 num_mrk                            
            character*4 mrk_name(30)
            integer*4 first_frm      ! used with tr3 & p3d files to show clipping
            character*1      filler(212)    ! makes structure occupy 512 bytes
          End Map
        End Union               
      end Structure

      Structure /Motion_Param /
        Union
          Map
            integer*4 array(128)
          End Map            
          Map
            integer*4 nfrm
            integer*4 frm_rate
            integer*4 num_cycle
            integer*4 cycle_first_frm(5)
            integer*4 cycle_last_frm(5)
            integer*4 cycle_length(5)
            integer*4 num_rhs
            integer*4 num_lhs
            integer*4 num_rto
            integer*4 num_lto
            integer*4 rhs_frm(5)
            integer*4 lhs_frm(5)
            integer*4 rto_frm(5)
            integer*4 lto_frm(5)
            integer*4 first_ft
            integer*4 num_mrk                            
            integer*4 first_frm      ! used with tr3 & p3d files to show clipping
            character*4 mrk_name(40)
            character*1      filler(52)    ! makes structure occupy 512 bytes
          End Map
        End Union               
      end Structure

      
      Structure /Coord_System/
        real*4 LCS(3,4)
      end Structure       
                            
      Structure /Force_Param/
        Union 
          Map
            integer*4 nfrm
            integer*4 frm_rate
            real*4    av_frm_ratio
            integer*4 frm_offset
            integer*4 first_frm    ! relative to motion data first heel strike
            integer*4 last_frm     !  and 2nd hs of same foot
            integer*4 num_plt
            real*4    plt_size(2,4)
            record/Coord_System/plt_loc(4) ! 48 Bytes x 4
            integer*4 num_rtft_plt
            integer*4 num_lfft_plt
            integer*4 rtft_plt(4)
            integer*4 lfft_plt(4)
            logical*4 dbl_stance_OK
            integer*4 FirstFoot                 ! from GLS 1 file
            integer*4 Direction                 ! from GLS 1 file
            character*1      filler(208)
          End Map
          Map
            character*1      array(512)
          End Map
        End Union
      end Structure
                  
                               
      Structure /Seg_Param/   
        Union
          Map
            real*4    length
            real*4    avg_cntr(3)
            real*4    mass
            real*4    inertia(3)
            real*4    shape(3,8)
            integer*4 num_end
            real*4    end(3,4)
            integer*4 num_mrk
            integer*4 mrk_num(5)
            integer*4 num_MrkDist
            integer*4 dist_mrk_num(2,10)
            real*4    TCStoLCS(3,4)      ! Added for rigid body calc 10/92
            real*4    mpnLCS(3,5)        ! Added for rigid body calc 10/92
            integer*4 nmTCS
            integer*4 mnTCS(5)
            character*1      filler(92)
          End Map
          Map
            integer*4 array(128)
          End Map
        End Union
      end Structure         
!
!     Note that mrk_num is arranged such that the marker numbers in elements
!     1 and 2 define the length of the segment from distal to proximal if
!     that is appropriate, e.g. the arm and calf but not the pelvis.
!                        
                                            
      Structure /Cycle/
        Union
          Map
            integer*4 first_side
            real*4    stride_length
            real*4    step_length(2)     ! order- first 1/2, second 1/2
            real*4    step_width
            real*4    cycle_time
            real*4    cadence
            real*4    velocity
            real*4    sgl_time(2)      !  order- rt,1  lf,2
            real*4    sgl_percent(2)   !  "
            real*4    dbl_time(2)      !  "
            real*4    dbl_percent(2)   !  "
            real*4    total_time(2)    !  "
            real*4    total_percent(2) !  "
            real*4    hs_percent(3)          ! order- 1st, 2nd, 1st foot
            real*4    to_percent(2)          ! order- 2nd, 1st foot
            real*4    NormStrideLength
            real*4    NormStepLength(2)     ! order- first 1/2, second 1/2
            real*4    NormStepWidth
            real*4    NormCycleTime
            real*4    NormCadence
            real*4    NormVelocity
            real*4    PctNormStrideLength
            real*4    PctNormStepLength(2)     ! order- first 1/2, second 1/2
            real*4    PctNormStepWidth
            real*4    PctNormCycleTime
            real*4    PctNormCadence
            real*4    PctNormVelocity
            real*4    NormSglPct(2)   
            real*4    NormDblPct(2)  
            real*4    NormTotalPct(2) 
            real*4    NormHsPct(3)      ! order- 1st, 2nd, 1st foot
            real*4    NormToPct(2)      ! order- 2nd, 1st foot
            character*1      filler(312)
          End Map
          Map
            integer*4 array(128)
          End Map
        End Union
      end Structure        
c                            
c     Structure to describe EMG channels
c
      structure /emg_param/
        union
          map
            character*1 array(512)
          end map
          map
            integer*4 NumChnl
            integer*4 NumSamples
            integer*4 SampleRate
            integer*4 CodeNum(16)
            character Name(16)*20
            logical*4 Surface(16)
            character Filter*40
            character*1      filler(12)
          end map           
        end union
      end structure
c                            
c     Structure to describe Muscles
c
      structure /msl_param/
        union
          map
            character*1 array(512)
          end map
          map
            character Name*20
            integer*4 InsertSeg(2)
            real*4    InsertLCS(3,2)
            integer*4 NumJntCrossed
            integer*4 JntCrossed(5)
            integer*4 NumViaPnt
            integer*4 ViaPntSeg(5)
            real*4    ViaPntLCS(3,5)
            integer*4 JntViaPntOrder(10)
            character*1      filler(322)
          end map           
        end union
      end structure
c
c     Command History storage record definition
c
      structure /CmndHistory/  ! 512 Bytes
        Union
          Map
            integer*4 NumLine
            integer*4 NumHistory
            character Line(25)*20
            character*1      filler(4)
          End Map
          Map
            character*1      array(512)
          End Map               
        End Union
      end structure
                          
c                             
c     the flag structures indicate which calculations have been
c     completed and are checked by the calculation subroutines to
c     see if the proper information required for completing the
c     calculations is available.
c
      structure /marker_flag/   ! 512 bytes
        Union
          Map
            logical*4 read
            logical*4 interpolated
            logical*4 adjusted
            logical*4 smoothed
            logical*4 diagnostics
            logical*4 regularized
            logical*4 VelAcc
            integer*4 NumProcOps
            character ProcOp(5)*40
            character*1      filler(282)
          End Map
          Map        
            logical*4 array(128)
          End Map
        End Union
      end structure

      structure /segment_flag/   ! 512 Bytes
        Union
          Map
            logical*4 param
            logical*4 position
            logical*4 vel_acc 
            logical*4 energy
            logical*4 FiniteScrew
            logical*4 InstantScrew
            logical*4 cntr_mass
            logical*4 momentum                                          
            logical*4 angle
            logical*4 adjusted
            logical*4 RefCorrect
            logical*4 BCMVel
            integer*4 NumProcOps
            character ProcOp(5)*40
            logical*4 RightSideAlign
            logical*4 LeftSideAlign
            character*1      filler(252)
          End Map
          Map
            logical*4 array(128)
          End Map
        End Union
      end structure     
                               
      structure /force_flag/    ! 512 Bytes
        Union
          Map
            logical*4 read
            logical*4 gls2_file
            logical*4 filtered
            logical*4 adjusted
            logical*4 aligned
            logical*4 individual_feet
            logical*4 cpr_GCS
            logical*4 cpr_LCS
            logical*4 StrIdx
            logical*4 wrench
            logical*4 Integral
            logical*4 reconstructed
            logical*4 DataClipped
            logical*4 PitchMomArm
            logical*4 PitchWreArm
            logical*4 CprVelGCS
            character FiltOp*40
            character*1      filler(408)
          End Map
          Map 
            logical*4 array(128)
          End Map
        End Union
      end structure            
                             
      structure /joint_flag/  ! 512 Bytes
        Union
          Map
            logical*4 angle_JCS
            logical*4 vel_acc_JCS 
            logical*4 angle_EUL
            logical*4 vel_acc_EUL
            logical*4 load    
            logical*4 wrench
            logical*4 power
            logical*4 FiniteScrew
            logical*4 InstantScrew
            logical*4 legsummed
            logical*4 TRU_angle   ! not used now...
            logical*4 Translation
            logical*4 ScrewAngle
            logical*4 MomentArm
            logical*4 WrenchArm
            logical*4 RefCorrectAng
            integer*4 NumProcOps
            character ProcOp(5)*40
            character*1      filler(244)
          End Map               
          Map
            logical*4 array(128)
          End Map
        End Union              
      end structure
                          
      structure /avg_pos_flag/  ! 5x4= 20 Bytes
        Union
          Map
            logical*4 read
            logical*4 position 
            logical*4 angle_EUL
            logical*4 angle_JCS
            logical*4 RefCorrectAng
          End Map
          Map
            logical*4 array(5)
          End Map
        End Union
      end structure

      structure /cycle_flag/
        Union
          Map
            logical*4 event
            logical*4 statistics
          End map
          Map
            logical*4 array(2)
          End Map
        End Union
      end structure
                 
      structure /emg_flag/ ! 512 Bytes
        Union
          Map
            logical*4 read
            logical*4 filtered
            logical*4 rectified
            logical*4 integrated
            logical*4 averaged
            integer*4 NumProcOps
            character ProcOp(5)*40
            logical*4 Maximum
            logical*4 Normalized
            character*1      filler(280)
          End Map
          Map
            logical*4 array(128)
          End Map
        End Union
      end structure 

      structure /option_flag/
        Union
          Map
            logical*4 ToLog     
            logical*4 log_file_created
            logical*4 one_cycle
            logical*4 normalize
            logical*4 UpDate
          End Map
          Map
            logical*4 array(5)
          End Map
        End Union
      end structure

      structure /MiscFlags/
        Union
          Map
            record /cycle_flag/   CycFlag ! 8 bytes
            record /avg_pos_flag/ AvgFlag ! 20 bytes
            record /option_flag/  OptFlag ! 20 bytes
            character*1   filler(464)
          End Map
          Map
            logical*4 array(128)
          End Map
        End Union              
      end structure

      structure /MuscleFlags/
        Union
          Map
            logical*4 Length
            logical*4 Velocity
            logical*4 MomentArm
            logical*4 MomentPotential
            character*1   filler(496)
          End Map
          Map
            logical*4 array(128)
          End Map
        End Union              
      end structure    
c
c     Structure used in intersegmental joint reaction load calculation
c
      structure /connectivity/
        integer*4 num_jnt            ! # of joints
        integer*4 jnt_order(14)      ! calc order of jnt loads
        integer*4 jnt_seg(14)        ! seg LCS which jnt load is calc'd within
        integer*4 calc_jnt_num(14)   ! jnt # in SP for which jnt load is calc'd
        integer*4 num_conn_jnt(14)   ! num of jnt's connected to above segment
        integer*4 conn_jnt_num(3,14) ! connected jnt #'s
        integer*4 conn_jnt_seg(3,14) ! connected jnt #'s in SP
        integer*4 num_ext_load(14)   ! # externally applied loads to segment
        integer*4 ext_load_num(3,14) ! id # of ext applied load
        integer*4 CalcOrder(14)      ! either ProxtoDist or DisttoProx
      end structure
                         
      structure /force_condition_param/
        real*4    trig_percent     ! OPT FRC TRI
        integer*4 num_idle_frm     !  "   "  FRM
        real*4    idle_percent     !  "   "  IDL
        real*4    HS_tol_percent   ! OPT FRC HST
      end structure
                                  
      structure /marker_number/
        integer*4 toe
        integer*4 ankle
        integer*4 heel
        integer*4 calf
        integer*4 knee
        integer*4 thigh
        integer*4 hip
        integer*4 asis
        integer*4 wrist
        integer*4 elbow
        integer*4 shldr
        integer*4 sacrum
        integer*4 neck
      end structure  
c
c     Structure for parsed command line
c                
      structure /CmndLine/
        integer*4 NumLine
        character Text(5)*80
        integer*4 NumCmnd
        character CmndText(50)*3
        logical*4 CmndNumOK(50)
        integer*4 CmndIntVal(50)
        real*4    CmndRealVal(50)
        integer*4 CmndStart(50)
        integer*4 CmndEnd(50)
        integer*4 NumOpt(50)
        character OptText(5,50)*3
        logical*4 OptNumOK(5,50)
        integer*4 OptIntVal(5,50)
        real*4    OptRealVal(5,50)
        integer*4 OptStart(5,50)
        integer*4 OptEnd(5,50) 
        logical*4 Continue
      end structure
c
c     Structure for force plate-motion data aligment options
c
      structure /FrcMtnOpt/
        logical*4 ManTrigFrm
        logical*4 ManFtPlt
        logical*4 SecondFt
        logical*4 OffSetWith2ndFt
        logical*4 UseDelDetect
        logical*4 MzZero
        real*4    TrigPct
        real*4    HsTolPct
        real*4    FzThreshold
        real*4    FzRange
      end structure
