[Cmake-commits] [cmake-commits] king committed cmDependsFortranParser.cxx 1.19 1.20 cmDependsFortranParser.y 1.21 1.22 cmDependsFortranParserTokens.h 1.6 1.7

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Jun 12 10:46:29 EDT 2009


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

Modified Files:
	cmDependsFortranParser.cxx cmDependsFortranParser.y 
	cmDependsFortranParserTokens.h 
Log Message:
ENH: Use KWSys String strcasecmp to parse Fortran

This replaces the Fortran dependency parser source's custom strcasecmp
implementation with one from KWSys String.  It removes duplicate code
and avoids a Borland warning about inlining functions with 'while'.


Index: cmDependsFortranParser.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortranParser.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -C 2 -d -r1.19 -r1.20
*** cmDependsFortranParser.cxx	17 Feb 2009 16:53:57 -0000	1.19
--- cmDependsFortranParser.cxx	12 Jun 2009 14:46:23 -0000	1.20
***************
*** 1,13 ****
! /* A Bison parser, made by GNU Bison 2.3.  */
  
  /* Skeleton implementation for Bison's Yacc-like parsers in C
  
!    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
     Free Software Foundation, Inc.
  
!    This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
!    the Free Software Foundation; either version 2, or (at your option)
[...1153 lines suppressed...]
  yyreturn:
!   if (yychar != YYEMPTY)
       yydestruct ("Cleanup: discarding lookahead",
                   yytoken, &yylval);
***************
*** 2033,2038 ****
  
  
- #line 330 "cmDependsFortranParser.y"
  
! /* End of grammar */
  
--- 2029,2035 ----
  
  
  
! /* Line 1675 of yacc.c  */
! #line 283 "cmDependsFortranParser.y"
  
+ /* End of grammar */

Index: cmDependsFortranParserTokens.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortranParserTokens.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmDependsFortranParserTokens.h	24 Apr 2008 03:53:20 -0000	1.6
--- cmDependsFortranParserTokens.h	12 Jun 2009 14:46:25 -0000	1.7
***************
*** 1,13 ****
! /* A Bison parser, made by GNU Bison 2.3.  */
  
  /* Skeleton interface for Bison's Yacc-like parsers in C
  
!    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
     Free Software Foundation, Inc.
  
!    This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
!    the Free Software Foundation; either version 2, or (at your option)
!    any later version.
  
     This program is distributed in the hope that it will be useful,
--- 1,13 ----
! /* A Bison parser, made by GNU Bison 2.4.1.  */
  
  /* Skeleton interface for Bison's Yacc-like parsers in C
  
!       Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
     Free Software Foundation, Inc.
  
!    This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
!    the Free Software Foundation, either version 3 of the License, or
!    (at your option) any later version.
  
     This program is distributed in the hope that it will be useful,
***************
*** 17,23 ****
  
     You should have received a copy of the GNU General Public License
!    along with this program; if not, write to the Free Software
!    Foundation, Inc., 51 Franklin Street, Fifth Floor,
!    Boston, MA 02110-1301, USA.  */
  
  /* As a special exception, you may create a larger work that contains
--- 17,21 ----
  
     You should have received a copy of the GNU General Public License
!    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
  
  /* As a special exception, you may create a larger work that contains
***************
*** 105,117 ****
  #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  typedef union YYSTYPE
- #line 141 "cmDependsFortranParser.y"
  {
    char* string;
! }
! /* Line 1489 of yacc.c.  */
! #line 113 "cmDependsFortranParserTokens.h"
!         YYSTYPE;
  # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  # define YYSTYPE_IS_DECLARED 1
- # define YYSTYPE_IS_TRIVIAL 1
  #endif
--- 103,118 ----
  #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  typedef union YYSTYPE
  {
+ 
+ /* Line 1676 of yacc.c  */
+ #line 94 "cmDependsFortranParser.y"
+ 
    char* string;
! 
! /* Line 1676 of yacc.c  */
! #line 118 "cmDependsFortranParserTokens.h"
! } YYSTYPE;
! # define YYSTYPE_IS_TRIVIAL 1
  # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  # define YYSTYPE_IS_DECLARED 1
  #endif

Index: cmDependsFortranParser.y
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortranParser.y,v
retrieving revision 1.21
retrieving revision 1.22
diff -C 2 -d -r1.21 -r1.22
*** cmDependsFortranParser.y	17 Feb 2009 16:53:57 -0000	1.21
--- cmDependsFortranParser.y	12 Jun 2009 14:46:25 -0000	1.22
***************
*** 47,50 ****
--- 47,52 ----
  #include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL.  */
  
+ #include <cmsys/String.h>
+ 
  /* Configure the parser to use a lexer object.  */
  #define YYPARSE_PARAM yyscanner
***************
*** 64,120 ****
  }
  
- static char charmap[] = {
-     '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
-     '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
-     '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
-     '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
-     '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
-     '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
-     '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
-     '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
-     '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
-     '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
-     '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
-     '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
-     '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
-     '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
-     '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
-     '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
-     '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
-     '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
-     '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
-     '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
-     '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
-     '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
-     '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
-     '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
-     '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
-     '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
-     '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
-     '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
-     '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
-     '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
-     '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
-     '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
- };
- 
- inline int strcasecmpCM(const char *s1, const char *s2) 
- {
-   const char *cm = charmap;
-   unsigned char const* us1 = reinterpret_cast<unsigned char const*>(s1);
-   unsigned char const* us2 = reinterpret_cast<unsigned char const*>(s2);
-   
-   while(cm[*us1] == cm[*us2++])
-     if(*us1++ == '\0') 
-       {
-       return(0);
-       }
-   return(cm[*us1] - cm[*--us2]);
- }
- 
  static bool cmDependsFortranParserIsKeyword(const char* word,
                                              const char* keyword)
  {
!   return strcasecmpCM(word, keyword) == 0;
  }
  
--- 66,73 ----
  }
  
  static bool cmDependsFortranParserIsKeyword(const char* word,
                                              const char* keyword)
  {
!   return cmsysString_strcasecmp(word, keyword) == 0;
  }
  



More information about the Cmake-commits mailing list