LAPACK  3.10.1
LAPACK: Linear Algebra PACKage
lsame.f
Go to the documentation of this file.
1 *> \brief \b LSAME
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * LOGICAL FUNCTION LSAME( CA, CB )
12 *
13 * .. Scalar Arguments ..
14 * CHARACTER CA, CB
15 * ..
16 *
17 *
18 *> \par Purpose:
19 * =============
20 *>
21 *> \verbatim
22 *>
23 *> LSAME returns .TRUE. if CA is the same letter as CB regardless of
24 *> case.
25 *> \endverbatim
26 *
27 * Arguments:
28 * ==========
29 *
30 *> \param[in] CA
31 *> \verbatim
32 *> \endverbatim
33 *>
34 *> \param[in] CB
35 *> \verbatim
36 *> CA and CB specify the single characters to be compared.
37 *> \endverbatim
38 *
39 * Authors:
40 * ========
41 *
42 *> \author Univ. of Tennessee
43 *> \author Univ. of California Berkeley
44 *> \author Univ. of Colorado Denver
45 *> \author NAG Ltd.
46 *
47 *> \ingroup auxOTHERauxiliary
48 *
49 * =====================================================================
50  LOGICAL FUNCTION lsame( CA, CB )
51 *
52 * -- LAPACK auxiliary routine --
53 * -- LAPACK is a software package provided by Univ. of Tennessee, --
54 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
55 *
56 * .. Scalar Arguments ..
57  CHARACTER ca, cb
58 * ..
59 *
60 * =====================================================================
61 *
62 * .. Intrinsic Functions ..
63  INTRINSIC ichar
64 * ..
65 * .. Local Scalars ..
66  INTEGER inta, intb, zcode
67 * ..
68 * .. Executable Statements ..
69 *
70 * Test if the characters are equal
71 *
72  lsame = ca.EQ.cb
73  IF( lsame )
74  $ RETURN
75 *
76 * Now test for equivalence if both characters are alphabetic.
77 *
78  zcode = ichar( 'Z' )
79 *
80 * Use 'Z' rather than 'A' so that ASCII can be detected on Prime
81 * machines, on which ICHAR returns a value with bit 8 set.
82 * ICHAR('A') on Prime machines returns 193 which is the same as
83 * ICHAR('A') on an EBCDIC machine.
84 *
85  inta = ichar( ca )
86  intb = ichar( cb )
87 *
88  IF( zcode.EQ.90 .OR. zcode.EQ.122 ) THEN
89 *
90 * ASCII is assumed - ZCODE is the ASCII code of either lower or
91 * upper case 'Z'.
92 *
93  IF( inta.GE.97 .AND. inta.LE.122 ) inta = inta - 32
94  IF( intb.GE.97 .AND. intb.LE.122 ) intb = intb - 32
95 *
96  ELSE IF( zcode.EQ.233 .OR. zcode.EQ.169 ) THEN
97 *
98 * EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or
99 * upper case 'Z'.
100 *
101  IF( inta.GE.129 .AND. inta.LE.137 .OR.
102  $ inta.GE.145 .AND. inta.LE.153 .OR.
103  $ inta.GE.162 .AND. inta.LE.169 ) inta = inta + 64
104  IF( intb.GE.129 .AND. intb.LE.137 .OR.
105  $ intb.GE.145 .AND. intb.LE.153 .OR.
106  $ intb.GE.162 .AND. intb.LE.169 ) intb = intb + 64
107 *
108  ELSE IF( zcode.EQ.218 .OR. zcode.EQ.250 ) THEN
109 *
110 * ASCII is assumed, on Prime machines - ZCODE is the ASCII code
111 * plus 128 of either lower or upper case 'Z'.
112 *
113  IF( inta.GE.225 .AND. inta.LE.250 ) inta = inta - 32
114  IF( intb.GE.225 .AND. intb.LE.250 ) intb = intb - 32
115  END IF
116  lsame = inta.EQ.intb
117 *
118 * RETURN
119 *
120 * End of LSAME
121 *
122  END
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53