Ejemplo n.º 1
0
void op(int argc, char **argv)
{
    double n2;
    char c;
    int i;
    sp=0;
    for (i = 0; i < argc; i++) {
        if ((c=argv[i][0])<'0'||c>'9')
            switch(c) {
            case '+':
                push_(pop_()+pop_());
                break;
            case '*':
                push_(pop_()*pop_());
                break;
            case '/':
                n2 = pop_();
                push_(pop_()/n2);
                break;
            case '-':
                n2 = pop_();
                push_(pop_()-n2);
                break;
            }
        else
            push_(atov(argv[i]));
    }
    printf("%f\n",pop_());
}
Ejemplo n.º 2
0
void SharedQueue::push_priority(element el) {
  down(space);
  down(mutex);
  push_(el, priority);
  up(mutex);
  up(size);
}
Ejemplo n.º 3
0
void SharedQueue::push_medium(element el) {
  down(space);
  down(mutex);
  push_(el, medium);
  up(mutex);
  up(size);
}
Ejemplo n.º 4
0
void SharedQueue::push(element el) {
  down(space);
  down(mutex);
  push_(el, standard);
  up(mutex);
  up(size);
}
Ejemplo n.º 5
0
 channel_op_status push( value_type const& va) {
     typename allocator_traits_t::pointer ptr{
         allocator_traits_t::allocate( alloc_, 1) };
     try {
         allocator_traits_t::construct( alloc_, ptr, va, alloc_);
     } catch (...) {
         allocator_traits_t::deallocate( alloc_, ptr, 1);
         throw;
     }
     std::unique_lock< mutex > lk( mtx_);
     return push_( { detail::convert( ptr) }, lk);
 }
Ejemplo n.º 6
0
  void
  push(V v)
  {
    mpscq_node <V> * node = new mpscq_node<V>();
    node->state = v;

    push_(node);

    {
      std::unique_lock<std::mutex> lock (mutex);
      cv.notify_all();
    }
  }
Ejemplo n.º 7
0
 Writer (XML::Element<C>& e)
     : attr__ (0)
 {
   push_ (e);
 }
Ejemplo n.º 8
0
 void Element::
 el_pre (Type const&)
 {
   push_ (::XSCRT::XML::Element< wchar_t > (L"el", top_ ()));
 }
Ejemplo n.º 9
0
 void Element::
 long_pre (Type const&)
 {
   push_ (::XSCRT::XML::Element< wchar_t > (L"long", top_ ()));
 }
Ejemplo n.º 10
0
 void Element::
 value_pre (Type const&)
 {
   push_ (::XSCRT::XML::Element< wchar_t > (L"value", top_ ()));
 }