| 1 |
/* ./src_f77/lsame.f -- translated by f2c (version 20030320). |
| 2 |
You must link the resulting object file with the libraries: |
| 3 |
-lf2c -lm (in that order) |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <punc/vf2c.h> |
| 7 |
|
| 8 |
logical lsame_(char *ca, char *cb, ftnlen ca_len, ftnlen cb_len) |
| 9 |
{ |
| 10 |
/* System generated locals */ |
| 11 |
logical ret_val; |
| 12 |
|
| 13 |
/* Local variables */ |
| 14 |
static integer inta, intb, zcode; |
| 15 |
|
| 16 |
|
| 17 |
/* -- LAPACK auxiliary routine (version 2.0) -- */ |
| 18 |
/* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */ |
| 19 |
/* Courant Institute, Argonne National Lab, and Rice University */ |
| 20 |
/* January 31, 1994 */ |
| 21 |
|
| 22 |
/* .. Scalar Arguments .. */ |
| 23 |
/* .. */ |
| 24 |
|
| 25 |
/* Purpose */ |
| 26 |
/* ======= */ |
| 27 |
|
| 28 |
/* LSAME returns .TRUE. if CA is the same letter as CB regardless of */ |
| 29 |
/* case. */ |
| 30 |
|
| 31 |
/* Arguments */ |
| 32 |
/* ========= */ |
| 33 |
|
| 34 |
/* CA (input) CHARACTER*1 */ |
| 35 |
/* CB (input) CHARACTER*1 */ |
| 36 |
/* CA and CB specify the single characters to be compared. */ |
| 37 |
|
| 38 |
/* ===================================================================== */ |
| 39 |
|
| 40 |
/* .. Intrinsic Functions .. */ |
| 41 |
/* .. */ |
| 42 |
/* .. Local Scalars .. */ |
| 43 |
/* .. */ |
| 44 |
/* .. Executable Statements .. */ |
| 45 |
|
| 46 |
/* Test if the characters are equal */ |
| 47 |
|
| 48 |
ret_val = *(unsigned char *)ca == *(unsigned char *)cb; |
| 49 |
if (ret_val) { |
| 50 |
return ret_val; |
| 51 |
} |
| 52 |
|
| 53 |
/* Now test for equivalence if both characters are alphabetic. */ |
| 54 |
|
| 55 |
zcode = 'Z'; |
| 56 |
|
| 57 |
/* Use 'Z' rather than 'A' so that ASCII can be detected on Prime */ |
| 58 |
/* machines, on which ICHAR returns a value with bit 8 set. */ |
| 59 |
/* ICHAR('A') on Prime machines returns 193 which is the same as */ |
| 60 |
/* ICHAR('A') on an EBCDIC machine. */ |
| 61 |
|
| 62 |
inta = *(unsigned char *)ca; |
| 63 |
intb = *(unsigned char *)cb; |
| 64 |
|
| 65 |
if (zcode == 90 || zcode == 122) { |
| 66 |
|
| 67 |
/* ASCII is assumed - ZCODE is the ASCII code of either lower or */ |
| 68 |
/* upper case 'Z'. */ |
| 69 |
|
| 70 |
if (inta >= 97 && inta <= 122) { |
| 71 |
inta += -32; |
| 72 |
} |
| 73 |
if (intb >= 97 && intb <= 122) { |
| 74 |
intb += -32; |
| 75 |
} |
| 76 |
|
| 77 |
} else if (zcode == 233 || zcode == 169) { |
| 78 |
|
| 79 |
/* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or */ |
| 80 |
/* upper case 'Z'. */ |
| 81 |
|
| 82 |
if (inta >= 129 && inta <= 137 || inta >= 145 && inta <= 153 || inta |
| 83 |
>= 162 && inta <= 169) { |
| 84 |
inta += 64; |
| 85 |
} |
| 86 |
if (intb >= 129 && intb <= 137 || intb >= 145 && intb <= 153 || intb |
| 87 |
>= 162 && intb <= 169) { |
| 88 |
intb += 64; |
| 89 |
} |
| 90 |
|
| 91 |
} else if (zcode == 218 || zcode == 250) { |
| 92 |
|
| 93 |
/* ASCII is assumed, on Prime machines - ZCODE is the ASCII code */ |
| 94 |
/* plus 128 of either lower or upper case 'Z'. */ |
| 95 |
|
| 96 |
if (inta >= 225 && inta <= 250) { |
| 97 |
inta += -32; |
| 98 |
} |
| 99 |
if (intb >= 225 && intb <= 250) { |
| 100 |
intb += -32; |
| 101 |
} |
| 102 |
} |
| 103 |
ret_val = inta == intb; |
| 104 |
|
| 105 |
/* RETURN */ |
| 106 |
|
| 107 |
/* End of LSAME */ |
| 108 |
|
| 109 |
return ret_val; |
| 110 |
} /* lsame_ */ |
| 111 |
|