C+ demo_htmID
C.
C   Demo of usage of the HTM C++ library. See wrapper program.
C.
C.  Optional parameter are: depth RAdeg DECdeg
C.
C.  Usage: ./demo_htmID
C.         ./demo_htmID 8 30 40
C.
C-    LN 29/07/2011: v. 0.1a

      PROGRAM DEMO_HTMID
      IMPLICIT NONE

      INCLUDE 'mcs_usrlib.inc'
      REAL*4 RA, DEC
      INTEGER*8 status, idepth, id, getHTMid
      CHARACTER*64 par
      CHARACTER*200 idname

      idepth = 6
      ra = 10.0
      dec = 20.0
C- Optional arguments: depth and coords
      CALL GETARG( 1, par )
      IF (par.NE.' ') THEN
        READ(par, *) idepth
        CALL GETARG( 2, par )
        IF (par.NE.' ') THEN
           READ(par, *) ra
          CALL GETARG( 3, par )
          IF (par.NE.' ') READ(par, *) dec
        ENDIF
      ENDIF
      WRITE(6,'("Result for depth, RA, Dec: ",I2,2X,G12.6,2X,G12.6)')
     .      idepth, ra, dec
C- The HTM ID and name at the given depth
      status = getHTMid(idepth, ra, dec, id, idname)
      write(6,'("The id and name: "/,I12,2X,A)') id, idname

      END
