static t_lst *pos_pres_s(t_lst *lst, t_data *data) { int count; t_lst *start; t_lst *tmp; if (!data->precision) { free_lst(lst); return (0); } if (lst_len(lst) > data->precision) { start = lst; count = data->precision; while (count > 1) { lst = lst->next; count--; } tmp = lst->next; lst->next = 0; free_lst(tmp); return (start); } return (lst); }
static void suite_print_suite_summary(t_suite *suite) { if (!lst_len(suite->tests)) fprintf(stdout, "[\?\?\?\?]"); else if (suite_count_failed_tests(suite)) fprintf(stdout, C_RED"[FAIL]"C_CLEAR); else fprintf(stdout, C_GREEN"[Ok !]"C_CLEAR); }
int lst_finish(t_lst *lst, t_data *data) { int count; lst = format_lst(lst, data); print_lst(lst); count = lst_len(lst); free_lst(lst); return (count); }
static t_lst *pos_pres_fmt(t_lst *lst, t_data *data) { if (*(data->fmt) == 'p' || (data->hash && ((*(data->fmt) == 'x' || *(data->fmt) == 'X')))) { while (data->precision > lst_len(lst) - 2) lst->next->next = pushfront_lst(lst->next->next, '0'); } if (ft_strchr("idDxXoOuU", *(data->fmt))) { while (lst_len(lst) < data->precision + (lst->c == '-') + (lst->c == '+')) { if (lst->c == '-' || (lst->c == '+')) lst->next = pushfront_lst(lst->next, '0'); else lst = pushfront_lst(lst, '0'); } } return (lst); }
static void proc_apply(process_t *proc, term_t mod, term_t fun, term_t args) { celem_t *ip; int arity = lst_len(args); term_t mdi = intnum(proc->mod_index); term_t off = intnum(proc->ip - proc->code); ip = code_base_lookup(proc->base, mod, fun, arity, &proc->mod_index, &proc->code); if (ip == 0) { *(term_t *)apr_array_push(proc->cstack) = args; *(term_t *)apr_array_push(proc->cstack) = fun; *(term_t *)apr_array_push(proc->cstack) = mod; ip = code_base_lookup(proc->base, A_ERROR_HANDLER, A_UNDEFINED_FUNCTION, 3, &proc->mod_index, &proc->code); } else { // pushing args in reverse order: kludgy term_t l; int i; for (i = 0; i < arity; i++) *(term_t *)apr_array_push(proc->cstack) = AI_UNDEFINED; l = args; i = 0; while (l != nil) { (((term_t *)proc->cstack->elts)[proc->cstack->nelts-i-1]) = lst_value(l); l = lst_next(l); i++; } } *(term_t *)apr_array_push(proc->cstack) = mdi; *(term_t *)apr_array_push(proc->cstack) = off; proc->ip = ip; }