Exemple #1
0
Rectangle::Rectangle(float Width, float Height)
{
	set_left   ( 0 );
	set_bottom ( 0 );	
	set_width  ( Width  );
	set_height ( Height );	
}
// This is the shared initialization code. It sets up the basic pointers,
// and allows enough extra space for a filler object. We call a virtual
// method, "lab_is_valid()" to handle the different asserts the old/young
// labs require.
void PSPromotionLAB::initialize(MemRegion lab) {
  assert(lab_is_valid(lab), "Sanity");

  HeapWord* bottom = lab.start();
  HeapWord* end    = lab.end();

  set_bottom(bottom);
  set_end(end);
  set_top(bottom);

  // Initialize after VM starts up because header_size depends on compressed
  // oops.
  filler_header_size = align_object_size(typeArrayOopDesc::header_size(T_INT));

  // We can be initialized to a zero size!
  if (free() > 0) {
    if (ZapUnusedHeapArea) {
      debug_only(Copy::fill_to_words(top(), free()/HeapWordSize, badHeapWord));
    }

    // NOTE! We need to allow space for a filler object.
    assert(lab.word_size() >= filler_header_size, "lab is too small");
    end = end - filler_header_size;
    set_end(end);

    _state = needs_flush;
  } else {
    _state = zero_size;
  }

  assert(this->top() <= this->end(), "pointers out of order");
}
Exemple #3
0
Rectangle::Rectangle()
{
	set_left  ( 0. );
	set_right ( 0. );
	set_top   ( 0. );
	set_bottom( 0. );
}
// This is the shared initialization code. It sets up the basic pointers,
// and allows enough extra space for a filler object. We call a virtual
// method, "lab_is_valid()" to handle the different asserts the old/young
// labs require. 
void PSPromotionLAB::initialize(MemRegion lab) {
  assert(lab_is_valid(lab), "Sanity");

  HeapWord* bottom = lab.start();
  HeapWord* end    = lab.end();

  set_bottom(bottom);
  set_end(end);
  set_top(bottom);

  // We can be initialized to a zero size!
  if (free() > 0) {
    if (ZapUnusedHeapArea) {
      debug_only(Memory::set_words(top(), free()/HeapWordSize, badHeapWord));
    }
    
    // NOTE! We need to allow space for a filler object.
    assert(lab.word_size() >= filler_header_size, "lab is too small");
    end = end - filler_header_size;
    set_end(end);

    _state = needs_flush;
  } else {
    _state = zero_size;
  }

  assert(this->top() <= this->end(), "pointers out of order");
}
// Fill all remaining lab space with an unreachable object.
// The goal is to leave a contiguous parseable span of objects.
void PSPromotionLAB::flush() {
  assert(_state != flushed, "Attempt to flush PLAB twice");
  assert(top() <= end(), "pointers out of order");
  
  // If we were initialized to a zero sized lab, there is
  // nothing to flush
  if (_state == zero_size)
    return;

  // PLAB's never allocate the last aligned_header_size 
  // so they can always fill with an array.
  HeapWord* tlab_end = end() + filler_header_size;
  typeArrayOop filler_oop = (typeArrayOop) top();
  filler_oop->set_mark();
  filler_oop->set_klass(Universe::intArrayKlassObj());
  const size_t array_length =
    pointer_delta(tlab_end, top()) - typeArrayOopDesc::header_size(T_INT);
  assert( (array_length * (HeapWordSize/sizeof(jint))) < max_jint, "array too big in PSPromotionLAB");
  filler_oop->set_length((int)(array_length * (HeapWordSize/sizeof(jint))));

#ifdef ASSERT
  // Note that we actually DO NOT want to use the aligned header size!
  HeapWord* elt_words = ((HeapWord*)filler_oop) + typeArrayOopDesc::header_size(T_INT);
  Memory::set_words(elt_words, array_length, 0xDEAABABE);
#endif
  
  set_bottom(NULL);
  set_end(NULL);
  set_top(NULL);

  _state = flushed;
}
Exemple #6
0
Rectangle::Rectangle(float Left, float Bottom, float Width, float Height)
{
	set_left  ( Left 			);
	set_right ( Left + Width    );
	set_top   ( Bottom + Height );
	set_bottom( Bottom 			);
}
Exemple #7
0
void space::initialize(char* name, oop* bottom, oop* end) {
  assert(Universe::on_page_boundary(bottom) && Universe::on_page_boundary(end), "invalid space boundaries");

  set_name(name);
  set_bottom(bottom);
  set_top(bottom);
  set_end(end);
}
	/* DEFAULT CONSTRUCTOR */
	DrawingObject::DrawingObject()
	{
		set_type("OBJECT");
		set_left(0);
		set_bottom(0);
		set_width(0);
		set_height(0);
	}
	/* COPY CONSTRUCTOR */
	DrawingObject::DrawingObject(const DrawingObject& o)
	{
		set_type(o.type());
		set_left(o.left());
		set_bottom(o.bottom());
		set_width(o.width());
		set_height(o.height());
	}
void Space::initialize(MemRegion mr, bool clear_space) {
  HeapWord* bottom = mr.start();
  HeapWord* end    = mr.end();
  assert(Universe::on_page_boundary(bottom) && Universe::on_page_boundary(end),
         "invalid space boundaries");
  set_bottom(bottom);
  set_end(end);
  if (clear_space) clear();
}
Exemple #11
0
oldSpace::oldSpace(char *name, int &size) {
  next_space= NULL;

  offset_array = NEW_C_HEAP_ARRAY(u_char, Universe::old_gen.virtual_space.reserved_size()/card_size);
  set_name(name);
  set_bottom((oop*) Universe::old_gen.virtual_space.low());
  set_top((oop*)    Universe::old_gen.virtual_space.low());
  set_end((oop*)    Universe::old_gen.virtual_space.high());
  initialize_threshold();
}
	Exit::Exit()
	{
		set_type("EXIT");
		set_left(EXIT_LEFT);
		set_bottom(EXIT_BOTTOM);
		set_width(EXIT_WIDTH);
		set_height(EXIT_HEIGHT);
		add_input(CircuitObject());
		close();
	}
Exemple #13
0
FractalProto * Fractal::serialize() {
    auto fp = new FractalProto();
    fp->set_bottom(bottom);
    fp->set_height(height);
    fp->set_left(left);
    fp->set_right(right);
    fp->set_width(width);
    fp->set_top(top);
    fp->set_maxiter(maxiter);
    return fp;
}
	CircuitObject::CircuitObject(string type)
	{
		set_type(type);
		set_left(0);
		set_bottom(0);
		set_width(0);
		set_height(0);
		set_input1(NULL);
		set_input2(NULL);
		set_output(NULL);
		set_output_value(0);
	}
Exemple #15
0
reset(int arg) {
  ::reset(arg);
  if (!arg) {
    set_light(1);
    set_short("All at sea");
    set_long("You are swimming out in the sea.\n");
    property = "waterfilled";
    set_bottom("room/sea_bottom");
    add_exit("room/jetty","west");
    add_exit("room/sea_bottom","down");
    set_outdoors(); }
}
	Exit::Exit(const Exit& e)
	{
		set_type(e.type());
		set_left(e.left());
		set_bottom(e.bottom());
		set_width(e.width());
		set_height(e.height());
		add_input(e.input());
		if(e.is_open())
			open();
		else
			close();
	}	
	CircuitObject::CircuitObject(const CircuitObject& o)
	{
		set_type(o.type());
		set_left(o.left());
		set_bottom(o.bottom());
		set_width(o.width());
		set_height(o.height());
		set_input1(o.input1());
		set_input2(o.input2());
		set_output(o.output());
		set_output_value(o.output_value());
		if(o.has_button())
			give_button();
	}
Exemple #18
0
void
key_event(void)
{
     int i, c;

     struct timespec length = { 0, ttyclock->option.delay };

     switch(c = wgetch(stdscr))
     {
     case KEY_UP:
     case 'k':
     case 'K':
          if(ttyclock->geo.x >= 1
             && !ttyclock->option.center)
               clock_move(ttyclock->geo.x - 1, ttyclock->geo.y, ttyclock->geo.w, ttyclock->geo.h);
          break;

     case KEY_DOWN:
     case 'j':
     case 'J':
          if(ttyclock->geo.x <= (LINES - ttyclock->geo.h - DATEWINH)
             && !ttyclock->option.center)
               clock_move(ttyclock->geo.x + 1, ttyclock->geo.y, ttyclock->geo.w, ttyclock->geo.h);
          break;

     case KEY_LEFT:
     case 'h':
     case 'H':
          if(ttyclock->geo.y >= 1
             && !ttyclock->option.center)
               clock_move(ttyclock->geo.x, ttyclock->geo.y - 1, ttyclock->geo.w, ttyclock->geo.h);
          break;

     case KEY_RIGHT:
     case 'l':
     case 'L':
          if(ttyclock->geo.y <= (COLS - ttyclock->geo.w - 1)
             && !ttyclock->option.center)
               clock_move(ttyclock->geo.x, ttyclock->geo.y + 1, ttyclock->geo.w, ttyclock->geo.h);
          break;

     case 'q':
     case 'Q':
          ttyclock->running = False;
          break;

     case 's':
     case 'S':
          set_second();
          break;

     case 't':
     case 'T':
          ttyclock->option.twelve = !ttyclock->option.twelve;
          /* Set the new ttyclock->date.datestr to resize date window */
          update_hour();
          clock_move(ttyclock->geo.x, ttyclock->geo.y, ttyclock->geo.w, ttyclock->geo.h);
          break;

     case 'c':
     case 'C':
          set_center(!ttyclock->option.center);
          break;

     case 'b':
     case 'B':
          set_bottom(!ttyclock->option.bottom);
          break;

     case 'r':
     case 'R':
          ttyclock->option.rebound = !ttyclock->option.rebound;
          if(ttyclock->option.rebound && ttyclock->option.center)
               ttyclock->option.center = False;
          break;
     default:
          nanosleep(&length, NULL);
          for(i = 0; i < 8; ++i)
               if(c == (i + '0'))
               {
                    ttyclock->option.color = i;
                    init_pair(1, ttyclock->bg, i);
                    init_pair(2, i, ttyclock->bg);
               }
          break;
     }

     return;
}
Exemple #19
0
void
init(void)
{
     struct sigaction sig;
     ttyclock->bg = COLOR_BLACK;

     /* Init ncurses */
     initscr();
     cbreak();
     noecho();
     keypad(stdscr, True);
     start_color();
     curs_set(False);
     clear();

     /* Init default terminal color */
     if(use_default_colors() == OK)
          ttyclock->bg = -1;

     /* Init color pair */
     init_pair(0, ttyclock->bg, ttyclock->bg);
     init_pair(1, ttyclock->bg, ttyclock->option.color);
     init_pair(2, ttyclock->option.color, ttyclock->bg);
     refresh();

     /* Init signal handler */
     sig.sa_handler = signal_handler;
     sig.sa_flags   = 0;
     sigaction(SIGWINCH, &sig, NULL);
     sigaction(SIGTERM,  &sig, NULL);
     sigaction(SIGINT,   &sig, NULL);
     sigaction(SIGSEGV,  &sig, NULL);

     /* Init global struct */
     ttyclock->running = True;
     if(!ttyclock->geo.x)
          ttyclock->geo.x = 0;
     if(!ttyclock->geo.y)
          ttyclock->geo.y = 0;
     if(!ttyclock->geo.a)
          ttyclock->geo.a = 1;
     if(!ttyclock->geo.b)
          ttyclock->geo.b = 1;
     ttyclock->geo.w = (ttyclock->option.second) ? SECFRAMEW : NORMFRAMEW;
     ttyclock->geo.h = 7;
     ttyclock->tm = localtime(&(ttyclock->lt));
     ttyclock->lt = time(NULL);
     update_hour();

     /* Create clock win */
     ttyclock->framewin = newwin(ttyclock->geo.h,
                                 ttyclock->geo.w,
                                 ttyclock->geo.x,
                                 ttyclock->geo.y);
     box(ttyclock->framewin, 0, 0);

     /* Create the date win */
     if (ttyclock->option.date)
     {
          ttyclock->datewin = newwin(DATEWINH, strlen(ttyclock->date.datestr) + 2,
                                     ttyclock->geo.x + ttyclock->geo.h - 1,
                                     ttyclock->geo.y + (ttyclock->geo.w / 2) -
                                     (strlen(ttyclock->date.datestr) / 2) - 1);
          box(ttyclock->datewin, 0, 0);
          clearok(ttyclock->datewin, True);
     }

     set_center(ttyclock->option.center);
     set_bottom(ttyclock->option.bottom);

     nodelay(stdscr, True);

     if (ttyclock->option.date)
     {
          wrefresh(ttyclock->datewin);
     }

     wrefresh(ttyclock->framewin);

     return;
}
Exemple #20
0
		/// \brief Set the bottom right corner
		constexpr void set_bottom_right(
			point< position_type > const& bottomRight
		){
			set_right(bottomRight.x);
			set_bottom(bottomRight.y);
		}
Exemple #21
0
		/// \brief Set the bottom left corner
		constexpr void set_bottom_left(
			point< position_type > const& bottomLeft
		){
			set_left(bottomLeft.x);
			set_bottom(bottomLeft.y);
		}
		TITANIUM_PROPERTY_SETTER(Animation, bottom)
		{
			TITANIUM_ASSERT(argument.IsNumber());
			set_bottom(static_cast<double>(argument));
			return true;
		}