KTH framework for Nek5000 toolboxes; testing version  0.0.1
lsame.f
Go to the documentation of this file.
1  LOGICAL FUNCTION lsame( CA, CB )
2 *
3 * -- LAPACK auxiliary routine (version 2.0) --
4 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5 * Courant Institute, Argonne National Lab, and Rice University
6 * January 31, 1994
7 *
8 * .. Scalar Arguments ..
9  CHARACTER ca, cb
10 * ..
11 *
12 * Purpose
13 * =======
14 *
15 * LSAME returns .TRUE. if CA is the same letter as CB regardless of
16 * case.
17 *
18 * Arguments
19 * =========
20 *
21 * CA (input) CHARACTER*1
22 * CB (input) CHARACTER*1
23 * CA and CB specify the single characters to be compared.
24 *
25 * =====================================================================
26 *
27 * .. Intrinsic Functions ..
28  INTRINSIC ichar
29 * ..
30 * .. Local Scalars ..
31  INTEGER inta, intb, zcode
32 * ..
33 * .. Executable Statements ..
34 *
35 * Test if the characters are equal
36 *
37  lsame = ca.EQ.cb
38  IF( lsame )
39  $ RETURN
40 *
41 * Now test for equivalence if both characters are alphabetic.
42 *
43  zcode = ichar( 'Z' )
44 *
45 * Use 'Z' rather than 'A' so that ASCII can be detected on Prime
46 * machines, on which ICHAR returns a value with bit 8 set.
47 * ICHAR('A') on Prime machines returns 193 which is the same as
48 * ICHAR('A') on an EBCDIC machine.
49 *
50  inta = ichar( ca )
51  intb = ichar( cb )
52 *
53  IF( zcode.EQ.90 .OR. zcode.EQ.122 ) THEN
54 *
55 * ASCII is assumed - ZCODE is the ASCII code of either lower or
56 * upper case 'Z'.
57 *
58  IF( inta.GE.97 .AND. inta.LE.122 ) inta = inta - 32
59  IF( intb.GE.97 .AND. intb.LE.122 ) intb = intb - 32
60 *
61  ELSE IF( zcode.EQ.233 .OR. zcode.EQ.169 ) THEN
62 *
63 * EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or
64 * upper case 'Z'.
65 *
66  IF( inta.GE.129 .AND. inta.LE.137 .OR.
67  $ inta.GE.145 .AND. inta.LE.153 .OR.
68  $ inta.GE.162 .AND. inta.LE.169 ) inta = inta + 64
69  IF( intb.GE.129 .AND. intb.LE.137 .OR.
70  $ intb.GE.145 .AND. intb.LE.153 .OR.
71  $ intb.GE.162 .AND. intb.LE.169 ) intb = intb + 64
72 *
73  ELSE IF( zcode.EQ.218 .OR. zcode.EQ.250 ) THEN
74 *
75 * ASCII is assumed, on Prime machines - ZCODE is the ASCII code
76 * plus 128 of either lower or upper case 'Z'.
77 *
78  IF( inta.GE.225 .AND. inta.LE.250 ) inta = inta - 32
79  IF( intb.GE.225 .AND. intb.LE.250 ) intb = intb - 32
80  END IF
81  lsame = inta.EQ.intb
82 *
83 * RETURN
84 *
85 * End of LSAME
86 *
87  END
logical function lsame(CA, CB)
Definition: lsame.f:2