t_lstsel *ft_read(t_sig *sig) { t_lstsel *tmp; char *readc; tmp = sig->lst; readc = ft_memalloc(4); while (readc[0] == 0) read(0, readc, 4); if (readc[0] == 27 && readc[1] == '[') ft_mvflech(readc[2], tmp); else if (readc[0] == ' ') ft_selectopt(tmp); else if (readc[0] == '\n') return (0); else if (readc[0] == 127) tmp = ft_delet(tmp); if (readc[0] == 27 && readc[1] == '\0') { ft_close(sig); exit(0); } free (readc); return (tmp); }
nemo_main() { FunctionTable *ftp; string fmt1, fmode = getparam("mode"); char fmt[100]; real x[MAX_LINES], y; bool Qinv; int i, n, mode=FUNTAB_SPLINE; if (hasvalue("x") && hasvalue("y")) error("Can only handle x= or y="); Qinv = hasvalue("y"); if (streq(fmode,"linear")) mode = FUNTAB_LINEAR; if (Qinv) { n = nemoinpd(getparam("y"),x,MAX_LINES); if (n<0) error("Error # %d parsing y=; or too many?",n); } else { n = nemoinpd(getparam("x"),x,MAX_LINES); if (n<0) error("Error # %d parsing x=; or too many?",n); } fmt1 = getparam("format"); sprintf(fmt,"%s %s\n",fmt1,fmt1); dprintf(1,"Using format=\"%s\"\n",fmt); if (Qinv) ftp = ft_open(getparam("in"), mode, getiparam("ycol"), getiparam("xcol")); else ftp = ft_open(getparam("in"), mode, getiparam("xcol"), getiparam("ycol")); for (i=0; i<n; i++) { if (mode == FUNTAB_LINEAR) y = ft_linear(ftp, x[i]); else if (mode == FUNTAB_SPLINE) y = ft_spline(ftp, x[i]); else error("Bad mode"); printf(fmt,x[i], y); } ft_close(ftp); }
int command_execute_simple(t_list *arg, t_cmd *cmd, t_env *env, t_dir *dir) { int *fd; int save[2]; int ret; save[0] = dup(0); save[1] = dup(1); fd = ft_init_fd(arg); if (fd == NULL) return (1); ret = ft_execute(arg, cmd, env, dir); ft_close(fd); ft_reverse_fd(save); free(fd); return (ret); }
int key_hook(int keycode, t_env *e) { if (keycode == 53) { mlx_destroy_window(e->mlx, e->win); ft_close(e); } if (keycode == 18) e->cam->fov += -10; if (keycode == 19) e->cam->fov += 10; if (keycode == 20) e->space += -2; if (keycode == 21) e->space += 2; key_rotation(keycode, e); key_move(keycode, e); draw(e); return (0); }
int ft_key_press(int keycode, t_glob *gl) { if (keycode == 257) gl->sprint = 1; if (keycode == 53) ft_close(gl); if (keycode == 13) gl->move_front = 1; if (keycode == 0) gl->move_left = 1; if (keycode == 1) gl->move_back = 1; if (keycode == 2) gl->move_right = 1; if (keycode == 123) gl->rot_left = 1; if (keycode == 124) gl->rot_right = 1; return (0); }