Ejemplo n.º 1
0
void changelist_float(t_changelist *x, double f)
{
	long in = SECT_PROXY_GETINLET(x);
	if(in == 0){	
		atom_setfloat(x->c_input, f);
		x->c_len = 1;
		do_comparison(x) ;
	}else if(in == 1){
		atom_setfloat(x->c_compare, f);
		x->c_complen = 1;		
	}
}
Ejemplo n.º 2
0
void changelist_int(t_changelist *x, long i)
{
	long in = SECT_PROXY_GETINLET(x);
	if(in == 0){
		x->c_len = 1;
		atom_setlong(x->c_input, i);
		do_comparison(x) ;
	}else if(in == 1){
		atom_setlong(x->c_compare, i);
		x->c_complen = 1;		
	}
}
Ejemplo n.º 3
0
void changelist_anything(t_changelist *x, t_symbol *s, short ac, t_atom *av)		
{
	long in = SECT_PROXY_GETINLET(x);
	int i;
	if(in==0){
		ac = MIN(MAXSIZE-1, ac);
		atom_setsym(x->c_input+0, s);
		x->c_len = ac+1;		
		for (i=0; i<ac; ++i) x->c_input[i+1] = av[i];
		do_comparison(x) ;
	}else if(in == 1){
		ac = MIN(MAXSIZE-1, ac);
		atom_setsym(x->c_compare+0, s);
		x->c_complen = ac+1;		
	for (i=0; i<ac; ++i) x->c_compare[i+1] = av[i];
	}
}
Ejemplo n.º 4
0
void changelist_list(t_changelist *x, t_symbol *s, short ac, t_atom *av)
{
	long in = SECT_PROXY_GETINLET(x);
	int i;
	t_atom *at;	
	
	if(in == 0){	
		ac = MIN(MAXSIZE, ac);
		at = x->c_input;
		x->c_len = ac;		
		for (i=0; i<ac; ++i) *at++ = *av++;
		do_comparison(x);
	}else if(in == 1){
		ac = MIN(MAXSIZE, ac);
		at = x->c_compare;
		x->c_complen = ac;		
	for (i=0; i<ac; ++i) *at++ = *av++; // copy to out_array
	}		
}
Ejemplo n.º 5
0
void changelist_bang(t_changelist *x)
{
	long in = SECT_PROXY_GETINLET(x);
	if (in == 0) do_comparison(x) ;
}
Ejemplo n.º 6
0
parse_errors_e fnc_binary_comparison::execute()
{
  static const int PAR_OPR1 = 1;
  static const int PAR_OPR2 = 2;
  static const int PAR_ACTION = 3;

  interpreter_t *_int = get_interpreter();

  const char *symname = _int->get_const_at(PAR_ACTION);

  bool bBranch;

  bBranch = do_comparison(_int, _op, PAR_OPR1, PAR_OPR2);

  if (!bBranch)
    return parse_error_none;

  // Label?
  if (_int->is_variable_name(symname))
  {
    // check if label already defined, if not so then error!
    value_t *val = _int->get_value_at(PAR_ACTION);
    if (val == 0)
      return parse_error_symbol_not_in_table;

    if (bBranch)
    {
      // branch!
      _int->set_cur_src_line(val->get_int_value());
      return parse_branch_to;
    }
  }

  if (function_t *fnc = _int->get_function(symname))
  {
    // we need a helper
    interpreter_helper_t helper(_int);

    // save old tokenizer
    compel_string_tokenizer_t *old_tokenizer = helper.get_tokenizer();

    // create new tokenizer for the action passed to the if_xx
    compel_string_tokenizer_t new_tokenizer;

    // get the action
    const char *action_str = old_tokenizer->join_from(PAR_ACTION);

    // parse the action
    new_tokenizer.parse(action_str);

    // set new tokenizer (temp)
    helper.set_tokenizer(&new_tokenizer);

    // execute the function
    parse_errors_e err = fnc->execute();

    // restore old tokenizer
    helper.set_tokenizer(old_tokenizer);

    return err;
  }
  else
    return parse_error_function_expected;

  // do not branch, execute next line
  return parse_error_none;
}