[beast/temp-rc1] SFI: move isCxxTypeName() and symbolToList() to sfidl-utils.cc
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/temp-rc1] SFI: move isCxxTypeName() and symbolToList() to sfidl-utils.cc
- Date: Wed, 22 Oct 2014 05:47:13 +0000 (UTC)
commit 85901be9fbfac81c4e1ad12e8e3107ef28dc348d
Author: Tim Janik <timj gnu org>
Date: Fri Oct 17 05:40:12 2014 +0200
SFI: move isCxxTypeName() and symbolToList() to sfidl-utils.cc
sfi/sfidl-cxxbase.cc | 5 ---
sfi/sfidl-namespace.cc | 25 ------------------
sfi/sfidl-parser.cc | 56 ------------------------------------------
sfi/sfidl-utils.cc | 64 ++++++++++++++++++++++++++++++++++++++++++++++++
sfi/sfidl-utils.hh | 3 ++
5 files changed, 67 insertions(+), 86 deletions(-)
---
diff --git a/sfi/sfidl-cxxbase.cc b/sfi/sfidl-cxxbase.cc
index 829dcbb..ae139cf 100644
--- a/sfi/sfidl-cxxbase.cc
+++ b/sfi/sfidl-cxxbase.cc
@@ -72,11 +72,6 @@ UC_NAME (const String &cstr) // FIXME: need mammut renaming function
}
return r;
}
-static const char*
-cUC_NAME (const String &cstr) // FIXME: need mammut renaming function
-{
- return g_intern_string (cstr.c_str());
-}
static String // FIXME: need mammut renaming function
UC_TYPE_NAME (const String &tname)
diff --git a/sfi/sfidl-namespace.cc b/sfi/sfidl-namespace.cc
index e9666ab..285a84f 100644
--- a/sfi/sfidl-namespace.cc
+++ b/sfi/sfidl-namespace.cc
@@ -10,31 +10,6 @@ using namespace Sfidl;
/* generic utilities */
-static list<String> symbolToList (String symbol)
-{
- list<String> result;
- String current;
-
- String::iterator si;
- for(si = symbol.begin(); si != symbol.end(); si++)
- {
- if(*si != ':')
- {
- current += *si;
- }
- else
- {
- if(current != "")
- result.push_back(current);
-
- current = "";
- }
- }
-
- result.push_back(current);
- return result;
-}
-
static String listToSymbol(list<String>& symlist)
{
String s;
diff --git a/sfi/sfidl-parser.cc b/sfi/sfidl-parser.cc
index 89e2298..1cc4551 100644
--- a/sfi/sfidl-parser.cc
+++ b/sfi/sfidl-parser.cc
@@ -1350,35 +1350,6 @@ scanner_get_next_token_with_colon_identifiers (GScanner *scanner)
scanner->config->cset_identifier_nth = cset_identifier_nth_orig;
return token;
}
-/* returns true for C++ style identifiers (Foo::BAR) - only the colons are checked, not individual chars */
-static bool
-isCxxTypeName (const String& str)
-{
- enum { valid, colon1, colon2, invalid } state = valid;
- for (String::const_iterator i = str.begin(); i != str.end(); i++)
- {
- if (state == valid)
- {
- if (*i == ':')
- state = colon1;
- }
- else if (state == colon1)
- {
- if (*i == ':')
- state = colon2;
- else
- state = invalid;
- }
- else if (state == colon2)
- {
- if (*i == ':')
- state = invalid;
- else
- state = valid;
- }
- }
- return (state == valid) && (str.size() != 0);
-}
static bool
makeLiteralOptions (const String& options, String& literal_options)
@@ -2018,33 +1989,6 @@ String Parser::defineSymbol (const String& name)
return sym->fullName();
}
-static list<String>
-symbolToList (const String& symbol)
-{
- list<String> result;
- String current;
-
- g_return_val_if_fail (isCxxTypeName (symbol), result);
-
- for (String::const_iterator si = symbol.begin(); si != symbol.end(); si++)
- {
- if (*si != ':')
- {
- current += *si;
- }
- else
- {
- if (current != "")
- result.push_back(current);
-
- current = "";
- }
- }
-
- result.push_back(current);
- return result;
-}
-
static Symbol*
matchSymbol (const list<String>& nlist, Namespace *ns)
{
diff --git a/sfi/sfidl-utils.cc b/sfi/sfidl-utils.cc
index 84db1ed..b50bed1 100644
--- a/sfi/sfidl-utils.cc
+++ b/sfi/sfidl-utils.cc
@@ -1 +1,65 @@
+#include "sfidl-utils.hh"
+
+namespace Sfidl {
+
+/** returns true for C++ style identifiers (Foo::BAR) - only the colons are checked, not individual chars
+ */
+bool
+isCxxTypeName (const String& str)
+{
+ enum { valid, colon1, colon2, invalid } state = valid;
+ for (String::const_iterator i = str.begin(); i != str.end(); i++)
+ {
+ if (state == valid)
+ {
+ if (*i == ':')
+ state = colon1;
+ }
+ else if (state == colon1)
+ {
+ if (*i == ':')
+ state = colon2;
+ else
+ state = invalid;
+ }
+ else if (state == colon2)
+ {
+ if (*i == ':')
+ state = invalid;
+ else
+ state = valid;
+ }
+ }
+ return (state == valid) && (str.size() != 0);
+}
+
+list<String>
+symbolToList (const String& symbol)
+{
+ list<String> result;
+ String current;
+
+ g_return_val_if_fail (isCxxTypeName (symbol), result);
+
+ for (String::const_iterator si = symbol.begin(); si != symbol.end(); si++)
+ {
+ if (*si != ':')
+ {
+ current += *si;
+ }
+ else
+ {
+ if (current != "")
+ result.push_back(current);
+
+ current = "";
+ }
+ }
+
+ result.push_back(current);
+ return result;
+}
+
+} // Sfidl
+
#include "glib-extra.cc" // needed by sfidl
diff --git a/sfi/sfidl-utils.hh b/sfi/sfidl-utils.hh
index 1624d65..588f165 100644
--- a/sfi/sfidl-utils.hh
+++ b/sfi/sfidl-utils.hh
@@ -16,6 +16,9 @@ using namespace Rapicorn;
using std::list;
using std::vector;
+bool isCxxTypeName (const String& str);
+list<String> symbolToList (const String& symbol);
+
} // Sfidl
#endif /* _SFIDL_UTILS_HH_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]