1
int lsame_(char *ca, char *cb)
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
11
LSAME returns .TRUE. if CA is the same letter as CB regardless of case.
16
CA (input) CHARACTER*1
17
CB (input) CHARACTER*1
18
CA and CB specify the single characters to be compared.
20
=====================================================================
23
/* System generated locals */
27
int inta, intb, zcode;
29
ret_val = *(unsigned char *)ca == *(unsigned char *)cb;
34
/* Now test for equivalence if both characters are alphabetic. */
38
/* Use 'Z' rather than 'A' so that ASCII can be detected on Prime
39
machines, on which ICHAR returns a value with bit 8 set.
40
ICHAR('A') on Prime machines returns 193 which is the same as
41
ICHAR('A') on an EBCDIC machine. */
43
inta = *(unsigned char *)ca;
44
intb = *(unsigned char *)cb;
46
if (zcode == 90 || zcode == 122) {
47
/* ASCII is assumed - ZCODE is the ASCII code of either lower or
49
if (inta >= 97 && inta <= 122) inta += -32;
50
if (intb >= 97 && intb <= 122) intb += -32;
52
} else if (zcode == 233 || zcode == 169) {
53
/* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or
55
if (inta >= 129 && inta <= 137 || inta >= 145 && inta <= 153 || inta
56
>= 162 && inta <= 169)
58
if (intb >= 129 && intb <= 137 || intb >= 145 && intb <= 153 || intb
59
>= 162 && intb <= 169)
61
} else if (zcode == 218 || zcode == 250) {
62
/* ASCII is assumed, on Prime machines - ZCODE is the ASCII code
63
plus 128 of either lower or upper case 'Z'. */
64
if (inta >= 225 && inta <= 250) inta += -32;
65
if (intb >= 225 && intb <= 250) intb += -32;
67
ret_val = inta == intb;