|
kusano |
7d535a |
/*! @file lsame.c
|
|
kusano |
7d535a |
* \brief Check if CA is the same letter as CB regardless of case.
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* -- LAPACK auxiliary routine (version 2.0) --
|
|
kusano |
7d535a |
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
|
|
kusano |
7d535a |
* Courant Institute, Argonne National Lab, and Rice University
|
|
kusano |
7d535a |
* September 30, 1994
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
#include "slu_Cnames.h"
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*! \brief
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Purpose
|
|
kusano |
7d535a |
=======
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
LSAME returns .TRUE. if CA is the same letter as CB regardless of case.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Arguments
|
|
kusano |
7d535a |
=========
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
CA (input) CHARACTER*1
|
|
kusano |
7d535a |
CB (input) CHARACTER*1
|
|
kusano |
7d535a |
CA and CB specify the single characters to be compared.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
=====================================================================
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
int lsame_(char *ca, char *cb)
|
|
kusano |
7d535a |
{
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* System generated locals */
|
|
kusano |
7d535a |
int ret_val;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Local variables */
|
|
kusano |
7d535a |
int inta, intb, zcode;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
ret_val = *(unsigned char *)ca == *(unsigned char *)cb;
|
|
kusano |
7d535a |
if (ret_val) {
|
|
kusano |
7d535a |
return ret_val;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Now test for equivalence if both characters are alphabetic. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
zcode = 'Z';
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Use 'Z' rather than 'A' so that ASCII can be detected on Prime
|
|
kusano |
7d535a |
machines, on which ICHAR returns a value with bit 8 set.
|
|
kusano |
7d535a |
ICHAR('A') on Prime machines returns 193 which is the same as
|
|
kusano |
7d535a |
ICHAR('A') on an EBCDIC machine. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
inta = *(unsigned char *)ca;
|
|
kusano |
7d535a |
intb = *(unsigned char *)cb;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
if (zcode == 90 || zcode == 122) {
|
|
kusano |
7d535a |
/* ASCII is assumed - ZCODE is the ASCII code of either lower or
|
|
kusano |
7d535a |
upper case 'Z'. */
|
|
kusano |
7d535a |
if (inta >= 97 && inta <= 122) inta += -32;
|
|
kusano |
7d535a |
if (intb >= 97 && intb <= 122) intb += -32;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
} else if (zcode == 233 || zcode == 169) {
|
|
kusano |
7d535a |
/* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or
|
|
kusano |
7d535a |
upper case 'Z'. */
|
|
kusano |
7d535a |
if (inta >= 129 && inta <= 137 || inta >= 145 && inta <= 153 || inta
|
|
kusano |
7d535a |
>= 162 && inta <= 169)
|
|
kusano |
7d535a |
inta += 64;
|
|
kusano |
7d535a |
if (intb >= 129 && intb <= 137 || intb >= 145 && intb <= 153 || intb
|
|
kusano |
7d535a |
>= 162 && intb <= 169)
|
|
kusano |
7d535a |
intb += 64;
|
|
kusano |
7d535a |
} else if (zcode == 218 || zcode == 250) {
|
|
kusano |
7d535a |
/* ASCII is assumed, on Prime machines - ZCODE is the ASCII code
|
|
kusano |
7d535a |
plus 128 of either lower or upper case 'Z'. */
|
|
kusano |
7d535a |
if (inta >= 225 && inta <= 250) inta += -32;
|
|
kusano |
7d535a |
if (intb >= 225 && intb <= 250) intb += -32;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
ret_val = inta == intb;
|
|
kusano |
7d535a |
return ret_val;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
} /* lsame_ */
|