Exemplo n.º 1
0
AbstractString * ZeroRankArray::write_to_string()
{
  Thread * thread = current_thread();
  bool print_readably = (thread->symbol_value(S_print_readably) != NIL);
  if (print_readably)
    {
      if (_element_type != T)
        signal_lisp_error(new PrintNotReadable(make_value(this)));
    }
  if (print_readably || thread->symbol_value(S_print_array) != NIL)
    {
      String * s = new String("#0A");
      if (aref(0) == make_value(this) && thread->symbol_value(S_print_circle) != NIL)
        {
          StringOutputStream * stream = new StringOutputStream(S_character);
          thread->execute(the_symbol(S_output_object)->function(), aref(0), make_value(stream));
          s->append(stream->get_string());
        }
      else
        s->append(::write_to_string(aref(0)));
      return s;
    }
  else
    return unreadable_string();
}
Exemplo n.º 2
0
Value Vector_UB32::nreverse()
{
  INDEX len = length();
  if (len > 0)
    {
      INDEX i = 0;
      INDEX j = len - 1;
      if (_data)
        {
          while (i < j)
            {
              unsigned int temp = _data[i];
              _data[i] = _data[j];
              _data[j] = temp;
              ++i;
              --j;
            }
        }
      else
        {
          // displaced
          while (i < j)
            {
              Value temp = aref(i);;
              aset(i, aref(j));
              aset(j, temp);
              ++i;
              --j;
            }
        }
    }
  return make_value(this);
}
Exemplo n.º 3
0
static obj_t random_subtree(obj_t tree, unsigned levels) {
  while(tree != objNULL && levels > 0) {
    tree = aref(tree, rnd() % width);
    --levels;
  }
  return tree;
}
Exemplo n.º 4
0
///----------------------------------------------------------------------------
void coroutine_stackful_actor::run(yield_t yld)
{
  yld_ = &yld;

  try
  {
    stat_ = on;
    actor<stackful> aref(*this);
    f_(aref);
    stop(exit_normal, "exit normal");
  }
  catch (boost::coroutines::detail::forced_unwind const&)
  {
    stop(exit_except, "exit normal");
    throw;
  }
  catch (std::exception& ex)
  {
    stop(exit_except, ex.what());
  }
  catch (...)
  {
    stop(exit_except, "unexpected exception");
  }
}
Exemplo n.º 5
0
void irq7_handler(interrupt_error_code n __attribute__((unused)))
{
     eoi(IRQ_MASTER);
     irq_handler current_irq_handler;
     aref(irq_handler_table,7,current_irq_handler);
     (*current_irq_handler)();
}
Exemplo n.º 6
0
//
// Return object identifier of attribute.
//
pwr_sAttrRef wb_attribute::aref() const
{
  check();

  pwr_sAttrRef ar;
  aref( &ar);

  return ar;
}
Exemplo n.º 7
0
void GDSin::Gds2Ted::convert(GDSin::GdsStructure* src, laydata::tdtcell* dst)
{
   //@FIXME!!! ged rid of this silly loop! GDS database is layer oriented now!
   for(int2b laynum = 1 ; laynum < GDS_MAX_LAYER ; laynum++)
   {
      if (src->allLay(laynum))
      {// layers
         GDSin::GdsData *wd = src->fDataAt(laynum);
         while( wd )
         {
            word tdtlaynum;
            if (_theLayMap.getTdtLay(tdtlaynum, laynum, wd->singleType()) )
            {
               // convert only if layer/data type pair is defined
               laydata::tdtlayer* dwl = static_cast<laydata::tdtlayer*>(dst->securelayer(tdtlaynum));
               switch( wd->gdsDataType() )
               {
                  case      gds_BOX: box (static_cast<GDSin::GdsBox*>(wd)     , dwl, laynum);  break;
                  case gds_BOUNDARY: poly(static_cast<GDSin::GdsPolygon*>(wd) , dwl, laynum);  break;
                  case     gds_PATH: wire(static_cast<GDSin::GDSpath*>(wd)    , dwl, laynum);  break;
                  case     gds_TEXT: text(static_cast<GDSin::GdsText*>(wd)    , dwl);  break;
                  default: assert(false); /*Error - unexpected type*/
               }
            }
            //else
            //{
            //   // The message below could be noughty - so put it in place ONLY if the data type
            //   // is different from default
            //   std::ostringstream ost;
            //   ost << "Layer: " << laynum << "; data type: " << wd->singleType() <<
            //         "; found in GDS database, but not in the conversion map.";
            //   tell_log(console::MT_INFO,ost.str());
            //}
            wd = wd->last();
         }
      }
   }
   if (src->allLay(0))
   {// references
      GDSin::GdsData *wd = src->fDataAt(0);
      while( wd )
      {
         switch( wd->gdsDataType() )
         {
            case gds_SREF: ref (static_cast<GDSin::GdsRef*>(wd)   , dst);  break;
            case gds_AREF: aref(static_cast<GDSin::GdsARef*>(wd)  , dst);  break;
                  default: assert(false); /*Error - unexpected type*/
         }
         wd = wd->last();
      }
   }
   dst->resort();
}
Exemplo n.º 8
0
/* Update tree to be identical tree but with nodes reallocated
 * with probability pupdate.  This avoids writing to vector slots
 * if unecessary. */
static obj_t update_tree(mps_ap_t ap, obj_t oldtree, unsigned d) {
  obj_t tree;
  size_t i;
  if (oldtree == objNULL || d == 0)
    return oldtree;
  if (rnd_double() < pupdate) {
    tree = mkvector(ap, width);
    for (i = 0; i < width; ++i) {
      aset(tree, i, update_tree(ap, aref(oldtree, i), d - 1));
    }
  } else {
    tree = oldtree;
    for (i = 0; i < width; ++i) {
      obj_t oldsubtree = aref(oldtree, i);
      obj_t subtree = update_tree(ap, oldsubtree, d - 1);
      if (subtree != oldsubtree) {
        aset(tree, i, subtree);
      }
    }
  }
  return tree;
}
Exemplo n.º 9
0
void GDSin::gds2ted::convert(GDSin::GDSstructure* src, laydata::tdtcell* dst) {
   GDSin::GDSdata *wd = src->Get_Fdata();
   while( wd ){
      switch( wd->GetGDSDatatype() ){
//         case      gds_BOX: box(static_cast<GDSin::GDSbox*>(wd), dst);  break;
         case      gds_BOX:
         case gds_BOUNDARY: polygon(static_cast<GDSin::GDSpolygon*>(wd), dst);  break;
         case     gds_PATH: path(static_cast<GDSin::GDSpath*>(wd), dst);  break;
         case     gds_SREF: ref(static_cast<GDSin::GDSref*>(wd), dst);  break;
         case     gds_AREF: aref(static_cast<GDSin::GDSaref*>(wd), dst);  break;
         case     gds_TEXT: text(static_cast<GDSin::GDStext*>(wd), dst);  break;
                   default: {/*Error - unexpected type*/}
      }
      wd = wd->GetLast();
   }
   dst->resort();
//   dst->secure_layprop();
}
Exemplo n.º 10
0
Value Vector_UB32::subseq(INDEX start, INDEX end) const
{
  assert(end >= start);
  const INDEX len = end - start;
  SimpleArray_UB32_1 * result = new_simple_array_ub32_1(len);
  INDEX i = start, j = 0;
  if (_data)
    {
      unsigned int * data = result->data();
      while (i < end)
        data[j++] = _data[i++];
    }
  else
    {
      // displaced
      while (i < end)
        result->aset(j++, aref(i++));
    }
  return make_value(result);
}