c
c     The following is a listing of the location in the anz_layout array
c     of the record numbers of the various quantities in the ANZ file
c     format. This is useful in debugging any file i/o problems.
c
c      Index #    Struct Name      Notes
c         1       PRM_general      Corresponds to GP_INT
c         2       PRM_motion       Corresponds to MP_INT
c         3       PRM_force        Corresponds to FP_INT
c         4       PRM_cycle        Corresponds to CYCLE_PRM_INT
c         5       MRK_pos_GCS     
c         6       MpnLCS 
c         7       MrkDist
c         8       SEG_param
c         9       Sgp
c        10       SvlGCS
c        11       SacGCS
c        12       SvlLCS
c        13       SacLCS
c        14       SEG_KE
c        15       SEG_PE
c        16       SEG_TE
c        17       SEG_bodyTE
c        18       SEG_bodyPE
c        19       SEG_bodyTE
c        20       SEG_FinScrew
c        21       SEG_bodyCM
c        22       SgMom
c        23       SEG_BdMom
c        24       SEG_angle
c        25       FRC_plate_FpData
c        26       FtGrlOK
c        27       FRC_FlrCntct
c        28       FRC_single_GRL
c        29       FRC_combined_GRL
c        30       FRC_single_CP
c        31       FRC_combined_CP
c        32       FRC_single_CP_LCS
c        33       FRC_StrIdx
c        34       FRC_single_wrench
c        35       FRC_combined_wrench
c        36       FRC_FtIntegral
c        37       FRC_CombIntegral
c        38       FRC_FRC_plate_CP
c        39       FRC_plate_wrench
c        40       FRC_PltIntegral
c        41       JangJCS
c        42       JvelJCS
c        43       JaccJCS
c        44       JaxesJCS
c        45       JangEUL
c        46       JvelEUL
c        47       JaccEUL
c        48       JaxesEUL
c        49       JntCalcOK
c        50       JNT_calc_type
c        51       JrlGCS
c        52       JrlJCS
c        53       JrlPCS
c        54       JrlDCS
c        55       JNT_LoadLegJCS
c        56       JNT_LoadLegGCS
c        57       JwreLCS
c        58       JNT_Power
c        59       JNT_PowerLeg
c        60       JNT_FinScrew
c        61       SgpAvg
c        62       AVG_angle_JCS
c        63       AVG_angle_EUL
c        64       REC_IndFtLoadLCS
c        65       REC_IndFtLoadGCS
c        66       REC_IndFtCpLCS
c        67       REC_IndFtCpGCS
c        68       REC_CombFtLoad
c        69       REC_CombFtCp
c        70       REC_StrikeIndex
c        71       PRM_EMG
c        72       EMG_Data
c        73       SEG_InsScrew
c        74       JNT_InsScrew
c        75       FRC_FpDataOK
c        76       FRC_FcDataOK
c        77       FRC_FtGRLLCS
c        78       JNT_TransGCS
c        79       JNT_TransJCS
c        80       JNT_TransPCS
c        81       JNT_TransDCS
c        82       JNT_FscAngJCS
c        83       JNT_FscAngPCS
c        84       JNT_FscAngDCS
c        85       FRC_PMAPnt
c        86       FRC_PMATrk
c        87       FRC_PMAPlv
c        88       FRC_PMAGCS
c        89       FRC_PWAPnt
c        90       FRC_PWATrk
c        91       FRC_PWAPlv
c        92       FRC_PWAGCS
c        93       Jnt_MomArmPCS
c        94       Jnt_MomArmDCS
c        95       Jnt_MomArmGCS
c        96       Jnt_WreArmPCS
c        97       Jnt_WreArmDCS
c        98       Jnt_WreArmGCS
c        99       MRK_Vel
c       100       MRK_Acc
c       101       FRC_FtIntegral2
c       102       FRC_CombIntegral2
c       103       FRC_PltIntegral2
c       104       FRC_FtCprVelGCS
c       105       AVG_SgpRefCorAng
c       106       JNT_JntAngRefCorAng
c       107       FLAGS
c       108       SEG_BCMVel
c       109       History
c       110       SegJntInfo               Added 1/93 for version 'd'
c       111       JNT_ExtLdGCS             ! remaining entities not yet 
c       112       JNT_ExtLdJCS             ! implemented....
c       113       JNT_ExtLdPro
c       114       JNT_ExtLdDist
c       115       JNT_LdAngGCS
c       116       JNT_LdAngPro
c       117       JNT_LdAngDist
c                           
c
      structure / anz_layout /  ! there are 108 different quantities listed!
        Union
          Map
            integer*4 Array(128)
          End Map
          Map
            integer*4 PRM_general,PRM_motion,PRM_force,PRM_cycle

            integer*4 MRK_pos_GCS,MpnLCS,MrkDist

            integer*4 SEG_param,Sgp,SvlGCS,SacGCS,SvlLCS,
     &                SacLCS,SEG_KE,SEG_PE,SEG_TE,SEG_bodyKE,SEG_bodyPE,
     &                SEG_bodyTE,SEG_FinScrew,SEG_bodyCM,SgMom,
     &                SEG_BdMom,SEG_angle

            integer*4 FRC_plate_FpData,FtGrlOK,FRC_FlrCntct,
     &                FRC_single_GRL,FRC_combined_GRL,FRC_single_CP,
     &                FRC_combined_CP,FRC_single_CP_LCS,FRC_StrIdx,
     &                FRC_single_wrench,FRC_combined_wrench,FRC_FtIntegral,
     &                FRC_CombIntegral,FRC_plate_CP,FRC_plate_wrench,
     &                FRC_PltIntegral 
                   
            integer*4 JangJCS,JvelJCS,JaccJCS,JaxesJCS,
     &                JangEUL,JvelEUL,JaccEUL,JaxesEUL,
     &                JntCalcOK,JNT_calc_type,
     &                JrlGCS,JrlJCS,JrlPCS,
     &                JrlDCS,JNT_LoadLegJCS,JNT_LoadLegGCS,
     &                JwreLCS,JNT_Power,JNT_PowerLeg,JNT_FinScrew

            integer*4 SgpAvg,AVG_angle_JCS,AVG_angle_EUL

            integer*4 REC_IndFtLoadLCS,REC_IndFtLoadGCS,REC_IndFtCpLCS,
     &                REC_IndFtCpGCS,REC_CombFtLoad,REC_CombFtCp,REC_StrikeIndex

            integer*4 PRM_EMG,EMG_Data,SEG_InsScrew,JNT_InsScrew,FRC_FpDataOK,
     &                FRC_FcDataOK,FRC_FtGRLLCS,JNT_TransGCS,JNT_TransJCS,
     &                JNT_TransPCS,JNT_TransDCS,JNT_FscAngJCS,
     &                JNT_FscAngPCS,JNT_FscAngDCS,FRC_PMAPnt,
     &                FRC_PMATrk,FRC_PMAPlv,FRC_PMAGCS,FRC_PWAPnt,
     &                FRC_PWATrk,FRC_PWAPlv,FRC_PWAGCS,
     &                JNT_MomArmPCS,JNT_MomArmDCS,JNT_MomArmGCS,
     &                JNT_WreArmPCS,JNT_WreArmDCS,JNT_WreArmGCS,
     &                MRK_Vel,MRK_Acc,FRC_FtIntegral2,FRC_CombIntegral2,
     &                FRC_PltIntegral2,FRC_FtCprVelGCS,AVG_SgpRefCorAng,
     &                JNT_JntAngRefCorAng,FLAGS,SEG_BCMVel,History,
     &                SegJntInfo,JNT_ExLdGCS,JNT_ExtLdJCS,JNT_ExtLdPro,
     &                JNT_ExtLdDist,JNT_LdAngGCS,JNT_LdAngPro,JNT_LdAngDist
          End Map
        end Union                                                 
      end structure
        
      Structure / General_Param_INT / 
        Union
          Map
            character*1 Array(512)
          End Map
          Map
            character*40 MtnFile
            character*40 AvgFile 
            character*40 FrcFile
            character*9  last_updated
            character*40 name
            character*80 comment
            integer*4 age
            integer*4 weight
            integer*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, 3-lower only
            integer*4 ByteOrderCheck  ! 4- force plate only 
            character*1 Sex
            character*1 FileFormatVersion
            character*1      filler(83)      
          End Map        !  ^          
        End Union        ! fill out structure to 512 bytes
      end Structure          
                                  
!     Motion_param structure is the same as that in a_struct.inc

      Structure / Coord_System_INT /
        integer*4 LCS(3,4)
      end Structure

      Structure / Force_Param_INT / 
        Union    
          Map                                                 
            integer*4 Array(128)
          End Map
          Map
            integer*4 nfrm
            integer*4 frm_rate
            integer*4 av_frm_ratio
            integer*4 frm_offset
            integer*4 first_frm
            integer*4 last_frm
            integer*4 num_plt
            integer*4 plt_size(2,4)                 ! changed from real to integer
            record / Coord_System_INT / plt_loc(4)  ! changed from real to integer
            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
            character*1      filler(208)     ! fill out structure to 512 bytes
          End Map                   
        End Union              
      end Structure

      Structure / Seg_Param_INT / 
        Union
          Map
            integer*4 Array(128)
          End Map   
          Map
            integer*4 length       ! changed from real to integer
            integer*4 avg_cntr(3)  ! "
            integer*4 mass         ! "
            integer*4 inertia(3)   ! "
            integer*4 shape(3,8)   ! "
            integer*4 num_end
            integer*4 end(3,4)     ! "
            integer*4 num_mrk
            integer*4 mrk_num(5)
            integer*4 num_MrkDist
            integer*4 dist_mrk_num(2,10)
            integer*4 TCStoLCS(3,4)       ! added for rigid body calc 10/92
            integer*4 mpnLCS(3,5)         ! added for rigid body calc 10/92
            integer*4 nmTCS
            integer*4 mnTCS(5)
            character*1      filler(92)
          End Map         
        End Union                 
      end Structure            
                           
      Structure / Cycle_INT / ! all elements of structure changed from real
        Union                 ! to integer except first_side
          Map    
            integer*4 Array(128)
          End Map                  
          Map
            integer*4 first_side  
            integer*4 stride_length
            integer*4 step_length(2)     ! order- first 1/2, second 1/2
            integer*4 step_width
            integer*4 cycle_time
            integer*4 cadence    
            integer*4 velocity
            integer*4 sgl_time(2)     ! order rt,1  lf,2
            integer*4 sgl_percent(2) 
            integer*4 dbl_time(2)
            integer*4 dbl_percent(2)
            integer*4 total_time(2)
            integer*4 total_percent(2)
            integer*4 hs_percent(3)          ! order- 1st, 2nd, 1st foot
            integer*4 to_percent(2)          ! order- 2nd, 1st foot
            integer*4    NormStrideLength
            integer*4    NormStepLength(2)     ! order- first 1/2, second 1/2
            integer*4    NormStepWidth
            integer*4    NormCycleTime
            integer*4    NormCadence
            integer*4    NormVelocity
            integer*4    PctNormStrideLength
            integer*4    PctNormStepLength(2)     ! order- first 1/2, second 1/2
            integer*4    PctNormStepWidth
            integer*4    PctNormCycleTime
            integer*4    PctNormCadence
            integer*4    PctNormVelocity
            integer*4    NormSglPct(2)   
            integer*4    NormDblPct(2)  
            integer*4    NormTotalPct(2) 
            integer*4    NormHsPct(3)      ! order- 1st, 2nd, 1st foot
            integer*4    NormToPct(2)      ! order- 2nd, 1st foot
            character*1      filler(312)
          End Map                  
        End Union                  
      end Structure          
c
c     Structure to hold the segment and joint names along with the 
c     connectivity array.
c     Added by dam 1/93 for version 'd' of ANZ file format
c
      Structure /SegJntInfo/
        Union
          Map
            character seg_names(15)*4
            character jnt_names(15)*4
            integer*4 JntSegNum(2,15)
            integer*4 SegJntNum(4,15)
            character*1      filler(32)
          End Map
          Map
            character*1      array(512)
          End Map
        End Union
      End Structure
                                                   
      structure /OldMrkFlag/   ! 7x4= 28 bytes
        Union                                                     
          Map
            logical*4 read
            logical*4 interpolated
            logical*4 adjusted
            logical*4 smoothed
            logical*4 diagnostics
            logical*4 regularized
            logical*4 VelAcc
          End Map
          Map
            logical*4 array(7)
          End Map
        End Union
      end structure              

      structure /OldSegFlag/   ! 12x4= 48 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
          End Map
          Map                 
            logical*4 array(12)
          End Map
        End Union
      end structure     
                                  
      structure /OldFrcFlag/    ! 16x4 +40 = 104 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
          End Map
          Map
            logical*4 array(26)
          End Map
        End Union
      end structure                  
                             
      structure /OldJntFlag/  !  16x4 = 48 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
          End Map
          Map
            logical*4 array(12)
          End Map
        End Union
      end structure
                          
      structure /OldAvgFlag/  ! 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 /OldEmgFlag/ ! 6x4 + 200 = 224 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
          End Map
          Map
            logical*4 array(56)
          End Map               
        End Union
      end structure 

      Structure / AllOldFlags /
        Union       
          Map
            record /OldMrkFlag/ MRK  ! 28 Bytes   7x4
            record /OldSegFlag/ SEG  ! 48   "    12x4
            record /OldJntFlag/ JNT  ! 64   "    16x4
            record /OldAvgFlag/ AVG  ! 20   "     5x4
            record /OldFrcFlag/ FRC  ! 104  "    16x4 + 40
            record /OldEmgFlag/ EMG  ! 224  "     6x4 + 200  =   488 Bytes Total
            character*1   filler(68)          !           --
          End Map                      !           63
          Map
            integer*4 array(128)
          End Map
        End Union   
      End Structure
                    
