Blender V2.61 - r43446

lsame.c

Go to the documentation of this file.
00001 
00004 int lsame_(char *, char *);
00005 
00006 
00007 int lsame_(char *ca, char *cb)
00008 {
00009 /*  -- LAPACK auxiliary routine (version 2.0) --   
00010        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,   
00011        Courant Institute, Argonne National Lab, and Rice University   
00012        September 30, 1994   
00013 
00014     Purpose   
00015     =======   
00016 
00017     LSAME returns .TRUE. if CA is the same letter as CB regardless of case.   
00018 
00019     Arguments   
00020     =========   
00021 
00022     CA      (input) CHARACTER*1   
00023     CB      (input) CHARACTER*1   
00024             CA and CB specify the single characters to be compared.   
00025 
00026    ===================================================================== 
00027 */  
00028 
00029     /* System generated locals */
00030     int ret_val;
00031     
00032     /* Local variables */
00033     int inta, intb, zcode;
00034 
00035     ret_val = *(unsigned char *)ca == *(unsigned char *)cb;
00036     if (ret_val) {
00037     return ret_val;
00038     }
00039 
00040     /* Now test for equivalence if both characters are alphabetic. */
00041 
00042     zcode = 'Z';
00043 
00044     /* Use 'Z' rather than 'A' so that ASCII can be detected on Prime   
00045        machines, on which ICHAR returns a value with bit 8 set.   
00046        ICHAR('A') on Prime machines returns 193 which is the same as   
00047        ICHAR('A') on an EBCDIC machine. */
00048 
00049     inta = *(unsigned char *)ca;
00050     intb = *(unsigned char *)cb;
00051 
00052     if (zcode == 90 || zcode == 122) {
00053     /* ASCII is assumed - ZCODE is the ASCII code of either lower or   
00054           upper case 'Z'. */
00055     if (inta >= 97 && inta <= 122) inta += -32;
00056     if (intb >= 97 && intb <= 122) intb += -32;
00057 
00058     } else if (zcode == 233 || zcode == 169) {
00059     /* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or   
00060           upper case 'Z'. */
00061     if ((inta >= 129 && inta <= 137) || (inta >= 145 && inta <= 153) || (inta 
00062         >= 162 && inta <= 169))
00063         inta += 64;
00064     if ((intb >= 129 && intb <= 137) || (intb >= 145 && intb <= 153) || (intb 
00065         >= 162 && intb <= 169))
00066         intb += 64;
00067     } else if (zcode == 218 || zcode == 250) {
00068     /* ASCII is assumed, on Prime machines - ZCODE is the ASCII code   
00069           plus 128 of either lower or upper case 'Z'. */
00070     if (inta >= 225 && inta <= 250) inta += -32;
00071     if (intb >= 225 && intb <= 250) intb += -32;
00072     }
00073     ret_val = inta == intb;
00074     return ret_val;
00075     
00076 } /* lsame_ */