[cmake-commits] king committed cmDependsFortranParser.cxx 1.8 1.9 cmDependsFortranParser.y 1.12 1.13

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Oct 3 17:01:51 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv28117

Modified Files:
	cmDependsFortranParser.cxx cmDependsFortranParser.y 
Log Message:
COMP: Do not use non-portable strcasecmp.


Index: cmDependsFortranParser.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortranParser.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cmDependsFortranParser.cxx	3 Oct 2007 19:41:39 -0000	1.8
+++ cmDependsFortranParser.cxx	3 Oct 2007 21:01:49 -0000	1.9
@@ -134,7 +134,7 @@
 
 
 /* Copy the first part of user declarations.  */
-#line 1 "cmDependsFortranParser.y"
+#line 1 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
 
 /*=========================================================================
 
@@ -181,6 +181,7 @@
 #define cmDependsFortranParser_cxx
 #include "cmDependsFortranParser.h" /* Interface to parser object.  */
 #include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL.  */
+#include "cmSystemTools.h"
 
 /* Configure the parser to use a lexer object.  */
 #define YYPARSE_PARAM yyscanner
@@ -199,6 +200,13 @@
   cmDependsFortranParser_Error(parser, message);
 }
 
+static bool cmDependsFortranParserIsKeyword(const char* word,
+                                            const char* keyword)
+{
+  return (strlen(word) == strlen(keyword) &&
+          cmSystemTools::LowerCase(word) == keyword);
+}
+
 /* Disable some warnings in the generated code.  */
 #ifdef __BORLANDC__
 # pragma warn -8004 /* Variable assigned a value that is not used.  */
@@ -232,12 +240,12 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 81 "cmDependsFortranParser.y"
+#line 88 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
 {
   char* string;
 }
 /* Line 187 of yacc.c.  */
-#line 241 "cmDependsFortranParser.cxx"
+#line 248 "/home/kingb/My Programs/CMake-gcc-4.0/Source/cmDependsFortranParser.cxx"
         YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -250,7 +258,7 @@
 
 
 /* Line 216 of yacc.c.  */
-#line 254 "cmDependsFortranParser.cxx"
+#line 261 "/home/kingb/My Programs/CMake-gcc-4.0/Source/cmDependsFortranParser.cxx"
 
 #ifdef short
 # undef short
@@ -550,11 +558,11 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,   100,   100,   100,   102,   102,   104,   107,   116,   144,
-     154,   155,   161,   167,   173,   179,   184,   189,   194,   199,
-     200,   201,   202,   208,   208,   209,   209,   210,   210,   211,
-     211,   212,   212,   213,   213,   214,   214,   215,   215,   216,
-     216,   219,   220,   221,   222,   223
+       0,   107,   107,   107,   109,   109,   111,   114,   123,   152,
+     162,   163,   169,   175,   181,   187,   192,   197,   202,   207,
+     208,   209,   210,   216,   216,   217,   217,   218,   218,   219,
+     219,   220,   220,   221,   221,   222,   222,   223,   223,   224,
+     224,   227,   228,   229,   230,   231
 };
 #endif
 
@@ -1517,9 +1525,9 @@
   switch (yyn)
     {
         case 7:
-#line 108 "cmDependsFortranParser.y"
+#line 115 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
-    if (strcasecmp((yyvsp[(1) - (2)].string), "interface") == 0)
+    if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_SetInInterface(parser, true);
@@ -1529,27 +1537,28 @@
     break;
 
   case 8:
-#line 117 "cmDependsFortranParser.y"
+#line 124 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
-    if (strcasecmp((yyvsp[(1) - (4)].string), "use") == 0)
+    if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_RuleUse(parser, (yyvsp[(2) - (4)].string));
       free((yyvsp[(2) - (4)].string));
       }
-    else if (strcasecmp((yyvsp[(1) - (4)].string), "module") == 0)
+    else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "module"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_RuleModule(parser, (yyvsp[(2) - (4)].string));
       free((yyvsp[(2) - (4)].string));
       }
-    else if (strcasecmp((yyvsp[(1) - (4)].string), "interface") == 0)
+    else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "interface"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_SetInInterface(parser, true);
       free((yyvsp[(2) - (4)].string));
       }
-    else if (strcasecmp((yyvsp[(2) - (4)].string), "interface") == 0 && strcasecmp((yyvsp[(1) - (4)].string), "end") == 0)
+    else if (cmDependsFortranParserIsKeyword((yyvsp[(2) - (4)].string), "interface") &&
+             cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "end"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_SetInInterface(parser, false);
@@ -1560,9 +1569,9 @@
     break;
 
   case 9:
-#line 145 "cmDependsFortranParser.y"
+#line 153 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
-    if (strcasecmp((yyvsp[(1) - (4)].string), "include") == 0)
+    if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string));
@@ -1573,7 +1582,7 @@
     break;
 
   case 11:
-#line 156 "cmDependsFortranParser.y"
+#line 164 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
     cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
     cmDependsFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string));
@@ -1582,7 +1591,7 @@
     break;
 
   case 12:
-#line 162 "cmDependsFortranParser.y"
+#line 170 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
     cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
     cmDependsFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string));
@@ -1591,7 +1600,7 @@
     break;
 
   case 13:
-#line 168 "cmDependsFortranParser.y"
+#line 176 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
     cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
     cmDependsFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string));
@@ -1600,7 +1609,7 @@
     break;
 
   case 14:
-#line 174 "cmDependsFortranParser.y"
+#line 182 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
     cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
     cmDependsFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string));
@@ -1609,7 +1618,7 @@
     break;
 
   case 15:
-#line 180 "cmDependsFortranParser.y"
+#line 188 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
     cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
     cmDependsFortranParser_RuleIf(parser);
@@ -1617,7 +1626,7 @@
     break;
 
   case 16:
-#line 185 "cmDependsFortranParser.y"
+#line 193 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
     cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
     cmDependsFortranParser_RuleElif(parser);
@@ -1625,7 +1634,7 @@
     break;
 
   case 17:
-#line 190 "cmDependsFortranParser.y"
+#line 198 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
     cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
     cmDependsFortranParser_RuleElse(parser);
@@ -1633,7 +1642,7 @@
     break;
 
   case 18:
-#line 195 "cmDependsFortranParser.y"
+#line 203 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     {
     cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
     cmDependsFortranParser_RuleEndif(parser);
@@ -1641,18 +1650,18 @@
     break;
 
   case 41:
-#line 219 "cmDependsFortranParser.y"
+#line 227 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     { free ((yyvsp[(1) - (1)].string)); }
     break;
 
   case 42:
-#line 220 "cmDependsFortranParser.y"
+#line 228 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
     { free ((yyvsp[(1) - (1)].string)); }
     break;
 
 
 /* Line 1267 of yacc.c.  */
-#line 1656 "cmDependsFortranParser.cxx"
+#line 1664 "/home/kingb/My Programs/CMake-gcc-4.0/Source/cmDependsFortranParser.cxx"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1866,7 +1875,7 @@
 }
 
 
-#line 226 "cmDependsFortranParser.y"
+#line 234 "/home/kingb/My Programs/CMake/Source/cmDependsFortranParser.y"
 
 /* End of grammar */
 

Index: cmDependsFortranParser.y
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortranParser.y,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmDependsFortranParser.y	3 Oct 2007 19:41:39 -0000	1.12
+++ cmDependsFortranParser.y	3 Oct 2007 21:01:49 -0000	1.13
@@ -44,6 +44,7 @@
 #define cmDependsFortranParser_cxx
 #include "cmDependsFortranParser.h" /* Interface to parser object.  */
 #include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL.  */
+#include "cmSystemTools.h"
 
 /* Configure the parser to use a lexer object.  */
 #define YYPARSE_PARAM yyscanner
@@ -62,6 +63,13 @@
   cmDependsFortranParser_Error(parser, message);
 }
 
+static bool cmDependsFortranParserIsKeyword(const char* word,
+                                            const char* keyword)
+{
+  return (strlen(word) == strlen(keyword) &&
+          cmSystemTools::LowerCase(word) == keyword);
+}
+
 /* Disable some warnings in the generated code.  */
 #ifdef __BORLANDC__
 # pragma warn -8004 /* Variable assigned a value that is not used.  */
@@ -106,7 +114,7 @@
 keyword_stmt:
   WORD EOSTMT
     {
-    if (strcasecmp($1, "interface") == 0)
+    if (cmDependsFortranParserIsKeyword($1, "interface"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_SetInInterface(parser, true);
@@ -115,25 +123,26 @@
     }
 | WORD WORD other EOSTMT
     {
-    if (strcasecmp($1, "use") == 0)
+    if (cmDependsFortranParserIsKeyword($1, "use"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_RuleUse(parser, $2);
       free($2);
       }
-    else if (strcasecmp($1, "module") == 0)
+    else if (cmDependsFortranParserIsKeyword($1, "module"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_RuleModule(parser, $2);
       free($2);
       }
-    else if (strcasecmp($1, "interface") == 0)
+    else if (cmDependsFortranParserIsKeyword($1, "interface"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_SetInInterface(parser, true);
       free($2);
       }
-    else if (strcasecmp($2, "interface") == 0 && strcasecmp($1, "end") == 0)
+    else if (cmDependsFortranParserIsKeyword($2, "interface") &&
+             cmDependsFortranParserIsKeyword($1, "end"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_SetInInterface(parser, false);
@@ -143,7 +152,7 @@
     }
 | WORD STRING other EOSTMT
     {
-    if (strcasecmp($1, "include") == 0)
+    if (cmDependsFortranParserIsKeyword($1, "include"))
       {
       cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
       cmDependsFortranParser_RuleInclude(parser, $2);



More information about the Cmake-commits mailing list