*"表題 エスケープシーケンス正規化 GTOOL3(GUCTXT)
*
*"履歴 90/08/28 沼口  敦
*
*
*******************************************************************
*"         << エスケープシーケンス正規化 >>
******************************************************************
      SUBROUTINE GUCTXT
     I         ( HEXT  ,
     O           HNORM  )
*
      CHARACTER HEXT  *(*)           !" エスケープ入り文字列
      CHARACTER HNORM *(*)           !" 正規化された文字列
*
      CHARACTER CSGI
      CHARACTER HMSG  *100
*
      NL = LEN( HNORM )
      NE = LEN( HEXT  )
*
      HNORM = ' '
*
      IL = 1
      IE = 1
 1000 CONTINUE
        IF ( HEXT(IE:IE) .EQ. '\\' ) THEN
           IF ( HEXT(IE+1:IE+1) .EQ. '\\' ) THEN
              HNORM(IL:IL) = '\\'
              IE = IE + 2
              IL = IL + 1
           ELSE IF ( IE .LE. NE-3 ) THEN
              READ ( HEXT(IE+1:IE+3), '(I3)', ERR=9000 ) INUM
              IF ( ( INUM .LT. 0 ) .OR. ( INUM .GT. 255 ) ) GOTO 9000
              HNORM(IL:IL) = CSGI(INUM)
              IE = IE + 4
              IL = IL + 1
           ELSE
              HNORM(IL:IL) = '\\'
              IE = IE + 4
              IL = IL + 1
           ENDIF
        ELSE
              HNORM(IL:IL) = HEXT(IE:IE)
              IE = IE + 1
              IL = IL + 1
        ENDIF
*
        IF ( ( IL .LT. NL ) .AND. ( IE .LT. NE-1 ) ) THEN
           GOTO 1000
        ELSE IF ( IE .EQ. NE ) THEN
              HNORM(IL:IL) = HEXT(IE:IE)
        ENDIF
*
      RETURN
*
 9000 CONTINUE
      HMSG ='IRREGAL ESCAPE(\\ddd): '//HEXT
      CALL MSGDMP( 'W', 'GUCTXT', HMSG )
*
      RETURN
      END
