Example #1
0
int
main (int argc, char **argv)
{
  rtx desc;
  int pattern_lineno; /* not used */
  int code;

  progname = "genconditions";

  if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
    return (FATAL_EXIT_CODE);

  condition_table = htab_create (1000, hash_c_test, cmp_c_test, NULL);

  /* Read the machine description.  */

  while (1)
    {
      desc = read_md_rtx (&pattern_lineno, &code);
      if (desc == NULL)
	break;

      /* N.B. define_insn_and_split, define_cond_exec are handled
	 entirely within read_md_rtx; we never see them.  */
      switch (GET_CODE (desc))
	{
	default:
	  break;

	case DEFINE_INSN:
	case DEFINE_EXPAND:
	  add_condition (XSTR (desc, 2));
	  /* except.h needs to know whether there is an eh_return
	     pattern in the machine description.  */
	  if (!strcmp (XSTR (desc, 0), "eh_return"))
	    saw_eh_return = 1;
	  break;

	case DEFINE_SPLIT:
	case DEFINE_PEEPHOLE:
	case DEFINE_PEEPHOLE2:
	  add_condition (XSTR (desc, 1));
	  break;
	}
    }

  write_header ();
  write_conditions ();

  fflush (stdout);
  return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
}
Example #2
0
File: state.c Project: dsaravel/dex
static void cmd_char(const char *pf, char **args)
{
	enum condition_type type = COND_CHAR;
	bool not = false;
	struct condition *c;

	while (*pf) {
		switch (*pf) {
		case 'b':
			type = COND_CHAR_BUFFER;
			break;
		case 'n':
			not = true;
			break;
		}
		pf++;
	}

	c = add_condition(type, args[1], args[2]);
	if (!c)
		return;

	set_bits(c->u.cond_char.bitmap, args[0]);
	if (not) {
		int i;
		for (i = 0; i < ARRAY_COUNT(c->u.cond_char.bitmap); i++)
			c->u.cond_char.bitmap[i] = ~c->u.cond_char.bitmap[i];
	}
}
Example #3
0
File: IF.cpp Project: tim099/AOCTDF
void IF::update(){
	if(selected_rule){
		selected_rule->update();
	}
	if(selected_condition){
		selected_condition->update();
	}

	Input::Input *input=Input::Input::get_cur_object();

	while(Input::Signal*sig=input->get_signal("add_rule")){
		add_rule(sig->get_data());
		delete sig;
	}
	while(Input::Signal*sig=input->get_signal("if_add_condition")){
		add_condition(sig->get_data());
		delete sig;
	}
	while(Input::Signal*sig=input->get_signal("rule_if")){
		if(sig->get_data()=="switch_if"){
			true_mode=true;
		}else if(sig->get_data()=="switch_else"){
			true_mode=false;
		}
		delete sig;
	}
	while(Input::Signal*sig=input->get_signal("if_edit_rule")){
		unsigned num=Tim::String::str_to_int(sig->get_data());
		if(true_mode){
			if(num<true_rules.size()){
				selected_rule=true_rules.at(num);
				selected_condition=0;
			}
		}else{
			if(num<false_rules.size()){
				selected_rule=false_rules.at(num);
				selected_condition=0;
			}
		}
		delete sig;
	}
	while(Input::Signal*sig=input->get_signal("if_edit_condition")){
		unsigned num=Tim::String::str_to_int(sig->get_data());
		if(num<conditions.size()){
			selected_condition=conditions.at(num);
			if(selected_rule){
				selected_rule->deselected();
				selected_rule=0;
			}
		}
		delete sig;
	}
}
Example #4
0
File: state.c Project: dsaravel/dex
static void cmd_bufis(const char *pf, char **args)
{
	bool icase = !!*pf;
	struct condition *c;
	const char *str = args[0];
	int len = strlen(str);

	if (len > ARRAY_COUNT(c->u.cond_bufis.str)) {
		error_msg("Maximum length of string is %lu bytes", ARRAY_COUNT(c->u.cond_bufis.str));
		return;
	}
	c = add_condition(COND_BUFIS, args[1], args[2]);
	if (c) {
		memcpy(c->u.cond_bufis.str, str, len);
		c->u.cond_bufis.len = len;
		c->u.cond_bufis.icase = icase;
	}
}
Example #5
0
static bool
find_equivalence (segment_info *n)
{
  gfc_equiv *e1, *e2, *eq;
  bool found;

  found = FALSE;

  for (e1 = n->sym->ns->equiv; e1; e1 = e1->next)
    {
      eq = NULL;

      /* Search the equivalence list, including the root (first) element
         for the symbol that owns the segment.  */
      for (e2 = e1; e2; e2 = e2->eq)
	{
	  if (!e2->used && e2->expr->symtree->n.sym == n->sym)
	    {
	      eq = e2;
	      break;
	    }
	}

      /* Go to the next root element.  */
      if (eq == NULL)
	continue;

      eq->used = 1;

      /* Now traverse the equivalence list matching the offsets.  */
      for (e2 = e1; e2; e2 = e2->eq)
	{
	  if (!e2->used && e2 != eq)
	    {
	      add_condition (n, eq, e2);
	      e2->used = 1;
	      found = TRUE;
	    }
	}
    }
  return found;
}
Example #6
0
static bool
find_equivalence (segment_info *n)
{
  gfc_equiv *e1, *e2, *eq, *other;
  bool found;
 
  found = FALSE;
  for (e1 = n->sym->ns->equiv; e1; e1 = e1->next)
    {
      other = NULL;
      for (e2 = e1->eq; e2; e2 = e2->eq)
	{
	  if (e2->used)
	    continue;

	  if (e1->expr->symtree->n.sym == n->sym)
	    {
	      eq = e1;
	      other = e2;
	    }
	  else if (e2->expr->symtree->n.sym == n->sym)
	    {
	      eq = e2;
	      other = e1;
	    }
	  else
	    eq = NULL;
	  
	  if (eq)
	    {
	      add_condition (n, eq, other);
	      eq->used = 1;
	      found = TRUE;
	      /* If this symbol is the first in the chain we may find other
		 matches. Otherwise we can skip to the next equivalence.  */
	      if (eq == e2)
		break;
	    }
	}
    }
  return found;
}
Example #7
0
Cevent_input_mask::Cevent_input_mask(QStringList *name_b, QStringList *name_v, QString projectpath)
{
    this->project_path = projectpath;
    this->gui_enable_title_label = new QLabel( tr( "Existence" ) );
    this->gui_enable_title_label->setFont( QFont( "Arial", 18, 50 ) );
    this->gui_enable_logo_label = new QLabel();
    this->gui_enable_logo_label->setPixmap( QPixmap( ":/resources/img/event_editor_exist_cond.png" ) );
    this->gui_enable_description = new QLabel( tr( "As an event is able to holde much pages in it, the page with the highest index (see left) will be used for as the event's' current behavour. If the Existence-Conditions on the right do not match, the page with the next lower index will be used instead." ) );
    this->gui_enable_description->setWordWrap( true );
    this->gui_enable_description->setMaximumWidth( 150 );
    this->gui_enable_add_condition_btn = new QPushButton( QIcon( ":/resources/img/add.png" ), tr( "Add Condition" ) );
    this->gui_enable_condition_box = new Cconditions_list_box( name_b, name_v );
    QObject::connect( this->gui_enable_add_condition_btn, SIGNAL(clicked()),
                      this->gui_enable_condition_box, SLOT(add_condition()));

    //asdf d

    this->gui_processing_logo_label = new QLabel();
    this->gui_processing_logo_label->setPixmap( QPixmap( ":/resources/img/event_editor_processing.png" ) );
    this->gui_processing_title_label = new QLabel( tr( "Trigger" ) );
    this->gui_processing_title_label->setFont( QFont( "Arial", 18, 50 ) );
    this->gui_processing_txt1_label = new QLabel( tr( "After this event-page started to exist, it starts it's event-commandos when ..." ) );
    this->gui_processing_txt1_label->setWordWrap( true );
    this->gui_processing_txt1_label->setMaximumWidth( 150 );
    this->gui_processing_combobox = new QComboBox();
    this->gui_processing_combobox->setIconSize( QSize( 32,32 ) );
    this->gui_processing_combobox->addItem( QIcon( ":/resources/img/on_hero_action_key.png" ), tr( "player presses action key" ) );
    this->gui_processing_combobox->addItem( QIcon( ":/resources/img/on_hero_touch.png" ), tr( "player touches event" ) );
    this->gui_processing_combobox->addItem( QIcon( ":/resources/img/on_hero_collision.png" ), tr( "event touches player" ) );
    this->gui_processing_combobox->addItem( QIcon( ":/resources/img/on_mouse_click.png" ), tr( "mouse clicks it" ) );
    this->gui_processing_combobox->addItem( QIcon( ":/resources/img/on_mouse_hover.png" ), tr( "mouse hovers it" ) );
    this->gui_processing_combobox->addItem( QIcon( ":/resources/img/on_hero_action_key.png" ), tr( "a special stock key is pressed" ) );
    this->gui_processing_combobox->addItem( QIcon( ":/resources/img/tools-wizard.png" ), tr( "autostarts after x secounds" ) );
    this->gui_processing_combobox->addItem( QIcon( ":/resources/img/event_edit_loop_start.png" ), tr( "For-ever loop" ) );
    this->gui_processing_edit_stock_keys_btn = new QPushButton( QIcon( ":/resources/img/on_hero_action_key.png" ), tr( "Edit Trigger-Keys" ) );
    this->gui_processing_edit_stock_keys_btn->setEnabled( false );
    QObject::connect( this->gui_processing_combobox, SIGNAL(currentIndexChanged(int)),
                      this, SLOT(gui_check_enable_btns()) );
    this->gui_processing_extra_desc_label = new QLabel( tr( "Delay before starting (msec)" ) );
    this->gui_processing_extra_desc_label->setWordWrap( true );
    this->gui_processing_extra_desc_label->setEnabled( false );
    this->gui_processing_autostart_delay_spin = new QSpinBox();
    this->gui_processing_autostart_delay_spin->setMinimum( 100 );
    this->gui_processing_autostart_delay_spin->setEnabled( false );

    //50px stretch

    this->gui_movement_logo_label = new QLabel();
    this->gui_movement_logo_label->setPixmap( QPixmap( ":/resources/img/event_editor_movement.png" ) );
    this->gui_movement_title_label = new QLabel( tr( "Movement" ) );
    this->gui_movement_title_label->setFont( QFont( "Arial", 18, 50 ) );
    this->gui_movement_title_label->setAlignment( Qt::AlignLeft );
    this->gui_movement_onOff_checkbox = new QCheckBox( tr( "This event moves\nautomatic" ) );
    this->gui_movement_txt1_label = new QLabel( tr( "It moves ..." ) );
    this->gui_movement_speed_combobox = new QComboBox();
    this->gui_movement_speed_combobox->setIconSize( QSize( 32,32 ) );
    this->gui_movement_speed_combobox->addItem( QIcon( ":/resources/img/move_fast.png" ), tr( "fast" ) );
    this->gui_movement_speed_combobox->addItem( QIcon( ":/resources/img/event_editor_movement.png" ), tr( "normal" ) );
    this->gui_movement_speed_combobox->addItem( QIcon( ":/resources/img/move_slow.png" ), tr( "slow" ) );
    this->gui_movement_speed_combobox->setCurrentIndex( 1 );
    this->gui_movement_txt2_label = new QLabel( tr( "and it aims ..." ) );
    this->gui_movement_movement_type_combobox = new QComboBox();
    this->gui_movement_movement_type_combobox->setIconSize( QSize( 32,32 ) );
    this->gui_movement_movement_type_combobox->addItem( QIcon( ":/resources/img/on_hero_collision.png" ), tr( "towards hero" ) );
    this->gui_movement_movement_type_combobox->addItem( QIcon( ":/resources/img/on_hero_touch.png" ), tr( "away from hero" ) );
    this->gui_movement_movement_type_combobox->addItem( QIcon( ":/resources/img/roll.png" ), tr( "totally random" ) );
    this->gui_movement_movement_type_combobox->addItem( QIcon( ":/resources/img/rand_l_r.png" ), tr( "random left and right" ) );
    this->gui_movement_movement_type_combobox->addItem( QIcon( ":/resources/img/rand_u_d.png" ), tr( "random up and down" ) );
    this->gui_movement_movement_type_combobox->addItem( QIcon( ":/resources/img/move_route.png" ), tr( "to a given route" ) );
    this->gui_movement_ghost_mode_checkbx = new QCheckBox( tr( "This event can walk trough everything" ) );
    this->gui_movement_edit_route_btn = new QPushButton( QIcon( ":/resources/img/move_route.png" ), tr( "Edit Route" ) );
    this->gui_movement_edit_route_btn->setEnabled( false );
    QObject::connect( this->gui_movement_movement_type_combobox, SIGNAL(currentIndexChanged(int)),
                      this, SLOT(gui_check_enable_btns()) );
    QObject::connect( this->gui_movement_onOff_checkbox, SIGNAL(toggled(bool)),
                      this, SLOT(gui_check_enable_btns()) );

    //50px stretch
    this->gui_appearance_logo_label = new QLabel();
    this->gui_appearance_logo_label->setPixmap( QPixmap( ":/resources/img/event_editor_appearance.png" ) );
    this->gui_appearance_title_label = new QLabel( tr( "Appearence" ) );
    this->gui_appearance_title_label->setFont( QFont( "Arial", 18, 50 ) );
    this->gui_appearance_title_label->setAlignment( Qt::AlignLeft );
    this->gui_appearance_pick_btn = new QToolButton();
    this->gui_appearance_pick_btn->setIconSize( QSize( 50,100 ) );
    this->gui_appearance_pick_btn->setIcon( QIcon( ":/resources/img/event_editor_no_sprite.png" ) );
    this->gui_appearance_pick_btn->setFixedSize( 100, 100 );
    this->gui_appearance_txt1_label = new QLabel( tr( "Opacity" ) );
    this->gui_appearance_opacityPick_combobox = new QComboBox();
    this->gui_appearance_opacityPick_combobox->setIconSize( QSize( 32,32 ) );
    this->gui_appearance_opacityPick_combobox->addItem( QIcon( ":/resources/img/dritel_3_3.png" ), tr( "fully visible" ) );
    this->gui_appearance_opacityPick_combobox->addItem( QIcon( ":/resources/img/dritel_2_3.png" ), tr( "semi-transparent" ) );
    this->gui_appearance_opacityPick_combobox->addItem( QIcon( ":/resources/img/dritel_1_3.png" ), tr( "hardly visible" ) );
    this->gui_appearance_fixed_face_chkbx = new QCheckBox( tr( "Graphic doesnt change when event looks into a different direction" ) );
    this->gui_appearance_line = new QLineEdit();
    this->gui_appearance_line->setFixedWidth(100);
    this->gui_appearance_line->setReadOnly( true );
    //50px stretch

    this->gui_behavior_logo_label = new QLabel();
    this->gui_behavior_logo_label->setPixmap( QPixmap( ":/resources/img/event_editor_behaviour.png" ) );
    this->gui_behavior_title_label = new QLabel( tr( "Behaviour" ) );
    this->gui_behavior_title_label->setFont( QFont( "Arial", 18, 50 ) );
    this->gui_behavior_title_label->setAlignment( Qt::AlignLeft );
    this->gui_behavior_description = new QLabel( tr( "Just drag'n'drop things that shall happen when this "
                                                     "event gets triggered from the right side bar into the left area.\n"
                                                     "The topmost entry is the first one that gets executed. From there "
                                                     "all others becomes become executed in a downward order.\n"
                                                     "( The Drop-stuff-here-helper entries will be removed once you saved the event )") );
    this->gui_behavior_description->setWordWrap( true );
    this->gui_behavior_cmd_widget = new cevent_editor_dialog_cmd_widget( projectpath,
                                                                         name_b, name_v);

    QObject::connect( this->gui_movement_edit_route_btn, SIGNAL(clicked()),
                      this, SLOT(pick_route()) );
    QObject::connect( this->gui_processing_edit_stock_keys_btn, SIGNAL(clicked()),
                      this, SLOT(pick_stock_key()) );
    QObject::connect( this->gui_appearance_pick_btn, SIGNAL(clicked()),
                      this, SLOT(pick_sprite()) );


    this->gui_lay = new QGridLayout();
    this->gui_lay->addWidget( this->gui_enable_logo_label,              0,0,1,1 );
    this->gui_lay->addWidget( this->gui_enable_title_label,             0,1,1,3 );
    this->gui_lay->addWidget( this->gui_enable_description,             1,1,2,1 );
    this->gui_lay->addWidget( this->gui_enable_add_condition_btn,       1,2,1,1 );
    this->gui_lay->addWidget( this->gui_enable_condition_box,           2,2,1,2 );
    this->gui_lay->addWidget( this->gui_processing_logo_label,          3,0,1,1 );
    this->gui_lay->addWidget( this->gui_processing_title_label,         3,1,1,3 );
    this->gui_lay->addWidget( this->gui_processing_txt1_label,          4,1,1,1 );
    this->gui_lay->addWidget( this->gui_processing_combobox,            4,2,1,2 );
    this->gui_lay->addWidget( this->gui_processing_extra_desc_label,    5,1,1,1 );
    this->gui_lay->addWidget( this->gui_processing_autostart_delay_spin,5,2,1,1 );
    this->gui_lay->addWidget( this->gui_processing_edit_stock_keys_btn, 5,3,1,1 );
    this->gui_lay->addWidget( this->gui_movement_logo_label,            6,0,1,1 );
    this->gui_lay->addWidget( this->gui_movement_title_label,           6,1,1,2 );
    this->gui_lay->addWidget( this->gui_movement_onOff_checkbox,        7,1,1,1 );
    this->gui_lay->addWidget( this->gui_movement_txt1_label,            7,2,1,1 );
    this->gui_lay->addWidget( this->gui_movement_speed_combobox,        7,3,1,1 );
    this->gui_lay->addWidget( this->gui_movement_txt2_label,            8,2,1,1 );
    this->gui_lay->addWidget( this->gui_movement_movement_type_combobox,8,3,1,1 );
    this->gui_lay->addWidget( this->gui_movement_ghost_mode_checkbx,    9,1,1,2 );
    this->gui_lay->addWidget( this->gui_movement_edit_route_btn,        9,3,1,1 );
    this->gui_lay->addWidget( this->gui_appearance_logo_label,          10,0,1,1 );
    this->gui_lay->addWidget( this->gui_appearance_title_label,         10,1,1,2 );
    this->gui_lay->addWidget( this->gui_appearance_pick_btn,            11,1,1,1 );
    this->gui_lay->addWidget( this->gui_appearance_txt1_label,          11,2,1,1 );
    this->gui_lay->addWidget( this->gui_appearance_opacityPick_combobox,11,3,1,1 );
    this->gui_lay->addWidget( this->gui_appearance_line,                12,1,1,1 );
    this->gui_lay->addWidget( this->gui_appearance_fixed_face_chkbx,    12,2,1,2 );
    this->gui_lay->addWidget( this->gui_behavior_logo_label,            13,0,1,1 );
    this->gui_lay->addWidget( this->gui_behavior_title_label,           13,1,1,2 );
    this->gui_lay->addWidget( this->gui_behavior_description,           14,1,1,3 );
    this->gui_lay->addWidget( this->gui_behavior_cmd_widget,            15,1,1,3 );

    this->setLayout( this->gui_lay );
    this->gui_check_enable_btns();
}
Example #8
0
File: state.c Project: dsaravel/dex
static void cmd_heredocend(const char *pf, char **args)
{
	add_condition(COND_HEREDOCEND, args[0], args[1]);
	current_syntax->heredoc = true;
}