LAPACK 3.3.1
Linear Algebra PACKage

INSTALL/lsame.f

Go to the documentation of this file.
00001       LOGICAL          FUNCTION LSAME( CA, CB )
00002 *
00003 *  -- LAPACK auxiliary routine (version 3.2) --
00004 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00005 *     November 2006
00006 *
00007 *     .. Scalar Arguments ..
00008       CHARACTER          CA, CB
00009 *     ..
00010 *
00011 *  Purpose
00012 *  =======
00013 *
00014 *  LSAME returns .TRUE. if CA is the same letter as CB regardless of
00015 *  case.
00016 *
00017 *  Arguments
00018 *  =========
00019 *
00020 *  CA      (input) CHARACTER*1
00021 *  CB      (input) CHARACTER*1
00022 *          CA and CB specify the single characters to be compared.
00023 *
00024 * =====================================================================
00025 *
00026 *     .. Intrinsic Functions ..
00027       INTRINSIC          ICHAR
00028 *     ..
00029 *     .. Local Scalars ..
00030       INTEGER            INTA, INTB, ZCODE
00031 *     ..
00032 *     .. Executable Statements ..
00033 *
00034 *     Test if the characters are equal
00035 *
00036       LSAME = CA.EQ.CB
00037       IF( LSAME )
00038      $   RETURN
00039 *
00040 *     Now test for equivalence if both characters are alphabetic.
00041 *
00042       ZCODE = ICHAR( 'Z' )
00043 *
00044 *     Use 'Z' rather than 'A' so that ASCII can be detected on Prime
00045 *     machines, on which ICHAR returns a value with bit 8 set.
00046 *     ICHAR('A') on Prime machines returns 193 which is the same as
00047 *     ICHAR('A') on an EBCDIC machine.
00048 *
00049       INTA = ICHAR( CA )
00050       INTB = ICHAR( CB )
00051 *
00052       IF( ZCODE.EQ.90 .OR. ZCODE.EQ.122 ) THEN
00053 *
00054 *        ASCII is assumed - ZCODE is the ASCII code of either lower or
00055 *        upper case 'Z'.
00056 *
00057          IF( INTA.GE.97 .AND. INTA.LE.122 ) INTA = INTA - 32
00058          IF( INTB.GE.97 .AND. INTB.LE.122 ) INTB = INTB - 32
00059 *
00060       ELSE IF( ZCODE.EQ.233 .OR. ZCODE.EQ.169 ) THEN
00061 *
00062 *        EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or
00063 *        upper case 'Z'.
00064 *
00065          IF( INTA.GE.129 .AND. INTA.LE.137 .OR.
00066      $       INTA.GE.145 .AND. INTA.LE.153 .OR.
00067      $       INTA.GE.162 .AND. INTA.LE.169 ) INTA = INTA + 64
00068          IF( INTB.GE.129 .AND. INTB.LE.137 .OR.
00069      $       INTB.GE.145 .AND. INTB.LE.153 .OR.
00070      $       INTB.GE.162 .AND. INTB.LE.169 ) INTB = INTB + 64
00071 *
00072       ELSE IF( ZCODE.EQ.218 .OR. ZCODE.EQ.250 ) THEN
00073 *
00074 *        ASCII is assumed, on Prime machines - ZCODE is the ASCII code
00075 *        plus 128 of either lower or upper case 'Z'.
00076 *
00077          IF( INTA.GE.225 .AND. INTA.LE.250 ) INTA = INTA - 32
00078          IF( INTB.GE.225 .AND. INTB.LE.250 ) INTB = INTB - 32
00079       END IF
00080       LSAME = INTA.EQ.INTB
00081 *
00082 *     RETURN
00083 *
00084 *     End of LSAME
00085 *
00086       END
 All Files Functions