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(); }
irept &irept::add(const irep_namet &name) { named_subt &s= is_comment(name)?get_comments():get_named_sub(); return s[name]; }
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 }
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); }
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); }
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; }
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 }
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(); }
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 }
/* 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); } }
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; }