list_pointer search_item_in_list(object_type item, list_type *list) { list_pointer aux; /* If there is no item on the list, it returns NULL*/ if(!get_first_in_list(list, &aux)) return NULL; /* While there is an next item, keep searching */ do { if (compare_objects(aux->item, item)) { return aux; } go_next(list, &aux); } while (!is_last(aux, list)); /* Tests if the object is the last */ if (compare_objects(aux->item, item)) { return aux; } return NULL; }
void gen_laby_parfait(t_gen *gen) { t_pos pos; pos.x = 0; pos.y = 0; while (!(pos.x == gen->w - 2 && pos.y == gen->h - 1) && !(pos.x == gen->w - 1 && pos.y == gen->h - 2)) { gen->map[pos.y][pos.x] = '*'; while (go_next(gen, &pos, rand() % 4)); } gen->map[pos.y][pos.x] = '*'; gen->map[gen->h - 1][gen->w - 1] = '*'; }
/* Sends all the objects of the list to the filter BIN*/ int send_object_list(list_type *list, int number_of_dimensions, OutputPortHandler port) { list_pointer aux; /* If the first item is not found, it justs returns */ if (!get_first_in_list(list, &aux)) { return 0; } /* Send the first object of the List*/ send_object_values(&(aux->item), number_of_dimensions, port); while (!is_last(aux, list)) { go_next(list, &aux); send_object_values(&(aux->item), number_of_dimensions, port); } return 1; }
__xmlcontext& __xmlcontext::operator++() { go_next(NULL); return *this; }
__xmlcontext __xmlcontext::operator++(int) { __xmlcontext __old = *this; go_next(NULL); return __old; }