Exemplo n.º 1
0
bool
edit_interface_rep::set_hybrid_footer (tree st) {
  // WARNING: update edit_dynamic_rep::activate_hybrid when updating this
  if (is_atomic (st))
    if (is_func (subtree (et, path_up (tp, 2)), HYBRID, 1)) {
      string msg;
      // macro argument
      string name= st->label;
      path mp= search_upwards (MACRO);
      if (!is_nil (mp)) {
	tree mt= subtree (et, mp);
	int i, n= N(mt)-1;
	for (i=0; i<n; i++)
	  if (mt[i] == name) {
	    set_message (concat (kbd ("return"), ": insert argument ", name),
			 "hybrid command");
	    return true;
	  }
      }
      // macro application
      tree f= get_env_value (name);
      if (drd->contains (name) && (f == UNINIT))
	set_message (concat (kbd ("return"), ": insert primitive ", name),
		     "hybrid command");
      else if (is_func (f, MACRO) || is_func (f, XMACRO))
	set_message (concat (kbd ("return"), ": insert macro ", name),
		     "hybrid command");
      else if (f != UNINIT)
	set_message (concat (kbd ("return"), ": insert value ", name),
		     "hybrid command");
      else return false;
      return true;
    }
  return false;
}
Exemplo n.º 2
0
u_char getchar() {
  u_char c;

  c = kbd();
  if (c == '\b' || c == '\177') return(c);
  if (c == '\r') c = '\n';
  return(c);
}
Exemplo n.º 3
0
void
becninit(struct consdev *cp)
{

	video_init((u_char *)cp->address);
	kbdreset();
	kbd(1);		/* read out ugly data */
}
Exemplo n.º 4
0
int CRT_tstc(void)
{
	if (!kbd_reset) {kbdreset(); kbd_reset++; }

        while (key_pending == -1 && ((inb(KBSTATP) & KBINRDY) != 0)) {
                key_pending = kbd(1);
        }

        return (key_pending != -1);
}
Exemplo n.º 5
0
scankbd() {
u_char c;
  
  c = inb(0x60);
  if (c == 0xaa) { odt = 0x2a; return (0); }
  if (c == 0xfa) { odt = 0x7a; return (0); }
  c &= 0x7f;
  
  if ( (odt&0x7f) == c )return(0);
  if(odt == 0) { odt = c;  return(0); }
  return(kbd());
}
Exemplo n.º 6
0
int CRT_getc(void)
{
	int c;
	if (!kbd_reset) {kbdreset(); kbd_reset++; }

        if (key_pending != -1) {
                c = key_pending;
                key_pending = -1;
                return c;
        } else {
	while ((c = kbd(0)) == 0) ;
                return c;
        }
}
Exemplo n.º 7
0
int Input::eventHandler(const df::Event *event){
 	std::string type = event->getType();

 	if(type == df::KEYBOARD_EVENT){
 		const df::EventKeyboard *kEvent = dynamic_cast <const df::EventKeyboard*> (event);
 		kbd(kEvent);
 		return 1;
 	} else if(type == df::MOUSE_EVENT){
 		const df::EventMouse *mouseEvent = dynamic_cast<const df::EventMouse*>(event);
 		mouse(mouseEvent);
 		return 1;
 	}

 	return 0;
}
Exemplo n.º 8
0
int main()
{
    int ch; /* Holds the keyboard char */
    init();

    do
    { /* Keyboard loop */
        ch = getch();
    }
    while(kbd(ch)); /* When the kbd returns false, we stop */

    finish();

    return 0;
}
Exemplo n.º 9
0
bool
edit_interface_rep::set_latex_footer (tree st) {
  if (is_atomic (st)) 
    if (is_func (subtree (et, path_up (tp, 2)), LATEX, 1) ||
	is_func (subtree (et, path_up (tp, 2)), HYBRID, 1)) {
      string s= st->label;
      string help;
      command cmd;
      if (sv->kbd_get_command (s, help, cmd)) {
	set_left_footer (concat (kbd ("return"), ": " * help));
	set_right_footer ("latex command");
	return true;
      }
    }
  return false;
}
Exemplo n.º 10
0
int Enemy::eventHandler(Event *p_e){
//std::cout << "Enemy::eventHandler: event passed to child\n";
	if(p_e->getType() == KEYBOARD_EVENT){
		EventKeyboard *p_keyboard_event = static_cast <EventKeyboard *> (p_e);
		kbd(p_keyboard_event);
		return 1;
	}
	if(p_e->getType() == STEP_EVENT){
		step();
		return 1;
	}
	if(p_e->getType() == COLLISION_EVENT){
		LogManager &lm = LogManager::getInstance();
		lm.writeLog("Collision");
		WorldManager &wm = WorldManager::getInstance();
		wm.markForDelete(this);
	}
	return 0;
}
Exemplo n.º 11
0
main()
{
	
	int k;
	init_world();
	
	init_curses();

	draw_vmap();

//	fskipc=0;

	do
	{ //Keyboard loop
		if(pause==0)
		{	

			evolv();

			//k=fskipc/fskip;

			if ((fskipc%fskip)==0)	
			{
				//fskipc=0;
				info_status();
				draw_vmap();
			}

			fskipc++;
			age++;

		}


		cho=getch();
	}
	while(kbd()); 


	finish_game();

	return(0);
}
Exemplo n.º 12
0
// Handle event.
// Return 0 if ignored, else 1.
int Hero::eventHandler(const df::Event *p_e) {
  Role &role = Role::getInstance();

  if (p_e->getType() == df::KEYBOARD_EVENT) {
    // if the ship is the host and so is the server
    const df::EventKeyboard *p_keyboard_event = dynamic_cast <const df::EventKeyboard *> (p_e);
    if(role.isHost() && !isClient) {
      kbd(p_keyboard_event);
    } else if(!role.isHost() && isClient) {
      // the ship and server is the client
      // send the event to the host server
      df::NetworkManager &net_mgr = df::NetworkManager::getInstance();
      std::string msg = "KEY:" + std::to_string(p_keyboard_event->getKey());
      printf("about to send the event: %s\n", msg.c_str());
      net_mgr.send((void*)msg.c_str(), msg.length());
    }
    return 1;
  }

  if (p_e->getType() == df::MOUSE_EVENT) {
    if(role.isHost() && !isClient) {
      const df::EventMouse *p_mouse_event = dynamic_cast <const df::EventMouse *> (p_e);
      mouse(p_mouse_event);
    } else if(!role.isHost() && isClient) {
      // the ship and server is the client
      // send the event
    }
    return 1;
  }

  if (p_e->getType() == df::STEP_EVENT) {
    if(role.isHost()) {
      step();
    }
    return 1;
  }

  // If get here, have ignored this event.
  return 0;
}
Exemplo n.º 13
0
// Handle event.
// Return 0 if ignored, else 1.
int Hero::eventHandler(const df::Event *p_e) {

  if (p_e->getType() == df::KEYBOARD_EVENT) {
    const df::EventKeyboard *p_keyboard_event = dynamic_cast <const df::EventKeyboard *> (p_e);
    kbd(p_keyboard_event);
    return 1;
  }

  if (p_e->getType() == df::MOUSE_EVENT) {
    const df::EventMouse *p_mouse_event = dynamic_cast <const df::EventMouse *> (p_e);
    mouse(p_mouse_event);
    return 1;
  }

  if (p_e->getType() == df::STEP_EVENT) {
    step();
    return 1;
  }
 
  // If get here, have ignored this event.
  return 0;
}
Exemplo n.º 14
0
void next() {
    kbd();
}
Exemplo n.º 15
0
int
vgacnscan(void *dev)
{

	return (kbd(1));
}
Exemplo n.º 16
0
int
becnscan(void *dev)
{

	return (kbd(1));
}
Exemplo n.º 17
0
tree
edit_interface_rep::kbd_shortcut (string cmd) {
  string s= as_string (eval ("(kbd-find-inv-binding '" * cmd * ")"));
  return kbd (s);
}