C***   XSPEAK
C  UTILITY ROUTINES FOR CREATING A READABLE CAVE MAP. (XSPEAK, XMAP)

       SUBROUTINE XSPEAK(LOC)

C  PRINT LOCATION DESCRIPTIONS.  WORKS JUST LIKE SPEAK, EXCEPT THAT
C  LOCATION NUMBER IS PREFIXED TO EACH LINE.

       IMPLICIT INTEGER(A-Z)
      INTEGER*4 RTEXT,PTEXT,MTEXT
C      INTEGER*4 LINES
      CHARACTER*4 LINES
       COMMON /TXTCOM/ LINES(25000),RTEXT(400),PTEXT(150),MTEXT(45)
      INTEGER*4 LTEXT,STEXT,K,L
       COMMON /LTXCOM/ LTEXT(250),STEXT(250),KEY(250),ABB(250),LOCSIZ
       COMMON /PLACOM/ ATLOC(250),LINK(300),PLACE(150),
     1          FIXED(150),MAXOBJ
C      INTEGER*4 POINTS,OLINE
       INTEGER*4 POINTS
       CHARACTER*4 OLINE
       COMMON /OBJCOM/ PLAC(150),FIXD(150),WEIGHT(150),PROP(150),
     1          POINTS(150)
       DIMENSION OLINE(18)
C       CHARACTER OLINE(18)

       K=STEXT(LOC)
C      IF(K.EQ.0.OR.LINES(K+1).EQ.XOR('>$< ','CLYD'))K=LTEXT(LOC)
      IF(K.EQ.0.OR.LINES(K+1).EQ.'>$< ')K=LTEXT(LOC)!??????
C       WRITE (22,5)
      WRITE(5,5)
C       WRITE (22,5)
      WRITE(5,5)
5       FORMAT (1H )
C1       L=IABS(LINES(K))-K-1
 1      L=IABS(ICHAR(LINES(K)))-K-1
       DO 2 I=1,L
C2     OLINE(I)=XOR(LINES(K+I),'CLYD')
 2        OLINE(I)=LINES(K+I)!I'M NOT SURE ABOUT THIS
C       WRITE (22,3),LOC,(OLINE(I),I=1,L)
      WRITE(5,3)LOC,(OLINE(I),I=1,L)
3       FORMAT (1X,I3,'  ',18A4)
       K=K+L+1
       IF(ICHAR(LINES(K)).GE.0)GOTO 1
       DO 7 OBJ=1,MAXOBJ
       IF(LOC.NE.PLAC(OBJ).AND.LOC.NE.FIXD(OBJ))GOTO 7
       K=PTEXT(OBJ)
C       L=IABS(LINES(K))-K-1
       L=IABS(ICHAR(LINES(K)))-K-1
       DO 6 I=1,L
C6     OLINE(I)=XOR(LINES(K+I),'CLYD')
 6        OLINE(I)=LINES(K+I)
C       WRITE (22,9),(OLINE(J),J=1,L)
      WRITE(5,9)(OLINE(J),J=1,L)
7       CONTINUE
C       WRITE (22,5)
      WRITE(5,5)
       RETURN

9       FORMAT (8X,18A4)
       END
