Esempio n. 1
0
const irep_idt &irept::get(const irep_namet &name) const
{
  const named_subt &s=
    is_comment(name)?get_comments():get_named_sub();

  #ifdef SUB_IS_LIST
  named_subt::const_iterator it=named_subt_lower_bound(s, name);

  if(it==s.end() ||
     it->first!=name)
  {
    const static irep_idt empty;
    return empty;
  }
  #else
  named_subt::const_iterator it=s.find(name);
  
  if(it==s.end())
  {
    const static irep_idt empty;
    return empty;
  }
  #endif

  return it->second.id();
}
Esempio n. 2
0
irept &irept::add(const irep_namet &name)
{
    named_subt &s=
        is_comment(name)?get_comments():get_named_sub();

    return s[name];
}
Esempio n. 3
0
irept &irept::add(const irep_namet &name, const irept &irep)
{
  named_subt &s=
    is_comment(name)?get_comments():get_named_sub();

  #ifdef SUB_IS_LIST
  named_subt::iterator it=named_subt_lower_bound(s, name);

  if(it==s.end() ||
     it->first!=name)
    it=s.insert(it, std::make_pair(name, irep));
  else
    it->second=irep;

  return it->second;
  #else
  std::pair<named_subt::iterator, bool> entry=
    s.insert(std::make_pair(name, irep));

  if(!entry.second)
    entry.first->second=irep;

  return entry.first->second;
  #endif
}
Esempio n. 4
0
void irept::remove(const irep_namet &name)
{
    named_subt &s=
        is_comment(name)?get_comments():get_named_sub();

    named_subt::iterator it=s.find(name);

    if(it!=s.end()) s.erase(it);
}
Esempio n. 5
0
int		get_ants(t_env *e)
{
	if (get_comments(e) == 0)
	{
		if (ft_strisdigit(e->line) != 0)
		{
			e->n_ants = ft_atof(e->line);
			if (e->n_ants < MIN_INT || e->n_ants > MAX_INT)
				return (-1);
			if (e->n_ants <= 0)
				return (-1);
		}
		else
			return (-1);
		e->n_read++;
	}
	else if (get_comments(e) == -1)
		return (1);
	return (0);
}
Esempio n. 6
0
const irept &irept::find(const irep_namet &name) const
{
    const named_subt &s=
        is_comment(name)?get_comments():get_named_sub();

    named_subt::const_iterator it=s.find(name);

    if(it==s.end())
        return get_nil_irep();

    return it->second;
}
Esempio n. 7
0
void irept::remove(const irep_namet &name)
{
  named_subt &s=
    is_comment(name)?get_comments():get_named_sub();

  #ifdef SUB_IS_LIST
  named_subt::iterator it=named_subt_lower_bound(s, name);

  if(it!=s.end() && it->first==name) s.erase(it);
  #else
  s.erase(name);
  #endif
}  
Esempio n. 8
0
const irep_idt &irept::get(const irep_namet &name) const
{
    const named_subt &s=
        is_comment(name)?get_comments():get_named_sub();

    named_subt::const_iterator it=s.find(name);

    if(it==s.end())
    {
        const static irep_idt empty;
        return empty;
    }

    return it->second.id();
}
Esempio n. 9
0
irept &irept::add(const irep_namet &name)
{
  named_subt &s=
    is_comment(name)?get_comments():get_named_sub();

  #ifdef SUB_IS_LIST
  named_subt::iterator it=named_subt_lower_bound(s, name);

  if(it==s.end() ||
     it->first!=name)
    it=s.insert(it, std::make_pair(name, irept()));

  return it->second;
  #else
  return s[name];
  #endif
}
Esempio n. 10
0
File: speex.c Progetto: gitkaste/moc
/* Fill info structure with data from spx comments */
static void spx_info (const char *file_name, struct file_tags *tags,
		const int tags_sel)
{
	struct io_stream *s;

	s = io_open (file_name, 0);
	if (io_ok(s)) {
		struct spx_data *data = spx_open_internal (s);

		if (data->ok) {
			if (tags_sel & TAGS_COMMENTS)
				get_comments (data, tags);
			if (tags_sel & TAGS_TIME)
				tags->time = count_time (data);
		}

		spx_close (data);
	}
}
Esempio n. 11
0
const irept &irept::find(const irep_namet &name) const
{
  const named_subt &s=
    is_comment(name)?get_comments():get_named_sub();

  #ifdef SUB_IS_LIST
  named_subt::const_iterator it=named_subt_lower_bound(s, name);

  if(it==s.end() ||
     it->first!=name)
    return get_nil_irep();
  #else
  named_subt::const_iterator it=s.find(name);

  if(it==s.end())
    return get_nil_irep();
  #endif

  return it->second;
}