00001 /* lsame.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 logical lsame_(char *ca, char *cb) 00017 { 00018 /* System generated locals */ 00019 logical ret_val; 00020 00021 /* Local variables */ 00022 integer inta, intb, zcode; 00023 00024 00025 /* -- LAPACK auxiliary routine (version 3.2) -- */ 00026 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00027 /* November 2006 */ 00028 00029 /* .. Scalar Arguments .. */ 00030 /* .. */ 00031 00032 /* Purpose */ 00033 /* ======= */ 00034 00035 /* LSAME returns .TRUE. if CA is the same letter as CB regardless of */ 00036 /* case. */ 00037 00038 /* Arguments */ 00039 /* ========= */ 00040 00041 /* CA (input) CHARACTER*1 */ 00042 /* CB (input) CHARACTER*1 */ 00043 /* CA and CB specify the single characters to be compared. */ 00044 00045 /* ===================================================================== */ 00046 00047 /* .. Intrinsic Functions .. */ 00048 /* .. */ 00049 /* .. Local Scalars .. */ 00050 /* .. */ 00051 /* .. Executable Statements .. */ 00052 00053 /* Test if the characters are equal */ 00054 00055 ret_val = *(unsigned char *)ca == *(unsigned char *)cb; 00056 if (ret_val) { 00057 return ret_val; 00058 } 00059 00060 /* Now test for equivalence if both characters are alphabetic. */ 00061 00062 zcode = 'Z'; 00063 00064 /* Use 'Z' rather than 'A' so that ASCII can be detected on Prime */ 00065 /* machines, on which ICHAR returns a value with bit 8 set. */ 00066 /* ICHAR('A') on Prime machines returns 193 which is the same as */ 00067 /* ICHAR('A') on an EBCDIC machine. */ 00068 00069 inta = *(unsigned char *)ca; 00070 intb = *(unsigned char *)cb; 00071 00072 if (zcode == 90 || zcode == 122) { 00073 00074 /* ASCII is assumed - ZCODE is the ASCII code of either lower or */ 00075 /* upper case 'Z'. */ 00076 00077 if (inta >= 97 && inta <= 122) { 00078 inta += -32; 00079 } 00080 if (intb >= 97 && intb <= 122) { 00081 intb += -32; 00082 } 00083 00084 } else if (zcode == 233 || zcode == 169) { 00085 00086 /* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or */ 00087 /* upper case 'Z'. */ 00088 00089 if (inta >= 129 && inta <= 137 || inta >= 145 && inta <= 153 || inta 00090 >= 162 && inta <= 169) { 00091 inta += 64; 00092 } 00093 if (intb >= 129 && intb <= 137 || intb >= 145 && intb <= 153 || intb 00094 >= 162 && intb <= 169) { 00095 intb += 64; 00096 } 00097 00098 } else if (zcode == 218 || zcode == 250) { 00099 00100 /* ASCII is assumed, on Prime machines - ZCODE is the ASCII code */ 00101 /* plus 128 of either lower or upper case 'Z'. */ 00102 00103 if (inta >= 225 && inta <= 250) { 00104 inta += -32; 00105 } 00106 if (intb >= 225 && intb <= 250) { 00107 intb += -32; 00108 } 00109 } 00110 ret_val = inta == intb; 00111 00112 /* RETURN */ 00113 00114 /* End of LSAME */ 00115 00116 return ret_val; 00117 } /* lsame_ */