C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LDM_GET_AXORD    **
C**************************
C
C
CD-Doc:
C AXORd            SUBROUTINE LDM_GET_AXORD (VALSTR, IORD, ISWAP, IFLAG)
CD-end
      SUBROUTINE LDM_GET_AXORD (VALSTR, IORD, ISWAP, IFLAG)
C
      INCLUDE 'implicit_none.finc'
C
C Purpose: Get value of string/code parameter AXORD
C
C Author:  John W. Campbell, June 1993
C
C Arguments:
C
      CHARACTER*(*) VALSTR
      INTEGER IORD
      INTEGER ISWAP
      INTEGER IFLAG

C  VALSTR    (W)   Value for the parameter as a string e.g. +xd+yd 
C                  (max 20 characters)
C                  See routine LDM_AXORD routine for details
C 
C                  The string defines the axis order in terms of x and y 
C                  (the detector xd, yd axes). The slower moving axis is
C                  given first followed by the faster moving axis. Minus 
C                  signs are used when the order of an axis is reversed. 
C                  The code 's' if present indicates that byte swapping is 
C                  to be done and the code 'n' indicates that no byte swapping 
C                  is to be done (byte swapping only relevant for image plate
C                  data). Characters, other than 'x', 'y', '-', '+', 's' and 
C                  'n', or their upper case equivalents, are ignored. 
C                  Some examples follow and the returned flags are indicated:
C
C                  xy                     IORD = 1, ISWAP = 0
C                  +x+y                   IORD = 1, ISWAP = 0
C                  -xy                    IORD = 3, ISWAP = 0
C                  x-y s                  IORD = 2, ISWAP = 2
C                  -Y, +X, n              IORD = 7, ISWAP = 1
C                  S                      IORD = 0, ISWAP = 2
C                  +yd, +xd               IORD = 4, ISWAP = 0
C
C                  Invalid strings: +x-x      (Same axis defined twice)
C                                   +x+y-x    (More than two axes defined)
C                                   xysn      (Byte swapping and no byte 
C                                             swapping both defined)
C
C  IORD      (W)   Returns the axis order as a number from 1 - 8
C                  0 if none specified (or syntax error)
C                  1   +xd slow   +yd fast
C                  2   +xd slow   -yd fast
C                  3   -xd slow   +yd fast
C                  4   -xd slow   -yd fast
C                  5   +yd slow   +xd fast
C                  6   +yd slow   -xd fast
C                  7   -yd slow   +xd fast
C                  8   -yd slow   -xd fast
C  ISWAP    (W)    Returns byte swap type   =1 do not swap bytes
C                                          =2 swap bytes
C                                          =0 not specified (or syntax
C                                             error)
C  IFLAG     (W)   Flag = -1 undefined value
C                       =  0 default value
C                       =  1 value set explicitly
C                       =  2 value set globally
C
C====== GLOBALS:
C
      INCLUDE 'ldm_data.finc'
      EXTERNAL LDM_BDAT
C
C====== LOCALS:
C
      INTEGER IERR
      CHARACTER*1 ERRSTR
C
C-------------------------------------------------------------------------------
C
      VALSTR = AXORD
      CALL LDM_AXORD (AXORD, IORD, ISWAP, IERR, ERRSTR)
      IFLAG = IS_AXORD
      RETURN
      END
