Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

lsame.c

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

Generated on Wed Sep 5 12:54:21 2007 for DSACSS Operational Code by  doxygen 1.3.9.1