|
kusano |
2b45e8 |
LOGICAL FUNCTION LSAME( CA, CB )
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* -- LAPACK auxiliary routine (version 2.0) --
|
|
kusano |
2b45e8 |
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
|
|
kusano |
2b45e8 |
* Courant Institute, Argonne National Lab, and Rice University
|
|
kusano |
2b45e8 |
* January 31, 1994
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* .. Scalar Arguments ..
|
|
kusano |
2b45e8 |
CHARACTER CA, CB
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Purpose
|
|
kusano |
2b45e8 |
* =======
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* LSAME returns .TRUE. if CA is the same letter as CB regardless of
|
|
kusano |
2b45e8 |
* case.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Arguments
|
|
kusano |
2b45e8 |
* =========
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* CA (input) CHARACTER*1
|
|
kusano |
2b45e8 |
* CB (input) CHARACTER*1
|
|
kusano |
2b45e8 |
* CA and CB specify the single characters to be compared.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* =====================================================================
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* .. Intrinsic Functions ..
|
|
kusano |
2b45e8 |
INTRINSIC ICHAR
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. Local Scalars ..
|
|
kusano |
2b45e8 |
INTEGER INTA, INTB, ZCODE
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. Executable Statements ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Test if the characters are equal
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
LSAME = CA.EQ.CB
|
|
kusano |
2b45e8 |
IF( LSAME )
|
|
kusano |
2b45e8 |
$ RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Now test for equivalence if both characters are alphabetic.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
ZCODE = ICHAR( 'Z' )
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Use 'Z' rather than 'A' so that ASCII can be detected on Prime
|
|
kusano |
2b45e8 |
* machines, on which ICHAR returns a value with bit 8 set.
|
|
kusano |
2b45e8 |
* ICHAR('A') on Prime machines returns 193 which is the same as
|
|
kusano |
2b45e8 |
* ICHAR('A') on an EBCDIC machine.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
INTA = ICHAR( CA )
|
|
kusano |
2b45e8 |
INTB = ICHAR( CB )
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( ZCODE.EQ.90 .OR. ZCODE.EQ.122 ) THEN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* ASCII is assumed - ZCODE is the ASCII code of either lower or
|
|
kusano |
2b45e8 |
* upper case 'Z'.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( INTA.GE.97 .AND. INTA.LE.122 ) INTA = INTA - 32
|
|
kusano |
2b45e8 |
IF( INTB.GE.97 .AND. INTB.LE.122 ) INTB = INTB - 32
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
ELSE IF( ZCODE.EQ.233 .OR. ZCODE.EQ.169 ) THEN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or
|
|
kusano |
2b45e8 |
* upper case 'Z'.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( INTA.GE.129 .AND. INTA.LE.137 .OR.
|
|
kusano |
2b45e8 |
$ INTA.GE.145 .AND. INTA.LE.153 .OR.
|
|
kusano |
2b45e8 |
$ INTA.GE.162 .AND. INTA.LE.169 ) INTA = INTA + 64
|
|
kusano |
2b45e8 |
IF( INTB.GE.129 .AND. INTB.LE.137 .OR.
|
|
kusano |
2b45e8 |
$ INTB.GE.145 .AND. INTB.LE.153 .OR.
|
|
kusano |
2b45e8 |
$ INTB.GE.162 .AND. INTB.LE.169 ) INTB = INTB + 64
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
ELSE IF( ZCODE.EQ.218 .OR. ZCODE.EQ.250 ) THEN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* ASCII is assumed, on Prime machines - ZCODE is the ASCII code
|
|
kusano |
2b45e8 |
* plus 128 of either lower or upper case 'Z'.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( INTA.GE.225 .AND. INTA.LE.250 ) INTA = INTA - 32
|
|
kusano |
2b45e8 |
IF( INTB.GE.225 .AND. INTB.LE.250 ) INTB = INTB - 32
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
LSAME = INTA.EQ.INTB
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* End of LSAME
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
END
|