OSDN Git Service

fix build of qlalr
authorIvailo Monev <xakepa10@laimg.moc>
Mon, 24 Oct 2016 17:27:14 +0000 (17:27 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Mon, 24 Oct 2016 17:27:14 +0000 (17:27 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
util/qlalr/examples/glsl/glsl.g
util/qlalr/lalr.cpp
util/qlalr/lalr.g
util/qlalr/recognizer.cpp

index ae5bd3e..3d2c0fa 100644 (file)
@@ -229,8 +229,8 @@ GLSLParser::GLSLParser():
 GLSLParser::~GLSLParser()
 {
     if (stack_size) {
-        qFree(sym_stack);
-        qFree(state_stack);
+        ::free(sym_stack);
+        ::free(state_stack);
     }
 }
 
index e7331c3..7073651 100644 (file)
@@ -44,6 +44,7 @@
 #include <limits.h>
 
 #include <algorithm>
+#include <functional>
 
 #define QLALR_NO_DEBUG_NULLABLES
 #define QLALR_NO_DEBUG_LOOKBACKS
@@ -246,11 +247,11 @@ void Grammar::buildExtendedGrammar ()
   non_terminals.insert (accept_symbol);
 }
 
-struct _Nullable: public std::unary_function<Name, bool>
+struct Nullable: public std::unary_function<Name, bool>
 {
   Automaton *_M_automaton;
 
-  _Nullable (Automaton *aut):
+  Nullable (Automaton *aut):
     _M_automaton (aut) {}
 
   bool operator () (Name name) const
@@ -308,7 +309,7 @@ void Automaton::buildNullables ()
 
       for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule)
         {
-          NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (_Nullable (this)));
+          NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (Nullable (this)));
 
           if (nn == rule->rhs.end ())
             changed |= nullables.insert (rule->lhs).second;
@@ -644,7 +645,7 @@ void Automaton::buildIncludesDigraph ()
                   if (! _M_grammar->isNonTerminal (*A))
                     continue;
 
-                  NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (_Nullable (this)));
+                  NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (Nullable (this)));
                   if (first_not_nullable != rule->rhs.end ())
                     continue;
 
index bda7c99..9aa2f6e 100644 (file)
@@ -249,7 +249,7 @@ Recognizer::Recognizer (Grammar *grammar, bool no_lines):
 Recognizer::~Recognizer()
 {
   if (stack_size)
-    ::qFree(state_stack);
+    ::free(state_stack);
 }
 
 inline void Recognizer::reallocateStack()
@@ -262,9 +262,9 @@ inline void Recognizer::reallocateStack()
   sym_stack.resize (stack_size);
 
   if (! state_stack)
-    state_stack = reinterpret_cast<int*> (::qMalloc(stack_size * sizeof(int)));
+    state_stack = reinterpret_cast<int*> (::malloc(stack_size * sizeof(int)));
   else
-    state_stack = reinterpret_cast<int*> (::qRealloc(state_stack, stack_size * sizeof(int)));
+    state_stack = reinterpret_cast<int*> (::realloc(state_stack, stack_size * sizeof(int)));
 }
 
 int Recognizer::nextToken()
index e238dd5..d9db721 100644 (file)
@@ -58,7 +58,7 @@ Recognizer::Recognizer (Grammar *grammar, bool no_lines):
 Recognizer::~Recognizer()
 {
   if (stack_size)
-    ::qFree(state_stack);
+    ::free(state_stack);
 }
 
 inline void Recognizer::reallocateStack()
@@ -71,9 +71,9 @@ inline void Recognizer::reallocateStack()
   sym_stack.resize (stack_size);
 
   if (! state_stack)
-    state_stack = reinterpret_cast<int*> (::qMalloc(stack_size * sizeof(int)));
+    state_stack = reinterpret_cast<int*> (::malloc(stack_size * sizeof(int)));
   else
-    state_stack = reinterpret_cast<int*> (::qRealloc(state_stack, stack_size * sizeof(int)));
+    state_stack = reinterpret_cast<int*> (::realloc(state_stack, stack_size * sizeof(int)));
 }
 
 int Recognizer::nextToken()