c
c     Structures relating to the data read in from anz and tru files
c
      Structure / General_Param /
        Union
          Map
            character*40 motion_file
            character*40 average_file
            character*40 force_file
            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
            logical*4 seg_unrotated
            logical*4 seg_smooth
            integer*4 int_poly_order
            integer*4 analysis_type   ! 1- full body, 2-upper only
            integer*4 ByteOrderCheck
            character*1 Sex    
            character*1 FileFormatVersion
            integer*1      filler(83)
          End Map                     
          Map 
            integer*1 array(512)
          End Map
        End Union
      end Structure               
                        
      Structure / Motion_Param /
        Union
          Map
            integer*1 Array(512)
          End Map            
          Map
            integer*4 num_frm
            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 files to show clipping
            character*4 mrk_name(40)
            integer*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 num_frm    
            integer*4 frm_rate
            real*4    av_frm_ratio
            integer*4 frm_offset        ! was offset i*2
            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)
            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
            integer*4 Direction
          End Map
          Map             
            integer*1 array(304)
          End Map
        End Union
      end Structure            

                               
      Structure / Seg_Param /    
        Union
          Map
            real*4    length        ! was seg_length(13) r*4
            real*4    avg_cntr(3)   ! was seg_cntr(3,13) r*4
            real*4    mass          ! was seg_mass(13) r*4
            real*4    inertia(3)    ! was seg_inertia(3,13) r*4
            real*4    shape(3,8)    ! was seg_shape(3,8,13) r*4
            integer*4 num_end
            real*4    end(3,4)      ! was seg_end(3,3,13)
            integer*4 num_mrk          ! was num_seg_mrkr i*2
            integer*4 mrk_num(5)       ! was seg_mrkr i*2
            integer*4 num_mrk_dist     ! was num_mrkr_dist i*2
            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)
            integer*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   ! was first_foot i*2
            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
          End Map
          Map
            integer*1 array(200)
          End Map
        End Union
      end Structure                                                      
c
c     Structure to describe EMG channels
c
      structure / emg_param /
        union
          map
            integer*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)
            integer*4 FirstHSFrm
            integer*1      filler(48)
          end map
        end union
      end structure
c                             
c     the flag structures indicate which calculations have been completed
c                                                  
      structure / MarkerFlag /
        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
            integer*1      filler(282)
          End Map
          Map
            logical*4 Flag(128)
          End Map
        End Union
      end structure

      structure / SegmentFlag /
        Union
          Map
            logical*4 Param
            logical*4 Pos    
            logical*4 VelAcc 
            logical*4 Energy
            logical*4 FiniteScrew
            logical*4 InstantScrew
            logical*4 CntrMass
            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
            integer*1      filler(252)
          End Map
          Map
            logical*4 Flag(128)
          End Map  
        End Union
      end structure                                            
                   
      structure / ForceFlag /
        Union
          Map
            logical*4 Read
            logical*4 GLS2File
            logical*4 FIltered
            logical*4 Adjusted
            logical*4 Aligned
            logical*4 IndFt
            logical*4 CpGCS
            logical*4 CpLCS
            logical*4 Si
            logical*4 Wrench
            logical*4 Integral
            logical*4 Rec
            logical*4 DataClipped
            logical*4 PitchMomArm
            logical*4 PitchWreArm
            logical*4 CpVelGCS
            character FilterOp*40
            integer*1      filler(408)
          End Map
          Map 
            logical*4 Flag(128) ! Only 16 flags...
          End Map  
        End Union
      end structure          
                             
      structure / JointFlag /
        Union
          Map
            logical*4 AngJCS
            logical*4 VelAccJCS  
            logical*4 AngEUL
            logical*4 VelAccEUL
            logical*4 Load   
            logical*4 Wrench
            logical*4 Power
            logical*4 FiniteScrew 
            logical*4 InstantScrew
            logical*4 LegSummed
            logical*4 TRUAngle     ! leftover 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
            integer*1      filler(244)
          End Map
          Map                      
            logical*4 Flag(128)
          End Map
        End Union               
      end structure
                   
      structure / AvgPosFlag /
        Union
          Map
            logical*4 Read
            logical*4 Pos
            logical*4 AngEUL
            logical*4 AngJCS         
            logical*4 RefCorrectAng
          End Map
          Map
            logical*4 Flag(5)
          End Map
        End Union
      end structure
                   
      structure / CycleFlag /
        logical*4 GaitEvent
        logical*4 Statistics
      end structure

      structure / EMGFlag / 
        Union                   
          Map             
            logical*4 Read
            logical*4 Filtered
            logical*4 Rectified
            logical*4 Integrated
            logical*4 Averaged
            integer*4 NumProcOps
            character ProcOp(5)*40
            integer*1      filler(288)
          End Map
          Map
            logical*4 Flag(128) ! Only 5 flags...
          End Map
        End Union
      end structure

      structure /OptionFlag/
        Union
          Map
            logical*4 log_file      
            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 /CycleFlag/  CycFlag ! 8 bytes
            record /AvgPosFlag/ AvgFlag ! 20 bytes
            record /OptionFlag/ OptFlag ! 20 bytes
            integer*1   filler(464)
          End Map
          Map
            logical*4 flag(128)
          End Map
        End Union              
      end structure
c                
c     Structure to define the layout of the ANZ files
c
c     Current file format version is 'd' as of 1/93
c
      structure / anz_layout /	! there are 110 different quantities
        Union		        ! at least in file format version 'a'
          Map
            integer*4 Array(128)
          End Map                                      
          Map
            integer*4 PRM_GEN,PRM_MTN,PRM_FRC,PRM_CYC

            integer*4 MrkPosGCS,MrkPosLCS,MrkDist

            integer*4 SegParam,SegPos,SegVelGCS,SegAccGCS,SegVelLCS,
     &                SegAccLCS,SegKE,SegPE,SegTE,BodyKE,BodyPE,
     &                BodyTE,ScrewFinGCS,BodyCM,SegMom,
     &                BodyMom,SegAngGCS

            integer*4 FpData,FtDataOK,FloorContact,
     &                FtGRL,CombGRL,FtCp,
     &                CombCp,FtCpLCS,FtSI,
     &                FtWrench,CombWrench,FtInt1,
     &                CombInt1,FpCp,FpWrench,
     &                FpInt1  
                   
            integer*4 JntAngJCS,JntVelJCS,JntAccJCS,JntAxesJCS,
     &                JntAngEUL,JntVelEUL,JntAccEUL,JntAxesEUL,
     &                JntCalcOK,JntCalcType,
     &                JntLoadGCS,JntLoadJCS,JntLoadProxLCS,
     &                JntLoadDistLCS,JntLoadLegJCS,JntLoadLegGCS,
     &                JntWrenchLCS,JntPower,JntPowerLeg,ScrewFinLCS

            integer*4 AvgSegPos,AvgAngJCS,AvgAngEUL

            integer*4 FtGRLRecLCS,FtGRLRecGCS,FtCpRecLCS,
     &                FtCpRecGCS,CombGRLRec,CombCpRec,FtSIRec
                                                                   
            integer*4 PRM_EMG,EMGData,ScrewInsGCS,ScrewInsLCS,FpDataOK,
     &                FcDataOK,FtGRLLCS,JntTransGCS,JntTransJCS,
     &                JntTransProxLCS,JntTransDistLCS,JntFscAngJCS,
     &                JntFscAngProxLCS,JntFscAngDistLCS,
     &                PmaPnt,PmaTrk,PmaPlv,PmaGCS,
     &                PwaPnt,PwaTrk,PwaPlv,PwaGCS,
     &                JntMomArmProxLCS,JntMomArmDistLCS,JntMomArmGCS,
     &                JntWreArmProxLCS,JntWreArmDistLCS,JntWreArmGCS,
     &                MrkVel,MrkAcc,FtInt2,CombInt2,FpInt2,FtCpVelGCS,
     &                SegPosRef,JntAngRef,FLAGS,BCMVel,History,
     &                SegJntInfo,JntExLdGCS,JntExLdPro,JntExLdDist,
     &                JntLdAngGCS,JntLdAngPro,JntLdAngDist
                                                                    
          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
            integer*1      filler(4)
          End Map
          Map
            integer*1      array(512)
          End Map               
        End Union
      end structure
c                
c     Structure to define a file completely
c                                
      structure / FileData /
        character Name*40
        integer*4 Type
        integer*4 LU   ! Logical Unit Number                       
        record /General_Param/ GP
        record /Motion_Param/  MP
        real*4 rMtnFrmRate
        logical*4 ExcessNumMtnFrm
        integer*4 OrigNumMtnFrm
        record /Force_Param/   FP
        logical*4 ExcessNumFrcFrm
        integer*4 OrigNumFrcFrm
        record /Seg_Param/     SP(MAX_SEG)
        record /Cycle/         CP
        record /Emg_Param/     EP
        logical*4 ExcessNumEmgFrm
        integer*4 OrigNumEmgFrm
        record /MarkerFlag/    MF
        record /SegmentFlag/   SF
        record /ForceFlag/     FF
        record /JointFlag/     JF
        record /AvgPosFlag/    AF
        record /CycleFlag/     CF
        record /EMGFlag/       EF                     
        record /CmndHistory/   History(MAX_NUM_HISTORY)

        integer*4 GaitEvent(MAX_MTN_FRM)
        logical*4 newCS                  ! these are recorded during FileParam
        logical*4 OldGain                ! reading but not used until FileData
        logical*4 ZeroChnl               ! is read.

        integer*4 NumChnl                ! these 4 values are used !
        integer*4 HdrLnth                ! to read                 !
        integer*4 AvRatio                ! C3D                     !
        real*4    C3dScale               ! Files                   !

        integer*4 NumHdr                 ! used to read TR3 files

        integer*4 FrmWordSize            ! used to read !
        integer*4 Frm1Ptr                ! TRU Files    !

        integer*4 DataStartPtr           ! used to read  !
        integer*4 DataEndPtr             ! FPD Files     !

        real*4    ChnlGain(32)           ! used to   !
        integer*4 FrcChnlNum(6,3)        ! read      !
        integer*4 EMGChnlNum(16)         ! GLS files !
                  
        integer*4 FrcDataPtr(6,4)        ! used to    !
        integer*4 EmgDataPtr(16)         ! read       !
        real*4    FrcConvFactor(6,4)     ! GLS2 files !

        record / anz_layout / Ptr        ! used to   !
        record / anz_layout / Scale      ! read      !
        integer*4 TotalNumVar            ! ANZ files !

        real*4    AvgSegPos(3,4,MAX_SEG)
        real*4    AvgJntAngJCS(3,MAX_JNT)             
        real*4    AvgJntAngEUL(3,MAX_JNT)

        logical*4 FtOutLineLcsOK(2)
        logical*4 FtOutLineGcsOK(2)
        real*4    FtOutLineLCS(3,4,2)
        real*4    FtOutLineGCS(3,4,4)
      end structure                                                 
c                                 
c     Structures relating to graphing of data
c                                       
      structure / PlotData /  
        integer*4 DataType(2)  ! 1= Motion Data, 2= Force Data
        integer*4 NumPnts      ! 3= EMG Data,    4= Muscle Data
        real*4    Max(2)
        real*4    Min(2)                 
        character Lgnd(2)*20
	integer*4 junk1
        character File(2)*40 
        integer*4 FileNum(2)
        integer*4 Side(2)
      end structure         
                                        
      structure / GraphData /    ! opt gra command
        character Title*80       ! tit text
	integer*4 junk1
        character SubTitle*80    ! sub text
        real*4    TitlePos(2)
        real*4    SubPos(2)
        character Xtitle*40      ! xti text
	integer*4 junk2
        character Ytitle*40      ! yti text
        real*4    XtPos(2)
        real*4    YtPos(2)
        character GrLabel*40
        real*4    max(2)
        real*4    min(2)                   
        integer*4 NumPlts    
        logical*4 SameFile
        logical*4 ShowFtOutLine(2)
        logical*4 FtOutLineGCS
        integer*4 FtFileNum(2)
        integer*4 FtPltNum(2)
        logical*4 ShowFpOutline
        logical*4 BlankGraph
        logical*4 ShowBlankTitle
        logical*4 ShowBlankSubtitle
        logical*4 ShowBlankDate
        logical*4 ShowBlankName
        logical*4 ShowBlankFilename
        integer*4 ShowBlankFileNum
        logical*4 ShowBlankTD1
        integer*4 ShowBlankTD1Fn
        logical*4 ShowBlankTD2
        integer*4 ShowBlankTD2Fn
      end structure
c
c     Structure for parsed command line
c                       
      structure /CmndLine/            
        integer*4 NumLine
        character Text(MAX_NUM_CMND_LINES)*80
        integer*4 NumCmnd
        character CmndText(MAX_NUM_CMND)*3
        logical*4 CmndNumOK(MAX_NUM_CMND)
        integer*4 CmndIntVal(MAX_NUM_CMND)
        real*4    CmndRealVal(MAX_NUM_CMND)
        integer*4 CmndStart(MAX_NUM_CMND)            
        integer*4 CmndEnd(MAX_NUM_CMND)
        integer*4 NumOpt(MAX_NUM_CMND)
        character OptText(MAX_NUM_CMND_OPT,MAX_NUM_CMND)*3
        logical*4 OptNumOK(MAX_NUM_CMND_OPT,MAX_NUM_CMND)
        integer*4 OptIntVal(MAX_NUM_CMND_OPT,MAX_NUM_CMND)
        real*4    OptRealVal(MAX_NUM_CMND_OPT,MAX_NUM_CMND)
        integer*4 OptStart(MAX_NUM_CMND_OPT,MAX_NUM_CMND)
        integer*4 OptEnd(MAX_NUM_CMND_OPT,MAX_NUM_CMND) 
        logical*4 Continue
      end structure
c                        
c     Macro structure
c                                     
      structure /MacroStuff/ ! note that the macros are numbered 0 to 9
        logical*4 On
        integer*4 MacroNum
        character Description(MAX_NUM_MACRO)*80
        character Text(MAX_NUM_MACRO_LINES,MAX_NUM_MACRO)*80
        logical*4 OK(MAX_NUM_MACRO)
        integer*4 NumLines(MAX_NUM_MACRO)
        integer*4 LineNum
        logical*4 Echo
      end structure      
c                        
c     Structures for graph and 3d plot options
c                              
      structure /GraphOption/   ! opt gra command
        Union
          Map
            logical*4 CycleClip     ! cyc on/off
            logical*4 RemAvgAng     ! avg on/off
            logical*4 Print         ! pri on/off
            logical*4 Screen        ! scr on/off
            Logical*4 LgndFlg       ! lgd on/off
            logical*4 ManLgndFlg    ! mlg on/off
            logical*4 EventOn       ! eve on/off
            logical*4 PctCycleLn    ! pct on/off
            logical*4 AlignSides    ! ali on/off
            logical*4 LnFlg         ! lin on/off
            logical*4 SymFlg        ! sym on/off
            logical*4 GrLabelFlg    ! grl on/off
            logical*4 ManGrLabelFlg ! mgl on/off
            logical*4 NormWt        ! nwt on/off
            logical*4 NormWtHt      ! nwh on/off
            logical*4 NormWtLeg     ! nwl on/off
            logical*4 XZeroLine     ! xzl on/off
            logical*4 YZeroLine     ! yzl on/off
            logical*4 PositiveFz    ! pfz on/off
            logical*4 SimpleAutoScale ! sas on/off
            logical*4 FirstGaitEvent  ! fge on/off
            logical*4 ShowFtOutLine   ! fot on/off
            logical*4 ShowFpOutline   ! fpo on/off
            logical*4 UsePostPrint    ! pst on/off
            logical*4 ManScale      ! msc on/off or xmin xmax ymin ymax
            integer*4 DefFile       ! def file#
            integer*4 LgndPosNum    ! lgp #(1-9)
            real*4    ManMin(2)          
            real*4    ManMax(2)
            integer*4 NumDiv(2)     ! div x/y #
            integer*4 Font          ! fon #
            character ManLgnd(MAX_PLOT)*20 ! mlt 'legend text'
	    integer*4 junk1
            character ManGrLabel*40 ! mgt 'graph name test'
          end Map                        
          Map                
            logical*4 Flag(31)
          End Map       
        End Union                        
      end structure

      structure /SChartOption/
        Union                                           
          Map
            logical*4 EventOn       ! OPT SCH EVE on/off
            logical*4 DisplayTitle  !         TIT on/off
            logical*4 DisplayLabel  !         LAB on/off
            logical*4 ManLabel      !         MLB on/off or text
            logical*4 ManXaxis      !         MNX on/off or min# max#
            logical*4 SimpleAutoScale !       SAS on/off
            logical*4 Print         !         PRI on/off
            logical*4 Screen        !         SCR on/off
            logical*4 UsePostPrint  !         PST on/off
            character Title*40      !         TIT text
	    integer*4 junk1
            character SubTitle*40   !         SUB text
	    integer*4 junk2
            character XaxisLabel*40 !         XLB text
	    integer*4 junk3
            character ChartLabel*40 !         MLB text
            integer*4 NumXDiv       !         XDV #Divisions
            integer*4 Font          !         FON Font#
            real*4    Xmin
            real*4    Xmax                              
          End Map
          Map
            logical*4 Flag(11)
          End Map
        End Union
      end structure
                                                       
      structure /TdOption/ ! one structure for each 3D view
c  Segment Appearance
        logical*4 SegWireFrame ! OPT 3DV SEG WIRe ON/OFF
        logical*4 SegHideFace  !  "   "   "  FACe ON/OFF
        logical*4 SegHideLine  !  "   "   "  LINe ON/OFF
        logical*4 SegShowLCS   !  "   "   "  LCS  ON/OFF
        logical*4 SegShowCntr  !  "   "   "  CENter ON/OFF
c  Segment vel/acc/momentum appearance - these defaults can be overridden
        logical*4 SegTrnDef    ! OPT 3DV SEG TRN ON/OFF
        logical*4 SegRotDef    ! OPT 3DV SEG ROT ON/OFF
c  Joint Load Appearance - these defaults can be overridden
        logical*4 JntFrcDef    ! OPT 3DV JNT FRC ON/OFF
        logical*4 JntMomDef    ! OPT 3DV JNT MOM ON/OFF
c  GRL Appearance - these defaults can be overridden
        logical*4 GRLFrcDef    ! OPT 3DV GRL FRC ON/OFF
        logical*4 GRLMomDef    ! OPT 3DV GRL MOM ON/OFF
c  View Centering
        logical*4 CenterOnSeg  ! OPT 3DV CENter JNTname/SEGname/OFF
        integer*4 SegCenter
        logical*4 CenterOnJnt
        integer*4 JntCenter
c  Misc View Components
        logical*4 ShowFp       ! OPT 3DV FPL ON/OFF
        logical*4 ShowLabGCS   !  "   "  GCS ON/OFF
        logical*4 ShowJnt      ! OPT 3DV SGE ON/OFF
        logical*4 Perspective  !  "   "  PER ON/OFF
        logical*4 Zoom         !  "   "  ZOOm OFF or #   ????
        integer*4 ZoomX                            
c  View Time Sequence         
        logical*4 Animate      ! OPT 3DV ANI ON/OFF
        integer*4 StartFrm     !  "   "  STArt/FRA/PER # or Gait Event Name
        integer*4 EndFrm       !  "   "  END/FRA/PER
        integer*4 FrmInc       !  "   "  INCrement/FRA/PER #
c  Manual Windowing                                    
        logical*4 ManWin        ! OPT 3DV MWN ON/OFF or Width# Height#
        real*4    ManWinSize(2)
c  Manually Defined View Point
        real*4    ManVwPnt(3)   ! OPT 3DV MVW- Forces 3 sets of 3 real #'s
        real*4    ManVwCntr(3)  !              to be input...
        real*4    ManVwUpDir(3)
c  Misc
        logical*4 Print         ! OPT 3DV PRI ON/OFF
        logical*4 Screen        !  "   "  SCR ON/OFF
        integer*4 DefFile       !  "   "  DEF #
c       Scaling Factors
        real*4 FinScrewAngle ! rad/m     OPT 3DV SAN #
        real*4 FinScrewTrans ! m/m        "   "  STR #
        real*4 InsScrewRotVel ! rad/s/m     OPT 3DV SAN #
        real*4 InsScrewTrnVel ! m/s/m        "   "  STR #
        real*4 VelRot     ! rad/s/m    "   "  VLR #
        real*4 VelTrans   ! m/s/m      "   "  VLT #
        real*4 AccRot     ! rad/s^2/m  "   "  ACR #
        real*4 AccTrans   ! m/s^2/m    "   "  ACT #
        real*4 GRLFrc     ! N/m        "   "  GRF #
        real*4 GRLMom     ! Nm/m       "   "  GRM #
        real*4 JntFrc     ! N/m        "   "  JTF #
        real*4 JntMom     ! Nm/m       "   "  JTM #
      end structure                                
                                
      structure /TdMrkInfo/   
        logical*4 Show   
        integer*4 NumMrk
        integer*4 MrkNum(MAX_MRK)
      end structure
                                 
      structure /TdSegInfo/                         
        logical*4 Show
        integer*4 NumSeg 
        integer*4 SegNum(MAX_SEG)
        logical*4 ShowTrn
        logical*4 ShowRot
      end structure

      structure /TdBodInfo/
        logical*4 Show   
        logical*4 ShowTrn
        logical*4 ShowRot
      end structure      
                        
      structure /TdJntInfo/
        logical*4 Show
        integer*4 NumJnt 
        integer*4 JntNum(MAX_JNT)
        logical*4 ShowFrc
        logical*4 ShowMom
      end structure      
                                 
      structure /TdFrcInfo/
        logical*4 Show  
        integer*4 NumPlt         
        integer*4 PltNum(MAX_PLT)
        logical*4 ShowFrc
        logical*4 ShowMom
        logical*4 RtSide
        logical*4 LfSide
      end structure              

      structure /TdRecInfo/
        logical*4 Show   
        logical*4 RtSide
        logical*4 LfSide
      end structure

      structure /TdMslInfo/
        logical*4 Show
        integer*4 NumMsl
        integer*4 MslNum(MAX_MSL)
      end structure

      structure /TdData/
        integer*4 FileNum
        real*4    VuPnt(3)
        real*4    VuDir(3)
        real*4    VuUpDir(3)
        integer*4 StartFrm
        integer*4 EndFrm
        integer*4 IncFrm
        record /TdMrkInfo/ MrkPos
        record /TdMrkInfo/ MrkVel
        record /TdMrkInfo/ MrkAcc
        record /TdSegInfo/ SegPos
        record /TdSegInfo/ SegVel
        record /TdSegInfo/ SegAcc
        record /TdSegInfo/ SegMrk
        record /TdSegInfo/ SegIsc
        record /TdSegInfo/ SegFsc
        record /TdSegInfo/ SegMom
        record /TdBodInfo/ BodMom
        record /TdBodInfo/ BodCM
        record /TdJntInfo/ JntLod                  
        record /TdJntInfo/ JntWre
        record /TdJntInfo/ JntIsc
        record /TdJntInfo/ JntFsc
        record /TdFrcInfo/ FrcPGR              
        record /TdFrcInfo/ FrcFGR
        record /TdFrcInfo/ FrcCGR
        record /TdFrcInfo/ FrcPCP
        record /TdFrcInfo/ FrcFCP
        record /TdFrcInfo/ FrcCCP
        record /TdFrcInfo/ FrcPWr
        record /TdFrcInfo/ FrcFWr
        record /TdFrcInfo/ FrcCWr
        record /TdFrcInfo/ FrcPIm
        record /TdFrcInfo/ FrcFIm
        record /TdFrcInfo/ FrcCIm
        record /TdRecInfo/ RecFGR
        record /TdRecInfo/ RecCGR
        record /TdRecInfo/ RecFCP
        record /TdRecInfo/ RecCCP
        record /TdMslInfo/ MslOri
        record /TdMslInfo/ MslIns
        record /TdMslInfo/ MslLin
        record /TdMslInfo/ MslEMG
      end structure

c
c     Bookeeping structure to keep track of what has and has not been read in
c     from the file
c
      structure /TdRead/
        logical*4 MrkPos
        logical*4 MrkVelAcc
        logical*4 SegPos
        logical*4 SegVel 
        logical*4 SegAcc
        logical*4 SegMrk
        logical*4 SegFinScrew
        logical*4 SegInsScrew
        logical*4 BodyCM
        logical*4 SegMom
        logical*4 BodyMom
        logical*4 JntLoad
        logical*4 JntWrench
        logical*4 JntFinScrew
        logical*4 JntInsScrew
        logical*4 FpGrl
        logical*4 FtGrl
        logical*4 CombGrl
        logical*4 FpCp
        logical*4 FtCp
        logical*4 CombCp
        logical*4 FpWrench
        logical*4 FtWrench
        logical*4 CombWrench
        logical*4 FpImp
        logical*4 FtImp
        logical*4 CombImp
        logical*4 RecFtGrl
        logical*4 RecFtCp
        logical*4 RecCombGrl
        logical*4 RecCombCp
        logical*4 EMG
        logical*4 Msl
      end structure
