forked from boostorg/regex
commit of split-config, including any changes required to existing libraries (mainly regex).
[SVN r11138]
This commit is contained in:
@ -26,7 +26,7 @@
|
||||
#define BOOST_REGEX_STACK_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/detail/regex_config.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_RAW_BUFFER_HPP
|
||||
#include <boost/regex/detail/regex_raw_buffer.hpp>
|
||||
@ -44,12 +44,12 @@ namespace boost{
|
||||
// simplified stack optimised for push/peek/pop
|
||||
// operations, we could use std::stack<std::vector<T>> instead...
|
||||
//
|
||||
template <class T, class Allocator BOOST_RE_DEF_ALLOC_PARAM(T) >
|
||||
template <class T, class Allocator = BOOST_DEFAULT_ALLOCATOR(T) >
|
||||
class jstack
|
||||
{
|
||||
private:
|
||||
typedef typename boost::re_detail::rebind_allocator<unsigned char, Allocator>::type allocator_type;
|
||||
typedef typename boost::re_detail::rebind_allocator<T, Allocator>::type T_alloc_type;
|
||||
typedef typename boost::detail::rebind_allocator<unsigned char, Allocator>::type allocator_type;
|
||||
typedef typename boost::detail::rebind_allocator<T, Allocator>::type T_alloc_type;
|
||||
typedef typename T_alloc_type::size_type size_type;
|
||||
typedef T value_type;
|
||||
struct node
|
||||
@ -74,15 +74,15 @@ private:
|
||||
node base;
|
||||
size_type block_size;
|
||||
|
||||
void BOOST_RE_CALL pop_aux()const;
|
||||
void BOOST_RE_CALL push_aux();
|
||||
void BOOST_REGEX_CALL pop_aux()const;
|
||||
void BOOST_REGEX_CALL push_aux();
|
||||
|
||||
public:
|
||||
jstack(size_type n = 64, const Allocator& a = Allocator());
|
||||
|
||||
~jstack();
|
||||
|
||||
node* BOOST_RE_CALL get_node()
|
||||
node* BOOST_REGEX_CALL get_node()
|
||||
{
|
||||
node* new_stack = (node*)alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size);
|
||||
new_stack->last = (T*)(new_stack+1);
|
||||
@ -91,53 +91,53 @@ public:
|
||||
return new_stack;
|
||||
}
|
||||
|
||||
bool BOOST_RE_CALL empty()
|
||||
bool BOOST_REGEX_CALL empty()
|
||||
{
|
||||
return (m_stack->start == m_stack->end) && (m_stack->next == 0);
|
||||
}
|
||||
|
||||
bool BOOST_RE_CALL good()
|
||||
bool BOOST_REGEX_CALL good()
|
||||
{
|
||||
return (m_stack->start != m_stack->end) || (m_stack->next != 0);
|
||||
}
|
||||
|
||||
T& BOOST_RE_CALL peek()
|
||||
T& BOOST_REGEX_CALL peek()
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
return *m_stack->end;
|
||||
}
|
||||
|
||||
const T& BOOST_RE_CALL peek()const
|
||||
const T& BOOST_REGEX_CALL peek()const
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
return *m_stack->end;
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL pop()
|
||||
void BOOST_REGEX_CALL pop()
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
jm_destroy(m_stack->end);
|
||||
::boost::re_detail::destroy(m_stack->end);
|
||||
++(m_stack->end);
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL pop(T& t)
|
||||
void BOOST_REGEX_CALL pop(T& t)
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
t = *m_stack->end;
|
||||
jm_destroy(m_stack->end);
|
||||
::boost::re_detail::destroy(m_stack->end);
|
||||
++(m_stack->end);
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL push(const T& t)
|
||||
void BOOST_REGEX_CALL push(const T& t)
|
||||
{
|
||||
if(m_stack->end == m_stack->last)
|
||||
push_aux();
|
||||
--(m_stack->end);
|
||||
jm_construct(m_stack->end, t);
|
||||
construct(m_stack->end, t);
|
||||
}
|
||||
|
||||
};
|
||||
@ -155,7 +155,7 @@ jstack<T, Allocator>::jstack(size_type n, const Allocator& a)
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
void BOOST_RE_CALL jstack<T, Allocator>::push_aux()
|
||||
void BOOST_REGEX_CALL jstack<T, Allocator>::push_aux()
|
||||
{
|
||||
// make sure we have spare space on TOS:
|
||||
register node* new_node;
|
||||
@ -175,7 +175,7 @@ void BOOST_RE_CALL jstack<T, Allocator>::push_aux()
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
void BOOST_RE_CALL jstack<T, Allocator>::pop_aux()const
|
||||
void BOOST_REGEX_CALL jstack<T, Allocator>::pop_aux()const
|
||||
{
|
||||
// make sure that we have a valid item
|
||||
// on TOS:
|
||||
|
Reference in New Issue
Block a user