Beispiel #1
0
void nwxGridCellValidatorCollection::SetCellValidator(
  nwxGridCellValidator *p, int nRow, int nCol)
{
  wxPoint pt(nRow,nCol);
  MAP2DV::iterator itr = 
    m_mapCellValidator.find(pt);
  bool bInsert = true;
  
  if(itr == m_mapCellValidator.end()) 
  {}
  else if(itr->second == p)
  { bInsert = false; }
  else
  { m_mapCellValidator.erase(itr); }

  if(bInsert)
  {
    _STORE(p);
    m_mapCellValidator.insert(
      MAP2DV::value_type(
        pt,p));
  }
}
Beispiel #2
0
void nwxGridCellValidatorCollection::_InsertRowCol(
  map<int, nwxGridCellValidator *> *pmap,
  int n, nwxGridCellValidator *p)
{
  MAPV::iterator itr = pmap->find(n);
  bool bInsert = true;
  if(itr == pmap->end())
  {}
  else if(itr->second == p)
  {
    bInsert = false;
  }
  else
  {
    pmap->erase(itr);
  }
  if(bInsert)
  {
    _STORE(p);
    pmap->insert(
      MAPV::value_type(
        n,p));
  }
}
Beispiel #3
0
int vm::start() {
    if(!mem)
        return -1;

    //some temporary addresses some instructions might need
    ADDR_TYPE addr1;

    for(;;) {
        //load next instruction
        char *inst = MEM(pc);

        //prints the current instruction
        //just for debugging purposes
        //std::cout << (int)*inst << std::endl;

        switch(*inst) {
            case NOP:
            break;

            case ADD:
            //adds the two integers on top of the stack
            _ADD();

            case DUP:
            //duplicates the integer on top of the stack
            _DUP();

            case GETBASIC:
            //replaces a pointer to a data object with the object
            _GETBASIC();

            case HALT:
            //Stops the vm
            return 0;

            case JUMP:
            //Jumps to an address
            pc = *(ADDR_TYPE*)(inst + sizeof(INST_TYPE));
            continue;

            case JUMPZ:
            //Jumps if the long long on top of the stack is 0
            _JUMPZ();

            case LOADC:
            //loads a INTEGER constant on the stack
            _LOADC();

            case STORE:
            //pushes the value on top of the stack to the adress lying at pos 2 of the stack
            //there is no check, if the destination address is allocated or of the right type
            _STORE();

            case MKBASIC:
            //Takes the INTEGER from the stack and stores it on the heap
            _MKBASIC();

            default:
            std::cerr << "Unrecognized Opcode " << (int)*inst << std::endl;
        }

        pc += sizeof(INST_TYPE);
    }

    return 0;
}
Beispiel #4
0
/* Function: al_restore_state
 */
void al_restore_state(ALLEGRO_STATE const *state)
{
   thread_local_state *tls;
   INTERNAL_STATE *stored;
   int flags;

   if ((tls = tls_get()) == NULL)
      return;
   
   stored = (void *)state;
   flags = stored->flags;

   if (flags & ALLEGRO_STATE_NEW_DISPLAY_PARAMETERS) {
      _STORE(new_display_flags);
      _STORE(new_display_refresh_rate);
      _STORE(new_display_adapter);
      _STORE(new_window_x);
      _STORE(new_window_y);
      _STORE(new_display_settings);
   }
   
   if (flags & ALLEGRO_STATE_NEW_BITMAP_PARAMETERS) {
      _STORE(new_bitmap_format);
      _STORE(new_bitmap_flags);
   }
   
   if (flags & ALLEGRO_STATE_DISPLAY) {
      _STORE(current_display);
      _al_set_current_display_only(tls->current_display);
   }

   if (flags & ALLEGRO_STATE_TARGET_BITMAP) {
      _STORE(target_bitmap);
      al_set_target_bitmap(tls->target_bitmap);
   }
   
   if (flags & ALLEGRO_STATE_BLENDER) {
      tls->current_blender = stored->stored_blender;
   }

   if (flags & ALLEGRO_STATE_NEW_FILE_INTERFACE) {
      _STORE(new_file_interface);
      _STORE(fs_interface);
   }
   
   if (flags & ALLEGRO_STATE_TRANSFORM) {
      ALLEGRO_BITMAP *bitmap = al_get_target_bitmap();
      if (bitmap)
         al_use_transform(&stored->stored_transform);
   }
}