-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_getpoint12.c
45 lines (41 loc) · 1.56 KB
/
ft_getpoint12.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_getpoint12.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: syusof <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/27 09:28:59 by syusof #+# #+# */
/* Updated: 2016/11/21 15:25:55 by syusof ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
void ft_getpoint12(t_env2 *env2, char *line, int j, t_ca *c1)
{
char *s1;
s1 = NULL;
while (line[c1->i] && env2->error == 0 && line[c1->i] != '\t'
&& line[c1->i] != ' ')
{
if (ft_checkint(&(line[c1->i])))
{
c1->start = c1->i;
while (line[c1->i] && (ft_isdigit(line[c1->i]) || line[c1->i] == '+'
|| line[c1->i] == '-'))
c1->i++;
ft_getpoint3(env2, j, c1->k);
s1 = ft_strsub(line, c1->start, c1->i - c1->start);
c1->tmp = ft_atoi(s1);
ft_free(&s1);
((env2)->doub1)[j][c1->k].z = c1->tmp;
c1->k++;
}
else
env2->error = 1;
}
}
void ft_getpoint3(t_env2 *env2, int j, int k)
{
((env2)->doub1)[j][k].x = k;
((env2)->doub1)[j][k].y = j;
}