#
#
# add_file "char_classifiers.hh"
# content [7dece6ad2d6a9520ababb31f6a9f84b7edb60444]
#
# patch "basic_io.cc"
# from [c229de5420267b08ab3a751c60f7aa4bcb099cef]
# to [1298ed3b8676cf98d80d5201390560a7827c6115]
#
# patch "basic_io.hh"
# from [9ad16beabaf2b1c272a356e8cf41bba97f7e1562]
# to [e9c7130d61117009c3aeb05f0e4162c8fc675498]
#
# patch "lua.cc"
# from [94164f93ac24a267514cf86d0e9f9eeb0fb17dd6]
# to [da69af522e71b86698116fa1fa7cfcc04d0ed5f0]
#
# patch "packet.cc"
# from [64ffd5b38c960abe0577ed2ea0d2941804680cb5]
# to [3d2a63f498f5168f17754e12c38fa4f6f96d4274]
#
# patch "rcs_file.cc"
# from [ff879adf81e7dd34604af8338e376b0692d1dcb6]
# to [ed67c5671b3697e609331ad14f952cfffde85d1f]
#
# patch "rcs_import.cc"
# from [1f4de49046aeb6d1f1b08c7677b68a6b440d45f1]
# to [66725aa80111868362a50d34c88baa603e441d57]
#
# patch "revision.cc"
# from [8f850eef37d3e69f8abaa75bb9b07623576738ac]
# to [858fc8cc77773c3c6a81e8373d0d5f1218517149]
#
# patch "transforms.cc"
# from [16f38ee4a45f73737a16534bb82f46863b3730cb]
# to [081cded2a5cf3c7dedb9460a14aaac21e70754aa]
#
# patch "vocab.cc"
# from [adc1c12688fdc842175abf939de38f92b3654df7]
# to [016043a836b8789b07f912e3431f3401234d61e0]
#
# patch "vocab.hh"
# from [555a09708e44a231cca9f0d8e808e88e45e05bf1]
# to [c6a7cc514b64b15428fb5548a4deda1fc1a212b7]
#
============================================================
--- char_classifiers.hh 7dece6ad2d6a9520ababb31f6a9f84b7edb60444
+++ char_classifiers.hh 7dece6ad2d6a9520ababb31f6a9f84b7edb60444
@@ -0,0 +1,82 @@
+#ifndef __CHAR_CLASSIFIERS_HH__
+#define __CHAR_CLASSIFIERS_HH__
+
+// Copyright (C) 2004 Graydon Hoare
+//
+// This program is made available under the GNU GPL version 2.0 or
+// greater. See the accompanying file COPYING for details.
+//
+// This program is distributed WITHOUT ANY WARRANTY; without even the
+// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE.
+
+// We don't use the standard C macros because their results
+// may depend on the global locale, and we don't use the standard C++
+// ctype facet (in classic() mode, of course) because, well,
+// someone should try it and verify that it's not slower.
+
+// Yes, we are aware that these will break horribly with EBCDIC.
+
+inline bool is_digit(char x)
+{
+ return (x >= '0' && x <= '9');
+}
+
+inline bool is_xdigit(char x)
+{
+ return ((x >= '0' && x <= '9')
+ || (x >= 'a' && x <= 'f'));
+}
+
+inline bool is_alpha(char x)
+{
+ return ((x >= 'a' && x <= 'z')
+ || (x >= 'A' && x <= 'Z'));
+}
+
+inline bool is_alnum(char x)
+{
+ return ((x >= '0' && x <= '9')
+ || (x >= 'a' && x <= 'z')
+ || (x >= 'A' && x <= 'Z'));
+}
+
+inline bool is_space(char x)
+{
+ return (x == ' ')
+ || (x == '\n')
+ || (x == '\t')
+ || (x == '\r')
+ || (x == '\v')
+ || (x == '\f');
+}
+
+inline bool is_upper(char x)
+{
+ return (x >= 'A' && x <= 'Z');
+}
+
+inline bool is_lower(char x)
+{
+ return (x >= 'a' && x <= 'z');
+}
+
+inline char to_upper(char x)
+{
+ return is_lower(x) ? (x - 'a' + 'A') : x;
+}
+
+inline char to_lower(char x)
+{
+ return is_upper(x) ? (x - 'A' + 'a') : x;
+}
+
+// Local Variables:
+// mode: C++
+// fill-column: 76
+// c-file-style: "gnu"
+// indent-tabs-mode: nil
+// End:
+// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
+
+#endif // __CHAR_CLASSIFIERS_HH__
============================================================
--- basic_io.cc c229de5420267b08ab3a751c60f7aa4bcb099cef
+++ basic_io.cc 1298ed3b8676cf98d80d5201390560a7827c6115
@@ -8,10 +8,6 @@
// PURPOSE.
#include "base.hh"
-#include
-#include
-#include
-
#include "basic_io.hh"
#include "sanity.hh"
#include "vocab.hh"
============================================================
--- basic_io.hh 9ad16beabaf2b1c272a356e8cf41bba97f7e1562
+++ basic_io.hh e9c7130d61117009c3aeb05f0e4162c8fc675498
@@ -18,6 +18,7 @@
#include "sanity.hh"
#include "vocab.hh"
#include "numeric_vocab.hh"
+#include "char_classifiers.hh"
// This file provides parsing and printing primitives used by the
// higher level parser and printer routines for the datatypes cset,
============================================================
--- lua.cc 94164f93ac24a267514cf86d0e9f9eeb0fb17dd6
+++ lua.cc da69af522e71b86698116fa1fa7cfcc04d0ed5f0
@@ -11,19 +11,14 @@
#include
#include "vector.hh"
#include
-#include // strerror, strlen
+#include // strlen
+#include // std::sort
using std::pair;
using std::set;
-#ifdef WIN32
-// with visual studio you need to include algorithm.
-// Not sure if this applies to other platforms so ifdef it for now.
-#include
-#endif
using std::sort;
using std::string;
using std::vector;
-using std::strerror;
using std::malloc;
using std::free;
============================================================
--- packet.cc 64ffd5b38c960abe0577ed2ea0d2941804680cb5
+++ packet.cc 3d2a63f498f5168f17754e12c38fa4f6f96d4274
@@ -19,6 +19,7 @@
#include "simplestring_xform.hh"
#include "cert.hh"
#include "key_store.hh" // for keypair
+#include "char_classifiers.hh"
using std::istream;
using std::istringstream;
============================================================
--- rcs_file.cc ff879adf81e7dd34604af8338e376b0692d1dcb6
+++ rcs_file.cc ed67c5671b3697e609331ad14f952cfffde85d1f
@@ -33,6 +33,7 @@
#include "rcs_file.hh"
#include "sanity.hh"
+#include "char_classifiers.hh"
using std::ifstream;
using std::ios_base;
@@ -235,7 +236,7 @@ get_token(file_source & ist,
if (i == EOF)
return TOK_NONE;
adv(i, line, col);
- if (!isspace(i))
+ if (!is_space(i))
break;
ist.get(c);
i = ist.peek();
@@ -280,11 +281,11 @@ get_token(file_source & ist,
while (ist.good()
&& i != ';'
&& i != ':'
- && !isspace(i))
+ && !is_space(i))
{
ist.get(c);
++col;
- if (! isdigit(c) && c != '.')
+ if (! is_digit(c) && c != '.')
saw_idchar = true;
str += c;
i = ist.peek();
============================================================
--- rcs_import.cc 1f4de49046aeb6d1f1b08c7677b68a6b440d45f1
+++ rcs_import.cc 66725aa80111868362a50d34c88baa603e441d57
@@ -17,9 +17,8 @@
#include
#include
#include "vector.hh"
+#include // memset
-#include
-
#include
#include
#include "lexical_cast.hh"
============================================================
--- revision.cc 8f850eef37d3e69f8abaa75bb9b07623576738ac
+++ revision.cc 858fc8cc77773c3c6a81e8373d0d5f1218517149
@@ -8,8 +8,6 @@
// PURPOSE.
#include "base.hh"
-#include
-#include
#include