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_());
}
示例#2
0
void SharedQueue::push_priority(element el) {
  down(space);
  down(mutex);
  push_(el, priority);
  up(mutex);
  up(size);
}
示例#3
0
void SharedQueue::push_medium(element el) {
  down(space);
  down(mutex);
  push_(el, medium);
  up(mutex);
  up(size);
}
示例#4
0
void SharedQueue::push(element el) {
  down(space);
  down(mutex);
  push_(el, standard);
  up(mutex);
  up(size);
}
 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);
 }
示例#6
0
文件: qoq.hpp 项目: scottgw/eveqs
  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();
    }
  }
示例#7
0
文件: Writer.hpp 项目: DOCGroup/XSC
 Writer (XML::Element<C>& e)
     : attr__ (0)
 {
   push_ (e);
 }
示例#8
0
 void Element::
 el_pre (Type const&)
 {
   push_ (::XSCRT::XML::Element< wchar_t > (L"el", top_ ()));
 }
示例#9
0
 void Element::
 long_pre (Type const&)
 {
   push_ (::XSCRT::XML::Element< wchar_t > (L"long", top_ ()));
 }
示例#10
0
 void Element::
 value_pre (Type const&)
 {
   push_ (::XSCRT::XML::Element< wchar_t > (L"value", top_ ()));
 }