static void go_to_next(t_ants **ats, t_hall **link) { if (*link && ((*link)->nbr_ants > 0 || (*link)->stat == 1) && (*link)->stat < 2) { go_to_next(ats, &(*link)->next); if ((*link)->next) { (*link)->next->myats = (*link)->myats; (*link)->next->nbr_ants++; if ((*link)->next->myats) ft_print_result(&(*link)->next); if ((*link)->stat == 0) { ft_putchar(' '); (*link)->myats = NULL; (*link)->nbr_ants = 0; } else { (*link)->nbr_ants--; if ((*link)->myats->next) (*link)->myats = (*link)->myats->next; } } } }
attribute_iterator(boost::iterator_range<ParentIterator> r) :parent_it(r.begin()), parent_end(r.end()) { if (parent_it != parent_end) { auto attributes = (*parent_it).attributes(); attribute_it = attributes.begin(); attribute_end = attributes.end(); if (attribute_it == attribute_end) { go_to_next(); } } }
static void move_ants(t_hall *str, t_hall *end, t_ants **ats) { int nbr; nbr = str->nbr_ants; str->myats = *ats; while (end->nbr_ants < nbr) { go_to_next(ats, &str); ft_putchar('\n'); } }
void select_arg(t_select *sl) { t_list *tmp; tmp = sl->lc; while (tmp != NULL) { if (tmp->indice & CURSOR) break ; tmp = tmp->next; } if (tmp->indice & SELECTED) tmp->indice -= 3; else tmp->indice += 1; go_to_next(sl, tmp); print_list(*sl); }
char *get_next_line(const int fd) { static char buf[READ_SIZE]; static char *line = NULL; static int beg = 1; static int len = 0; static int ctr = 0; if (buf[my_strlen(buf) - len] == 0) { if ((len = read(fd, buf, READ_SIZE)) <= 0) return (line = (beg-- && buf[my_strlen(buf) - len - 1] != '\n') ? (line) : (NULL)); buf[len] = 0; } if (!(line = my_realloc(line, ctr))) return (NULL); while (buf[my_strlen(buf) - len] != 0 && buf[my_strlen(buf) - len] != '\n') line[ctr++] = buf[my_strlen(buf) - len--]; line[ctr] = 0; if (buf[my_strlen(buf) - len] == '\n') return (line = go_to_next(line, &ctr, &len)); return (get_next_line(fd)); }
/** * Incremental operator. It will get to the next edge. * * @Return edge_iterator object. */ edge_iterator& operator++() { go_to_next(); return *this; }
void increment() { go_to_next(); }