c@427: /* lsame.f -- translated by f2c (version 20061008). c@427: You must link the resulting object file with libf2c: c@427: on Microsoft Windows system, link with libf2c.lib; c@427: on Linux or Unix systems, link with .../path/to/libf2c.a -lm c@427: or, if you install libf2c.a in a standard place, with -lf2c -lm c@427: -- in that order, at the end of the command line, as in c@427: cc *.o -lf2c -lm c@427: Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., c@427: c@427: http://www.netlib.org/f2c/libf2c.zip c@427: */ c@427: c@427: #include "f2c.h" c@427: #include "blaswrap.h" c@427: c@427: logical lsame_(char *ca, char *cb) c@427: { c@427: /* System generated locals */ c@427: logical ret_val; c@427: c@427: /* Local variables */ c@427: integer inta, intb, zcode; c@427: c@427: c@427: /* -- LAPACK auxiliary routine (version 3.1) -- */ c@427: /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ c@427: /* November 2006 */ c@427: c@427: /* .. Scalar Arguments .. */ c@427: /* .. */ c@427: c@427: /* Purpose */ c@427: /* ======= */ c@427: c@427: /* LSAME returns .TRUE. if CA is the same letter as CB regardless of */ c@427: /* case. */ c@427: c@427: /* Arguments */ c@427: /* ========= */ c@427: c@427: /* CA (input) CHARACTER*1 */ c@427: c@427: /* CB (input) CHARACTER*1 */ c@427: /* CA and CB specify the single characters to be compared. */ c@427: c@427: /* ===================================================================== */ c@427: c@427: /* .. Intrinsic Functions .. */ c@427: /* .. */ c@427: /* .. Local Scalars .. */ c@427: /* .. */ c@427: c@427: /* Test if the characters are equal */ c@427: c@427: ret_val = *(unsigned char *)ca == *(unsigned char *)cb; c@427: if (ret_val) { c@427: return ret_val; c@427: } c@427: c@427: /* Now test for equivalence if both characters are alphabetic. */ c@427: c@427: zcode = 'Z'; c@427: c@427: /* Use 'Z' rather than 'A' so that ASCII can be detected on Prime */ c@427: /* machines, on which ICHAR returns a value with bit 8 set. */ c@427: /* ICHAR('A') on Prime machines returns 193 which is the same as */ c@427: /* ICHAR('A') on an EBCDIC machine. */ c@427: c@427: inta = *(unsigned char *)ca; c@427: intb = *(unsigned char *)cb; c@427: c@427: if (zcode == 90 || zcode == 122) { c@427: c@427: /* ASCII is assumed - ZCODE is the ASCII code of either lower or */ c@427: /* upper case 'Z'. */ c@427: c@427: if (inta >= 97 && inta <= 122) { c@427: inta += -32; c@427: } c@427: if (intb >= 97 && intb <= 122) { c@427: intb += -32; c@427: } c@427: c@427: } else if (zcode == 233 || zcode == 169) { c@427: c@427: /* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or */ c@427: /* upper case 'Z'. */ c@427: c@427: if (inta >= 129 && inta <= 137 || inta >= 145 && inta <= 153 || inta c@427: >= 162 && inta <= 169) { c@427: inta += 64; c@427: } c@427: if (intb >= 129 && intb <= 137 || intb >= 145 && intb <= 153 || intb c@427: >= 162 && intb <= 169) { c@427: intb += 64; c@427: } c@427: c@427: } else if (zcode == 218 || zcode == 250) { c@427: c@427: /* ASCII is assumed, on Prime machines - ZCODE is the ASCII code */ c@427: /* plus 128 of either lower or upper case 'Z'. */ c@427: c@427: if (inta >= 225 && inta <= 250) { c@427: inta += -32; c@427: } c@427: if (intb >= 225 && intb <= 250) { c@427: intb += -32; c@427: } c@427: } c@427: ret_val = inta == intb; c@427: c@427: /* RETURN */ c@427: c@427: /* End of LSAME */ c@427: c@427: return ret_val; c@427: } /* lsame_ */