Example #1
0
/*
** fin empilage, on depile et calcul
 */
int	depile_all(t_list *op, t_list *nb)
{
  char	*operator;
  char	*nb1;
  char	*nb2;
  char	*newval;
  int	inew_val;
  
  if (my_list_size(op) > 0)
    {
      my_rev_list(&op);
      my_rev_list(&nb);
    }
  while (my_list_size(op) > 0)
    {
      nb1 = nb->data;
      depile(&nb);
      nb2=nb->data;
      depile(&nb);
      operator = op->data;
      depile(&op);
      inew_val = eval(my_getnbr(nb1), *operator, my_getnbr(nb2));
      newval = malloc(sizeof(*newval) * (digit_len(inew_val) + 1));
      my_itoa(inew_val, newval);
      my_put_in_list(&nb, newval);
      free(newval);
    }
  return (my_getnbr(nb->data));
}
Example #2
0
char	*depile_all(char *base, char *operators, t_list *op, t_list *nb)
{
  char	*operator;
  char	*expr1;
  char	*expr2;
 
  if (my_list_size(op) > 0)
    {
      my_rev_list(&op);
      my_rev_list(&nb);
    }
  while (my_list_size(op) > 0)
    {
      operator = op->data;
      depile(&op);
      expr1 = nb->data;
      depile(&nb);
      if (my_list_size(nb) == 0)
	return (special_case_one_expr_only(base, operators, expr1, operator));
      expr2 = nb->data;
      depile(&nb);
      my_put_in_list(&nb, operations(base, operators, expr1, operator, expr2));
  }
  return (nb->data);
}
Example #3
0
static	void	get_object_from_file(char *path,
				     t_object **o, t_object *parent)
{
  t_face		*f;
  t_vertice       	*v;
  t_vertice_n     	*vn;
  double		pt[3][3];
  double		n[3];

  f = NULL;
  v = NULL;
  vn = NULL;
  get_coord(path, &v, &vn, &f);
  my_rev_list(&v);
  my_rev_n(&vn);
  my_rev_f(&f);
  while (f)
    {
      if (copy_tab(pt[0], get_itm(v, vn, 1, f->pos[0])) &&
	  copy_tab(pt[1], get_itm(v, vn, 1, f->pos[1])) &&
	  copy_tab(pt[2], get_itm(v, vn, 1, f->pos[2])) &&
	  copy_tab(n, get_itm(v, vn, 0, f->n)))
	add_triangle(o, pt, n, parent);
      f = f->next;
    }
}
Example #4
0
void		option_d(int ac, char **av, int pos, t_options option)
{
  t_list	*begin;

  begin = option_dlist(ac, av, pos, option);
  if (option.r == 1 && my_list_size(begin) > 1)
    my_rev_list(&begin);
  ls_display(begin, option);
  my_free_list(&begin);
}
Example #5
0
File: my_ls.c Project: girard-r/LS
int	apply_flags(t_file *file, int *apply, char *path)
{
  if (apply[3] == 1)
    display_flag_d(&file, apply, path);
  if (apply[1] == 1)
    my_rev_list(&file);
  if (apply[0] == 1)
    display_detailed_list(&file);
  else
    display_list(&file);
}